Compare commits

..

29 Commits

Author SHA1 Message Date
f53c4c61d4 feat: add base fennel config 2019-02-10 21:58:09 +11:00
c02b6ef68d feat: dirty update 2019-02-10 21:57:46 +11:00
ba2284cb65 feat(theme): minor update 2019-01-18 10:31:37 +11:00
3ee9ce2897 feat(autostart): set numlock 2019-01-18 10:31:16 +11:00
fdcffa9650 feat: wire up buttons for tag list 2019-01-18 10:30:58 +11:00
4ac05d48a6 feat(sidebar): use tag number widget 2019-01-16 00:28:27 +11:00
3017ac7e16 refactor(sidebar): abstract tooltips into function 2019-01-15 22:58:30 +11:00
0bbff9ba62 feat(rules): float orage 2019-01-15 22:53:04 +11:00
ef457f30af fix(rules): let emacs/terminal/etc resize freely 2019-01-15 22:52:58 +11:00
07e372b31c feat(sidebar): add buttons and tooltips 2019-01-15 22:51:07 +11:00
dea630bf1e refactor: remove duplicate code from decoration module 2019-01-15 22:17:06 +11:00
3a51bab1c8 fix: reduce size of battery icon widget 2019-01-15 21:34:21 +11:00
41c431d40f feat: fall back to beautiful.font for textclock 2019-01-15 21:34:04 +11:00
80cc22804b feat(sidebar): add task list 2019-01-15 21:34:01 +11:00
d7186976a8 feat(autostart): use some async processes 2019-01-15 21:33:14 +11:00
8f33221d1d feat: remove handling of audio keys
Leaving for pa-applet
2019-01-15 21:32:40 +11:00
1cb2eb5940 feat: set awful.util.terminal correctly 2019-01-15 21:32:06 +11:00
0ce7fe3cb4 fix: use xfce4-notifyd for dbus notifications 2019-01-15 21:31:45 +11:00
5b4584f17a fix: make systray behave as it should 2019-01-15 17:24:06 +11:00
e6fd7b5613 feat(autostart): implement in awesome itself 2019-01-15 17:21:27 +11:00
d377a56780 refactor(sidebar): split battery and pulse widgets out 2019-01-15 17:07:30 +11:00
0bde007468 feat(sidebar): add volume widget 2019-01-15 17:01:14 +11:00
04f619499d feat(sidebar): add battery icon 2019-01-15 16:34:04 +11:00
867f3434f3 feat(std): add string splitter 2019-01-15 15:57:44 +11:00
818b38bef7 feat: vendor in lain 2019-01-15 15:57:39 +11:00
7b21018a59 feat: add tint2ish tag list and clock to sidebar 2019-01-15 15:15:39 +11:00
54230c55dd feat: add init.fnl to search paths 2019-01-15 13:42:07 +11:00
da0a6ad0b9 feat: downgrade to stable release 2019-01-15 12:00:18 +11:00
5b93b8f766 refactor(sidebar): split tag/task list out 2019-01-15 11:37:47 +11:00
33 changed files with 1171 additions and 118 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "lain"]
path = lain
url = gh:lcpz/lain

16
cfg.fnl
View File

@ -2,13 +2,20 @@
(local awful (require :awful)) (local awful (require :awful))
(require :awful.autofocus) (require :awful.autofocus)
(local naughty (require :naughty))
(local beautiful (require :beautiful)) (local beautiful (require :beautiful))
(beautiful.init (require :conf.theme)) ;; HACK Use xfce4-notifyd for dbus integration.
;; Purely for pa-applet until a better solution is found.
(local _dbus dbus)
(set _G.dbus nil)
(local naughty (require :naughty))
(set _G.dbus _dbus)
(beautiful.init (require :theme))
(require :module.decorate) (require :module.decorate)
(require :module.sidebar) (require :module.sidebar)
(require :module.autostart)
(require :conf.client) (require :conf.client)
(require :conf.tags) (require :conf.tags)
@ -18,6 +25,8 @@
(set naughty.config.defaults.border_width beautiful.notification_border_width) (set naughty.config.defaults.border_width beautiful.notification_border_width)
(set naughty.config.defaults.icon_size beautiful.notification_icon_size) (set naughty.config.defaults.icon_size beautiful.notification_icon_size)
(tset awful.util :terminal (. (require :conf.apps) :terminal))
;;; ;;;
;; Post-config -- wiring it all up ;; Post-config -- wiring it all up
@ -36,7 +45,4 @@
:unfocus (lambda [c] (set c.border_color beautiful.border_normal))} :unfocus (lambda [c] (set c.border_color beautiful.border_normal))}
(fun.each (fn [event callback] (client.connect_signal event callback)))) (fun.each (fn [event callback] (client.connect_signal event callback))))
(awful.spawn.with_shell "~/.config/awesome/autostart")
;; Empty return
{} {}

473
cfg.orig.fnl Normal file
View File

