chore: migrate to unique git repo

This commit is contained in:
xeals 2019-01-15 11:20:10 +11:00
commit 492c91a204
19 changed files with 3583 additions and 0 deletions

1
autostart Symbolic link
View File

@ -0,0 +1 @@
../autostart.sh

42
cfg.fnl Normal file
View File

@ -0,0 +1,42 @@
(local fun (require :lib.fun))
(local awful (require :awful))
(require :awful.autofocus)
(local naughty (require :naughty))
(local beautiful (require :beautiful))
(beautiful.init (require :conf.theme))
(require :module.decorate)
(require :module.sidebar)
(require :conf.client)
(require :conf.tags)
(_G.root.keys (require :conf.keys))
;; TEMP Next release should support this through `beautiful'.
(set naughty.config.defaults.border_width beautiful.notification_border_width)
(set naughty.config.defaults.icon_size beautiful.notification_icon_size)
;;;
;; Post-config -- wiring it all up
(->> {:manage (lambda [c] nil
(when (and awesome.startup
(not c.size_hints.user_position)
(not c.size_hints.program_position))
;; Prevent clients from being unreachable after screen count changes.
(awful.placement.no_offscreen c)))
:mouse::enter (lambda [c]
(when (and (~= (awful.layout.get c.screen)
awful.layout.suit.magnifier)
(awful.client.focus.filter c))
(set client.focus c)))
:focus (lambda [c] (set c.border_color beautiful.border_focus))
:unfocus (lambda [c] (set c.border_color beautiful.border_normal))}
(fun.each (fn [event callback] (client.connect_signal event callback))))
(awful.spawn.with_shell "~/.config/awesome/autostart")
;; Empty return
{}

9
conf/apps.fnl Normal file
View File

@ -0,0 +1,9 @@
;;; conf/apps.fnl --- Common program parameters
;;; Code:
{:terminal "xfce4-terminal"
:dropdown "xfce4-terminal --drop-down"
:editor "emacs"
:rofi "rofi -show drun"}
;;; conf/apps.fnl ends here

1
conf/client.fnl Normal file
View File

@ -0,0 +1 @@
(require :conf.client.rules)

17
conf/client/buttons.fnl Normal file
View File

@ -0,0 +1,17 @@
;;; buttons.fnl --- Client buttons
;;; Code:
(var buttons {})
(local awful (require :awful))
(local gears (require :gears))
(local button (. (require :lib.keys) :button))
(gears.table.join
(button [] 1 (lambda [c] (set client.focus c) (: c :raise)))
(button [:mod] 1 awful.mouse.client.move)
(button [:mod] 3 awful.mouse.client.resize))
;;; buttons.fnl ends here

45
conf/client/keys.fnl Normal file
View File

@ -0,0 +1,45 @@
;;; conf/client/keys.fnl --- Client keys
;;; Code:
(var keys {})
(local awful (require :awful))
(local beautiful (require :beautiful))
(local gears (require :gears))
(local key (. (require :lib.keys) :key))
;;;
;; Functions
(fn register [field ...]
(tset keys field (gears.table.join ...)))
(fn cinv [k]
(fn [c]
(let [v (. c k)]
(tset c k (not v)))))
;;;
;; Configuration
(register :client
(key [:mod] :q (lambda [c] (: c :kill)))
(key [:mod] :w (lambda [c] (set c.minimized true)))
(key [:mod] :t (lambda [c] (awful.titlebar.toggle c beautiful.titlebar_position)))
(key [:mod :shift] :t (lambda [c] (awful.titlebar.toggle c :left)))
(key [:mod :ctrl] :t (lambda [c] (awful.titlebar.toggle c)))
(key [:mod] :a (cinv :floating))
(key [:mod] :f (cinv :fullscreen))
(key [:mod] :m (cinv :maximized)) ;; FIXME behaves weird
(key [:mod] :s (cinv :sticky)))
(register :floating
(. keys :client)
(key [:alt :shift] :h (lambda [c] (: c :relative_move {:x -100}))))
keys
;;; conf/client/keys.fnl ends here

51
conf/client/rules.fnl Normal file
View File

@ -0,0 +1,51 @@
;;; conf/client/rules.fnl --- Client placement rules
;;; Code:
(local awful (require :awful))
(local beautiful (require :beautiful))
(local keys (require :conf.client.keys))
(local buttons (require :conf.client.buttons))
;;;
;; Functions
(local
rules
[{:rule {}
:properties {:border_width beautiful.border_width
:border_color beautiful.border_normal
:focus true
:keys (. keys :client)
:buttons buttons
:placement (+ awful.placement.no_overlap
awful.placement.no_offscreen)}}
{:rule {:floating true}
:properties {:keys (. keys :floating)}}
;; Floating clients.
{:rule_any {:class ["Gpick"]
:name ["Event Tester"] ;; xev
:role ["pop-up"
"xfce4-terminal-dropdown"]}
:properties {:floating true}}
;; Add titlebars to normal clients and dialogs.
{:rule_any {:type ["normal" "dialog"]}
:properties {:titlebars_enabled true}}
;; Awesome reserves space for tint2, but doesn't actually fucking place it.
{:rule {:class "Tint2"}
:properties {:x 0 :y 0}}
;; Set Firefox to always map on the tag named "2" on screen 1.
;; {:rule {:class "Firefox"}
;; :properties {:screen 1 :tag "2"}}
])
(tset awful.rules :rules rules)
{}
;;; conf/client/rules.fnl ends here

119
conf/keys.fnl Normal file
View File

@ -0,0 +1,119 @@
;;; conf/keys.fnl --- Global keys
;;; Code:
(var keys {})
(local gears (require :gears))
(local awful (require :awful))
(local apps (require :conf.apps))
(local key (. (require :lib.keys) :key))
;;;
;; Functions
(fn register [...]
(set keys (gears.table.join keys ...)))
;; Spawn lamda
(fn run [prog]
(fn [] (awful.spawn prog)))
;; Run silent
(fn run! [prog]
(fn [] (awful.spawn prog false)))
(fn playerctl [a]
(run! (.. "playerctl " a)))
(fn mpc [a]
(run! (.. "mpc " a)))
(fn amixer [args]
(run! (.. "amixer sset Master " args)))
(fn light [a v]
(let [flag (. {:up "-A" :down "-U"} a)]
(run! (.. "light " flag " " (tostring v)))))
(fn with-tag [i fun]
(lambda [] (when client.focus
(let [tag (. client.focus.screen.tags i)]
(when tag
(fun tag))))))
(fn apply-focus [i attr]
(with-tag i (lambda [t] (: client.focus attr t))))
(fn current-tag []
(. (awful.screen.focused) :selected_tag))
(fn focused-tag-by-index [i]
(. (awful.screen.focused) :tags i))
(fn with-focused-tag [i fun]
(lambda [] (let [tag (focused-tag-by-index i)]
(when tag
(fun tag)))))
(fn focus [c]
(when c
(set client.focus c)
(: c :raise)))
;;;
;; Configuration
(register
(key [:mod :ctrl :shift] :q awesome.quit)
(key [:mod :ctrl] :r awesome.restart)
(key [:mod :ctrl] :q (run "oblogout"))
(key [:mod] :equal (lambda []
(doto (current-tag)
(tset :master_width_factor 0.5)
(tset :master_count 1)
(tset :column_count 1))))
(key [:mod :ctrl] :l (lambda [] (awful.tag.incmwfact 0.05)))
(key [:mod :ctrl] :h (lambda [] (awful.tag.incmwfact -0.05)))
(key [:mod] :comma (lambda [] (awful.tag.incnmaster 1 nil true)))
(key [:mod] :period (lambda [] (awful.tag.incnmaster -1 nil true)))
(key [:mod :ctrl] :period (lambda [] (awful.tag.incncol 1 nil true)))
(key [:mod :ctrl] :comma (lambda [] (awful.tag.incncol -1 nil true)))
(key [:mod] :Return (run apps.terminal))
(key [:mod] :d (run apps.dropdown))
(key [:mod] :space (lambda [] (awful.layout.inc 1)))
(key [:mod] :r (run apps.rofi))
(key [:mod] :p (run "xfce4-display-settings"))
(key [:mod] :e (run apps.editor))
(key [:mod] :BackSpace (lambda [] (focus (awful.client.restore))))
(key [] :XF86AudioPlay (playerctl :play-pause))
(key [] :XF86AudioNext (playerctl :next))
(key [] :XF86AudioPrev (playerctl :previous))
(key [] :XF86AudioRaiseVolume (amixer "5%+"))
(key [] :XF86AudioLowerVolume (amixer "5%-"))
(key [] :XF86AudioMute (amixer "toggle"))
(key [] :XF86MonBrightnessUp (light :up 5))
(key [] :XF86MonBrightnessDown (light :down 5)))
(each [_key dir (pairs {:h :left :j :down :k :up :l :right})]
(register
(key [:mod] _key (lambda [] (awful.client.focus.bydirection dir)))
(key [:mod :shift] _key (lambda [] (awful.client.swap.bydirection dir)))))
(for [i 1 9]
(let [ksym (.. "#" (+ i 9))]
(register
(key [:mod] ksym (with-focused-tag i (lambda [t] (: t :view_only))))
(key [:mod :ctrl] ksym (with-focused-tag i (lambda [t] (awful.tag.viewtoggle t))))
(key [:mod :shift] ksym (apply-focus i :move_to_tag))
(key [:mod :ctrl :shift] ksym (apply-focus i :toggle_tag)))))
keys
;;; conf/keys.fnl ends here

10
conf/rules.fnl Normal file
View File

@ -0,0 +1,10 @@
;;; rules.fnl --- Rule definitions
;;; Code:
(var rules {})
rules
;;; rules.fnl ends here

21
conf/tags.fnl Normal file
View File

@ -0,0 +1,21 @@
;;; conf/tags.fnl --- Tag configuration
;;; Code:
(local awful (require :awful))
;;;
;; Configuration
(local layouts [awful.layout.suit.tile
awful.layout.suit.floating])
(set awful.layout.layouts layouts)
(awful.screen.connect_for_each_screen
(lambda [s]
(awful.tag ["1", "2", "3", "4", "5", "6", "7", "8", "9"]
s (. layouts 1))))
{}
;;; conf/tags.fnl ends here

35
conf/theme.fnl Normal file
View File

@ -0,0 +1,35 @@
;; Have to use underscores for `beautiful' compat.
;; Non-beautiful variables are commented with an asterisk.
{
:font "Sarasa Mono J"
:variable_font "Sarasa UI J"
:sidebar_position :left ;; *
:sidebar_width 36 ;; *
:sidebar_bg "#1a1e24" ;; *
:sidebar_subbox "#252b33" ;; *
:bg_focus "#252b33"
:bg_normal "#1a1e24"
:fg_focus "#cfcfcf"
:fg_normal "#cfcfcf"
:useless_gap 0
:border_width 0
:border_focus "#5bb3b4"
:border_normal "#1a1e24"
:use_titlebars_for_borders nil ;; *
:titlebar_border_width 1 ;; *
:titlebar_position :left ;; *
:titlebar_size 15 ;; *
:titlebar_bg_focus "#926b3e"
:titlebar_bg_normal "#252b33"
:titlebar_fg_focus "#1a1e24"
:titlebar_fg_normal "#cfcfcf"
:icon_theme "Vertex Maia"
:notification_icon_size 48
:notification_border_width 0
:notification_bg "#252b33"
}

