Feat: moved all the startup script to systemd services

This commit is contained in:
2026-05-31 15:20:26 +05:30
parent a61cc65725
commit 6695e8192b
18 changed files with 148 additions and 41 deletions
+3
View File
@@ -27,3 +27,6 @@ zoom*
systemd systemd
sunshine sunshine
uad uad
intelephense
rustdesk
ristretto
+10
View File
@@ -40,3 +40,13 @@ matrix_creds() {
MX_TOKEN= MX_TOKEN=
MX_URL= MX_URL=
} }
navidrome_creds() {
# unload
[ "$1" = "unload" ] && unset ND_USER ND_PASS ND_URL && return 0
# load
ND_USER=
ND_PASS=
ND_URL=
}
+31 -13
View File
@@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
notify() { notify() {
notify-send -e -i "$icon_dir/$1" -h "string:x-canonical-private-synchronous:${0##*/}" "$2" -u "${3:-normal}" notify-send -e -t 5000 -i "${icon_dir}${1}" -h "string:x-canonical-private-synchronous:${0##*/}" "$2" -u "${3:-normal}"
} }
print_sleep() { print_sleep() {
@@ -9,27 +9,45 @@ print_sleep() {
sleep "$1" sleep "$1"
} }
switch_to_ac_mode() {
charge_icon=$(printf "%03d" "$((charge / 10))0")
hyprctl keyword monitor 'eDP-1',preferred,auto,1.5,bitdepth,10
hyprctl keyword decoration:blur:enabled true
hyprctl keyword decoration:shadow:enabled true
notify "battery-$charge_icon-charging.svg" "AC Mode ($charge%, Charging)"
exit 0
}
switch_to_battery_mode() {
charge_icon=$(printf "%03d" "$((charge / 10))0")
hyprctl keyword monitor 'eDP-1',$battery_resolution,auto,1.5,bitdepth,10
hyprctl keyword decoration:blur:enabled false
hyprctl keyword decoration:shadow:enabled false
notify "battery-$charge_icon.svg" "Battery Mode ($charge%, Discharging)"
exit 0
}
#declaration #declaration
dir="/sys/class/power_supply/"
battery="BAT0" #change accordingly battery="BAT0" #change accordingly
dir="/sys/class/power_supply/$battery/" battery_dir="${dir}${battery}/"
icon_dir="/usr/share/icons/Papirus-Dark/22x22/panel/" #change accordingly icon_dir="/usr/share/icons/Papirus-Dark/22x22/panel/" #change accordingly
i=0 i=0
status="normal" status="normal"
charge=$(cat "$dir"/capacity) charge=$(cat "$battery_dir"/capacity)
power_status=$(cat "$dir"/status) battery_resolution="2880x1800@48" # widthxheight@refresh_rate
case "$1" in case "$1" in
ac) ac)
notify "battery-$(( charge / 10))0-charging.svg" "Power: AC Mode ($charge % $power_status)" switch_to_ac_mode
hyprctl keyword decoration:blur:enabled true
hyprctl keyword decoration:shadow:enabled true
exit 0
;; ;;
battery) battery)
notify "battery-$(( charge / 10))0.svg" "Power: Battery Mode ($charge % $power_status)" switch_to_battery_mode
hyprctl keyword decoration:blur:enabled false ;;
hyprctl keyword decoration:shadow:enabled false check)
if [ "$(cat "$dir/ADP1/online")" -eq 0 ]; then
switch_to_battery_mode
fi
exit 0 exit 0
;; ;;
@@ -37,8 +55,8 @@ case "$1" in
esac esac
#infinite loop #infinite loop
while charge=$(cat "$dir"/capacity); do while charge=$(cat "$battery_dir"/capacity); do
if [ "$(cat "$dir"/status)" = "Charging" ]; then if [ "$(cat "$battery_dir"/status)" = "Charging" ]; then
i=300 #default polling time, it's 5 minutes i=300 #default polling time, it's 5 minutes
else else
case $charge in case $charge in
+18 -7
View File
@@ -4,7 +4,7 @@ monitorv2 {
mode = preferred mode = preferred
position = auto position = auto
scale = 1.5 scale = 1.5
vrr = 2 vrr = 1
bitdepth = 10 bitdepth = 10
} }
@@ -294,10 +294,21 @@ workspace = special, on-created-empty:[float] foot
#startup applications #startup applications
exec-once = systemctl --user import-environment DBUS_SESSION_BUS_ADDRESS WAYLAND_DISPLAY XDG_SESSION_TYPE XDG_CURRENT_DESKTOP XDG_SESSION_DESKTOP QT_QPA_PLATFORMTHEME GTK_THEME exec-once = systemctl --user import-environment DBUS_SESSION_BUS_ADDRESS WAYLAND_DISPLAY XDG_SESSION_TYPE XDG_CURRENT_DESKTOP XDG_SESSION_DESKTOP QT_QPA_PLATFORMTHEME GTK_THEME
exec-once = dbus-update-activation-environment --systemd --all exec-once = dbus-update-activation-environment --systemd --all
exec-once = hypridle
exec-once = ssh-agent # misc
exec-once = systemctl --user start ssh-agent
exec-once = systemctl --user start ntfy_sub
exec-once = systemctl --user start workspace
# hypr ecosystem
exec-once = systemctl --user start hyprpolkitagent exec-once = systemctl --user start hyprpolkitagent
exec-once = swaybg -i $HOME/.config/wall/1.png -m fill exec-once = systemctl --user start hypridle
exec-once = $hypr_dir/workspace focus
exec-once = $hypr_dir/battery # power
exec-once = $hypr_dir/themes exec-once = systemctl --user start power-mode@check
exec-once = systemctl --user start monitor-battery
# UI
exec-once = systemctl --user start theme
exec-once = systemctl --user start set-background@1.png
-1
View File
@@ -48,7 +48,6 @@ input-field {
check_color = rgb(204, 136, 34) check_color = rgb(204, 136, 34)
fail_color = rgb(204, 34, 34) fail_color = rgb(204, 34, 34)
fail_text = <i>$FAIL <b>($ATTEMPTS)</b></i> fail_text = <i>$FAIL <b>($ATTEMPTS)</b></i>
fail_transition = 300
capslock_color = -1 capslock_color = -1
numlock_color = -1 numlock_color = -1
bothlock_color = -1 bothlock_color = -1
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Executable
+24
View File
@@ -0,0 +1,24 @@
#!/bin/sh
notify () {
notify-send -i "$icon_path" -e -h "string:x-canonical-private-synchronous:${0##*/}" "[$1] ${2}" "$3"
}
env_file="${XDG_CONFIG_HOME:-$HOME/.config}/.env"
. "$env_file"
ntfy_creds load
token="$(printf 'Basic %s' "$(printf ':%s' "$NTFY_TOKEN" | base64)" | base64 | tr -d '=')"
icon_path="$(dirname "$0")/ntfy.png"
trap "ntfy_creds unload" EXIT
trap "ntfy_creds unload; exit 1" INT HUP
websocat --no-close "wss://${NTFY_URL#https://}/$NTFY_TOPIC_LISTEN/ws?auth=$token" | while IFS= read -r line; do
title=$(printf '%s' "$line" | sed -nE 's|.*,"title":"([^"]*)",.*|\1|p')
topic=$(printf '%s' "$line" | sed -nE 's|.*,"topic":"([^"]*)",?.*|\1|p')
message=$(printf '%s' "$line" | sed -nE 's|.*,"message":"([^"]*)",.*|\1|p')
printf '%s' "$line" | grep -q '"open"' && notify "NTFY" "Listening" "$topic"
[ -z "$message" ] || notify "$topic" "${title:-NO TITLE}" "$message"
done
+1 -1
View File
@@ -19,7 +19,7 @@ load() {
ip r ip r
# start sunshine # start sunshine
sunshine > /dev/null sunshine >/dev/null
} }
unload() { unload() {
+1 -1
View File
@@ -46,7 +46,7 @@ case $1 in
;; ;;
focus) focus)
#shows the workspace number as notification whenever u switch workspaces and also handles the dual monitor setup on the fly(perfect for laptop users) #shows the workspace number as notification whenever u switch workspaces and also handles the dual monitor setup on the fly(perfect for laptop users)
socat - "UNIX-CONNECT:$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock" | while read -r line; do socat -u "UNIX-CONNECT:$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock" - | while read -r line; do
printf "%s" "$line" | grep -qE "monitoraddedv2.*HEADLESS" && continue printf "%s" "$line" | grep -qE "monitoraddedv2.*HEADLESS" && continue
printf "%s" "$line" | grep -q "monitoraddedv2" && handle_it "$line" printf "%s" "$line" | grep -q "monitoraddedv2" && handle_it "$line"
#recent workspace switcher #recent workspace switcher
+5 -4
View File
@@ -1,14 +1,14 @@
[Default Applications] [Default Applications]
inode/directory=pcmanfm.desktop inode/directory=pcmanfm.desktop
image/jpeg=nsxiv.desktop image/jpeg=org.xfce.ristretto.desktop
application/pdf=firefox.desktop application/pdf=firefox.desktop
text/html=firefox.desktop text/html=firefox.desktop
x-scheme-handler/http=firefox.desktop x-scheme-handler/http=firefox.desktop
x-scheme-handler/https=firefox.desktop x-scheme-handler/https=firefox.desktop
x-scheme-handler/about=firefox.desktop x-scheme-handler/about=firefox.desktop
x-scheme-handler/unknown=firefox.desktop x-scheme-handler/unknown=firefox.desktop
image/png=nsxiv.desktop image/png=org.xfce.ristretto.desktop
image/webp=nsxiv.desktop image/webp=org.xfce.ristretto.desktop
plain/text=nvim.desktop plain/text=nvim.desktop
text/x-python=nvim.desktop text/x-python=nvim.desktop
text/english=nvim.deskop text/english=nvim.deskop
@@ -41,10 +41,11 @@ application/x-bittorrent=torrent.desktop
x-scheme-handler/magnet=torrent.desktop x-scheme-handler/magnet=torrent.desktop
hoppscotch=hoppscotch-handler.desktop hoppscotch=hoppscotch-handler.desktop
audio/flac=mpv.desktop audio/flac=mpv.desktop
application/octet-stream=nvim.desktop
[Added Associations] [Added Associations]
video/x-matroska=mpv.desktop; video/x-matroska=mpv.desktop;
application/octet-stream=mpv.desktop;firefox.desktop; application/octet-stream=nvim.desktop;mpv.desktop;firefox.desktop;
video/vnd.radgamettools.bink=mpv.desktop; video/vnd.radgamettools.bink=mpv.desktop;
x-scheme-handler/mailto=firefox.desktop; x-scheme-handler/mailto=firefox.desktop;
x-scheme-handler/http=firefox.desktop x-scheme-handler/http=firefox.desktop
+7 -7
View File
@@ -1,5 +1,5 @@
{ {
"LuaSnip": { "branch": "master", "commit": "a62e1083a3cfe8b6b206e7d3d33a51091df25357" }, "LuaSnip": { "branch": "master", "commit": "0abc8f390b278c3b4aabc4c004ac8a088b65cf24" },
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" }, "cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
"cmp-cmdline": { "branch": "main", "commit": "d126061b624e0af6c3a556428712dd4d4194ec6d" }, "cmp-cmdline": { "branch": "main", "commit": "d126061b624e0af6c3a556428712dd4d4194ec6d" },
"cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" }, "cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" },
@@ -9,18 +9,18 @@
"friendly-snippets": { "branch": "main", "commit": "6cd7280adead7f586db6fccbd15d2cac7e2188b9" }, "friendly-snippets": { "branch": "main", "commit": "6cd7280adead7f586db6fccbd15d2cac7e2188b9" },
"lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" }, "lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" },
"lualine.nvim": { "branch": "master", "commit": "131a558e13f9f28b15cd235557150ccb23f89286" }, "lualine.nvim": { "branch": "master", "commit": "131a558e13f9f28b15cd235557150ccb23f89286" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "0c2823e0418f3d9230ff8b201c976e84de1cb401" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "7b01e2974a47d489bb92f47a41e4c0088ea8f86e" },
"mason.nvim": { "branch": "main", "commit": "cb8445f8ce85d957416c106b780efd51c6298f89" }, "mason.nvim": { "branch": "main", "commit": "cbf8d285e1462dd24acf3507817be2bbcb035919" },
"monokai-pro.nvim": { "branch": "main", "commit": "8ba1fea7774e7c522b006091a9adb32b5cef95b9" }, "monokai-pro.nvim": { "branch": "main", "commit": "8ba1fea7774e7c522b006091a9adb32b5cef95b9" },
"nvim-autopairs": { "branch": "master", "commit": "59bce2eef357189c3305e25bc6dd2d138c1683f5" }, "nvim-autopairs": { "branch": "master", "commit": "7b9923abad60b903ece7c52940e1321d39eccc79" },
"nvim-cmp": { "branch": "main", "commit": "a1d504892f2bc56c2e79b65c6faded2fd21f3eca" }, "nvim-cmp": { "branch": "main", "commit": "a1d504892f2bc56c2e79b65c6faded2fd21f3eca" },
"nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" }, "nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" },
"nvim-dap": { "branch": "master", "commit": "45a69eba683a2c448dd9ecfc4de89511f0646b5f" }, "nvim-dap": { "branch": "master", "commit": "531771530d4f82ad2d21e436e3cc052d68d7aebb" },
"nvim-dap-python": { "branch": "master", "commit": "1808458eba2b18f178f990e01376941a42c7f93b" }, "nvim-dap-python": { "branch": "master", "commit": "1808458eba2b18f178f990e01376941a42c7f93b" },
"nvim-lspconfig": { "branch": "master", "commit": "31026a13eefb20681124706a79fc1df6bf11ab27" }, "nvim-lspconfig": { "branch": "master", "commit": "deb0df61b2d6691e745b16a42755e10ad38218e9" },
"nvim-parinfer": { "branch": "master", "commit": "3968e669d9f02589aa311d33cb475b16b27c5fbb" }, "nvim-parinfer": { "branch": "master", "commit": "3968e669d9f02589aa311d33cb475b16b27c5fbb" },
"nvim-treesitter": { "branch": "master", "commit": "cf12346a3414fa1b06af75c79faebe7f76df080a" }, "nvim-treesitter": { "branch": "master", "commit": "cf12346a3414fa1b06af75c79faebe7f76df080a" },
"packer.nvim": { "branch": "master", "commit": "ea0cc3c59f67c440c5ff0bbe4fb9420f4350b9a3" }, "packer.nvim": { "branch": "master", "commit": "ea0cc3c59f67c440c5ff0bbe4fb9420f4350b9a3" },
"plenary.nvim": { "branch": "master", "commit": "74b06c6c75e4eeb3108ec01852001636d85a932b" }, "plenary.nvim": { "branch": "master", "commit": "74b06c6c75e4eeb3108ec01852001636d85a932b" },
"telescope.nvim": { "branch": "master", "commit": "ec009610d5d259ec59a6edf0219ef3f7ee4732e5" } "telescope.nvim": { "branch": "master", "commit": "7d324792b7943e4aa16ad007212e6acc6f9fe335" }
} }
@@ -0,0 +1 @@
/usr/lib/systemd/user/xdg-user-dirs.service
+9
View File
@@ -0,0 +1,9 @@
[Unit]
Description=Monitors the battery Power and State.
[Service]
Type=simple
ExecStart=%h/.config/hypr/battery
Restart=on-failure
RestartSec=5
+8
View File
@@ -0,0 +1,8 @@
[Unit]
Description=Ntfy Subscribe Notifications
[Service]
Type=simple
ExecStart=%h/.config/hypr/ntfy_sub
Restart=on-failure
RestartSec=5
+1 -1
View File
@@ -3,4 +3,4 @@ Description=Power Mode (%i)
[Service] [Service]
Type=oneshot Type=oneshot
ExecStart=/home/tanveer/.config/hypr/battery %i ExecStart=%h/.config/hypr/battery %i
+8
View File
@@ -0,0 +1,8 @@
[Unit]
Description=Set Background (%i)
[Service]
Type=simple
ExecStartPre=-/usr/bin/pkill -x swaybg
ExecStart=/usr/sbin/swaybg -i %h/.config/wall/%i -m fill
Restart=on-failure
+6
View File
@@ -0,0 +1,6 @@
[Unit]
Description=Set GTK Theme
[Service]
Type=oneshot
ExecStart=%h/.config/hypr/themes
+9
View File
@@ -0,0 +1,9 @@
[Unit]
Description=Monitors current Workspace
[Service]
Type=simple
ExecStart=%h/.config/hypr/workspace focus
Restart=on-failure
RestartSec=5