Skip to main content
added 111 characters in body
Source Link
ctx
  • 2.9k
  • 13
  • 19

Wait until the window appears and then send it to the original workspace:

#!/bin/bash activeworkspace=$(i3-msg -t get_workspaces | jq -c '.[] | select(.focused) | .name' --raw-output) atom & windowname=atom xprop -spy -root _NET_ACTIVE_WINDOW | \ while read line ; do if xprop WM_CLASS -id ${line##* } | grep -q $windowname ; then i3-msg move "[con_id=\"${line##* }\"]" $activeworkspace exit fi done 
  • At first get the active workspace, use the jq as an example
  • run your program in the background: atom &
  • Use xprop -spy to 'Examine window properties forever, looking for property change events.'
  • Act on all new active windows with while read line
  • Get WM_CLASS of them with xprop WM_CLASS, extract the windowid with bash ${line##* }
  • Filter with `grep $windownamegrep $windowname
  • Move the window to the original workspace with i3-msg move ..

You should stay on the active workspace and a window on this workspace should get focused.

It doesn't work when you have multiple atom windows which get focused between the start and the move of a new atom window. In this case you would have to look for the NET_WM_PID atom instead of WM_CLASS.

Wait until the window appears and then send it to the original workspace:

#!/bin/bash activeworkspace=$(i3-msg -t get_workspaces | jq -c '.[] | select(.focused) | .name' --raw-output) atom & windowname=atom xprop -spy -root _NET_ACTIVE_WINDOW | \ while read line ; do if xprop WM_CLASS -id ${line##* } | grep -q $windowname ; then i3-msg move "[con_id=\"${line##* }\"]" $activeworkspace exit fi done 
  • At first get the active workspace, use the jq as an example
  • run your program: atom
  • Use xprop -spy to 'Examine window properties forever, looking for property change events.'
  • Act on all new active windows with while read line
  • Get WM_CLASS of them with xprop WM_CLASS, extract the windowid with bash ${line##* }
  • Filter with `grep $windowname
  • Move the window to the original workspace with i3-msg move ..

It doesn't work when you have multiple atom windows which get focused between the start and the move of a new atom window. In this case you would have to look for the NET_WM_PID atom instead of WM_CLASS.

Wait until the window appears and then send it to the original workspace:

#!/bin/bash activeworkspace=$(i3-msg -t get_workspaces | jq -c '.[] | select(.focused) | .name' --raw-output) atom & windowname=atom xprop -spy -root _NET_ACTIVE_WINDOW | \ while read line ; do if xprop WM_CLASS -id ${line##* } | grep -q $windowname ; then i3-msg move "[con_id=\"${line##* }\"]" $activeworkspace exit fi done 
  • At first get the active workspace, use jq as an example
  • run your program in the background: atom &
  • Use xprop -spy to 'Examine window properties forever, looking for property change events.'
  • Act on all new active windows with while read line
  • Get WM_CLASS of them with xprop WM_CLASS, extract the windowid with bash ${line##* }
  • Filter with grep $windowname
  • Move the window to the original workspace with i3-msg move ..

You should stay on the active workspace and a window on this workspace should get focused.

It doesn't work when you have multiple atom windows which get focused between the start and the move of a new atom window. In this case you would have to look for the NET_WM_PID atom instead of WM_CLASS.

added 3 characters in body
Source Link
ctx
  • 2.9k
  • 13
  • 19

Wait until the window appears and then send it to the original workspace:

#!/bin/bash activeworkspace=$(i3-msg -t get_workspaces | jq -c '.[] | select(.focused) | .name' --raw-output) atom & windowname=atom xprop -spy -root _NET_ACTIVE_WINDOW | \ while read line ; do   if xprop WM_CLASS -id ${line##* } | \  grep -q $windowname &&; \then   i3-msg move "[con_id=\"${line##* }\"]" $activeworkspace   && \  exit fi done 
  • At first get the active workspace, use the jq as an example
  • run your program: atom
  • Use xprop -spy to 'Examine window properties forever, looking for property change events.'
  • Act on all new active windows with while read line
  • Get WM_CLASS of them with xprop WM_CLASS, extract the windowid with bash ${line##* }
  • Filter with `grep $windowname
  • Move the window to the original workspace with i3-msg move ..

It doesn't work when you have multiple atom windows which get focused between the start and the move of a new atom window. In this case you would have to look for the NET_WM_PID atom instead of WM_CLASS.

Wait until the window appears and then send it to the original workspace:

#!/bin/bash activeworkspace=$(i3-msg get_workspaces | jq -c '.[] | select(.focused) | .name' --raw-output) atom & windowname=atom xprop -spy -root _NET_ACTIVE_WINDOW | \ while read line ; do xprop WM_CLASS -id ${line##* } | \  grep -q $windowname && \ i3-msg move "[con_id=\"${line##* }\"]" $activeworkspace && \  exit done 
  • At first get the active workspace, use the jq as an example
  • run your program: atom
  • Use xprop -spy to 'Examine window properties forever, looking for property change events.'
  • Act on all new active windows with while read line
  • Get WM_CLASS of them with xprop WM_CLASS, extract the windowid with bash ${line##* }
  • Filter with `grep $windowname
  • Move the window to the original workspace with i3-msg move ..

It doesn't work when you have multiple atom windows which get focused between the start and the move of a new atom window. In this case you would have to look for the NET_WM_PID atom instead of WM_CLASS.

Wait until the window appears and then send it to the original workspace:

#!/bin/bash activeworkspace=$(i3-msg -t get_workspaces | jq -c '.[] | select(.focused) | .name' --raw-output) atom & windowname=atom xprop -spy -root _NET_ACTIVE_WINDOW | \ while read line ; do   if xprop WM_CLASS -id ${line##* } | grep -q $windowname ; then   i3-msg move "[con_id=\"${line##* }\"]" $activeworkspace   exit fi done 
  • At first get the active workspace, use the jq as an example
  • run your program: atom
  • Use xprop -spy to 'Examine window properties forever, looking for property change events.'
  • Act on all new active windows with while read line
  • Get WM_CLASS of them with xprop WM_CLASS, extract the windowid with bash ${line##* }
  • Filter with `grep $windowname
  • Move the window to the original workspace with i3-msg move ..

It doesn't work when you have multiple atom windows which get focused between the start and the move of a new atom window. In this case you would have to look for the NET_WM_PID atom instead of WM_CLASS.

Source Link
ctx
  • 2.9k
  • 13
  • 19

Wait until the window appears and then send it to the original workspace:

#!/bin/bash activeworkspace=$(i3-msg get_workspaces | jq -c '.[] | select(.focused) | .name' --raw-output) atom & windowname=atom xprop -spy -root _NET_ACTIVE_WINDOW | \ while read line ; do xprop WM_CLASS -id ${line##* } | \ grep -q $windowname && \ i3-msg move "[con_id=\"${line##* }\"]" $activeworkspace && \ exit done 
  • At first get the active workspace, use the jq as an example
  • run your program: atom
  • Use xprop -spy to 'Examine window properties forever, looking for property change events.'
  • Act on all new active windows with while read line
  • Get WM_CLASS of them with xprop WM_CLASS, extract the windowid with bash ${line##* }
  • Filter with `grep $windowname
  • Move the window to the original workspace with i3-msg move ..

It doesn't work when you have multiple atom windows which get focused between the start and the move of a new atom window. In this case you would have to look for the NET_WM_PID atom instead of WM_CLASS.