Skip to content
/ wintrix Public

Wintrix is a GNOME Shell extension that provides methods for centering, snapping and moving windows.

License

Notifications You must be signed in to change notification settings

yz778/wintrix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Wintrix

Wintrix is a GNOME Shell extension that provides methods for centering, snapping and moving windows.

Manual Installation

  1. Clone this repository to your local machine.
  2. Copy the directory wintrix@yz778.github.com (or create a symbolic link) to ~/.local/share/gnome-shell/extensions/.
  3. Enable the extension in GNOME Tweaks or by running the following command in your terminal:
    gnome-extensions enable wintrix@yz778.github.com

Usage

Wintrix provides a DBus interface to control window behavior, enabling automation via command-line tools like gdbus.

Centering a Window

To center the focused window, you can use the Center method. This method takes a scale parameter that determines the new size of the window as a factor of its current size.

Example:

# center and increase window size 20%
gdbus call --session --dest org.gnome.Shell --object-path /org/gnome/Shell/Extensions/Wintrix --method org.gnome.Shell.Extensions.Wintrix.Center 1.2

# center window
gdbus call --session --dest org.gnome.Shell --object-path /org/gnome/Shell/Extensions/Wintrix --method org.gnome.Shell.Extensions.Wintrix.Center 1.0

# center and decrease window size 20%
gdbus call --session --dest org.gnome.Shell --object-path /org/gnome/Shell/Extensions/Wintrix --method org.gnome.Shell.Extensions.Wintrix.Center 0.8

Snapping a Window

The Snap method allows you to snap the focused window to a specific region of the screen. It takes four parameters, x0_frac, x1_frac, y0_frac, and y1_frac, which are doubles between 0.0 and 1.0, representing the proportions of the screen.

Example: To snap a window to the left half of the screen:

# snap window to top 50% of screen
gdbus call --session --dest org.gnome.Shell --object-path /org/gnome/Shell/Extensions/Wintrix --method org.gnome.Shell.Extensions.Wintrix.Snap 0.0 0.5 0.0 0.5

# snap window to bottom 50% of screen
gdbus call --session --dest org.gnome.Shell --object-path /org/gnome/Shell/Extensions/Wintrix --method org.gnome.Shell.Extensions.Wintrix.Snap 0.0 0.5 0.5 1.0

# "zen mode" snap window to middle 80% of screen
gdbus call --session --dest org.gnome.Shell --object-path /org/gnome/Shell/Extensions/Wintrix --method org.gnome.Shell.Extensions.Wintrix.Snap 0.2 0.8 0.0 1.0

Moving a Window to Another Monitor

The MoveMon method moves the focused window to the next or previous monitor. It takes one integer parameter, direction, which can be 1 (for the next monitor) or -1 (for the previous monitor).

Example: To move the window to the next monitor:

# proportional move to next monitor
gdbus call --session --dest org.gnome.Shell --object-path /org/gnome/Shell/Extensions/Wintrix --method org.gnome.Shell.Extensions.Wintrix.MoveMon 1

# proportional move to prev monitor (note the --)
gdbus call --session --dest org.gnome.Shell --object-path /org/gnome/Shell/Extensions/Wintrix --method org.gnome.Shell.Extensions.Wintrix.MoveMon -- -1

About

Wintrix is a GNOME Shell extension that provides methods for centering, snapping and moving windows.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published