Skip to content
This repository has been archived by the owner on Apr 18, 2023. It is now read-only.

Active window IDs reported wrong when the desktop window is alone on a workspace #2

Open
tdemin opened this issue Oct 19, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@tdemin
Copy link
Owner

tdemin commented Oct 19, 2021

This custom run-or-raise script misbehaves when used on empty workspaces with the desktop window being alone:

#!/usr/bin/env bash
# 1. window open and is focused? move it to scratchpad
# 2. window open and is not focused? move to current, raise it
# 3. window not open? run the program
case "$1" in
    "class" )
        window=`xdotool search --limit 1 --class "$2"`
        crit="class";;
    "instance" )
        window=`xdotool search --limit 1 --classname "$2"`
        crit="instance";;
    "name" )
        window=`xdotool search --limit 1 --name "$2"`
        crit="title";;
esac
if [ -z "$window" ]; then
    $3 # 3
else
    window_pid=`xdotool getwindowpid $window`
    active_window_pid=`xdotool getwindowpid $(xdotool getwindowfocus)`
    if [ "$window_pid" -eq "$active_window_pid" ]; then
        # 1
        i3-msg "[$crit=(?i)$2] move container to workspace $4"
    else
        # 2
        i3-msg "[$crit=(?i)$2] move container to workspace current"
        i3-msg "[$crit=(?i)$2] focus"
    fi
fi

When the desktop window is the only window drawn on a workspace, the script appears to either always execute branch marked #2, but consider workspace current to be 11 ($4), or always execute branch #1, switching you to workspace 11. The issue doesn't reproduce when no desktop manager is drawn on-screen.

@tdemin tdemin added the bug Something isn't working label Oct 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant