diff --git a/module/sidebar.fnl b/module/sidebar.fnl index ee60f2c..5a522ec 100644 --- a/module/sidebar.fnl +++ b/module/sidebar.fnl @@ -36,6 +36,14 @@ :align "center" :widget wibox.container.place}) +(fn deftooltip [obj callback] + (awful.tooltip + {:objects [obj] + :timer_function callback + :delay_show 0.5 + :margin_leftright (dpi 10) + :margin_topbottom (dpi 8)})) + (local clock (textclock "%H\n%M")) (local systray (doto (wibox.widget.systray) (: :set_base_size 24) @@ -48,12 +56,6 @@ (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" @@ -67,11 +69,8 @@ (= 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)}) +(deftooltip clock (lambda [] (os.date "%A %d %B %Y"))) +(deftooltip battery.widget bat-detail) (fn draw-sidebar [s] (set s.sb (awful.wibar {:position beautiful.sidebar_position