Skip to content

Added stack bounded client navigation and movement#796

Open
Enquandriant wants to merge 5 commits intomangowm:mainfrom
Enquandriant:focusstack_bounded
Open

Added stack bounded client navigation and movement#796
Enquandriant wants to merge 5 commits intomangowm:mainfrom
Enquandriant:focusstack_bounded

Conversation

@Enquandriant
Copy link

  • Adds commands for navigation and movement of wayland clients WITHIN the stack so user doesn't unexpectedly end up moving to/swapping with a master window
  • Adds dwl mmsg ipc command to query number of masters
  • Adds dwl mmsg ipc command to query if current focused client is a master
  • Adds command to kill clients by appid (used for killing my TUI scratchpad before spawning a new one for any and all TUIs spawned from my shell)

This is kind of unfocused, but at least the bounded navigation within the stack feels necessary as it is VERY unintuitive that while trying to navigate in the stack in deck layout that I can randomly end up back on one of my master windows.

These changes seemed needed to make my movement bind keys work generically across layouts with a script like this:

#!/usr/bin/env bash

[[ -z "$ACTION" ]] && echo "ACTION is not set" && exit 1
[[ -z "$DIR" ]]    && echo "DIR is not set"    && exit 1
ACTION=${ACTION,,}
DIR=${DIR,,}

IS_MASTER="$(mmsg -gM | awk '{print ($3 == 1 ? "M" : "")}')"
IS_FLOATING="$(mmsg -gf | awk '{print ($3 == 1 ? "F" : "")}')"
CURRENT_CALL="$IS_FLOATING$IS_MASTER$(mmsg -gl | awk '{print ($3)}')$DIR"

case "$CURRENT_CALL" in
    F* )
        FOCUS_COMMAND="focusdir,$DIR"
        case "$DIR" in
            up)
                MOVE_COMMAND="movewin,+0,-50"
                ;;
            down)
                MOVE_COMMAND="movewin,+0,+50"
                ;;
            left)
                MOVE_COMMAND="movewin,-50,+0"
                ;;
            right)
                MOVE_COMMAND="movewin,+50,+0"
        esac
        ;;
    VKleft | Kup)
        FOCUS_COMMAND="focusstack_bounded,prev"
        MOVE_COMMAND="exchange_stack_client_bounded,prev"
        ;;
    VKright | Kdown)
        FOCUS_COMMAND="focusstack_bounded,next"
        MOVE_COMMAND="exchange_stack_client_bounded,next"
        ;;
    MMright | MMdown | Mright | Mdown)
        FOCUS_COMMAND="focusstack,next"
        MOVE_COMMAND="exchange_stack_client,next"
        ;;
    MMleft | MMup | Mleft | Mup)
        FOCUS_COMMAND="focusstack,prev"
        MOVE_COMMAND="exchange_stack_client,prev"
        ;;
    MK* | MVK* | VK* | K* | *)
        FOCUS_COMMAND="focusdir,$DIR"
        MOVE_COMMAND="exchange_client,$DIR"
        ;;
esac

#case "$ACTION" in
#    focus) echo mmsg -d "$FOCUS_COMMAND" >> ~/movement.log ;; 
#    move)  echo mmsg -d "$MOVE_COMMAND" >> ~/movement.log  ;;
#esac

case "$ACTION" in
    focus) mmsg -d "$FOCUS_COMMAND" ;;
    move)  mmsg -d "$MOVE_COMMAND"  ;;
esac

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant