small thunar and greetd changes and some refactoring

This commit is contained in:
cnst
2024-11-10 13:54:04 +01:00
parent dbba176430
commit df33d941cb
22 changed files with 77 additions and 202 deletions

36
scripts/bin/tuirun-toggle.sh Executable file
View File

@@ -0,0 +1,36 @@
# Define TERMINAL if not set
TERMINAL="${TERMINAL:-foot}"
# Path to the tuirun executable
TUIRUN_PATH="/etc/profiles/per-user/$USER/bin/tuirun"
# Use absolute paths for commands
PGREP="/run/current-system/sw/bin/pgrep"
PKILL="/run/current-system/sw/bin/pkill"
HYPRCTL="/etc/profiles/per-user/$USER/bin/hyprctl"
# Determine OPTIONS based on TERMINAL
if [ "$TERMINAL" = "foot" ]; then
OPTIONS="--override=main.pad=0x0"
elif [ "$TERMINAL" = "alacritty" ]; then
OPTIONS="--option window.padding.x=0 --option window.padding.y=0"
else
OPTIONS=""
fi
# Matching pattern for the process
MATCH_PATTERN="$TERMINAL --title tuirun"
if "$PGREP" -f "$MATCH_PATTERN" >/dev/null; then
"$PKILL" -f "$MATCH_PATTERN"
else
# Construct the command
CMD="$TERMINAL --title tuirun"
if [ -n "$OPTIONS" ]; then
CMD="$CMD $OPTIONS"
fi
CMD="$CMD -e $TUIRUN_PATH"
# Launch the terminal with OPTIONS
"$HYPRCTL" dispatch exec "$CMD"
fi