diff --git a/meson.build b/meson.build index 33c3f5f7..4bcd5729 100644 --- a/meson.build +++ b/meson.build @@ -64,10 +64,19 @@ libudev = dependency('libudev', required: get_option('libudev')) libmpdclient = dependency('libmpdclient', required: get_option('mpd')) systemd = dependency('systemd', required: get_option('systemd')) +prefix = get_option('prefix') +conf_data = configuration_data() +conf_data.set('prefix', prefix) + if systemd.found() user_units_dir = systemd.get_pkgconfig_variable('systemduserunitdir') - install_data('./resources/waybar.service', - install_dir: user_units_dir) + + configure_file( + configuration: conf_data, + input: './resources/waybar.service.in', + output: '@BASENAME@', + install_dir: user_units_dir + ) endif src_files = files( diff --git a/resources/waybar.service b/resources/waybar.service.in similarity index 89% rename from resources/waybar.service rename to resources/waybar.service.in index 5eee4aaf..1c086bfa 100644 --- a/resources/waybar.service +++ b/resources/waybar.service.in @@ -6,7 +6,7 @@ PartOf=wayland-session.target [Service] Type=dbus BusName=fr.arouillard.waybar -ExecStart=/usr/bin/waybar +ExecStart=@prefix@/bin/waybar [Install] WantedBy=wayland-session.target