@ -0,0 +1,473 @@
(let [;; Standard awesome library
gears (require :gears)
awful (require :awful)
;; Widget and layout library
wibox (require :wibox)
;; Theme handling library
beautiful (require :beautiful)
;; Notification library
naughty (require :naughty)
menubar (require :menubar)
hotkeys-popup (. (require :awful.hotkeys_popup) :widget)]
(require :awful.autofocus)
;; Enable hotkeys help client widget for VIM and other apps
;; when client with a matching name is open
(require :awful.hotkeys_popup.keys)
;; {{{ Error handling
;; Check if aweseom encountered an error during startup and fell back to
;; another config (This code will only ever execute for the fallback config)
(when awesome.startup_errors
(naughty.notify {:preset naughty.config.presets.critical
:title "Oops, there were errors during startup!"
:text awesome.startup_errors}))
;; Handle runtime errors after startup
(do
(var error? false)
(awesome.connect_signal
"debug::error"
(lambda [err]
(when (not error?)
(set error? true)
(naughty.notify {:preset naughty.config.presets.critical
:title "Oops, an error happened!"
:text (tostring err)})
(set error? false)))))
;; }}}
;;{{{ Variable definitions
;; Themes define colours, icons, font, and wallpapers.
(beautiful.init (.. (gears.filesystem.get_themes_dir) "default/theme.lua"))
;; This is used later as the default terminal and editor to run.
(local terminal "xterm")
(local editor (or (os.getenv "EDITOR")
"nano"))
(local editor-cmd (.. terminal " -e " editor))
;; Default modkey.
;; Usually, Mod4 is the key with a logo between Control and Alt.
;; If you do not like this or do not have such a key,
;; I suggest you to remap Mod4 to another key using xmodmap or other tools.
;; However, you can use another modifier like Mod1, but it may interact with others.
(local modkey "Mod4")
;; Table of layouts to cover with awful.layout.inc, order matters.
(set awful.layout.layouts
[awful.layout.suit.floating
awful.layout.suit.tile
awful.layout.suit.tile.left
awful.layout.suit.tile.bottom
awful.layout.suit.tile.top
awful.layout.suit.fair
awful.layout.suit.fair.horizontal
awful.layout.suit.spiral
awful.layout.suit.spiral.dwindle
awful.layout.suit.max
awful.layout.suit.max.fullscreen
awful.layout.suit.magnifier
awful.layout.suit.corner.nw
;; awful.layout.suit.corner.ne
;; awful.layout.suit.corner.sw
;; awful.layout.suit.corner.se
])
;; }}}
;; {{{ Helper functions
(fn client-menu-toggle-fn []
(var instance nil)
(lambda []
(if (and instance (. instance :wibox :visible))
(do (: instance :hide)
(set instance nil))
(set instance (awful.menu.clients {:theme {:width 250}})))))
;; }}}
;; {{{ Menu
;; Create a launcher widget and a main menu
(local myawesomemenu
[["hotkeys" (lambda [] (values false hotkeys-popup.show_help))]
["manual" (.. terminal "-e man awesome")]
["edit config" (.. editor-cmd " " awesome.conffile)]
["restart" awesome.restart]
["quit" (lambda [] (awesome.quit))]])
(local mymainmenu
(awful.menu {:items [["awesome" myawesomemenu beautiful.awesome_icon]
["open terminal" terminal]]}))
(local mylauncher
(awful.widget.launcher {:image beautiful.awesome_icon
:menu mymainmenu}))
;; Menubar configuration
(set menubar.utils.terminal terminal) ;; Set the terminal for applications that require it
;; }}}
;; Keyboard map indicator and switcher
(local mykeyboardlayout (awful.widget.keyboardlayout))
;; {{{ Wibar
;; Create a textclock widget
(local mytextclock (wibox.widget.textclock))
;; Create a wibox for each screen and add it
(local
taglist-buttons
(gears.table.join
(awful.button [] 1 (lambda [t] (: t :view_only)))
(awful.button [modkey] 1
(lambda [t] (when client.focus (: client.focus :move_to_tag t))))
(awful.button [] 3 awful.tag.viewtoggle)
(awful.button [modkey] 3
(lambda [t] (when client.focus (: client.focus :toggle_tag t))))
(awful.button [] 4 (lambda [t] (awful.tag.viewnext t.screen)))
(awful.button [] 5 (lambda [t] (awful.tag.viewprev t.screen)))))
(local
tasklist-buttons
(gears.table.join
(awful.button
[] 1 (lambda [c] (if (= c client.focus)
(set c.minimized true)
(do
;; Without this, the following
;; :isvisible makes no sense
(set c.minimized false)
(when (and (not (: c :isvisible))
c.first_tag)
(: c.first_tag :view_only)
;; This will also un-minimize
;; the client, if needed
(set client.focus c)
(: c :raise))))))
(awful.button [] 3 (client-menu-toggle-fn))
(awful.button [] 4 (lambda [] (awful.client.focus.byidx 1)))
(awful.button [] 5 (lambda [] (awful.client.focus.byidx -1)))))
(fn set-wallpaper [s]
(when beautiful.wallpaper
(var wallpaper beautiful.wallpaper)
(when (= (type wallpaper) :function)
(set wallpaper (wallpaper s)))
(gears.wallpaper.maximized wallpaper s true)))
;; Re-set wallpaper when a screen's geometry changes (e.g. different resolution)
(screen.connect_signal "property::geometry" set-wallpaper)
(awful.screen.connect_for_each_screen
(lambda [s]
;; Wallpaper
(set-wallpaper s)
;; Each screen has its own tag table.
(awful.tag ["1", "2", "3", "4", "5", "6", "7", "8", "9"]
s (. awful.layout.layouts 1))
;; Create a promptbox for each screen
(set s.mypromptbox (awful.widget.prompt))
;; Create an imagebox widget which will contain an icon indicating which layout we're using.
;; We need one layout box per screen.
(set s.mylayoutbox (awful.widget.layoutbox s))
(: s.mylayoutbox :buttons
(gears.table.join
(awful.button [] 1 (lambda [] (awful.layout.inc 1)))
(awful.button [] 3 (lambda [] (awful.layout.inc -1)))
(awful.button [] 4 (lambda [] (awful.layout.inc 1)))
(awful.button [] 5 (lambda [] (awful.layout.inc -1)))))
;; Create a taglist widget
(set s.mytaglist (awful.widget.taglist s awful.widget.taglist.filter.all
taglist-buttons))
;; Create a tasklist widget
(set s.mytasklist (awful.widget.tasklist s awful.widget.tasklist.filter.currenttags
tasklist-buttons))
;; Create the wibox
(set s.mywibox (awful.wibar {:position "top" :screen s}))
;; Add widgets to the wibox
;; XXX Adding numbers is required workaround for mixed named and not tables.
;; Alternative is to construct table and then tset the named entry(s).
(: s.mywibox :setup
{:layout wibox.layout.align.horizontal
1 { ;; Left widgets
:layout wibox.layout.fixed.horizontal
1 mylauncher
2 s.mytaglist
3 s.mypromptbox}
2 s.mytasklist ;; Middle widget
3 {;;Right widgets
:layout wibox.layout.fixed.horizontal
1 mykeyboardlayout
2 (wibox.widget.systray)
3 mytextclock
4 s.mylayoutbox}})))
;; }}}
;; {{{ Mouse bindings
(root.buttons (gears.table.join
(awful.button [] 3 (lambda [] (: mymainmenu :toggle)))
(awful.button [] 4 awful.tag.viewnext)
(awful.button [] 5 awful.tag.viewprev)))
;;}}}
;; {{{ Key bindings
(var
globalkeys
(gears.table.join
(awful.key [modkey] :s hotkeys-popup.show_help
{:description "show help" :group "awesome"})
(awful.key [modkey] :Left awful.tag.viewprev
{:description "view previous" :group "tag"})
(awful.key [modkey] :Right awful.tag.viewnext
{:description "view next" :group "tag"})
(awful.key [modkey] :Escape awful.tag.history.restore
{:description "go back" :group "tag"})
(awful.key [modkey] :j (lambda [] (awful.client.focus.byidx 1))
{:description "focus next by index" :group "client"})
(awful.key [modkey] :k (lambda [] (awful.client.focus.byidx -1))
{:description "focus previous by index" :group "client"})
(awful.key [modkey] :w (lambda [] (: mymainmenu :show))
{:description "show main menu" :group "awesome"})
;; Layout manipulation
(awful.key [modkey :Shift] :j (lambda [] (awful.client.swap.byidx 1))
{:description "swap with next client by index", :group "client"})
(awful.key [modkey :Shift] :k (lambda [] (awful.client.swap.byidx -1))
{:description "swap with previous client by index", :group "client"})
(awful.key [modkey :Control] :j (lambda [] (awful.screen.focus_relative 1))
{:description "focus the next screen", :group "screen"})
(awful.key [modkey :Control] :k (lambda [] (awful.screen.focus_relative -1))
{:description "focus the previous screen", :group "screen"})
(awful.key [modkey] :u awful.client.urgent.jumpto
{:description "jump to urgent client" :group "client"})
(awful.key [modkey] :Tab (lambda []
(awful.client.focus.history.previous)
(when client.focus (: client.focus :raise)))
{:description "go back" :group "client"})
;; Standard program
(awful.key [modkey] :Return (lambda [] (awful.spawn terminal))
{:description "open a terminal" :group "launcher"})
(awful.key [modkey :Control] :r awesome.restart
{:description "reload awesome" :group "awesome"})
(awful.key [modkey :Shift] :q awesome.quit
{:description "quit awesome" :group "awesome"})
(awful.key [modkey] :l (lambda [] (awful.tag.incmwfact 0.05))
{:description "increase master width factor" :group "layout"})
(awful.key [modkey] :h (lambda [] (awful.tag.incmwfact -0.05))
{:description "decrease master width factor" :group "layout"})
(awful.key [modkey :Shift] :h (lambda [] (awful.tag.incnmaster 1 nil true))
{:description "increase the number of master clients" :group "layout"})
(awful.key [modkey :Shift] :l (lambda [] (awful.tag.incnmaster -1 nil true))
{:description "decrease the number of master clients" :group "layout"})
(awful.key [modkey :Control] :h (lambda [] (awful.tag.incncol 1 nil true))
{:description "increase the number of columns" :group "layout"})
(awful.key [modkey :Control] :l (lambda [] (awful.tag.incncol -1 nil true))
{:description "decrease the number of columns" :group "layout"})
(awful.key [modkey] :space (lambda [] (awful.layout.inc 1))
{:description "select next" :group "layout"})
(awful.key [modkey :Shift] :space (lambda [] (awful.layout.inc -1))
{:description "select previous" :group "layout"})
(awful.key [modkey :Control] :n
(lambda [] (let [c (awful.client.restore)]
;; Focus restored client
(when c
(set client.focus c)
(: c :raise))))
{:description "restore minimized" :group "client"})
;; Prompt
(awful.key [modkey] :r (lambda [] (: (. (awful.screen.focused) :mypromptbox) :run))
{:description "run prompt" :group "launcher"})
(awful.key [modkey] :x
(lambda [] (awful.prompt.run
{:prompt "Run Lua code: "
:textbox (. (awful.screen.focused) :mypromptbox :widget)
:exe_callback awful.util.eval
:history_path (.. (awful.util.get_cache_dir) "/history_eval")}))
{:description "lua execute prompt" :group "awesome"})
;; Menubar
(awful.key [modkey] :p (lambda [] (menubar.show))
{:description "show the menubar" :group "launcher"})))
(local
clientkeys
(gears.table.join
(awful.key [modkey] :f (lambda [c] (set c.fullscreen (not c.fullscreen)) (: c :raise))
{:description "toggle fullscreen" :group "client"})
(awful.key [modkey :Shift] :c (lambda [c] (: c :kill))
{:description "close" :group "client"})
(awful.key [modkey :Control] :space awful.client.floating.toggle
{:description "toggle floating" :group "client"})
(awful.key [modkey :Control] :Return (lambda [c] (: c :swap (awful.client.getmaster)))
{:description "move to master" :group "client"})
(awful.key [modkey] :o (lambda [c] (: c :move_to_screen))
{:description "move to screen" :group "client"})
(awful.key [modkey] :t (lambda [c] (set c.ontop (not c.ontop)))
{:description "toggle keep on top" :group "client"})
(awful.key [modkey] :n (lambda [c] (set c.minimized true))
;; The client currently has the input focus, so it cannot be
;; minimized, since minimized clients can't have the focus
{:description "minimize" :group "client"})
(awful.key [modkey] :m (lambda [c] (set c.maximized (not c.maximized)) (: c :raise))
{:description "(un)maximize" :group "client"})
(awful.key [modkey :Control] :m
(lambda [c]
(set c.maximized_vertical (not c.maximized_vertical))
(: c :raise))
{:description "(un)maximize vertically" :group "client"})
(awful.key [modkey :Shift] :m
(lambda [c]
(set c.maximized_horizontal (not c.maximized_horizontal))
(: c :raise))
{:description "(un)maximize horizontally" :group "client"})))
;; Bind all keys numbers to tags.
;; Be careful: we use keycodes to make it work on any keyboard layout.
;; This should ma on the top row of your keyboard, usually 1 to 9.
(for [i 1 9]
(set
globalkeys
(gears.table.join
globalkeys
;; View tag only.
(awful.key [modkey] (.. "#" (+ i 9))
(lambda [] (let [screen (awful.screen.focused)
tag (. screen.tags i)]
(when tag
(: tag :view_only))))
{:description (.. "view tag #" i) :group "tag"})
;; Toggle tag display.
(awful.key [modkey :Control] (.. "#" (+ i 9))
(lambda [] (let [screen (awful.screen.focused)
tag (. screen.tags i)]
(when tag
(awful.tag.viewtoggle tag))))
{:description (.. "toggle tag #" i) :group "tag"})
;; Move client to tag.
(awful.key [modkey :Shift] (.. "#" (+ i 9))
(lambda [] (when client.focus
(let [tag (. client.focus.screen.tags i)]
(when tag
(: client.focus :move_to_tag tag)))))
{:description (.. "move focused client to tag #" i) :group "tag"})
;; Toggle tag on focused client.
(awful.key [modkey :Control :Shift] (.. "#" (+ i 9))
(lambda [] (when client.focus
(let [tag (. client.focus.screen.tags i)]
(when tag
(: client.focus :toggle_tag tag)))))
{:description (.. "toggle focused client on tag #" i) :group "tag"}))))
(local
clientbuttons
(gears.table.join
(awful.button [] 1 (lambda [c] (set client.focus c) (: c :raise)))
(awful.button [modkey] 1 awful.mouse.client.move)
(awful.button [modkey] 3 awful.mouse.client.resize)))
;; Set keys
(root.keys globalkeys)
;;}}}
;; {{{ Rules
;; Rules apply to new clients (through the "manage" signal).
(set awful.rules.rules
[ ;; All clients will match this rule.
{:rule {}
:properties {:border_width beautiful.border_width
:border_color beautiful.border_normal
:focus awful.client.focus.filter
:raise true
:keys clientkeys
:buttons clientbuttons
:screen awful.screen.preferred
:placement (+ awful.placement.no_overlap
awful.placement.no_offscreen)}}
;; Floating clients.
{:rule_any {:instance ["DTA" ;; Firefox addon DownThemAll.
"copyq"] ;; Includes session name in class.
:class ["Arandr"
"Gpick"
"Kruler"
"MessageWin" ;; kalarm.
"Sxiv"
"Wpa_gui"
"pinentry"
"veromix"
"xtightvncviewer"]
:name ["Event Tester"] ;; xev
:role ["AlarmWindow" ;; Thunderbird's calendar
"pop-up"]} ;; e.g. Google Chrome's (detatched) Developer Tools.
:properties {:floating true}}
;; Add titlebars to normal clients and dialogs.
{:rule_any {:type ["normal" "dialog"]}
:properties {:titlebars_enabled true}}
;; Set Firefox to always map on the tag named "2" on screen 1.
;; {:rule {:class "Firefox"}
;; :properties {:screen 1 :tag "2"}}
])
;; }}}
;; {{{ Signals
;; Signal function to execute when a new client appears.
(client.connect_signal "manage"
(lambda [c] (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))))
;; Add a titlebar if titlebars_enabled is set to true in the rules.
(client.connect_signal
"request::titlebars"
(lambda [c] (let [buttons (gears.table.join
(awful.button [] 1 (lambda []
(set client.focus c)
(: c :raise)
(awful.mouse.client.move c)))
(awful.button [] 3 (lambda []
(set client.focus c)
(: c :raise)
(awful.mouse.client.resize c))))]
(: (awful.titlebar c) :setup
{ ;; Left
1 {1 (awful.titlebar.widget.iconwidget c)
:buttons buttons
:layout wibox.layout.fixed.horizontal}
;; Middle
2 {1 {:align "center" ;; Title
:widget (awful.titlebar.widget.titlewidget c)}
:buttons buttons
:layout wibox.layout.flex.horizontal}
;; Right
3 {1 (awful.titlebar.widget.floatingbutton c)
2 (awful.titlebar.widget.maximizedbutton c)
3 (awful.titlebar.widget.stickybutton c)
4 (awful.titlebar.widget.ontopbutton c)
5 (awful.titlebar.widget.closebutton c)
:layout (wibox.layout.fixed.horizontal)}
:layout wibox.layout.align.horizontal}))))
;; Enable sloppy focus, so that the focus follows mouse.
(client.connect_signal "mouse::enter"
(lambda [c] (when (and (~= (awful.layout.get c.screen)
awful.layout.suit.magnifier)
(awful.client.focus.filter c))
(set client.focus c))))
(client.connect_signal "focus"
(lambda [c] (set c.border_color beautiful.border_focus)))
(client.connect_signal "unfocus"
(lambda [c] (set c.border_color beautiful.border_normal))))
;; }}}

View File

@ -19,14 +19,16 @@
:focus true :focus true
:keys (. keys :client) :keys (. keys :client)
:buttons buttons :buttons buttons
:placement (+ awful.placement.no_overlap :size_hints_honor false ;; fuck you terminals I know what I want
awful.placement.no_offscreen)}} :placement awful.placement.no_offscreen}}
{:rule {:floating true} {:rule {:floating true}
:properties {:keys (. keys :floating)}} :properties {:keys (. keys :floating)}}
;; Floating clients. ;; Floating clients.
{:rule_any {:class ["Gpick"] {:rule_any {:class ["Gpick"
"Orage"
"Pavucontrol"]
:name ["Event Tester"] ;; xev :name ["Event Tester"] ;; xev
:role ["pop-up" :role ["pop-up"
"xfce4-terminal-dropdown"]} "xfce4-terminal-dropdown"]}

View File

@ -96,9 +96,9 @@
(key [] :XF86AudioPlay (playerctl :play-pause)) (key [] :XF86AudioPlay (playerctl :play-pause))
(key [] :XF86AudioNext (playerctl :next)) (key [] :XF86AudioNext (playerctl :next))
(key [] :XF86AudioPrev (playerctl :previous)) (key [] :XF86AudioPrev (playerctl :previous))
(key [] :XF86AudioRaiseVolume (amixer "5%+")) ;; (key [] :XF86AudioRaiseVolume (amixer "5%+"))
(key [] :XF86AudioLowerVolume (amixer "5%-")) ;; (key [] :XF86AudioLowerVolume (amixer "5%-"))
(key [] :XF86AudioMute (amixer "toggle")) ;; (key [] :XF86AudioMute (amixer "toggle"))
(key [] :XF86MonBrightnessUp (light :up 5)) (key [] :XF86MonBrightnessUp (light :up 5))
(key [] :XF86MonBrightnessDown (light :down 5))) (key [] :XF86MonBrightnessDown (light :down 5)))

