You are not logged in.
Pages: 1
Topic closed
Hey all,
I really missed the feature in other WM's where one could drag a maximized window out of maximize and have it restore to the original size. I have written a small shell script to get the size of the current window and then implemented it in rc.xml. The only little issue is that, for some reason, when restoring from the values originally saved, the window comes out of the "maximized" state but retains the maximized dimensions. In other words, I can drag it out of "maximized' but it stays big, and does not go back to the original saved size. Any thoughts?
getdimcur.sh
#!/bin/bash
activew="$(xwininfo -id $(xdotool getactivewindow)|awk '/Width/ {print $2}')"
activeh="$(xwininfo -id $(xdotool getactivewindow)|awk '/Height/ {print $2}')"
echo -en "$activew $activeh" > /home/ts/scripts/curwin/curwindim
rc.xml snippet
<context name="Titlebar">
<mousebind button="Left" action="DoubleClick">
<action name="Execute">
<command>bash /home/ts/scripts/curwin/getdimcur.sh</command>
</action>
<action name="Execute">
<command>wmctrl -r :ACTIVE: -b toggle,maximized_vert,maximized_horz</command>
</action>
</mousebind>
<mousebind button="Left" action="Drag">
<action name="if">
<maximized>yes</maximized>
<then>
<action name="Execute">
<command>wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz</command>
</action>
<action name="Execute">
<command>bash /home/ts/scripts/curwin/restorewin.sh/</command>
</action>
</then>
</action>
<action name="Move"/>
</mousebind>
</context>
restorewin.sh
xdotool getactivewindow windowsize $(cat /home/ts/scripts/curwin/curwindim|awk '{print $1}') $(cat /home/ts/scripts/curwin/curwindim|awk '{print $2}')
Testing these commands in terminal individually is successful, so what am I missing?
Thank you.
Offline
I have solved moving a window by dragging the title bar with the following openbox configuration, which is located in ~/.config/openbox/lxde-rc.xml on my machine:
[...]
<context name="Titlebar">
[...]
<mousebind button="Left" action="Drag">
<action name="if">
<maximized>yes</maximized>
<then>
<action name="Unmaximize"/>
<action name="MoveResizeTo">
<y>0</y>
</action>
</then>
</action>
<action name="Move"/>
</mousebind>
<mousebind button="Left" action="DoubleClick">
<action name="ToggleMaximizeFull"/>
</mousebind>
[...]
</context>
[...]
After holding down the left mouse button on the title bar and moving the mouse, the window is unmaximized and moved to the top of the desktop with the actions Unmaximize and MoveResizeTo. Unmaximizing and moving to the top is only done, if the window is maximized. Then in each case the action Move starts the modus for moving the window with the mouse. This configuration simulates nearly the same behavior as in Windows 7 while dragged the title bar with the left mouse button.
After a left double click on the title bar, the action ToggleMaximizeFull switches the window state once between maximized and unmaximized.
See also http://openbox.org/wiki/Help:Actions
Last edited by raimar (2014-01-04 23:48:06)
Offline
I have solved moving a window by dragging the title bar with the following openbox configuration, which is located in ~/.config/openbox/lxde-rc.xml on my machine:
[...] <context name="Titlebar"> [...] <mousebind button="Left" action="Drag"> <action name="if"> <maximized>yes</maximized> <then> <action name="Unmaximize"/> <action name="MoveResizeTo"> <y>0</y> </action> </then> </action> <action name="Move"/> </mousebind> <mousebind button="Left" action="DoubleClick"> <action name="ToggleMaximizeFull"/> </mousebind> [...] </context> [...]
After holding down the left mouse button on the title bar and moving the mouse, the window is unmaximized and moved to the top of the desktop with the actions Unmaximize and MoveResizeTo. Unmaximizing and moving to the top is only done, if the window is maximized. Then in each case the action Move starts the modus for moving the window with the mouse. This configuration simulates nearly the same behavior as in Windows 7 while dragged the title bar with the left mouse button.
After a left double click on the title bar, the action ToggleMaximizeFull switches the window state once between maximized and unmaximized.
See also http://openbox.org/wiki/Help:Actions
Sorry for digging, but it was very helpful and I've a question.
How to make window resize to size from before maximizing? When I applied this I'm able to move this window, but it's still in size of maximized window.
Offline
Offline
Pages: 1
Topic closed