eufon

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

commit 08dd9405e2e3f4c774e5eb21c9f3b0be4038d31c
parent bbba059634651f1e156fbfa9c9eb1ad5a48a5866
Author: Daniel Barlow <dan@telent.net>
Date:   Mon, 17 Jan 2022 23:58:06 +0000

swayphone_saturn_show shows saturn using dbus call

Diffstat:
Msaturn/default.nix | 10++++++++++
Msaturn/main.fnl | 16++++++++--------
2 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/saturn/default.nix b/saturn/default.nix @@ -9,6 +9,7 @@ , lua53Packages , lua5_3 , makeWrapper +, writeText }: let fennel = fetchurl { name = "fennel.lua"; @@ -35,6 +36,13 @@ let fennel = fetchurl { cp inifile.lua "$out/share/lua/${lua.luaversion}/" ''; }; + + serviceFile = out: writeText "squeekboard.service" '' + [D-BUS Service] + Name=net.telent.saturn + Exec=${out}/bin/saturn + ''; + lua = lua5_3.withPackages (ps: with ps; [ dbusProxy inifile @@ -59,6 +67,8 @@ in stdenv.mkDerivation { # This makes a big difference to how many icons are displayed on # my machine postInstall = '' + mkdir -p $out/share/dbus-1/services + cp ${serviceFile (placeholder "out")} $out/share/dbus-1/services/net.telent.saturn.service wrapProgram $out/bin/saturn --set GDK_PIXBUF_MODULE_FILE ${librsvg.out}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache --set GI_TYPELIB_PATH "$GI_TYPELIB_PATH" ''; } diff --git a/saturn/main.fnl b/saturn/main.fnl @@ -46,6 +46,12 @@ (local icon-theme (Gtk.IconTheme.get_default)) +(local window (Gtk.Window { + :title "Saturn V" + :default_width 720 + :default_height 800 + :on_destroy Gtk.main_quit + })) (fn find-icon [name] (var found false) (if (= (name.sub 1 1) "/") @@ -97,8 +103,7 @@ (if app.Terminal (spawn-async ["kitty" cmd]) (spawn-async ["sh" "-c" cmd])) - (Gtk.main_quit) - (os.exit 0))) + (window:hide))) (fn button-for [app] (doto (Gtk.Button @@ -109,12 +114,7 @@ :on_clicked #(launch app) }) (: :set_image app.IconImage))) -(local window (Gtk.Window { - :title "Saturn V" - :default_width 720 - :default_height 800 - :on_destroy Gtk.main_quit - })) + (fn handle-dbus-method-call [conn sender path interface method params invocation] (when (and (= path "/net/telent/saturn") (= interface "net.telent.saturn")