Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #/bin/bash
- # killOld=`ps -ef | grep CitrixCaffeine.sh | awk '{print $2}' | xargs kill -9`
- #get the details of currently open windows | get only the full title | put 'FALSE " "'' around each title for zenity usage | replace newlines with spaces -- o/p is ready as a list of options for zenity radiolist
- listOfWindows=`wmctrl -l | awk '{print substr($0,index($0,$4))}' | sed 's/\(.*\)/FALSE "\1"/g' | tr '\n' ' '`
- #echo ${listOfWindows}
- ListType=`eval $(echo "zenity --width=400 --height=275 --window-icon='/usr/share/icons/CitrixCaffeine.png' --list --radiolist --title 'Window Picker' --text 'Pick the window to keep alive:' --column 'Select' --column 'Window Name:' $listOfWindows")`
- echo $ListType
- #still doesn't handle case where multiple windows have same title
- WID=$(xdotool search --name "${ListType:0:10}")
- echo $WID
- Response=$(zenity --scale --title "Ping frequency" --window-icon='/usr/share/icons/CitrixCaffeine.png' --text "Select ping frequency." --min-value=10 --max-value=180 --step=5 --value=120);
- echo $Response
- if [[ $WID > -1 ]]; then
- while [ 1 ]; do
- sleep $Response
- xdotool key --window $WID F13
- #sleep 2
- #xdotool key --window $WID a
- done
- fi
- else
- #unlikely as we're picking from a list, but if window is closed between execution, it branches here, it doesn't. WID is stored in variable, fix this
- zenity --error --title="Error!" --width=200 --text="This window doesn't exist"
- exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement