From f3f59bbd8f4e272cb3d1f19b4e17794933968a2b Mon Sep 17 00:00:00 2001 From: Ryo Nakano Date: Sat, 15 Aug 2026 17:05:41 +0900 Subject: [PATCH 1/3] Autostart using systemd instead of gnome-session --- README.md | 1 + data/bluetooth-daemon.desktop | 12 ------------ data/bluetooth.service.in | 12 ++++++++++++ data/meson.build | 22 +++++++++++++++++----- meson.build | 3 +++ meson_options.txt | 1 + 6 files changed, 34 insertions(+), 17 deletions(-) delete mode 100644 data/bluetooth-daemon.desktop create mode 100644 data/bluetooth.service.in create mode 100644 meson_options.txt diff --git a/README.md b/README.md index 969f993..51c9a31 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ You'll need the following dependencies: libgranite-dev >= 6.0.0 libgtk3-dev + systemd-dev meson valac diff --git a/data/bluetooth-daemon.desktop b/data/bluetooth-daemon.desktop deleted file mode 100644 index ef434d9..0000000 --- a/data/bluetooth-daemon.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Name=Bluetooth Daemon -Comment=Send and receive files via Bluetooth -Exec=io.elementary.bluetooth -s -Icon=io.elementary.bluetooth -Type=Application -NoDisplay=true -Categories=System; -X-GNOME-Autostart-Notify=false -X-GNOME-AutoRestart=true -X-GNOME-Autostart-enabled=true -OnlyShowIn=Pantheon; diff --git a/data/bluetooth.service.in b/data/bluetooth.service.in new file mode 100644 index 0000000..d4ef9b4 --- /dev/null +++ b/data/bluetooth.service.in @@ -0,0 +1,12 @@ +[Unit] +Description=Bluetooth Daemon +After=gnome-session-initialized.target + +[Install] +WantedBy=gnome-session-initialized.target + +[Service] +Type=exec +ExecStart=@bindir@/io.elementary.bluetooth -s +Restart=on-failure +Slice=session.slice diff --git a/data/meson.build b/data/meson.build index 9335494..bef2016 100644 --- a/data/meson.build +++ b/data/meson.build @@ -13,11 +13,23 @@ foreach i : icon_sizes ) endforeach -install_data( - 'bluetooth-daemon.desktop', - rename: meson.project_name() + '.desktop', - install_dir: get_option('sysconfdir') / 'xdg' / 'autostart' -) +if systemd_user_unit_dir != 'no' + systemd_dep = dependency ('systemd') + + if systemd_user_unit_dir == '' + systemd_user_unit_dir = systemd_dep.get_variable('systemduserunitdir', pkgconfig_define: ['prefix', prefix]) + endif + + service_config = configuration_data() + service_config.set('bindir', bindir) + + configure_file( + input: 'bluetooth.service.in', + output: meson.project_name() + '.service', + configuration: service_config, + install_dir: systemd_user_unit_dir + ) +endif i18n.merge_file( input: 'bluetooth.desktop', diff --git a/meson.build b/meson.build index d187293..4cf94a8 100644 --- a/meson.build +++ b/meson.build @@ -10,6 +10,9 @@ add_global_arguments('-DGETTEXT_PACKAGE="@0@"'.format(meson.project_name()), lan gnome = import('gnome') i18n = import('i18n') +prefix = get_option('prefix') +bindir = prefix / get_option('bindir') + granite_dep = dependency ('granite') gtk_dep = dependency ('gtk+-3.0') posix_dep = meson.get_compiler('vala').find_library('posix') diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000..d1195c4 --- /dev/null +++ b/meson_options.txt @@ -0,0 +1 @@ +option('systemduserunitdir', type: 'string', value: '', description: 'custom directory for systemd user units, or \'no\' to disable') From b7152be1d7eb7f53c215c03dd83bd96bb2d5eed6 Mon Sep 17 00:00:00 2001 From: Ryo Nakano Date: Sat, 15 Aug 2026 17:07:12 +0900 Subject: [PATCH 2/3] Actions: Add systemd-dev --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7249bc2..11a2c1a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -23,7 +23,7 @@ jobs: - name: Install Dependencies run: | apt update - apt install -y libgranite-dev meson valac + apt install -y libgranite-dev systemd-dev meson valac - name: Build env: DESTDIR: out From 55a080501f0abef9a1279b9ae3929764b218abb0 Mon Sep 17 00:00:00 2001 From: Ryo Nakano Date: Sat, 15 Aug 2026 17:21:17 +0900 Subject: [PATCH 3/3] Fix missing variable --- data/meson.build | 1 + 1 file changed, 1 insertion(+) diff --git a/data/meson.build b/data/meson.build index bef2016..d910a4a 100644 --- a/data/meson.build +++ b/data/meson.build @@ -13,6 +13,7 @@ foreach i : icon_sizes ) endforeach +systemd_user_unit_dir = get_option('systemduserunitdir') if systemd_user_unit_dir != 'no' systemd_dep = dependency ('systemd')