feat(sidebar): add buttons and tooltips
This commit is contained in:
parent
dea630bf1e
commit
07e372b31c
@ -4,10 +4,13 @@
|
|||||||
|
|
||||||
(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 lain (require :lain))
|
||||||
(local wibox (require :wibox))
|
(local wibox (require :wibox))
|
||||||
|
|
||||||
(local std (require :lib.std))
|
(local std (require :lib.std))
|
||||||
|
(local button (. (require :lib.keys) :button))
|
||||||
|
|
||||||
(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))
|
||||||
@ -41,6 +44,35 @@
|
|||||||
(local battery (require :widget.bat))
|
(local battery (require :widget.bat))
|
||||||
(local pulse (require :widget.pulse))
|
(local pulse (require :widget.pulse))
|
||||||
|
|
||||||
|
(local clock-buttons
|
||||||
|
(gears.table.join
|
||||||
|
(button [] 1 (lambda [] (awful.spawn "orage")))))
|
||||||
|
|
||||||
|
(awful.tooltip {:objects [clock]
|
||||||
|
:timer_function (lambda [] (os.date "%A %d %B %Y"))
|
||||||
|
:delay_show 0.5
|
||||||
|
:margin_leftright (dpi 10)
|
||||||
|
:margin_topbottom (dpi 8)})
|
||||||
|
|
||||||
|
(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") ""))))
|
||||||
|
|
||||||
|
(awful.tooltip {:objects [battery.widget]
|
||||||
|
:timer_function bat-detail
|
||||||
|
:delay_show 0.5
|
||||||
|
:margin_leftright (dpi 10)
|
||||||
|
:margin_topbottom (dpi 8)})
|
||||||
|
|
||||||
(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
|
||||||
:width beautiful.sidebar_width
|
:width beautiful.sidebar_width
|
||||||
@ -61,6 +93,7 @@
|
|||||||
:widget wibox.container.margin}
|
:widget wibox.container.margin}
|
||||||
:widget wibox.container.background
|
:widget wibox.container.background
|
||||||
:bg beautiful.sidebar_bg_info})
|
:bg beautiful.sidebar_bg_info})
|
||||||
|
:buttons clock-buttons
|
||||||
:layout wibox.layout.fixed.vertical}
|
:layout wibox.layout.fixed.vertical}
|
||||||
:layout wibox.layout.fixed.vertical}}))
|
:layout wibox.layout.fixed.vertical}}))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user