swayphone_saturn_show shows saturn using dbus call

phoen
Daniel Barlow 2022-01-17 23:58:06 +00:00
parent bbba059634
commit 08dd9405e2
2 changed files with 18 additions and 8 deletions

View File

@ -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"
'';
}

View File

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