feat(sidebar): add battery icon
This commit is contained in:
parent
867f3434f3
commit
04f619499d
@ -4,12 +4,17 @@
|
|||||||
|
|
||||||
(local awful (require :awful))
|
(local awful (require :awful))
|
||||||
(local beautiful (require :beautiful))
|
(local beautiful (require :beautiful))
|
||||||
|
(local lain (require :lain))
|
||||||
(local wibox (require :wibox))
|
(local wibox (require :wibox))
|
||||||
|
|
||||||
|
(local std (require :lib.std))
|
||||||
|
|
||||||
(local tag-list (require :widget.tag-list))
|
(local tag-list (require :widget.tag-list))
|
||||||
(local task-list (require :widget.task-list))
|
(local task-list (require :widget.task-list))
|
||||||
(local textclock (require :widget.textclock))
|
(local textclock (require :widget.textclock))
|
||||||
|
|
||||||
|
(local markup lain.util.markup)
|
||||||
|
|
||||||
;;;
|
;;;
|
||||||
;; Functions
|
;; Functions
|
||||||
|
|
||||||
@ -23,9 +28,52 @@
|
|||||||
:top end
|
:top end
|
||||||
:widget wibox.container.margin} ))
|
:widget wibox.container.margin} ))
|
||||||
|
|
||||||
|
(fn center [t]
|
||||||
|
{1 t
|
||||||
|
:align "center"
|
||||||
|
:widget wibox.container.place})
|
||||||
|
|
||||||
(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 ":")
|
||||||
|
;; 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 28" icon))))
|
||||||
|
|
||||||
|
;; TODO Plug/unplug notifications
|
||||||
|
(local battery
|
||||||
|
(lain.widget.bat
|
||||||
|
{:battery "BAT1"
|
||||||
|
:ac "ACAD"
|
||||||
|
:notify "on"
|
||||||
|
:n_perc [10 20]
|
||||||
|
:settings bat-icon}))
|
||||||
|
(local pulse (lain.widget.pulse))
|
||||||
|
|
||||||
(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
|
||||||
@ -37,13 +85,12 @@
|
|||||||
1 {1 (border (tag-list s))
|
1 {1 (border (tag-list s))
|
||||||
;; 2 (task-list s)
|
;; 2 (task-list s)
|
||||||
:layout wibox.layout.fixed.vertical}
|
:layout wibox.layout.fixed.vertical}
|
||||||
2 {:layout wibox.layout.fixed.vertical}
|
2 nil
|
||||||
3 {1 sb-systray
|
3 {1 (center battery.widget)
|
||||||
2 {1 (border
|
2 pulse.widget
|
||||||
{1 {1 {1 sb-clock
|
;; 2 sb-systray
|
||||||
:valign "center"
|
3 {1 (border
|
||||||
:halign "center"
|
{1 {1 (center sb-clock)
|
||||||
:widget wibox.container.place}
|
|
||||||
:top 2
|
:top 2
|
||||||
:bottom 2
|
:bottom 2
|
||||||
:widget wibox.container.margin}
|
:widget wibox.container.margin}
|
||||||
|
Loading…
Reference in New Issue
Block a user