From c73854c46d0c1c458d5c85aa450b8676f21673aa Mon Sep 17 00:00:00 2001 From: Patrick Spek Date: Tue, 6 Feb 2024 18:59:31 +0100 Subject: Use service template for starting desktop applications --- .config/systemd/user/chwp.service | 11 ----------- .config/systemd/user/desktop-app@.service | 19 +++++++++++++++++++ .config/systemd/user/dunst.service | 11 ----------- .config/systemd/user/evolution.service | 11 ----------- .config/systemd/user/firefox.service | 11 ----------- .config/systemd/user/irc-client.service | 14 -------------- .config/systemd/user/keepassxc.service | 11 ----------- .config/systemd/user/mumble.service | 11 ----------- .config/systemd/user/nextcloud.service | 11 ----------- .config/systemd/user/nm-applet.service | 11 ----------- .config/systemd/user/redshift.service | 11 ----------- .config/systemd/user/sxhkd.service | 11 ----------- .config/systemd/user/xcompmgr.service | 11 ----------- .config/systemd/user/xss-lock.service | 11 ----------- .local/bin/irc | 1 + .local/bin/redshift | 1 + .local/etc/wrapper.d/irc.sh | 10 ++++++++++ .local/etc/wrapper.d/redshift.sh | 10 ++++++++++ .local/etc/x/xinitrc | 1 + 19 files changed, 42 insertions(+), 146 deletions(-) delete mode 100644 .config/systemd/user/chwp.service create mode 100644 .config/systemd/user/desktop-app@.service delete mode 100644 .config/systemd/user/dunst.service delete mode 100644 .config/systemd/user/evolution.service delete mode 100644 .config/systemd/user/firefox.service delete mode 100644 .config/systemd/user/irc-client.service delete mode 100644 .config/systemd/user/keepassxc.service delete mode 100644 .config/systemd/user/mumble.service delete mode 100644 .config/systemd/user/nextcloud.service delete mode 100644 .config/systemd/user/nm-applet.service delete mode 100644 .config/systemd/user/redshift.service delete mode 100644 .config/systemd/user/sxhkd.service delete mode 100644 .config/systemd/user/xcompmgr.service delete mode 100644 .config/systemd/user/xss-lock.service create mode 120000 .local/bin/irc create mode 120000 .local/bin/redshift create mode 100644 .local/etc/wrapper.d/irc.sh create mode 100644 .local/etc/wrapper.d/redshift.sh diff --git a/.config/systemd/user/chwp.service b/.config/systemd/user/chwp.service deleted file mode 100644 index c9356f0..0000000 --- a/.config/systemd/user/chwp.service +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=Change wallpaper on x11 -PartOf=graphical-session.target - -[Service] -Type=oneshot -ExecStart=/bin/sh -c "exec $HOME/.local/bin/chwp" -Restart=on-failure - -[Install] -WantedBy=desktop-x11.target diff --git a/.config/systemd/user/desktop-app@.service b/.config/systemd/user/desktop-app@.service new file mode 100644 index 0000000..4b818ae --- /dev/null +++ b/.config/systemd/user/desktop-app@.service @@ -0,0 +1,19 @@ +[Unit] +Description=Manage an x11 application +PartOf=graphical-session.target + +[Service] +Type=exec +Restart=on-failure + +ExecSearchPath=%h/.local/bin +ExecSearchPath=/usr/local/bin +ExecSearchPath=/usr/bin +Environment=PATH=/home/tyil/.local/bin:/home/tyil/.config/shell/wrappers.d:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin +WorkingDirectory=%h + +ExecStartPre=sleep 5 +ExecStart=%i + +[Install] +WantedBy=desktop.target diff --git a/.config/systemd/user/dunst.service b/.config/systemd/user/dunst.service deleted file mode 100644 index 6301a41..0000000 --- a/.config/systemd/user/dunst.service +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=Start dunst -PartOf=graphical-session.target - -[Service] -Type=exec -ExecStart=/usr/bin/dunst -Restart=on-failure - -[Install] -WantedBy=desktop.target diff --git a/.config/systemd/user/evolution.service b/.config/systemd/user/evolution.service deleted file mode 100644 index c60bca7..0000000 --- a/.config/systemd/user/evolution.service +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=Start Evolution -PartOf=graphical-session.target - -[Service] -Type=exec -ExecStart=/usr/bin/evolution -Restart=on-failure - -[Install] -WantedBy=desktop.target diff --git a/.config/systemd/user/firefox.service b/.config/systemd/user/firefox.service deleted file mode 100644 index 869d1bd..0000000 --- a/.config/systemd/user/firefox.service +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=Start Firefox -PartOf=graphical-session.target - -[Service] -Type=exec -ExecStart=/bin/sh -c "exec $HOME/.local/bin/firefox" -Restart=on-failure - -[Install] -WantedBy=desktop.target diff --git a/.config/systemd/user/irc-client.service b/.config/systemd/user/irc-client.service deleted file mode 100644 index b1d0544..0000000 --- a/.config/systemd/user/irc-client.service +++ /dev/null @@ -1,14 +0,0 @@ -[Unit] -Description=Start preferred IRC client -PartOf=graphical-session.target - -[Service] -Type=exec -ExecSearchPath=%h/.local/bin -ExecSearchPath=/usr/local/bin -ExecSearchPath=/usr/bin -ExecStart=alacritty --class irc -e mosh oolah .local/bin/ta irc -Restart=on-failure - -[Install] -WantedBy=desktop.target diff --git a/.config/systemd/user/keepassxc.service b/.config/systemd/user/keepassxc.service deleted file mode 100644 index 75ac2b4..0000000 --- a/.config/systemd/user/keepassxc.service +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=Start KeePassXC -PartOf=graphical-session.target - -[Service] -Type=exec -ExecStart=/usr/bin/keepassxc -Restart=on-failure - -[Install] -WantedBy=desktop.target diff --git a/.config/systemd/user/mumble.service b/.config/systemd/user/mumble.service deleted file mode 100644 index ad127ca..0000000 --- a/.config/systemd/user/mumble.service +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=Start the Mumble -PartOf=graphical-session.target - -[Service] -Type=exec -ExecStart=/usr/bin/mumble -Restart=on-failure - -[Install] -WantedBy=desktop.target diff --git a/.config/systemd/user/nextcloud.service b/.config/systemd/user/nextcloud.service deleted file mode 100644 index 3dcf567..0000000 --- a/.config/systemd/user/nextcloud.service +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=Start Nextcloud -PartOf=graphical-session.target - -[Service] -Type=exec -ExecStart=/usr/bin/nextcloud -Restart=on-failure - -[Install] -WantedBy=desktop.target diff --git a/.config/systemd/user/nm-applet.service b/.config/systemd/user/nm-applet.service deleted file mode 100644 index a88498c..0000000 --- a/.config/systemd/user/nm-applet.service +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=Start the NetworkManager applet -PartOf=graphical-session.target - -[Service] -Type=exec -ExecStart=/usr/bin/nm-applet -Restart=on-failure - -[Install] -WantedBy=desktop.target diff --git a/.config/systemd/user/redshift.service b/.config/systemd/user/redshift.service deleted file mode 100644 index a63fa5d..0000000 --- a/.config/systemd/user/redshift.service +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=Start redshift -PartOf=graphical-session.target - -[Service] -Type=exec -ExecStart=/usr/bin/redshift -l 51.50:4.59 -t 6500:3500 -Restart=on-failure - -[Install] -WantedBy=desktop-x11.target diff --git a/.config/systemd/user/sxhkd.service b/.config/systemd/user/sxhkd.service deleted file mode 100644 index b8a806f..0000000 --- a/.config/systemd/user/sxhkd.service +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=Start sxhkd -PartOf=graphical-session.target - -[Service] -Type=exec -ExecStart=/usr/bin/sxhkd -Restart=on-failure - -[Install] -WantedBy=desktop-x11.target diff --git a/.config/systemd/user/xcompmgr.service b/.config/systemd/user/xcompmgr.service deleted file mode 100644 index 2de0721..0000000 --- a/.config/systemd/user/xcompmgr.service +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=Start xcompmgr -PartOf=graphical-session.target - -[Service] -Type=exec -ExecStart=/usr/bin/xcompmgr -Restart=on-failure - -[Install] -WantedBy=desktop-x11.target diff --git a/.config/systemd/user/xss-lock.service b/.config/systemd/user/xss-lock.service deleted file mode 100644 index 072a268..0000000 --- a/.config/systemd/user/xss-lock.service +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=Start xss-lock -PartOf=graphical-session.target - -[Service] -Type=exec -ExecStart=/usr/bin/xss-lock -- i3lock -c '#000000' -n -Restart=on-failure - -[Install] -WantedBy=desktop-x11.target diff --git a/.local/bin/irc b/.local/bin/irc new file mode 120000 index 0000000..3da827c --- /dev/null +++ b/.local/bin/irc @@ -0,0 +1 @@ +../share/wrapper.sh \ No newline at end of file diff --git a/.local/bin/redshift b/.local/bin/redshift new file mode 120000 index 0000000..3da827c --- /dev/null +++ b/.local/bin/redshift @@ -0,0 +1 @@ +../share/wrapper.sh \ No newline at end of file diff --git a/.local/etc/wrapper.d/irc.sh b/.local/etc/wrapper.d/irc.sh new file mode 100644 index 0000000..27fcbc7 --- /dev/null +++ b/.local/etc/wrapper.d/irc.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +WRAPPER_BINS=" + alacritty +" + +WRAPPER_OPTS=" + --class irc + --command mosh oolah .local/bin/ta irc +" diff --git a/.local/etc/wrapper.d/redshift.sh b/.local/etc/wrapper.d/redshift.sh new file mode 100644 index 0000000..9268ac8 --- /dev/null +++ b/.local/etc/wrapper.d/redshift.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +WRAPPER_BINS=" + /usr/bin/redshift +" + +WRAPPER_OPTS=" + -l 51.50:4.59 + -t 6500:3500 +" diff --git a/.local/etc/x/xinitrc b/.local/etc/x/xinitrc index ccb21f3..1896830 100644 --- a/.local/etc/x/xinitrc +++ b/.local/etc/x/xinitrc @@ -30,5 +30,6 @@ export WINIT_X11_SCALE_FACTOR=1 # Import X11 environment for systemd systemctl --user import-environment \ DISPLAY \ + PATH \ WINIT_X11_SCALE_FACTOR \ XAUTHORITY -- cgit v1.1