View File

@ -3,19 +3,29 @@
;;; Code: ;;; Code:
(local awful (require :awful)) (local awful (require :awful))
(local beautiful (require :beautiful))
;;; ;;;
;; Configuration ;; Configuration
(local layouts [awful.layout.suit.tile (local layouts [awful.layout.suit.tile])
awful.layout.suit.floating])
(set awful.layout.layouts layouts) (set awful.layout.layouts layouts)
(awful.screen.connect_for_each_screen ;; TODO Rasterize?
(local tags [:firefox.png :code.png :code.png :code.png :code.png :code.png])
(let [icon-path (.. (os.getenv "HOME") "/.config/awesome/theme/icons/tag/")]
(awful.screen.connect_for_each_screen
(lambda [s] (lambda [s]
(awful.tag ["1", "2", "3", "4", "5", "6", "7", "8", "9"] (each [n tag (ipairs tags)]
s (. layouts 1)))) (awful.tag.add
n {:icon (.. icon-path tag)
:layout (. layouts 1)
:gap_single_client false
:gap beautiful.useless_gap
:screen s
:selected (= n 1)})))))
{} {}
;;; conf/tags.fnl ends here ;;; conf/tags.fnl ends here

View File

@ -1,35 +0,0 @@
;; 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"
}

1
lain Submodule

Submodule lain added at 93b31ef0e9

View File

@ -13,5 +13,20 @@
(fn std.zero? [n] (fn std.zero? [n]
(= 0 n)) (= 0 n))
(fn std.fn? [f]
(= (type f) :function))
(fn std.s-empty? [s]
(or (= nil s)
(= "" s)))
(fn std.s-split [s sep]
(var t {})
(let [sep (or sep "%s")
re (.. "([^" sep "]+)")]
(each [str (string.gmatch s re)]
(table.insert t str))
t))
std std
;;; std.fnl ends here ;;; std.fnl ends here

53
module/autostart.fnl Normal file
View File

