From 5b93b8f7664e49d6debc68e415f8885c7f0fc484 Mon Sep 17 00:00:00 2001 From: xeals Date: Tue, 15 Jan 2019 11:37:47 +1100 Subject: [PATCH] refactor(sidebar): split tag/task list out --- module/sidebar.fnl | 29 +++++++---------------------- widget/tag-list.fnl | 30 ++++++++++++++++++++++++++++++ widget/task-list.fnl | 19 +++++++++++++++++++ 3 files changed, 56 insertions(+), 22 deletions(-) create mode 100644 widget/tag-list.fnl create mode 100644 widget/task-list.fnl diff --git a/module/sidebar.fnl b/module/sidebar.fnl index 01e71c4..896e6ba 100644 --- a/module/sidebar.fnl +++ b/module/sidebar.fnl @@ -6,6 +6,9 @@ (local beautiful (require :beautiful)) (local wibox (require :wibox)) +(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))) @@ -24,26 +27,8 @@ ;; Functions (fn draw-sidebar [s] - (set s.sb-tag (awful.widget.taglist - {:screen s - :filter awful.widget.taglist.filter.selected - :style {:font (.. beautiful.font " Bold 10")} - ;; :widget_template - ;; {1 - ;; {:id "index_role" - ;; :widget wibox.widget.textbox} - ;; :widget wibox.container.margin - ;; :margins 5 - ;; :create_callback - ;; (lambda [self, c3, index, objects])} - :layout wibox.layout.fixed.vertical - } - )) - (set s.sb-tasks (awful.widget.tasklist - {:screen s - :filter awful.widget.tasklist.filter.currenttags - :style {:disable_task_name true} - })) + (set s.sb-tag (tag-list s)) + (set s.sb-tasks (task-list s)) (set s.sb (awful.wibar {:position beautiful.sidebar_position :width beautiful.sidebar_width @@ -67,8 +52,8 @@ ;;; ;; Configuration -;; (awful.screen.connect_for_each_screen -;; draw-sidebar) +(awful.screen.connect_for_each_screen + draw-sidebar) {} ;;; module/sidebar.fnl ends here diff --git a/widget/tag-list.fnl b/widget/tag-list.fnl new file mode 100644 index 0000000..3f27f08 --- /dev/null +++ b/widget/tag-list.fnl @@ -0,0 +1,30 @@ +;;; widget/tag-list.fnl --- Vertical tag list widget + +;;; Code: + +(local awful (require :awful)) +(local beautiful (require :beautiful)) +(local wibox (require :wibox)) + +;;; +;; Functions + +(fn tag-list [s] + (awful.widget.taglist + {:screen s + :filter awful.widget.taglist.filter.selected + :style {:font (.. beautiful.font " Bold 10")} + ;; :widget_template + ;; {1 + ;; {:id "index_role" + ;; :widget wibox.widget.textbox} + ;; :widget wibox.container.margin + ;; :margins 5 + ;; :create_callback + ;; (lambda [self, c3, index, objects])} + :layout wibox.layout.fixed.vertical + } + )) + +tag-list +;;; widget/tag-list.fnl ends here diff --git a/widget/task-list.fnl b/widget/task-list.fnl new file mode 100644 index 0000000..53c6dab --- /dev/null +++ b/widget/task-list.fnl @@ -0,0 +1,19 @@ +;;; widget/task-list.fnl --- Vertical task list + +;;; Code: + +(local awful (require :awful)) + +;;; +;; Functions + +(fn task-list [s] + (awful.widget.tasklist + {:screen s + :filter awful.widget.tasklist.filter.currenttags + :style {:disable_task_name true} + })) + + +task-list +;;; widget/task-list.fnl ends here