8
lib/README.md Normal file
View File

@ -0,0 +1,8 @@
## lib
These would normally be installed by `luarocks`; however, given how central they are to the config, they are vendored in instead.
### Versions
- `fennel`: 0.1.1-2
- `fun`: 0.1.3-1

1964
lib/fennel.lua Normal file

File diff suppressed because it is too large Load Diff

1056
lib/fun.lua Normal file

File diff suppressed because it is too large Load Diff

35
lib/keys.fnl Normal file
View File

@ -0,0 +1,35 @@
;;; lib/keys.fnl --- Key configuration utilities
;;; Commentary:
;; Comments
;;; Code:
(var keys {})
(local awful (require :awful))
(local fun (require :lib.fun))
(local modifiers
{:mod "Mod4"
:alt "Mod1"
:super "Mod4"
:shift "Shift"
:ctrl "Control"})
;;;
;; Functions
(fn map-mods [mods]
(->> mods
(fun.map (partial . modifiers))
(fun.totable)))
(fn keys.key [mods kc fun]
(awful.key (map-mods mods) kc fun))
(fn keys.button [mods bc fun]
(awful.button (map-mods mods) bc fun))
keys
;;; lib/keys.fnl ends here

17
lib/std.fnl Normal file
View File

@ -0,0 +1,17 @@
;;; std.fnl --- A small standard library
;;; Commentary:
;; Porting a few functions that I'm used to from other Lisps.
;;; Code:
(var std {})
;;;
;; Functions
(fn std.zero? [n]
(= 0 n))
std
;;; std.fnl ends here

