Skip to content

Commit

Permalink
Update resize api operations
Browse files Browse the repository at this point in the history
  • Loading branch information
jmmaranan committed May 1, 2023
1 parent d652dfb commit 99910fc
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 30 deletions.
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ Forge is a GNOME Shell extension that provides tiling/window management.
- Download/clone the source and `make install`, restart gnome-shell after or `make dev`.
- AUR Package: https://aur.archlinux.org/packages/gnome-shell-extension-forge - thanks to [@Radeox](https://github.com/Radeox)

## ! Major Changes !
- Implemented quarter tiling. See https://github.com/jmmaranan/forge/issues/166. Toggle available on preferences
- Implemented floating windows are default always on top. Toggle available on preferences

## Development
- The `main` branch contains gnome-4x code.
- The `legacy` and `gnome-3-36` are the same and is now the source for gnome-3x.
Expand All @@ -35,6 +31,7 @@ Forge is a GNOME Shell extension that provides tiling/window management.
- Swap current window with the last active window
- Auto Split or Quarter Tiling
- Show/hide tab decoration via keybinding https://github.com/jmmaranan/forge/issues/180
- Window resize using keyboard shortcuts

![image](https://user-images.githubusercontent.com/348125/146386593-8f53ea8b-2cf3-4d44-a613-bbcaf89f9d4a.png)

Expand All @@ -43,7 +40,14 @@ Forge is a GNOME Shell extension that provides tiling/window management.
### New
| Action | Shortcut |
| --- | --- |
| Show/hide tab decoration | `<Ctrl> + <Alt> + y` |
| Increase active window size left | `<Ctrl> + <Super> + y` |
| Decrease active window size left | `<Ctrl> + <Shift> + <Super> + o` |
| Increase active window size bottom | `<Ctrl> + <Super> + u` |
| Decrease active window size bottom | `<Ctrl> + <Shift> + <Super> + i` |
| Increase active window size top | `<Ctrl> + <Super> + i` |
| Decrease active window size top | `<Ctrl> + <Shift> + <Super> + u` |
| Increase active window size right | `<Ctrl> + <Super> + o` |
| Decrease active window size right | `<Ctrl> + <Shift> + <Super> + y` |

### Current

Expand Down Expand Up @@ -73,6 +77,7 @@ Forge is a GNOME Shell extension that provides tiling/window management.
| Toggle active workspace tiling | `<Shift> + <Super> + w` |
| Toggle stacked layout | `<Shift> + <Super> + s` |
| Toggle tabbed layout | `<Shift> + <Super> + t` |
| Show/hide tab decoration | `<Ctrl> + <Alt> + y` |
| Activate tile drag-drop | `Start dragging - Mod key configuration in prefs` |
| Snap active window left two thirds | `<Ctrl> + <Alt> + e` |
| Snap active window right two thirds | `<Ctrl> + <Alt> + t` |
Expand Down
48 changes: 40 additions & 8 deletions keybindings.js
Original file line number Diff line number Diff line change
Expand Up @@ -438,27 +438,59 @@ var Keybindings = GObject.registerClass(
};
this.extWm.command(action);
},
"window-resize-vertical-increase": () => {
"window-resize-top-increase": () => {
let action = {
name: "WindowResizeVerticalIncrease",
name: "WindowResizeTop",
amount: this.settings.get_uint("resize-amount"),
};
this.extWm.command(action);
},
"window-resize-vertical-decrease": () => {
"window-resize-top-decrease": () => {
let action = {
name: "WindowResizeVerticalDecrease",
name: "WindowResizeTop",
amount: -1 * this.settings.get_uint("resize-amount"),
};
this.extWm.command(action);
},
"window-resize-horizontal-increase": () => {
"window-resize-bottom-increase": () => {
let action = {
name: "WindowResizeHorizontalIncrease",
name: "WindowResizeBottom",
amount: this.settings.get_uint("resize-amount"),
};
this.extWm.command(action);
},
"window-resize-horizontal-decrease": () => {
"window-resize-bottom-decrease": () => {
let action = {
name: "WindowResizeHorizontalDecrease",
name: "WindowResizeBottom",
amount: -1 * this.settings.get_uint("resize-amount"),
};
this.extWm.command(action);
},
"window-resize-left-increase": () => {
let action = {
name: "WindowResizeLeft",
amount: this.settings.get_uint("resize-amount"),
};
this.extWm.command(action);
},
"window-resize-left-decrease": () => {
let action = {
name: "WindowResizeLeft",
amount: -1 * this.settings.get_uint("resize-amount"),
};
this.extWm.command(action);
},
"window-resize-right-increase": () => {
let action = {
name: "WindowResizeRight",
amount: this.settings.get_uint("resize-amount"),
};
this.extWm.command(action);
},
"window-resize-right-decrease": () => {
let action = {
name: "WindowResizeRight",
amount: -1 * this.settings.get_uint("resize-amount"),
};
this.extWm.command(action);
},
Expand Down
38 changes: 31 additions & 7 deletions schemas/org.gnome.shell.extensions.forge.gschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@
</summary>
</key>

<key type="u" name="resize-amount">
<default>15</default>
<summary>
The size of the gap between windows in the workarea
</summary>
</key>

<key type="u" name="window-gap-size-increment">
<default>1</default>
<summary>
Expand Down Expand Up @@ -127,6 +134,7 @@
<default>true</default>
<summary>Whether to show the tab decoration or not</summary>
</key>

</schema>
<schema id="org.gnome.shell.extensions.forge.keybindings" path="/org/gnome/shell/extensions/forge/keybindings/">
<!-- Keybinding Settings -->
Expand Down Expand Up @@ -293,20 +301,36 @@
<default><![CDATA[['<Ctrl><Alt>c']]]></default>
</key>

<key type="as" name="window-resize-horizontal-increase">
<default><![CDATA[['<Ctrl><Super>o']]]></default>
<key type="as" name="window-resize-left-increase">
<default><![CDATA[['<Ctrl><Super>y']]]></default>
</key>

<key type="as" name="window-resize-horizontal-decrease">
<default><![CDATA[['<Ctrl><Super>y']]]></default>
<key type="as" name="window-resize-left-decrease">
<default><![CDATA[['<Ctrl><Shift><Super>o']]]></default>
</key>

<key type="as" name="window-resize-bottom-increase">
<default><![CDATA[['<Ctrl><Super>u']]]></default>
</key>

<key type="as" name="window-resize-vertical-increase">
<key type="as" name="window-resize-bottom-decrease">
<default><![CDATA[['<Ctrl><Shift><Super>i']]]></default>
</key>

<key type="as" name="window-resize-top-increase">
<default><![CDATA[['<Ctrl><Super>i']]]></default>
</key>

<key type="as" name="window-resize-vertical-decrease">
<default><![CDATA[['<Ctrl><Super>u']]]></default>
<key type="as" name="window-resize-top-decrease">
<default><![CDATA[['<Ctrl><Shift><Super>u']]]></default>
</key>

<key type="as" name="window-resize-right-increase">
<default><![CDATA[['<Ctrl><Super>o']]]></default>
</key>

<key type="as" name="window-resize-right-decrease">
<default><![CDATA[['<Ctrl><Shift><Super>y']]]></default>
</key>
</schema>
</schemalist>
19 changes: 9 additions & 10 deletions window.js
Original file line number Diff line number Diff line change
Expand Up @@ -739,31 +739,30 @@ var WindowManager = GObject.registerClass(
this.renderTree("showtab-decoration-enabled");
break;

case "WindowResizeHorizontalIncrease":
this.resize(Meta.GrabOp.KEYBOARD_RESIZING_E);
case "WindowResizeRight":
this.resize(Meta.GrabOp.KEYBOARD_RESIZING_E, action.amount);
break;

case "WindowResizeHorizontalDecrease":
this.resize(Meta.GrabOp.KEYBOARD_RESIZING_W);
case "WindowResizeLeft":
this.resize(Meta.GrabOp.KEYBOARD_RESIZING_W, action.amount);
break;

case "WindowResizeVerticalIncrease":
this.resize(Meta.GrabOp.KEYBOARD_RESIZING_N);
case "WindowResizeTop":
this.resize(Meta.GrabOp.KEYBOARD_RESIZING_N, action.amount);
break;

case "WindowResizeVerticalDecrease":
this.resize(Meta.GrabOp.KEYBOARD_RESIZING_S);
case "WindowResizeBottom":
this.resize(Meta.GrabOp.KEYBOARD_RESIZING_S, action.amount);
break;

default:
break;
}
}

resize(grabOp) {
resize(grabOp, amount) {
let metaWindow = this.focusMetaWindow;
let display = global.display;
let amount = 15;

this._handleGrabOpBegin(display, metaWindow, grabOp);

Expand Down

0 comments on commit 99910fc

Please sign in to comment.