diff --git a/modern49.js b/gnome45-48.js similarity index 98% rename from modern49.js rename to gnome45-48.js index 00c162d..2eecbff 100644 --- a/modern49.js +++ b/gnome45-48.js @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////// -// Simple‑Tiling – MODERN (GNOME Shell 45+) // +// Simple‑Tiling – MODERN (GNOME Shell 45-48) // // © 2025 domoel – MIT // ///////////////////////////////////////////////////////////// @@ -347,8 +347,8 @@ class Tiler { if (index > -1) this._centerTimeoutIds.splice(index, 1); if (!win || !win.get_display()) return GLib.SOURCE_REMOVE; - if (win.is_maximized()) - win.unmaximize(); + if (win.get_maximized()) + win.unmaximize(Meta.MaximizeFlags.BOTH); const monitorIndex = win.get_monitor(); const workspace = this._workspaceManager.get_active_workspace(); @@ -558,7 +558,7 @@ class Tiler { height: workArea.height - 2 * this._outerGapVertical, }; windowsToTile.forEach((win) => { - if (win.is_maximized()) win.unmaximize(); + if (win.get_maximized()) win.unmaximize(Meta.MaximizeFlags.BOTH); }); if (windowsToTile.length === 1) { windowsToTile[0].move_resize_frame( diff --git a/modern.js b/modern.js index 7302cbb..03c319c 100644 --- a/modern.js +++ b/modern.js @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////// -// Simple‑Tiling – MODERN (GNOME Shell 45+) // +// Simple‑Tiling – MODERN (GNOME Shell 49+) // // © 2025 domoel – MIT // ///////////////////////////////////////////////////////////// @@ -347,8 +347,8 @@ class Tiler { if (index > -1) this._centerTimeoutIds.splice(index, 1); if (!win || !win.get_display()) return GLib.SOURCE_REMOVE; - if (win.get_maximized()) - win.unmaximize(Meta.MaximizeFlags.BOTH); + if (win.is_maximized()) + win.unmaximize(); const monitorIndex = win.get_monitor(); const workspace = this._workspaceManager.get_active_workspace(); @@ -558,7 +558,7 @@ class Tiler { height: workArea.height - 2 * this._outerGapVertical, }; windowsToTile.forEach((win) => { - if (win.get_maximized()) win.unmaximize(Meta.MaximizeFlags.BOTH); + if (win.is_maximized()) win.unmaximize(); }); if (windowsToTile.length === 1) { windowsToTile[0].move_resize_frame( diff --git a/prefs_gnome45-48.js b/prefs_gnome45-48.js new file mode 100644 index 0000000..829b70d --- /dev/null +++ b/prefs_gnome45-48.js @@ -0,0 +1,91 @@ +/////////////////////////////////////////////////////////////// +// Simple-Tiling – MODERN MENU (GNOME Shell 45+) // +// © 2025 domoel – MIT // +/////////////////////////////////////////////////////////////// + +// ── GLOBAL IMPORTS ──────────────────────────────────────── +import Adw from 'gi://Adw'; +import Gio from 'gi://Gio'; +import Gtk from 'gi://Gtk'; +import GLib from 'gi://GLib'; +import { ExtensionPreferences, gettext as _ } from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js'; + +export default class SimpleTilingPrefs extends ExtensionPreferences { + fillPreferencesWindow(window) { + const settings = this.getSettings(); + const page = new Adw.PreferencesPage(); + window.add(page); + + // ── WINDOW GAPS ──────────────────────────────────────────── + const groupGaps = new Adw.PreferencesGroup({ + title: 'Window Gaps', + description: 'Adjust spacing between windows and screen edges.' + }); + page.add(groupGaps); + + const rowInnerGap = new Adw.SpinRow({ + title: 'Inner Gap', + subtitle: 'Space between tiled windows (pixels)', + adjustment: new Gtk.Adjustment({ lower: 0, upper: 100, step_increment: 1 }), + }); + groupGaps.add(rowInnerGap); + settings.bind('inner-gap', rowInnerGap, 'value', Gio.SettingsBindFlags.DEFAULT); + + const rowOuterH = new Adw.SpinRow({ + title: 'Outer Gap (horizontal)', + subtitle: 'Left / right screen edges (pixels)', + adjustment: new Gtk.Adjustment({ lower: 0, upper: 100, step_increment: 1 }), + }); + groupGaps.add(rowOuterH); + settings.bind('outer-gap-horizontal', rowOuterH, 'value', Gio.SettingsBindFlags.DEFAULT); + + const rowOuterV = new Adw.SpinRow({ + title: 'Outer Gap (vertical)', + subtitle: 'Top / bottom screen edges (pixels)', + adjustment: new Gtk.Adjustment({ lower: 0, upper: 100, step_increment: 1 }), + }); + groupGaps.add(rowOuterV); + settings.bind('outer-gap-vertical', rowOuterV, 'value', Gio.SettingsBindFlags.DEFAULT); + + // ── WINDOW BEHAVIOR ──────────────────────────────────────────── + const groupBehavior = new Adw.PreferencesGroup({ title: 'Window Behavior' }); + page.add(groupBehavior); + + const rowNewWindow = new Adw.ComboRow({ + title: 'Open new windows as', + subtitle: 'Whether a new window starts as Master or Stack', + model: new Gtk.StringList({ + strings: ['Stack Window (Default)', 'Master Window'], + }), + }); + groupBehavior.add(rowNewWindow); + + const currentBehavior = settings.get_string('new-window-behavior'); + rowNewWindow.selected = currentBehavior === 'master' ? 1 : 0; + + rowNewWindow.connect('notify::selected', () => { + const newVal = rowNewWindow.selected === 1 ? 'master' : 'stack'; + settings.set_string('new-window-behavior', newVal); + }); + + // ── KEYBINDINGS ──────────────────────────────────────────── + const groupKeys = new Adw.PreferencesGroup({ title: 'Keybindings' }); + page.add(groupKeys); + + const rowKeys = new Adw.ActionRow({ + title: 'Configure Shortcuts', + subtitle: 'Adjust all shortcuts in GNOME Keyboard settings.', + }); + groupKeys.add(rowKeys); + + const btnOpenKeyboard = new Gtk.Button({ label: 'Open Keyboard Settings' }); + btnOpenKeyboard.connect('clicked', () => { + const appInfo = Gio.AppInfo.create_from_commandline( + 'gnome-control-center keyboard', null, Gio.AppInfoCreateFlags.NONE + ); + appInfo.launch([], null); + }); + rowKeys.add_suffix(btnOpenKeyboard); + rowKeys.set_activatable_widget(btnOpenKeyboard); + } +} diff --git a/prefs_modern.js b/prefs_modern.js index 829b70d..a97bb97 100644 --- a/prefs_modern.js +++ b/prefs_modern.js @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////// -// Simple-Tiling – MODERN MENU (GNOME Shell 45+) // +// Simple-Tiling – MODERN MENU (GNOME Shell 49+) // // © 2025 domoel – MIT // ///////////////////////////////////////////////////////////////