Script to focus and raise window demanding attention

I’m running Openbox with Gnome on Linux, and windows demanding attention show in
the taskbar with a yellow highlight, usually Skype IMs or something.
I’ve created the following bash script that I bind to a hotkey win-j, and pressing it changes to the correct desktop, raises the window, and focuses it. Huge time saver!

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

Requirements: Wmctrl (sudo apt-get install wmctrl)

Here’s another adaptation I’ve added. Two scripts, one bound to Win-r to jump to the window demanding attention, and another bound to W-Shift-r that jumps back to the window you were busy with.

First:

#!/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

Second:

#!/bin/bash
if [ -f ~/activeWinId ]; then
	origWinId=`cat ~/activeWinId`
	wmctrl -i -a $origWinId
fi
Posted at 7pm on 02/24/10 by Vaughn Dickson | read on

Researchers Say Women Secretly Desire Hairy Geeks

“The Daily Mail has a story about a study looking into women’s preference for men. More specifically, about how women say they want one kind of man, but really want another. From the article: ‘Most women claim to be attracted to tall, dark and handsome men, but a new study has revealed that facial stubble and a geeky personality are their biggest secret turn-ons. Despite complaining that it looks unkempt and feels rough to touch, the unshaven look on a man is actually a turn-on for 41 per cent of women. A slightly geeky personality came second, proving that women really do like a guy who knows their stuff when it comes to technology. A hairy chest was voted third, followed by a man who loves to read or cries at a soppy film.’”

[via Slashdot]

Posted at 8am on 02/20/10 by Vaughn Dickson | read on

Online Colleges - search for 1000+ online degrees, online colleges & online universities

Pages

About

Whatever catches our internet-shortened attention spans will be propped up here as a decoy to lure your boredom out in the open, where we’ll silently glide out of the shadows and slit it’s tedious throat. Because we care.

Join the forums to discuss world domination, or peruse the Wiki for arcane knowledge.

Java, WordPress, PHP, Javascript, Python, Apache, Scala, WTF, I’m Totally Lost! Let us help. Get your very own ninja software developer and consultant and we’ll make your problems…disappear.

  • Share/Bookmark

Twitter

Posting tweet...

Tags

advert art beautiful-south-africans beautiful-women beauty bizarre book business design environment firefox funny funny-video games google health hotties Humanity java life mac marketing mobile movies music nature philosophy photography photos programming psychology rant review science science-fiction singularity software software-development south-africa technology thoughts tips trailer trailers video

Afrigator