add layer-shell, todo list

phoen
Daniel Barlow 2022-03-23 23:20:53 +00:00
parent 76b919baed
commit 10154115bf
3 changed files with 39 additions and 1 deletions

View File

@ -8,6 +8,16 @@ More seriously: you might prefer this over another status bar program
if you want fine-grained control over what is shown in your bar and
you are happy to exert that control in a Lua-based Lisp language.
## Plan
* [X] use gtk-layer-shell to put it in a layer
* [] update only at relevant intervals
* [] do we need file poll support? prolly not if we're calling every 200ms
* [] cache icon pixbufs
* [] update image/label widget instead of destroying
* [] allow height customisation
```fennel
(bar
{

View File

@ -1,4 +1,5 @@
(local {: Gtk
: GtkLayerShell
: Gdk
: GdkPixbuf
: GLib
@ -61,6 +62,24 @@
: update
}))
(fn make-layer-shell [window layer exclusive? anchors]
(let [s GtkLayerShell]
(s.init_for_window window)
(s.set_layer window (. {
:top GtkLayerShell.Layer.TOP
}
layer))
(if exclusive? (s.auto_exclusive_zone_enable window))
(each [edge margin (pairs anchors)]
(let [edge (. {:top GtkLayerShell.Edge.TOP
:bottom GtkLayerShell.Edge.BOTTOM
:left GtkLayerShell.Edge.LEFT
:right GtkLayerShell.Edge.RIGHT}
edge)]
(GtkLayerShell.set_margin window edge margin)
(GtkLayerShell.set_anchor window edge 1)))))
(local bars [])
(fn bar [{ : anchor : orientation : indicators }]
@ -85,6 +104,9 @@
(indicator:update)))
true))
(each [_ b (ipairs bars)]
(make-layer-shell b.window :top true
(collect [_ edge (ipairs b.anchor)]
edge 1))
(b.window:show_all))
(Gtk.main))

View File

@ -4,6 +4,7 @@
, fetchurl
, gobject-introspection
, gtk3
, gtk-layer-shell
, lib
, librsvg
, lua53Packages
@ -33,7 +34,12 @@ in stdenv.mkDerivation {
inherit fennel;
buildInputs = [ lua gtk3 gobject-introspection.dev ];
buildInputs = [
gobject-introspection.dev
gtk-layer-shell
gtk3
lua
];
nativeBuildInputs = [ lua makeWrapper ];
makeFlags = [ "PREFIX=${placeholder "out"}" ];