File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,7 +26,6 @@ if [ -f "$SIDEPAD_POS_FILE" ]; then
2626else
2727 SIDEPAD_POS=" left"
2828fi
29- source $SIDEPAD_PADS_FOLDER /$( cat " $SIDEPAD_DATA " )
3029source $SIDEPAD_PADS_FOLDER /$SIDEPAD_ACTIVE
3130echo " :: Current sidepad: $SIDEPAD_ACTIVE "
3231echo " :: Current sidepad app: $SIDEPAD_APP "
@@ -65,8 +64,10 @@ if [[ "$1" == "--init" ]]; then
6564 eval " $SIDEPAD_PATH --position '$SIDEPAD_POS ' --class '$SIDEPAD_CLASS ' --init '$SIDEPAD_APP '"
6665elif [[ " $1 " == " --hide" ]]; then
6766 if [[ " $SIDEPAD_POS " == " left" ]]; then
67+ # Hide left sidepad
6868 eval " $SIDEPAD_PATH --position '$SIDEPAD_POS ' --class '$SIDEPAD_CLASS ' --hide"
6969 else
70+ # Show right sidepad
7071 eval " $SIDEPAD_PATH --position '$SIDEPAD_POS ' --class '$SIDEPAD_CLASS ' $SIDEPAD_OPTIONS "
7172 fi
7273elif [[ " $1 " == " --test" ]]; then
Original file line number Diff line number Diff line change @@ -92,6 +92,10 @@ while [[ $# -gt 0 ]]; do
9292 ;;
9393
9494 --position)
95+ if [[ " $2 " != " left" && " $2 " != " right" ]]; then
96+ echo " Error: --position must be either 'left' or 'right' (got '$2 ')." >&2
97+ exit 1
98+ fi
9599 POSITION=" $2 "
96100 shift ; shift
97101 ;;
@@ -213,7 +217,10 @@ if [[ "$HIDE_REQUESTED" -eq 1 ]]; then
213217 # Restore focus
214218 if [ -f " $PREV_FOCUS_FILE " ]; then
215219 PREV_FOCUS=$( cat " $PREV_FOCUS_FILE " )
216- hyprctl dispatch focuswindow address:$PREV_FOCUS
220+ if [[ -n " $PREV_FOCUS " ]]; then
221+ # Suppress errors in case the previous window no longer exists or the address is invalid
222+ hyprctl dispatch focuswindow address:" $PREV_FOCUS " 2> /dev/null || true
223+ fi
217224 rm " $PREV_FOCUS_FILE "
218225 fi
219226
You can’t perform that action at this time.
0 commit comments