-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #179 from ff2400t/develop
Porting to GNOME 45
- Loading branch information
Showing
4 changed files
with
160 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,11 @@ | ||
{ | ||
"name": "WinTile", | ||
"description": "WinTile is a hotkey driven window tiling system for GNOME that imitates the standard Win-Arrow keys of Windows 10, allowing you to maximize, maximize to sides, or 1/4 sized to corner across a single or multiple monitors using just Super+Arrow.\n\nAs of v16, WinTile also supports:\n- 1-5 columns and 1-5 rows for standard or ultrawide monitors\n- Top/bottom half support\n- Mouse preview and snapping for placing windows\n- 'Maximize' mode, which adds/removes GNOME animations\n- 'Ultrawide-only' mode, to allow standard screens to have different cols/row than ultrawides\n- Portrait screens will automatically swap columns and rows\n- Add gaps around tiles to avoid the 'crowded elevator' feeling'\n- Ctrl+Super+Arrow to grow a tile in that direction if space is available\n- Ctrl+drag to drop a tile in a specific spot\n- Ctrl+Super+drag to draw a grid for the new tile", | ||
"description": "WinTile is a hotkey driven window tiling system for GNOME that imitates the standard Win-Arrow keys of Windows 10, allowing you to maximize, maximize to sides, or 1/4 sized to corner across a single or multiple monitors using just Super+Arrow.\n\nAs of v17, WinTile also supports:\n- 1-5 columns and 1-5 rows for standard or ultrawide monitors\n- Top/bottom half support\n- Mouse preview and snapping for placing windows\n- 'Maximize' mode, which adds/removes GNOME animations\n- 'Ultrawide-only' mode, to allow standard screens to have different cols/row than ultrawides\n- Portrait screens will automatically swap columns and rows\n- Add gaps around tiles to avoid the 'crowded elevator' feeling'\n- Ctrl+Super+Arrow to grow a tile in that direction if space is available\n- Ctrl+drag to drop a tile in a specific spot\n- Ctrl+Super+drag to draw a grid for the new tile", | ||
"uuid": "wintile@nowsci.com", | ||
"url": "https://github.com/fmstrat/wintile", | ||
"settings-schema":"org.gnome.shell.extensions.wintile", | ||
"shell-version": [ | ||
"42", | ||
"43", | ||
"44" | ||
"45" | ||
], | ||
"version": 17 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,81 +1,96 @@ | ||
'use strict'; | ||
|
||
const Gio = imports.gi.Gio; | ||
const Gtk = imports.gi.Gtk; | ||
/* BEGIN NON-G45 */ | ||
// const Gio = imports.gi.Gio; | ||
// const Gtk = imports.gi.Gtk; | ||
|
||
const ExtensionUtils = imports.misc.extensionUtils; | ||
const Me = ExtensionUtils.getCurrentExtension(); | ||
// const ExtensionUtils = imports.misc.extensionUtils; | ||
// const Me = ExtensionUtils.getCurrentExtension(); | ||
|
||
const Gettext = imports.gettext; | ||
const _ = Gettext.domain('wintile').gettext; | ||
// const Gettext = imports.gettext; | ||
// const _ = Gettext.domain('wintile').gettext; | ||
|
||
const gsettings = ExtensionUtils.getSettings(); | ||
// const gsettings = ExtensionUtils.getSettings(); | ||
|
||
/** | ||
* | ||
*/ | ||
function init() { | ||
// empty | ||
} | ||
// /** | ||
// * | ||
// */ | ||
// function init() { | ||
// // empty | ||
// } | ||
/* END NON-G45 */ | ||
|
||
/* BEGIN G45 */ | ||
import Gio from 'gi://Gio'; | ||
import Gtk from 'gi://Gtk'; | ||
import {ExtensionPreferences} from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js'; | ||
|
||
/** | ||
* | ||
* @param {object} window - Don't worry about this. Gnome handles it for you. | ||
*/ | ||
function fillPreferencesWindow(window) { | ||
let builder = Gtk.Builder.new(); | ||
builder.add_from_file(`${Me.path}/settings.ui`); | ||
let gridPage = builder.get_object('gridPage'); | ||
let behaviorPage = builder.get_object('behaviorPage'); | ||
window.add(gridPage); | ||
window.add(behaviorPage); | ||
export default class WinTileExtensionPreferences extends ExtensionPreferences { | ||
/* END G45 */ | ||
/** | ||
* | ||
* @param {object} window - Don't worry about this. Gnome handles it for you. | ||
*/ | ||
/* BEGIN G45 */ | ||
fillPreferencesWindow(window) { | ||
/* END G45 */ | ||
/* BEGIN NON-G45 */ | ||
// function fillPreferencesWindow(window) { | ||
/* END NON-G45 */ | ||
let builder = Gtk.Builder.new(); | ||
builder.add_from_file(`${this.path}/settings.ui`); | ||
let gridPage = builder.get_object('gridPage'); | ||
let behaviorPage = builder.get_object('behaviorPage'); | ||
window.add(gridPage); | ||
window.add(behaviorPage); | ||
|
||
// let gsettings; | ||
// gsettings = ExtensionUtils.getSettings(); | ||
const bindSettings = (key, input) => { | ||
key.value = gsettings.get_value(input).deep_unpack(); | ||
gsettings.bind(input, key, 'active', Gio.SettingsBindFlags.DEFAULT); | ||
}; | ||
/* BEGIN G45 */ | ||
let gsettings = this.getSettings(); | ||
/* END G45 */ | ||
const bindSettings = (key, input) => { | ||
key.value = gsettings.get_value(input).deep_unpack(); | ||
gsettings.bind(input, key, 'active', Gio.SettingsBindFlags.DEFAULT); | ||
}; | ||
|
||
const connectAndSetInt = (key, input) => { | ||
key.value = gsettings.get_value(input).deep_unpack(); | ||
key.connect('value-changed', entry => { | ||
gsettings.set_int(input, entry.value); | ||
}); | ||
}; | ||
const connectAndSetInt = (key, input) => { | ||
key.value = gsettings.get_value(input).deep_unpack(); | ||
key.connect('value-changed', entry => { | ||
gsettings.set_int(input, entry.value); | ||
}); | ||
}; | ||
|
||
let ultrawideOnlyInput = builder.get_object('ultrawideOnlyInput'); | ||
let nonUltrawideGroup = builder.get_object('nonUltrawideGroup'); | ||
let ultrawideOnlyInput = builder.get_object('ultrawideOnlyInput'); | ||
let nonUltrawideGroup = builder.get_object('nonUltrawideGroup'); | ||
|
||
const toggleUltrawide = () => { | ||
if (ultrawideOnlyInput.active) { | ||
// Show rows and columns options | ||
nonUltrawideGroup.show(); | ||
} else { | ||
// Hide rows and columns options | ||
nonUltrawideGroup.hide(); | ||
} | ||
}; | ||
const toggleUltrawide = () => { | ||
if (ultrawideOnlyInput.active) { | ||
// Show rows and columns options | ||
nonUltrawideGroup.show(); | ||
} else { | ||
// Hide rows and columns options | ||
nonUltrawideGroup.hide(); | ||
} | ||
}; | ||
|
||
// settings that aren't toggles need a connect | ||
connectAndSetInt(builder.get_object('colsSettingInt'), 'cols'); | ||
connectAndSetInt(builder.get_object('rowsSettingInt'), 'rows'); | ||
connectAndSetInt(builder.get_object('nonUltraColsSettingInt'), 'non-ultra-cols'); | ||
connectAndSetInt(builder.get_object('nonUltraRowsSettingInt'), 'non-ultra-rows'); | ||
connectAndSetInt(builder.get_object('previewDistanceSettingInt'), 'distance'); | ||
connectAndSetInt(builder.get_object('previewDelaySettingInt'), 'delay'); | ||
connectAndSetInt(builder.get_object('gapSettingInt'), 'gap'); | ||
// settings that aren't toggles need a connect | ||
connectAndSetInt(builder.get_object('colsSettingInt'), 'cols'); | ||
connectAndSetInt(builder.get_object('rowsSettingInt'), 'rows'); | ||
connectAndSetInt(builder.get_object('nonUltraColsSettingInt'), 'non-ultra-cols'); | ||
connectAndSetInt(builder.get_object('nonUltraRowsSettingInt'), 'non-ultra-rows'); | ||
connectAndSetInt(builder.get_object('previewDistanceSettingInt'), 'distance'); | ||
connectAndSetInt(builder.get_object('previewDelaySettingInt'), 'delay'); | ||
connectAndSetInt(builder.get_object('gapSettingInt'), 'gap'); | ||
|
||
// all other settings need a bind | ||
bindSettings(builder.get_object('ultrawideOnlyInput'), 'ultrawide-only'); | ||
bindSettings(builder.get_object('maximizeInput'), 'use-maximize'); | ||
bindSettings(builder.get_object('minimizeInput'), 'use-minimize'); | ||
bindSettings(builder.get_object('previewInput'), 'preview'); | ||
bindSettings(builder.get_object('doubleWidthInput'), 'double-width'); | ||
bindSettings(builder.get_object('debugInput'), 'debug'); | ||
ultrawideOnlyInput.connect('notify::active', toggleUltrawide); | ||
// all other settings need a bind | ||
bindSettings(builder.get_object('ultrawideOnlyInput'), 'ultrawide-only'); | ||
bindSettings(builder.get_object('maximizeInput'), 'use-maximize'); | ||
bindSettings(builder.get_object('minimizeInput'), 'use-minimize'); | ||
bindSettings(builder.get_object('previewInput'), 'preview'); | ||
bindSettings(builder.get_object('doubleWidthInput'), 'double-width'); | ||
bindSettings(builder.get_object('debugInput'), 'debug'); | ||
ultrawideOnlyInput.connect('notify::active', toggleUltrawide); | ||
|
||
// make sure that the non-ultrawide menu is hidden unless it's enabled | ||
toggleUltrawide(); | ||
// make sure that the non-ultrawide menu is hidden unless it's enabled | ||
toggleUltrawide(); | ||
} | ||
} |