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!ia0y~yU{C;I4mJh`hT^KKFANL}EX7WqAsieW95oy%9SjT% zHl8kyArY-_&nYr8Cf|Qu!XT%>A>pf#@H=(ewA-c7psJCZf8IR_2LC$ VEDm9-x4s66d%F6$taD0e0sx`VAW{GT 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!ia0y~yU{C;I4mJh`hT^KKFANL}EX7WqAsieW95oy%9SjT% zCY~;iArY-_&lxf@7;qdpusqJH^vM2gO3hD`6vDrMJ)e|b%*TKNCa5qcTw^@+ 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!ia0y~yU~m9o4mJh`hE;GxvX-Ln`LHofYp9oG)?w{LO2TX$Q?Z{~Dff>us8|Fk{mKg)s4`wYxmFYbW!Hh_)s! z3E#A*n2*)*)VgIXuG^Z*qC|SLUiJPpoN}ZzHMc|hk1=V2i;RnlJGY1NB}?*F9onP!Q^LX>m%tw|tGl{ic|VjEszi*w4SdzP?`bNB)m;o)hc$gUu+}&ONeo=;>pP%2ME${B^ELOKoOGrpyIC}Wan>TAhw5C2= zTG8sXaK`-k^W8mp7;dfe)ezx2{IEb`+0v_7TUX9-Zs(Itl4x`MYG`k7zdk@i#9C|L zqD6}iz5o6@a5B?}YK}wqZk1TgZB)6>(F(?>d0qrbPeH}#kxi{k>Hxg|{p6E=YKhki6QH8su7&d$ye z>h0<2S+I@?6v#Z6ch~&<^fYIqMc?DUfB*i?*|T>2`t{eZU%##_S`YHnL=TlFEx*eq zckkW1*H={>sx_6%Z2IGm6*d3={rz41a>m)TVx@^53w|xp=(_a!>#sS_^kR3Fyu7|X zet&@L;)@wyPEFMg59mH_z_U3*M{LHrlXc5mN_dg zGc)t&Y>(*Z=xC#vK8w1*?%9}pylr=7C4RbMou?<%|Z$^88G_O^M*f1bkz zckkZ4E76vC<1T$Cmj7q7l2`va*gU%q_#k|5ERxOVN@wK@NpO{99;dL6e$t!;Z5B;s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