From e0ff04168a34aa4a5fedf2cad5be6ee84ea59549 Mon Sep 17 00:00:00 2001 From: Joe Groocock Date: Sun, 23 Aug 2020 01:16:54 +0100 Subject: [PATCH] systemd: assign default slices to user services As per recommendations in the systemd documentation, assign session, app or background slice allocations to the standard user services: https://github.com/systemd/systemd/blob/master/docs/DESKTOP_ENVIRONMENTS.md#pre-defined-systemd-units Signed-off-by: Joe Groocock --- systemd/user/blueman-applet.service | 2 +- systemd/user/dunst.service.d/override.conf | 2 ++ systemd/user/i3.service | 1 + systemd/user/networkmanager-applet.service | 1 + systemd/user/nextcloud.service | 3 +-- systemd/user/parcellite.service | 1 + systemd/user/picom.service | 2 +- systemd/user/polybar@.service | 2 +- systemd/user/pulseaudio.service.d/override.conf | 2 ++ systemd/user/redshift.service.d/override.conf | 2 ++ systemd/user/solaar.service | 1 + systemd/user/wallpaper.service | 2 +- systemd/user/xautolock.service | 1 + systemd/user/xbindkeys.service | 1 + systemd/user/xprofile.service | 1 + systemd/user/xsettingsd.service | 1 + 16 files changed, 19 insertions(+), 6 deletions(-) create mode 100644 systemd/user/dunst.service.d/override.conf create mode 100644 systemd/user/pulseaudio.service.d/override.conf create mode 100644 systemd/user/redshift.service.d/override.conf diff --git a/systemd/user/blueman-applet.service b/systemd/user/blueman-applet.service index c8f3ffa..4f6b7eb 100644 --- a/systemd/user/blueman-applet.service +++ b/systemd/user/blueman-applet.service @@ -5,9 +5,9 @@ Requires=graphical-session.target ConditionPathExists=/sys/class/bluetooth [Service] -Type=simple ExecStart=/usr/bin/blueman-applet Restart=on-failure +Slice=background.slice [Install] WantedBy=desktop.target diff --git a/systemd/user/dunst.service.d/override.conf b/systemd/user/dunst.service.d/override.conf new file mode 100644 index 0000000..09bac38 --- /dev/null +++ b/systemd/user/dunst.service.d/override.conf @@ -0,0 +1,2 @@ +[Service] +Slice=session.slice diff --git a/systemd/user/i3.service b/systemd/user/i3.service index e0150be..2957748 100644 --- a/systemd/user/i3.service +++ b/systemd/user/i3.service @@ -8,6 +8,7 @@ After=xprofile.service xorg.target ExecStart=/usr/bin/i3 ExecReload=/usr/bin/i3-msg reload Restart=always +Slice=session.slice [Install] WantedBy=graphical-session.target diff --git a/systemd/user/networkmanager-applet.service b/systemd/user/networkmanager-applet.service index cf7a395..a9c764f 100644 --- a/systemd/user/networkmanager-applet.service +++ b/systemd/user/networkmanager-applet.service @@ -7,6 +7,7 @@ Requires=graphical-session.target Type=simple ExecStart=/usr/bin/nm-applet Restart=on-failure +Slice=background.slice [Install] WantedBy=desktop.target diff --git a/systemd/user/nextcloud.service b/systemd/user/nextcloud.service index 38c0f96..305d88a 100644 --- a/systemd/user/nextcloud.service +++ b/systemd/user/nextcloud.service @@ -4,11 +4,10 @@ Requires=graphical-session.target After=graphical-session.target [Service] -Type=simple ExecStart=/usr/bin/nextcloud --background ExecReload=/bin/kill -HUP $MAINPID -KillMode=process Restart=on-failure +Slice=app.slice [Install] WantedBy=desktop.target diff --git a/systemd/user/parcellite.service b/systemd/user/parcellite.service index aa5ae4d..d7ea365 100644 --- a/systemd/user/parcellite.service +++ b/systemd/user/parcellite.service @@ -6,6 +6,7 @@ After=xorg.target [Service] ExecStart=/usr/bin/parcellite -n +Slice=session.slice [Install] WantedBy=graphical-session.target diff --git a/systemd/user/picom.service b/systemd/user/picom.service index 3f0e245..dc2b052 100644 --- a/systemd/user/picom.service +++ b/systemd/user/picom.service @@ -4,9 +4,9 @@ Requires=graphical-session.target After=dbus.service graphical-session.target xorg.target [Service] -Type=simple ExecStart=/usr/bin/picom --experimental-backends --dbus Restart=always +Slice=session.slice [Install] WantedBy=desktop.target diff --git a/systemd/user/polybar@.service b/systemd/user/polybar@.service index 83e1bcd..642003f 100644 --- a/systemd/user/polybar@.service +++ b/systemd/user/polybar@.service @@ -4,10 +4,10 @@ Requires=graphical-session.target After=graphical-session.target pulseaudio.socket i3.service [Service] -Type=simple ExecStart=/usr/bin/polybar --reload --log=warning %i ExecReload=/usr/bin/polybar-msg cmd restart -p $MAINPID Restart=always +Slice=session.slice [Install] WantedBy=desktop.target diff --git a/systemd/user/pulseaudio.service.d/override.conf b/systemd/user/pulseaudio.service.d/override.conf new file mode 100644 index 0000000..09bac38 --- /dev/null +++ b/systemd/user/pulseaudio.service.d/override.conf @@ -0,0 +1,2 @@ +[Service] +Slice=session.slice diff --git a/systemd/user/redshift.service.d/override.conf b/systemd/user/redshift.service.d/override.conf new file mode 100644 index 0000000..09bac38 --- /dev/null +++ b/systemd/user/redshift.service.d/override.conf @@ -0,0 +1,2 @@ +[Service] +Slice=session.slice diff --git a/systemd/user/solaar.service b/systemd/user/solaar.service index 4617960..c123367 100644 --- a/systemd/user/solaar.service +++ b/systemd/user/solaar.service @@ -8,6 +8,7 @@ Type=simple ExecStart=/usr/bin/solaar --debug --restart-on-wake-up --window=hide KillMode=process Restart=on-failure +Slice=background.slice [Install] WantedBy=desktop.target diff --git a/systemd/user/wallpaper.service b/systemd/user/wallpaper.service index 7bde829..6569966 100644 --- a/systemd/user/wallpaper.service +++ b/systemd/user/wallpaper.service @@ -4,12 +4,12 @@ Requires=graphical-session.target After=graphical-session.target [Service] -Type=simple Environment=FEH_OPTIONS="--no-fehbg --no-xinerama" Environment=WALLPAPER=/home/frebib/pictures/lakesidesunrise.jpg ExecStartPre=feh $FEH_OPTIONS --bg-fill $WALLPAPER ExecStart=/bin/sh -c "xev -root -event randr 2>&1 | while awk -v RS=\\n\\n '{exit;}'; do echo 'Applying wallpaper'; feh $FEH_OPTIONS --bg-fill $WALLPAPER; done" Restart=always +Slice=session.slice [Install] WantedBy=desktop.target diff --git a/systemd/user/xautolock.service b/systemd/user/xautolock.service index 769ee7e..3b02b60 100644 --- a/systemd/user/xautolock.service +++ b/systemd/user/xautolock.service @@ -7,6 +7,7 @@ After=xorg.target ExecStart=/usr/bin/xautolock -time 5 -locker 'dm-tool switch-to-greeter' -detectsleep -resetsaver -secure KillMode=process Restart=on-failure +Slice=session.slice [Install] WantedBy=graphical-session.target diff --git a/systemd/user/xbindkeys.service b/systemd/user/xbindkeys.service index cf778b1..4f17660 100644 --- a/systemd/user/xbindkeys.service +++ b/systemd/user/xbindkeys.service @@ -4,6 +4,7 @@ Description=XBindKeys [Service] ExecStart=/usr/bin/xbindkeys -n -f $XDG_CONFIG_HOME/X11/xbindkeysrc KillMode=process +Slice=session.slice [Install] WantedBy=graphical-session.target diff --git a/systemd/user/xprofile.service b/systemd/user/xprofile.service index ea01ed0..ed26dd9 100644 --- a/systemd/user/xprofile.service +++ b/systemd/user/xprofile.service @@ -7,6 +7,7 @@ After=xorg.target Type=oneshot RemainAfterExit=yes ExecStart=/bin/sh -c '. $XDG_CONFIG_HOME/X11/xprofile; systemctl --user import-environment' +Slice=session.slice [Install] WantedBy=xorg.target diff --git a/systemd/user/xsettingsd.service b/systemd/user/xsettingsd.service index bfc91b3..2ddba04 100644 --- a/systemd/user/xsettingsd.service +++ b/systemd/user/xsettingsd.service @@ -7,6 +7,7 @@ After=xorg.target ExecStart=/bin/sh -c 'xsettingsd -c $XDG_CONFIG_HOME/xsettingsd/xsettingsd.local' ExecReload=/bin/kill -s HUP $MAINPID Restart=always +Slice=session.slice [Install] WantedBy=graphical-session.target