diff options
author | Anthony Wang | 2024-11-22 22:27:20 -0500 |
---|---|---|
committer | Anthony Wang | 2024-11-22 22:27:20 -0500 |
commit | 39e70197454023cd01b559c8f9c1af81028dc6f2 (patch) | |
tree | aa520dbc28e1faff1b3df986430cf1fea7d65a0b | |
parent | a4fa177b3f84d8c1cb8b77e08475d973bcee8032 (diff) |
Replace autostart .desktop files with systemd services and fish functions
-rw-r--r-- | autostart/ssh-add.desktop | 4 | ||||
-rw-r--r-- | autostart/switchvirtualkeyboard.desktop | 4 | ||||
-rwxr-xr-x | autostart/switchvirtualkeyboard.sh | 16 | ||||
-rw-r--r-- | fish/functions/backup.fish | 5 | ||||
-rw-r--r-- | fish/functions/switchvirtualkeyboard.fish | 16 | ||||
-rw-r--r-- | systemd/user/backup.service | 8 | ||||
-rw-r--r-- | systemd/user/ssh-agent.service.d/override.conf | 2 | ||||
-rw-r--r-- | systemd/user/switchvirtualkeyboard.service | 8 |
8 files changed, 36 insertions, 27 deletions
diff --git a/autostart/ssh-add.desktop b/autostart/ssh-add.desktop deleted file mode 100644 index 4ec7d65..0000000 --- a/autostart/ssh-add.desktop +++ /dev/null @@ -1,4 +0,0 @@ -[Desktop Entry] -Exec=ssh-add -Name=ssh-add -Type=Application diff --git a/autostart/switchvirtualkeyboard.desktop b/autostart/switchvirtualkeyboard.desktop deleted file mode 100644 index f66d8e0..0000000 --- a/autostart/switchvirtualkeyboard.desktop +++ /dev/null @@ -1,4 +0,0 @@ -[Desktop Entry] -Exec=bash ~/.config/autostart/switchvirtualkeyboard.sh -Name=switchvirtualkeyboard -Type=Application diff --git a/autostart/switchvirtualkeyboard.sh b/autostart/switchvirtualkeyboard.sh deleted file mode 100755 index b0919f5..0000000 --- a/autostart/switchvirtualkeyboard.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -switch() { - echo "Starting $1" - kwriteconfig6 --file kwinrc --group Wayland --key InputMethod "$1" - busctl --user emit /kwinrc org.kde.kconfig.notify ConfigChanged "a{saay}" 1 Wayland 1 11 73 110 112 117 116 77 101 116 104 111 100 -} - -busctl --user monitor --match "type='signal',interface='org.kde.KWin.TabletModeManager',member='tabletModeChanged'" | \ -while read -r line; do - if [[ $line == *"true"* ]]; then - switch /usr/share/applications/com.github.maliit.keyboard.desktop - elif [[ $line == *"false"* ]]; then - switch /usr/share/applications/fcitx5-wayland-launcher.desktop - fi -done diff --git a/fish/functions/backup.fish b/fish/functions/backup.fish index 4d1cadd..d0dd48f 100644 --- a/fish/functions/backup.fish +++ b/fish/functions/backup.fish @@ -1,11 +1,10 @@ function backup if not set -q HOSTNAME - set HOSTNAME (hostnamectl hostname) + set HOSTNAME (hostnamectl hostname) end - + cd ~/Documents/Backups/$HOSTNAME cp ~/.local/share/fish/fish_history . cp ~/.mozilla/firefox/*.default-release/places.sqlite . cp ~/.thunderbird/*.default-release/Mail/Feeds/feeds.json . - cd - end diff --git a/fish/functions/switchvirtualkeyboard.fish b/fish/functions/switchvirtualkeyboard.fish new file mode 100644 index 0000000..5700bf7 --- /dev/null +++ b/fish/functions/switchvirtualkeyboard.fish @@ -0,0 +1,16 @@ +function setvirtualkeyboard + echo "Starting $argv[1]" + kwriteconfig6 --file kwinrc --group Wayland --key InputMethod "$argv[1]" + busctl --user emit /kwinrc org.kde.kconfig.notify ConfigChanged "a{saay}" 1 Wayland 1 11 73 110 112 117 116 77 101 116 104 111 100 +end + +function switchvirtualkeyboard + busctl --user monitor --match "type='signal',interface='org.kde.KWin.TabletModeManager',member='tabletModeChanged'" | \ + while read -l line + if string match -q "*true*" $line + setvirtualkeyboard /usr/share/applications/com.github.maliit.keyboard.desktop + else if string match -q "*false*" $line + setvirtualkeyboard /usr/share/applications/fcitx5-wayland-launcher.desktop + end + end +end diff --git a/systemd/user/backup.service b/systemd/user/backup.service new file mode 100644 index 0000000..3a3e5b3 --- /dev/null +++ b/systemd/user/backup.service @@ -0,0 +1,8 @@ +[Unit] +Description=Back up important files + +[Service] +ExecStart=fish -c backup + +[Install] +WantedBy=default.target diff --git a/systemd/user/ssh-agent.service.d/override.conf b/systemd/user/ssh-agent.service.d/override.conf new file mode 100644 index 0000000..4e35d4c --- /dev/null +++ b/systemd/user/ssh-agent.service.d/override.conf @@ -0,0 +1,2 @@ +[Service] +ExecStartPost=ssh-add diff --git a/systemd/user/switchvirtualkeyboard.service b/systemd/user/switchvirtualkeyboard.service new file mode 100644 index 0000000..ca40d11 --- /dev/null +++ b/systemd/user/switchvirtualkeyboard.service @@ -0,0 +1,8 @@ +[Unit] +Description=Switch the virtual keyboard when entering and exiting tablet mode + +[Service] +ExecStart=fish -c switchvirtualkeyboard + +[Install] +WantedBy=default.target |