diff --git a/modules/wlogout/scripts/logout.sh b/modules/wlogout/scripts/logout.sh index 415b766..64e9104 100755 --- a/modules/wlogout/scripts/logout.sh +++ b/modules/wlogout/scripts/logout.sh @@ -1,2 +1,22 @@ #!/bin/bash -systemctl loginctl terminate-user $USER \ No newline at end of file + +# 1. Run helper script if it exists +if [[ -x "$SCRIPT_PATH" ]]; then + echo "Running helper script..." + bash "$SCRIPT_PATH" +else + echo "Helper script not found, skipping..." +fi + +# 2. Run hyprshutdown if available +if command -v hyprshutdown >/dev/null 2>&1; then + echo "Running hyprshutdown..." + hyprshutdown +else + echo "Rebooting system..." + if command -v systemctl >/dev/null 2>&1; then + systemctl loginctl terminate-user $USER + else + pkill -KILL -u "$USER" -t tty2 + fi +fi \ No newline at end of file diff --git a/modules/wlogout/scripts/reboot.sh b/modules/wlogout/scripts/reboot.sh index 1b7078c..0e66c96 100755 --- a/modules/wlogout/scripts/reboot.sh +++ b/modules/wlogout/scripts/reboot.sh @@ -1,2 +1,29 @@ -#!/bin/bash -systemctl reboot \ No newline at end of file +#!/usr/bin/env bash + +set -e + +SCRIPT_PATH="$HOME/.config/quickshell/modules/wlogout/scripts/helper.sh" + +# 1. Run helper script if it exists +if [[ -x "$SCRIPT_PATH" ]]; then + echo "Running helper script..." + bash "$SCRIPT_PATH" +else + echo "Helper script not found, skipping..." +fi + +# 2. Run hyprshutdown if available +if command -v hyprshutdown >/dev/null 2>&1; then + echo "Running hyprshutdown..." + hyprshutdown +else + echo "hyprshutdown not found, skipping..." +fi + +# 3. Power off if systemctl exists +if command -v systemctl >/dev/null 2>&1; then + echo "Rebooting system..." + systemctl reboot +else + reboot +fi \ No newline at end of file diff --git a/modules/wlogout/scripts/shutdown.sh b/modules/wlogout/scripts/shutdown.sh index 422a4c6..48094c6 100755 --- a/modules/wlogout/scripts/shutdown.sh +++ b/modules/wlogout/scripts/shutdown.sh @@ -1,2 +1,29 @@ -#!/bin/bash -systemctl poweroff \ No newline at end of file +#!/usr/bin/env bash + +set -e + +SCRIPT_PATH="$HOME/.config/quickshell/modules/wlogout/scripts/helper.sh" + +# 1. Run helper script if it exists +if [[ -x "$SCRIPT_PATH" ]]; then + echo "Running helper script..." + bash "$SCRIPT_PATH" +else + echo "Helper script not found, skipping..." +fi + +# 2. Run hyprshutdown if available +if command -v hyprshutdown >/dev/null 2>&1; then + echo "Running hyprshutdown..." + hyprshutdown +else + echo "hyprshutdown not found, skipping..." +fi + +# 3. Power off if systemctl exists +if command -v systemctl >/dev/null 2>&1; then + echo "Powering off system..." + systemctl poweroff +else + shutdown -h now +fi \ No newline at end of file