From 7b21018a59d749627bcfaca189c70e171707c1ea Mon Sep 17 00:00:00 2001 From: xeals Date: Tue, 15 Jan 2019 15:14:29 +1100 Subject: [PATCH] feat: add tint2ish tag list and clock to sidebar --- cfg.fnl | 4 +- conf/tags.fnl | 20 ++++- lib/std.fnl | 7 ++ module/sidebar.fnl | 59 ++++++++------- theme/icons/tag-list/occupied-border.png | Bin 0 -> 133 bytes theme/icons/tag-list/occupied.png | Bin 0 -> 125 bytes theme/icons/tag-list/panel.png | Bin 0 -> 227 bytes theme/icons/tag-list/selected.png | Bin 0 -> 131 bytes theme/icons/tag-list/unselected.png | Bin 0 -> 112 bytes theme/icons/tag-list/urgent.png | Bin 0 -> 133 bytes theme/icons/tag/code.png | Bin 0 -> 1896 bytes theme/icons/tag/code.svg | 1 + theme/icons/tag/firefox.png | Bin 0 -> 2410 bytes theme/icons/tag/firefox.svg | 1 + theme/init.fnl | 63 +++++++++------- widget/clickable-container.fnl | 52 +++++++++++++ widget/list_update.lua | 80 ++++++++++++++++++++ widget/tag-list.fnl | 90 ++++++++++++++++++++++- widget/textclock.fnl | 43 +++++++++++ 19 files changed, 355 insertions(+), 65 deletions(-) create mode 100644 theme/icons/tag-list/occupied-border.png create mode 100644 theme/icons/tag-list/occupied.png create mode 100644 theme/icons/tag-list/panel.png create mode 100644 theme/icons/tag-list/selected.png create mode 100644 theme/icons/tag-list/unselected.png create mode 100644 theme/icons/tag-list/urgent.png create mode 100644 theme/icons/tag/code.png create mode 100644 theme/icons/tag/code.svg create mode 100644 theme/icons/tag/firefox.png create mode 100644 theme/icons/tag/firefox.svg create mode 100644 widget/clickable-container.fnl create mode 100644 widget/list_update.lua create mode 100644 widget/textclock.fnl diff --git a/cfg.fnl b/cfg.fnl index 8e92d3d..d595347 100644 --- a/cfg.fnl +++ b/cfg.fnl @@ -5,7 +5,7 @@ (local naughty (require :naughty)) (local beautiful (require :beautiful)) -(beautiful.init (require :conf.theme)) +(beautiful.init (require :theme)) (require :module.decorate) (require :module.sidebar) @@ -36,7 +36,7 @@ :unfocus (lambda [c] (set c.border_color beautiful.border_normal))} (fun.each (fn [event callback] (client.connect_signal event callback)))) -(awful.spawn.with_shell "~/.config/awesome/autostart") +;; (awful.spawn.with_shell "~/.config/awesome/autostart") ;; Empty return {} diff --git a/conf/tags.fnl b/conf/tags.fnl index 80513af..6686315 100644 --- a/conf/tags.fnl +++ b/conf/tags.fnl @@ -3,6 +3,7 @@ ;;; Code: (local awful (require :awful)) +(local beautiful (require :beautiful)) ;;; ;; Configuration @@ -12,10 +13,21 @@ (set awful.layout.layouts layouts) -(awful.screen.connect_for_each_screen - (lambda [s] - (awful.tag ["1", "2", "3", "4", "5", "6", "7", "8", "9"] - s (. layouts 1)))) +;; TODO Rasterize? +(local tags [:firefox.png :code.png :code.svg]) + +(let [icon-path (.. (os.getenv "HOME") "/.config/awesome/theme/icons/tag/")] + (awful.screen.connect_for_each_screen + (lambda [s] + (each [n tag (ipairs tags)] + (awful.tag.add + n {:icon (.. icon-path tag) + :icon_only true + :layout (. layouts 1) + :gap_single_client false + :gap beautiful.useless_gap + :screen s + :selected (= n 1)}))))) {} ;;; conf/tags.fnl ends here diff --git a/lib/std.fnl b/lib/std.fnl index 97bf29c..18650aa 100644 --- a/lib/std.fnl +++ b/lib/std.fnl @@ -13,5 +13,12 @@ (fn std.zero? [n] (= 0 n)) +(fn std.fn? [f] + (= (type f) :function)) + +(fn std.s-empty? [s] + (or (= nil s) + (= "" s))) + std ;;; std.fnl ends here diff --git a/module/sidebar.fnl b/module/sidebar.fnl index 896e6ba..4c1ad66 100644 --- a/module/sidebar.fnl +++ b/module/sidebar.fnl @@ -8,46 +8,49 @@ (local tag-list (require :widget.tag-list)) (local task-list (require :widget.task-list)) - -(local sb-clock (wibox.widget.textclock "%H\n%M")) -(local sb-systray (doto (wibox.widget.systray) - (: :set_base_size 24))) -(local fill-width (doto (wibox.layout.fixed.horizontal) - (: :fill_space true) - (: :set_spacing 10))) - -(local bounding (wibox.container.margin - (wibox.container.place - (wibox.container.margin - nil - 10 10 10 10 beautiful.sidebar_subbox)) - 1 1 1 1 beautiful.sidebar_bg)) +(local textclock (require :widget.textclock)) ;;; ;; Functions -(fn draw-sidebar [s] - (set s.sb-tag (tag-list s)) - (set s.sb-tasks (task-list s)) +(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} )) +(local sb-clock (textclock "%H\n%M")) +(local sb-systray (doto (wibox.widget.systray) + (: :set_base_size 24))) + +(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 {:layout wibox.layout.fixed.vertical - 1 {1 s.sb-tag - :halign "center" - :layout (wibox.container.margin nil 10 10 10 10)} - 2 s.sb-tasks} + 1 {1 (border (tag-list s)) + ;; 2 (task-list s) + :layout wibox.layout.fixed.vertical} 2 {:layout wibox.layout.fixed.vertical} - 3 {:layout wibox.layout.fixed.vertical - 1 sb-systray - 2 {1 sb-clock - :valign "center" - :halign "center" - :layout bounding}}})) + 3 {1 sb-systray + 2 {1 (border + {1 {1 {1 sb-clock + :valign "center" + :halign "center" + :widget wibox.container.place} + :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 diff --git a/theme/icons/tag-list/occupied-border.png b/theme/icons/tag-list/occupied-border.png new file mode 100644 index 0000000000000000000000000000000000000000..89609681e73c4944b5e097e855e709be027ffa61 GIT binary patch literal 133 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdzmSQK*5Dp-y;YjHK@@+g_977^n z-=0%sWKa+|;4n{5L*=isLSPGHv(kap(T%ZN?EEU3&dC)!d7p6 P4HETq^>bP0l+XkKq0k^w literal 0 HcmV?d00001 diff --git a/theme/icons/tag-list/occupied.png b/theme/icons/tag-list/occupied.png new file mode 100644 index 0000000000000000000000000000000000000000..7ed971001f2c54204a4acdaf86b344a4e98adaab GIT binary patch literal 125 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdzmSQK*5Dp-y;YjHK@=ZKl977^n z-<~sMWH8`3a$tF!Rq2ua+mxE0CMkq}|9Uzopr03Y2U_5c6? literal 0 HcmV?d00001 diff --git a/theme/icons/tag-list/panel.png b/theme/icons/tag-list/panel.png new file mode 100644 index 0000000000000000000000000000000000000000..40d09df153f485bb88644af0c8143760e1a1f4ae GIT binary patch literal 227 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I1|(Ny7TyC=EX7WqAsj$Z!;#VfgboFyt=akR{0LdU1&j0`b literal 0 HcmV?d00001 diff --git a/theme/icons/tag-list/urgent.png b/theme/icons/tag-list/urgent.png new file mode 100644 index 0000000000000000000000000000000000000000..2c2b87e9ac283c3d05a8190cdd888cdc70ea6948 GIT binary patch literal 133 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdzmSQK*5Dp-y;YjHK@@+g_977^n z-<~sMWDpQx2#japF(H-Ku`-9_h&uW~!`bH6`90?q_&svwn;*cZ} QT?P{MboFyt=akR{0D>GK5&!@I literal 0 HcmV?d00001 diff --git a/theme/icons/tag/code.png b/theme/icons/tag/code.png new file mode 100644 index 0000000000000000000000000000000000000000..9d7728c62e31916960c600a4800c0af3163e4923 GIT binary patch literal 1896 zcmW-i3p|urAIBfeq6w89@gnBMn<3ZDtD73UX7T2hNLe&PWZdnDacAT*G$@5#VNhh{ zlFQm+a+xHTr6|`75q3gj$|d8rfBXG>p65Kz^Eu}^|MNe;-~Z6BrPq> z?4dQ@yTnD|{u?=%0}YB|YUv;jM2TNZK@c%zOEVJ(>iwl(uUcFTlsWx$=^FR@XJ`L2)%`idai%Hh>jLEq+vHTX?SFvQ~D2*a0Q2dULlc zZf~>gik-?v)Mf1WYClZyJdDR-ZB#36vfLt#lx%g_CBUNy z=!u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