View previous topic :: View next topic |
Author |
Message |
xiandrow n00b
Joined: 05 Aug 2008 Posts: 13 Location: Indiana, USA
|
Posted: Mon Aug 31, 2009 6:52 am Post subject: Howto: Nifty Fluxbox Hotkey Window Moving and Resizing |
|
|
If you're anything like me, your Fluxbox environment is heavily driven by terminals. Gentoo especially demands it, and I find myself continually having 6 or 7 terminals open at once. Frankly, this leads to a lot of clutter, and Its nice to be able to sort out all of my terminals without removing my hands from the keyboard.
The following hot keys allow you to use the Meta(win) button + a number on the numpad to automatically re-size the active window. The respective sizes are mapped visually to where they would be on the numpad. Here's how it works:
The corner numbers, 7, 9, 1, and 3, resize the window to a quarter of the screen and move it to its respective corner. The "Arrow" numbers, 8, 6, 2, and 4, resize the window to a half screen and move it to its respective corner. I've changed the function of the 5 key several times, but I've settled on having it maximize the active window.
Before you do any of this, you'll need wmctrl installed.
Here's the snippet of code that goes in your .fluxbox/keys:
Code: |
#meta+7 upper-left quadrant
mod4 none 79 :execCommand wmctrl -r :ACTIVE: -e 0,0,21,800,545
#meta+8 upper half
mod4 none 80 :execCommand wmctrl -r :ACTIVE: -e 0,0,21,1600,545
#meta+9 upper-right quadrant
mod4 none 81 :execCommand wmctrl -r :ACTIVE: -e 0,800,21,800,545
#meta+4 left half-vertical
mod4 none 83 :execCommand wmctrl -r :ACTIVE: -e 0,0,0,800,1158
#meta+5 fullscreen
mod4 none 84 :execCommand wmctrl -r :ACTIVE: -e 0,190,315,1245,600
#meta+6 right half-vertical
mod4 none 85 :execCommand wmctrl -r :ACTIVE: -e 0,800,0,800,1158
#meta+1 lower-left quadrant
mod4 none 87 :execCommand wmctrl -r :ACTIVE: -e 0,0,594,800,579
#meta+2 lower half
mod4 none 88 :execCommand wmctrl -r :ACTIVE: -e 0,0,594,1600,579
#meta+3 lower-right quadrant
mod4 none 89 :execCommand wmctrl -r :ACTIVE: -e 0,800,594,800,579
|
This particular set up is for a 1600x1200 resolution, and will need to be adjusted for different resolutions. I thought about writing a script that did this, maybe in the future.
I set the "Menu" key (the one next to the Right Control key) to open a new terminal, and a bash alias that takes 'e' for 'exit', and I can practically throw terminals around the screen, opening new ones and removing them as I need them.
~/.fluxbox/keys
Code: |
Mod1 Menu :execCommand aterm
|
~/.bashrc
Hope someone finds this useful, or if nothing else, inspiring! _________________ AMD am386DX-40 (40Mhz) , ECC-SIMM (Single Inline) 4MB, Seagate ST3120A 107MB IDE, Hercules ISA Graphite 1MB 16-bit VGA AGX014 Chipset, Soundblaster 16, Toshiba XM-4101B 2X SCSI CD-ROM |
|
Back to top |
|
|
RedSquirrel Guru
Joined: 22 Apr 2008 Posts: 336
|
Posted: Mon Aug 31, 2009 6:50 pm Post subject: Re: Howto: Nifty Fluxbox Hotkey Window Moving and Resizing |
|
|
xiandrow wrote: | Before you do any of this, you'll need wmctrl installed. |
Have you tried using the built-in functionality that Fluxbox offers, namely, MoveTo, ResizeTo, and so on?
http://fluxbox-wiki.org/index.php?title=Keyboard_shortcuts
Since you enjoy this sort of tiling layout feature, have you looked into tiling window managers? (dwm, ratpoison, etc.)
xiandrow wrote: | ~/.bashrc
|
Control-d works. |
|
Back to top |
|
|
i92guboj Bodhisattva
Joined: 30 Nov 2004 Posts: 10315 Location: Córdoba (Spain)
|
Posted: Mon Aug 31, 2009 9:09 pm Post subject: |
|
|
Moved from Desktop Environments to Documentation, Tips & Tricks.
I think it fits better here. |
|
Back to top |
|
|
xiandrow n00b
Joined: 05 Aug 2008 Posts: 13 Location: Indiana, USA
|
Posted: Wed Sep 02, 2009 7:06 pm Post subject: |
|
|
Thanks i92guboj, I wasn't paying attention when I posted it, I'll remember that next time.
RedSquirrel wrote:
Quote: |
Have you tried using the built-in functionality that Fluxbox offers, namely, MoveTo, ResizeTo, and so on?
http://fluxbox-wiki.org/index.php?title=Keyboard_shortcuts
Since you enjoy this sort of tiling layout feature, have you looked into tiling window managers? (dwm, ratpoison, etc.)
|
Thanks for pointing that out, there's some really potent stuff in there. I started using Fluxbox years ago, and have since returned to it (Compiz is just too bloated). Its nice to see that Fluxbox has been growing. I've been told that ratpoison would be up my alley, I might have to check it out. _________________ AMD am386DX-40 (40Mhz) , ECC-SIMM (Single Inline) 4MB, Seagate ST3120A 107MB IDE, Hercules ISA Graphite 1MB 16-bit VGA AGX014 Chipset, Soundblaster 16, Toshiba XM-4101B 2X SCSI CD-ROM |
|
Back to top |
|
|
freitass n00b
Joined: 04 May 2011 Posts: 5
|
Posted: Wed May 11, 2011 5:57 pm Post subject: Re: Howto: Nifty Fluxbox Hotkey Window Moving and Resizing |
|
|
RedSquirrel wrote: | Have you tried using the built-in functionality that Fluxbox offers, namely, MoveTo, ResizeTo, and so on? |
I was searching for the codes of the keys on the numpad to implement the same feature xiandrow posted here. It turns out that those keys can be also referred to as 'KP_i', where 'i' is the correspondent number of the key. Also, I'm using the built-in functionalities of Fluxbox, as questioned by RedSquirrel. The current state of my implementation is shown below:
Code: | Control Mod1 KP_1 :MacroCmd {ResizeTo 940 575} {MoveTo 10 10 LowerLeft}
Control Mod1 KP_2 :MacroCmd {ResizeTo 1890 575} {MoveTo 10 10 LowerLeft}
Control Mod1 KP_3 :MacroCmd {ResizeTo 940 575} {MoveTo 10 10 LowerRight}
Control Mod1 KP_4 :MacroCmd {ResizeTo 940 1160} {MoveTo 10 10 UpperLeft}
Control Mod1 KP_5 :Maximize
Control Mod1 KP_6 :MacroCmd {ResizeTo 940 1160} {MoveTo 10 10 UpperRight}
Control Mod1 KP_7 :MacroCmd {ResizeTo 940 575} {MoveTo 10 10 UpperLeft}
Control Mod1 KP_8 :MacroCmd {ResizeTo 1890 575} {MoveTo 10 10 UpperLeft}
Control Mod1 KP_9 :MacroCmd {ResizeTo 940 575} {MoveTo 10 10 UpperRight} |
As you may have noticed, the key strokes to resize and move the windows are Ctrl+Alt+Numpad, and the ResizeTo arguments were calculated for a screen resolution of 1920x1200.
Known issues:
- The current implementation only works for one screen resolution (I don't know if there is some kind of variable that holds the width and height of the screen);
- If you start resizing a mazimized window with one of the commands above, when you try to maximize it again you have to type Ctrl+Alt+5 twice, as at the first time the window behave as it was still maximized; |
|
Back to top |
|
|
cld71 Tux's lil' helper
Joined: 12 Jul 2005 Posts: 128
|
Posted: Sat Sep 01, 2012 4:41 am Post subject: Fluxbox 1.3.2 |
|
|
I know this is an old post, but with the new Fluxbox 1.3.2 there are new Fluxbox commands that will arrange the window automatically.
arrangewindowshorizontal will arrange the windows horizontally.
arrangewindowsvertical will arrange the windows vertically.
Add this to your .fluxbox/keys file.
Control Shift H :arrangewindowshorizontal
Control Shift V :arrangewindowsvertical |
|
Back to top |
|
|
lyallp Veteran
Joined: 15 Jul 2004 Posts: 1557 Location: Adelaide/Australia
|
Posted: Thu Sep 13, 2012 11:20 am Post subject: |
|
|
How about this extract from my keys file
Built in Fluxbox capabilities
Code: |
Shift KP_Left :MoveLeft 16
Shift KP_Right :MoveRight 16
Shift KP_Up :MoveUp 16
Shift KP_Down :MoveDown 16
Shift KP_Next :Lower
Shift KP_Prior :Raise
Mod1 KP_Left :ResizeHorizontal -8
Mod1 KP_Right :ResizeHorizontal +8
Mod1 KP_Up :ResizeVertical -8
Mod1 KP_Down :ResizeVertical +8
Mod1 KP_Add :Maximize
Mod1 KP_Subtract :ShadeWindow
Mod4 KP_Begin :ArrangeWindows
! Keypad
! +-----------+-----------+-----------+-----------+
! | Num Lock | / | * | - | Key name
! | | | | Shrink * | Shift
! | | | |Toggl Shade| Alt
! +-----------+-----------+-----------+-----------+
! | 7 | 8 | 9 | + | Key name
! | | Mv Up | | Expand * | Shift
! | | Shrink Up | Push Back |Toggle Full| Alt
! +-----------+-----------+-----------+ |
! | 4 | 5 | 6 | | Key name
! | Mv Left | | Mv Right | | Shift
! | Smaller | | Bigger | | Alt
! +-----------+-----------+-----------+-----------+
! | 1 | 2 | 3 | Enter | Key name
! | | Mv Down | | | Shift
! | |Shrink Down| Pull Front| | Alt
! +-----------+-----------+-----------+ |
! | 0 | . | | Key name
! | | | | Shift
! | | | | Alt
! +-----------------------+-----------+-----------+
!
! * - xterm only |
_________________ ...Lyall |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|