refactor(sidebar): split tag/task list out

This commit is contained in:
xeals 2019-01-15 11:37:47 +11:00
parent 25e03a70b8
commit 5b93b8f766
3 changed files with 56 additions and 22 deletions

View File

@ -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

30
widget/tag-list.fnl Normal file
View File

@ -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

19
widget/task-list.fnl Normal file
View File

@ -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