프로세스 창을 i3 작업 공간으로 제한

프로세스 창을 i3 작업 공간으로 제한

i3(i3wm)과 함께 사용하기 위해 특정 작업 공간에서 프로세스의 모든 창을 유지하는 솔루션을 찾고 있습니다.

프로세스/프로세스 트리의 창을 작업 공간(이름 또는 번호 기준)으로 제한하는 명령을 i3-msg실행하기 위해 바이너리를 사용할 생각입니다 .assign [...] workspace ...

지금까지 내가 생각해낸 내용은 다음과 같습니다.https://gist.github.com/nmschulte/ab206ea9bd32f3eb599cf1552ef27ecc

#!/usr/bin/env sh

## constrain process windows to an i3 workspace; requires jq
## usage: i3-proc-to-ws.sh command

if [ -z "$JQ" ]; then
    JQ=jq
fi
if [ -z "$I3_PROC_TO_WS" ]; then
    I3_PROC_TO_WS=$(i3-msg -t get_workspaces | $JQ '.[] | select(.focused) | .num')
fi
$@ & PID=$!

# get window properties
for wid in $(xwininfo -tree -root -int | sed 's/\(xwininfo:\| \)*\([0-9]*\) [^c].*/\2/'); do
    wpid=$(xprop -id $wid _NET_WM_PID | sed 's/_NET_WM_PID.* = \([0-9]\+\)/\1/')
    echo $PID $wpid
    constraint=$(xprop -id $wid WM_CLASS | sed 's/WM_CLASS.* = "\(.*\)", "\(.*\)"/class="^\2$" instance="^\1$"/')
    echo $constraint
    if [ "$PID" -eq "$wpid" ]; then
        #constraint=$(xprop -id $wid WM_CLASS | sed 's/WM_CLASS.* = "\(.*\)", "\(.*\)"/class="^\2$" instance="^\1$"/')
        echo i3-msg -t command assign [$constraint] $I3_PROC_TO_WS
    fi
done

wait $PID

잠재적인 대체 솔루션에 대한 참고 자료:

관련 정보