@ -0,0 +1,53 @@
;;; module/auto-start.fnl --- Auto-start utilities
;;; Commentary:
;; Largely copied from
;; https://github.com/PapyElGringo/material-awesome/blob/master/module/auto-start.lua
;;; Code:
(local awful (require :awful))
(local beautiful (require :beautiful))
(local naughty (require :naughty))
(local spawn awful.spawn.with_shell)
(local async awful.spawn.easy_async_with_shell)
;;;
;; Functions
(fn cb [prog]
(lambda [stdout stderr exitreason exitcode]
(when (not (= 0 exitcode))
(naughty.notify
{:title (.. "async startup handler: " prog)
:text stderr}))))
(fn run-once [cmds]
(each [_ cmd (ipairs cmds)]
(let [first-space (: cmd :find " ")
findme (if first-space
(: cmd :sub 0 (- first-space 1))
cmd)]
(spawn
(string.format "pgrep -u $USER -x %s >/dev/null || (%s)" findme cmd)))))
;; Keyboard
(async "tpset \"Natural Scrolling\" 1" (cb "tpset"))
(async "tpset \"Tapping\" 1" (cb "tpset"))
(spawn "setxkbmap -option caps:ctrl_modifier")
(spawn "numlockx on")
(async (.. "feh --bg-fill " beautiful.wallpaper) (cb "feh"))
(run-once
["nm-applet" ;; WiFi
"pa-applet" ;; Sound manager
"blueman-applet" ;; Bluetooth
"compton -b" ;; Compositor
"libinput-gestures"
"fcitx-autostart" ;; Keyboard
])
{}
;;; module/auto-start.fnl ends here

View File

@ -10,25 +10,9 @@
(local gears (require :gears)) (local gears (require :gears))
(local wibox (require :wibox)) (local wibox (require :wibox))
(local std (require :lib.std))
;; TODO Properly abstract these into a library
(local fun (require :lib.fun)) (local fun (require :lib.fun))
(local modifiers (local std (require :lib.std))
{:mod "Mod4" (local button (. (require :lib.keys) :button))
: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 ;; Functions

View File

@ -4,71 +4,110 @@
(local awful (require :awful)) (local awful (require :awful))
(local beautiful (require :beautiful)) (local beautiful (require :beautiful))
(local gears (require :gears))
(local dpi beautiful.xresources.apply_dpi)
(local lain (require :lain))
(local wibox (require :wibox)) (local wibox (require :wibox))
(local sb-clock (wibox.widget.textclock "%H\n%M")) (local std (require :lib.std))
(local sb-systray (doto (wibox.widget.systray) (local button (. (require :lib.keys) :button))
(: :set_base_size 24)))
(local fill-width (doto (wibox.layout.fixed.horizontal)
(: :fill_space true)
(: :set_spacing 10)))
(local bounding (wibox.container.margin (local tag-list (require :widget.tag-list))
(wibox.container.place (local tag-number (require :widget.tag-number))
(wibox.container.margin (local task-list (require :widget.task-list))
nil (local textclock (require :widget.textclock))
10 10 10 10 beautiful.sidebar_subbox))
1 1 1 1 beautiful.sidebar_bg)) (local markup lain.util.markup)
;;; ;;;
;; Functions ;; Functions
(fn draw-sidebar [s] (fn border [t margin]
(set s.sb-tag (awful.widget.taglist (let [side (or margin 2)
{:screen s end (+ side 1)]
:filter awful.widget.taglist.filter.selected {1 t
:style {:font (.. beautiful.font " Bold 10")} :bottom end
;; :widget_template :left side
;; {1 :right side
;; {:id "index_role" :top end
;; :widget wibox.widget.textbox} :widget wibox.container.margin} ))
;; :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}
}))
(fn center [t]
{1 t
:align "center"
:widget wibox.container.place})
(fn deftooltip [obj callback]
(awful.tooltip
{:objects [obj]
:timer_function callback
:delay_show 0.5
:margin_leftright (dpi 10)
:margin_topbottom (dpi 8)}))
(local clock (textclock "%H\n%M"))
(local systray (doto (wibox.widget.systray)
(: :set_base_size 24)
(: :set_horizontal false)))
(local battery (require :widget.bat))
(local pulse (require :widget.pulse))
(local clock-buttons
(gears.table.join
(button [] 1 (lambda [] (awful.spawn "orage")))))
(fn bat-detail []
(let [status _G.bat_now.status
statustxt (if (= status "Full") "charged"
(= status "Charging") "charging"
(= status "Discharging") "discharging"
"N/A")]
(..
"Level: " _G.bat_now.perc "%\n"
"Status: " statustxt "\n"
(if (or (= status "Charging")
(= status "Discharging"))
(.. "Time left: " _G.bat_now.time " hours") ""))))
(deftooltip clock (lambda [] (os.date "%A %d %B %Y")))
(deftooltip battery.widget bat-detail)
(fn draw-sidebar [s]
(set s.sb (awful.wibar {:position beautiful.sidebar_position (set s.sb (awful.wibar {:position beautiful.sidebar_position
:width beautiful.sidebar_width :width beautiful.sidebar_width
:screen s})) :screen s}))
(: s.sb :setup (: s.sb :setup
{:layout wibox.layout.align.vertical {:layout wibox.layout.align.vertical
1 {:layout wibox.layout.fixed.vertical 1 {1 (border
1 {1 s.sb-tag {1 {1 (tag-number s)
:halign "center" :forced_height 32
:layout (wibox.container.margin nil 10 10 10 10)} :align :center
2 s.sb-tasks} :widget wibox.container.place}
2 {:layout wibox.layout.fixed.vertical} :bg beautiful.sidebar_bg_info
3 {:layout wibox.layout.fixed.vertical :widget wibox.container.background})
1 sb-systray 2 (border (tag-list s))
2 {1 sb-clock :layout wibox.layout.fixed.vertical}
:valign "center" 2 {1 (border (center (task-list s)) 4)
:halign "center" :layout wibox.layout.flex.vertical}
:layout bounding}}})) 3 {1 (center systray)
2 (center battery.widget)
3 (border
{1 {1 (center clock)
:top 3
:bottom 3
:widget wibox.container.margin}
:buttons clock-buttons
:bg beautiful.sidebar_bg_info
:widget wibox.container.background})
:layout wibox.layout.fixed.vertical}}))
;;; ;;;
;; Configuration ;; Configuration
;; (awful.screen.connect_for_each_screen (awful.screen.connect_for_each_screen
;; draw-sidebar) draw-sidebar)
{} {}
;;; module/sidebar.fnl ends here ;;; module/sidebar.fnl ends here

2
rc.lua
View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 B

BIN
theme/icons/tag/code.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

1
theme/icons/tag/code.svg Normal file
View File

@ -0,0 +1 @@
<svg aria-hidden="true" data-prefix="fas" data-icon="code" class="svg-inline--fa fa-code fa-w-20" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><path fill="currentColor" d="M278.9 511.5l-61-17.7c-6.4-1.8-10-8.5-8.2-14.9L346.2 8.7c1.8-6.4 8.5-10 14.9-8.2l61 17.7c6.4 1.8 10 8.5 8.2 14.9L293.8 503.3c-1.9 6.4-8.5 10.1-14.9 8.2zm-114-112.2l43.5-46.4c4.6-4.9 4.3-12.7-.8-17.2L117 256l90.6-79.7c5.1-4.5 5.5-12.3.8-17.2l-43.5-46.4c-4.5-4.8-12.1-5.1-17-.5L3.8 247.2c-5.1 4.7-5.1 12.8 0 17.5l144.1 135.1c4.9 4.6 12.5 4.4 17-.5zm327.2.6l144.1-135.1c5.1-4.7 5.1-12.8 0-17.5L492.1 112.1c-4.8-4.5-12.4-4.3-17 .5L431.6 159c-4.6 4.9-4.3 12.7.8 17.2L523 256l-90.6 79.7c-5.1 4.5-5.5 12.3-.8 17.2l43.5 46.4c4.5 4.9 12.1 5.1 17 .6z"></path></svg>

After

Width:  |  Height:  |  Size: 750 B

BIN
theme/icons/tag/firefox.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@ -0,0 +1 @@
<svg aria-hidden="true" data-prefix="fab" data-icon="firefox" class="svg-inline--fa fa-firefox fa-w-15" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 480 512"><path fill="currentColor" d="M478.1 235.3c-.7-4.5-1.4-7.1-1.4-7.1s-1.8 2-4.7 5.9c-.9-10.7-2.8-21.2-5.8-31.6-3.7-12.9-8.5-25.4-14.5-37.4-3.8-8-8.2-15.6-13.3-22.8-1.8-2.7-3.7-5.4-5.6-7.9-8.8-14.4-19-23.3-30.7-40-7.6-12.8-12.9-26.9-15.4-41.6-3.2 8.9-5.7 18-7.4 27.3-12.1-12.2-22.5-20.8-28.9-26.7C319.4 24.2 323 9.1 323 9.1S264.7 74.2 289.9 142c8.7 23 23.8 43.1 43.4 57.9 24.4 20.2 50.8 36 64.7 76.6-11.2-21.3-28.1-39.2-48.8-51.5 6.2 14.7 9.4 30.6 9.3 46.5 0 61-49.6 110.5-110.6 110.4-8.3 0-16.5-.9-24.5-2.8-9.5-1.8-18.7-4.9-27.4-9.3-12.9-7.8-24-18.1-32.8-30.3l-.2-.3 2 .7c4.6 1.6 9.2 2.8 14 3.7 18.7 4 38.3 1.7 55.6-6.6 17.5-9.7 28-16.9 36.6-14h.2c8.4 2.7 15-5.5 9-14-10.4-13.4-27.4-20-44.2-17-17.5 2.5-33.5 15-56.4 2.9-1.5-.8-2.9-1.6-4.3-2.5-1.6-.9 4.9 1.3 3.4.3-5-2.5-9.8-5.4-14.4-8.6-.3-.3 3.5 1.1 3.1.8-5.9-4-11-9.2-15-15.2-4.1-7.4-4.5-16.4-1-24.1 2.1-3.8 5.4-6.9 9.3-8.7 3 1.5 4.8 2.6 4.8 2.6s-1.3-2.5-2.1-3.8c.3-.1.5 0 .8-.2 2.6 1.1 8.3 4 11.4 5.8 2.1 1.1 3.8 2.7 5.2 4.7 0 0 1-.5.3-2.7-1.1-2.7-2.9-5-5.4-6.6h.2c2.3 1.2 4.5 2.6 6.6 4.1 1.9-4.4 2.8-9.2 2.6-14 .2-2.6-.2-5.3-1.1-7.8-.8-1.6.5-2.2 1.9-.5-.2-1.3-.7-2.5-1.2-3.7v-.1s.8-1.1 1.2-1.5c1-1 2.1-1.9 3.4-2.7 7.2-4.5 14.8-8.4 22.7-11.6 6.4-2.8 11.7-4.9 12.8-5.6 1.6-1 3.1-2.2 4.5-3.5 5.3-4.5 9-10.8 10.2-17.7.1-.9.2-1.8.3-2.8v-1.5c-.9-3.5-6.9-6.1-38.4-9.1-11.1-1.8-20-10.1-22.5-21.1v.1c-.4 1.1-.9 2.3-1.3 3.5.4-1.2.8-2.3 1.3-3.5v-.2c6-15.7 16.8-29.1 30.8-38.3.8-.7-3.2.2-2.4-.5 2.7-1.3 5.4-2.5 8.2-3.5 1.4-.6-6-3.4-12.6-2.7-4 .2-8 1.2-11.7 2.8 1.6-1.3 6.2-3.1 5.1-3.1-8.4 1.6-16.5 4.7-23.9 9 0-.8.1-1.5.5-2.2-5.9 2.5-11 6.5-15 11.5.1-.9.2-1.8.2-2.7-2.7 2-5.2 4.3-7.3 6.9l-.1.1c-17.4-6.7-36.3-8.3-54.6-4.7l-.2-.1h.2c-3.8-3.1-7.1-6.7-9.7-10.9l-.2.1-.4-.2c-1.2-1.8-2.4-3.8-3.7-6-.9-1.6-1.8-3.4-2.7-5.2 0-.1-.1-.2-.2-.2-.4 0-.6 1.7-.9 1.3v-.1c-3.2-8.3-4.7-17.2-4.4-26.2l-.2.1c-5.1 3.5-9 8.6-11.1 14.5-.9 2.1-1.6 3.3-2.2 4.5v-.5c.1-1.1.6-3.3.5-3.1-.1.2-.2.3-.3.4-1.5 1.7-2.9 3.7-3.9 5.8-.9 1.9-1.7 3.9-2.3 5.9-.1.3 0-.3 0-1s.1-2 0-1.7l-.3.7c-6.7 14.9-10.9 30.8-12.4 47.1-.4 2.8-.6 5.6-.5 8.3v.2c-4.8 5.2-9 11-12.7 17.1-12.1 20.4-21.1 42.5-26.8 65.6 4-8.8 8.8-17.2 14.3-25.1C5.5 228.5 0 257.4 0 286.6c1.8-8.6 4.2-17 7-25.3-1.7 34.5 4.9 68.9 19.4 100.3 19.4 43.5 51.6 80 92.3 104.7 16.6 11.2 34.7 19.9 53.8 25.8 2.5.9 5.1 1.8 7.7 2.7-.8-.3-1.6-.7-2.4-1 22.6 6.8 46.2 10.3 69.8 10.3 83.7 0 111.3-31.9 113.8-35 4.1-3.7 7.5-8.2 9.9-13.3 1.6-.7 3.2-1.4 4.9-2.1l1-.5 1.9-.9c12.6-5.9 24.5-13.4 35.3-22.1 16.3-11.7 27.9-28.7 32.9-48.1 3-7.1 3.1-15 .4-22.2.9-1.4 1.7-2.8 2.7-4.3 18-28.9 28.2-61.9 29.6-95.9v-2.8c0-7.3-.6-14.5-1.9-21.6z"></path></svg>

After

Width:  |  Height:  |  Size: 2.7 KiB

43
theme/init.fnl Normal file
View File

@ -0,0 +1,43 @@
;; Have to use underscores for `beautiful' compat.
;; Non-beautiful variables are commented with an asterisk.
(let [theme-dir (.. (os.getenv "HOME") "/.config/awesome/theme")
icon-dir (.. theme-dir "/icons/")]
{
:font "Sarasa UI J 10"
:font_mono "Sarasa Mono J Bold 10"
:wallpaper (.. (os.getenv "HOME") "/pics/wp/sgIcOup.jpg")
:sidebar_position :left ;; *
:sidebar_width 36 ;; *
:sidebar_bg_info "#252b33" ;; *
:bg_focus "#252b33"
:bg_normal "#1a1e24"
:fg_focus "#cfcfcf"
:fg_normal "#cfcfcf"
:useless_gap 2
: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 "#5bb3b4"
: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"
:taglist_bg_empty (.. "png:" icon-dir "tag-list/unselected.png")
:taglist_bg_focus (.. "png:" icon-dir "tag-list/selected.png")
:taglist_bg_occupied (.. "png:" icon-dir "tag-list/occupied-border.png")
:taglist_bg_urgent (.. "png:" icon-dir "tag-list/urgent.png")
})

51
widget/bat.fnl Normal file
View File

@ -0,0 +1,51 @@
;;; widget/bat.fnl --- Battery widget
;;; Code:
(local std (require :lib.std))
(local lain (require :lain))
(local markup lain.util.markup)
(fn bat-hm []
(let [[h m] (std.s-split _G.bat_now.time ":")
baticon "\u{f241}"]
(: _G.widget :set_markup
(.. baticon "\n" h "\n" m))))
(fn bat-icon []
;; FA
;; (let [full "\u{f240}"
;; x75 "\u{f241}"
;; x50 "\u{f242}"
;; x25 "\u{f243}"
;; empty "\u{f244}"
(let [full "\u{e02b}"
x75 "\u{e02c}"
x50 "\u{e02d}"
x25 "\u{e02e}"
empty "\u{e136}"
charging "\u{e02a}"
status _G.bat_now.status
level _G.bat_now.perc
icon (if (= status "Full") full
(= status "Charging") charging
(> level 75) x75
(> level 50) x50
(> level 25) x25
empty)]
(: _G.widget :set_markup (markup.font "Typicons 24" icon))))
(fn bat-markup []
(bat-icon))
;; TODO Plug/unplug notifications
(local battery
(lain.widget.bat
{:battery "BAT1"
:ac "ACAD"
:notify "on"
:n_perc [10 20]
:settings bat-markup}))
battery
;;; widget/bat.fnl ends here

View File

@ -0,0 +1,52 @@
;;; widget/clickable-container.fnl --- Clickable container
;;; Commentary:
;; From https://github.com/PapyElGringo/material-awesome/blob/57116136a904560e8626b673370d2130b40dc62a/widgets/clickable-container.lua
;;; Code:
(local wibox (require :wibox))
(local naughty (require :naughty))
(local awful (require :awful))
;;;
;; Functions
(fn build [widget]
(let [container (wibox.container.background widget)]
(var old-cursor {})
(var old-wibox {})
(: container :connect_signal
:mouse::enter
(lambda []
(let [cw _G.mouse.current_wibox]
(tset container :bg "#ffffff11")
;; Hm, no idea how to get the wibox from this signal's arguments...
(when cw
(set old-cursor cw.cursor)
(set old-wibox cw)
(tset cw :cursor :hand1)))))
(: container :connect_signal
:mouse::leave
(lambda []
(tset container :bg "#ffffff00")
(when old-wibox
(tset old-wibox :cursor old-cursor)
(set old-wibox nil))))
(: container :connect_signal
:button::press
(lambda []
(tset container :bg "#ffffff22")))
(: container :connect_signal
:button::release
(lambda []
(tset container :bg "#ffffff11")))
container))
build
;;; widget/clickable-container.fnl ends here

110
widget/list_update.lua Normal file
View File

@ -0,0 +1,110 @@
local common = require("awful.widget.common")
local dpi = require("beautiful").xresources.apply_dpi
local wibox = require("wibox")
local clickable_container = require("widget.clickable-container")
local capi = {button = _G.button}
function create_buttons(buttons, object)
if buttons then
local btns = {}
for _, b in ipairs(buttons) do
-- Create a proxy button object: it will receive the real
-- press and release events, and will propagate them to the
-- button object the user provided, but with the object as
-- argument.
local btn = capi.button {modifiers = b.modifiers, button = b.button}
btn:connect_signal(
'press',
function()
b:emit_signal('press', object)
end
)
btn:connect_signal(
'release',
function()
b:emit_signal('release', object)
end
)
btns[#btns + 1] = btn
end
return btns
end
end
function list_update(w, buttons, label, data, objects)
-- update the widgets, creating them if needed
w:reset()
for i, o in ipairs(objects) do
local cache = data[o]
local ib, tb, bgb, tbm, ibm, l
if cache then
ib = cache.ib
tb = cache.tb
bgb = cache.bgb
tbm = cache.tbm
ibm = cache.ibm
else
ib = wibox.widget.imagebox()
tb = wibox.widget.textbox()
bgb = wibox.container.background()
tbm = wibox.container.margin(tb, dpi(4), dpi(4))
ibm = wibox.container.margin(ib, dpi(10), dpi(8), dpi(8), dpi(8))
-- ibm = wibox.container.margin(ib, dpi(4))
l = wibox.layout.fixed.horizontal()
bg_clickable = clickable_container()
-- All of this is added in a fixed widget
l:fill_space(true)
l:add(ibm)
-- l:add(tbm)
bg_clickable:set_widget(l)
-- And all of this gets a background
-- bgb:set_widget(l)
bgb:set_widget(bg_clickable)
bgb:buttons(create_buttons(buttons, o))
data[o] = {
ib = ib,
tb = tb,
bgb = bgb,
tbm = tbm,
ibm = ibm,
}
end
local text, bg, bg_image, icon, args = label(o, tb)
args = args or {}
-- The text might be invalid, so use pcall.
if text == nil or text == "" then
tbm:set_margins(0)
else
if not tb:set_markup_silently(text) then
tb:set_markup("<i>&lt;Invalid text&gt;</i>")
end
end
bgb:set_bg(bg)
if type(bg_image) == "function" then
-- TODO: Why does this pass nil as an argument?
bg_image = bg_image(tb,o,nil,objects,i)
end
bgb:set_bgimage(bg_image)
if icon then
ib:set_image(icon)
else
ibm:set_margins(0)
end
bgb.shape = args.shape
bgb.shape_border_width = args.shape_border_width
bgb.shape_border_color = args.shape_border_color
w:add(bgb)
end
end
return list_update

45
widget/pulse.fnl Normal file
View File

@ -0,0 +1,45 @@
;;; widget/pulse.fnl --- Pulseaudio widget
;;; Code:
(local lain (require :lain))
(local markup lain.util.markup)
(fn pulse-icon []
(let [icon {:muted "\u{e133}"
:low "\u{e135}"
:med "\u{e132}"
:high "\u{e134}"}
muted (= _G.volume_now.muted "yes")
vol (tonumber _G.volume_now.left)
icon (if muted icon.muted
(> vol 35) icon.high
(> vol 5) icon.med
icon.low)]
(: _G.widget :set_markup (markup.font "Typicons 24" icon))))
(fn pulse-icon+text []
(let [icon {:muted "\u{e133}"
:low "\u{e135}"
:med "\u{e132}"
:high "\u{e134}"}
muted (= _G.volume_now.muted "yes")
vol (tonumber _G.volume_now.left)
icon (if muted icon.muted
(> vol 35) icon.high
(> vol 5) icon.med
icon.low)
s (if muted ""
(.. "\n" (tostring vol) "%"))]
(: _G.widget :set_markup
(.. (markup.font "Typicons 24" icon)
s))))
(fn pulse-markup []
(pulse-icon))
(local pulse (lain.widget.pulse
{:settings pulse-markup}))
pulse
;;; widget/pulse.fnl ends here

113
widget/tag-list.fnl Normal file
View File

@ -0,0 +1,113 @@
;;; widget/tag-list.fnl --- Pop-out tag list widget
;;; Code:
(local awful (require :awful))
(local beautiful (require :beautiful))
(local gears (require :gears))
(local wibox (require :wibox))
(local common (require :awful.widget.common))
(local dpi (. (require :beautiful) :xresources :apply_dpi))
(local button (. (require :lib.keys) :button))
(local std (require :lib.std))
;;;
;; Functions
(fn update-tag-list [w buttons label data objects]
(: w :reset)
(each [i o (ipairs objects)]
(let [cache (. data o)]
(var ib nil)
(var tb nil)
(var bgb nil)
(var tbm nil)
(var ibm nil)
(var l nil)
(if cache
(do
(set ib cache.ib)
(set tb cache.tb)
(set bgb cache.bgb)
(set tbm cache.tbm)
(set ibm cache.ibm))
(do
(set ib (wibox.widget.imagebox))
(set tb (wibox.widget.textbox))
(set bgb (wibox.container.background))
(set tbm (wibox.container.margin tb (dpi 4) (dpi 4)))
;; (set ibm (wibox.container.margin ib (dpi 12) (dpi 12) (dpi 12) (dpi 12)))
(set ibm (wibox.container.margin ib (dpi 4)))
(set l (wibox.layout.fixed.horizontal))
;; All of this is added in a fixed widget
(doto l
(: :fill_space true)
(: :add ibm)
(: :add tbm))
;; And all of this gets a background
(: bgb :set_widget l)
(: bgb :buttons (common.create_buttons buttons o))
(tset data o {:ib ib :tb tb :bgb bgb :tbm tbm :ibm ibm})))
(let [[text bg bg-image icon args] (label o tb)]
;; The text might be invalid, so use pcall.
(if (std.s-empty? text)
(: tbm :set_margins 0)
(when (not (: tb :set_markup_silently text))
(: tb :set_markup "<i>&lt;Invalid text&gt;</i>")))
(: bgb :set_bg bg)
(: bgb :set_bgimage (if (std.fn? bg-image)
;; TODO: Why does this pass nil as an argument?
(bg-image tb o nil objects i)
bg-image))
(if icon
(: ib :set_image icon)
(: ibm :set_margins 0))
(let [args (or args {})]
(doto bgb
(tset :shape args.shape)
(tset :shape_border_width args.shape_border_width)
(tset :shape_border_color args.shape_border_color)))
(: w :add bgb)))))
(fn container []
(let [l (wibox.layout.fixed.vertical)]
;; Wishlist: let*
(local innerm (wibox.container.margin nil 10 10))
(local bg (wibox.container.background innerm "#faa"))
(local outerm (wibox.container.margin bg 4 4))
(: l :fill_space true)
(: l :add outerm)
l))
(fn tag-list [s]
(awful.widget.taglist
s
awful.widget.taglist.filter.all
(gears.table.join
(button [] 1 (lambda [t] (: t :view_only)))
(button [] 3 (lambda [t] (when _G.client.focus (: _G.client.focus :move_to_tag t))))
(button [] 4 (lambda [t] (awful.tag.viewnext t.screen)))
(button [] 5 (lambda [t] (awful.tag.viewprev t.screen))))
{:font (.. beautiful.font " Bold 10")
:spacing 2}
;; update-tag-list
(require :widget.list_update)
;; awful.widget.common.list_update
;; (container)
(wibox.layout.fixed.vertical)
))
tag-list
;;; widget/tag-list.fnl ends here

20
widget/tag-number.fnl Normal file
View File

@ -0,0 +1,20 @@
(local awful (require :awful))
(local beautiful (require :beautiful))
(local wibox (require :wibox))
(fn tag-number [s]
(awful.widget.taglist
s
awful.widget.taglist.filter.selected
{}
{:taglist_disable_icon true
:bg_empty beautiful.bg_normal
:bg_focus beautiful.bg_focus
:bg_occupied beautiful.bg_normal
:bg_urgent beautiful.bg_normal
:font beautiful.font_mono}
awful.widget.common.list_update
;; (require :widget.list_update)
(wibox.layout.fixed.vertical)))
tag-number

23
widget/task-list.fnl Normal file
View File

@ -0,0 +1,23 @@
;;; widget/task-list.fnl --- Vertical task list
;;; Code:
(local awful (require :awful))
(local wibox (require :wibox))
;;;
;; Functions
(fn task-list [s]
(awful.widget.tasklist
s
awful.widget.tasklist.filter.minimizedcurrenttags
{}
{:disable_task_name true}
awful.widget.common.list_update
(wibox.layout.fixed.vertical)
))
task-list
;;; widget/task-list.fnl ends here

43
widget/textclock.fnl Normal file
View File

@ -0,0 +1,43 @@
;;; widget/textclock.fnl --- Configurable text clock widget
;;; Commentary:
;; More modular than the standard library
;;; Code:
(local beautiful (require :beautiful))
(local gears (require :gears))
(local glib (. (require :lgi) :GLib))
(local wibox (require :wibox))
(local DateTime glib.DateTime)
(local TimeZone glib.TimeZone)
;;;
;; Functions
(fn calc-timeout [real-timeout]
(% (- real-timeout (os.time)) real-timeout))
(fn textclock [format timeout timezone font]
(let [format (or format " %a %b %d, %H:%M ")
timeout (or timeout 60)
timezone (or (and timezone (TimeZone.new timezone))
(TimeZone.new_local))
font (or font beautiful.textclock_font beautiful.font)
w (wibox.widget.textbox)]
(var t nil)
(tset w :font font)
(fn w._private.textclock_update_cb []
(: w :set_markup (: (DateTime.new_now timezone) :format format))
(tset t :timeout (calc-timeout timeout))
(: t :again)
true)
(set t (gears.timer.weak_start_new timeout w._private.textclock_update_cb))
(: t :emit_signal :timeout)
w))
textclock
;;; widget/textclock.fnl ends here