moved all desktop utils into this repo
This commit is contained in:
parent
cd7e93374e
commit
2241d30a86
28 changed files with 151 additions and 45 deletions
34
scripts/workspaces.sh
Executable file
34
scripts/workspaces.sh
Executable file
|
@ -0,0 +1,34 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Check if an argument is provided
|
||||
if [[ -z $1 ]]; then
|
||||
# echo "Error: Number argument is missing."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Retrieve the argument value
|
||||
new_workspace=$1
|
||||
|
||||
if [[ $new_workspace == special:* ]]; then
|
||||
hyprctl dispatch togglespecialworkspace "${new_workspace:8}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Validate if the argument is a number
|
||||
if ! [[ $new_workspace =~ ^-?[0-9]+$ ]]; then
|
||||
# echo "Error: Invalid number argument."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
while read -r i a f;do
|
||||
workspace[$a]=$i
|
||||
if [[ $f == true ]]; then
|
||||
active=$i
|
||||
fi
|
||||
done < <(hyprctl monitors -j | jq -r '.[]|"\(.id) \(.activeWorkspace.id) \(.focused)"')
|
||||
|
||||
if [[ ${workspace[$new_workspace]} ]]; then
|
||||
hyprctl dispatch swapactiveworkspaces $active ${workspace[$new_workspace]}
|
||||
else
|
||||
hyprctl --batch "dispatch moveworkspacetomonitor $new_workspace $active ; dispatch workspace $new_workspace"
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue