Adding temp and volume widgets for real

This commit is contained in:
Chris Cochrun 2020-12-15 08:05:11 -06:00
parent 68489d3fb0
commit e2dbc91280
4 changed files with 32 additions and 140 deletions

View file

@ -1,121 +0,0 @@
(local awful (require "awful"))
(local gears (require "gears"))
(local beautiful (require "beautiful"))
(local menubar (require "menubar"))
(local bar (fn [s]
;; Wallpaper
(set_wallpaper s)
;; Each screen has its own tag table.
(awful.tag [ "1" "2" "3" "4" ] 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 layoutbox per screen.
(set s.mylayoutbox (awful.widget.layoutbox s))
(: s.mylayoutbox :buttons (gears.table.join
(awful.button [] 1 (fn [] (awful.layout.inc 1 s awful.layout.layouts)))
(awful.button [] 3 (fn [] (awful.layout.inc -1 s)))
(awful.button [] 4 (fn [] (awful.layout.inc 1 s)))
(awful.button [] 5 (fn [] (awful.layout.inc -1 s)))))
;; Create a taglist widget
(set s.mytaglist (awful.widget.taglist {
:screen s
:filter awful.widget.taglist.filter.all
:buttons taglist_buttons
}))
;; Create a tasklist widget
(set s.mytasklist (awful.widget.tasklist {
:screen s
:filter awful.widget.tasklist.filter.currenttags
:buttons tasklist_buttons
}))
(set s.mytextclock
(wibox.widget (/<
:layout wibox.layout.fixed.horizontal
(/<
:format "<b> %a %b %d, %l:%M %p </b>"
:widget wibox.widget.textclock)
)))
;; Create the wibox
(set s.mywibox (awful.wibar { :position "bottom" :screen s }))
;; Add widgets to the wibox
(: s.mywibox :setup {
:layout wibox.layout.align.horizontal
1 { ;; Left widgets
:layout wibox.layout.fixed.horizontal
2 s.mytaglist
3 s.mypromptbox
}
2 s.mytasklist ;; Middle widget
3 { ;; Right widgets
:layout wibox.layout.fixed.horizontal
2 (wibox.widget.systray)
3 s.mytextclock
4 s.mylayoutbox
}
})
))
;; Menu
;; Create a launcher widget and a main menu
(local myawesomemenu [
[ "hotkeys" (fn [] (hotkeys_popup.show_help nil (awful.screen.focused))) ]
[ "manual" (.. terminal " -e man awesome") ]
[ "edit config" (.. editor_cmd " " awesome.conffile) ]
[ "restart" awesome.restart ]
[ "quit" (fn [] (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 }))
;; Keyboard map indicator and switcher
(local mykeyboardlayout (awful.widget.keyboardlayout))
;; Create a wibox for each screen and add it
(local taglist_buttons
(gears.table.join
(awful.button [] 1 (fn [t] (: t :view_only)))
(awful.button [ modkey ] 1 (fn [t] (when client.focus (: client.focus :move_to_tag t))))
(awful.button [] 3 awful.tag.viewtoggle)
(awful.button [ modkey ] 3 (fn [t] (when client.focus (: client.focus :toggle_tag t))))
(awful.button [] 4 (fn [t] (awful.tag.viewnext t.screen)))
(awful.button [] 5 (fn [t] (awful.tag.viewprev t.screen)))))
(local tasklist_buttons
(gears.table.join
(awful.button [] 1 (fn [c]
(if (= c client.focus)
(set c.minimized true)
(: c :emit_signal
"request::activate"
"tasklist"
{:raise true}
))))
(awful.button [] 3 (fn [] (awful.menu.client_list {:theme {:width 250 }})))
(awful.button [] 4 (fn [] (awful.client.focus.byidx 1)))
(awful.button [] 5 (fn [] (awful.client.focus.byidx -1)))))
;; (fn set_wallpaper [s]
;; ;; Wallpaper
;; (when beautiful.wallpaper
;; (var wallpaper beautiful.wallpaper)
;; ;; If wallpaper is a function, call it with the screen
;; (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)
bar

View file

@ -20,6 +20,7 @@
;; my splits
(local rules (require "rules"))
(local keybindings (require "keybindings"))
;; (local volume-widget (require :widgets.volume))
;; (local bar (require "bar"))
;; Error handling
@ -63,10 +64,7 @@
(local ctrl "Control")
(local alt "Mod1")
(fn get-volume [?callback]
(let [cb (or ?callback (fn [] nil))]
(awful.spawn.easy_async_with_shell "pamixer --get-volume-human" cb)))
;; (local volume-string (awful.widget.watch "pamixer --get-volume-human" 1))
;; Table of layouts to cover with awful.layout.inc, order matters.
(set awful.layout.layouts [
awful.layout.suit.tile
@ -260,11 +258,11 @@
}
}))
(set s.mytextclock (wibox.widget {
:layout wibox.layout.fixed.horizontal
1 {
:format "<b> %a %b %d, %l:%M %p </b>"
:widget wibox.widget.textclock}}))
(set s.mytextclock (wibox.widget {
:layout wibox.layout.fixed.horizontal
1 {
:format "<b> %a %b %d, %l:%M %p </b>"
:widget wibox.widget.textclock}}))
(set s.myemptywidget (wibox.widget { ;; an empty widget for spacing things out
:text ""
@ -272,19 +270,33 @@
:valign ""
:widget wibox.widget.textbox}))
(set s.temptext (awful.widget.watch "cat /sys/class/thermal/thermal_zone3/temp" 10))
(set s.tempicon (wibox.widget.textbox " "))
(set s.tempspace (wibox.widget.textbox " "))
(set s.tempwidget (wibox.widget {
1 s.tempicon
2 s.temptext
3 s.tempspace
:layout wibox.layout.fixed.horizontal}))
(set s.volumetext (awful.widget.watch "pamixer --get-volume-human" 1))
(set s.volumeicon (wibox.widget.textbox " "))
(set s.volumespace (wibox.widget.textbox " "))
(set s.volumewidget (wibox.widget {
:text "墳 get-volume "
:align ""
:valign ""
:widget wibox.widget.textbox
1 s.volumeicon
2 s.volumetext
3 s.volumespace
:layout wibox.layout.fixed.horizontal
}))
(set s.myrightwidgets {
1 {
:layout wibox.layout.fixed.horizontal
1 s.volumewidget
2 wibox.widget.systray
3 s.mylayoutbox
1 s.tempwidget
2 s.volumewidget
3 wibox.widget.systray
4 s.mylayoutbox
}
:widget wibox.container.background
})

View file

@ -125,7 +125,7 @@
(awful.key [modkey] "b" (fn [] (awful.spawn "bwmenu"))
{:description "launch rofi bitwarden selector" :group "launcher"})
;; audio
(awful.key [modkey] "a" (fn [] (awful.spawn "alacritty -e pulsemixer" {
(awful.key [modkey] "a" (fn [] (awful.spawn "alacritty --class pulsemixer -e pulsemixer" {
:floating true
:placement awful.placement.centered
}))

View file

@ -59,8 +59,9 @@
;; Pacmixer center and smaller
{
:rule_any {
:name [
"(pacmixer) ~"
:class [
"pulsemixer"
"pulsemixer,Alacritty"
]
}
:properties {