Difference between revisions of "Custom Window Snap"

From TheBeard Science Project Wiki
Jump to: navigation, search
Line 49: Line 49:
 
</source>
 
</source>
  
If your desktop environment supports custom hotkeys, you can simply map any hotkey you want to execute this script:
+
If your desktop environment supports custom hotkeys, you can simply map any hotkey you want to execute this script with the appropriate parameter. For example:
* Snap Left: <code>gosnap -l</code>
+
* Snap Left: <code>gosnap -l</code> <code>Super+Left</code>
* Snap Right: <code>gosnap -r</code>
+
* Snap Right: <code>gosnap -r</code> <code>Super+Right</code>
* Snap Maximize: <code>gosnap -m</code>
+
* Snap Maximize: <code>gosnap -m</code> <code>Super+Up</code>
* Snap Minimize: <code>gosnap -l</code>
+
* Snap Minimize: <code>gosnap -l</code> <code>Super+Down</code>
  
 
Note: To "snap dynamically" means to go to an intermediate position depending on the window's current position. For example, if I minimize the window using <code>gosnap -n</code>, but the window was previously maximized, I'd rather the window pop into the middle of the screen on the first invocation, and then when I minimize again I want the window to collapse to the taskbar. To just immediately minimize the window, use <code>gosnap -N</code> instead.
 
Note: To "snap dynamically" means to go to an intermediate position depending on the window's current position. For example, if I minimize the window using <code>gosnap -n</code>, but the window was previously maximized, I'd rather the window pop into the middle of the screen on the first invocation, and then when I minimize again I want the window to collapse to the taskbar. To just immediately minimize the window, use <code>gosnap -N</code> instead.

Revision as of 19:17, 31 July 2020

Many desktop environments for Linux have had window snapping (a.k.a window tiling or edge snapping) for a long time. It is a feature that I use very heavily, especially with hotkeys. I have been very dissatisfied with the way Linux desktop environments have handled this. They almost work the way I want, but not quite. I decided to take control of this.

Gosnap stands for "Good Old Snap" and replaces the window snapping/tiling feature on just about any Linux distro that uses the X Window System.

Download:

Filename Description Size Modified Link

gosnap

The Gosnap bash script. 6.4K 7/31/2020

Download

Installing:

wget https://beardedmaker.com/wiki/files/gosnap
chmod a+x gosnap
sudo cp gosnap /usr/bin

Usage:

Usage: gosnap [-L | -l | -R | -r | -M | -m | -N | -n | -d | -i]
  -L    snap left
  -l    snap left dynamically
  -R    snap right
  -r    snap right dynamically
  -M    maximize window
  -m    toggle maximize window
  -N    minimize window
  -n    minimize window dynamically
  -d    resize to default geometry (current default: 0,10,60,826,556
  -i    print window information

If your desktop environment supports custom hotkeys, you can simply map any hotkey you want to execute this script with the appropriate parameter. For example:

  • Snap Left: gosnap -l Super+Left
  • Snap Right: gosnap -r Super+Right
  • Snap Maximize: gosnap -m Super+Up
  • Snap Minimize: gosnap -l Super+Down

Note: To "snap dynamically" means to go to an intermediate position depending on the window's current position. For example, if I minimize the window using gosnap -n, but the window was previously maximized, I'd rather the window pop into the middle of the screen on the first invocation, and then when I minimize again I want the window to collapse to the taskbar. To just immediately minimize the window, use gosnap -N instead.