Skip to content

Conversation

@BackSlasher
Copy link

@BackSlasher BackSlasher commented Nov 2, 2025

Solves #3234

Added assign_parent_workspace directive.
When a window is created, if it matches this directive, and has a parent, and the parent has a workspace, the window will be created in the parent's workspace.

I'm aware that this PR is against

For this reason, most new window management feature requests are not accepted, even if accompanied by a patch.

But figured I'd suggest it anyway. I'm happy to close..

Testing

Done by starting FF on a separate unused profile, hitting openwrt's binary which shows as a download dialog.
That's the best case I could think about.

$ cat test-config 
include ~/.config/sway/config
assign_parent_workspace [app_id="firefox"]

$ cat test-ff.sh 
#!/bin/bash
set -e

CURRENT=$(swaymsg -t get_workspaces | jq -r '.[] | select(.focused) | .name')
swaymsg "workspace 4"
firefox -P 'poop' -no-remote 'https://downloads.openwrt.org/releases/24.10.4/targets/apm821xx/nand/openwrt-24.10.4-apm821xx-nand-meraki_mr24-initramfs-kernel.bin' &>/dev/null &
FF_PID=$!
sleep 1

swaymsg "workspace $CURRENT"
sleep 3

FF_WS_ID=$(swaymsg -t get_tree | jq -r ".nodes[].nodes[] | select(.nodes[] | select(.pid == $FF_PID)).name" | head -1)
DIALOG_WS_ID=$(swaymsg -t get_tree | jq -r ".nodes[].nodes[] | select(.floating_nodes[] | select(.pid == $FF_PID)).name" | head -1)
echo "Firefox (PID $FF_PID) workspace: $FF_WS_ID"
echo "Dialog workspace: $DIALOG_WS_ID"

kill $FF_PID

if [ "$FF_WS_ID" = "4" ] && [ "$DIALOG_WS_ID" = "4" ]; then
    exit 0
else
    exit 1
fi

In a separate tty, run:

meson setup build/ && ninja -C build/ && ./build/sway/sway --config ./test-config

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant