Created
September 4, 2011 14:27
-
-
Save offlinehacker/1192926 to your computer and use it in GitHub Desktop.
Start web app
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
################################################## | |
# Get application's window ID | |
# Input: | |
# $1: application's process ID | |
# Output: | |
# $1: application's window ID | |
# Return value: | |
# success: 0 | |
# failed: 1 | |
# Usage: | |
# WID=`GetWID $PID` | |
# | |
GetWID() { | |
# Loop windows with application's executable name | |
for WID in $(wmctrl -l | awk '{print $1}') | |
do | |
# Check window's PID is matching application's PID | |
if [ `xprop -id $WID _NET_WM_PID | \ | |
awk '{print $3}'` -eq $1 ] ; then | |
echo $WID | |
return 0 | |
fi | |
done | |
return 1 | |
} | |
chromium-browser --app=https://www.seesmic.com/web/index.html 1>&2 2> /dev/null & | |
PID=$! | |
WID=0 | |
# It takes a few seconds to launch, hence retries 10 times | |
for I in `seq 20` ; do | |
WID=`GetWID $PID` | |
if [ $? -eq 0 ] ; then | |
echo "Found match $WID" | |
wmctrl -i -r $WID -t 3 | |
wmctrl -i -r $WID -b add,maximized_horz | |
wmctrl -i -r $WID -b add,modal | |
wmctrl -i -r $WID -b add,skip_taskbar | |
wmctrl -i -r $WID -b add,skip_pager | |
wmctrl -i -r $WID -b add,above | |
break | |
fi | |
sleep 1 | |
done | |
echo "WID is: $WID" | |
while ! wmctrl -l | grep Seesmic | |
do | |
sleep 3 | |
xdotool key --window $WID F5 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment