From 0d0ee0853adac515330c0834586fa75f63bf321e Mon Sep 17 00:00:00 2001 From: Julian Stiller Date: Sun, 13 Apr 2025 16:44:56 +0200 Subject: [PATCH] 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. --- ndrop | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ndrop b/ndrop index 2199082..5a010ac 100755 --- a/ndrop +++ b/ndrop @@ -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}"