You are not logged in.
I don't know whether any Ubuntu Unity user is here, but Unity has a great feature of window positioning using Ctrl+Alt+Num(keypad). It sets the current window in the corresponding position in accordance with the pressed Num Key. I'll give the examples here:
Ctrl+Alt+1 would position the window in Bottom Left Corner
Ctrl+Alt+3 would position the window in Bottom Right Corner
Ctrl+Alt+9 would position the window in Top Right Corner
Ctrl+Alt+7 would position the window in Top Left Corner
Ctrl+Alt+2 would position the window in Bottom Half-of-the-Screen
Ctrl+Alt+8 would position the window in Top Half-of-the-Screen
Ctrl+Alt+4 would position the window in Left Half-of-the-Screen
Ctrl+Alt+6 would position the window in Right Half-of-the-Screen
Ctrl+Alt+5 would position the window in Center of the Screen in its Normal size
I want to implement 'exactly' this feature in my Openbox WM of CrunchBang. How would I do that?
Last edited by tranjeeshan (2014-11-27 06:13:58)
Offline
Similar thread recently:
organizing windows
Also:
Brontosaurusrex's howto on openbox manual tiling.
Example rc.xml, read lines 279-573.
Last edited by nore (2014-11-27 07:30:32)
Offline
nore, you said it all.
Offline
nore, you said it all.
Didn't get it.
Offline
ohnonot wrote:nore, you said it all.
Didn't get it.
The file ~/.config/openbox/rc.xml contains all the key and mousebinds for Openbox. This includes a lot for window positioning. You can edit this file so that they move how you want them to, with the keyboard combinations that you designate.
There are quite a few already set up, including snapping actions (with cb-aerosnap). For all possibilities read the links given above, and see also Openbox wiki Help:Actions for example
I use Alt-Arrow to snap my windows left/right, Ctrl-Arrow to shrink/expand into available desktop space.
BunsenLabs Group on deviantArt
damo's gallery on deviantArt
Openbox themes
Forum Moderator
Offline
I'll try them and will let you know
Offline
Backup rc.xml first! If you make an error in the xml then Openbox may not start properly
My advice is to make one change at a time, then do Settings->Openbox->reconfigure, and try it.
BunsenLabs Group on deviantArt
damo's gallery on deviantArt
Openbox themes
Forum Moderator
Offline
Offline
ohnonot wrote:nore, you said it all.
Didn't get it.
there was no hidden meaning.
i came here to point you to the same threads, only to find nore had already done that.
Offline
Offline
I don't know whether any Ubuntu Unity user is here, but Unity has a great feature of window positioning using Ctrl+Alt+Num(keypad). It sets the current window in the corresponding position in accordance with the pressed Num Key. I'll give the examples here:
Ctrl+Alt+1 would position the window in Bottom Left Corner
Ctrl+Alt+3 would position the window in Bottom Right Corner
Ctrl+Alt+9 would position the window in Top Right Corner
Ctrl+Alt+7 would position the window in Top Left Corner
Ctrl+Alt+2 would position the window in Bottom Half-of-the-Screen
Ctrl+Alt+8 would position the window in Top Half-of-the-Screen
Ctrl+Alt+4 would position the window in Left Half-of-the-Screen
Ctrl+Alt+6 would position the window in Right Half-of-the-Screen
Ctrl+Alt+5 would position the window in Center of the Screen in its Normal sizeI want to implement 'exactly' this feature in my Openbox WM of CrunchBang. How would I do that?
This is the best I've been able to do with it. Works perfectly (almost) on a single monitor setup, but is a little buggy on dual monitor (see details below).
I'm going to explain this as if the reader is completely green, as step by step as I can think to make it.
So, to start out, open your rc.xml file (located in ~/.config/openbox/) in geany. There is a section in the file already that attempts to do some tiling (but isn't so great), which I commented out and placed my code next to. So go to "Find" (ctrl+f) and type "A bit of tiling" and you should get to the section I'm talking about (if you're using default rc.xml file, it'll be around line 429).
To make a comment, you would do this:
<!-- Text you want commented out -->
I would comment out the 'tiling' keybinds already there like so:
<!-- <keybind key="W-Right">
<action name="GrowToEdgeEast"/>
</keybind>
<keybind key="W-Left">
<action name="GrowToEdgeWest"/>
</keybind>
<keybind key="W-Down">
<action name="GrowToEdgeSouth"/>
</keybind>
<keybind key="W-Up">
<action name="GrowToEdgeNorth"/>
</keybind>
<keybind key="W-A-Left">
<action name="Execute">
<command>cb-aerosnap --left</command>
</action>
</keybind>
<keybind key="W-A-Right">
<action name="Execute">
<command>cb-aerosnap --right</command>
</action>
</keybind> -->
Then paste my code below underneath that:
<!-- Start of Tiling -->
<!-- Poorly strewn together by alaskan-hippie who can be found here: http://crunchbang.org/forums/profile.php?id=9401 -->
<!--Bottom Left-->
<keybind key="W-A-KP_1">
<action name="UnmaximizeFull"/>
<action name="MoveResizeTo">
<width>50%</width>
<height>50%</height>
</action>
<action name="MoveToEdge"><direction>south</direction></action>
<action name="MoveToEdge"><direction>west</direction></action>
</keybind>
<!--Bottom-->
<keybind key="W-A-KP_2">
<action name="UnmaximizeFull"/>
<action name="Maximize"><direction>horizontal</direction></action>
<action name="MoveResizeTo">
<height>50%</height>
</action>
<action name="MoveToEdge"><direction>south</direction></action>
</keybind>
<!--Bottom Right-->
<keybind key="W-A-KP_3">
<action name="UnmaximizeFull"/>
<action name="MoveResizeTo">
<width>50%</width>
<height>50%</height>
</action>
<action name="MoveToEdge"><direction>south</direction></action>
<action name="MoveToEdge"><direction>east</direction></action>
</keybind>
<!--Full Left-->
<keybind key="W-A-KP_4">
<action name="UnmaximizeFull"/>
<action name="MaximizeVert"/>
<action name="MoveResizeTo">
<width>50%</width>
</action>
<action name="MoveToEdge"><direction>west</direction></action>
</keybind>
<!--Full Screen/Center-->
<keybind key="W-A-KP_5">
<action name="Maximize"><direction>both</direction></action>
</keybind>
<!--Full Right-->
<keybind key="W-A-KP_6">
<action name="UnmaximizeFull"/>
<action name="MaximizeVert"/>
<action name="MoveResizeTo">
<width>50%</width>
</action>
<action name="MoveToEdge"><direction>east</direction></action>
</keybind>
<!--Top Left-->
<keybind key="W-A-KP_7">
<action name="UnmaximizeFull"/>
<action name="MoveResizeTo">
<width>50%</width>
<height>50%</height>
</action>
<action name="MoveToEdge"><direction>north</direction></action>
<action name="MoveToEdge"><direction>west</direction></action>
</keybind>
<!--Full Top-->
<keybind key="W-A-KP_8">
<action name="UnmaximizeFull"/>
<action name="Maximize"><direction>horizontal</direction></action>
<action name="MoveResizeTo">
<height>50%</height>
</action>
<action name="MoveToEdge"><direction>north</direction></action>
</keybind>
<!--Top Right-->
<keybind key="W-A-KP_9">
<action name="UnmaximizeFull"/>
<action name="MoveResizeTo">
<width>50%</width>
<height>50%</height>
</action>
<action name="MoveToEdge"><direction>north</direction></action>
<action name="MoveToEdge"><direction>east</direction></action>
</keybind>
<!-- End of tiling -->
After that, save (ctrl+s) and then restart openbox by either pressing alt+F2 and typing "openbox --restart" or by going to the menu entry Settings -> Openbox -> Restart.
Now you should have your makeshift manual tiling. The keypad represents the screen, each number would be where the window will snap to (eg, super+alt+numpad_1 brings the window to the bottom left quarter of the screen), and the center (5) will maximize the window.
Details regarding single monitor setups:
Moving between certain positions you may have to press the desired key combo a times. I tested on my laptop and noticed that going from full left/right to top left/right would leave the window the right size but hanging in the middle top, and going from any top position to bottom would again resize correctly but leave the window floating a little ways up the screen. Both of those situations were fixed by hitting the key combo again.
Details regarding laptops:
Many laptops don't have full keypads, but rather keys mapped to both regular keyboard keys and numpad keys (ie, on my laptop U is also 4, if my numpad lock is on). I recommend changing them to the standard numbers, or to the arrow keys (I prefer the arrow keys). If changing to the arrow keys, consider short example below that I use myself.
<!-- Top Left-->
<keybind key="W-C-A-Up">
<!--Left-->
<keybind key="W-A-Left">
<!--Bottom Left-->
<keybind key="W-C-A-Left">
<!--Top Right-->
<keybind key="W-C-A-Right">
<!--Bottom Right-->
<keybind key="W-C-A-Down">
Details regarding dual monitor setups:
If you have two monitors side by side (using twinview or similar), the center line will likely be fuzzy from openbox's perspective. What this means is, if you have a full height half width window on the right side (ie full right) of your left monitor, and you go to make it full bottom, it'll probably split between the two monitors. This will also happen if you have a top/bottom right window on the left monitor and go to make it a full right. The only way I've found around this so is to bring the window to the opposite side of the screen from the center line between the monitors, then you can bring it back.
For example, say I have a window in the top left (position 7) of my right-most monitor that I would like to move to the bottom left (pos. 1) of the same monitor. If I was to try this out-right, it would move to the bottom left (pos. 1), but also be showing some (a little, or a lot) on the left monitor as well, which is not what I wanted. What I do to prevent that window from jumping over to the other screen is to bring it to the bottom right (pos. 3) first, then to the bottom left (pos. 1). It's a bit cumbersome, but takes no extra thought once you've done it a few times.
Also, to move a window from one monitor to the other, for best results you'll need to bring the window all the way to the far side of the destination monitor first, then position it where you'd like. Example, if a window at top right of my right monitor needs to be full right on my left monitor, I would press super+alt+numpad_4 several times until the window was all the way to the left, then super+alt+numpad_6 to bring it to full right on the left monitor.
If any of this is confusing, please let me know and I'd be happy to clarify. It is quite late (er... now early) so my brain grammaring no working good, and explaining things is becoming more difficult by the letter.
Please feel free to change any key combination you'd like to make things more suited to your needs.
Hopefully this helps, OP!
Last edited by alaskan-hippie (2014-12-14 23:58:16)
Offline
tranjeeshan wrote:I don't know whether any Ubuntu Unity user is here, but Unity has a great feature of window positioning using Ctrl+Alt+Num(keypad). It sets the current window in the corresponding position in accordance with the pressed Num Key. I'll give the examples here:
Ctrl+Alt+1 would position the window in Bottom Left Corner
Ctrl+Alt+3 would position the window in Bottom Right Corner
Ctrl+Alt+9 would position the window in Top Right Corner
Ctrl+Alt+7 would position the window in Top Left Corner
Ctrl+Alt+2 would position the window in Bottom Half-of-the-Screen
Ctrl+Alt+8 would position the window in Top Half-of-the-Screen
Ctrl+Alt+4 would position the window in Left Half-of-the-Screen
Ctrl+Alt+6 would position the window in Right Half-of-the-Screen
Ctrl+Alt+5 would position the window in Center of the Screen in its Normal sizeI want to implement 'exactly' this feature in my Openbox WM of CrunchBang. How would I do that?
This is the best I've been able to do with it. Works perfectly on a single monitor setup, but is a little buggy on dual monitor (details on that below).
I'm going to explain this as if the reader is completely green, as step by step as I can think to make it.
So, to start out, open your rc.xml file (located in ~/.config/openbox/) in geany. There is a section in the file already that attempts to do some tiling (but isn't so great), which I commented out and placed my code next to. So go to "Find" (ctrl+f) and type "A bit of tiling" and you should get to the section I'm talking about (if you're using default rc.xml file, it'll be around line 429).
To make a comment, you would do this:
<!-- Text you want commented out -->
I would comment out the 'tiling' keybinds already there like so:
<!-- <keybind key="W-Right"> <action name="GrowToEdgeEast"/> </keybind> <keybind key="W-Left"> <action name="GrowToEdgeWest"/> </keybind> <keybind key="W-Down"> <action name="GrowToEdgeSouth"/> </keybind> <keybind key="W-Up"> <action name="GrowToEdgeNorth"/> </keybind> <keybind key="W-A-Left"> <action name="Execute"> <command>cb-aerosnap --left</command> </action> </keybind> <keybind key="W-A-Right"> <action name="Execute"> <command>cb-aerosnap --right</command> </action> </keybind> -->
Then paste my code below underneath that:
<!-- Start of Tiling --> <!-- Poorly strewn together by alaskan-hippie who can be found here: http://crunchbang.org/forums/profile.php?id=9401 --> <!--Bottom Left--> <keybind key="W-A-KP_1"> <action name="UnmaximizeFull"/> <action name="MoveResizeTo"> <width>50%</width> <height>50%</height> </action> <action name="MoveToEdge"><direction>south</direction></action> <action name="MoveToEdge"><direction>west</direction></action> </keybind> <!--Bottom--> <keybind key="W-A-KP_2"> <action name="UnmaximizeFull"/> <action name="Maximize"><direction>horizontal</direction></action> <action name="MoveResizeTo"> <height>50%</height> </action> <action name="MoveToEdge"><direction>south</direction></action> </keybind> <!--Bottom Right--> <keybind key="W-A-KP_3"> <action name="UnmaximizeFull"/> <action name="MoveResizeTo"> <width>50%</width> <height>50%</height> </action> <action name="MoveToEdge"><direction>south</direction></action> <action name="MoveToEdge"><direction>east</direction></action> </keybind> <!--Full Left--> <keybind key="W-A-KP_4"> <action name="UnmaximizeFull"/> <action name="MaximizeVert"/> <action name="MoveResizeTo"> <width>50%</width> </action> <action name="MoveToEdge"><direction>west</direction></action> </keybind> <!--Full Screen/Center--> <keybind key="W-A-KP_5"> <action name="Maximize"><direction>both</direction></action> </keybind> <!--Full Right--> <keybind key="W-A-KP_6"> <action name="UnmaximizeFull"/> <action name="MaximizeVert"/> <action name="MoveResizeTo"> <width>50%</width> </action> <action name="MoveToEdge"><direction>east</direction></action> </keybind> <!--Top Left--> <keybind key="W-A-KP_7"> <action name="UnmaximizeFull"/> <action name="MoveResizeTo"> <width>50%</width> <height>50%</height> </action> <action name="MoveToEdge"><direction>north</direction></action> <action name="MoveToEdge"><direction>west</direction></action> </keybind> <!--Full Top--> <keybind key="W-A-KP_8"> <action name="UnmaximizeFull"/> <action name="Maximize"><direction>horizontal</direction></action> <action name="MoveResizeTo"> <height>50%</height> </action> <action name="MoveToEdge"><direction>north</direction></action> </keybind> <!--Top Right--> <keybind key="W-A-KP_9"> <action name="UnmaximizeFull"/> <action name="MoveResizeTo"> <width>50%</width> <height>50%</height> </action> <action name="MoveToEdge"><direction>north</direction></action> <action name="MoveToEdge"><direction>east</direction></action> </keybind> <!-- End of tiling -->
After that, save (ctrl+s) and then restart openbox by either pressing alt+F2 and typing "openbox --restart" or by going to the menu entry Settings -> Openbox -> Restart.
Now you should have your makeshift manual tiling. The keypad represents the screen, each number would be where the window will snap to (eg, super+alt+numpad_1 brings the window to the bottom left quarter of the screen), and the center (5) will maximize the window.
Details regarding dual monitor setups:
If you have two monitors side by side (using twinview or similar), the center line will likely be fuzzy from openbox's perspective. What this means is, if you have a full height half width window on the right side (ie full right) of your left monitor, and you go to make it full bottom, it'll probably split between the two monitors. This will also happen if you have a top/bottom right window on the left monitor and go to make it a full right. The only way I've found around this so is to bring the window to the opposite side of the screen from the center line between the monitors, then you can bring it back.For example, say I have a window in the top left (position 7) of my right-most monitor that I would like to move to the bottom left (pos. 1) of the same monitor. If I was to try this out-right, it would move to the bottom left (pos. 1), but also be showing some (a little, or a lot) on the left monitor as well, which is not what I wanted. What I do to prevent that window from jumping over to the other screen is to bring it to the bottom right (pos. 3) first, then to the bottom left (pos. 1). It's a bit cumbersome, but takes no extra thought once you've done it a few times.
Also, to move a window from one monitor to the other, for best results you'll need to bring the window all the way to the far side of the destination monitor first, then position it where you'd like. Example, if a window at top right of my right monitor needs to be full right on my left monitor, I would press super+alt+numpad_4 several times until the window was all the way to the left, then super+alt+numpad_6 to bring it to full right on the left monitor.
If any of this is confusing, please let me know and I'd be happy to clarify. It is quite late (er... now early) so my brain grammaring no working good, and explaining things is becoming more difficult by the letter.
Hopefully this helps, OP!
Awesome! Thank you very much, alaskan-hippie. That's what I was looking for.
I'll try it out and let you know.
You can post it in #! How-To guide. I'm sure many people would be thankful for this.
Offline
@alaskan-hippie, after saving your code and restarting openbox, I'm seeing an error. I've attached the screenshot of the error herewith. What's the problem?
http://imgur.com/Cn9F0K7
Last edited by tranjeeshan (2014-12-14 17:52:38)
Offline
First problem is, that we can't see your screenshot. Most probably a missing end of comment "-->" or similar.
Did you backup your rc.xml before editing? If not, you can find the default one in folder /etc/skel/.config/openbox and copy it from there. Don't overwrite your own file next time, just clip and paste appropriate sections after making a backup and reading through and learning to understand the lines you are going to copy. Be careful. If you are going to remove something, comment it out instead of deleting.
Last edited by nore (2014-12-14 17:30:34)
Offline
First problem is, that we can't see your screenshot. Most probably a missing end of comment "-->" or similar.
Did you backup your rc.xml before editing? If not, you can find the default one in folder /etc/skel/.config/openbox and copy it from there. Don't overwrite your own file next time, just clip and paste appropriate sections after making a backup and reading through and learning to understand the lines you are going to copy. Be careful. If you are going to remove something, comment it out instead of deleting.
I've edited the image link. Could you tell me the solution now? I checked the code but didn't find any clue of the error.
Offline
I've edited the image link. Could you tell me the solution now? I checked the code but didn't find any clue of the error.
It tells you the error: "Double hyphen within comment". You may have not closed a comment, and it is being confused by the "--" within the commands.
I would also suggest you follow @nore's advice, and use the default rc.xml from /etc/skel/.config/openbox until you track down the problem.
BunsenLabs Group on deviantArt
damo's gallery on deviantArt
Openbox themes
Forum Moderator
Offline
Nore is right about baking up first, i forgot to mention that bit. Post the section you rc.xml that you edited for us to look over.
Offline
@alaskan-hippie, after saving your code and restarting openbox, I'm seeing an error. I've attached the screenshot of the error herewith. What's the problem?
http://imgur.com/Cn9F0K7
I actually just tested my instructions using the default rc.xml, and figured out what's going. The double hyphens used in the line "cb-aerosnap --right/left" is not permitted. Having double hyphens in xml markdown comments is disallowed for compatibility with SGML. I haven't seen a way around this at all other than removing the double hyphens. So you can do one of two things:
1 Change the code as follows:
<!--
<command>cb-aerosnap --left</command>
-->
Change to
<!--
<command>cb-aerosnap - -left</command>
-->
OR
2 Just remove that whole section:
REMOVE THE FOLLOWING
<keybind key="W-Right">
<action name="GrowToEdgeEast"/>
</keybind>
<keybind key="W-Left">
<action name="GrowToEdgeWest"/>
</keybind>
<keybind key="W-Down">
<action name="GrowToEdgeSouth"/>
</keybind>
<keybind key="W-Up">
<action name="GrowToEdgeNorth"/>
</keybind>
<keybind key="W-A-Left">
<action name="Execute">
<command>cb-aerosnap - -left</command>
</action>
</keybind>
<keybind key="W-A-Right">
<action name="Execute">
<command>cb-aerosnap - -right</command>
</action>
</keybind>
<keybind key="W-Right">
<action name="GrowToEdgeEast"/>
</keybind>
<keybind key="W-Left">
<action name="GrowToEdgeWest"/>
</keybind>
<keybind key="W-Down">
<action name="GrowToEdgeSouth"/>
</keybind>
<keybind key="W-Up">
<action name="GrowToEdgeNorth"/>
</keybind>
<keybind key="W-A-Left">
<action name="Execute">
<command>cb-aerosnap - -left</command>
</action>
</keybind>
<keybind key="W-A-Right">
<action name="Execute">
<command>cb-aerosnap - -right</command>
</action>
</keybind>
I just removed it entirely on my end.
Offline
Okay, I made a backup copy of rc.xml and then removed the part that weren't necesary. The problem's gone.
The problem was, XML or SGML doesn't allow double hyphen in comment. Thanks everyone.
Offline
Happy to help. Glad it's working for you!
If you do wind up having further questions/comments or a suggested change to something, I started a thread in the tips/tricks section, so feel free to ask there.
Offline
I'll comment/question on that thread if I encounter any problem. Thanks, again.
Offline
... The double hyphens used in the line "cb-aerosnap --right/left" is not permitted. ...
Thanks for that. Now I know what tripped me up in the past
Offline
alaskan-hippie wrote:... The double hyphens used in the line "cb-aerosnap --right/left" is not permitted. ...
Thanks for that. Now I know what tripped me up in the past
No problem. I'd never encountered that before today, so I'm glad I could help more than just myself!
Offline
flaneur wrote:alaskan-hippie wrote:... The double hyphens used in the line "cb-aerosnap --right/left" is not permitted. ...
Thanks for that. Now I know what tripped me up in the past
No problem. I'd never encountered that before today, so I'm glad I could help more than just myself!
I tried to find an "official" source for this but failed.
So I went back and purposely edited a "--" into a comment and when I ran openbox --reconfigure, the popup clearly mentioned the line number with "Double hyphen within comment". This is with Openbox 3.5.2.
Offline
alaskan-hippie wrote:flaneur wrote:Thanks for that. Now I know what tripped me up in the past
No problem. I'd never encountered that before today, so I'm glad I could help more than just myself!
I tried to find an "official" source for this but failed.
So I went back and purposely edited a "--" into a comment and when I ran openbox --reconfigure, the popup clearly mentioned the line number with "Double hyphen within comment". This is with Openbox 3.5.2.
As said earlier, first back up rc.xml and then remove the 'a bit of tiling' portions from the file. And replace it with the one suggested by alaskan-hippie. Read the previous replies carefully if you're not clear yet.
Offline
Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.
Server: acrobat