awesome/module/sidebar.fnl

75 lines
1.8 KiB
Fennel

;;; module/sidebar.fnl --- Informational sidebar
;;; Code:
(local awful (require :awful))
(local beautiful (require :beautiful))
(local lain (require :lain))
(local wibox (require :wibox))
(local std (require :lib.std))
(local tag-list (require :widget.tag-list))
(local task-list (require :widget.task-list))
(local textclock (require :widget.textclock))
(local markup lain.util.markup)
;;;
;; Functions
(fn border [t margin]
(let [side (or margin 2)
end (+ side 1)]
{1 t
:bottom end
:left side
:right side
:top end
:widget wibox.container.margin} ))
(fn center [t]
{1 t
:align "center"
:widget wibox.container.place})
(local clock (textclock "%H\n%M"))
(local systray (doto (wibox.widget.systray)
(: :set_base_size 24)
(: :set_horizontal false)))
(local battery (require :widget.bat))
(local pulse (require :widget.pulse))
(fn draw-sidebar [s]
(set s.sb (awful.wibar {:position beautiful.sidebar_position
:width beautiful.sidebar_width
:screen s}))
(: s.sb :setup
{:layout wibox.layout.align.vertical
1 {1 (border (tag-list s))
;; 2 (task-list s)
:layout wibox.layout.fixed.vertical}
2 nil
3 {1 (center systray)
2 (center battery.widget)
3 {1 (border
{1 {1 (center clock)
:top 2
:bottom 2
:widget wibox.container.margin}
:widget wibox.container.background
:bg beautiful.sidebar_bg_info})
:layout wibox.layout.fixed.vertical}
:layout wibox.layout.fixed.vertical}}))
;;;
;; Configuration
(awful.screen.connect_for_each_screen
draw-sidebar)
{}
;;; module/sidebar.fnl ends here