I just wanna say I’m very new to linux (hyprland) and editing scripts/code/configs in general most of the stuff I gathered from internet and put it in AI chatbots to create me script as I couldn’t find any guide on what I wanted to achieve.
I wanted something like this, create a special-workspace then toggle on/off (hide-unhide) and then if need be movetoworkspace, I used three moving things to get this 1. Toggle script 2. promotion script 3. A window rule in config.
What’s happening: I can as per my preferences open the spcial-window (scratchpad workflow) but when I try to move it to workspace it is still keeping float and center values, i want it to behave as a normal window after being moved to workspace. From what I gathered float and center are static and that’s why this is happening. Is there anyway to resolve this
Toggle Script
#!/usr/bin/env bash
SCRATCH="term"
CLASS="scratchpad-term"
CMD="kitty --class scratchpad-term"
SCRATCH_ADDR=$(hyprctl clients -j | jq -r \
".[] | select(.initialClass == \"$CLASS\" and .workspace.name == \"special:$SCRATCH\") | .address" \
| head -n1)
if [[ -z "$SCRATCH_ADDR" ]]; then
$CMD &
attempt=0
while [[ -z "$SCRATCH_ADDR" ]]; do
sleep 0.1
((attempt++))
[[ $attempt -ge 20 ]] && exit 1
SCRATCH_ADDR=$(hyprctl clients -j | jq -r \
".[] | select(.initialClass == \"$CLASS\" and .workspace.name == \"special:$SCRATCH\") | .address" \
| head -n1)
done
hyprctl dispatch setfloating "address:$SCRATCH_ADDR"
hyprctl dispatch centerwindow "address:$SCRATCH_ADDR"
hyprctl dispatch tagwindow +utility "address:$SCRATCH_ADDR"
hyprctl dispatch tagwindow +scratchpad "address:$SCRATCH_ADDR"
exit 0
fi
VISIBLE=$(hyprctl monitors -j | jq -r \
".[] | select(.specialWorkspace.name == \"special:$SCRATCH\" and .specialWorkspace.visible == true)")
if [[ -z "$VISIBLE" ]]; then
hyprctl dispatch togglespecialworkspace "$SCRATCH"
exit 0
fi
ACTIVE_ADDR=$(hyprctl activewindow -j | jq -r '.address')
if [[ "$ACTIVE_ADDR" == "$SCRATCH_ADDR" ]]; then
hyprctl dispatch togglespecialworkspace "$SCRATCH"
else
hyprctl dispatch focuswindow "address:$SCRATCH_ADDR"
fi
Promotion Script
#!/usr/bin/env bash
CLASS="scratchpad-term"
SCRATCH="term"
WINDOW=$(hyprctl activewindow -j)
ADDR=$(echo "$WINDOW" | jq -r '.address')
ACTIVE_CLASS=$(echo "$WINDOW" | jq -r '.initialClass')
ACTIVE_WS=$(echo "$WINDOW" | jq -r '.workspace.name')
# Exit if not our scratchpad
if [[ "$ACTIVE_CLASS" != "$CLASS" || "$ACTIVE_WS" != "special:$SCRATCH" ]]; then
exit 0
fi
hyprctl dispatch togglespecialworkspace "$SCRATCH"
hyprctl dispatch movetoworkspacesilent "emptynm,address:$ADDR"
hyprctl dispatch setfloating 0 "address:$ADDR"
hyprctl dispatch focuswindow "address:$ADDR"
Hyprland version 0.53.0
PASTE YOUR HYPRLAND VERSION HERE (hyprctl version), BETWEEN THE BACKTICKS. DO NOT REMOVE ANY FORMATTING.