feat: add tint2ish tag list and clock to sidebar
4
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
|
||||
{}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
BIN
theme/icons/tag-list/occupied-border.png
Normal file
After Width: | Height: | Size: 133 B |
BIN
theme/icons/tag-list/occupied.png
Normal file
After Width: | Height: | Size: 125 B |
BIN
theme/icons/tag-list/panel.png
Normal file
After Width: | Height: | Size: 227 B |
BIN
theme/icons/tag-list/selected.png
Normal file
After Width: | Height: | Size: 131 B |
BIN
theme/icons/tag-list/unselected.png
Normal file
After Width: | Height: | Size: 112 B |
BIN
theme/icons/tag-list/urgent.png
Normal file
After Width: | Height: | Size: 133 B |
BIN
theme/icons/tag/code.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
1
theme/icons/tag/code.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg aria-hidden="true" data-prefix="fas" data-icon="code" class="svg-inline--fa fa-code fa-w-20" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><path fill="currentColor" d="M278.9 511.5l-61-17.7c-6.4-1.8-10-8.5-8.2-14.9L346.2 8.7c1.8-6.4 8.5-10 14.9-8.2l61 17.7c6.4 1.8 10 8.5 8.2 14.9L293.8 503.3c-1.9 6.4-8.5 10.1-14.9 8.2zm-114-112.2l43.5-46.4c4.6-4.9 4.3-12.7-.8-17.2L117 256l90.6-79.7c5.1-4.5 5.5-12.3.8-17.2l-43.5-46.4c-4.5-4.8-12.1-5.1-17-.5L3.8 247.2c-5.1 4.7-5.1 12.8 0 17.5l144.1 135.1c4.9 4.6 12.5 4.4 17-.5zm327.2.6l144.1-135.1c5.1-4.7 5.1-12.8 0-17.5L492.1 112.1c-4.8-4.5-12.4-4.3-17 .5L431.6 159c-4.6 4.9-4.3 12.7.8 17.2L523 256l-90.6 79.7c-5.1 4.5-5.5 12.3-.8 17.2l43.5 46.4c4.5 4.9 12.1 5.1 17 .6z"></path></svg>
|
After Width: | Height: | Size: 750 B |
BIN
theme/icons/tag/firefox.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
1
theme/icons/tag/firefox.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg aria-hidden="true" data-prefix="fab" data-icon="firefox" class="svg-inline--fa fa-firefox fa-w-15" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 480 512"><path fill="currentColor" d="M478.1 235.3c-.7-4.5-1.4-7.1-1.4-7.1s-1.8 2-4.7 5.9c-.9-10.7-2.8-21.2-5.8-31.6-3.7-12.9-8.5-25.4-14.5-37.4-3.8-8-8.2-15.6-13.3-22.8-1.8-2.7-3.7-5.4-5.6-7.9-8.8-14.4-19-23.3-30.7-40-7.6-12.8-12.9-26.9-15.4-41.6-3.2 8.9-5.7 18-7.4 27.3-12.1-12.2-22.5-20.8-28.9-26.7C319.4 24.2 323 9.1 323 9.1S264.7 74.2 289.9 142c8.7 23 23.8 43.1 43.4 57.9 24.4 20.2 50.8 36 64.7 76.6-11.2-21.3-28.1-39.2-48.8-51.5 6.2 14.7 9.4 30.6 9.3 46.5 0 61-49.6 110.5-110.6 110.4-8.3 0-16.5-.9-24.5-2.8-9.5-1.8-18.7-4.9-27.4-9.3-12.9-7.8-24-18.1-32.8-30.3l-.2-.3 2 .7c4.6 1.6 9.2 2.8 14 3.7 18.7 4 38.3 1.7 55.6-6.6 17.5-9.7 28-16.9 36.6-14h.2c8.4 2.7 15-5.5 9-14-10.4-13.4-27.4-20-44.2-17-17.5 2.5-33.5 15-56.4 2.9-1.5-.8-2.9-1.6-4.3-2.5-1.6-.9 4.9 1.3 3.4.3-5-2.5-9.8-5.4-14.4-8.6-.3-.3 3.5 1.1 3.1.8-5.9-4-11-9.2-15-15.2-4.1-7.4-4.5-16.4-1-24.1 2.1-3.8 5.4-6.9 9.3-8.7 3 1.5 4.8 2.6 4.8 2.6s-1.3-2.5-2.1-3.8c.3-.1.5 0 .8-.2 2.6 1.1 8.3 4 11.4 5.8 2.1 1.1 3.8 2.7 5.2 4.7 0 0 1-.5.3-2.7-1.1-2.7-2.9-5-5.4-6.6h.2c2.3 1.2 4.5 2.6 6.6 4.1 1.9-4.4 2.8-9.2 2.6-14 .2-2.6-.2-5.3-1.1-7.8-.8-1.6.5-2.2 1.9-.5-.2-1.3-.7-2.5-1.2-3.7v-.1s.8-1.1 1.2-1.5c1-1 2.1-1.9 3.4-2.7 7.2-4.5 14.8-8.4 22.7-11.6 6.4-2.8 11.7-4.9 12.8-5.6 1.6-1 3.1-2.2 4.5-3.5 5.3-4.5 9-10.8 10.2-17.7.1-.9.2-1.8.3-2.8v-1.5c-.9-3.5-6.9-6.1-38.4-9.1-11.1-1.8-20-10.1-22.5-21.1v.1c-.4 1.1-.9 2.3-1.3 3.5.4-1.2.8-2.3 1.3-3.5v-.2c6-15.7 16.8-29.1 30.8-38.3.8-.7-3.2.2-2.4-.5 2.7-1.3 5.4-2.5 8.2-3.5 1.4-.6-6-3.4-12.6-2.7-4 .2-8 1.2-11.7 2.8 1.6-1.3 6.2-3.1 5.1-3.1-8.4 1.6-16.5 4.7-23.9 9 0-.8.1-1.5.5-2.2-5.9 2.5-11 6.5-15 11.5.1-.9.2-1.8.2-2.7-2.7 2-5.2 4.3-7.3 6.9l-.1.1c-17.4-6.7-36.3-8.3-54.6-4.7l-.2-.1h.2c-3.8-3.1-7.1-6.7-9.7-10.9l-.2.1-.4-.2c-1.2-1.8-2.4-3.8-3.7-6-.9-1.6-1.8-3.4-2.7-5.2 0-.1-.1-.2-.2-.2-.4 0-.6 1.7-.9 1.3v-.1c-3.2-8.3-4.7-17.2-4.4-26.2l-.2.1c-5.1 3.5-9 8.6-11.1 14.5-.9 2.1-1.6 3.3-2.2 4.5v-.5c.1-1.1.6-3.3.5-3.1-.1.2-.2.3-.3.4-1.5 1.7-2.9 3.7-3.9 5.8-.9 1.9-1.7 3.9-2.3 5.9-.1.3 0-.3 0-1s.1-2 0-1.7l-.3.7c-6.7 14.9-10.9 30.8-12.4 47.1-.4 2.8-.6 5.6-.5 8.3v.2c-4.8 5.2-9 11-12.7 17.1-12.1 20.4-21.1 42.5-26.8 65.6 4-8.8 8.8-17.2 14.3-25.1C5.5 228.5 0 257.4 0 286.6c1.8-8.6 4.2-17 7-25.3-1.7 34.5 4.9 68.9 19.4 100.3 19.4 43.5 51.6 80 92.3 104.7 16.6 11.2 34.7 19.9 53.8 25.8 2.5.9 5.1 1.8 7.7 2.7-.8-.3-1.6-.7-2.4-1 22.6 6.8 46.2 10.3 69.8 10.3 83.7 0 111.3-31.9 113.8-35 4.1-3.7 7.5-8.2 9.9-13.3 1.6-.7 3.2-1.4 4.9-2.1l1-.5 1.9-.9c12.6-5.9 24.5-13.4 35.3-22.1 16.3-11.7 27.9-28.7 32.9-48.1 3-7.1 3.1-15 .4-22.2.9-1.4 1.7-2.8 2.7-4.3 18-28.9 28.2-61.9 29.6-95.9v-2.8c0-7.3-.6-14.5-1.9-21.6z"></path></svg>
|
After Width: | Height: | Size: 2.7 KiB |
@ -1,35 +1,42 @@
|
||||
;; Have to use underscores for `beautiful' compat.
|
||||
;; Non-beautiful variables are commented with an asterisk.
|
||||
{
|
||||
:font "Sarasa Mono J"
|
||||
:variable_font "Sarasa UI J"
|
||||
(let [theme-dir (.. (os.getenv "HOME") "/.config/awesome/theme")
|
||||
icon-dir (.. theme-dir "/icons/")]
|
||||
{
|
||||
:font "Sarasa Mono J"
|
||||
:variable_font "Sarasa UI J"
|
||||
:textclock_font "Sarasa UI J"
|
||||
|
||||
:sidebar_position :left ;; *
|
||||
:sidebar_width 36 ;; *
|
||||
:sidebar_bg "#1a1e24" ;; *
|
||||
:sidebar_subbox "#252b33" ;; *
|
||||
:sidebar_position :left ;; *
|
||||
:sidebar_width 36 ;; *
|
||||
:sidebar_bg_info "#252b33" ;; *
|
||||
|
||||
:bg_focus "#252b33"
|
||||
:bg_normal "#1a1e24"
|
||||
:fg_focus "#cfcfcf"
|
||||
:fg_normal "#cfcfcf"
|
||||
:bg_focus "#252b33"
|
||||
:bg_normal "#1a1e24"
|
||||
:fg_focus "#cfcfcf"
|
||||
:fg_normal "#cfcfcf"
|
||||
|
||||
:useless_gap 0
|
||||
:border_width 0
|
||||
:border_focus "#5bb3b4"
|
||||
:border_normal "#1a1e24"
|
||||
:use_titlebars_for_borders nil ;; *
|
||||
:titlebar_border_width 1 ;; *
|
||||
:useless_gap 0
|
||||
:border_width 0
|
||||
:border_focus "#5bb3b4"
|
||||
:border_normal "#1a1e24"
|
||||
:use_titlebars_for_borders nil ;; *
|
||||
:titlebar_border_width 1 ;; *
|
||||
|
||||
:titlebar_position :left ;; *
|
||||
:titlebar_size 15 ;; *
|
||||
:titlebar_bg_focus "#926b3e"
|
||||
:titlebar_bg_normal "#252b33"
|
||||
:titlebar_fg_focus "#1a1e24"
|
||||
:titlebar_fg_normal "#cfcfcf"
|
||||
:titlebar_position :left ;; *
|
||||
:titlebar_size 15 ;; *
|
||||
:titlebar_bg_focus "#926b3e"
|
||||
:titlebar_bg_normal "#252b33"
|
||||
:titlebar_fg_focus "#1a1e24"
|
||||
:titlebar_fg_normal "#cfcfcf"
|
||||
|
||||
:icon_theme "Vertex Maia"
|
||||
:notification_icon_size 48
|
||||
:notification_border_width 0
|
||||
:notification_bg "#252b33"
|
||||
}
|
||||
:icon_theme "Vertex Maia"
|
||||
:notification_icon_size 48
|
||||
:notification_border_width 0
|
||||
:notification_bg "#252b33"
|
||||
|
||||
:taglist_bg_empty (.. "png:" icon-dir "tag-list/unselected.png")
|
||||
:taglist_bg_focus (.. "png:" icon-dir "tag-list/selected.png")
|
||||
:taglist_bg_occupied (.. "png:" icon-dir "tag-list/occupied.png")
|
||||
:taglist_bg_urgent (.. "png:" icon-dir "tag-list/urgent.png")
|
||||
})
|
||||
|
52
widget/clickable-container.fnl
Normal file
@ -0,0 +1,52 @@
|
||||
;;; widget/clickable-container.fnl --- Clickable container
|
||||
|
||||
;;; Commentary:
|
||||
;; From https://github.com/PapyElGringo/material-awesome/blob/57116136a904560e8626b673370d2130b40dc62a/widgets/clickable-container.lua
|
||||
|
||||
;;; Code:
|
||||
|
||||
(local wibox (require :wibox))
|
||||
(local naughty (require :naughty))
|
||||
(local awful (require :awful))
|
||||
|
||||
;;;
|
||||
;; Functions
|
||||
|
||||
(fn build [widget]
|
||||
(let [container (wibox.container.background widget)]
|
||||
(var old-cursor {})
|
||||
(var old-wibox {})
|
||||
|
||||
(: container :connect_signal
|
||||
:mouse::enter
|
||||
(lambda []
|
||||
(let [cw _G.mouse.current_wibox]
|
||||
(tset container :bg "#ffffff11")
|
||||
;; Hm, no idea how to get the wibox from this signal's arguments...
|
||||
(when cw
|
||||
(set old-cursor cw.cursor)
|
||||
(set old-wibox cw)
|
||||
(tset cw :cursor :hand1)))))
|
||||
|
||||
(: container :connect_signal
|
||||
:mouse::leave
|
||||
(lambda []
|
||||
(tset container :bg "#ffffff00")
|
||||
(when old-wibox
|
||||
(tset old-wibox :cursor old-cursor)
|
||||
(set old-wibox nil))))
|
||||
|
||||
(: container :connect_signal
|
||||
:button::press
|
||||
(lambda []
|
||||
(tset container :bg "#ffffff22")))
|
||||
|
||||
(: container :connect_signal
|
||||
:button::release
|
||||
(lambda []
|
||||
(tset container :bg "#ffffff11")))
|
||||
|
||||
container))
|
||||
|
||||
build
|
||||
;;; widget/clickable-container.fnl ends here
|
80
widget/list_update.lua
Normal file
@ -0,0 +1,80 @@
|
||||
local common = require("awful.widget.common")
|
||||
local dpi = require("beautiful").xresources.apply_dpi
|
||||
local wibox = require("wibox")
|
||||
local clickable_container = require("widget.clickable-container")
|
||||
|
||||
function list_update(w, buttons, label, data, objects)
|
||||
-- update the widgets, creating them if needed
|
||||
w:reset()
|
||||
for i, o in ipairs(objects) do
|
||||
local cache = data[o]
|
||||
local ib, tb, bgb, tbm, ibm, l
|
||||
if cache then
|
||||
ib = cache.ib
|
||||
tb = cache.tb
|
||||
bgb = cache.bgb
|
||||
tbm = cache.tbm
|
||||
ibm = cache.ibm
|
||||
else
|
||||
ib = wibox.widget.imagebox()
|
||||
tb = wibox.widget.textbox()
|
||||
bgb = wibox.container.background()
|
||||
tbm = wibox.container.margin(tb, dpi(4), dpi(4))
|
||||
ibm = wibox.container.margin(ib, dpi(10), dpi(8), dpi(8), dpi(8))
|
||||
-- ibm = wibox.container.margin(ib, dpi(4))
|
||||
l = wibox.layout.fixed.horizontal()
|
||||
bg_clickable = clickable_container()
|
||||
|
||||
-- All of this is added in a fixed widget
|
||||
l:fill_space(true)
|
||||
l:add(ibm)
|
||||
-- l:add(tbm)
|
||||
bg_clickable:set_widget(l)
|
||||
|
||||
-- And all of this gets a background
|
||||
-- bgb:set_widget(l)
|
||||
bgb:set_widget(bg_clickable)
|
||||
|
||||
bgb:buttons(common.create_buttons(buttons, o))
|
||||
|
||||
data[o] = {
|
||||
ib = ib,
|
||||
tb = tb,
|
||||
bgb = bgb,
|
||||
tbm = tbm,
|
||||
ibm = ibm,
|
||||
}
|
||||
end
|
||||
|
||||
local text, bg, bg_image, icon, args = label(o, tb)
|
||||
args = args or {}
|
||||
|
||||
-- The text might be invalid, so use pcall.
|
||||
if text == nil or text == "" then
|
||||
tbm:set_margins(0)
|
||||
else
|
||||
if not tb:set_markup_silently(text) then
|
||||
tb:set_markup("<i><Invalid text></i>")
|
||||
end
|
||||
end
|
||||
bgb:set_bg(bg)
|
||||
if type(bg_image) == "function" then
|
||||
-- TODO: Why does this pass nil as an argument?
|
||||
bg_image = bg_image(tb,o,nil,objects,i)
|
||||
end
|
||||
bgb:set_bgimage(bg_image)
|
||||
if icon then
|
||||
ib:set_image(icon)
|
||||
else
|
||||
ibm:set_margins(0)
|
||||
end
|
||||
|
||||
bgb.shape = args.shape
|
||||
bgb.shape_border_width = args.shape_border_width
|
||||
bgb.shape_border_color = args.shape_border_color
|
||||
|
||||
w:add(bgb)
|
||||
end
|
||||
end
|
||||
|
||||
return list_update
|
@ -5,17 +5,101 @@
|
||||
(local awful (require :awful))
|
||||
(local beautiful (require :beautiful))
|
||||
(local wibox (require :wibox))
|
||||
(local common (require :awful.widget.common))
|
||||
(local dpi (. (require :beautiful) :xresources :apply_dpi))
|
||||
|
||||
(local std (require :lib.std))
|
||||
|
||||
;;;
|
||||
;; Functions
|
||||
|
||||
(fn update-tag-list [w buttons label data objects]
|
||||
(: w :reset)
|
||||
(each [i o (ipairs objects)]
|
||||
(let [cache (. data o)]
|
||||
(var ib nil)
|
||||
(var tb nil)
|
||||
(var bgb nil)
|
||||
(var tbm nil)
|
||||
(var ibm nil)
|
||||
(var l nil)
|
||||
(if cache
|
||||
(do
|
||||
(set ib cache.ib)
|
||||
(set tb cache.tb)
|
||||
(set bgb cache.bgb)
|
||||
(set tbm cache.tbm)
|
||||
(set ibm cache.ibm))
|
||||
(do
|
||||
(set ib (wibox.widget.imagebox))
|
||||
(set tb (wibox.widget.textbox))
|
||||
(set bgb (wibox.container.background))
|
||||
(set tbm (wibox.container.margin tb (dpi 4) (dpi 4)))
|
||||
;; (set ibm (wibox.container.margin ib (dpi 12) (dpi 12) (dpi 12) (dpi 12)))
|
||||
(set ibm (wibox.container.margin ib (dpi 4)))
|
||||
(set l (wibox.layout.fixed.horizontal))
|
||||
|
||||
;; All of this is added in a fixed widget
|
||||
(doto l
|
||||
(: :fill_space true)
|
||||
(: :add ibm)
|
||||
(: :add tbm))
|
||||
|
||||
;; And all of this gets a background
|
||||
(: bgb :set_widget l)
|
||||
|
||||
(: bgb :buttons (common.create_buttons buttons o))
|
||||
|
||||
(tset data o {:ib ib :tb tb :bgb bgb :tbm tbm :ibm ibm})))
|
||||
|
||||
(let [[text bg bg-image icon args] (label o tb)]
|
||||
;; The text might be invalid, so use pcall.
|
||||
(if (std.s-empty? text)
|
||||
(: tbm :set_margins 0)
|
||||
(when (not (: tb :set_markup_silently text))
|
||||
(: tb :set_markup "<i><Invalid text></i>")))
|
||||
(: bgb :set_bg bg)
|
||||
|
||||
(: bgb :set_bgimage (if (std.fn? bg-image)
|
||||
;; TODO: Why does this pass nil as an argument?
|
||||
(bg-image tb o nil objects i)
|
||||
bg-image))
|
||||
|
||||
(if icon
|
||||
(: ib :set_image icon)
|
||||
(: ibm :set_margins 0))
|
||||
|
||||
(let [args (or args {})]
|
||||
(doto bgb
|
||||
(tset :shape args.shape)
|
||||
(tset :shape_border_width args.shape_border_width)
|
||||
(tset :shape_border_color args.shape_border_color)))
|
||||
|
||||
(: w :add bgb)))))
|
||||
|
||||
(fn container []
|
||||
(let [l (wibox.layout.fixed.vertical)]
|
||||
;; Wishlist: let*
|
||||
(local innerm (wibox.container.margin nil 10 10))
|
||||
(local bg (wibox.container.background innerm "#faa"))
|
||||
(local outerm (wibox.container.margin bg 4 4))
|
||||
|
||||
(: l :fill_space true)
|
||||
(: l :add outerm)
|
||||
|
||||
l))
|
||||
|
||||
(fn tag-list [s]
|
||||
(awful.widget.taglist
|
||||
s
|
||||
awful.widget.taglist.filter.selected
|
||||
awful.widget.taglist.filter.all
|
||||
{}
|
||||
{:font (.. beautiful.font " Bold 10")}
|
||||
nil
|
||||
{:font (.. beautiful.font " Bold 10")
|
||||
:spacing 2}
|
||||
;; update-tag-list
|
||||
(require :widget.list_update)
|
||||
;; awful.widget.common.list_update
|
||||
;; (container)
|
||||
(wibox.layout.fixed.vertical)
|
||||
))
|
||||
|
||||
|
43
widget/textclock.fnl
Normal file
@ -0,0 +1,43 @@
|
||||
;;; widget/textclock.fnl --- Configurable text clock widget
|
||||
|
||||
;;; Commentary:
|
||||
;; More modular than the standard library
|
||||
|
||||
;;; Code:
|
||||
|
||||
(local beautiful (require :beautiful))
|
||||
(local gears (require :gears))
|
||||
(local glib (. (require :lgi) :GLib))
|
||||
(local wibox (require :wibox))
|
||||
(local DateTime glib.DateTime)
|
||||
(local TimeZone glib.TimeZone)
|
||||
|
||||
;;;
|
||||
;; Functions
|
||||
|
||||
(fn calc-timeout [real-timeout]
|
||||
(% (- real-timeout (os.time)) real-timeout))
|
||||
|
||||
(fn textclock [format timeout timezone font]
|
||||
(let [format (or format " %a %b %d, %H:%M ")
|
||||
timeout (or timeout 60)
|
||||
timezone (or (and timezone (TimeZone.new timezone))
|
||||
(TimeZone.new_local))
|
||||
font (or font beautiful.textclock_font)
|
||||
w (wibox.widget.textbox)]
|
||||
(var t nil)
|
||||
|
||||
(tset w :font font)
|
||||
|
||||
(fn w._private.textclock_update_cb []
|
||||
(: w :set_markup (: (DateTime.new_now timezone) :format format))
|
||||
(tset t :timeout (calc-timeout timeout))
|
||||
(: t :again)
|
||||
true)
|
||||
|
||||
(set t (gears.timer.weak_start_new timeout w._private.textclock_update_cb))
|
||||
(: t :emit_signal :timeout)
|
||||
w))
|
||||
|
||||
textclock
|
||||
;;; widget/textclock.fnl ends here
|