Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- X=200
- Y=200
- W=100
- H=30
- COMMAND="$SHELL"
- if [ -n "$1" ]
- then
- SNAME="$1";
- if [ -n "$2" ]
- then
- COMMAND="$2";
- if [ -n "$3" ]
- then
- X="$3";
- if [ -n "$4" ]
- then
- Y="$4";
- if [ -n "$5" ]
- then
- W="$5";
- if [ -n "$6" ]
- then
- H="$6";
- fi
- fi
- fi
- fi
- fi
- else
- SNAME="";
- fi
- PATNAME="\*-scratch-${SNAME}\*";
- TERMNAME="*-scratch-${SNAME}*";
- SW=`xdotool search --classname ${PATNAME}`;
- if [ -z "$SW" ]
- then
- urxvtc -name ${TERMNAME} -g "${W}x${H}+${X}+${Y}" -e "${COMMAND}";
- SW=`xdotool search --classname ${PATNAME}`;
- xdotool windowunmap "$SW";
- xprop -id "$SW" -f _NET_WM_WINDOW_TYPE 32a -set _NET_WM_WINDOW_TYPE _NET_WM_WINDOW_TYPE_DIALOG
- xdotool set_window --classname ${TERMNAME} --role '*-scratch-*' #--overrideredirect 0 "$SW"
- xdotool windowmap "$SW"
- xdotool windowraise "$SW" windowsize --usehints "$SW" "$W" "$H" windowmove "$SW" "$X" "$Y";
- xdotool windowfocus "$SW";
- #xdotool behave "$SW" mouse-enter windowfocus
- #xprop -id "$SW" -f WM_WINDOW_ROLE 8s -set WM_WINDOW_ROLE '*-scratch-*'
- #xprop -id "$SW" -f _NET_WM_STATE 32a -set _NET_WM_STATE _NET_WM_STATE_ABOVE
- #xprop -id "$SW" -f _NET_WM_STATE 32a -set _NET_WM_STATE _NET_WM_STATE_SKIP_TASKBAR
- #wmctrl -x -r ${TERMNAME} -b add,above,skip_taskbar
- #wmctrl -x -r ${TERMNAME} -b remove,maximized_vert,maximized_horz
- #wmctrl -x -r ${TERMNAME} -e 0,"$X,$Y,$W,$H";
- else
- SWN=`xdotool search --onlyvisible --classname ${PATNAME}`;
- if [ -n "$SWN" ]
- then
- xdotool windowminimize "$SWN";
- xdotool windowunmap "$SWN";
- xdotool getactivewindow windowraise
- else
- xdotool windowmap "$SW";
- xdotool windowraise "$SW" windowsize --usehints "$SW" "$W" "$H" windowmove "$SW" "$X" "$Y";
- fi
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement