eww: refactor and add calendar widget
This commit is contained in:
parent
4cd16133e9
commit
33f4d22664
1 changed files with 61 additions and 33 deletions
|
@ -1,13 +1,11 @@
|
||||||
;;;; (defpoll time :interval "1s" 'date +%s')
|
;; VARIABLE DEFINITIONS
|
||||||
|
|
||||||
(defwidget clock []
|
|
||||||
(box :orientation "vertical"
|
|
||||||
:halign "center"
|
|
||||||
:valign "end"
|
|
||||||
(box :class "clock" {formattime(EWW_TIME, "%H")})
|
|
||||||
(box :class "clock" {formattime(EWW_TIME, "%M")})
|
|
||||||
))
|
|
||||||
|
|
||||||
|
;; Audio
|
||||||
|
(deflisten vol "cat ~/.cache/eww/vol && inotifywait -q -m -e close_write ~/.cache/eww/vol | while read -r filename event; do cat ~/.cache/eww/vol; done")
|
||||||
|
(defpoll micvol :interval "1m" "wpctl get-volume @DEFAULT_AUDIO_SOURCE@ | awk '{print $2}'")
|
||||||
|
|
||||||
|
;; Workspace Stuff
|
||||||
(deflisten workspaces :initial "[]" "bash ~/.config/eww/scripts/get-workspaces")
|
(deflisten workspaces :initial "[]" "bash ~/.config/eww/scripts/get-workspaces")
|
||||||
(deflisten current_workspace :initial "..." "bash ~/.config/eww/scripts/get-active-workspace")
|
(deflisten current_workspace :initial "..." "bash ~/.config/eww/scripts/get-active-workspace")
|
||||||
(deflisten urgent_workspace :initial "..." "bash ~/.config/eww/scripts/get-urgent-workspaces")
|
(deflisten urgent_workspace :initial "..." "bash ~/.config/eww/scripts/get-urgent-workspaces")
|
||||||
|
@ -21,6 +19,21 @@
|
||||||
(label :text "${workspace.id}")
|
(label :text "${workspace.id}")
|
||||||
))))))
|
))))))
|
||||||
|
|
||||||
|
;; Screen
|
||||||
|
(deflisten backlight "brightnessctl g && inotifywait -q -m -e modify /sys/class/backlight/intel_backlight/actual_brightness | while read -r filename event; do cat /sys/class/backlight/intel_backlight/actual_brightness; done")
|
||||||
|
|
||||||
|
|
||||||
|
;; Widgets
|
||||||
|
|
||||||
|
(defwidget clock []
|
||||||
|
(eventbox
|
||||||
|
:onhover "eww open cal"
|
||||||
|
(box :orientation "vertical"
|
||||||
|
:halign "center"
|
||||||
|
:valign "end"
|
||||||
|
(box :class "clock" {formattime(EWW_TIME, "%H")})
|
||||||
|
(box :class "clock" {formattime(EWW_TIME, "%M")})
|
||||||
|
)))
|
||||||
|
|
||||||
(defwidget circle [val prog sty char]
|
(defwidget circle [val prog sty char]
|
||||||
(box :halign "center"
|
(box :halign "center"
|
||||||
|
@ -43,24 +56,18 @@
|
||||||
:val {EWW_BATTERY.BAT1.capacity}
|
:val {EWW_BATTERY.BAT1.capacity}
|
||||||
:char ""))
|
:char ""))
|
||||||
|
|
||||||
(deflisten vol "cat ~/.cache/eww/vol && inotifywait -q -m -e close_write ~/.cache/eww/vol | while read -r filename event; do cat ~/.cache/eww/vol; done")
|
|
||||||
|
|
||||||
(defwidget volume []
|
(defwidget volume []
|
||||||
(circle :prog {vol * 7/10}
|
(circle :prog {vol * 7/10}
|
||||||
:sty "font-size: 12; margin-right: 2px;"
|
:sty "font-size: 12; margin-right: 2px;"
|
||||||
:val {vol + 1 - 1}
|
:val {vol + 1 - 1}
|
||||||
:char ""))
|
:char ""))
|
||||||
|
|
||||||
(defpoll micvol :interval "1m" "wpctl get-volume @DEFAULT_AUDIO_SOURCE@ | awk '{print $2}'")
|
|
||||||
|
|
||||||
(defwidget mic []
|
(defwidget mic []
|
||||||
(circle :prog {micvol * 70}
|
(circle :prog {micvol * 70}
|
||||||
:sty "margin-left: 1px;"
|
:sty "margin-left: 1px;"
|
||||||
:val {micvol *100}
|
:val {micvol *100}
|
||||||
:char ""))
|
:char ""))
|
||||||
|
|
||||||
(deflisten backlight "brightnessctl g && inotifywait -q -m -e modify /sys/class/backlight/intel_backlight/actual_brightness | while read -r filename event; do cat /sys/class/backlight/intel_backlight/actual_brightness; done")
|
|
||||||
|
|
||||||
(defwidget brightness []
|
(defwidget brightness []
|
||||||
(circle :prog {(backlight / 960) * 7/10}
|
(circle :prog {(backlight / 960) * 7/10}
|
||||||
:sty "font-size: 12; margin-right: 3px;"
|
:sty "font-size: 12; margin-right: 3px;"
|
||||||
|
@ -73,28 +80,49 @@
|
||||||
(defwidget tray []
|
(defwidget tray []
|
||||||
(systray :orientation "v" :icon-size 20))
|
(systray :orientation "v" :icon-size 20))
|
||||||
|
|
||||||
|
|
||||||
|
;; Upper Level Widgets
|
||||||
|
|
||||||
|
|
||||||
(defwidget bar []
|
(defwidget bar []
|
||||||
(centerbox :orientation "vertical"
|
(centerbox :orientation "vertical"
|
||||||
:halign "center"
|
:halign "center"
|
||||||
:space-evenly false
|
:space-evenly false
|
||||||
(_workspaces)
|
(_workspaces)
|
||||||
(clock)
|
(clock)
|
||||||
(box :orientation "vertical" :spacing -25 :valign "end"
|
(box :orientation "vertical" :spacing -25 :valign "end"
|
||||||
(brightness)
|
(brightness)
|
||||||
(mic)
|
(mic)
|
||||||
(volume)
|
(volume)
|
||||||
(battery)
|
(battery)
|
||||||
(tray)
|
(tray)
|
||||||
(power))))
|
(power))))
|
||||||
|
|
||||||
|
(defwidget cal []
|
||||||
|
(eventbox
|
||||||
|
:onhoverlost "eww close cal"
|
||||||
|
(calendar)))
|
||||||
|
|
||||||
|
|
||||||
|
;; Windows
|
||||||
|
|
||||||
(defwindow bar
|
(defwindow bar
|
||||||
:monitor 0
|
:monitor 0
|
||||||
:geometry (geometry :x "4px"
|
:geometry (geometry :x "4px"
|
||||||
:y "1%"
|
:y "1%"
|
||||||
:height "98%"
|
:height "98%"
|
||||||
:anchor "left center")
|
:anchor "left center")
|
||||||
:stacking "fg"
|
:stacking "fg"
|
||||||
:exclusive true
|
:exclusive true
|
||||||
:class "bar"
|
:class "bar"
|
||||||
(bar))
|
(bar))
|
||||||
|
|
||||||
|
(defwindow cal
|
||||||
|
:monitor 0
|
||||||
|
:geometry (geometry :x "1%"
|
||||||
|
:y "5%"
|
||||||
|
:anchor "left center")
|
||||||
|
:stacking "fg"
|
||||||
|
:exclusive false
|
||||||
|
:class "bar"
|
||||||
|
(cal))
|
||||||
|
|
Loading…
Reference in a new issue