feat(sidebar): add volume widget
This commit is contained in:
parent
04f619499d
commit
0bde007468
@ -36,11 +36,12 @@
|
|||||||
(local sb-clock (textclock "%H\n%M"))
|
(local sb-clock (textclock "%H\n%M"))
|
||||||
(local sb-systray (doto (wibox.widget.systray)
|
(local sb-systray (doto (wibox.widget.systray)
|
||||||
(: :set_base_size 24)))
|
(: :set_base_size 24)))
|
||||||
;; (fn bat-markup []
|
|
||||||
;; (let [[h m] (std.s-split _G.bat_now.time ":")
|
(fn bat-hm []
|
||||||
;; baticon "\u{f241}"]
|
(let [[h m] (std.s-split _G.bat_now.time ":")
|
||||||
;; (: _G.widget :set_markup
|
baticon "\u{f241}"]
|
||||||
;; (.. baticon "\n" h "\n" m))))
|
(: _G.widget :set_markup
|
||||||
|
(.. baticon "\n" h "\n" m))))
|
||||||
|
|
||||||
(fn bat-icon []
|
(fn bat-icon []
|
||||||
;; FA
|
;; FA
|
||||||
@ -65,6 +66,42 @@
|
|||||||
empty)]
|
empty)]
|
||||||
(: _G.widget :set_markup (markup.font "Typicons 28" icon))))
|
(: _G.widget :set_markup (markup.font "Typicons 28" icon))))
|
||||||
|
|
||||||
|
(fn bat-markup []
|
||||||
|
(bat-icon))
|
||||||
|
|
||||||
|
(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))
|
||||||
|
|
||||||
;; TODO Plug/unplug notifications
|
;; TODO Plug/unplug notifications
|
||||||
(local battery
|
(local battery
|
||||||
(lain.widget.bat
|
(lain.widget.bat
|
||||||
@ -72,8 +109,10 @@
|
|||||||
:ac "ACAD"
|
:ac "ACAD"
|
||||||
:notify "on"
|
:notify "on"
|
||||||
:n_perc [10 20]
|
:n_perc [10 20]
|
||||||
:settings bat-icon}))
|
:settings bat-markup}))
|
||||||
(local pulse (lain.widget.pulse))
|
|
||||||
|
(local pulse (lain.widget.pulse
|
||||||
|
{:settings pulse-markup}))
|
||||||
|
|
||||||
(fn draw-sidebar [s]
|
(fn draw-sidebar [s]
|
||||||
(set s.sb (awful.wibar {:position beautiful.sidebar_position
|
(set s.sb (awful.wibar {:position beautiful.sidebar_position
|
||||||
@ -87,7 +126,7 @@
|
|||||||
:layout wibox.layout.fixed.vertical}
|
:layout wibox.layout.fixed.vertical}
|
||||||
2 nil
|
2 nil
|
||||||
3 {1 (center battery.widget)
|
3 {1 (center battery.widget)
|
||||||
2 pulse.widget
|
2 (center pulse.widget)
|
||||||
;; 2 sb-systray
|
;; 2 sb-systray
|
||||||
3 {1 (border
|
3 {1 (border
|
||||||
{1 {1 (center sb-clock)
|
{1 {1 (center sb-clock)
|
||||||
|
Loading…
Reference in New Issue
Block a user