eufon

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 8d8c65e5b394765f5e1fbead73ce6c6ef58c7c4d
parent c426bf7893420a6a1528fb59821eb60db49cba72
Author: Daniel Barlow <dan@telent.net>
Date:   Tue,  5 Apr 2022 21:09:52 +0000

add "gravity" option for bar

A bar must be full-screen-width (or height, for vertical bars) to
have an "exclusive zone", otherwise it appears on top of other windows
instead of moving them out of the way. To right-justify (or bottom-
justify) the indicators in a bar, add :gravity :end to its options

Am *probably* going to get rid of this again, in favour of adding
support for "spacers" in the bar - then the same bar could contain
both left- and right-justified indicators

Diffstat:
Mblinkenlicht/bl.fnl | 6+++++-
Mblinkenlicht/blinkenlicht.fnl | 7++++++-
2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/blinkenlicht/bl.fnl b/blinkenlicht/bl.fnl @@ -23,8 +23,12 @@ (bar { - :anchor [:top :right] + ;; bar must be full width to set up an "exclusive zone" (moves + ;; other windows out of the way), otherwise it will display on + ;; to of whatever's on the screen already + :anchor [:top :right :left] :orientation :horizontal + :gravity :end :classes ["hey"] :indicators [ diff --git a/blinkenlicht/blinkenlicht.fnl b/blinkenlicht/blinkenlicht.fnl @@ -135,7 +135,9 @@ (local bars []) -(fn bar [{ : anchor : orientation : indicators : classes }] +(fn bar [{: anchor : orientation : indicators + : gravity + : classes }] (let [window (Gtk.Window {} ) orientation (match orientation :vertical Gtk.Orientation.VERTICAL @@ -145,6 +147,9 @@ (add-css-classes ["bar"]) (add-css-classes (or classes []))) + (if (= gravity :end) + (box:pack_start (Gtk.EventBox) true true 0)) + (table.insert bars { : window : anchor : indicators }) (each [_ i (ipairs indicators)] (box:pack_start i.button false false 0))