Skip to content

lambda1103/gSnap

 
 

Repository files navigation

gSnap

Gnome-shell extension that allows you to move windows into specific regions similiar to FancyZones on windows.

This extension was built from gTile, stripped it down and changed it to work like FancyZones. Thanks to all the folks that worked on gTile as it made my process of developing this much easier.

This extensions is developed in freetime. Developer got to eat, if you like it, consider buying me a coffee :)

"Buy Me A Coffee"

Installation

Install From The Gnome Extensions Page

Installation from source

Follow the Development docs.

Debugging

If you encounter buggy behavior, it may help to view the log messages gSnap writes. These may be viewed with the following shell command:

journalctl --follow /usr/bin/gnome-shell | grep "gSnap"

Configuration

For configuration, please use the built-in preferences dialog (Gnome Tweak Tool -> Extensions -> gSnap -> Preferences).

  • Keyboard shortcuts:
    • Currently you can switch between preconfigured layouts
    • You can set the margins between the windows as well

Edit Layouts:

To edit a layout follow the instructions below

  • Click "Edit Layout" (will edit the currently applied layout).
  • Left-Click to split the region
  • Middle-Click to split with opposite orientation
  • Right-Click to remove

When done click "Stop Editing"

Layouts are stored in the default config dir (usually ~/.config/gSnap). This directory should be user-writable, to save the layouts changes.

gedit ~/.config/gSnap/layouts.json 

Previous versions of the extensions used to store the layouts file in the extension directory (~/.local/share/gnome-shell/extensions/gSnap@micahosborne/). This has been deprecated to allow for the extension to be installed as a system package. When upgrading, the extension will copy the old file and save it in the new path.

After editing layouts disable and re-enable the plugin.

Layouts are defined via json here is a 50% 50% split layout

  {
    "type": 0, // 0 for horizontal, 1 for vertical
    "length": 100, // Percentage of screen
    "items": [
      {
        "length": 50 // Percentage of parent
      },
      {
        "length": 50
      }
    ]
  }

Here is a 3 split configuration, with the column in the middle split into 3 zones

  {
    "length": 100, // 100% of screen
    "items": [
       // Column 1
      {
        "length": 42 // 42% of parent
      },
       // Column 2
      {
        "type": 1, // Layout items in vertical
        "length": 16, // 16% of parent
        "items": [
          {
            "length": 33
          },
          {
            "length": 34
          },
          {
            "length": 33
          }
        ]
      },
       // Column 3
      {
        "length": 42 // 42% of parent
      }
    ]
  }

Usage with interface

  1. Make sure the window you want to resize has focus
  2. Click and drag a window to see the layouts and snap a window
  3. Use the (configurable) shortcuts to switch between layouts. Ctrl+Super+KP[NUM]

Note: Right now the layouts can only be edited from source. When I have more time i'll make a configuration file, or even and editor for this. Feel free to contribute

Default shortcuts for Super+Alt+[KP_1..KP_9]

Shortcut Description
Super+Alt+KP_1 Preset 1
Super+Alt+KP_2 Preset 2
Super+Alt+KP_3 Preset 3
Super+Alt+KP_4 Preset 4
Super+Alt+KP_5 Preset 5
Super+Alt+KP_6 Preset 6
Super+Alt+KP_7 Preset 7
Super+Alt+KP_8 Preset 8
Super+Alt+KP_9 Preset 9

Source code

This extension is developed at GitHub.

gTile was the basis for which I started at GitHub.

gSnap is licensed under the GPL v2+

For debugging, enable debug in preferences, and in terminal run journalctl /usr/bin/gnome-shell -f

Enjoy!

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 95.5%
  • JavaScript 3.2%
  • Other 1.3%