[openbox] script to focus and raise window demanding attention
Anthony Thyssen
A.Thyssen at griffith.edu.au
Thu Mar 4 00:15:30 EST 2010
On Sun, 28 Feb 2010 08:52:24 +0200
Vaughn Dickson <vaughnd at gmail.com> wrote:
| Bound to W-r:
|
| #!/bin/bash
| activeWinIdLine=`xprop -root | grep _NET_ACTIVE_WINDOW\(WINDOW\) `
| activeWinId="${activeWinIdLine:40}"
|
| echo $activeWinId > ~/activeWinId
| for id in `wmctrl -l | cut -d " " -f 1`; do
| xprop -id $id | grep "_NET_WM_STATE_DEMANDS_ATTENTION" 2>&1 > /dev/null
| if [ "$?" = "0" ]; then
|
| wmctrl -i -a $id
| exit 0
| fi
| done
| exit 1
|
|
| Bound to W-S-r:
|
| #!/bin/bash
| if [ -f ~/activeWinId ]; then
| origWinId=`cat ~/activeWinId`
| wmctrl -i -a $origWinId
| fi
|
|
I would make your grep a little more specific as I copyed and pasted a
line to try it and got two resulting lines!!! One copy from a 'cut buffer'.
:::prompt:::> xprop -root | grep '_NET_ACTIVE_WINDOW(WINDOW)'
CUT_BUFFER0(STRING) = "xprop -root | grep '_NET_ACTIVE_WINDOW(WINDOW)'"
_NET_ACTIVE_WINDOW(WINDOW): window id # 0x1e00022
I suggest you add '^' so say it must be at the start of the line.
Also you can replace the grep with 'sed' to search and extract the
window ID at the same time...
:::prompt:::> xprop -root | sed -n '/^_NET_ACTIVE_WINDOW(WINDOW)/s/.\{40\}//p'
0x1e00022
That works much better!
As an alternative to wmctrl you can also look at xwit
Anthony Thyssen ( System Programmer ) <A.Thyssen at griffith.edu.au>
--------------------------------------------------------------------------
"Brigadier, a straight line may be the shortest distance between two
points, but it is by no means the most interesting."
-- Doctor Who, "The Time Warrior"
--------------------------------------------------------------------------
Anthony's Castle http://hobbit.ict.griffith.edu.au/~anthony/
More information about the openbox
mailing list