fix: move back to previous workspace

It happens, that when we move the ndrop target to another monitor, we
stay on the ndrop workspace after switching back to the previous focused
workspace. So, after moving to ndrop, we switch one time to the previous
one and then to the previous focused.
This commit is contained in:
Julian Stiller 2025-04-13 16:44:56 +02:00
parent 6c10c2cb7b
commit 0d0ee0853a

5
ndrop
View file

@ -155,8 +155,8 @@ CLASS="$1"
COMMANDLINE="${*:1}"
ACTIVE_WORKSPACE=$(active_workspace)
ACTIVE_WORKSPACE_ID=$(niri msg --json workspaces | jq -r ".[] | select(.is_focused==true) | .id")
ACTIVE_OUTPUT=$(niri msg --json focused-output | jq -r ".name")
NDROP_OUTPUT=$(niri msg --json workspaces | jq -r ".[] | select(.name==\"ndrop\") | .output")
# ACTIVE_OUTPUT=$(niri msg --json focused-output | jq -r ".name")
# NDROP_OUTPUT=$(niri msg --json workspaces | jq -r ".[] | select(.name==\"ndrop\") | .output")
case "$1" in
epiphany)
@ -225,6 +225,7 @@ if [[ -n ${WINDOW_ID} ]]; then
notify_low "ndrop: Matched focused target on active ws '${ACTIVE_WORKSPACE}'; move target to 'ndrop'"
fi
niri msg action move-window-to-workspace --window-id "${WINDOW_ID}" "ndrop"
niri msg action focus-workspace-previous
# For good multi-monitor support, we need something like this in niri.
# if [[ "$ACTIVE_OUTPUT" != "$NDROP_OUTPUT" ]]; then
# niri msg action focus-monitor "${ACTIVE_OUTPUT}"