From 5fd615cc543aac8b91e370618af21b2965910f37 Mon Sep 17 00:00:00 2001 From: dbrw Date: Fri, 8 Jul 2022 16:09:22 +0700 Subject: [PATCH] update user services --- .../.config/systemd/user/lock.target | 8 +++ .../.config/systemd/user/slock.service | 21 +++++++ .../.config/systemd/user/unclutter.service | 15 +++++ .../.config/systemd/user/unlock.target | 5 ++ .../.config/systemd/user/xss-lock.service | 15 +++++ roles/common/files/user_home/.xinitrc | 2 +- roles/common/tasks/dwm.yml | 59 ++++++++++--------- 7 files changed, 95 insertions(+), 30 deletions(-) create mode 100644 roles/common/files/user_home/.config/systemd/user/lock.target create mode 100644 roles/common/files/user_home/.config/systemd/user/slock.service create mode 100644 roles/common/files/user_home/.config/systemd/user/unclutter.service create mode 100644 roles/common/files/user_home/.config/systemd/user/unlock.target create mode 100644 roles/common/files/user_home/.config/systemd/user/xss-lock.service diff --git a/roles/common/files/user_home/.config/systemd/user/lock.target b/roles/common/files/user_home/.config/systemd/user/lock.target new file mode 100644 index 0000000..005a8fa --- /dev/null +++ b/roles/common/files/user_home/.config/systemd/user/lock.target @@ -0,0 +1,8 @@ +[Unit] +Description=Services which should run when session is locked +Documentation=man:systemd.special(7) +Requires=lock-helper.service +BindsTo=graphical-session.target dwm.service +Conflicts=unlock.target +After=graphical-session.target +StopWhenUnneeded=yes diff --git a/roles/common/files/user_home/.config/systemd/user/slock.service b/roles/common/files/user_home/.config/systemd/user/slock.service new file mode 100644 index 0000000..04b6c28 --- /dev/null +++ b/roles/common/files/user_home/.config/systemd/user/slock.service @@ -0,0 +1,21 @@ +[Unit] +Description=slock -- suckless screen locker +Documentation=man:slock(1) man:xss-lock(1) +PartOf=lock.target +Conflicts=unclutter.service +After=lock.target +RefuseManualStop=yes + +[Service] +Type=simple +ExecStartPre=/usr/bin/xset +dpms dpms 0 0 ${DPMS_TIMEOUT} +ExecStart=/usr/local/bin/slock -m "ANTI SUCK-SUCK CLUB" +ExecStopPost=/bin/systemctl --user --no-block start xset-dpms.service +ExecStopPost=/bin/systemctl --user --no-block start unclutter.service +Restart=on-failure +RestartSec=2 + +[Install] +WantedBy=lock.target +WantedBy=sleep.target + diff --git a/roles/common/files/user_home/.config/systemd/user/unclutter.service b/roles/common/files/user_home/.config/systemd/user/unclutter.service new file mode 100644 index 0000000..5bc144a --- /dev/null +++ b/roles/common/files/user_home/.config/systemd/user/unclutter.service @@ -0,0 +1,15 @@ +[Unit] +Description=Unclutter, hide mouse cursor on idle +Documentation=man:unclutter(1) +PartOf=graphical-session.target +After=graphical-session.target + +[Service] +Type=simple +ExecStart=/usr/bin/unclutter -display ${DISPLAY} -idle 2 -jitter 3 -grab -root +Restart=on-failure +RestartSec=2 + +[Install] +WantedBy=graphical-session.target + diff --git a/roles/common/files/user_home/.config/systemd/user/unlock.target b/roles/common/files/user_home/.config/systemd/user/unlock.target new file mode 100644 index 0000000..02ee5e6 --- /dev/null +++ b/roles/common/files/user_home/.config/systemd/user/unlock.target @@ -0,0 +1,5 @@ +[Unit] +Description=Services which should run when session is unlocked +Documentation=man:systemd.special(7) +Conflicts=lock.target +StopWhenUnneeded=yes diff --git a/roles/common/files/user_home/.config/systemd/user/xss-lock.service b/roles/common/files/user_home/.config/systemd/user/xss-lock.service new file mode 100644 index 0000000..57f75c5 --- /dev/null +++ b/roles/common/files/user_home/.config/systemd/user/xss-lock.service @@ -0,0 +1,15 @@ +[Unit] +Description=XScreenSaver Utility +Documentation=man:xss-lock(1) +PartOf=graphical-session.target +After=graphical-session.target +Before=xset-xss.service + +[Service] +Type=simple +ExecStart=/usr/bin/xss-lock -s ${XDG_SESSION_ID} --ignore-sleep -- systemctl --user --wait start lock.target +Restart=always +RestartSec=2 + +[Install] +WantedBy=graphical-session.target diff --git a/roles/common/files/user_home/.xinitrc b/roles/common/files/user_home/.xinitrc index 93ca6a0..274b2e2 100644 --- a/roles/common/files/user_home/.xinitrc +++ b/roles/common/files/user_home/.xinitrc @@ -1,7 +1,7 @@ #!/bin/sh # Import environemnt to systemd user session -systemctl --user import-environment DISPLAY XAUTHORITY PATH +systemctl --user import-environment DISPLAY XAUTHORITY PATH XDG_SESSION_ID # Run graphical-session.target systemctl --user start --wait xorg.target diff --git a/roles/common/tasks/dwm.yml b/roles/common/tasks/dwm.yml index 9c1fcd8..6592598 100644 --- a/roles/common/tasks/dwm.yml +++ b/roles/common/tasks/dwm.yml @@ -2,43 +2,44 @@ - name: install dwm with my patches community.general.pacman: name: - - awesome-terminal-fonts - - powerline-fonts - - autorandr - - dialog - - pass - - capitaine-cursors - - feh - adwaita-icon-theme - arc-gtk-theme - arc-icon-theme + - autorandr + - awesome-terminal-fonts + - bitwarden-cli + - capitaine-cursors + - dialog + - dunst + - earlyoom + - feh - gnome-themes-extra - gtk-engine-murrine - - rofi - - bitwarden-cli - - python-tldextract - - dunst - - libnotify - - libadwaita - - libxkbcommon - - xclip - - xss-lock - - xdg-user-dirs - - noto-fonts-emoji - - ttf-nerd-fonts-symbols - - ttf-dejavu - - earlyoom - - ttf-droid - - lxappearance - - ttc-iosevka - - pipewire - - pipewire-pulse - - pamixer - - wireplumber - - wireguard-tools - gvfs - gvfs-mtp + - libadwaita + - libnotify + - libxkbcommon + - lxappearance + - noto-fonts-emoji + - pass - pcmanfm + - powerline-fonts + - rofi + - ttc-iosevka + - ttf-dejavu + - ttf-droid + - ttf-nerd-fonts-symbols + - unclutter + - pamixer + - pipewire + - pipewire-pulse + - python-tldextract + - wireplumber + - wireguard-tools + - xclip + - xdg-user-dirs + - xss-lock - yt-dlp state: present