mirror of
https://github.com/FranP-code/wintile.git
synced 2025-10-13 00:33:46 +00:00
Merge branch 'develop' of github.com:Fmstrat/wintile into config-use-minimize
This commit is contained in:
@@ -12,3 +12,8 @@ WinTile can be found on the GNOME Extension site:
|
|||||||
https://extensions.gnome.org/extension/1723/wintile-windows-10-window-tiling-for-gnome/
|
https://extensions.gnome.org/extension/1723/wintile-windows-10-window-tiling-for-gnome/
|
||||||
|
|
||||||
<img src='demo.gif'>
|
<img src='demo.gif'>
|
||||||
|
|
||||||
|
# Configuration
|
||||||
|
1. Visit https://extensions.gnome.org/local/
|
||||||
|
1. Click on the "Configure this extension" button.
|
||||||
|
1. Alternatively, open the `Extension` settings in [Gnome Tweaks](https://gitlab.gnome.org/GNOME/gnome-tweaks), locate `Wintile` and click on the cogwheel button to bring up the configuration dialog.
|
||||||
|
|||||||
19
extension.js
19
extension.js
@@ -90,6 +90,17 @@ function requestMinimize(app) {
|
|||||||
} else {
|
} else {
|
||||||
_log("Not minimizing due to config");
|
_log("Not minimizing due to config");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Move window to specified location and size.
|
||||||
|
// On paper, the move_resize_frame should not need the preceding move_frame,
|
||||||
|
// but the additional move_frame is known to fix errors with gnome-terminal
|
||||||
|
// and [gnome-]terminator.
|
||||||
|
// A similar fix is used in the gTile extension:
|
||||||
|
// See https://github.com/gTile/gTile/commit/fc68797015e13143f74606fcbb9d48859f55dca9 by jshack88.
|
||||||
|
function moveAppCoordinates(app, x, y, w, h) {
|
||||||
|
_log("Moving window to ("+x+","+y+"), size ("+w+","+h+")" );
|
||||||
|
app.move_frame(true, x, y);
|
||||||
|
app.move_resize_frame(true, x, y, w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
function moveApp(app, loc) {
|
function moveApp(app, loc) {
|
||||||
@@ -112,12 +123,12 @@ function moveApp(app, loc) {
|
|||||||
|
|
||||||
if (!config.useMaximize) {
|
if (!config.useMaximize) {
|
||||||
unMaximizeIfMaximized(app);
|
unMaximizeIfMaximized(app);
|
||||||
app.move_resize_frame(true, x, y, w, h);
|
moveAppCoordinates(app, x, y, w, h);
|
||||||
} else {
|
} else {
|
||||||
if (loc.height < 2 || loc.width < config.cols) {
|
if (loc.height < 2 || loc.width < config.cols) {
|
||||||
unMaximizeIfMaximized(app);
|
unMaximizeIfMaximized(app);
|
||||||
}
|
}
|
||||||
app.move_resize_frame(true, x, y, w, h);
|
moveAppCoordinates(app, x, y, w, h);
|
||||||
if (loc.height == 2 && loc.width == config.cols) {
|
if (loc.height == 2 && loc.width == config.cols) {
|
||||||
// Maximize
|
// Maximize
|
||||||
_log('maximize')
|
_log('maximize')
|
||||||
@@ -197,7 +208,7 @@ function restoreApp(app, move=true) {
|
|||||||
if (app.wintile.origFrame.y+app.wintile.origFrame.height > space.y+space.height) {
|
if (app.wintile.origFrame.y+app.wintile.origFrame.height > space.y+space.height) {
|
||||||
app.wintile.origFrame.y = space.y + space.height - app.wintile.origFrame.height - 100;
|
app.wintile.origFrame.y = space.y + space.height - app.wintile.origFrame.height - 100;
|
||||||
}
|
}
|
||||||
app.move_resize_frame(true, app.wintile.origFrame.x, app.wintile.origFrame.y, app.wintile.origFrame.width, app.wintile.origFrame.height);
|
moveAppCoordinates(app, app.wintile.origFrame.x, app.wintile.origFrame.y, app.wintile.origFrame.width, app.wintile.origFrame.height);
|
||||||
} else {
|
} else {
|
||||||
// BUG: when clicking the maximize button, then dragging the window off, it moves to below the mouse cursor
|
// BUG: when clicking the maximize button, then dragging the window off, it moves to below the mouse cursor
|
||||||
let [x, y, mask] = global.get_pointer();
|
let [x, y, mask] = global.get_pointer();
|
||||||
@@ -208,7 +219,7 @@ function restoreApp(app, move=true) {
|
|||||||
window = app.wintile.origFrame;
|
window = app.wintile.origFrame;
|
||||||
_log(`A) origFrame - x:${window.x} y:${window.y} w:${window.width} h:${window.height}`);
|
_log(`A) origFrame - x:${window.x} y:${window.y} w:${window.width} h:${window.height}`);
|
||||||
}
|
}
|
||||||
app.move_resize_frame(true, Math.floor(x-app.wintile.origFrame.width/2), y-10, app.wintile.origFrame.width, app.wintile.origFrame.height);
|
moveAppCoordinates(app, Math.floor(x-app.wintile.origFrame.width/2), y-10, app.wintile.origFrame.width, app.wintile.origFrame.height);
|
||||||
if (config.debug) {
|
if (config.debug) {
|
||||||
let window = app.get_frame_rect()
|
let window = app.get_frame_rect()
|
||||||
_log(`B) mouse - x:${x} y:${y}`);
|
_log(`B) mouse - x:${x} y:${y}`);
|
||||||
|
|||||||
2
prefs.js
2
prefs.js
@@ -167,7 +167,7 @@ function buildPrefsWidget() {
|
|||||||
|
|
||||||
// Delay
|
// Delay
|
||||||
let previewDelayLabel = new Gtk.Label({
|
let previewDelayLabel = new Gtk.Label({
|
||||||
label: _(" Delay in ms before preview dislpays"),
|
label: _(" Delay in ms before preview displays"),
|
||||||
visible: true,
|
visible: true,
|
||||||
hexpand: true,
|
hexpand: true,
|
||||||
halign: Gtk.Align.START
|
halign: Gtk.Align.START
|
||||||
|
|||||||
Reference in New Issue
Block a user