74
module/decorate.fnl Normal file
View File

@ -0,0 +1,74 @@
;;; decorate.fnl --- Client decorations
;;; Commentary:
;; Comments
;;; Code:
(local awful (require :awful))
(local beautiful (require :beautiful))
(local gears (require :gears))
(local wibox (require :wibox))
(local std (require :lib.std))
;; TODO Properly abstract these into a library
(local fun (require :lib.fun))
(local modifiers
{:mod "Mod4"
:alt "Mod1"
:super "Mod4"
:shift "Shift"
:ctrl "Control"})
(fn map-mods [mods]
(->> mods
(fun.map (partial . modifiers))
(fun.totable)))
(fn button [mods bc fun]
(awful.button (map-mods mods) bc fun))
;;;
;; Functions
(fn mouse-button [c bc cmd]
(button [] bc (lambda []
(: c :emit_signal
:request::activate :titlebar {:raise true})
((. awful.mouse.client cmd) c))))
(fn make-titlebar [c side -size]
(let [size (or -size beautiful.titlebar_size 10)]
(awful.titlebar c {:size size :position side})))
(fn setup-empty-titlebar [bar buttons]
;; Placeholder layouts
(: bar :setup
{1 {:layout wibox.layout.fixed.vertical}
2 {:buttons buttons
:layout wibox.layout.flex.vertical}
3 {:layout (wibox.layout.fixed.vertical)}
:layout wibox.layout.align.vertical}))
(fn titlebar-hook [c]
(let [buttons (gears.table.join
(mouse-button c 1 :move)
(mouse-button c 3 :resize))
mainbar (make-titlebar c beautiful.titlebar_position)]
(setup-empty-titlebar mainbar buttons)
(when (and (not (std.zero? beautiful.titlebar_border_width))
beautiful.use_titlebars_for_borders)
(let [size beautiful.titlebar_border_width]
(each [_ side (ipairs [:top :right :bottom])]
(setup-empty-titlebar (make-titlebar c side size) buttons))))))
;;;
;; Processing
(_G.client.connect_signal :request::titlebars titlebar-hook)
{}
;;; decorate.fnl ends here

