Skip to content

Commit

Permalink
Add SystemD units for Autostart (#189)
Browse files Browse the repository at this point in the history
  • Loading branch information
danirabbit authored Jan 5, 2024
1 parent cce7e7d commit 70deba9
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 1 deletion.
16 changes: 16 additions & 0 deletions data/dock.service.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[Unit]
Description=Pantheon Dock
PartOf=graphical-session.target
After=gnome-session-initialized.target

[Service]
Slice=session.slice
Type=dbus
BusName=io.elementary.dock
ExecStart=@bindir@/io.elementary.dock

# Lower down dock's OOM score to avoid being killed by OOM-killer too early
OOMScoreAdjust=-1000

[Install]
[email protected]
18 changes: 18 additions & 0 deletions data/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,21 @@ install_data(
install_dir: get_option('prefix') / get_option('datadir') / 'glib-2.0' / 'schemas',
rename: meson.project_name() + '.gschema.xml'
)

dep_systemd = dependency('systemd', required: true)
systemd_userunitdir = get_option('systemduserunitdir')
if systemd_userunitdir == ''
systemd_userunitdir = dep_systemd.get_variable('systemduserunitdir', pkgconfig_define: ['prefix', get_option('prefix')])
endif

bindir = get_option('prefix') / get_option('bindir')
unit_conf = configuration_data()
unit_conf.set('bindir', bindir)

configure_file(
input: 'dock.service.in',
output: meson.project_name() + '.service',
install: true,
install_dir: systemd_userunitdir,
configuration: unit_conf
)
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ project(
'io.elementary.dock',
'vala', 'c',
version: '1.0.0',
meson_version: '>=0.57'
meson_version: '>=0.58'
)

cc = meson.get_compiler('c')
Expand Down
1 change: 1 addition & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
option ('systemduserunitdir', type : 'string', value : '')

0 comments on commit 70deba9

Please sign in to comment.