From 65a2e657ce7340744d81fc1ca15519031c205d9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Sun, 5 Oct 2025 17:49:03 +0200 Subject: [PATCH] data: Add systemd unit file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes: https://gitlab.gnome.org/World/Phosh/squeekboard/-/issues/440 Signed-off-by: Guido Günther --- data/meson.build | 8 ++++++++ data/sm.puri.Squeekboard.service.in | 16 ++++++++++++++++ debian/control | 1 + debian/squeekboard.alternatives | 2 ++ debian/squeekboard.install | 1 + meson.build | 12 +++++++++++- meson_options.txt | 4 ++++ 7 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 data/sm.puri.Squeekboard.service.in diff --git a/data/meson.build b/data/meson.build index 5d0a0879..f9711199 100644 --- a/data/meson.build +++ b/data/meson.build @@ -56,3 +56,11 @@ i18n.merge_file( install_dir: desktopdir, type: 'desktop' ) + +configure_file( + input: 'sm.puri.Squeekboard.service.in', + output: 'mobi.phosh.OSK.service', + configuration: desktopconf, + install: true, + install_dir: systemd_user_unit_dir, +) diff --git a/data/sm.puri.Squeekboard.service.in b/data/sm.puri.Squeekboard.service.in new file mode 100644 index 00000000..600f43f2 --- /dev/null +++ b/data/sm.puri.Squeekboard.service.in @@ -0,0 +1,16 @@ +# This is a systemd user unit intended to be started with gnome-session. + +[Unit] +Description=Squeekboard, an on-screen-keyboard input-method for Phosh +Documentation=https://gitlab.gnome.org/World/Phosh/squeekboard +CollectMode=inactive-or-failed + +After=gnome-session-initialized.target + +[Service] +Slice=session.slice +Type=simple +BusName=sm.puri.OSK0 +ExecStart=@bindir@/squeekboard +Restart=on-failure +TimeoutStopSec=5 diff --git a/debian/control b/debian/control index 92acf331..f1156bf5 100644 --- a/debian/control +++ b/debian/control @@ -39,6 +39,7 @@ Build-Depends: python3, python3-ruamel.yaml, rustc, + systemd-dev, wayland-protocols (>= 1.14), Standards-Version: 4.1.3 Homepage: https://gitlab.gnome.org/World/Phosh/squeekboard diff --git a/debian/squeekboard.alternatives b/debian/squeekboard.alternatives index 002d3dad..40026e18 100644 --- a/debian/squeekboard.alternatives +++ b/debian/squeekboard.alternatives @@ -2,3 +2,5 @@ Name: Phosh-OSK Link: /usr/share/applications/sm.puri.OSK0.desktop Alternative: /usr/share/squeekboard/sm.puri.Squeekboard.desktop Priority: 50 +Dependents: + /usr/lib/systemd/user/mobi.phosh.OSK.service Phosh-OSK.service /usr/share/squeekboard/sm.puri.Squeekboard.service diff --git a/debian/squeekboard.install b/debian/squeekboard.install index 569b15a6..993c4387 100644 --- a/debian/squeekboard.install +++ b/debian/squeekboard.install @@ -1,5 +1,6 @@ tools/squeekboard-restyled usr/bin usr/bin/squeekboard /usr/bin +usr/lib/systemd/user/mobi.phosh.OSK.service usr/share/squeekboard/sm.puri.Squeekboard.service usr/share/applications/*.desktop usr/share/squeekboard/ usr/share/glib-2.0/schemas/ usr/share/locale/ diff --git a/meson.build b/meson.build index c33a2be4..7524267c 100644 --- a/meson.build +++ b/meson.build @@ -72,6 +72,16 @@ endif dbusdir = join_paths(depdatadir, 'dbus-1/interfaces') schemasdir = datadir / 'glib-2.0' / 'schemas' +systemd_user_unit_dir = get_option('systemd_user_unit_dir') +systemd_dep = dependency('systemd', required: false) +if systemd_user_unit_dir == '' + if systemd_dep.found() + systemd_user_unit_dir = systemd_dep.get_variable('systemd_user_unit_dir') + else + systemd_user_unit_dir = prefix / get_option('libdir') / 'systemd' / 'user' + endif +endif + conf_data = configuration_data() conf_data.set_quoted('GETTEXT_PACKAGE', 'squeekboard') conf_data.set_quoted('LOCALEDIR', localedir) @@ -115,4 +125,4 @@ subdir('tests') gnome.post_install( glib_compile_schemas: true, -) \ No newline at end of file +) diff --git a/meson_options.txt b/meson_options.txt index 0c333858..c5ac20bd 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -14,3 +14,7 @@ option('find_orphans', option('strict', type: 'boolean', value: true, description: 'Turn more warnings into errors') + +option('systemd_user_unit_dir', + type: 'string', value: '', + description: 'Directory for systemd user units') -- GitLab