74
module/sidebar.fnl Normal file
View File

@ -0,0 +1,74 @@
;;; module/sidebar.fnl --- Informational sidebar
;;; Code:
(local awful (require :awful))
(local beautiful (require :beautiful))
(local wibox (require :wibox))
(local sb-clock (wibox.widget.textclock "%H\n%M"))
(local sb-systray (doto (wibox.widget.systray)
(: :set_base_size 24)))
(local fill-width (doto (wibox.layout.fixed.horizontal)
(: :fill_space true)
(: :set_spacing 10)))
(local bounding (wibox.container.margin
(wibox.container.place
(wibox.container.margin
nil
10 10 10 10 beautiful.sidebar_subbox))
1 1 1 1 beautiful.sidebar_bg))
;;;
;; Functions
(fn draw-sidebar [s]
(set s.sb-tag (awful.widget.taglist
{:screen s
:filter awful.widget.taglist.filter.selected
:style {:font (.. beautiful.font " Bold 10")}
;; :widget_template
;; {1
;; {:id "index_role"
;; :widget wibox.widget.textbox}
;; :widget wibox.container.margin
;; :margins 5
;; :create_callback
;; (lambda [self, c3, index, objects])}
:layout wibox.layout.fixed.vertical
}
))
(set s.sb-tasks (awful.widget.tasklist
{:screen s
:filter awful.widget.tasklist.filter.currenttags
:style {:disable_task_name true}
}))
(set s.sb (awful.wibar {:position beautiful.sidebar_position
:width beautiful.sidebar_width
:screen s}))
(: s.sb :setup
{:layout wibox.layout.align.vertical
1 {:layout wibox.layout.fixed.vertical
1 {1 s.sb-tag
:halign "center"
:layout (wibox.container.margin nil 10 10 10 10)}
2 s.sb-tasks}
2 {:layout wibox.layout.fixed.vertical}
3 {:layout wibox.layout.fixed.vertical
1 sb-systray
2 {1 sb-clock
:valign "center"
:halign "center"
:layout bounding}}}))
;;;
;; Configuration
;; (awful.screen.connect_for_each_screen
;; draw-sidebar)
{}
;;; module/sidebar.fnl ends here

4
rc.lua Normal file
View File

@ -0,0 +1,4 @@
local fennel = require("lib.fennel")
fennel.path = fennel.path .. ";.config/awesome/?.fnl"
table.insert(package.loaders or package.searchers, fennel.searcher)
require("cfg") -- .config/awesome/cfg.fnl