Skip to content

Commit

Permalink
Prevented requesting more persistent workspaces than available
Browse files Browse the repository at this point in the history
  • Loading branch information
CJendantix committed Sep 2, 2024
1 parent aefd614 commit e1a1e82
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion config-generator.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/bin/bash

# Scripted input goes as follows:
# /path/to/config-generator.sh TOTALMONITORS WORKSPACESPERMONITOR PERSISTENTWORKSPACES MONITOR1,MONITOR2,MONITOR3

findSuffix () {
INPUT="$1";
OUTPUT="";
Expand Down Expand Up @@ -36,19 +39,24 @@ if [ ! "$1" ]; then
echo "Cannot create more than nine workspaces per monitor";
exit;
fi

if [ "$PERSISTENTWORKSPACES" -gt "$WORKSPACESPERMONITOR" ]; then
PERSISTENTWORKSPACES="$WORKSPACESPERMONITOR"
fi

for i in $(seq "$TOTALMONITORS"); do
suffix=$(findSuffix "${i}");
read -rp "What is the name of the ${i}${suffix} monitor? " x;
MONITORNAMES+=("$x");
done
echo ""
else
TOTALMONITORS="$1"
WORKSPACESPERMONITOR="$2"
PERSISTENTWORKSPACES="$3"
IFS=, command eval 'MONITORNAMES=($4)'
fi
echo ""

for x in $(seq "$WORKSPACESPERMONITOR"); do
echo "bind = SUPER, ${x}, exec, ~/.local/share/scripts/hyprland_workspace_scripts/workspaces.sh ${x} ${WORKSPACESPERMONITOR}";
done
Expand Down

0 comments on commit e1a1e82

Please sign in to comment.