From c317661f6196e7162cce700774418bcbc8865907 Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Fri, 11 Aug 2023 22:55:12 +0200 Subject: [PATCH 01/58] set gnome 45 to only supported shell versions --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 17d80f4..65dc8e6 100644 --- a/metadata.json +++ b/metadata.json @@ -3,7 +3,7 @@ "uuid": "dash-to-panel@jderose9.github.com", "name": "Dash to Panel", "description": "An icon taskbar for the Gnome Shell. This extension moves the dash into the gnome main panel so that the application launchers and system tray are combined into a single panel, similar to that found in KDE Plasma and Windows 7+. A separate dock is no longer needed for easy access to running and favorited applications.\n\nFor a more traditional experience, you may also want to use Tweak Tool to enable Windows > Titlebar Buttons > Minimize & Maximize.\n\nFor the best support, please report any issues on Github. Dash-to-panel is developed and maintained by @jderose9 and @charlesg99.", -"shell-version": [ "42", "43", "44" ], +"shell-version": [ "45" ], "url": "https://github.com/home-sweet-gnome/dash-to-panel", "gettext-domain": "dash-to-panel", "version": 9999 From b87ac15d66e1a2acd4fd81bb4185d172c127840f Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Sun, 13 Aug 2023 02:49:56 +0200 Subject: [PATCH 02/58] migrate gi, ui and Me imports to new ESM format --- appIcons.js | 51 +++++++++++++++++----------------- desktopIconsIntegration.js | 7 ++--- extension.js | 23 ++++++++------- intellihide.js | 25 ++++++++--------- overview.js | 21 +++++++------- panel.js | 57 +++++++++++++++++++------------------- panelManager.js | 47 +++++++++++++++---------------- panelSettings.js | 3 +- panelStyle.js | 15 +++++----- prefs.js | 21 +++++++------- progress.js | 11 ++++---- proximity.js | 9 +++--- taskbar.js | 45 +++++++++++++++--------------- transparency.js | 19 ++++++------- utils.js | 24 ++++++++-------- windowPreview.js | 29 ++++++++++--------- 16 files changed, 196 insertions(+), 211 deletions(-) diff --git a/appIcons.js b/appIcons.js index b63b1ac..49cf839 100644 --- a/appIcons.js +++ b/appIcons.js @@ -22,39 +22,38 @@ */ -const Clutter = imports.gi.Clutter; -const Gio = imports.gi.Gio; -const GLib = imports.gi.GLib; -const Gtk = imports.gi.Gtk; -const GObject = imports.gi.GObject; +import Clutter from 'gi://Clutter'; +import Gio from 'gi://Gio'; +import GLib from 'gi://GLib'; +import Gtk from 'gi://Gtk'; +import GObject from 'gi://GObject'; const Signals = imports.signals; -const Meta = imports.gi.Meta; -const Shell = imports.gi.Shell; -const St = imports.gi.St; +import Meta from 'gi://Meta'; +import Shell from 'gi://Shell'; +import St from 'gi://St'; const Mainloop = imports.mainloop; -const Config = imports.misc.config; -const AppDisplay = imports.ui.appDisplay; -const AppMenu = imports.ui.appMenu; +import * as Config from 'resource:///org/gnome/shell/misc/config.js'; +import * as AppDisplay from 'resource:///org/gnome/shell/ui/appDisplay.js'; +import * as AppMenu from 'resource:///org/gnome/shell/ui/appMenu.js'; if (Config.PACKAGE_VERSION < '42') { const AppMenu = imports.ui.appDisplay; } -const AppFavorites = imports.ui.appFavorites; -const Dash = imports.ui.dash; -const DND = imports.ui.dnd; -const IconGrid = imports.ui.iconGrid; -const Main = imports.ui.main; -const PopupMenu = imports.ui.popupMenu; -const Util = imports.misc.util; -const Workspace = imports.ui.workspace; -const BoxPointer = imports.ui.boxpointer; -const ExtensionUtils = imports.misc.extensionUtils +import * as AppFavorites from 'resource:///org/gnome/shell/ui/appFavorites.js'; +import * as Dash from 'resource:///org/gnome/shell/ui/dash.js'; +import * as DND from 'resource:///org/gnome/shell/ui/dnd.js'; +import * as IconGrid from 'resource:///org/gnome/shell/ui/iconGrid.js'; +import * as Main from 'resource:///org/gnome/shell/ui/main.js'; +import * as PopupMenu from 'resource:///org/gnome/shell/ui/popupMenu.js'; +import * as Util from 'resource:///org/gnome/shell/misc/util.js'; +import * as Workspace from 'resource:///org/gnome/shell/ui/workspace.js'; +import * as BoxPointer from 'resource:///org/gnome/shell/ui/boxpointer.js'; +import * as ExtensionUtils from 'resource:///org/gnome/shell/misc/extensionUtils.js'; -const Me = ExtensionUtils.getCurrentExtension(); -const Utils = Me.imports.utils; -const PanelSettings = Me.imports.panelSettings; -const Taskbar = Me.imports.taskbar; -const Progress = Me.imports.progress; +import * as Utils from './utils.js'; +import * as PanelSettings from './panelSettings.js'; +import * as Taskbar from './taskbar.js'; +import * as Progress from './progress.js'; const _ = imports.gettext.domain(Utils.TRANSLATION_DOMAIN).gettext; //timeout names diff --git a/desktopIconsIntegration.js b/desktopIconsIntegration.js index 5754d5e..77a4540 100644 --- a/desktopIconsIntegration.js +++ b/desktopIconsIntegration.js @@ -55,11 +55,10 @@ * *******************************************************************************/ -const GLib = imports.gi.GLib; -const Main = imports.ui.main; +import GLib from 'gi://GLib'; +import * as Main from 'resource:///org/gnome/shell/ui/main.js'; -const ExtensionUtils = imports.misc.extensionUtils; -const Me = ExtensionUtils.getCurrentExtension(); +import * as ExtensionUtils from 'resource:///org/gnome/shell/misc/extensionUtils.js';; const IDENTIFIER_UUID = "130cbc66-235c-4bd6-8571-98d2d8bba5e2"; diff --git a/extension.js b/extension.js index 6281b2c..fad4c3c 100644 --- a/extension.js +++ b/extension.js @@ -18,21 +18,20 @@ */ -const Main = imports.ui.main; -const Meta = imports.gi.Meta; -const Gio = imports.gi.Gio; -const GLib = imports.gi.GLib; -const Shell = imports.gi.Shell; -const St = imports.gi.St; -const WindowManager = imports.ui.windowManager; -const ExtensionUtils = imports.misc.extensionUtils; +import * as Main from 'resource:///org/gnome/shell/ui/main.js'; +import Meta from 'gi://Meta'; +import Gio from 'gi://Gio'; +import GLib from 'gi://GLib'; +import Shell from 'gi://Shell'; +import St from 'gi://St'; +import * as WindowManager from 'resource:///org/gnome/shell/ui/windowManager.js'; +import * as ExtensionUtils from 'resource:///org/gnome/shell/misc/extensionUtils.js';; const Mainloop = imports.mainloop; const Signals = imports.signals; -const Me = ExtensionUtils.getCurrentExtension(); -const { PanelManager } = Me.imports.panelManager; -const Utils = Me.imports.utils; -const AppIcons = Me.imports.appIcons; +import { PanelManager } from './panelManager.js'; +import * as Utils from './utils.js'; +import * as AppIcons from './appIcons.js'; const UBUNTU_DOCK_UUID = 'ubuntu-dock@ubuntu.com'; diff --git a/intellihide.js b/intellihide.js index 436e4c8..d2ba8b3 100644 --- a/intellihide.js +++ b/intellihide.js @@ -15,21 +15,20 @@ * along with this program. If not, see . */ -const Clutter = imports.gi.Clutter; -const Meta = imports.gi.Meta; -const Shell = imports.gi.Shell; -const St = imports.gi.St; +import Clutter from 'gi://Clutter'; +import Meta from 'gi://Meta'; +import Shell from 'gi://Shell'; +import St from 'gi://St'; -var GrabHelper = imports.ui.grabHelper; -const Layout = imports.ui.layout; -const Main = imports.ui.main; -const OverviewControls = imports.ui.overviewControls; -const PointerWatcher = imports.ui.pointerWatcher; +import * as GrabHelper from 'resource:///org/gnome/shell/ui/grabHelper.js'; +import * as Layout from 'resource:///org/gnome/shell/ui/layout.js'; +import * as Main from 'resource:///org/gnome/shell/ui/main.js'; +import * as OverviewControls from 'resource:///org/gnome/shell/ui/overviewControls.js'; +import * as PointerWatcher from 'resource:///org/gnome/shell/ui/pointerWatcher.js'; -const Me = imports.misc.extensionUtils.getCurrentExtension(); -const Panel = Me.imports.panel; -const Proximity = Me.imports.proximity; -const Utils = Me.imports.utils; +import * as Panel from './panel.js'; +import * as Proximity from './proximity.js'; +import * as Utils from './utils.js'; //timeout intervals const CHECK_POINTER_MS = 200; diff --git a/overview.js b/overview.js index c53600e..59664f4 100644 --- a/overview.js +++ b/overview.js @@ -20,19 +20,18 @@ * Some code was also adapted from the upstream Gnome Shell source code. */ -const Me = imports.misc.extensionUtils.getCurrentExtension(); -const Intellihide = Me.imports.intellihide; -const Utils = Me.imports.utils; +import * as Intellihide from './intellihide.js'; +import * as Utils from './utils.js'; -const Clutter = imports.gi.Clutter; -const Gio = imports.gi.Gio; -const Shell = imports.gi.Shell; -const St = imports.gi.St; -const Main = imports.ui.main; -const Workspace = imports.ui.workspace; -const { WindowPreview } = imports.ui.windowPreview; +import Clutter from 'gi://Clutter'; +import Gio from 'gi://Gio'; +import Shell from 'gi://Shell'; +import St from 'gi://St'; +import * as Main from 'resource:///org/gnome/shell/ui/main.js'; +import * as Workspace from 'resource:///org/gnome/shell/ui/workspace.js'; +import { WindowPreview } from 'resource:///org/gnome/shell/ui/windowPreview.js'; -const Meta = imports.gi.Meta; +import Meta from 'gi://Meta'; const GS_HOTKEYS_KEY = 'switch-to-application-'; diff --git a/panel.js b/panel.js index a5697b6..38b934b 100644 --- a/panel.js +++ b/panel.js @@ -27,38 +27,37 @@ * Some code was also adapted from the upstream Gnome Shell source code. */ -const Me = imports.misc.extensionUtils.getCurrentExtension(); -const Clutter = imports.gi.Clutter; -const Config = imports.misc.config; -const Gtk = imports.gi.Gtk; -const GObject = imports.gi.GObject; +import Clutter from 'gi://Clutter'; +import * as Config from 'resource:///org/gnome/shell/misc/config.js'; +import Gtk from 'gi://Gtk'; +import GObject from 'gi://GObject'; const Gi = imports._gi; -const AppIcons = Me.imports.appIcons; -const Utils = Me.imports.utils; -const { Taskbar, TaskbarItemContainer } = Me.imports.taskbar; -const Pos = Me.imports.panelPositions; -const PanelSettings = Me.imports.panelSettings; -const { PanelStyle } = Me.imports.panelStyle; -const Main = imports.ui.main; +import * as AppIcons from './appIcons.js'; +import * as Utils from './utils.js'; +import { Taskbar, TaskbarItemContainer } from './taskbar.js'; +import * as Pos from './panelPositions.js'; +import * as PanelSettings from './panelSettings.js'; +import { PanelStyle } from './panelStyle.js'; +import * as Main from 'resource:///org/gnome/shell/ui/main.js'; const Mainloop = imports.mainloop; -const Dash = imports.ui.dash; -const CtrlAltTab = imports.ui.ctrlAltTab; -const GSPanel = imports.ui.panel; -const PanelMenu = imports.ui.panelMenu; -const St = imports.gi.St; -const GLib = imports.gi.GLib; -const Meta = imports.gi.Meta; -const Pango = imports.gi.Pango; -const DND = imports.ui.dnd; -const Shell = imports.gi.Shell; -const PopupMenu = imports.ui.popupMenu; -const IconGrid = imports.ui.iconGrid; -const DateMenu = imports.ui.dateMenu; -const Volume = imports.ui.status.volume; -const Progress = Me.imports.progress; +import * as Dash from 'resource:///org/gnome/shell/ui/dash.js'; +import * as CtrlAltTab from 'resource:///org/gnome/shell/ui/ctrlAltTab.js'; +import * as GSPanel from 'resource:///org/gnome/shell/ui/panel.js'; +import * as PanelMenu from 'resource:///org/gnome/shell/ui/panelMenu.js'; +import St from 'gi://St'; +import GLib from 'gi://GLib'; +import Meta from 'gi://Meta'; +import Pango from 'gi://Pango'; +import * as DND from 'resource:///org/gnome/shell/ui/dnd.js'; +import Shell from 'gi://Shell'; +import * as PopupMenu from 'resource:///org/gnome/shell/ui/popupMenu.js'; +import * as IconGrid from 'resource:///org/gnome/shell/ui/iconGrid.js'; +import * as DateMenu from 'resource:///org/gnome/shell/ui/dateMenu.js'; +import * as Volume from 'resource:///org/gnome/shell/ui/volume.js'; +import * as Progress from './progress.js'; -const Intellihide = Me.imports.intellihide; -const Transparency = Me.imports.transparency; +import * as Intellihide from './intellihide.js'; +import * as Transparency from './transparency.js'; const _ = imports.gettext.domain(Me.imports.utils.TRANSLATION_DOMAIN).gettext; let tracker = Shell.WindowTracker.get_default(); diff --git a/panelManager.js b/panelManager.js index 953aa85..9f423ed 100755 --- a/panelManager.js +++ b/panelManager.js @@ -27,33 +27,32 @@ * Some code was also adapted from the upstream Gnome Shell source code. */ -const Me = imports.misc.extensionUtils.getCurrentExtension(); -const { Overview } = Me.imports.overview; -const { Panel, panelBoxes } = Me.imports.panel; -const PanelSettings = Me.imports.panelSettings; -const Proximity = Me.imports.proximity; -const Taskbar = Me.imports.taskbar; -const Utils = Me.imports.utils; -const DesktopIconsIntegration = Me.imports.desktopIconsIntegration; +import { Overview } from './overview.js'; +import { Panel, panelBoxes } from './panel.js'; +import * as PanelSettings from './panelSettings.js'; +import * as Proximity from './proximity.js'; +import * as Taskbar from './taskbar.js'; +import * as Utils from './utils.js'; +import * as DesktopIconsIntegration from './desktopIconsIntegration.js'; const Gi = imports._gi; -const GLib = imports.gi.GLib; -const GObject = imports.gi.GObject; -const Clutter = imports.gi.Clutter; -const Meta = imports.gi.Meta; -const Shell = imports.gi.Shell; -const St = imports.gi.St; +import GLib from 'gi://GLib'; +import GObject from 'gi://GObject'; +import Clutter from 'gi://Clutter'; +import Meta from 'gi://Meta'; +import Shell from 'gi://Shell'; +import St from 'gi://St'; -const AppDisplay = imports.ui.appDisplay; -const BoxPointer = imports.ui.boxpointer; -const Dash = imports.ui.dash; -const IconGrid = imports.ui.iconGrid; -const LookingGlass = imports.ui.lookingGlass; -const Main = imports.ui.main; -const PanelMenu = imports.ui.panelMenu; -const Layout = imports.ui.layout; -const WM = imports.ui.windowManager; -const { SecondaryMonitorDisplay, WorkspacesView } = imports.ui.workspacesView; +import * as AppDisplay from 'resource:///org/gnome/shell/ui/appDisplay.js'; +import * as BoxPointer from 'resource:///org/gnome/shell/ui/boxpointer.js'; +import * as Dash from 'resource:///org/gnome/shell/ui/dash.js'; +import * as IconGrid from 'resource:///org/gnome/shell/ui/iconGrid.js'; +import * as LookingGlass from 'resource:///org/gnome/shell/ui/lookingGlass.js'; +import * as Main from 'resource:///org/gnome/shell/ui/main.js'; +import * as PanelMenu from 'resource:///org/gnome/shell/ui/panelMenu.js'; +import * as Layout from 'resource:///org/gnome/shell/ui/layout.js'; +import * as WM from 'resource:///org/gnome/shell/ui/windowManager.js'; +import { SecondaryMonitorDisplay, WorkspacesView } from 'resource:///org/gnome/shell/ui/workspacesView.js'; var PanelManager = class { diff --git a/panelSettings.js b/panelSettings.js index 4feb3fd..0f07057 100644 --- a/panelSettings.js +++ b/panelSettings.js @@ -15,8 +15,7 @@ * along with this program. If not, see . */ -const Me = imports.misc.extensionUtils.getCurrentExtension(); -const Pos = Me.imports.panelPositions; +import * as Pos from './panelPositions.js'; /** Return object representing a settings value that is stored as JSON. */ function getSettingsJson(settings, setting) { diff --git a/panelStyle.js b/panelStyle.js index fde15af..28d1703 100644 --- a/panelStyle.js +++ b/panelStyle.js @@ -21,16 +21,15 @@ * mathematical.coffee@gmail.com */ -const Me = imports.misc.extensionUtils.getCurrentExtension(); -const ExtensionUtils = imports.misc.extensionUtils; -const Main = imports.ui.main; +import * as ExtensionUtils from 'resource:///org/gnome/shell/misc/extensionUtils.js';; +import * as Main from 'resource:///org/gnome/shell/ui/main.js'; const Mainloop = imports.mainloop; -const St = imports.gi.St; -const Shell = imports.gi.Shell; +import St from 'gi://St'; +import Shell from 'gi://Shell'; -const Panel = Me.imports.panel; -const Taskbar = Me.imports.taskbar; -const Utils = Me.imports.utils; +import * as Panel from './panel.js'; +import * as Taskbar from './taskbar.js'; +import * as Utils from './utils.js'; var PanelStyle = class { diff --git a/prefs.js b/prefs.js index fb376d9..0d86117 100644 --- a/prefs.js +++ b/prefs.js @@ -20,22 +20,21 @@ * Some code was also adapted from the upstream Gnome Shell source code. */ -const GdkPixbuf = imports.gi.GdkPixbuf; -const Gio = imports.gi.Gio; -const GLib = imports.gi.GLib; -const GObject = imports.gi.GObject; -const Gtk = imports.gi.Gtk; -const Adw = imports.gi.Adw; -const Gdk = imports.gi.Gdk; +import GdkPixbuf from 'gi://GdkPixbuf'; +import Gio from 'gi://Gio'; +import GLib from 'gi://GLib'; +import GObject from 'gi://GObject'; +import Gtk from 'gi://Gtk'; +import Adw from 'gi://Adw'; +import Gdk from 'gi://Gdk'; const Mainloop = imports.mainloop; -const Me = imports.misc.extensionUtils.getCurrentExtension(); -const ExtensionUtils = imports.misc.extensionUtils; +import * as ExtensionUtils from 'resource:///org/gnome/shell/misc/extensionUtils.js';; const Gettext = imports.gettext.domain(Me.metadata['gettext-domain']); const _ = Gettext.gettext; const N_ = function(e) { return e }; -const PanelSettings = Me.imports.panelSettings; -const Pos = Me.imports.panelPositions; +import * as PanelSettings from './panelSettings.js'; +import * as Pos from './panelPositions.js'; const SCALE_UPDATE_TIMEOUT = 500; const DEFAULT_PANEL_SIZES = [ 128, 96, 64, 48, 32, 24, 16 ]; diff --git a/progress.js b/progress.js index 45e26d2..d3a121b 100644 --- a/progress.js +++ b/progress.js @@ -19,14 +19,13 @@ * This file is based on code from the Dash to Dock extension by micheleg */ -const Me = imports.misc.extensionUtils.getCurrentExtension(); -const Gio = imports.gi.Gio; +import Gio from 'gi://Gio'; const Cairo = imports.cairo; -const Clutter = imports.gi.Clutter; -const Pango = imports.gi.Pango; -const St = imports.gi.St; +import Clutter from 'gi://Clutter'; +import Pango from 'gi://Pango'; +import St from 'gi://St'; const Signals = imports.signals; -const Utils = Me.imports.utils; +import * as Utils from './utils.js'; var ProgressManager = class { diff --git a/proximity.js b/proximity.js index 158b634..3e03343 100644 --- a/proximity.js +++ b/proximity.js @@ -15,13 +15,12 @@ * along with this program. If not, see . */ -const Meta = imports.gi.Meta; +import Meta from 'gi://Meta'; -const Layout = imports.ui.layout; -const Main = imports.ui.main; +import * as Layout from 'resource:///org/gnome/shell/ui/layout.js'; +import * as Main from 'resource:///org/gnome/shell/ui/main.js'; -const Me = imports.misc.extensionUtils.getCurrentExtension(); -const Utils = Me.imports.utils; +import * as Utils from './utils.js'; //timeout intervals const MIN_UPDATE_MS = 200; diff --git a/taskbar.js b/taskbar.js index e688ee9..19ce02c 100644 --- a/taskbar.js +++ b/taskbar.js @@ -22,35 +22,34 @@ */ -const Clutter = imports.gi.Clutter; -const Gio = imports.gi.Gio; -const GLib = imports.gi.GLib; -const GObject = imports.gi.GObject; -const Gtk = imports.gi.Gtk; +import Clutter from 'gi://Clutter'; +import Gio from 'gi://Gio'; +import GLib from 'gi://GLib'; +import GObject from 'gi://GObject'; +import Gtk from 'gi://Gtk'; const Signals = imports.signals; -const Meta = imports.gi.Meta; -const Shell = imports.gi.Shell; -const St = imports.gi.St; +import Meta from 'gi://Meta'; +import Shell from 'gi://Shell'; +import St from 'gi://St'; const Mainloop = imports.mainloop; const SearchController = imports.ui.main.overview._overview._controls._searchController; const AppDisplay = imports.ui.main.overview._overview._controls.appDisplay; -const AppFavorites = imports.ui.appFavorites; -const Dash = imports.ui.dash; -const DND = imports.ui.dnd; -const IconGrid = imports.ui.iconGrid; -const Main = imports.ui.main; -const PopupMenu = imports.ui.popupMenu; -const Workspace = imports.ui.workspace; +import * as AppFavorites from 'resource:///org/gnome/shell/ui/appFavorites.js'; +import * as Dash from 'resource:///org/gnome/shell/ui/dash.js'; +import * as DND from 'resource:///org/gnome/shell/ui/dnd.js'; +import * as IconGrid from 'resource:///org/gnome/shell/ui/iconGrid.js'; +import * as Main from 'resource:///org/gnome/shell/ui/main.js'; +import * as PopupMenu from 'resource:///org/gnome/shell/ui/popupMenu.js'; +import * as Workspace from 'resource:///org/gnome/shell/ui/workspace.js'; -const Me = imports.misc.extensionUtils.getCurrentExtension(); -const AppIcons = Me.imports.appIcons; -const Panel = Me.imports.panel; -const PanelManager = Me.imports.panelManager; -const PanelSettings = Me.imports.panelSettings; -const Pos = Me.imports.panelPositions; -const Utils = Me.imports.utils; -const WindowPreview = Me.imports.windowPreview; +import * as AppIcons from './appIcons.js'; +import * as Panel from './panel.js'; +import * as PanelManager from './panelManager.js'; +import * as PanelSettings from './panelSettings.js'; +import * as Pos from './panelPositions.js'; +import * as Utils from './utils.js'; +import * as WindowPreview from './windowPreview.js'; var DASH_ANIMATION_TIME = Dash.DASH_ANIMATION_TIME / (Dash.DASH_ANIMATION_TIME > 1 ? 1000 : 1); var DASH_ITEM_HOVER_TIMEOUT = Dash.DASH_ITEM_HOVER_TIMEOUT; diff --git a/transparency.js b/transparency.js index 8766a53..83497c4 100644 --- a/transparency.js +++ b/transparency.js @@ -15,17 +15,16 @@ * along with this program. If not, see . */ -const Clutter = imports.gi.Clutter; -const GdkPixbuf = imports.gi.GdkPixbuf; -const Main = imports.ui.main; -const Meta = imports.gi.Meta; -const St = imports.gi.St; -const Config = imports.misc.config; +import Clutter from 'gi://Clutter'; +import GdkPixbuf from 'gi://GdkPixbuf'; +import * as Main from 'resource:///org/gnome/shell/ui/main.js'; +import Meta from 'gi://Meta'; +import St from 'gi://St'; +import * as Config from 'resource:///org/gnome/shell/misc/config.js'; -const Me = imports.misc.extensionUtils.getCurrentExtension(); -const Panel = Me.imports.panel; -const Proximity = Me.imports.proximity; -const Utils = Me.imports.utils; +import * as Panel from './panel.js'; +import * as Proximity from './proximity.js'; +import * as Utils from './utils.js'; var DynamicTransparency = class { diff --git a/utils.js b/utils.js index 04e50a4..a15544b 100644 --- a/utils.js +++ b/utils.js @@ -21,20 +21,20 @@ * Some code was also adapted from the upstream Gnome Shell source code. */ -const Clutter = imports.gi.Clutter; -const GdkPixbuf = imports.gi.GdkPixbuf; +import Clutter from 'gi://Clutter'; +import GdkPixbuf from 'gi://GdkPixbuf'; const Gi = imports._gi; -const Gio = imports.gi.Gio; -const GLib = imports.gi.GLib; -const Gtk = imports.gi.Gtk; -const Meta = imports.gi.Meta; -const Shell = imports.gi.Shell; -const St = imports.gi.St; +import Gio from 'gi://Gio'; +import GLib from 'gi://GLib'; +import Gtk from 'gi://Gtk'; +import Meta from 'gi://Meta'; +import Shell from 'gi://Shell'; +import St from 'gi://St'; const Mainloop = imports.mainloop; -const Config = imports.misc.config; -const Util = imports.misc.util; -const Main = imports.ui.main; -const MessageTray = imports.ui.messageTray; +import * as Config from 'resource:///org/gnome/shell/misc/config.js'; +import * as Util from 'resource:///org/gnome/shell/misc/util.js'; +import * as Main from 'resource:///org/gnome/shell/ui/main.js'; +import * as MessageTray from 'resource:///org/gnome/shell/ui/messageTray.js'; var TRANSLATION_DOMAIN = imports.misc.extensionUtils.getCurrentExtension().metadata['gettext-domain']; var SCROLL_TIME = Util.SCROLL_TIME / (Util.SCROLL_TIME > 1 ? 1000 : 1); diff --git a/windowPreview.js b/windowPreview.js index 6a65945..06b22c9 100644 --- a/windowPreview.js +++ b/windowPreview.js @@ -15,24 +15,23 @@ * along with this program. If not, see . */ -const GObject = imports.gi.GObject; -const Clutter = imports.gi.Clutter; -const GLib = imports.gi.GLib; -const Graphene = imports.gi.Graphene; -const Gtk = imports.gi.Gtk; -const Main = imports.ui.main; +import GObject from 'gi://GObject'; +import Clutter from 'gi://Clutter'; +import GLib from 'gi://GLib'; +import Graphene from 'gi://Graphene'; +import Gtk from 'gi://Gtk'; +import * as Main from 'resource:///org/gnome/shell/ui/main.js'; const Mainloop = imports.mainloop; -const Meta = imports.gi.Meta; -const PopupMenu = imports.ui.popupMenu; +import Meta from 'gi://Meta'; +import * as PopupMenu from 'resource:///org/gnome/shell/ui/popupMenu.js'; const Signals = imports.signals; -const St = imports.gi.St; -const WindowManager = imports.ui.windowManager; -const Workspace = imports.ui.workspace; +import St from 'gi://St'; +import * as WindowManager from 'resource:///org/gnome/shell/ui/windowManager.js'; +import * as Workspace from 'resource:///org/gnome/shell/ui/workspace.js'; -const Me = imports.misc.extensionUtils.getCurrentExtension(); -const Panel = Me.imports.panel; -const Taskbar = Me.imports.taskbar; -const Utils = Me.imports.utils; +import * as Panel from './panel.js'; +import * as Taskbar from './taskbar.js'; +import * as Utils from './utils.js'; //timeout intervals const ENSURE_VISIBLE_MS = 200; From 33c07bf397fc95ea2732dfce361d490e6e8f4185 Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Sun, 13 Aug 2023 03:06:21 +0200 Subject: [PATCH 03/58] export default Extension class --- extension.js | 108 ++++++++++++++++++++++++++++----------------------- 1 file changed, 59 insertions(+), 49 deletions(-) diff --git a/extension.js b/extension.js index fad4c3c..5409c18 100644 --- a/extension.js +++ b/extension.js @@ -40,28 +40,69 @@ let extensionChangedHandler; let disabledUbuntuDock; let extensionSystem = (Main.extensionManager || imports.ui.extensionSystem); -function init() { - this._realHasOverview = Main.sessionMode.hasOverview; +import {Extension, gettext as _} from 'resource:///org/gnome/shell/extensions/extension.js'; - ExtensionUtils.initTranslations(Utils.TRANSLATION_DOMAIN); - - //create an object that persists until gnome-shell is restarted, even if the extension is disabled - Me.persistentStorage = {}; -} +export default class DashToPanelExtension extends Extension { + constructor(metadata) { + super(metadata); + console.log(`Initiating ${this.uuid}`); -function enable() { - // The Ubuntu Dock extension might get enabled after this extension - extensionChangedHandler = extensionSystem.connect('extension-state-changed', (data, extension) => { - if (extension.uuid === UBUNTU_DOCK_UUID && extension.state === 1) { - _enable(); + this._realHasOverview = Main.sessionMode.hasOverview; + + ExtensionUtils.initTranslations(Utils.TRANSLATION_DOMAIN); + + //create an object that persists until gnome-shell is restarted, even if the extension is disabled + Me.persistentStorage = {}; + } + + enable() { + this._settings = this.getSettings(); + console.log(_('This is a translatable text')); + + // The Ubuntu Dock extension might get enabled after this extension + extensionChangedHandler = extensionSystem.connect('extension-state-changed', (data, extension) => { + if (extension.uuid === UBUNTU_DOCK_UUID && extension.state === 1) { + _enable(); + } + }); + + //create a global object that can emit signals and conveniently expose functionalities to other extensions + global.dashToPanel = {}; + Signals.addSignalMethods(global.dashToPanel); + + _enable(); + } + + disable() { + reset = false + + panelManager.disable(); + + this._settings = null; + panelManager = null; + + Utils.removeKeybinding('open-application-menu'); + Utils.addKeybinding( + 'open-application-menu', + new Gio.Settings({ schema_id: WindowManager.SHELL_KEYBINDINGS_SCHEMA }), + Main.wm._toggleAppMenu.bind(Main.wm), + Shell.ActionMode.NORMAL | Shell.ActionMode.POPUP + ); + + if (!reset) { + extensionSystem.disconnect(extensionChangedHandler); + delete global.dashToPanel; + + // Re-enable Ubuntu Dock if it was disabled by dash to panel + if (disabledUbuntuDock && Main.sessionMode.allowExtensions) { + (extensionSystem._callExtensionEnable || extensionSystem.enableExtension).call(extensionSystem, UBUNTU_DOCK_UUID); + } + + AppIcons.resetRecentlyClickedApp(); } - }); - //create a global object that can emit signals and conveniently expose functionalities to other extensions - global.dashToPanel = {}; - Signals.addSignalMethods(global.dashToPanel); - - _enable(); + Main.sessionMode.hasOverview = this._realHasOverview; + } } function _enable() { @@ -116,34 +157,3 @@ function _enable() { Shell.ActionMode.NORMAL | Shell.ActionMode.POPUP ); } - -function disable(reset) { - panelManager.disable(); - Me.settings.run_dispose(); - Me.desktopSettings.run_dispose(); - - delete Me.settings; - panelManager = null; - - Utils.removeKeybinding('open-application-menu'); - Utils.addKeybinding( - 'open-application-menu', - new Gio.Settings({ schema_id: WindowManager.SHELL_KEYBINDINGS_SCHEMA }), - Main.wm._toggleAppMenu.bind(Main.wm), - Shell.ActionMode.NORMAL | Shell.ActionMode.POPUP - ); - - if (!reset) { - extensionSystem.disconnect(extensionChangedHandler); - delete global.dashToPanel; - - // Re-enable Ubuntu Dock if it was disabled by dash to panel - if (disabledUbuntuDock && Main.sessionMode.allowExtensions) { - (extensionSystem._callExtensionEnable || extensionSystem.enableExtension).call(extensionSystem, UBUNTU_DOCK_UUID); - } - - AppIcons.resetRecentlyClickedApp(); - } - - Main.sessionMode.hasOverview = this._realHasOverview; -} From 6f5a2e0f192799b6814be959e984a0e47e0725a8 Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Sun, 13 Aug 2023 03:06:39 +0200 Subject: [PATCH 04/58] export default ExtensionPreferences class --- prefs.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/prefs.js b/prefs.js index 0d86117..8d09130 100644 --- a/prefs.js +++ b/prefs.js @@ -36,6 +36,8 @@ const N_ = function(e) { return e }; import * as PanelSettings from './panelSettings.js'; import * as Pos from './panelPositions.js'; +import {ExtensionPreferences, gettext as _} from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js'; + const SCALE_UPDATE_TIMEOUT = 500; const DEFAULT_PANEL_SIZES = [ 128, 96, 64, 48, 32, 24, 16 ]; const DEFAULT_FONT_SIZES = [ 96, 64, 48, 32, 24, 16, 0 ]; @@ -2328,13 +2330,15 @@ const BuilderScope = GObject.registerClass({ } }); -function init() { - ExtensionUtils.initTranslations(); -} -function fillPreferencesWindow(window) { - // use default width or window - window.set_default_size(0, 740); +export default class DashToPanelPreferences extends ExtensionPreferences { + fillPreferencesWindow(window) { + window._settings = this.getSettings(); + this.initTranslations(); - let preferences = new Preferences(window); -} + // use default width or window + window.set_default_size(0, 740); + + let preferences = new Preferences(window); + } +} \ No newline at end of file From 950c1aaa4bb0bc92ea30ab2991159b16de240393 Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Sun, 13 Aug 2023 03:25:09 +0200 Subject: [PATCH 05/58] fix imports with {} --- extension.js | 2 +- panel.js | 5 +++-- panelManager.js | 5 +++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/extension.js b/extension.js index 5409c18..0f4a757 100644 --- a/extension.js +++ b/extension.js @@ -29,7 +29,7 @@ import * as ExtensionUtils from 'resource:///org/gnome/shell/misc/extensionUtils const Mainloop = imports.mainloop; const Signals = imports.signals; -import { PanelManager } from './panelManager.js'; +import * as PanelManager from './panelManager.js'; import * as Utils from './utils.js'; import * as AppIcons from './appIcons.js'; diff --git a/panel.js b/panel.js index 38b934b..c425598 100644 --- a/panel.js +++ b/panel.js @@ -34,10 +34,11 @@ import GObject from 'gi://GObject'; const Gi = imports._gi; import * as AppIcons from './appIcons.js'; import * as Utils from './utils.js'; -import { Taskbar, TaskbarItemContainer } from './taskbar.js'; +import * as Taskbar from './taskbar.js'; +import * as TaskbarItemContainer from './taskbar.js'; import * as Pos from './panelPositions.js'; import * as PanelSettings from './panelSettings.js'; -import { PanelStyle } from './panelStyle.js'; +import * as PanelStyle from './panelStyle.js'; import * as Main from 'resource:///org/gnome/shell/ui/main.js'; const Mainloop = imports.mainloop; import * as Dash from 'resource:///org/gnome/shell/ui/dash.js'; diff --git a/panelManager.js b/panelManager.js index 9f423ed..3e95192 100755 --- a/panelManager.js +++ b/panelManager.js @@ -27,8 +27,9 @@ * Some code was also adapted from the upstream Gnome Shell source code. */ -import { Overview } from './overview.js'; -import { Panel, panelBoxes } from './panel.js'; +import * as Overview from './overview.js'; +import * as Panel from './panel.js'; +import * as panelBoxes from './panel.js'; import * as PanelSettings from './panelSettings.js'; import * as Proximity from './proximity.js'; import * as Taskbar from './taskbar.js'; From 1780bb1bff142cfa3d3de8fc338f2a80c16ab107 Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Sun, 13 Aug 2023 17:32:09 +0200 Subject: [PATCH 06/58] move Extension import to the top --- extension.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extension.js b/extension.js index 0f4a757..da16004 100644 --- a/extension.js +++ b/extension.js @@ -33,6 +33,8 @@ import * as PanelManager from './panelManager.js'; import * as Utils from './utils.js'; import * as AppIcons from './appIcons.js'; +import {Extension, gettext as _} from 'resource:///org/gnome/shell/extensions/extension.js'; + const UBUNTU_DOCK_UUID = 'ubuntu-dock@ubuntu.com'; let panelManager; @@ -40,8 +42,6 @@ let extensionChangedHandler; let disabledUbuntuDock; let extensionSystem = (Main.extensionManager || imports.ui.extensionSystem); -import {Extension, gettext as _} from 'resource:///org/gnome/shell/extensions/extension.js'; - export default class DashToPanelExtension extends Extension { constructor(metadata) { super(metadata); From 9c12d7908cf961ab8f55a05b4b2f96ceb40e287a Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Sun, 13 Aug 2023 17:35:28 +0200 Subject: [PATCH 07/58] migrate signals imports to new ESM format --- appIcons.js | 2 +- extension.js | 2 +- progress.js | 2 +- taskbar.js | 2 +- windowPreview.js | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/appIcons.js b/appIcons.js index 49cf839..4077b74 100644 --- a/appIcons.js +++ b/appIcons.js @@ -27,7 +27,7 @@ import Gio from 'gi://Gio'; import GLib from 'gi://GLib'; import Gtk from 'gi://Gtk'; import GObject from 'gi://GObject'; -const Signals = imports.signals; +import * as Signals from 'resource:///org/gnome/shell/misc/signals.js'; import Meta from 'gi://Meta'; import Shell from 'gi://Shell'; import St from 'gi://St'; diff --git a/extension.js b/extension.js index da16004..a66b7dc 100644 --- a/extension.js +++ b/extension.js @@ -27,7 +27,7 @@ import St from 'gi://St'; import * as WindowManager from 'resource:///org/gnome/shell/ui/windowManager.js'; import * as ExtensionUtils from 'resource:///org/gnome/shell/misc/extensionUtils.js';; const Mainloop = imports.mainloop; -const Signals = imports.signals; +import * as Signals from 'resource:///org/gnome/shell/misc/signals.js'; import * as PanelManager from './panelManager.js'; import * as Utils from './utils.js'; diff --git a/progress.js b/progress.js index d3a121b..dc02fd9 100644 --- a/progress.js +++ b/progress.js @@ -24,7 +24,7 @@ const Cairo = imports.cairo; import Clutter from 'gi://Clutter'; import Pango from 'gi://Pango'; import St from 'gi://St'; -const Signals = imports.signals; +import * as Signals from 'resource:///org/gnome/shell/misc/signals.js'; import * as Utils from './utils.js'; diff --git a/taskbar.js b/taskbar.js index 19ce02c..e089317 100644 --- a/taskbar.js +++ b/taskbar.js @@ -27,7 +27,7 @@ import Gio from 'gi://Gio'; import GLib from 'gi://GLib'; import GObject from 'gi://GObject'; import Gtk from 'gi://Gtk'; -const Signals = imports.signals; +import * as Signals from 'resource:///org/gnome/shell/misc/signals.js'; import Meta from 'gi://Meta'; import Shell from 'gi://Shell'; import St from 'gi://St'; diff --git a/windowPreview.js b/windowPreview.js index 06b22c9..4d1c1a7 100644 --- a/windowPreview.js +++ b/windowPreview.js @@ -24,7 +24,7 @@ import * as Main from 'resource:///org/gnome/shell/ui/main.js'; const Mainloop = imports.mainloop; import Meta from 'gi://Meta'; import * as PopupMenu from 'resource:///org/gnome/shell/ui/popupMenu.js'; -const Signals = imports.signals; +import * as Signals from 'resource:///org/gnome/shell/misc/signals.js'; import St from 'gi://St'; import * as WindowManager from 'resource:///org/gnome/shell/ui/windowManager.js'; import * as Workspace from 'resource:///org/gnome/shell/ui/workspace.js'; From 7eedebca38ccdc61ffc1800f63dcbc4cf1f4fa89 Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Sun, 13 Aug 2023 20:04:49 +0200 Subject: [PATCH 08/58] export functions and vars in panelPosition.js and paneSettings.js --- panelPositions.js | 46 +++++++++++++++++++++++----------------------- panelSettings.js | 20 ++++++++++---------- 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/panelPositions.js b/panelPositions.js index 52458bb..37bffc2 100644 --- a/panelPositions.js +++ b/panelPositions.js @@ -15,31 +15,31 @@ * along with this program. If not, see . */ -var SHOW_APPS_BTN = 'showAppsButton'; -var ACTIVITIES_BTN = 'activitiesButton'; -var TASKBAR = 'taskbar'; -var DATE_MENU = 'dateMenu'; -var SYSTEM_MENU = 'systemMenu'; -var LEFT_BOX = 'leftBox'; -var CENTER_BOX = 'centerBox'; -var RIGHT_BOX = 'rightBox'; -var DESKTOP_BTN = 'desktopButton'; +export var SHOW_APPS_BTN = 'showAppsButton'; +export var ACTIVITIES_BTN = 'activitiesButton'; +export var TASKBAR = 'taskbar'; +export var DATE_MENU = 'dateMenu'; +export var SYSTEM_MENU = 'systemMenu'; +export var LEFT_BOX = 'leftBox'; +export var CENTER_BOX = 'centerBox'; +export var RIGHT_BOX = 'rightBox'; +export var DESKTOP_BTN = 'desktopButton'; -var STACKED_TL = 'stackedTL'; -var STACKED_BR = 'stackedBR'; -var CENTERED = 'centered'; -var CENTERED_MONITOR = 'centerMonitor'; +export var STACKED_TL = 'stackedTL'; +export var STACKED_BR = 'stackedBR'; +export var CENTERED = 'centered'; +export var CENTERED_MONITOR = 'centerMonitor'; -var TOP = 'TOP'; -var BOTTOM = 'BOTTOM'; -var LEFT = 'LEFT'; -var RIGHT = 'RIGHT'; +export var TOP = 'TOP'; +export var BOTTOM = 'BOTTOM'; +export var LEFT = 'LEFT'; +export var RIGHT = 'RIGHT'; -var START = 'START'; -var MIDDLE = 'MIDDLE'; -var END = 'END'; +export var START = 'START'; +export var MIDDLE = 'MIDDLE'; +export var END = 'END'; -var defaults = [ +export var defaults = [ { element: SHOW_APPS_BTN, visible: true, position: STACKED_TL }, { element: ACTIVITIES_BTN, visible: false, position: STACKED_TL }, { element: LEFT_BOX, visible: true, position: STACKED_TL }, @@ -51,11 +51,11 @@ var defaults = [ { element: DESKTOP_BTN, visible: true, position: STACKED_BR }, ]; -var optionDialogFunctions = {}; +export var optionDialogFunctions = {}; optionDialogFunctions[SHOW_APPS_BTN] = '_showShowAppsButtonOptions'; optionDialogFunctions[DESKTOP_BTN] = '_showDesktopButtonOptions'; -function checkIfCentered(position) { +export function checkIfCentered(position) { return position == CENTERED || position == CENTERED_MONITOR; } \ No newline at end of file diff --git a/panelSettings.js b/panelSettings.js index 0f07057..fc2d60c 100644 --- a/panelSettings.js +++ b/panelSettings.js @@ -18,7 +18,7 @@ import * as Pos from './panelPositions.js'; /** Return object representing a settings value that is stored as JSON. */ -function getSettingsJson(settings, setting) { +export function getSettingsJson(settings, setting) { try { return JSON.parse(settings.get_string(setting)); } catch(e) { @@ -26,7 +26,7 @@ function getSettingsJson(settings, setting) { } } /** Write value object as JSON to setting in settings. */ -function setSettingsJson(settings, setting, value) { +export function setSettingsJson(settings, setting, value) { try { const json = JSON.stringify(value); settings.set_string(setting, json); @@ -36,7 +36,7 @@ function setSettingsJson(settings, setting, value) { } /** Returns size of panel on a specific monitor, in pixels. */ -function getPanelSize(settings, monitorIndex) { +export function getPanelSize(settings, monitorIndex) { const sizes = getSettingsJson(settings, 'panel-sizes'); // Pull in deprecated setting if panel-sizes does not have setting for monitor. const fallbackSize = settings.get_int('panel-size'); @@ -44,7 +44,7 @@ function getPanelSize(settings, monitorIndex) { return sizes[monitorIndex] || fallbackSize || theDefault; } -function setPanelSize(settings, monitorIndex, value) { +export function setPanelSize(settings, monitorIndex, value) { if (!(Number.isInteger(value) && value <= 128 && value >= 16)) { log('Not setting invalid panel size: ' + value); return; @@ -58,13 +58,13 @@ function setPanelSize(settings, monitorIndex, value) { * Returns length of panel on a specific monitor, as a whole number percent, * from settings. e.g. 100 */ -function getPanelLength(settings, monitorIndex) { +export function getPanelLength(settings, monitorIndex) { const lengths = getSettingsJson(settings, 'panel-lengths'); const theDefault = 100; return lengths[monitorIndex] || theDefault; } -function setPanelLength(settings, monitorIndex, value) { +export function setPanelLength(settings, monitorIndex, value) { if (!(Number.isInteger(value) && value <= 100 && value >= 0)) { log('Not setting invalid panel length: ' + value); return; @@ -75,14 +75,14 @@ function setPanelLength(settings, monitorIndex, value) { } /** Returns position of panel on a specific monitor. */ -function getPanelPosition(settings, monitorIndex) { +export function getPanelPosition(settings, monitorIndex) { const positions = getSettingsJson(settings, 'panel-positions'); const fallbackPosition = settings.get_string('panel-position'); const theDefault = Pos.BOTTOM; return positions[monitorIndex] || fallbackPosition || theDefault; } -function setPanelPosition(settings, monitorIndex, value) { +export function setPanelPosition(settings, monitorIndex, value) { if (!(value === Pos.TOP || value === Pos.BOTTOM || value === Pos.LEFT || value === Pos.RIGHT)) { log('Not setting invalid panel position: ' + value); @@ -94,13 +94,13 @@ function setPanelPosition(settings, monitorIndex, value) { } /** Returns anchor location of panel on a specific monitor. */ -function getPanelAnchor(settings, monitorIndex) { +export function getPanelAnchor(settings, monitorIndex) { const anchors = getSettingsJson(settings, 'panel-anchors'); const theDefault = Pos.MIDDLE; return anchors[monitorIndex] || theDefault; } -function setPanelAnchor(settings, monitorIndex, value) { +export function setPanelAnchor(settings, monitorIndex, value) { if (!(value === Pos.START || value === Pos.MIDDLE || value === Pos.END)) { log('Not setting invalid panel anchor: ' + value); return; From 9a3d3156388100fb7d21b2097a4e020e0a41325f Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Sun, 13 Aug 2023 20:10:23 +0200 Subject: [PATCH 09/58] fix imports in prefs.js --- prefs.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/prefs.js b/prefs.js index 8d09130..6b0eac6 100644 --- a/prefs.js +++ b/prefs.js @@ -27,17 +27,16 @@ import GObject from 'gi://GObject'; import Gtk from 'gi://Gtk'; import Adw from 'gi://Adw'; import Gdk from 'gi://Gdk'; -const Mainloop = imports.mainloop; -import * as ExtensionUtils from 'resource:///org/gnome/shell/misc/extensionUtils.js';; -const Gettext = imports.gettext.domain(Me.metadata['gettext-domain']); -const _ = Gettext.gettext; -const N_ = function(e) { return e }; import * as PanelSettings from './panelSettings.js'; import * as Pos from './panelPositions.js'; import {ExtensionPreferences, gettext as _} from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js'; +const Mainloop = imports.mainloop; + +const N_ = function(e) { return e }; + const SCALE_UPDATE_TIMEOUT = 500; const DEFAULT_PANEL_SIZES = [ 128, 96, 64, 48, 32, 24, 16 ]; const DEFAULT_FONT_SIZES = [ 96, 64, 48, 32, 24, 16, 0 ]; @@ -2341,4 +2340,4 @@ export default class DashToPanelPreferences extends ExtensionPreferences { let preferences = new Preferences(window); } -} \ No newline at end of file +} From ef93bd908b7783031109dcea80e8c34d7a8d9b22 Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Sun, 13 Aug 2023 20:12:56 +0200 Subject: [PATCH 10/58] fix paths and settings in prefs.js --- prefs.js | 51 ++++++++++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/prefs.js b/prefs.js index 6b0eac6..b580a0c 100644 --- a/prefs.js +++ b/prefs.js @@ -158,53 +158,54 @@ function mergeObjects(main, bck) { const Preferences = class { - constructor(window) { - this._settings = ExtensionUtils.getSettings('org.gnome.shell.extensions.dash-to-panel'); + constructor(window, settings, path) { + // this._settings = ExtensionUtils.getSettings('org.gnome.shell.extensions.dash-to-panel'); this._rtl = (Gtk.Widget.get_default_direction() == Gtk.TextDirection.RTL); this._builder = new Gtk.Builder(); this._builder.set_scope(new BuilderScope(this)); - this._builder.set_translation_domain(Me.metadata['gettext-domain']); + this._settings = settings + this._path = path window.set_search_enabled(true); // dialogs - this._builder.add_from_file(Me.path + '/ui/BoxAnimateAppIconHoverOptions.ui'); - this._builder.add_from_file(Me.path + '/ui/BoxDotOptions.ui'); - this._builder.add_from_file(Me.path + '/ui/BoxShowDesktopOptions.ui'); - this._builder.add_from_file(Me.path + '/ui/BoxDynamicOpacityOptions.ui'); - this._builder.add_from_file(Me.path + '/ui/BoxIntellihideOptions.ui'); - this._builder.add_from_file(Me.path + '/ui/BoxShowApplicationsOptions.ui'); - this._builder.add_from_file(Me.path + '/ui/BoxWindowPreviewOptions.ui'); - this._builder.add_from_file(Me.path + '/ui/BoxGroupAppsOptions.ui'); - this._builder.add_from_file(Me.path + '/ui/BoxMiddleClickOptions.ui'); - this._builder.add_from_file(Me.path + '/ui/BoxOverlayShortcut.ui'); - this._builder.add_from_file(Me.path + '/ui/BoxSecondaryMenuOptions.ui'); - this._builder.add_from_file(Me.path + '/ui/BoxScrollPanelOptions.ui'); - this._builder.add_from_file(Me.path + '/ui/BoxScrollIconOptions.ui'); - this._builder.add_from_file(Me.path + '/ui/BoxAdvancedOptions.ui'); + this._builder.add_from_file(this._path + '/ui/BoxAnimateAppIconHoverOptions.ui'); + this._builder.add_from_file(this._path + '/ui/BoxDotOptions.ui'); + this._builder.add_from_file(this._path + '/ui/BoxShowDesktopOptions.ui'); + this._builder.add_from_file(this._path + '/ui/BoxDynamicOpacityOptions.ui'); + this._builder.add_from_file(this._path + '/ui/BoxIntellihideOptions.ui'); + this._builder.add_from_file(this._path + '/ui/BoxShowApplicationsOptions.ui'); + this._builder.add_from_file(this._path + '/ui/BoxWindowPreviewOptions.ui'); + this._builder.add_from_file(this._path + '/ui/BoxGroupAppsOptions.ui'); + this._builder.add_from_file(this._path + '/ui/BoxMiddleClickOptions.ui'); + this._builder.add_from_file(this._path + '/ui/BoxOverlayShortcut.ui'); + this._builder.add_from_file(this._path + '/ui/BoxSecondaryMenuOptions.ui'); + this._builder.add_from_file(this._path + '/ui/BoxScrollPanelOptions.ui'); + this._builder.add_from_file(this._path + '/ui/BoxScrollIconOptions.ui'); + this._builder.add_from_file(this._path + '/ui/BoxAdvancedOptions.ui'); // pages - this._builder.add_from_file(Me.path + '/ui/SettingsPosition.ui'); + this._builder.add_from_file(this._path + '/ui/SettingsPosition.ui'); let pagePosition = this._builder.get_object('position'); window.add(pagePosition); - this._builder.add_from_file(Me.path + '/ui/SettingsStyle.ui'); + this._builder.add_from_file(this._path + '/ui/SettingsStyle.ui'); let pageStyle = this._builder.get_object('style'); window.add(pageStyle); - this._builder.add_from_file(Me.path + '/ui/SettingsBehavior.ui'); + this._builder.add_from_file(this._path + '/ui/SettingsBehavior.ui'); let pageBehavior = this._builder.get_object('behavior'); window.add(pageBehavior); - this._builder.add_from_file(Me.path + '/ui/SettingsAction.ui'); + this._builder.add_from_file(this._path + '/ui/SettingsAction.ui'); let pageAction = this._builder.get_object('action'); window.add(pageAction); - this._builder.add_from_file(Me.path + '/ui/SettingsFineTune.ui'); + this._builder.add_from_file(this._path + '/ui/SettingsFineTune.ui'); let pageFineTune = this._builder.get_object('finetune'); window.add(pageFineTune); - this._builder.add_from_file(Me.path + '/ui/SettingsAbout.ui'); + this._builder.add_from_file(this._path + '/ui/SettingsAbout.ui'); let pageAbout = this._builder.get_object('about'); window.add(pageAbout); @@ -2332,12 +2333,12 @@ const BuilderScope = GObject.registerClass({ export default class DashToPanelPreferences extends ExtensionPreferences { fillPreferencesWindow(window) { - window._settings = this.getSettings(); + window._settings = this.getSettings('org.gnome.shell.extensions.dash-to-panel'); this.initTranslations(); // use default width or window window.set_default_size(0, 740); - let preferences = new Preferences(window); + let preferences = new Preferences(window, window._settings, this.path); } } From f843af865102c7b709f454dc47c902f9cd521609 Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Sun, 13 Aug 2023 20:14:25 +0200 Subject: [PATCH 11/58] mark settings variables as TODO for now --- prefs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prefs.js b/prefs.js index b580a0c..a4a83ea 100644 --- a/prefs.js +++ b/prefs.js @@ -2082,7 +2082,7 @@ const Preferences = class { // About Panel - this._builder.get_object('extension_version').set_label(Me.metadata.version.toString() + (Me.metadata.commit ? ' (' + Me.metadata.commit + ')' : '')); + // TODO this._builder.get_object('extension_version').set_label(this._settings.version.toString() + (this._settings.commit ? ' (' + this._settings.commit + ')' : '')); this._builder.get_object('importexport_export_button').connect('clicked', widget => { this._showFileChooser( From bc60959709e85b3cbb4ac3731d5944ecde2365b4 Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Sun, 13 Aug 2023 20:32:43 +0200 Subject: [PATCH 12/58] move all imports to the top --- appIcons.js | 6 ++---- desktopIconsIntegration.js | 2 +- extension.js | 3 ++- panel.js | 7 ++++--- panelManager.js | 3 ++- panelStyle.js | 3 ++- progress.js | 3 ++- taskbar.js | 8 +++++--- utils.js | 5 +++-- windowPreview.js | 3 ++- 10 files changed, 25 insertions(+), 18 deletions(-) diff --git a/appIcons.js b/appIcons.js index 4077b74..159f73e 100644 --- a/appIcons.js +++ b/appIcons.js @@ -31,14 +31,10 @@ import * as Signals from 'resource:///org/gnome/shell/misc/signals.js'; import Meta from 'gi://Meta'; import Shell from 'gi://Shell'; import St from 'gi://St'; -const Mainloop = imports.mainloop; import * as Config from 'resource:///org/gnome/shell/misc/config.js'; import * as AppDisplay from 'resource:///org/gnome/shell/ui/appDisplay.js'; import * as AppMenu from 'resource:///org/gnome/shell/ui/appMenu.js'; -if (Config.PACKAGE_VERSION < '42') { -const AppMenu = imports.ui.appDisplay; -} import * as AppFavorites from 'resource:///org/gnome/shell/ui/appFavorites.js'; import * as Dash from 'resource:///org/gnome/shell/ui/dash.js'; import * as DND from 'resource:///org/gnome/shell/ui/dnd.js'; @@ -56,6 +52,8 @@ import * as Taskbar from './taskbar.js'; import * as Progress from './progress.js'; const _ = imports.gettext.domain(Utils.TRANSLATION_DOMAIN).gettext; +const Mainloop = imports.mainloop; + //timeout names const T2 = 'mouseScrollTimeout'; const T3 = 'showDotsTimeout'; diff --git a/desktopIconsIntegration.js b/desktopIconsIntegration.js index 77a4540..8ecd339 100644 --- a/desktopIconsIntegration.js +++ b/desktopIconsIntegration.js @@ -58,7 +58,7 @@ import GLib from 'gi://GLib'; import * as Main from 'resource:///org/gnome/shell/ui/main.js'; -import * as ExtensionUtils from 'resource:///org/gnome/shell/misc/extensionUtils.js';; +import * as ExtensionUtils from 'resource:///org/gnome/shell/misc/extensionUtils.js'; const IDENTIFIER_UUID = "130cbc66-235c-4bd6-8571-98d2d8bba5e2"; diff --git a/extension.js b/extension.js index a66b7dc..18a0ed5 100644 --- a/extension.js +++ b/extension.js @@ -26,7 +26,6 @@ import Shell from 'gi://Shell'; import St from 'gi://St'; import * as WindowManager from 'resource:///org/gnome/shell/ui/windowManager.js'; import * as ExtensionUtils from 'resource:///org/gnome/shell/misc/extensionUtils.js';; -const Mainloop = imports.mainloop; import * as Signals from 'resource:///org/gnome/shell/misc/signals.js'; import * as PanelManager from './panelManager.js'; @@ -35,6 +34,8 @@ import * as AppIcons from './appIcons.js'; import {Extension, gettext as _} from 'resource:///org/gnome/shell/extensions/extension.js'; +const Mainloop = imports.mainloop; + const UBUNTU_DOCK_UUID = 'ubuntu-dock@ubuntu.com'; let panelManager; diff --git a/panel.js b/panel.js index c425598..760bdf7 100644 --- a/panel.js +++ b/panel.js @@ -31,7 +31,6 @@ import Clutter from 'gi://Clutter'; import * as Config from 'resource:///org/gnome/shell/misc/config.js'; import Gtk from 'gi://Gtk'; import GObject from 'gi://GObject'; -const Gi = imports._gi; import * as AppIcons from './appIcons.js'; import * as Utils from './utils.js'; import * as Taskbar from './taskbar.js'; @@ -40,7 +39,6 @@ import * as Pos from './panelPositions.js'; import * as PanelSettings from './panelSettings.js'; import * as PanelStyle from './panelStyle.js'; import * as Main from 'resource:///org/gnome/shell/ui/main.js'; -const Mainloop = imports.mainloop; import * as Dash from 'resource:///org/gnome/shell/ui/dash.js'; import * as CtrlAltTab from 'resource:///org/gnome/shell/ui/ctrlAltTab.js'; import * as GSPanel from 'resource:///org/gnome/shell/ui/panel.js'; @@ -54,13 +52,16 @@ import Shell from 'gi://Shell'; import * as PopupMenu from 'resource:///org/gnome/shell/ui/popupMenu.js'; import * as IconGrid from 'resource:///org/gnome/shell/ui/iconGrid.js'; import * as DateMenu from 'resource:///org/gnome/shell/ui/dateMenu.js'; -import * as Volume from 'resource:///org/gnome/shell/ui/volume.js'; +import * as Volume from 'resource:///org/gnome/shell/ui/status/volume.js'; import * as Progress from './progress.js'; import * as Intellihide from './intellihide.js'; import * as Transparency from './transparency.js'; const _ = imports.gettext.domain(Me.imports.utils.TRANSLATION_DOMAIN).gettext; +const Mainloop = imports.mainloop; +const Gi = imports._gi; + let tracker = Shell.WindowTracker.get_default(); var panelBoxes = ['_leftBox', '_centerBox', '_rightBox']; diff --git a/panelManager.js b/panelManager.js index 3e95192..db65750 100755 --- a/panelManager.js +++ b/panelManager.js @@ -36,7 +36,6 @@ import * as Taskbar from './taskbar.js'; import * as Utils from './utils.js'; import * as DesktopIconsIntegration from './desktopIconsIntegration.js'; -const Gi = imports._gi; import GLib from 'gi://GLib'; import GObject from 'gi://GObject'; import Clutter from 'gi://Clutter'; @@ -55,6 +54,8 @@ import * as Layout from 'resource:///org/gnome/shell/ui/layout.js'; import * as WM from 'resource:///org/gnome/shell/ui/windowManager.js'; import { SecondaryMonitorDisplay, WorkspacesView } from 'resource:///org/gnome/shell/ui/workspacesView.js'; +const Gi = imports._gi; + var PanelManager = class { constructor() { diff --git a/panelStyle.js b/panelStyle.js index 28d1703..d0a28d7 100644 --- a/panelStyle.js +++ b/panelStyle.js @@ -23,7 +23,6 @@ import * as ExtensionUtils from 'resource:///org/gnome/shell/misc/extensionUtils.js';; import * as Main from 'resource:///org/gnome/shell/ui/main.js'; -const Mainloop = imports.mainloop; import St from 'gi://St'; import Shell from 'gi://Shell'; @@ -31,6 +30,8 @@ import * as Panel from './panel.js'; import * as Taskbar from './taskbar.js'; import * as Utils from './utils.js'; +const Mainloop = imports.mainloop; + var PanelStyle = class { enable(panel) { diff --git a/progress.js b/progress.js index dc02fd9..6ee56be 100644 --- a/progress.js +++ b/progress.js @@ -20,13 +20,14 @@ */ import Gio from 'gi://Gio'; -const Cairo = imports.cairo; import Clutter from 'gi://Clutter'; import Pango from 'gi://Pango'; import St from 'gi://St'; import * as Signals from 'resource:///org/gnome/shell/misc/signals.js'; import * as Utils from './utils.js'; +const Cairo = imports.cairo; + var ProgressManager = class { diff --git a/taskbar.js b/taskbar.js index e089317..04fc3fe 100644 --- a/taskbar.js +++ b/taskbar.js @@ -31,10 +31,7 @@ import * as Signals from 'resource:///org/gnome/shell/misc/signals.js'; import Meta from 'gi://Meta'; import Shell from 'gi://Shell'; import St from 'gi://St'; -const Mainloop = imports.mainloop; -const SearchController = imports.ui.main.overview._overview._controls._searchController; -const AppDisplay = imports.ui.main.overview._overview._controls.appDisplay; import * as AppFavorites from 'resource:///org/gnome/shell/ui/appFavorites.js'; import * as Dash from 'resource:///org/gnome/shell/ui/dash.js'; import * as DND from 'resource:///org/gnome/shell/ui/dnd.js'; @@ -51,6 +48,11 @@ import * as Pos from './panelPositions.js'; import * as Utils from './utils.js'; import * as WindowPreview from './windowPreview.js'; +const Mainloop = imports.mainloop; + +const SearchController = imports.ui.main.overview._overview._controls._searchController; +const AppDisplay = imports.ui.main.overview._overview._controls.appDisplay; + var DASH_ANIMATION_TIME = Dash.DASH_ANIMATION_TIME / (Dash.DASH_ANIMATION_TIME > 1 ? 1000 : 1); var DASH_ITEM_HOVER_TIMEOUT = Dash.DASH_ITEM_HOVER_TIMEOUT; var MIN_ICON_SIZE = 4; diff --git a/utils.js b/utils.js index a15544b..139a75d 100644 --- a/utils.js +++ b/utils.js @@ -23,19 +23,20 @@ import Clutter from 'gi://Clutter'; import GdkPixbuf from 'gi://GdkPixbuf'; -const Gi = imports._gi; import Gio from 'gi://Gio'; import GLib from 'gi://GLib'; import Gtk from 'gi://Gtk'; import Meta from 'gi://Meta'; import Shell from 'gi://Shell'; import St from 'gi://St'; -const Mainloop = imports.mainloop; import * as Config from 'resource:///org/gnome/shell/misc/config.js'; import * as Util from 'resource:///org/gnome/shell/misc/util.js'; import * as Main from 'resource:///org/gnome/shell/ui/main.js'; import * as MessageTray from 'resource:///org/gnome/shell/ui/messageTray.js'; +const Gi = imports._gi; +const Mainloop = imports.mainloop; + var TRANSLATION_DOMAIN = imports.misc.extensionUtils.getCurrentExtension().metadata['gettext-domain']; var SCROLL_TIME = Util.SCROLL_TIME / (Util.SCROLL_TIME > 1 ? 1000 : 1); diff --git a/windowPreview.js b/windowPreview.js index 4d1c1a7..285e978 100644 --- a/windowPreview.js +++ b/windowPreview.js @@ -21,7 +21,6 @@ import GLib from 'gi://GLib'; import Graphene from 'gi://Graphene'; import Gtk from 'gi://Gtk'; import * as Main from 'resource:///org/gnome/shell/ui/main.js'; -const Mainloop = imports.mainloop; import Meta from 'gi://Meta'; import * as PopupMenu from 'resource:///org/gnome/shell/ui/popupMenu.js'; import * as Signals from 'resource:///org/gnome/shell/misc/signals.js'; @@ -33,6 +32,8 @@ import * as Panel from './panel.js'; import * as Taskbar from './taskbar.js'; import * as Utils from './utils.js'; +const Mainloop = imports.mainloop; + //timeout intervals const ENSURE_VISIBLE_MS = 200; From 2931452c1ab1039e01f92fd56407b79f8c9043fe Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Sun, 13 Aug 2023 21:10:14 +0200 Subject: [PATCH 13/58] fix gettext import --- appIcons.js | 2 +- panel.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/appIcons.js b/appIcons.js index 159f73e..f97ee77 100644 --- a/appIcons.js +++ b/appIcons.js @@ -50,7 +50,7 @@ import * as Utils from './utils.js'; import * as PanelSettings from './panelSettings.js'; import * as Taskbar from './taskbar.js'; import * as Progress from './progress.js'; -const _ = imports.gettext.domain(Utils.TRANSLATION_DOMAIN).gettext; +import {gettext as _} from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js'; const Mainloop = imports.mainloop; diff --git a/panel.js b/panel.js index 760bdf7..b59f190 100644 --- a/panel.js +++ b/panel.js @@ -57,7 +57,7 @@ import * as Progress from './progress.js'; import * as Intellihide from './intellihide.js'; import * as Transparency from './transparency.js'; -const _ = imports.gettext.domain(Me.imports.utils.TRANSLATION_DOMAIN).gettext; +import {gettext as _} from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js'; const Mainloop = imports.mainloop; const Gi = imports._gi; From 1dbad460e46ce905ce487ae191ddff9f568c407b Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Sun, 13 Aug 2023 22:45:43 +0200 Subject: [PATCH 14/58] revert Signals import back --- appIcons.js | 2 +- extension.js | 2 +- progress.js | 2 +- taskbar.js | 2 +- windowPreview.js | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/appIcons.js b/appIcons.js index f97ee77..26d5960 100644 --- a/appIcons.js +++ b/appIcons.js @@ -27,7 +27,6 @@ import Gio from 'gi://Gio'; import GLib from 'gi://GLib'; import Gtk from 'gi://Gtk'; import GObject from 'gi://GObject'; -import * as Signals from 'resource:///org/gnome/shell/misc/signals.js'; import Meta from 'gi://Meta'; import Shell from 'gi://Shell'; import St from 'gi://St'; @@ -53,6 +52,7 @@ import * as Progress from './progress.js'; import {gettext as _} from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js'; const Mainloop = imports.mainloop; +const Signals = imports.signals; //timeout names const T2 = 'mouseScrollTimeout'; diff --git a/extension.js b/extension.js index 18a0ed5..5e240c6 100644 --- a/extension.js +++ b/extension.js @@ -26,7 +26,6 @@ import Shell from 'gi://Shell'; import St from 'gi://St'; import * as WindowManager from 'resource:///org/gnome/shell/ui/windowManager.js'; import * as ExtensionUtils from 'resource:///org/gnome/shell/misc/extensionUtils.js';; -import * as Signals from 'resource:///org/gnome/shell/misc/signals.js'; import * as PanelManager from './panelManager.js'; import * as Utils from './utils.js'; @@ -35,6 +34,7 @@ import * as AppIcons from './appIcons.js'; import {Extension, gettext as _} from 'resource:///org/gnome/shell/extensions/extension.js'; const Mainloop = imports.mainloop; +const Signals = imports.signals; const UBUNTU_DOCK_UUID = 'ubuntu-dock@ubuntu.com'; diff --git a/progress.js b/progress.js index 6ee56be..d5fc20f 100644 --- a/progress.js +++ b/progress.js @@ -23,10 +23,10 @@ import Gio from 'gi://Gio'; import Clutter from 'gi://Clutter'; import Pango from 'gi://Pango'; import St from 'gi://St'; -import * as Signals from 'resource:///org/gnome/shell/misc/signals.js'; import * as Utils from './utils.js'; const Cairo = imports.cairo; +const Signals = imports.signals; var ProgressManager = class { diff --git a/taskbar.js b/taskbar.js index 04fc3fe..9eeb452 100644 --- a/taskbar.js +++ b/taskbar.js @@ -27,7 +27,6 @@ import Gio from 'gi://Gio'; import GLib from 'gi://GLib'; import GObject from 'gi://GObject'; import Gtk from 'gi://Gtk'; -import * as Signals from 'resource:///org/gnome/shell/misc/signals.js'; import Meta from 'gi://Meta'; import Shell from 'gi://Shell'; import St from 'gi://St'; @@ -49,6 +48,7 @@ import * as Utils from './utils.js'; import * as WindowPreview from './windowPreview.js'; const Mainloop = imports.mainloop; +const Signals = imports.signals; const SearchController = imports.ui.main.overview._overview._controls._searchController; const AppDisplay = imports.ui.main.overview._overview._controls.appDisplay; diff --git a/windowPreview.js b/windowPreview.js index 285e978..4efae2f 100644 --- a/windowPreview.js +++ b/windowPreview.js @@ -23,7 +23,6 @@ import Gtk from 'gi://Gtk'; import * as Main from 'resource:///org/gnome/shell/ui/main.js'; import Meta from 'gi://Meta'; import * as PopupMenu from 'resource:///org/gnome/shell/ui/popupMenu.js'; -import * as Signals from 'resource:///org/gnome/shell/misc/signals.js'; import St from 'gi://St'; import * as WindowManager from 'resource:///org/gnome/shell/ui/windowManager.js'; import * as Workspace from 'resource:///org/gnome/shell/ui/workspace.js'; @@ -33,6 +32,7 @@ import * as Taskbar from './taskbar.js'; import * as Utils from './utils.js'; const Mainloop = imports.mainloop; +const Signals = imports.signals; //timeout intervals const ENSURE_VISIBLE_MS = 200; From 3cec4d7135407c5a931bac4e81154f56f69325b5 Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Sun, 13 Aug 2023 22:47:02 +0200 Subject: [PATCH 15/58] comment Signals.addSignalMethods for now --- appIcons.js | 2 +- extension.js | 2 +- progress.js | 4 ++-- taskbar.js | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/appIcons.js b/appIcons.js index 26d5960..adbdc9c 100644 --- a/appIcons.js +++ b/appIcons.js @@ -1730,7 +1730,7 @@ function ItemShowLabel() { this.realShowAppsIcon.destroy(); } }; -Signals.addSignalMethods(ShowAppsIconWrapper.prototype); +// Signals.addSignalMethods(ShowAppsIconWrapper.prototype); /** * A menu for the showAppsIcon diff --git a/extension.js b/extension.js index 5e240c6..f3b8360 100644 --- a/extension.js +++ b/extension.js @@ -69,7 +69,7 @@ export default class DashToPanelExtension extends Extension { //create a global object that can emit signals and conveniently expose functionalities to other extensions global.dashToPanel = {}; - Signals.addSignalMethods(global.dashToPanel); + // Signals.addSignalMethods(global.dashToPanel); _enable(); } diff --git a/progress.js b/progress.js index d5fc20f..4c2f062 100644 --- a/progress.js +++ b/progress.js @@ -162,7 +162,7 @@ var ProgressManager = class { } } }; -Signals.addSignalMethods(ProgressManager.prototype); +// Signals.addSignalMethods(ProgressManager.prototype); class AppProgress { @@ -277,7 +277,7 @@ class AppProgress { } } }; -Signals.addSignalMethods(AppProgress.prototype); +// Signals.addSignalMethods(AppProgress.prototype); var ProgressIndicator = class { diff --git a/taskbar.js b/taskbar.js index 9eeb452..e288193 100644 --- a/taskbar.js +++ b/taskbar.js @@ -1324,7 +1324,7 @@ var Taskbar = class { } }; -Signals.addSignalMethods(Taskbar.prototype); +// Signals.addSignalMethods(Taskbar.prototype); const CloneContainerConstraint = GObject.registerClass({ }, class CloneContainerConstraint extends Clutter.BindConstraint { From d634f0cdfd3b1185ed64cdb64304643942e87e82 Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Sun, 13 Aug 2023 22:57:43 +0200 Subject: [PATCH 16/58] export settings and persistant storage --- extension.js | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/extension.js b/extension.js index f3b8360..245adb2 100644 --- a/extension.js +++ b/extension.js @@ -43,6 +43,10 @@ let extensionChangedHandler; let disabledUbuntuDock; let extensionSystem = (Main.extensionManager || imports.ui.extensionSystem); +export var SETTINGS = null; +export var DESKTOPSETTINGS = null; +export var PERSISTENTSTORAGE = null; + export default class DashToPanelExtension extends Extension { constructor(metadata) { super(metadata); @@ -50,20 +54,19 @@ export default class DashToPanelExtension extends Extension { this._realHasOverview = Main.sessionMode.hasOverview; - ExtensionUtils.initTranslations(Utils.TRANSLATION_DOMAIN); + this.initTranslations(); //create an object that persists until gnome-shell is restarted, even if the extension is disabled - Me.persistentStorage = {}; + PERSISTENTSTORAGE = {}; } enable() { - this._settings = this.getSettings(); console.log(_('This is a translatable text')); // The Ubuntu Dock extension might get enabled after this extension extensionChangedHandler = extensionSystem.connect('extension-state-changed', (data, extension) => { if (extension.uuid === UBUNTU_DOCK_UUID && extension.state === 1) { - _enable(); + _enable(this); } }); @@ -71,7 +74,7 @@ export default class DashToPanelExtension extends Extension { global.dashToPanel = {}; // Signals.addSignalMethods(global.dashToPanel); - _enable(); + _enable(this); } disable() { @@ -79,7 +82,7 @@ export default class DashToPanelExtension extends Extension { panelManager.disable(); - this._settings = null; + SETTINGS = null; panelManager = null; Utils.removeKeybinding('open-application-menu'); @@ -106,7 +109,7 @@ export default class DashToPanelExtension extends Extension { } } -function _enable() { +function _enable(extension) { let ubuntuDock = Main.extensionManager ? Main.extensionManager.lookup(UBUNTU_DOCK_UUID) : //gnome-shell >= 3.33.4 ExtensionUtils.extensions[UBUNTU_DOCK_UUID]; @@ -129,12 +132,12 @@ function _enable() { if (panelManager) return; //already initialized - Me.settings = ExtensionUtils.getSettings('org.gnome.shell.extensions.dash-to-panel'); - Me.desktopSettings = ExtensionUtils.getSettings('org.gnome.desktop.interface'); + SETTINGS = extension.getSettings('org.gnome.shell.extensions.dash-to-panel'); + DESKTOPSETTINGS = extension.getSettings('org.gnome.desktop.interface'); - Main.layoutManager.startInOverview = !Me.settings.get_boolean('hide-overview-on-startup'); + Main.layoutManager.startInOverview = !SETTINGS.get_boolean('hide-overview-on-startup'); - if (Me.settings.get_boolean('hide-overview-on-startup') && Main.layoutManager._startingUp) { + if (SETTINGS.get_boolean('hide-overview-on-startup') && Main.layoutManager._startingUp) { Main.sessionMode.hasOverview = false; Main.layoutManager.connect('startup-complete', () => { Main.sessionMode.hasOverview = this._realHasOverview @@ -150,7 +153,7 @@ function _enable() { 'open-application-menu', new Gio.Settings({ schema_id: WindowManager.SHELL_KEYBINDINGS_SCHEMA }), () => { - if(Me.settings.get_boolean('show-appmenu')) + if(SETTINGS.get_boolean('show-appmenu')) Main.wm._toggleAppMenu(); else panelManager.primaryPanel.taskbar.popupFocusedAppSecondaryMenu(); From 84159f5df9aead75828fb61d8fcb51369105920c Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Sun, 13 Aug 2023 22:58:15 +0200 Subject: [PATCH 17/58] use exported settings --- appIcons.js | 193 ++++++++++++++++++++++++----------------------- intellihide.js | 33 ++++---- overview.js | 53 ++++++------- panel.js | 67 ++++++++-------- panelManager.js | 37 ++++----- panelStyle.js | 15 ++-- progress.js | 5 +- taskbar.js | 41 +++++----- transparency.js | 41 +++++----- windowPreview.js | 61 +++++++-------- 10 files changed, 278 insertions(+), 268 deletions(-) diff --git a/appIcons.js b/appIcons.js index adbdc9c..b0193cd 100644 --- a/appIcons.js +++ b/appIcons.js @@ -49,6 +49,7 @@ import * as Utils from './utils.js'; import * as PanelSettings from './panelSettings.js'; import * as Taskbar from './taskbar.js'; import * as Progress from './progress.js'; +import {SETTINGS, DESKTOPSETTINGS} from './extension.js'; import {gettext as _} from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js'; const Mainloop = imports.mainloop; @@ -146,7 +147,7 @@ var TaskbarAppIcon = GObject.registerClass({ this._dot.set_width(0); - this._isGroupApps = Me.settings.get_boolean('group-apps'); + this._isGroupApps = SETTINGS.get_boolean('group-apps'); this._container = new St.Widget({ style_class: 'dtp-container', layout_manager: new Clutter.BinLayout() }); this._dotsContainer = new St.Widget({ layout_manager: new Clutter.BinLayout() }); @@ -203,7 +204,7 @@ var TaskbarAppIcon = GObject.registerClass({ this._stateChangedId = this.app.connect('windows-changed', this.onWindowsChanged.bind(this)); if (!this.window) { - if (Me.settings.get_boolean('isolate-monitors')) { + if (SETTINGS.get_boolean('isolate-monitors')) { this._windowEnteredMonitorId = Utils.DisplayWrapper.getScreen().connect('window-entered-monitor', this.onWindowEnteredOrLeft.bind(this)); this._windowLeftMonitorId = Utils.DisplayWrapper.getScreen().connect('window-left-monitor', this.onWindowEnteredOrLeft.bind(this)); } @@ -229,33 +230,33 @@ var TaskbarAppIcon = GObject.registerClass({ this._hoverChangeId = this.connect('notify::hover', () => this._onAppIconHoverChanged()); this._dtpSettingsSignalIds = [ - Me.settings.connect('changed::animate-appicon-hover', this._onAnimateAppiconHoverChanged.bind(this)), - Me.settings.connect('changed::dot-position', this._settingsChangeRefresh.bind(this)), - Me.settings.connect('changed::dot-size', this._settingsChangeRefresh.bind(this)), - Me.settings.connect('changed::dot-style-focused', this._settingsChangeRefresh.bind(this)), - Me.settings.connect('changed::dot-style-unfocused', this._settingsChangeRefresh.bind(this)), - Me.settings.connect('changed::dot-color-dominant', this._settingsChangeRefresh.bind(this)), - Me.settings.connect('changed::dot-color-override', this._settingsChangeRefresh.bind(this)), - Me.settings.connect('changed::dot-color-1', this._settingsChangeRefresh.bind(this)), - Me.settings.connect('changed::dot-color-2', this._settingsChangeRefresh.bind(this)), - Me.settings.connect('changed::dot-color-3', this._settingsChangeRefresh.bind(this)), - Me.settings.connect('changed::dot-color-4', this._settingsChangeRefresh.bind(this)), - Me.settings.connect('changed::dot-color-unfocused-different', this._settingsChangeRefresh.bind(this)), - Me.settings.connect('changed::dot-color-unfocused-1', this._settingsChangeRefresh.bind(this)), - Me.settings.connect('changed::dot-color-unfocused-2', this._settingsChangeRefresh.bind(this)), - Me.settings.connect('changed::dot-color-unfocused-3', this._settingsChangeRefresh.bind(this)), - Me.settings.connect('changed::dot-color-unfocused-4', this._settingsChangeRefresh.bind(this)), - Me.settings.connect('changed::focus-highlight', this._settingsChangeRefresh.bind(this)), - Me.settings.connect('changed::focus-highlight-dominant', this._settingsChangeRefresh.bind(this)), - Me.settings.connect('changed::focus-highlight-color', this._settingsChangeRefresh.bind(this)), - Me.settings.connect('changed::focus-highlight-opacity', this._settingsChangeRefresh.bind(this)), - Me.settings.connect('changed::group-apps-label-font-size', this._updateWindowTitleStyle.bind(this)), - Me.settings.connect('changed::group-apps-label-font-weight', this._updateWindowTitleStyle.bind(this)), - Me.settings.connect('changed::group-apps-label-font-color', this._updateWindowTitleStyle.bind(this)), - Me.settings.connect('changed::group-apps-label-font-color-minimized', this._updateWindowTitleStyle.bind(this)), - Me.settings.connect('changed::group-apps-label-max-width', this._updateWindowTitleStyle.bind(this)), - Me.settings.connect('changed::group-apps-use-fixed-width', this._updateWindowTitleStyle.bind(this)), - Me.settings.connect('changed::group-apps-underline-unfocused', this._settingsChangeRefresh.bind(this)) + SETTINGS.connect('changed::animate-appicon-hover', this._onAnimateAppiconHoverChanged.bind(this)), + SETTINGS.connect('changed::dot-position', this._settingsChangeRefresh.bind(this)), + SETTINGS.connect('changed::dot-size', this._settingsChangeRefresh.bind(this)), + SETTINGS.connect('changed::dot-style-focused', this._settingsChangeRefresh.bind(this)), + SETTINGS.connect('changed::dot-style-unfocused', this._settingsChangeRefresh.bind(this)), + SETTINGS.connect('changed::dot-color-dominant', this._settingsChangeRefresh.bind(this)), + SETTINGS.connect('changed::dot-color-override', this._settingsChangeRefresh.bind(this)), + SETTINGS.connect('changed::dot-color-1', this._settingsChangeRefresh.bind(this)), + SETTINGS.connect('changed::dot-color-2', this._settingsChangeRefresh.bind(this)), + SETTINGS.connect('changed::dot-color-3', this._settingsChangeRefresh.bind(this)), + SETTINGS.connect('changed::dot-color-4', this._settingsChangeRefresh.bind(this)), + SETTINGS.connect('changed::dot-color-unfocused-different', this._settingsChangeRefresh.bind(this)), + SETTINGS.connect('changed::dot-color-unfocused-1', this._settingsChangeRefresh.bind(this)), + SETTINGS.connect('changed::dot-color-unfocused-2', this._settingsChangeRefresh.bind(this)), + SETTINGS.connect('changed::dot-color-unfocused-3', this._settingsChangeRefresh.bind(this)), + SETTINGS.connect('changed::dot-color-unfocused-4', this._settingsChangeRefresh.bind(this)), + SETTINGS.connect('changed::focus-highlight', this._settingsChangeRefresh.bind(this)), + SETTINGS.connect('changed::focus-highlight-dominant', this._settingsChangeRefresh.bind(this)), + SETTINGS.connect('changed::focus-highlight-color', this._settingsChangeRefresh.bind(this)), + SETTINGS.connect('changed::focus-highlight-opacity', this._settingsChangeRefresh.bind(this)), + SETTINGS.connect('changed::group-apps-label-font-size', this._updateWindowTitleStyle.bind(this)), + SETTINGS.connect('changed::group-apps-label-font-weight', this._updateWindowTitleStyle.bind(this)), + SETTINGS.connect('changed::group-apps-label-font-color', this._updateWindowTitleStyle.bind(this)), + SETTINGS.connect('changed::group-apps-label-font-color-minimized', this._updateWindowTitleStyle.bind(this)), + SETTINGS.connect('changed::group-apps-label-max-width', this._updateWindowTitleStyle.bind(this)), + SETTINGS.connect('changed::group-apps-use-fixed-width', this._updateWindowTitleStyle.bind(this)), + SETTINGS.connect('changed::group-apps-underline-unfocused', this._settingsChangeRefresh.bind(this)) ] this._progressIndicator = new Progress.ProgressIndicator(this, panel.progressManager); @@ -293,8 +294,8 @@ var TaskbarAppIcon = GObject.registerClass({ } shouldShowTooltip() { - if (!Me.settings.get_boolean('show-tooltip') || - (!this.isLauncher && Me.settings.get_boolean("show-window-previews") && + if (!SETTINGS.get_boolean('show-tooltip') || + (!this.isLauncher && SETTINGS.get_boolean("show-window-previews") && this.getAppIconInterestingWindows().length > 0)) { return false; } else { @@ -305,7 +306,7 @@ var TaskbarAppIcon = GObject.registerClass({ } _onAppIconHoverChanged() { - if (!Me.settings.get_boolean('show-window-previews') || + if (!SETTINGS.get_boolean('show-window-previews') || (!this.window && !this._nWindows)) { return; } @@ -362,7 +363,7 @@ var TaskbarAppIcon = GObject.registerClass({ } for (let i = 0; i < this._dtpSettingsSignalIds.length; ++i) { - Me.settings.disconnect(this._dtpSettingsSignalIds[i]); + SETTINGS.disconnect(this._dtpSettingsSignalIds[i]); } } @@ -407,7 +408,7 @@ var TaskbarAppIcon = GObject.registerClass({ } _onAnimateAppiconHoverChanged() { - if (Me.settings.get_boolean('animate-appicon-hover')) { + if (SETTINGS.get_boolean('animate-appicon-hover')) { this._container.add_style_class_name('animate-appicon-hover'); // Workaround to prevent scaled icon from being ugly when it is animated on hover. @@ -439,7 +440,7 @@ var TaskbarAppIcon = GObject.registerClass({ } _onMouseScroll(actor, event) { - let scrollAction = Me.settings.get_string('scroll-icon-action'); + let scrollAction = SETTINGS.get_string('scroll-icon-action'); if (scrollAction === 'PASS_THROUGH') { return this.dtpPanel._onPanelMouseScroll(actor, event); @@ -450,7 +451,7 @@ var TaskbarAppIcon = GObject.registerClass({ let direction = Utils.getMouseScrollDirection(event); if (direction && !this._timeoutsHandler.getId(T2)) { - this._timeoutsHandler.add([T2, Me.settings.get_int('scroll-icon-delay'), () => {}]); + this._timeoutsHandler.add([T2, SETTINGS.get_int('scroll-icon-delay'), () => {}]); let windows = this.getAppIconInterestingWindows(); @@ -485,12 +486,12 @@ var TaskbarAppIcon = GObject.registerClass({ if (!this._dashItemContainer.animatingOut) // don't draw and trigger more animations if the icon is in the middle of // being removed from the panel - this._drawRunningIndicator(this._focusedDots, Me.settings.get_string('dot-style-focused'), true); + this._drawRunningIndicator(this._focusedDots, SETTINGS.get_string('dot-style-focused'), true); }); this._unfocusedDots.connect('repaint', () => { if (!this._dashItemContainer.animatingOut) - this._drawRunningIndicator(this._unfocusedDots, Me.settings.get_string('dot-style-unfocused'), false); + this._drawRunningIndicator(this._unfocusedDots, SETTINGS.get_string('dot-style-unfocused'), false); }); this._dotsContainer.add_child(this._unfocusedDots); @@ -507,11 +508,11 @@ var TaskbarAppIcon = GObject.registerClass({ } _resetDots() { - let position = Me.settings.get_string('dot-position'); + let position = SETTINGS.get_string('dot-position'); let isHorizontalDots = position == DOT_POSITION.TOP || position == DOT_POSITION.BOTTOM; let sizeProp = isHorizontalDots ? 'width' : 'height'; - let focusedDotStyle = Me.settings.get_string('dot-style-focused'); - let unfocusedDotStyle = Me.settings.get_string('dot-style-unfocused'); + let focusedDotStyle = SETTINGS.get_string('dot-style-focused'); + let unfocusedDotStyle = SETTINGS.get_string('dot-style-unfocused'); this._focusedIsWide = this._isWideDotStyle(focusedDotStyle); this._unfocusedIsWide = this._isWideDotStyle(unfocusedDotStyle); @@ -540,14 +541,14 @@ var TaskbarAppIcon = GObject.registerClass({ _updateWindowTitleStyle() { if (this._windowTitle) { - let useFixedWidth = Me.settings.get_boolean('group-apps-use-fixed-width'); - let fontWeight = Me.settings.get_string('group-apps-label-font-weight'); - let fontScale = Me.desktopSettings.get_double('text-scaling-factor'); + let useFixedWidth = SETTINGS.get_boolean('group-apps-use-fixed-width'); + let fontWeight = SETTINGS.get_string('group-apps-label-font-weight'); + let fontScale = DESKTOPSETTINGS.get_double('text-scaling-factor'); let fontColor = this.window.minimized ? - Me.settings.get_string('group-apps-label-font-color-minimized') : - Me.settings.get_string('group-apps-label-font-color'); + SETTINGS.get_string('group-apps-label-font-color-minimized') : + SETTINGS.get_string('group-apps-label-font-color'); let scaleFactor = Utils.getScaleFactor(); - let maxLabelWidth = Me.settings.get_int('group-apps-label-max-width') * scaleFactor; + let maxLabelWidth = SETTINGS.get_int('group-apps-label-max-width') * scaleFactor; let variableWidth = !useFixedWidth || this.dtpPanel.checkIfVertical() || this.dtpPanel.taskbar.fullScrollView; this._windowTitle[(maxLabelWidth > 0 ? 'show' : 'hide')](); @@ -556,7 +557,7 @@ var TaskbarAppIcon = GObject.registerClass({ this._windowTitle.clutter_text.natural_width = useFixedWidth ? maxLabelWidth : 0; this._windowTitle.clutter_text.natural_width_set = useFixedWidth; - this._windowTitle.set_style('font-size: ' + Me.settings.get_int('group-apps-label-font-size') * fontScale + 'px;' + + this._windowTitle.set_style('font-size: ' + SETTINGS.get_int('group-apps-label-font-size') * fontScale + 'px;' + 'font-weight: ' + fontWeight + ';' + (useFixedWidth ? '' : 'max-width: ' + maxLabelWidth + 'px;') + 'color: ' + fontColor); @@ -576,12 +577,12 @@ var TaskbarAppIcon = GObject.registerClass({ _setIconStyle(isFocused) { let inlineStyle = 'margin: 0;'; - if(Me.settings.get_boolean('focus-highlight') && + if(SETTINGS.get_boolean('focus-highlight') && this._checkIfFocusedApp() && !this.isLauncher && (!this.window || isFocused) && !this._isThemeProvidingIndicator() && this._checkIfMonitorHasFocus()) { - let focusedDotStyle = Me.settings.get_string('dot-style-focused'); - let pos = Me.settings.get_string('dot-position'); - let highlightMargin = this._focusedIsWide ? Me.settings.get_int('dot-size') : 0; + let focusedDotStyle = SETTINGS.get_string('dot-style-focused'); + let pos = SETTINGS.get_string('dot-position'); + let highlightMargin = this._focusedIsWide ? SETTINGS.get_int('dot-size') : 0; if(!this.window) { let containerWidth = this._dtpIconContainer.get_width() / Utils.getScaleFactor();; @@ -605,7 +606,7 @@ var TaskbarAppIcon = GObject.registerClass({ } let highlightColor = this._getFocusHighlightColor(); - inlineStyle += "background-color: " + cssHexTocssRgba(highlightColor, Me.settings.get_int('focus-highlight-opacity') * 0.01); + inlineStyle += "background-color: " + cssHexTocssRgba(highlightColor, SETTINGS.get_int('focus-highlight-opacity') * 0.01); } if(this._dotsContainer.get_style() != inlineStyle) { @@ -619,14 +620,14 @@ var TaskbarAppIcon = GObject.registerClass({ _checkIfMonitorHasFocus() { return global.display.focus_window && - (!Me.settings.get_boolean('multi-monitors') || // only check same monitor index if multi window is enabled. - !Me.settings.get_boolean('isolate-monitors') || + (!SETTINGS.get_boolean('multi-monitors') || // only check same monitor index if multi window is enabled. + !SETTINGS.get_boolean('isolate-monitors') || global.display.focus_window.get_monitor() === this.dtpPanel.monitor.index); } _setAppIconPadding() { let padding = getIconPadding(this.dtpPanel.monitor.index); - let margin = Me.settings.get_int('appicon-margin'); + let margin = SETTINGS.get_int('appicon-margin'); this.set_style('padding:' + (this.dtpPanel.checkIfVertical() ? margin + 'px 0' : '0 ' + margin + 'px;')); this._iconContainer.set_style('padding: ' + padding + 'px;'); @@ -676,7 +677,7 @@ var TaskbarAppIcon = GObject.registerClass({ _onOverviewWindowDragEnd(windowTracker) { this._timeoutsHandler.add([T4, 0, () => { - if (Me.settings.get_boolean('isolate-workspaces')) + if (SETTINGS.get_boolean('isolate-workspaces')) this._updateWindows() this._displayProperIndicator() @@ -693,13 +694,13 @@ var TaskbarAppIcon = GObject.registerClass({ _displayProperIndicator() { let isFocused = this._isFocusedWindow(); - let position = Me.settings.get_string('dot-position'); + let position = SETTINGS.get_string('dot-position'); let isHorizontalDots = position == DOT_POSITION.TOP || position == DOT_POSITION.BOTTOM; this._setIconStyle(isFocused); if(!this._isGroupApps) { - if (this.window && (Me.settings.get_boolean('group-apps-underline-unfocused') || isFocused)) { + if (this.window && (SETTINGS.get_boolean('group-apps-underline-unfocused') || isFocused)) { let align = Clutter.ActorAlign[position == DOT_POSITION.TOP || position == DOT_POSITION.LEFT ? 'START' : 'END']; this._focusedDots.set_size(0, 0); @@ -748,7 +749,7 @@ var TaskbarAppIcon = GObject.registerClass({ // animation is enabled in settings // AND (going from a wide style to a narrow style indicator or vice-versa // OR going from an open app to a closed app or vice versa) - let animate = Me.settings.get_boolean('animate-app-switch') && + let animate = SETTINGS.get_boolean('animate-app-switch') && ((this._focusedIsWide != this._unfocusedIsWide) || (this._focusedDots[sizeProp] != newUnfocusedDotsSize || this._unfocusedDots[sizeProp] != newFocusedDotsSize)) let duration = animate ? Taskbar.DASH_ANIMATION_TIME : 0.001; @@ -830,9 +831,9 @@ var TaskbarAppIcon = GObject.registerClass({ if (button && button == 2 ) { if (modifiers & Clutter.ModifierType.SHIFT_MASK) - buttonAction = Me.settings.get_string('shift-middle-click-action'); + buttonAction = SETTINGS.get_string('shift-middle-click-action'); else - buttonAction = Me.settings.get_string('middle-click-action'); + buttonAction = SETTINGS.get_string('middle-click-action'); } else if (button && button == 1) { let now = global.get_current_time() @@ -841,12 +842,12 @@ var TaskbarAppIcon = GObject.registerClass({ this.lastClick = now if (modifiers & Clutter.ModifierType.SHIFT_MASK) - buttonAction = Me.settings.get_string('shift-click-action'); + buttonAction = SETTINGS.get_string('shift-click-action'); else - buttonAction = Me.settings.get_string('click-action'); + buttonAction = SETTINGS.get_string('click-action'); } - let closePreview = () => this._previewMenu.close(Me.settings.get_boolean('window-preview-hide-immediate-click')); + let closePreview = () => this._previewMenu.close(SETTINGS.get_boolean('window-preview-hide-immediate-click')); let appCount = this.getAppIconInterestingWindows().length; let previewedAppIcon = this._previewMenu.getCurrentAppIcon(); @@ -989,7 +990,7 @@ var TaskbarAppIcon = GObject.registerClass({ } _launchNewInstance(ctrlPressed) { - let maybeAnimate = () => Me.settings.get_boolean('animate-window-launch') && this.animateLaunch() + let maybeAnimate = () => SETTINGS.get_boolean('animate-window-launch') && this.animateLaunch() if ((ctrlPressed || this.app.state == Shell.AppState.RUNNING) && this.app.can_open_new_window()) { @@ -1032,14 +1033,14 @@ var TaskbarAppIcon = GObject.registerClass({ } _getRunningIndicatorSize() { - return Me.settings.get_int('dot-size') * Utils.getScaleFactor(); + return SETTINGS.get_int('dot-size') * Utils.getScaleFactor(); } _getRunningIndicatorColor(isFocused) { let color; const fallbackColor = new Clutter.Color({ red: 82, green: 148, blue: 226, alpha: 255 }); - if (Me.settings.get_boolean('dot-color-dominant')) { + if (SETTINGS.get_boolean('dot-color-dominant')) { let dce = new Utils.DominantColorExtractor(this.app); let palette = dce._getColorPalette(); if (palette) { @@ -1051,13 +1052,13 @@ var TaskbarAppIcon = GObject.registerClass({ // theme didn't provide one, use a default if(color.alpha == 0) color = fallbackColor; } - } else if(Me.settings.get_boolean('dot-color-override')) { + } else if(SETTINGS.get_boolean('dot-color-override')) { let dotColorSettingPrefix = 'dot-color-'; - if(!isFocused && Me.settings.get_boolean('dot-color-unfocused-different')) + if(!isFocused && SETTINGS.get_boolean('dot-color-unfocused-different')) dotColorSettingPrefix = 'dot-color-unfocused-'; - color = Clutter.color_from_string(Me.settings.get_string(dotColorSettingPrefix + (this._getRunningIndicatorCount() || 1) ))[1]; + color = Clutter.color_from_string(SETTINGS.get_string(dotColorSettingPrefix + (this._getRunningIndicatorCount() || 1) ))[1]; } else { // Re-use the style - background color, and border width and color - // of the default dot @@ -1072,12 +1073,12 @@ var TaskbarAppIcon = GObject.registerClass({ } _getFocusHighlightColor() { - if (Me.settings.get_boolean('focus-highlight-dominant')) { + if (SETTINGS.get_boolean('focus-highlight-dominant')) { let dce = new Utils.DominantColorExtractor(this.app); let palette = dce._getColorPalette(); if (palette) return palette.original; } - return Me.settings.get_string('focus-highlight-color'); + return SETTINGS.get_string('focus-highlight-color'); } _drawRunningIndicator(area, type, isFocused) { @@ -1087,7 +1088,7 @@ var TaskbarAppIcon = GObject.registerClass({ return; } - let position = Me.settings.get_string('dot-position'); + let position = SETTINGS.get_string('dot-position'); let isHorizontalDots = position == DOT_POSITION.TOP || position == DOT_POSITION.BOTTOM; let bodyColor = this._getRunningIndicatorColor(isFocused); let [areaWidth, areaHeight] = area.get_surface_size(); @@ -1401,13 +1402,13 @@ function getInterestingWindows(app, monitor, isolateMonitors) { // When using workspace or monitor isolation, we filter out windows // that are not in the current workspace or on the same monitor as the appicon - if (Me.settings.get_boolean('isolate-workspaces')) + if (SETTINGS.get_boolean('isolate-workspaces')) windows = windows.filter(function(w) { return w.get_workspace() && w.get_workspace() == Utils.getCurrentWorkspace(); }); - if (monitor && Me.settings.get_boolean('multi-monitors') && (isolateMonitors || Me.settings.get_boolean('isolate-monitors'))) { + if (monitor && SETTINGS.get_boolean('multi-monitors') && (isolateMonitors || SETTINGS.get_boolean('isolate-monitors'))) { windows = windows.filter(function(w) { return w.get_monitor() == monitor.index; }); @@ -1426,8 +1427,8 @@ function cssHexTocssRgba(cssHex, opacity) { } function getIconPadding(monitorIndex) { - let panelSize = PanelSettings.getPanelSize(Me.settings, monitorIndex); - let padding = Me.settings.get_int('appicon-padding'); + let panelSize = PanelSettings.getPanelSize(SETTINGS, monitorIndex); + let padding = SETTINGS.get_int('appicon-padding'); let availSize = panelSize - Taskbar.MIN_ICON_SIZE - panelSize % 2; if (padding * 2 > availSize) { @@ -1455,7 +1456,7 @@ function getIconPadding(monitorIndex) { this._showSingleWindows = true; // Remove "Show Details" menu item - if(!Me.settings.get_boolean('secondarymenu-contains-showdetails')) { + if(!SETTINGS.get_boolean('secondarymenu-contains-showdetails')) { let existingMenuItems = this._getMenuItems(); for (let i = 0; i < existingMenuItems.length; i++) { let item = existingMenuItems[i]; @@ -1617,7 +1618,7 @@ function ItemShowLabel() { this.realShowAppsIcon._dtpPanel = dtpPanel; Taskbar.extendDashItemContainer(this.realShowAppsIcon); - let customIconPath = Me.settings.get_string('show-apps-icon-file'); + let customIconPath = SETTINGS.get_string('show-apps-icon-file'); this.realShowAppsIcon.icon.createIcon = function(size) { this._iconActor = new St.Icon({ icon_name: 'view-app-grid-symbolic', @@ -1632,13 +1633,13 @@ function ItemShowLabel() { return this._iconActor; }; - this._changedShowAppsIconId = Me.settings.connect('changed::show-apps-icon-file', () => { - customIconPath = Me.settings.get_string('show-apps-icon-file'); + this._changedShowAppsIconId = SETTINGS.connect('changed::show-apps-icon-file', () => { + customIconPath = SETTINGS.get_string('show-apps-icon-file'); this.realShowAppsIcon.icon._createIconTexture(this.realShowAppsIcon.icon.iconSize); }); - this._changedAppIconPaddingId = Me.settings.connect('changed::appicon-padding', () => this.setShowAppsPadding()); - this._changedAppIconSidePaddingId = Me.settings.connect('changed::show-apps-icon-side-padding', () => this.setShowAppsPadding()); + this._changedAppIconPaddingId = SETTINGS.connect('changed::appicon-padding', () => this.setShowAppsPadding()); + this._changedAppIconSidePaddingId = SETTINGS.connect('changed::show-apps-icon-side-padding', () => this.setShowAppsPadding()); this.setShowAppsPadding(); } @@ -1674,7 +1675,7 @@ function ItemShowLabel() { setShowAppsPadding() { let padding = getIconPadding(this.realShowAppsIcon._dtpPanel.monitor.index); - let sidePadding = Me.settings.get_int('show-apps-icon-side-padding'); + let sidePadding = SETTINGS.get_int('show-apps-icon-side-padding'); let isVertical = this.realShowAppsIcon._dtpPanel.checkIfVertical(); this.actor.set_style('padding:' + (padding + (isVertical ? sidePadding : 0)) + 'px ' + (padding + (isVertical ? 0 : sidePadding)) + 'px;'); @@ -1718,14 +1719,14 @@ function ItemShowLabel() { } shouldShowTooltip() { - return Me.settings.get_boolean('show-tooltip') && + return SETTINGS.get_boolean('show-tooltip') && (this.actor.hover && (!this._menu || !this._menu.isOpen)); } destroy() { - Me.settings.disconnect(this._changedShowAppsIconId); - Me.settings.disconnect(this._changedAppIconSidePaddingId); - Me.settings.disconnect(this._changedAppIconPaddingId); + SETTINGS.disconnect(this._changedShowAppsIconId); + SETTINGS.disconnect(this._changedAppIconSidePaddingId); + SETTINGS.disconnect(this._changedAppIconPaddingId); this.realShowAppsIcon.destroy(); } @@ -1777,8 +1778,8 @@ var MyShowAppsIconMenu = class extends PopupMenu.PopupMenu { }); this._appendList( - Me.settings.get_strv('show-apps-button-context-menu-commands'), - Me.settings.get_strv('show-apps-button-context-menu-titles') + SETTINGS.get_strv('show-apps-button-context-menu-commands'), + SETTINGS.get_strv('show-apps-button-context-menu-titles') ) this._appendSeparator(); @@ -1810,15 +1811,15 @@ var MyShowAppsIconMenu = class extends PopupMenu.PopupMenu { }); this._appendList( - Me.settings.get_strv('panel-context-menu-commands'), - Me.settings.get_strv('panel-context-menu-titles') + SETTINGS.get_strv('panel-context-menu-commands'), + SETTINGS.get_strv('panel-context-menu-titles') ) this._appendSeparator(); - let lockTaskbarMenuItem = this._appendMenuItem(Me.settings.get_boolean('taskbar-locked') ? _('Unlock taskbar') : _('Lock taskbar')); + let lockTaskbarMenuItem = this._appendMenuItem(SETTINGS.get_boolean('taskbar-locked') ? _('Unlock taskbar') : _('Lock taskbar')); lockTaskbarMenuItem.connect('activate', () => { - Me.settings.set_boolean('taskbar-locked', !Me.settings.get_boolean('taskbar-locked')); + SETTINGS.set_boolean('taskbar-locked', !SETTINGS.get_boolean('taskbar-locked')); }); let settingsMenuItem = this._appendMenuItem(_('Dash to Panel Settings')); @@ -1877,7 +1878,7 @@ var MyShowAppsIconMenu = class extends PopupMenu.PopupMenu { var getIconContainerStyle = function(isVertical) { let style = 'padding: '; - if (Me.settings.get_boolean('group-apps')) { + if (SETTINGS.get_boolean('group-apps')) { style += (isVertical ? '0;' : '0 ' + DEFAULT_PADDING_SIZE + 'px;'); } else { style += (isVertical ? '' : '0 ') + DEFAULT_PADDING_SIZE + 'px;'; diff --git a/intellihide.js b/intellihide.js index d2ba8b3..6979ffe 100644 --- a/intellihide.js +++ b/intellihide.js @@ -29,6 +29,7 @@ import * as PointerWatcher from 'resource:///org/gnome/shell/ui/pointerWatcher.j import * as Panel from './panel.js'; import * as Proximity from './proximity.js'; import * as Utils from './utils.js'; +import {SETTINGS} from './extension.js'; //timeout intervals const CHECK_POINTER_MS = 200; @@ -62,8 +63,8 @@ var Intellihide = class { this._signalsHandler = new Utils.GlobalSignalsHandler(); this._timeoutsHandler = new Utils.TimeoutsHandler(); - this._intellihideChangedId = Me.settings.connect('changed::intellihide', () => this._changeEnabledStatus()); - this._intellihideOnlySecondaryChangedId = Me.settings.connect('changed::intellihide-only-secondary', () => this._changeEnabledStatus()); + this._intellihideChangedId = SETTINGS.connect('changed::intellihide', () => this._changeEnabledStatus()); + this._intellihideOnlySecondaryChangedId = SETTINGS.connect('changed::intellihide-only-secondary', () => this._changeEnabledStatus()); this.enabled = false; this._changeEnabledStatus(); @@ -84,11 +85,11 @@ var Intellihide = class { this._setTrackPanel(true); this._bindGeneralSignals(); - if (Me.settings.get_boolean('intellihide-hide-from-windows')) { + if (SETTINGS.get_boolean('intellihide-hide-from-windows')) { this._proximityWatchId = this._proximityManager.createWatch( this._panelBox.get_parent(), this._dtpPanel.monitor.index, - Proximity.Mode[Me.settings.get_string('intellihide-behaviour')], + Proximity.Mode[SETTINGS.get_string('intellihide-behaviour')], 0, 0, overlap => { this._windowOverlap = overlap; @@ -119,8 +120,8 @@ var Intellihide = class { } destroy() { - Me.settings.disconnect(this._intellihideChangedId); - Me.settings.disconnect(this._intellihideOnlySecondaryChangedId); + SETTINGS.disconnect(this._intellihideChangedId); + SETTINGS.disconnect(this._intellihideOnlySecondaryChangedId); if (this.enabled) { this.disable(); @@ -153,8 +154,8 @@ var Intellihide = class { } _changeEnabledStatus() { - let intellihide = Me.settings.get_boolean('intellihide'); - let onlySecondary = Me.settings.get_boolean('intellihide-only-secondary'); + let intellihide = SETTINGS.get_boolean('intellihide'); + let onlySecondary = SETTINGS.get_boolean('intellihide-only-secondary'); let enabled = intellihide && !(this._dtpPanel.isPrimary && onlySecondary); if (this.enabled !== enabled) { @@ -173,7 +174,7 @@ var Intellihide = class { } ], [ - Me.settings, + SETTINGS, [ 'changed::intellihide-use-pressure', 'changed::intellihide-hide-from-windows', @@ -231,11 +232,11 @@ var Intellihide = class { } _setRevealMechanism() { - if (global.display.supports_extended_barriers() && Me.settings.get_boolean('intellihide-use-pressure')) { + if (global.display.supports_extended_barriers() && SETTINGS.get_boolean('intellihide-use-pressure')) { this._edgeBarrier = this._createBarrier(); this._pressureBarrier = new Layout.PressureBarrier( - Me.settings.get_int('intellihide-pressure-threshold'), - Me.settings.get_int('intellihide-pressure-time'), + SETTINGS.get_int('intellihide-pressure-threshold'), + SETTINGS.get_int('intellihide-pressure-time'), Shell.ActionMode.NORMAL ); this._pressureBarrier.addBarrier(this._edgeBarrier); @@ -331,13 +332,13 @@ var Intellihide = class { //the user is trying to reveal the panel if (this._monitor.inFullscreen && !mouseBtnIsPressed) { - return Me.settings.get_boolean('intellihide-show-in-fullscreen'); + return SETTINGS.get_boolean('intellihide-show-in-fullscreen'); } return !mouseBtnIsPressed; } - if (!Me.settings.get_boolean('intellihide-hide-from-windows')) { + if (!SETTINGS.get_boolean('intellihide-hide-from-windows')) { return this._panelBox.hover; } @@ -405,9 +406,9 @@ var Intellihide = class { //when entering/leaving the overview, use its animation time instead of the one from the settings time: Main.overview.visible ? SIDE_CONTROLS_ANIMATION_TIME : - Me.settings.get_int('intellihide-animation-time') * 0.001, + SETTINGS.get_int('intellihide-animation-time') * 0.001, //only delay the animation when hiding the panel after the user hovered out - delay: destination != 0 && this._hoveredOut ? Me.settings.get_int('intellihide-close-delay') * 0.001 : 0, + delay: destination != 0 && this._hoveredOut ? SETTINGS.get_int('intellihide-close-delay') * 0.001 : 0, transition: 'easeOutQuad', onComplete: () => { this._panelBox.visible = !destination; diff --git a/overview.js b/overview.js index 59664f4..d38dc89 100644 --- a/overview.js +++ b/overview.js @@ -30,6 +30,7 @@ import St from 'gi://St'; import * as Main from 'resource:///org/gnome/shell/ui/main.js'; import * as Workspace from 'resource:///org/gnome/shell/ui/workspace.js'; import { WindowPreview } from 'resource:///org/gnome/shell/ui/windowPreview.js'; +import {SETTINGS} from './extension.js'; import Meta from 'gi://Meta'; @@ -67,7 +68,7 @@ var Overview = class { this._adaptAlloc(true); this._signalsHandler.add([ - Me.settings, + SETTINGS, [ 'changed::stockgs-keep-dash', 'changed::panel-sizes' @@ -92,7 +93,7 @@ var Overview = class { _toggleDash(visible) { if (visible === undefined) { - visible = Me.settings.get_boolean('stockgs-keep-dash'); + visible = SETTINGS.get_boolean('stockgs-keep-dash'); } let visibilityFunc = visible ? 'show' : 'hide'; @@ -183,19 +184,19 @@ var Overview = class { } this._signalsHandler.add([ - Me.settings, + SETTINGS, 'changed::isolate-workspaces', () => { this._panel.panelManager.allPanels.forEach(p => p.taskbar.resetAppIcons()); - if (Me.settings.get_boolean('isolate-workspaces')) + if (SETTINGS.get_boolean('isolate-workspaces')) enable(); else disable(); } ]); - if (Me.settings.get_boolean('isolate-workspaces')) + if (SETTINGS.get_boolean('isolate-workspaces')) enable(); } @@ -219,7 +220,7 @@ var Overview = class { let seenAppCount = seenApps[appIcon.app]; let windowCount = appIcon.window || appIcon._hotkeysCycle ? seenAppCount : appIcon._nWindows; - if (Me.settings.get_boolean('shortcut-previews') && windowCount > 1 && + if (SETTINGS.get_boolean('shortcut-previews') && windowCount > 1 && !(modifiers & ~(Clutter.ModifierType.MOD1_MASK | Clutter.ModifierType.SUPER_MASK))) { //ignore the alt (MOD1_MASK) and super key (SUPER_MASK) if (this._hotkeyPreviewCycleInfo && this._hotkeyPreviewCycleInfo.appIcon != appIcon) { this._endHotkeyPreviewCycle(); @@ -273,14 +274,14 @@ var Overview = class { _optionalHotKeys() { this._hotKeysEnabled = false; - if (Me.settings.get_boolean('hot-keys')) + if (SETTINGS.get_boolean('hot-keys')) this._enableHotKeys(); this._signalsHandler.add([ - Me.settings, + SETTINGS, 'changed::hot-keys', () => { - if (Me.settings.get_boolean('hot-keys')) + if (SETTINGS.get_boolean('hot-keys')) this._enableHotKeys(); else this._disableHotKeys(); @@ -305,12 +306,12 @@ var Overview = class { } // Setup keyboard bindings for taskbar elements - let shortcutNumKeys = Me.settings.get_string('shortcut-num-keys'); + let shortcutNumKeys = SETTINGS.get_string('shortcut-num-keys'); let bothNumKeys = shortcutNumKeys == 'BOTH'; let keys = []; let prefixModifiers = Clutter.ModifierType.SUPER_MASK - if (Me.settings.get_string('hotkey-prefix-text') == 'SuperAlt') + if (SETTINGS.get_string('hotkey-prefix-text') == 'SuperAlt') prefixModifiers |= Clutter.ModifierType.MOD1_MASK if (bothNumKeys || shortcutNumKeys == 'NUM_ROW') { @@ -332,13 +333,13 @@ var Overview = class { for (let i = 0; i < this._numHotkeys; i++) { let appNum = i; - Utils.addKeybinding(key + (i + 1), Me.settings, () => this._activateApp(appNum, modifiers)); + Utils.addKeybinding(key + (i + 1), SETTINGS, () => this._activateApp(appNum, modifiers)); } }, this); this._hotKeysEnabled = true; - if (Me.settings.get_string('hotkeys-overlay-combo') === 'ALWAYS') + if (SETTINGS.get_string('hotkeys-overlay-combo') === 'ALWAYS') this.taskbar.toggleNumberOverlay(true); } @@ -369,38 +370,38 @@ var Overview = class { _optionalNumberOverlay() { // Enable extra shortcut - if (Me.settings.get_boolean('hot-keys')) + if (SETTINGS.get_boolean('hot-keys')) this._enableExtraShortcut(); this._signalsHandler.add([ - Me.settings, + SETTINGS, 'changed::hot-keys', this._checkHotkeysOptions.bind(this) ], [ - Me.settings, + SETTINGS, 'changed::hotkeys-overlay-combo', () => { - if (Me.settings.get_boolean('hot-keys') && Me.settings.get_string('hotkeys-overlay-combo') === 'ALWAYS') + if (SETTINGS.get_boolean('hot-keys') && SETTINGS.get_string('hotkeys-overlay-combo') === 'ALWAYS') this.taskbar.toggleNumberOverlay(true); else this.taskbar.toggleNumberOverlay(false); } ], [ - Me.settings, + SETTINGS, 'changed::shortcut-num-keys', () => this._resetHotkeys() ]); } _checkHotkeysOptions() { - if (Me.settings.get_boolean('hot-keys')) + if (SETTINGS.get_boolean('hot-keys')) this._enableExtraShortcut(); else this._disableExtraShortcut(); } _enableExtraShortcut() { - Utils.addKeybinding('shortcut', Me.settings, () => this._showOverlay(true)); + Utils.addKeybinding('shortcut', SETTINGS, () => this._showOverlay(true)); } _disableExtraShortcut() { @@ -414,7 +415,7 @@ var Overview = class { } // Restart the counting if the shortcut is pressed again - let hotkey_option = Me.settings.get_string('hotkeys-overlay-combo'); + let hotkey_option = SETTINGS.get_string('hotkeys-overlay-combo'); if (hotkey_option === 'NEVER') return; @@ -424,10 +425,10 @@ var Overview = class { this._panel.intellihide.revealAndHold(Intellihide.Hold.TEMPORARY); - let timeout = Me.settings.get_int('overlay-timeout'); + let timeout = SETTINGS.get_int('overlay-timeout'); if (overlayFromShortcut) { - timeout = Me.settings.get_int('shortcut-timeout'); + timeout = SETTINGS.get_int('shortcut-timeout'); } // Hide the overlay/dock after the timeout @@ -442,14 +443,14 @@ var Overview = class { _optionalClickToExit() { this._clickToExitEnabled = false; - if (Me.settings.get_boolean('overview-click-to-exit')) + if (SETTINGS.get_boolean('overview-click-to-exit')) this._enableClickToExit(); this._signalsHandler.add([ - Me.settings, + SETTINGS, 'changed::overview-click-to-exit', () => { - if (Me.settings.get_boolean('overview-click-to-exit')) + if (SETTINGS.get_boolean('overview-click-to-exit')) this._enableClickToExit(); else this._disableClickToExit(); diff --git a/panel.js b/panel.js index b59f190..d1be58b 100644 --- a/panel.js +++ b/panel.js @@ -57,6 +57,7 @@ import * as Progress from './progress.js'; import * as Intellihide from './intellihide.js'; import * as Transparency from './transparency.js'; +import {SETTINGS, DESKTOPSETTINGS} from './extension.js'; import {gettext as _} from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js'; const Mainloop = imports.mainloop; @@ -91,7 +92,7 @@ var Panel = GObject.registerClass({ // so in this case use isPrimary to get the panel on the primary dtp monitor, which // might be different from the system's primary monitor. this.isStandalone = isStandalone; - this.isPrimary = !isStandalone || (Me.settings.get_boolean('stockgs-keep-top-panel') && + this.isPrimary = !isStandalone || (SETTINGS.get_boolean('stockgs-keep-top-panel') && monitor == panelManager.dtpPrimaryMonitor); this._sessionStyle = null; @@ -206,7 +207,7 @@ var Panel = GObject.registerClass({ this.menuManager._oldChangeMenu = this.menuManager._changeMenu; this.menuManager._changeMenu = (menu) => { - if (!Me.settings.get_boolean('stockgs-panelbtn-click-only')) { + if (!SETTINGS.get_boolean('stockgs-panelbtn-click-only')) { this.menuManager._oldChangeMenu(menu); } }; @@ -217,14 +218,14 @@ var Panel = GObject.registerClass({ this.panel.add_child(this.taskbar.actor); - this._setAppmenuVisible(Me.settings.get_boolean('show-appmenu')); + this._setAppmenuVisible(SETTINGS.get_boolean('show-appmenu')); this._setShowDesktopButton(true); this._setAllocationMap(); this.panel.add_style_class_name('dashtopanelMainPanel ' + this.getOrientation()); - this._timeoutsHandler.add([T2, Me.settings.get_int('intellihide-enable-start-delay'), () => this.intellihide = new Intellihide.Intellihide(this)]); + this._timeoutsHandler.add([T2, SETTINGS.get_int('intellihide-enable-start-delay'), () => this.intellihide = new Intellihide.Intellihide(this)]); this._signalsHandler.add( // this is to catch changes to the theme or window scale factor @@ -412,7 +413,7 @@ var Panel = GObject.registerClass({ } getPosition() { - let position = PanelSettings.getPanelPosition(Me.settings, this.monitor.index); + let position = PanelSettings.getPanelPosition(SETTINGS, this.monitor.index); if (position == Pos.TOP) { return St.Side.TOP; @@ -499,7 +500,7 @@ var Panel = GObject.registerClass({ this._signalsHandler.add( [ - Me.settings, + SETTINGS, [ 'changed::panel-sizes', 'changed::group-apps' @@ -507,7 +508,7 @@ var Panel = GObject.registerClass({ () => this._resetGeometry() ], [ - Me.settings, + SETTINGS, [ 'changed::appicon-margin', 'changed::appicon-padding' @@ -515,12 +516,12 @@ var Panel = GObject.registerClass({ () => this.taskbar.resetAppIcons() ], [ - Me.settings, + SETTINGS, 'changed::show-appmenu', - () => this._setAppmenuVisible(Me.settings.get_boolean('show-appmenu')) + () => this._setAppmenuVisible(SETTINGS.get_boolean('show-appmenu')) ], [ - Me.settings, + SETTINGS, [ 'changed::showdesktop-button-width', 'changed::trans-use-custom-bg', @@ -531,7 +532,7 @@ var Panel = GObject.registerClass({ () => this._setShowDesktopButtonStyle() ], [ - Me.desktopSettings, + DESKTOPSETTINGS, 'changed::clock-format', () => { this._clockFormat = null; @@ -542,19 +543,19 @@ var Panel = GObject.registerClass({ } ], [ - Me.settings, + SETTINGS, 'changed::progress-show-bar', () => this._initProgressManager() ], [ - Me.settings, + SETTINGS, 'changed::progress-show-count', () => this._initProgressManager() ] ); if (isVertical) { - this._signalsHandler.add([Me.settings, 'changed::group-apps-label-max-width', () => this._resetGeometry()]); + this._signalsHandler.add([SETTINGS, 'changed::group-apps-label-max-width', () => this._resetGeometry()]); } } @@ -633,24 +634,24 @@ var Panel = GObject.registerClass({ let topPadding = panelBoxTheme.get_padding(St.Side.TOP); let tbPadding = topPadding + panelBoxTheme.get_padding(St.Side.BOTTOM); let position = this.getPosition(); - let length = PanelSettings.getPanelLength(Me.settings, this.monitor.index) / 100; - let anchor = PanelSettings.getPanelAnchor(Me.settings, this.monitor.index); + let length = PanelSettings.getPanelLength(SETTINGS, this.monitor.index) / 100; + let anchor = PanelSettings.getPanelAnchor(SETTINGS, this.monitor.index); let anchorPlaceOnMonitor = 0; let gsTopPanelOffset = 0; let x = 0, y = 0; let w = 0, h = 0; - const panelSize = PanelSettings.getPanelSize(Me.settings, this.monitor.index); + const panelSize = PanelSettings.getPanelSize(SETTINGS, this.monitor.index); this.dtpSize = panelSize * scaleFactor; - if (Me.settings.get_boolean('stockgs-keep-top-panel') && Main.layoutManager.primaryMonitor == this.monitor) { + if (SETTINGS.get_boolean('stockgs-keep-top-panel') && Main.layoutManager.primaryMonitor == this.monitor) { gsTopPanelOffset = Main.layoutManager.panelBox.height - topPadding; } if (this.checkIfVertical()) { - if (!Me.settings.get_boolean('group-apps')) { + if (!SETTINGS.get_boolean('group-apps')) { // add window title width and side padding of _dtpIconContainer when vertical - this.dtpSize += Me.settings.get_int('group-apps-label-max-width') + AppIcons.DEFAULT_PADDING_SIZE * 2 / scaleFactor; + this.dtpSize += SETTINGS.get_int('group-apps-label-max-width') + AppIcons.DEFAULT_PADDING_SIZE * 2 / scaleFactor; } this.sizeFunc = 'get_preferred_height', @@ -1065,7 +1066,7 @@ var Panel = GObject.registerClass({ let timeParts = time.split('∶'); if (!this._clockFormat) { - this._clockFormat = Me.desktopSettings.get_string('clock-format'); + this._clockFormat = DESKTOPSETTINGS.get_string('clock-format'); } if (this._clockFormat == '12h') { @@ -1096,8 +1097,8 @@ var Panel = GObject.registerClass({ this._showDesktopButton.add_style_class_name(this._getBackgroundBrightness() ? 'showdesktop-button-light-hovered' : 'showdesktop-button-dark-hovered'); - if (Me.settings.get_boolean('show-showdesktop-hover')) { - this._timeoutsHandler.add([T4, Me.settings.get_int('show-showdesktop-delay'), () => { + if (SETTINGS.get_boolean('show-showdesktop-hover')) { + this._timeoutsHandler.add([T4, SETTINGS.get_int('show-showdesktop-delay'), () => { this._hiddenDesktopWorkspace = Utils.DisplayWrapper.getWorkspaceManager().get_active_workspace(); this._toggleWorkspaceWindows(true, this._hiddenDesktopWorkspace); }]); @@ -1108,7 +1109,7 @@ var Panel = GObject.registerClass({ this._showDesktopButton.remove_style_class_name(this._getBackgroundBrightness() ? 'showdesktop-button-light-hovered' : 'showdesktop-button-dark-hovered'); - if (Me.settings.get_boolean('show-showdesktop-hover')) { + if (SETTINGS.get_boolean('show-showdesktop-hover')) { if (this._timeoutsHandler.getId(T4)) { this._timeoutsHandler.remove(T4); } else if (this._hiddenDesktopWorkspace) { @@ -1131,11 +1132,11 @@ var Panel = GObject.registerClass({ _setShowDesktopButtonStyle() { let rgb = this._getBackgroundBrightness() ? "rgba(55, 55, 55, .2)" : "rgba(200, 200, 200, .2)"; - let isLineCustom = Me.settings.get_boolean('desktop-line-use-custom-color'); - rgb = isLineCustom ? Me.settings.get_string('desktop-line-custom-color') : rgb; + let isLineCustom = SETTINGS.get_boolean('desktop-line-use-custom-color'); + rgb = isLineCustom ? SETTINGS.get_string('desktop-line-custom-color') : rgb; if (this._showDesktopButton) { - let buttonSize = Me.settings.get_int('showdesktop-button-width') + 'px;'; + let buttonSize = SETTINGS.get_int('showdesktop-button-width') + 'px;'; let isVertical = this.checkIfVertical(); let sytle = "border: 0 solid " + rgb + ";"; @@ -1152,7 +1153,7 @@ var Panel = GObject.registerClass({ } _toggleWorkspaceWindows(hide, workspace) { - let time = Me.settings.get_int('show-showdesktop-time') * .001; + let time = SETTINGS.get_int('show-showdesktop-time') * .001; workspace.list_windows().forEach(w => { if (!w.minimized && !w.customJS_ding) { @@ -1210,7 +1211,7 @@ var Panel = GObject.registerClass({ } _onPanelMouseScroll(actor, event) { - let scrollAction = Me.settings.get_string('scroll-panel-action'); + let scrollAction = SETTINGS.get_string('scroll-panel-action'); let direction = Utils.getMouseScrollDirection(event); if (!this._checkIfIgnoredScrollSource(event.get_source()) && !this._timeoutsHandler.getId(T6)) { @@ -1225,7 +1226,7 @@ var Panel = GObject.registerClass({ //gnome-shell < 3.30 needs an additional "screen" param global.screen ? args.push(global.screen) : 0; - let showWsPopup = Me.settings.get_boolean('scroll-panel-show-ws-popup'); + let showWsPopup = SETTINGS.get_boolean('scroll-panel-show-ws-popup'); showWsPopup ? 0 : Main.wm._workspaceSwitcherPopup = { display: () => {} }; Main.wm._showWorkspaceSwitcher.apply(Main.wm, args.concat([0, { get_name: () => 'switch---' + direction }])); showWsPopup ? 0 : Main.wm._workspaceSwitcherPopup = null; @@ -1247,7 +1248,7 @@ var Panel = GObject.registerClass({ return; } - var scrollDelay = Me.settings.get_int('scroll-panel-delay'); + var scrollDelay = SETTINGS.get_int('scroll-panel-delay'); if (scrollDelay) { this._timeoutsHandler.add([T6, scrollDelay, () => {}]); @@ -1262,8 +1263,8 @@ var Panel = GObject.registerClass({ } _initProgressManager() { - const progressVisible = Me.settings.get_boolean('progress-show-bar'); - const countVisible = Me.settings.get_boolean('progress-show-count'); + const progressVisible = SETTINGS.get_boolean('progress-show-bar'); + const countVisible = SETTINGS.get_boolean('progress-show-count'); const pm = this.progressManager; if(!pm && (progressVisible || countVisible)) diff --git a/panelManager.js b/panelManager.js index db65750..b996e9c 100755 --- a/panelManager.js +++ b/panelManager.js @@ -52,6 +52,7 @@ import * as Main from 'resource:///org/gnome/shell/ui/main.js'; import * as PanelMenu from 'resource:///org/gnome/shell/ui/panelMenu.js'; import * as Layout from 'resource:///org/gnome/shell/ui/layout.js'; import * as WM from 'resource:///org/gnome/shell/ui/windowManager.js'; +import {SETTINGS} from './extension.js'; import { SecondaryMonitorDisplay, WorkspacesView } from 'resource:///org/gnome/shell/ui/workspacesView.js'; const Gi = imports._gi; @@ -66,21 +67,21 @@ var PanelManager = class { } enable(reset) { - let dtpPrimaryIndex = Me.settings.get_int('primary-monitor'); + let dtpPrimaryIndex = SETTINGS.get_int('primary-monitor'); this.allPanels = []; this.dtpPrimaryMonitor = Main.layoutManager.monitors[dtpPrimaryIndex] || Main.layoutManager.primaryMonitor; this.proximityManager = new Proximity.ProximityManager(); if (this.dtpPrimaryMonitor) { - this.primaryPanel = this._createPanel(this.dtpPrimaryMonitor, Me.settings.get_boolean('stockgs-keep-top-panel')); + this.primaryPanel = this._createPanel(this.dtpPrimaryMonitor, SETTINGS.get_boolean('stockgs-keep-top-panel')); this.allPanels.push(this.primaryPanel); this.overview.enable(this.primaryPanel); this.setFocusedMonitor(this.dtpPrimaryMonitor); } - if (Me.settings.get_boolean('multi-monitors')) { + if (SETTINGS.get_boolean('multi-monitors')) { Main.layoutManager.monitors.filter(m => m != this.dtpPrimaryMonitor).forEach(m => { this.allPanels.push(this._createPanel(m, true)); }); @@ -135,7 +136,7 @@ var PanelManager = class { Main.layoutManager._updateHotCorners = newUpdateHotCorners.bind(Main.layoutManager); Main.layoutManager._updateHotCorners(); - this._forceHotCornerId = Me.settings.connect('changed::stockgs-force-hotcorner', () => Main.layoutManager._updateHotCorners()); + this._forceHotCornerId = SETTINGS.connect('changed::stockgs-force-hotcorner', () => Main.layoutManager._updateHotCorners()); if (Main.layoutManager._interfaceSettings) { this._enableHotCornersId = Main.layoutManager._interfaceSettings.connect('changed::enable-hot-corners', () => Main.layoutManager._updateHotCorners()); @@ -158,7 +159,7 @@ var PanelManager = class { //listen settings this._signalsHandler.add( [ - Me.settings, + SETTINGS, [ 'changed::primary-monitor', 'changed::multi-monitors', @@ -171,17 +172,17 @@ var PanelManager = class { () => this._reset() ], [ - Me.settings, + SETTINGS, 'changed::panel-element-positions', () => this._updatePanelElementPositions() ], [ - Me.settings, + SETTINGS, 'changed::intellihide-key-toggle-text', () => this._setKeyBindings(true) ], [ - Me.settings, + SETTINGS, 'changed::panel-sizes', () => { GLib.idle_add(GLib.PRIORITY_LOW, () => { @@ -215,7 +216,7 @@ var PanelManager = class { this._setKeyBindings(true); // keep GS overview.js from blowing away custom panel styles - if(!Me.settings.get_boolean('stockgs-keep-top-panel')) + if(!SETTINGS.get_boolean('stockgs-keep-top-panel')) Object.defineProperty(Main.panel, "style", {configurable: true, set(v) {}}); } @@ -277,7 +278,7 @@ var PanelManager = class { Main.layoutManager._updateHotCorners = this._oldUpdateHotCorners; Main.layoutManager._updateHotCorners(); - Me.settings.disconnect(this._forceHotCornerId); + SETTINGS.disconnect(this._forceHotCornerId); if (this._enableHotCornersId) { Main.layoutManager._interfaceSettings.disconnect(this._enableHotCornersId); @@ -385,8 +386,8 @@ var PanelManager = class { let keyPrimary = 'primary-monitor'; let primaryIndex = Main.layoutManager.primaryIndex; let newMonitors = [primaryIndex]; - let savedMonitors = Me.settings.get_value(keyMonitors).deep_unpack(); - let dtpPrimaryIndex = Me.settings.get_int(keyPrimary); + let savedMonitors = SETTINGS.get_value(keyMonitors).deep_unpack(); + let dtpPrimaryIndex = SETTINGS.get_int(keyPrimary); let newDtpPrimaryIndex = primaryIndex; Main.layoutManager.monitors.filter(m => m.index != primaryIndex).forEach(m => newMonitors.push(m.index)); @@ -400,8 +401,8 @@ var PanelManager = class { newDtpPrimaryIndex = newDtpPrimaryIndex == null ? primaryIndex : newDtpPrimaryIndex; } - Me.settings.set_int(keyPrimary, newDtpPrimaryIndex); - Me.settings.set_value(keyMonitors, new GLib.Variant('ai', newMonitors)); + SETTINGS.set_int(keyPrimary, newDtpPrimaryIndex); + SETTINGS.set_value(keyMonitors, new GLib.Variant('ai', newMonitors)); } checkIfFocusedMonitor(monitor) { @@ -446,7 +447,7 @@ var PanelManager = class { } _updatePanelElementPositions() { - this.panelsElementPositions = PanelSettings.getSettingsJson(Me.settings, 'panel-element-positions'); + this.panelsElementPositions = PanelSettings.getSettingsJson(SETTINGS, 'panel-element-positions'); this.allPanels.forEach(p => p.updateElementPositions()); } @@ -466,7 +467,7 @@ var PanelManager = class { } _getBoxPointerPreferredHeight(boxPointer, alloc, monitor) { - if (boxPointer._dtpInPanel && boxPointer.sourceActor && Me.settings.get_boolean('intellihide')) { + if (boxPointer._dtpInPanel && boxPointer.sourceActor && SETTINGS.get_boolean('intellihide')) { monitor = monitor || Main.layoutManager.findMonitorForActor(boxPointer.sourceActor); let panel = Utils.find(global.dashToPanel.panels, p => p.monitor == monitor); let excess = alloc.natural_size + panel.dtpSize + 10 - monitor.height; // 10 is arbitrary @@ -520,7 +521,7 @@ var PanelManager = class { Utils.removeKeybinding(k); if (enable) { - Utils.addKeybinding(k, Me.settings, keys[k], Shell.ActionMode.NORMAL); + Utils.addKeybinding(k, SETTINGS, keys[k], Shell.ActionMode.NORMAL); } }); } @@ -640,7 +641,7 @@ function newUpdateHotCorners() { // hot corner unless it is actually a top left panel. Otherwise, it stops the mouse // as you are dragging across. In the future, maybe we will automatically move the // hotcorner to the bottom when the panel is positioned at the bottom - if (i != this.primaryIndex || (!panelTopLeft && !Me.settings.get_boolean('stockgs-force-hotcorner'))) { + if (i != this.primaryIndex || (!panelTopLeft && !SETTINGS.get_boolean('stockgs-force-hotcorner'))) { // Check if we have a top left (right for RTL) corner. // I.e. if there is no monitor directly above or to the left(right) let besideX = this._rtl ? monitor.x + 1 : cornerX - 1; diff --git a/panelStyle.js b/panelStyle.js index d0a28d7..6ef6c10 100644 --- a/panelStyle.js +++ b/panelStyle.js @@ -29,6 +29,7 @@ import Shell from 'gi://Shell'; import * as Panel from './panel.js'; import * as Taskbar from './taskbar.js'; import * as Utils from './utils.js'; +import {SETTINGS} from './extension.js'; const Mainloop = imports.mainloop; @@ -44,7 +45,7 @@ var PanelStyle = class { disable() { for (let i = 0; i < this._dtpSettingsSignalIds.length; ++i) { - Me.settings.disconnect(this._dtpSettingsSignalIds[i]); + SETTINGS.disconnect(this._dtpSettingsSignalIds[i]); } this._removeStyles(); @@ -62,7 +63,7 @@ var PanelStyle = class { this._dtpSettingsSignalIds = []; for(let i in configKeys) { - this._dtpSettingsSignalIds.push(Me.settings.connect('changed::' + configKeys[i], () => { + this._dtpSettingsSignalIds.push(SETTINGS.connect('changed::' + configKeys[i], () => { this._removeStyles(); this._applyStyles(); })); @@ -72,7 +73,7 @@ var PanelStyle = class { _applyStyles() { this._rightBoxOperations = []; - let trayPadding = Me.settings.get_int('tray-padding'); + let trayPadding = SETTINGS.get_int('tray-padding'); let isVertical = this.panel.checkIfVertical(); let paddingStyle = 'padding: ' + (isVertical ? '%dpx 0' : '0 %dpx'); @@ -105,7 +106,7 @@ var PanelStyle = class { this._rightBoxOperations.push(operation); } - let statusIconPadding = Me.settings.get_int('status-icon-padding'); + let statusIconPadding = SETTINGS.get_int('status-icon-padding'); if(statusIconPadding >= 0) { let statusIconPaddingStyleLine = paddingStyle.format(statusIconPadding) let operation = {}; @@ -118,7 +119,7 @@ var PanelStyle = class { this._rightBoxOperations.push(operation); } - let trayContentSize = Me.settings.get_int('tray-size'); + let trayContentSize = SETTINGS.get_int('tray-size'); if(trayContentSize > 0) { let trayIconSizeStyleLine = 'icon-size: %dpx'.format(trayContentSize) let operation = {}; @@ -149,7 +150,7 @@ var PanelStyle = class { this._leftBoxOperations = []; - let leftboxPadding = Me.settings.get_int('leftbox-padding'); + let leftboxPadding = SETTINGS.get_int('leftbox-padding'); if(leftboxPadding >= 0) { let leftboxPaddingStyleLine = paddingStyle.format(leftboxPadding); let operation = {}; @@ -163,7 +164,7 @@ var PanelStyle = class { this._leftBoxOperations.push(operation); } - let leftboxContentSize = Me.settings.get_int('leftbox-size'); + let leftboxContentSize = SETTINGS.get_int('leftbox-size'); if(leftboxContentSize > 0) { let leftboxIconSizeStyleLine = 'icon-size: %dpx'.format(leftboxContentSize) let operation = {}; diff --git a/progress.js b/progress.js index 4c2f062..03ab49f 100644 --- a/progress.js +++ b/progress.js @@ -24,6 +24,7 @@ import Clutter from 'gi://Clutter'; import Pango from 'gi://Pango'; import St from 'gi://St'; import * as Utils from './utils.js'; +import {SETTINGS} from './extension.js'; const Cairo = imports.cairo; const Signals = imports.signals; @@ -262,11 +263,11 @@ class AppProgress { if (property == 'count') { this.setCount(other[property].get_int64()); } else if (property == 'count-visible') { - this.setCountVisible(Me.settings.get_boolean('progress-show-count') && other[property].get_boolean()); + this.setCountVisible(SETTINGS.get_boolean('progress-show-count') && other[property].get_boolean()); } else if (property == 'progress') { this.setProgress(other[property].get_double()); } else if (property == 'progress-visible') { - this.setProgressVisible(Me.settings.get_boolean('progress-show-bar') && other[property].get_boolean()); + this.setProgressVisible(SETTINGS.get_boolean('progress-show-bar') && other[property].get_boolean()); } else if (property == 'urgent') { this.setUrgent(other[property].get_boolean()); } else { diff --git a/taskbar.js b/taskbar.js index e288193..2ba6922 100644 --- a/taskbar.js +++ b/taskbar.js @@ -46,6 +46,7 @@ import * as PanelSettings from './panelSettings.js'; import * as Pos from './panelPositions.js'; import * as Utils from './utils.js'; import * as WindowPreview from './windowPreview.js'; +import {SETTINGS} from './extension.js'; const Mainloop = imports.mainloop; const Signals = imports.signals; @@ -76,15 +77,15 @@ function extendDashItemContainer(dashItemContainer) { const iconAnimationSettings = { _getDictValue(key) { - let type = Me.settings.get_string('animate-appicon-hover-animation-type'); - return Me.settings.get_value(key).deep_unpack()[type] || 0; + let type = SETTINGS.get_string('animate-appicon-hover-animation-type'); + return SETTINGS.get_value(key).deep_unpack()[type] || 0; }, get type() { - if (!Me.settings.get_boolean('animate-appicon-hover')) + if (!SETTINGS.get_boolean('animate-appicon-hover')) return ""; - return Me.settings.get_string('animate-appicon-hover-animation-type'); + return SETTINGS.get_string('animate-appicon-hover-animation-type'); }, get convexity() { @@ -330,7 +331,7 @@ var Taskbar = class { 'window-left-monitor' ], () => { - if (Me.settings.get_boolean('isolate-monitors')) { + if (SETTINGS.get_boolean('isolate-monitors')) { this._queueRedisplay(); } } @@ -357,7 +358,7 @@ var Taskbar = class { this._syncShowAppsButtonToggled.bind(this) ], [ - Me.settings, + SETTINGS, [ 'changed::dot-size', 'changed::show-favorites', @@ -370,7 +371,7 @@ var Taskbar = class { } ], [ - Me.settings, + SETTINGS, 'changed::group-apps', () => { setAttributes() @@ -378,7 +379,7 @@ var Taskbar = class { } ], [ - Me.settings, + SETTINGS, [ 'changed::group-apps-use-launchers', 'changed::taskbar-locked' @@ -399,11 +400,11 @@ var Taskbar = class { ); let setAttributes = () => { - this.isGroupApps = Me.settings.get_boolean('group-apps'); - this.usingLaunchers = !this.isGroupApps && Me.settings.get_boolean('group-apps-use-launchers'); - this.showFavorites = Me.settings.get_boolean('show-favorites') && - (this.dtpPanel.isPrimary || Me.settings.get_boolean('show-favorites-all-monitors')) - this.showRunningApps = Me.settings.get_boolean('show-running-apps') + this.isGroupApps = SETTINGS.get_boolean('group-apps'); + this.usingLaunchers = !this.isGroupApps && SETTINGS.get_boolean('group-apps-use-launchers'); + this.showFavorites = SETTINGS.get_boolean('show-favorites') && + (this.dtpPanel.isPrimary || SETTINGS.get_boolean('show-favorites-all-monitors')) + this.showRunningApps = SETTINGS.get_boolean('show-running-apps') this.allowSplitApps = this.usingLaunchers || (!this.isGroupApps && !this.showFavorites) } @@ -693,7 +694,7 @@ var Taskbar = class { { setSizeManually: true, showLabel: false, - isDraggable: !Me.settings.get_boolean('taskbar-locked'), + isDraggable: !SETTINGS.get_boolean('taskbar-locked'), }, this.previewMenu, this.iconAnimator @@ -852,8 +853,8 @@ var Taskbar = class { _adjustIconSize() { const thisMonitorIndex = this.dtpPanel.monitor.index; - let panelSize = PanelSettings.getPanelSize(Me.settings, thisMonitorIndex); - let availSize = panelSize - Me.settings.get_int('appicon-padding') * 2; + let panelSize = PanelSettings.getPanelSize(SETTINGS, thisMonitorIndex); + let availSize = panelSize - SETTINGS.get_int('appicon-padding') * 2; let minIconSize = MIN_ICON_SIZE + panelSize % 2; if (availSize == this.iconSize) @@ -1084,8 +1085,8 @@ var Taskbar = class { icon.updateHotkeyNumberOverlay(); }); - if (Me.settings.get_boolean('hot-keys') && - Me.settings.get_string('hotkeys-overlay-combo') === 'ALWAYS') + if (SETTINGS.get_boolean('hot-keys') && + SETTINGS.get_string('hotkeys-overlay-combo') === 'ALWAYS') this.toggleNumberOverlay(true); } @@ -1249,7 +1250,7 @@ var Taskbar = class { // find visible view if (this.showAppsButton.checked) { - if (Me.settings.get_boolean('show-apps-override-escape')) { + if (SETTINGS.get_boolean('show-apps-override-escape')) { //override escape key to return to the desktop when entering the overview using the showapps button SearchController._onStageKeyPress = function(actor, event) { if (Main.modalCount == 1 && event.get_key_symbol() === Clutter.KEY_Escape) { @@ -1385,7 +1386,7 @@ var TaskbarItemContainer = GObject.registerClass({ // For ItemShowLabel _getIconAnimationOffset() { - if (!Me.settings.get_boolean('animate-appicon-hover')) + if (!SETTINGS.get_boolean('animate-appicon-hover')) return 0; let travel = iconAnimationSettings.travel; diff --git a/transparency.js b/transparency.js index 83497c4..e48ffc9 100644 --- a/transparency.js +++ b/transparency.js @@ -25,6 +25,7 @@ import * as Config from 'resource:///org/gnome/shell/misc/config.js'; import * as Panel from './panel.js'; import * as Proximity from './proximity.js'; import * as Utils from './utils.js'; +import {SETTINGS} from './extension.js'; var DynamicTransparency = class { @@ -72,7 +73,7 @@ var DynamicTransparency = class { () => this._updateAlphaAndSet() ], [ - Me.settings, + SETTINGS, [ 'changed::trans-use-custom-bg', 'changed::trans-bg-color' @@ -80,7 +81,7 @@ var DynamicTransparency = class { () => this._updateColorAndSet() ], [ - Me.settings, + SETTINGS, [ 'changed::trans-use-custom-opacity', 'changed::trans-panel-opacity', @@ -91,7 +92,7 @@ var DynamicTransparency = class { () => this._updateAlphaAndSet() ], [ - Me.settings, + SETTINGS, [ 'changed::trans-use-custom-gradient', 'changed::trans-gradient-top-color', @@ -102,7 +103,7 @@ var DynamicTransparency = class { () => this._updateGradientAndSet() ], [ - Me.settings, + SETTINGS, [ 'changed::trans-dynamic-behavior', 'changed::trans-use-dynamic-opacity', @@ -111,7 +112,7 @@ var DynamicTransparency = class { () => this._updateProximityWatch() ], [ - Me.settings, + SETTINGS, 'changed::trans-dynamic-anim-time', () => this._updateAnimationDuration() ] @@ -121,9 +122,9 @@ var DynamicTransparency = class { _updateProximityWatch() { this._proximityManager.removeWatch(this._proximityWatchId); - if (Me.settings.get_boolean('trans-use-dynamic-opacity')) { + if (SETTINGS.get_boolean('trans-use-dynamic-opacity')) { let isVertical = this._dtpPanel.checkIfVertical(); - let threshold = Me.settings.get_int('trans-dynamic-distance'); + let threshold = SETTINGS.get_int('trans-dynamic-distance'); this._windowOverlap = false; this._updateAlphaAndSet() @@ -131,7 +132,7 @@ var DynamicTransparency = class { this._proximityWatchId = this._proximityManager.createWatch( this._dtpPanel.panelBox.get_parent(), this._dtpPanel.monitor.index, - Proximity.Mode[Me.settings.get_string('trans-dynamic-behavior')], + Proximity.Mode[SETTINGS.get_string('trans-dynamic-behavior')], isVertical ? threshold : 0, isVertical ? 0 : threshold, overlap => { @@ -143,7 +144,7 @@ var DynamicTransparency = class { } _updateAnimationDuration() { - this.animationDuration = (Me.settings.get_int('trans-dynamic-anim-time') * 0.001) + 's;'; + this.animationDuration = (SETTINGS.get_int('trans-dynamic-anim-time') * 0.001) + 's;'; } _updateAllAndSet() { @@ -179,17 +180,17 @@ var DynamicTransparency = class { } _updateColor(themeBackground) { - this.backgroundColorRgb = Me.settings.get_boolean('trans-use-custom-bg') ? - Me.settings.get_string('trans-bg-color') : + this.backgroundColorRgb = SETTINGS.get_boolean('trans-use-custom-bg') ? + SETTINGS.get_string('trans-bg-color') : (themeBackground || this._getThemeBackground()); } _updateAlpha(themeBackground) { - if (this._windowOverlap && !Main.overview.visibleTarget && Me.settings.get_boolean('trans-use-dynamic-opacity')) { - this.alpha = Me.settings.get_double('trans-dynamic-anim-target'); + if (this._windowOverlap && !Main.overview.visibleTarget && SETTINGS.get_boolean('trans-use-dynamic-opacity')) { + this.alpha = SETTINGS.get_double('trans-dynamic-anim-target'); } else { - this.alpha = Me.settings.get_boolean('trans-use-custom-opacity') ? - Me.settings.get_double('trans-panel-opacity') : + this.alpha = SETTINGS.get_boolean('trans-use-custom-opacity') ? + SETTINGS.get_double('trans-panel-opacity') : (themeBackground || this._getThemeBackground()).alpha * 0.003921569; // 1 / 255 = 0.003921569 } } @@ -197,12 +198,12 @@ var DynamicTransparency = class { _updateGradient() { this._gradientStyle = ''; - if (Me.settings.get_boolean('trans-use-custom-gradient')) { + if (SETTINGS.get_boolean('trans-use-custom-gradient')) { this._gradientStyle += 'background-gradient-direction: ' + (this._dtpPanel.checkIfVertical() ? 'horizontal;' : 'vertical;') + - 'background-gradient-start: ' + Utils.getrgbaColor(Me.settings.get_string('trans-gradient-top-color'), - Me.settings.get_double('trans-gradient-top-opacity')) + - 'background-gradient-end: ' + Utils.getrgbaColor(Me.settings.get_string('trans-gradient-bottom-color'), - Me.settings.get_double('trans-gradient-bottom-opacity')); + 'background-gradient-start: ' + Utils.getrgbaColor(SETTINGS.get_string('trans-gradient-top-color'), + SETTINGS.get_double('trans-gradient-top-opacity')) + + 'background-gradient-end: ' + Utils.getrgbaColor(SETTINGS.get_string('trans-gradient-bottom-color'), + SETTINGS.get_double('trans-gradient-bottom-opacity')); } } diff --git a/windowPreview.js b/windowPreview.js index 4efae2f..55a8af9 100644 --- a/windowPreview.js +++ b/windowPreview.js @@ -30,6 +30,7 @@ import * as Workspace from 'resource:///org/gnome/shell/ui/workspace.js'; import * as Panel from './panel.js'; import * as Taskbar from './taskbar.js'; import * as Utils from './utils.js'; +import {SETTINGS, DESKTOPSETTINGS} from './extension.js'; const Mainloop = imports.mainloop; const Signals = imports.signals; @@ -143,7 +144,7 @@ var PreviewMenu = GObject.registerClass({ } ], [ - Me.settings, + SETTINGS, [ 'changed::panel-sizes', 'changed::window-preview-size', @@ -169,7 +170,7 @@ var PreviewMenu = GObject.registerClass({ } requestOpen(appIcon) { - let timeout = Me.settings.get_int('show-window-previews-timeout'); + let timeout = SETTINGS.get_int('show-window-previews-timeout'); if (this.opened) { timeout = Math.min(100, timeout); @@ -263,9 +264,9 @@ var PreviewMenu = GObject.registerClass({ requestPeek(window) { this._timeoutsHandler.remove(T3); - if (Me.settings.get_boolean('peek-mode')) { + if (SETTINGS.get_boolean('peek-mode')) { if (this.peekInitialWorkspaceIndex < 0) { - this._timeoutsHandler.add([T3, Me.settings.get_int('enter-peek-mode-timeout'), () => this._peek(window)]); + this._timeoutsHandler.add([T3, SETTINGS.get_int('enter-peek-mode-timeout'), () => this._peek(window)]); } else { this._peek(window); } @@ -368,7 +369,7 @@ var PreviewMenu = GObject.registerClass({ } _addCloseTimeout() { - this._timeoutsHandler.add([T2, Me.settings.get_int('leave-timeout'), () => this.close()]); + this._timeoutsHandler.add([T2, SETTINGS.get_int('leave-timeout'), () => this.close()]); } _onHoverChanged() { @@ -413,22 +414,22 @@ var PreviewMenu = GObject.registerClass({ _refreshGlobals() { isLeftButtons = Meta.prefs_get_button_layout().left_buttons.indexOf(Meta.ButtonFunction.CLOSE) >= 0; - isTopHeader = Me.settings.get_string('window-preview-title-position') == 'TOP'; - isManualStyling = Me.settings.get_boolean('window-preview-manual-styling'); + isTopHeader = SETTINGS.get_string('window-preview-title-position') == 'TOP'; + isManualStyling = SETTINGS.get_boolean('window-preview-manual-styling'); scaleFactor = Utils.getScaleFactor(); - headerHeight = Me.settings.get_boolean('window-preview-show-title') ? HEADER_HEIGHT * scaleFactor : 0; - animationTime = Me.settings.get_int('window-preview-animation-time') * .001; + headerHeight = SETTINGS.get_boolean('window-preview-show-title') ? HEADER_HEIGHT * scaleFactor : 0; + animationTime = SETTINGS.get_int('window-preview-animation-time') * .001; aspectRatio.x = { - size: Me.settings.get_int('window-preview-aspect-ratio-x'), - fixed: Me.settings.get_boolean('window-preview-fixed-x') + size: SETTINGS.get_int('window-preview-aspect-ratio-x'), + fixed: SETTINGS.get_boolean('window-preview-fixed-x') }; aspectRatio.y = { - size: Me.settings.get_int('window-preview-aspect-ratio-y'), - fixed: Me.settings.get_boolean('window-preview-fixed-y') + size: SETTINGS.get_int('window-preview-aspect-ratio-y'), + fixed: SETTINGS.get_boolean('window-preview-fixed-y') }; - alphaBg = Me.settings.get_boolean('preview-use-custom-opacity') ? - Me.settings.get_int('preview-custom-opacity') * .01 : + alphaBg = SETTINGS.get_boolean('preview-use-custom-opacity') ? + SETTINGS.get_int('preview-custom-opacity') * .01 : this.panel.dynamicTransparency.alpha; } @@ -436,8 +437,8 @@ var PreviewMenu = GObject.registerClass({ let x, y, w; let geom = this.panel.getGeometry(); let panelBoxTheme = this.panel.panelBox.get_theme_node(); - let previewSize = (Me.settings.get_int('window-preview-size') + - Me.settings.get_int('window-preview-padding') * 2) * scaleFactor; + let previewSize = (SETTINGS.get_int('window-preview-size') + + SETTINGS.get_int('window-preview-padding') * 2) * scaleFactor; if (this.isVertical) { w = previewSize; @@ -467,7 +468,7 @@ var PreviewMenu = GObject.registerClass({ let sourceContentBox = sourceNode.get_content_box(this.currentAppIcon.get_allocation_box()); let sourceAllocation = Utils.getTransformedAllocation(this.currentAppIcon); let [previewsWidth, previewsHeight] = this._getPreviewsSize(); - let appIconMargin = Me.settings.get_int('appicon-margin') / scaleFactor; + let appIconMargin = SETTINGS.get_int('appicon-margin') / scaleFactor; let x = 0, y = 0; previewsWidth = Math.min(previewsWidth, this.panel.monitor.width); @@ -589,7 +590,7 @@ var PreviewMenu = GObject.registerClass({ _peek(window) { let currentWorkspace = Utils.getCurrentWorkspace(); let windowWorkspace = window.get_workspace(); - let focusWindow = () => this._focusMetaWindow(Me.settings.get_int('peek-mode-opacity'), window); + let focusWindow = () => this._focusMetaWindow(SETTINGS.get_int('peek-mode-opacity'), window); this._restorePeekedWindowStack(); @@ -709,7 +710,7 @@ var Preview = GObject.registerClass({ this._needsCloseButton = true; this.cloneWidth = this.cloneHeight = 0; this._previewMenu = previewMenu; - this._padding = Me.settings.get_int('window-preview-padding') * scaleFactor; + this._padding = SETTINGS.get_int('window-preview-padding') * scaleFactor; this._previewDimensions = this._getPreviewDimensions(); this.animatingOut = false; @@ -883,7 +884,7 @@ var Preview = GObject.registerClass({ this._hideOrShowCloseButton(true); this.reactive = false; - if (!Me.settings.get_boolean('group-apps')) { + if (!SETTINGS.get_boolean('group-apps')) { this._previewMenu.close(); } else { this._previewMenu.endPeekHere(); @@ -898,7 +899,7 @@ var Preview = GObject.registerClass({ this.activate(); break; case 2: // Middle click - if (Me.settings.get_boolean('preview-middle-click-close')) { + if (SETTINGS.get_boolean('preview-middle-click-close')) { this._onCloseBtnClick(); } break; @@ -957,21 +958,21 @@ var Preview = GObject.registerClass({ _updateHeader() { if (headerHeight) { - let iconTextureSize = Me.settings.get_boolean('window-preview-use-custom-icon-size') ? - Me.settings.get_int('window-preview-custom-icon-size') : + let iconTextureSize = SETTINGS.get_boolean('window-preview-use-custom-icon-size') ? + SETTINGS.get_int('window-preview-custom-icon-size') : headerHeight / scaleFactor * .6; let icon = this._previewMenu.getCurrentAppIcon().app.create_icon_texture(iconTextureSize); let workspaceIndex = ''; let workspaceStyle = null; - let fontScale = Me.desktopSettings.get_double('text-scaling-factor'); - let commonTitleStyles = 'color: ' + Me.settings.get_string('window-preview-title-font-color') + ';' + - 'font-size: ' + Me.settings.get_int('window-preview-title-font-size') * fontScale + 'px;' + - 'font-weight: ' + Me.settings.get_string('window-preview-title-font-weight') + ';'; + let fontScale = DESKTOPSETTINGS.get_double('text-scaling-factor'); + let commonTitleStyles = 'color: ' + SETTINGS.get_string('window-preview-title-font-color') + ';' + + 'font-size: ' + SETTINGS.get_int('window-preview-title-font-size') * fontScale + 'px;' + + 'font-weight: ' + SETTINGS.get_string('window-preview-title-font-weight') + ';'; this._iconBin.destroy_all_children(); this._iconBin.add_child(icon); - if (!Me.settings.get_boolean('isolate-workspaces')) { + if (!SETTINGS.get_boolean('isolate-workspaces')) { workspaceIndex = (this.window.get_workspace().index() + 1).toString(); workspaceStyle = 'margin: 0 4px 0 ' + (isLeftButtons ? Math.round((headerHeight - icon.width) * .5) + 'px' : '0') + '; padding: 0 4px;' + 'border: 2px solid ' + this._getRgbaColor(FOCUSED_COLOR_OFFSET, .8) + 'border-radius: 2px;' + commonTitleStyles; @@ -1096,7 +1097,7 @@ var Preview = GObject.registerClass({ } _getPreviewDimensions() { - let size = Me.settings.get_int('window-preview-size') * scaleFactor; + let size = SETTINGS.get_int('window-preview-size') * scaleFactor; let w, h; if (this._previewMenu.isVertical) { From 56306fb76bdb1b28d2aa79ef50468b44bd1b5809 Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Sun, 13 Aug 2023 23:00:56 +0200 Subject: [PATCH 18/58] use exported persistent storage --- panel.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/panel.js b/panel.js index d1be58b..8f0abee 100644 --- a/panel.js +++ b/panel.js @@ -57,7 +57,7 @@ import * as Progress from './progress.js'; import * as Intellihide from './intellihide.js'; import * as Transparency from './transparency.js'; -import {SETTINGS, DESKTOPSETTINGS} from './extension.js'; +import {SETTINGS, DESKTOPSETTINGS, PERSISTENTSTORAGE} from './extension.js'; import {gettext as _} from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js'; const Mainloop = imports.mainloop; @@ -583,19 +583,19 @@ var Panel = GObject.registerClass({ let panelMenu = this.statusArea[propName]; this.menuManager.removeMenu(panelMenu.menu); - Me.persistentStorage[propName].push(panelMenu); + PERSISTENTSTORAGE[propName].push(panelMenu); this.statusArea[propName] = null; } } _getPanelMenu(propName, constr) { - Me.persistentStorage[propName] = Me.persistentStorage[propName] || []; + PERSISTENTSTORAGE[propName] = PERSISTENTSTORAGE[propName] || []; - if (!Me.persistentStorage[propName].length) { - Me.persistentStorage[propName].push(new constr()); + if (!PERSISTENTSTORAGE[propName].length) { + PERSISTENTSTORAGE[propName].push(new constr()); } - return Me.persistentStorage[propName].pop(); + return PERSISTENTSTORAGE[propName].pop(); } _adjustForOverview() { From c9789f013c012256b1c5880f41f23cd43cb405dd Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Sun, 13 Aug 2023 23:04:35 +0200 Subject: [PATCH 19/58] export path, uuid and use it --- appIcons.js | 4 ++-- desktopIconsIntegration.js | 4 +++- extension.js | 4 ++++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/appIcons.js b/appIcons.js index b0193cd..73bb607 100644 --- a/appIcons.js +++ b/appIcons.js @@ -49,7 +49,7 @@ import * as Utils from './utils.js'; import * as PanelSettings from './panelSettings.js'; import * as Taskbar from './taskbar.js'; import * as Progress from './progress.js'; -import {SETTINGS, DESKTOPSETTINGS} from './extension.js'; +import {SETTINGS, DESKTOPSETTINGS, EXTENSION_PATH} from './extension.js'; import {gettext as _} from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js'; const Mainloop = imports.mainloop; @@ -599,7 +599,7 @@ var TaskbarAppIcon = GObject.registerClass({ bgSvg += (this.dtpPanel.checkIfVertical() ? '_2' : '_3'); } - inlineStyle += "background-image: url('" + Me.path + bgSvg + ".svg');" + + inlineStyle += "background-image: url('" + EXTENSION_PATH + bgSvg + ".svg');" + "background-position: 0 " + (pos == DOT_POSITION.TOP ? highlightMargin : 0) + "px;" + "background-size: " + backgroundSize; } diff --git a/desktopIconsIntegration.js b/desktopIconsIntegration.js index 8ecd339..abeebe8 100644 --- a/desktopIconsIntegration.js +++ b/desktopIconsIntegration.js @@ -58,6 +58,8 @@ import GLib from 'gi://GLib'; import * as Main from 'resource:///org/gnome/shell/ui/main.js'; +import {EXTENSION_UUID} from './extension.js'; + import * as ExtensionUtils from 'resource:///org/gnome/shell/misc/extensionUtils.js'; const IDENTIFIER_UUID = "130cbc66-235c-4bd6-8571-98d2d8bba5e2"; @@ -153,6 +155,6 @@ var DesktopIconsUsableAreaClass = class { const usableArea = extension?.stateObj?.DesktopIconsUsableArea; if (usableArea?.uuid === IDENTIFIER_UUID) - usableArea.setMarginsForExtension(Me.uuid, this._margins); + usableArea.setMarginsForExtension(EXTENSION_UUID, this._margins); } } diff --git a/extension.js b/extension.js index 245adb2..6b57760 100644 --- a/extension.js +++ b/extension.js @@ -46,6 +46,8 @@ let extensionSystem = (Main.extensionManager || imports.ui.extensionSystem); export var SETTINGS = null; export var DESKTOPSETTINGS = null; export var PERSISTENTSTORAGE = null; +export var EXTENSION_UUID = null; +export var EXTENSION_PATH = null; export default class DashToPanelExtension extends Extension { constructor(metadata) { @@ -134,6 +136,8 @@ function _enable(extension) { SETTINGS = extension.getSettings('org.gnome.shell.extensions.dash-to-panel'); DESKTOPSETTINGS = extension.getSettings('org.gnome.desktop.interface'); + EXTENSION_UUID = extension.uuid + EXTENSION_PATH = extension.path Main.layoutManager.startInOverview = !SETTINGS.get_boolean('hide-overview-on-startup'); From 6acd829e633cffacb94d28d42ba8005c68209c9e Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Sun, 13 Aug 2023 23:24:32 +0200 Subject: [PATCH 20/58] fix more translation imports --- appIcons.js | 2 +- panel.js | 2 +- utils.js | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/appIcons.js b/appIcons.js index 73bb607..761b452 100644 --- a/appIcons.js +++ b/appIcons.js @@ -50,7 +50,7 @@ import * as PanelSettings from './panelSettings.js'; import * as Taskbar from './taskbar.js'; import * as Progress from './progress.js'; import {SETTINGS, DESKTOPSETTINGS, EXTENSION_PATH} from './extension.js'; -import {gettext as _} from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js'; +import {gettext as _} from 'resource:///org/gnome/shell/extensions/extension.js'; const Mainloop = imports.mainloop; const Signals = imports.signals; diff --git a/panel.js b/panel.js index 8f0abee..0e8f15c 100644 --- a/panel.js +++ b/panel.js @@ -58,7 +58,7 @@ import * as Progress from './progress.js'; import * as Intellihide from './intellihide.js'; import * as Transparency from './transparency.js'; import {SETTINGS, DESKTOPSETTINGS, PERSISTENTSTORAGE} from './extension.js'; -import {gettext as _} from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js'; +import {gettext as _} from 'resource:///org/gnome/shell/extensions/extension.js'; const Mainloop = imports.mainloop; const Gi = imports._gi; diff --git a/utils.js b/utils.js index 139a75d..8f2873c 100644 --- a/utils.js +++ b/utils.js @@ -37,7 +37,6 @@ import * as MessageTray from 'resource:///org/gnome/shell/ui/messageTray.js'; const Gi = imports._gi; const Mainloop = imports.mainloop; -var TRANSLATION_DOMAIN = imports.misc.extensionUtils.getCurrentExtension().metadata['gettext-domain']; var SCROLL_TIME = Util.SCROLL_TIME / (Util.SCROLL_TIME > 1 ? 1000 : 1); // simplify global signals and function injections handling From 39137bde156b900566d1c852e1d2462daf1ba557 Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Sun, 13 Aug 2023 23:29:53 +0200 Subject: [PATCH 21/58] fix SearchController import --- taskbar.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/taskbar.js b/taskbar.js index 2ba6922..28e8c05 100644 --- a/taskbar.js +++ b/taskbar.js @@ -38,6 +38,7 @@ import * as IconGrid from 'resource:///org/gnome/shell/ui/iconGrid.js'; import * as Main from 'resource:///org/gnome/shell/ui/main.js'; import * as PopupMenu from 'resource:///org/gnome/shell/ui/popupMenu.js'; import * as Workspace from 'resource:///org/gnome/shell/ui/workspace.js'; +import * as SearchController from 'resource:///org/gnome/shell/ui/searchController.js'; import * as AppIcons from './appIcons.js'; import * as Panel from './panel.js'; @@ -51,9 +52,6 @@ import {SETTINGS} from './extension.js'; const Mainloop = imports.mainloop; const Signals = imports.signals; -const SearchController = imports.ui.main.overview._overview._controls._searchController; -const AppDisplay = imports.ui.main.overview._overview._controls.appDisplay; - var DASH_ANIMATION_TIME = Dash.DASH_ANIMATION_TIME / (Dash.DASH_ANIMATION_TIME > 1 ? 1000 : 1); var DASH_ITEM_HOVER_TIMEOUT = Dash.DASH_ITEM_HOVER_TIMEOUT; var MIN_ICON_SIZE = 4; From a1461db80d972b78a53daebc6f155cd22d753139 Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Sun, 13 Aug 2023 23:39:55 +0200 Subject: [PATCH 22/58] export classes from panelManager.js --- extension.js | 2 +- panelManager.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/extension.js b/extension.js index 6b57760..bba4f70 100644 --- a/extension.js +++ b/extension.js @@ -148,7 +148,7 @@ function _enable(extension) { }); } - panelManager = new PanelManager(); + panelManager = new PanelManager.PanelManager(); panelManager.enable(); diff --git a/panelManager.js b/panelManager.js index b996e9c..9dc222d 100755 --- a/panelManager.js +++ b/panelManager.js @@ -57,7 +57,7 @@ import { SecondaryMonitorDisplay, WorkspacesView } from 'resource:///org/gnome/s const Gi = imports._gi; -var PanelManager = class { +export var PanelManager = class { constructor() { this.overview = new Overview(); @@ -530,7 +530,7 @@ var PanelManager = class { // This class drives long-running icon animations, to keep them running in sync // with each other. -var IconAnimator = class { +export var IconAnimator = class { constructor(actor) { this._count = 0; From 32021f825e068f346dd7c1f0787b2c92560c5547 Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Sun, 13 Aug 2023 23:44:02 +0200 Subject: [PATCH 23/58] export classes in panel.js --- panel.js | 4 ++-- panelManager.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/panel.js b/panel.js index 0e8f15c..6c0ed65 100644 --- a/panel.js +++ b/panel.js @@ -73,7 +73,7 @@ const T5 = 'trackerFocusAppTimeout'; const T6 = 'scrollPanelDelayTimeout'; const T7 = 'waitPanelBoxAllocation'; -var Panel = GObject.registerClass({ +export var Panel = GObject.registerClass({ }, class Panel extends St.Widget { _init(panelManager, monitor, panelBox, isStandalone) { @@ -1274,7 +1274,7 @@ var Panel = GObject.registerClass({ } }); -var SecondaryPanel = GObject.registerClass({ +export var SecondaryPanel = GObject.registerClass({ }, class SecondaryPanel extends St.Widget { _init(params) { diff --git a/panelManager.js b/panelManager.js index 9dc222d..b9e6330 100755 --- a/panelManager.js +++ b/panelManager.js @@ -427,7 +427,7 @@ export var PanelManager = class { clipContainer.add_child(panelBox); Main.layoutManager.trackChrome(panelBox, { trackFullscreen: true, affectsStruts: true, affectsInputRegion: true }); - panel = new Panel(this, monitor, panelBox, isStandalone); + panel = new Panel.Panel(this, monitor, panelBox, isStandalone); panelBox.add(panel); panel.enable(); From 8a987a4ec2a8a0968f3126d6af1b53612985a1e3 Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Sun, 13 Aug 2023 23:47:22 +0200 Subject: [PATCH 24/58] export overview class --- overview.js | 2 +- panelManager.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/overview.js b/overview.js index d38dc89..7b17dc5 100644 --- a/overview.js +++ b/overview.js @@ -45,7 +45,7 @@ const LABEL_MARGIN = 60; const T1 = 'swipeEndTimeout'; const T2 = 'numberOverlayTimeout'; -var Overview = class { +export var Overview = class { constructor() { this._numHotkeys = 10; diff --git a/panelManager.js b/panelManager.js index b9e6330..91b1f4e 100755 --- a/panelManager.js +++ b/panelManager.js @@ -60,7 +60,7 @@ const Gi = imports._gi; export var PanelManager = class { constructor() { - this.overview = new Overview(); + this.overview = new Overview.Overview(); this.panelsElementPositions = {}; this._saveMonitors(); From 8cabdd466235dd9bd715d702468e874f9520e963 Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Sun, 13 Aug 2023 23:49:34 +0200 Subject: [PATCH 25/58] export classes from panelStyle.js --- panel.js | 2 +- panelStyle.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/panel.js b/panel.js index 6c0ed65..cf860e2 100644 --- a/panel.js +++ b/panel.js @@ -83,7 +83,7 @@ export var Panel = GObject.registerClass({ this._signalsHandler = new Utils.GlobalSignalsHandler(); this.panelManager = panelManager; - this.panelStyle = new PanelStyle(); + this.panelStyle = new PanelStyle.PanelStyle(); this.monitor = monitor; this.panelBox = panelBox; diff --git a/panelStyle.js b/panelStyle.js index 6ef6c10..c1d4452 100644 --- a/panelStyle.js +++ b/panelStyle.js @@ -33,7 +33,7 @@ import {SETTINGS} from './extension.js'; const Mainloop = imports.mainloop; -var PanelStyle = class { +export var PanelStyle = class { enable(panel) { this.panel = panel; From 01d63c2332dbeb3d125e4df5fd3c3e15593899f3 Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Sun, 13 Aug 2023 23:51:06 +0200 Subject: [PATCH 26/58] export classes from progress.js --- progress.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/progress.js b/progress.js index 03ab49f..eb16aa2 100644 --- a/progress.js +++ b/progress.js @@ -30,7 +30,7 @@ const Cairo = imports.cairo; const Signals = imports.signals; -var ProgressManager = class { +export var ProgressManager = class { constructor() { this._entriesByDBusName = {}; @@ -165,7 +165,7 @@ var ProgressManager = class { }; // Signals.addSignalMethods(ProgressManager.prototype); -class AppProgress { +export class AppProgress { constructor(dbusName, appId, properties) { this._dbusName = dbusName; @@ -281,7 +281,7 @@ class AppProgress { // Signals.addSignalMethods(AppProgress.prototype); -var ProgressIndicator = class { +export var ProgressIndicator = class { constructor(source, progressManager) { this._source = source; From 24f4552a79da26c9a899d1e6271f8ab26e02c202 Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Sun, 13 Aug 2023 23:51:52 +0200 Subject: [PATCH 27/58] export classes from profimity.js --- proximity.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/proximity.js b/proximity.js index 3e03343..2d0c4ca 100644 --- a/proximity.js +++ b/proximity.js @@ -34,7 +34,7 @@ var Mode = { MAXIMIZED_WINDOWS: 2 }; -class ProximityWatch { +export class ProximityWatch { constructor(actor, monitorIndex, mode, xThreshold, yThreshold, handler) { this.actor = actor; @@ -65,7 +65,7 @@ class ProximityWatch { } }; -var ProximityManager = class { +export var ProximityManager = class { constructor() { this._counter = 1; From 59bc598566cb26fec1968a2e0bc957ef3c45de7c Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Sun, 13 Aug 2023 23:55:46 +0200 Subject: [PATCH 28/58] export classes and functions from taskbar.js --- panel.js | 2 +- taskbar.js | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/panel.js b/panel.js index cf860e2..ff727ad 100644 --- a/panel.js +++ b/panel.js @@ -214,7 +214,7 @@ export var Panel = GObject.registerClass({ this.dynamicTransparency = new Transparency.DynamicTransparency(this); - this.taskbar = new Taskbar(this); + this.taskbar = new Taskbar.Taskbar(this); this.panel.add_child(this.taskbar.actor); diff --git a/taskbar.js b/taskbar.js index 28e8c05..06208ec 100644 --- a/taskbar.js +++ b/taskbar.js @@ -69,7 +69,7 @@ const T3 = 'resetHoverTimeout' * thus use this ugly pattern. */ -function extendDashItemContainer(dashItemContainer) { +export function extendDashItemContainer(dashItemContainer) { dashItemContainer.showLabel = AppIcons.ItemShowLabel; }; @@ -117,7 +117,7 @@ const iconAnimationSettings = { * - modified chldBox calculations for when 'show-apps-at-top' option is checked * - handle horizontal dash */ -var TaskbarActor = GObject.registerClass({ +export var TaskbarActor = GObject.registerClass({ }, class TaskbarActor extends St.Widget { _init(delegate) { this._delegate = delegate; @@ -198,7 +198,7 @@ var TaskbarActor = GObject.registerClass({ * - Sync minimization application target position. */ -var Taskbar = class { +export var Taskbar = class { constructor(panel) { this.dtpPanel = panel; @@ -1340,7 +1340,7 @@ const CloneContainerConstraint = GObject.registerClass({ } }); -var TaskbarItemContainer = GObject.registerClass({ +export var TaskbarItemContainer = GObject.registerClass({ }, class TaskbarItemContainer extends Dash.DashItemContainer { @@ -1551,7 +1551,7 @@ var DragPlaceholderItem = GObject.registerClass({ } }); -function getAppStableSequence(app, monitor) { +export function getAppStableSequence(app, monitor) { let windows = AppIcons.getInterestingWindows(app, monitor); return windows.reduce((prevWindow, window) => { @@ -1559,10 +1559,10 @@ function getAppStableSequence(app, monitor) { }, Infinity); } -function sortWindowsCompareFunction(windowA, windowB) { +export function sortWindowsCompareFunction(windowA, windowB) { return getWindowStableSequence(windowA) - getWindowStableSequence(windowB); } -function getWindowStableSequence(window) { +export function getWindowStableSequence(window) { return ('_dtpPosition' in window ? window._dtpPosition : window.get_stable_sequence()); } From 204f33eb7025e675a512a5b92c133c79811d3d1c Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Sun, 13 Aug 2023 23:56:26 +0200 Subject: [PATCH 29/58] export classes from transparency.js --- transparency.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/transparency.js b/transparency.js index e48ffc9..2561f03 100644 --- a/transparency.js +++ b/transparency.js @@ -27,7 +27,7 @@ import * as Proximity from './proximity.js'; import * as Utils from './utils.js'; import {SETTINGS} from './extension.js'; -var DynamicTransparency = class { +export var DynamicTransparency = class { constructor(dtpPanel) { this._dtpPanel = dtpPanel; From 61db151f8351fd6ff1967ea2dfb84a2a419689b2 Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Mon, 14 Aug 2023 00:04:25 +0200 Subject: [PATCH 30/58] export classes and functions from utils.js --- utils.js | 78 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/utils.js b/utils.js index 8f2873c..5ea50a4 100644 --- a/utils.js +++ b/utils.js @@ -41,7 +41,7 @@ var SCROLL_TIME = Util.SCROLL_TIME / (Util.SCROLL_TIME > 1 ? 1000 : 1); // simplify global signals and function injections handling // abstract class -var BasicHandler = class { +export var BasicHandler = class { constructor() { this._storage = new Object(); @@ -101,7 +101,7 @@ var BasicHandler = class { } // Manage global signals -var GlobalSignalsHandler = class extends BasicHandler { +export var GlobalSignalsHandler = class extends BasicHandler { _create(item) { let handlers = []; @@ -134,7 +134,7 @@ var GlobalSignalsHandler = class extends BasicHandler { * Manage function injection: both instances and prototype can be overridden * and restored */ -var InjectionsHandler = class extends BasicHandler { +export var InjectionsHandler = class extends BasicHandler { _create(item) { let object = item[0]; @@ -157,7 +157,7 @@ var InjectionsHandler = class extends BasicHandler { /** * Manage timeouts: the added timeouts have their id reset on completion */ -var TimeoutsHandler = class extends BasicHandler { +export var TimeoutsHandler = class extends BasicHandler { _create(item) { let name = item[0]; @@ -194,7 +194,7 @@ var TimeoutsHandler = class extends BasicHandler { // This is wrapper to maintain compatibility with GNOME-Shell 3.30+ as well as // previous versions. -var DisplayWrapper = { +export var DisplayWrapper = { getScreen() { return global.screen || global.display; }, @@ -209,7 +209,7 @@ var DisplayWrapper = { }; let unredirectEnabled = true -var setDisplayUnredirect = (enable) => { +export var setDisplayUnredirect = (enable) => { if (enable && !unredirectEnabled) Meta.enable_unredirect_for_display(global.display); else if (!enable && unredirectEnabled) @@ -218,7 +218,7 @@ var setDisplayUnredirect = (enable) => { unredirectEnabled = enable; }; -var getSystemMenuInfo = function() { +export var getSystemMenuInfo = function() { if (Config.PACKAGE_VERSION < '43') return { name: 'aggregateMenu', @@ -231,27 +231,27 @@ var getSystemMenuInfo = function() { }; } -var getCurrentWorkspace = function() { +export var getCurrentWorkspace = function() { return DisplayWrapper.getWorkspaceManager().get_active_workspace(); }; -var getWorkspaceByIndex = function(index) { +export var getWorkspaceByIndex = function(index) { return DisplayWrapper.getWorkspaceManager().get_workspace_by_index(index); }; -var getWorkspaceCount = function() { +export var getWorkspaceCount = function() { return DisplayWrapper.getWorkspaceManager().n_workspaces; }; -var getStageTheme = function() { +export var getStageTheme = function() { return St.ThemeContext.get_for_stage(global.stage); }; -var getScaleFactor = function() { +export var getScaleFactor = function() { return getStageTheme().scale_factor || 1; }; -var findIndex = function(array, predicate) { +export var findIndex = function(array, predicate) { if (array) { if (Array.prototype.findIndex) { return array.findIndex(predicate); @@ -267,7 +267,7 @@ var findIndex = function(array, predicate) { return -1; }; -var find = function(array, predicate) { +export var find = function(array, predicate) { let index = findIndex(array, predicate); if (index > -1) { @@ -275,7 +275,7 @@ var find = function(array, predicate) { } }; -var mergeObjects = function(main, bck) { +export var mergeObjects = function(main, bck) { for (var prop in bck) { if (!main.hasOwnProperty(prop) && bck.hasOwnProperty(prop)) { main[prop] = bck[prop]; @@ -285,7 +285,7 @@ var mergeObjects = function(main, bck) { return main; }; -var hookVfunc = function(proto, symbol, func) { +export var hookVfunc = function(proto, symbol, func) { if (!func) return if (Gi.gobject_prototype_symbol && proto[Gi.gobject_prototype_symbol]) { @@ -295,14 +295,14 @@ var hookVfunc = function(proto, symbol, func) { } }; -var getTrackedActorData = (actor) => { +export var getTrackedActorData = (actor) => { let trackedIndex = Main.layoutManager._findActor(actor); if (trackedIndex >= 0) return Main.layoutManager._trackedActors[trackedIndex] } -var getTransformedAllocation = function(actor) { +export var getTransformedAllocation = function(actor) { let extents = actor.get_transformed_extents(); let topLeft = extents.get_top_left(); let bottomRight = extents.get_bottom_right(); @@ -310,13 +310,13 @@ var getTransformedAllocation = function(actor) { return { x1: topLeft.x, x2: bottomRight.x, y1: topLeft.y, y2: bottomRight.y }; }; -var setClip = function(actor, x, y, width, height) { +export var setClip = function(actor, x, y, width, height) { actor.set_clip(0, 0, width, height); actor.set_position(x, y); actor.set_size(width, height); }; -var addKeybinding = function(key, settings, handler, modes) { +export var addKeybinding = function(key, settings, handler, modes) { if (!Main.wm._allowedKeybindings[key]) { Main.wm.addKeybinding( key, @@ -328,19 +328,19 @@ var addKeybinding = function(key, settings, handler, modes) { } }; -var removeKeybinding = function(key) { +export var removeKeybinding = function(key) { if (Main.wm._allowedKeybindings[key]) { Main.wm.removeKeybinding(key); } }; -var getrgbColor = function(color) { +export var getrgbColor = function(color) { color = typeof color === 'string' ? Clutter.color_from_string(color)[1] : color; return { red: color.red, green: color.green, blue: color.blue }; }; -var getrgbaColor = function(color, alpha, offset) { +export var getrgbaColor = function(color, alpha, offset) { if (alpha <= 0) { return 'transparent; '; } @@ -360,14 +360,14 @@ var getrgbaColor = function(color, alpha, offset) { return 'rgba(' + rgb.red + ',' + rgb.green + ',' + rgb.blue + ',' + (Math.floor(alpha * 100) * 0.01) + '); ' ; }; -var checkIfColorIsBright = function(color) { +export var checkIfColorIsBright = function(color) { let rgb = getrgbColor(color); let brightness = 0.2126 * rgb.red + 0.7152 * rgb.green + 0.0722 * rgb.blue; return brightness > 128; }; -var getMouseScrollDirection = function(event) { +export var getMouseScrollDirection = function(event) { let direction; switch (event.get_scroll_direction()) { @@ -384,7 +384,7 @@ var getMouseScrollDirection = function(event) { return direction; }; -var checkIfWindowHasTransient = function(window) { +export var checkIfWindowHasTransient = function(window) { let hasTransient; window.foreach_transient(t => !(hasTransient = true)); @@ -392,7 +392,7 @@ var checkIfWindowHasTransient = function(window) { return hasTransient; }; -var activateSiblingWindow = function(windows, direction, startWindow) { +export var activateSiblingWindow = function(windows, direction, startWindow) { let windowIndex = windows.indexOf(global.display.focus_window); let nextWindowIndex = windowIndex < 0 ? startWindow ? windows.indexOf(startWindow) : 0 : @@ -409,7 +409,7 @@ var activateSiblingWindow = function(windows, direction, startWindow) { } }; -var animateWindowOpacity = function(window, tweenOpts) { +export var animateWindowOpacity = function(window, tweenOpts) { //there currently is a mutter bug with the windowactor opacity, starting with 3.34 //https://gitlab.gnome.org/GNOME/mutter/issues/836 @@ -438,7 +438,7 @@ var animateWindowOpacity = function(window, tweenOpts) { animate(window, tweenOpts); }; -var animate = function(actor, options) { +export var animate = function(actor, options) { //the original animations used Tweener instead of Clutter animations, so we //use "time" and "delay" properties defined in seconds, as opposed to Clutter //animations "duration" and "delay" which are defined in milliseconds @@ -471,15 +471,15 @@ var animate = function(actor, options) { actor.ease.apply(actor, params); } -var isAnimating = function(actor, prop) { +export var isAnimating = function(actor, prop) { return !!actor.get_transition(prop); } -var stopAnimations = function(actor) { +export var stopAnimations = function(actor) { actor.remove_all_transitions(); } -var getIndicators = function(delegate) { +export var getIndicators = function(delegate) { if (delegate instanceof St.BoxLayout) { return delegate; } @@ -487,11 +487,11 @@ var getIndicators = function(delegate) { return delegate.indicators; } -var getPoint = function(coords) { +export var getPoint = function(coords) { return new imports.gi.Graphene.Point(coords); } -var notify = function(text, iconName, action, isTransient) { +export var notify = function(text, iconName, action, isTransient) { let source = new MessageTray.SystemNotificationSource(); let notification = new MessageTray.Notification(source, 'Dash to Panel', text); let notifyFunc = source.showNotification || source.notify; @@ -522,7 +522,7 @@ var notify = function(text, iconName, action, isTransient) { * it would be clamp to the current one in any case. * Return the amount of shift applied */ -var ensureActorVisibleInScrollView = function(scrollView, actor, fadeSize, onComplete) { +export var ensureActorVisibleInScrollView = function(scrollView, actor, fadeSize, onComplete) { let vadjustment = scrollView.vscroll.adjustment; let hadjustment = scrollView.hscroll.adjustment; let [vvalue, vlower, vupper, vstepIncrement, vpageIncrement, vpageSize] = vadjustment.get_values(); @@ -579,7 +579,7 @@ var ensureActorVisibleInScrollView = function(scrollView, actor, fadeSize, onCom /** * ColorUtils is adapted from https://github.com/micheleg/dash-to-dock */ -var ColorUtils = { +export var ColorUtils = { colorLuminance(r, g, b, dlum) { // Darken or brighten color by a fraction dlum // Each rgb value is modified by the same fraction. @@ -690,7 +690,7 @@ const MAX_CACHED_ITEMS = 1000; const BATCH_SIZE_TO_DELETE = 50; const DOMINANT_COLOR_ICON_SIZE = 64; -var DominantColorExtractor = class { +export var DominantColorExtractor = class { constructor(app){ this._app = app; @@ -880,7 +880,7 @@ var DominantColorExtractor = class { }; -var drawRoundedLine = function(cr, x, y, width, height, isRoundLeft, isRoundRight, stroke, fill) { +export var drawRoundedLine = function(cr, x, y, width, height, isRoundLeft, isRoundRight, stroke, fill) { if (height > width) { y += Math.floor((height - width) / 2.0); height = width; @@ -918,7 +918,7 @@ var drawRoundedLine = function(cr, x, y, width, height, isRoundLeft, isRoundRigh */ var checkedCommandsMap = new Map(); -function checkIfCommandExists(app) { +export function checkIfCommandExists(app) { let answer = checkedCommandsMap.get(app); if (answer === undefined) { // Command is a shell built in, use shell to call it. From 37e11409b74b2ece03b474dda06a8689b8068303 Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Mon, 14 Aug 2023 00:06:27 +0200 Subject: [PATCH 31/58] export functions and classes from windowPreview.js --- windowPreview.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/windowPreview.js b/windowPreview.js index 55a8af9..d44828a 100644 --- a/windowPreview.js +++ b/windowPreview.js @@ -62,7 +62,7 @@ let scaleFactor = 1; let animationTime = 0; let aspectRatio = {}; -var PreviewMenu = GObject.registerClass({ +export var PreviewMenu = GObject.registerClass({ Signals: { 'open-state-changed': {} } }, class PreviewMenu extends St.Widget { @@ -694,7 +694,7 @@ var PreviewMenu = GObject.registerClass({ } }); -var Preview = GObject.registerClass({ +export var Preview = GObject.registerClass({ }, class Preview extends St.Widget { _init(previewMenu) { @@ -1112,7 +1112,7 @@ var Preview = GObject.registerClass({ } }); -var WindowCloneLayout = GObject.registerClass({ +export var WindowCloneLayout = GObject.registerClass({ }, class WindowCloneLayout extends Clutter.BinLayout { _init(frameRect, bufferRect) { @@ -1140,13 +1140,13 @@ var WindowCloneLayout = GObject.registerClass({ } }); -function setStyle(actor, style) { +export function setStyle(actor, style) { if (!isManualStyling) { actor.set_style(style); } } -function getTweenOpts(opts) { +export function getTweenOpts(opts) { let defaults = { time: animationTime, transition: 'easeInOutQuad' From fb8fd19d95b029c0a7abb2f31dc04fa0a170e8f1 Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Mon, 14 Aug 2023 00:07:10 +0200 Subject: [PATCH 32/58] export class from intellihide.js --- intellihide.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/intellihide.js b/intellihide.js index 6979ffe..681be12 100644 --- a/intellihide.js +++ b/intellihide.js @@ -51,7 +51,7 @@ var Hold = { PERMANENT: 2 }; -var Intellihide = class { +export var Intellihide = class { constructor(dtpPanel) { this._dtpPanel = dtpPanel; From d95db96d4f0c2b24a0c657410ec8b3981e8e1c8a Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Mon, 14 Aug 2023 00:07:47 +0200 Subject: [PATCH 33/58] export class from desktopIconsIntegration.js --- desktopIconsIntegration.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/desktopIconsIntegration.js b/desktopIconsIntegration.js index abeebe8..c308b2c 100644 --- a/desktopIconsIntegration.js +++ b/desktopIconsIntegration.js @@ -64,7 +64,7 @@ import * as ExtensionUtils from 'resource:///org/gnome/shell/misc/extensionUtils const IDENTIFIER_UUID = "130cbc66-235c-4bd6-8571-98d2d8bba5e2"; -var DesktopIconsUsableAreaClass = class { +export var DesktopIconsUsableAreaClass = class { constructor() { this._extensionManager = Main.extensionManager; this._timedMarginsID = 0; From 3f8e5bfb9577a3ff8c790d395dd63315a9e95827 Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Mon, 14 Aug 2023 00:11:03 +0200 Subject: [PATCH 34/58] export functions and classes from appIcons.js --- appIcons.js | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/appIcons.js b/appIcons.js index 761b452..288b8e2 100644 --- a/appIcons.js +++ b/appIcons.js @@ -108,7 +108,7 @@ let tracker = Shell.WindowTracker.get_default(); * */ -var TaskbarAppIcon = GObject.registerClass({ +export var TaskbarAppIcon = GObject.registerClass({ }, class TaskbarAppIcon extends AppDisplay.AppIcon { _init(appInfo, panel, iconParams, previewMenu, iconAnimator) { @@ -1286,7 +1286,7 @@ var TaskbarAppIcon = GObject.registerClass({ }); TaskbarAppIcon.prototype.scaleAndFade = TaskbarAppIcon.prototype.undoScaleAndFade = () => {}; -function minimizeWindow(app, param, monitor){ +export function minimizeWindow(app, param, monitor){ // Param true make all app windows minimize let windows = getInterestingWindows(app, monitor); let current_workspace = Utils.DisplayWrapper.getWorkspaceManager().get_active_workspace(); @@ -1306,7 +1306,7 @@ function minimizeWindow(app, param, monitor){ * By default only non minimized windows are activated. * This activates all windows in the current workspace. */ -function activateAllWindows(app, monitor){ +export function activateAllWindows(app, monitor){ // First activate first window so workspace is switched if needed, // then activate all other app windows in the current workspace. @@ -1325,13 +1325,13 @@ function activateAllWindows(app, monitor){ } } -function activateFirstWindow(app, monitor){ +export function activateFirstWindow(app, monitor){ let windows = getInterestingWindows(app, monitor); Main.activateWindow(windows[0]); } -function cycleThroughWindows(app, reversed, shouldMinimize, monitor) { +export function cycleThroughWindows(app, reversed, shouldMinimize, monitor) { // Store for a little amount of time last clicked app and its windows // since the order changes upon window interaction let MEMORY_TIME=3000; @@ -1372,7 +1372,7 @@ function cycleThroughWindows(app, reversed, shouldMinimize, monitor) { Main.activateWindow(recentlyClickedAppWindows[index]); } -function resetRecentlyClickedApp() { +export function resetRecentlyClickedApp() { if (recentlyClickedAppLoopId > 0) Mainloop.source_remove(recentlyClickedAppLoopId); @@ -1385,7 +1385,7 @@ function resetRecentlyClickedApp() { return false; } -function closeAllWindows(app, monitor) { +export function closeAllWindows(app, monitor) { let windows = getInterestingWindows(app, monitor); for (let i = 0; i < windows.length; i++) windows[i].delete(global.get_current_time()); @@ -1393,7 +1393,7 @@ function closeAllWindows(app, monitor) { // Filter out unnecessary windows, for instance // nautilus desktop window. -function getInterestingWindows(app, monitor, isolateMonitors) { +export function getInterestingWindows(app, monitor, isolateMonitors) { let windows = ( app ? app.get_windows() : @@ -1417,7 +1417,7 @@ function getInterestingWindows(app, monitor, isolateMonitors) { return windows; } -function cssHexTocssRgba(cssHex, opacity) { +export function cssHexTocssRgba(cssHex, opacity) { var bigint = parseInt(cssHex.slice(1), 16); var r = (bigint >> 16) & 255; var g = (bigint >> 8) & 255; @@ -1426,7 +1426,7 @@ function cssHexTocssRgba(cssHex, opacity) { return 'rgba(' + [r, g, b].join(',') + ',' + opacity + ')'; } -function getIconPadding(monitorIndex) { +export function getIconPadding(monitorIndex) { let panelSize = PanelSettings.getPanelSize(SETTINGS, monitorIndex); let padding = SETTINGS.get_int('appicon-padding'); let availSize = panelSize - Taskbar.MIN_ICON_SIZE - panelSize % 2; @@ -1447,7 +1447,7 @@ function getIconPadding(monitorIndex) { * (https://github.com/deuill/shell-extension-quitfromdash) */ - class TaskbarSecondaryMenu extends AppMenu.AppMenu { +export class TaskbarSecondaryMenu extends AppMenu.AppMenu { constructor(source, side) { super(source, side); @@ -1506,7 +1506,7 @@ function getIconPadding(monitorIndex) { /** * This function is used for extendDashItemContainer */ -function ItemShowLabel() { +export function ItemShowLabel() { if (!this._labelText) return; @@ -1587,7 +1587,7 @@ function ItemShowLabel() { * use of this class in place of the original showAppsButton. * */ - var ShowAppsIconWrapper = class { +export var ShowAppsIconWrapper = class { constructor(dtpPanel) { this.realShowAppsIcon = new Dash.ShowAppsIcon(); @@ -1736,7 +1736,7 @@ function ItemShowLabel() { /** * A menu for the showAppsIcon */ -var MyShowAppsIconMenu = class extends PopupMenu.PopupMenu { +export var MyShowAppsIconMenu = class extends PopupMenu.PopupMenu { constructor(actor, dtpPanel) { super(actor, 0, dtpPanel.getPosition()); @@ -1875,7 +1875,7 @@ var MyShowAppsIconMenu = class extends PopupMenu.PopupMenu { }; -var getIconContainerStyle = function(isVertical) { +export var getIconContainerStyle = function(isVertical) { let style = 'padding: '; if (SETTINGS.get_boolean('group-apps')) { From 03a0aee77c9807ee9ec291838d1e43d8bccf9797 Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Mon, 14 Aug 2023 01:02:59 +0200 Subject: [PATCH 35/58] remove the remaining non ESM imports --- appIcons.js | 3 ++- extension.js | 2 +- overview.js | 3 ++- panel.js | 2 +- panelManager.js | 2 +- taskbar.js | 3 ++- utils.js | 12 ++++-------- 7 files changed, 13 insertions(+), 14 deletions(-) diff --git a/appIcons.js b/appIcons.js index 288b8e2..931da6a 100644 --- a/appIcons.js +++ b/appIcons.js @@ -25,6 +25,7 @@ import Clutter from 'gi://Clutter'; import Gio from 'gi://Gio'; import GLib from 'gi://GLib'; +import Graphene from 'gi://Graphene'; import Gtk from 'gi://Gtk'; import GObject from 'gi://GObject'; import Meta from 'gi://Meta'; @@ -276,7 +277,7 @@ export var TaskbarAppIcon = GObject.registerClass({ source: this.child, x: this.child.x, y: this.child.y, width: this.child.width, height: this.child.height, - pivot_point: new imports.gi.Graphene.Point({ x: 0.5, y: 0.5 }), + pivot_point: new Graphene.Point({ x: 0.5, y: 0.5 }), opacity: 255, reactive: false, x_align: Clutter.ActorAlign.CENTER, y_align: Clutter.ActorAlign.CENTER, diff --git a/extension.js b/extension.js index bba4f70..38f9652 100644 --- a/extension.js +++ b/extension.js @@ -41,7 +41,7 @@ const UBUNTU_DOCK_UUID = 'ubuntu-dock@ubuntu.com'; let panelManager; let extensionChangedHandler; let disabledUbuntuDock; -let extensionSystem = (Main.extensionManager || imports.ui.extensionSystem); +let extensionSystem = Main.extensionManager; export var SETTINGS = null; export var DESKTOPSETTINGS = null; diff --git a/overview.js b/overview.js index 7b17dc5..9a9e647 100644 --- a/overview.js +++ b/overview.js @@ -29,6 +29,7 @@ import Shell from 'gi://Shell'; import St from 'gi://St'; import * as Main from 'resource:///org/gnome/shell/ui/main.js'; import * as Workspace from 'resource:///org/gnome/shell/ui/workspace.js'; +import * as MessageTray from 'resource:///org/gnome/shell/ui/messageTray.js'; import { WindowPreview } from 'resource:///org/gnome/shell/ui/windowPreview.js'; import {SETTINGS} from './extension.js'; @@ -356,7 +357,7 @@ export var Overview = class { }, this); if (Main.wm._switchToApplication) { - let gsSettings = new Gio.Settings({ schema_id: imports.ui.windowManager.SHELL_KEYBINDINGS_SCHEMA }); + let gsSettings = new Gio.Settings({ schema_id: MessageTray.SHELL_KEYBINDINGS_SCHEMA }); for (let i = 1; i < 10; ++i) { Utils.addKeybinding(GS_HOTKEYS_KEY + i, gsSettings, Main.wm._switchToApplication.bind(Main.wm)); diff --git a/panel.js b/panel.js index ff727ad..5652b12 100644 --- a/panel.js +++ b/panel.js @@ -966,7 +966,7 @@ export var Panel = GObject.registerClass({ _setVertical(actor, isVertical) { let _set = (actor, isVertical) => { - if (!actor || actor instanceof Dash.DashItemContainer || actor instanceof TaskbarItemContainer) { + if (!actor || actor instanceof Dash.DashItemContainer || actor instanceof TaskbarItemContainer.TaskbarItemContainer) { return; } diff --git a/panelManager.js b/panelManager.js index 91b1f4e..23601bc 100755 --- a/panelManager.js +++ b/panelManager.js @@ -365,7 +365,7 @@ export var PanelManager = class { } else { // No idea why atm, but we need the import at the top of this file and to use the // full imports ns here, otherwise SecondaryMonitorDisplay can't be used ¯\_(ツ)_/¯ - view = new imports.ui.workspacesView.SecondaryMonitorDisplay(i, + view = new SecondaryMonitorDisplay(i, this._controls, this._scrollAdjustment, this._fitModeAdjustment, diff --git a/taskbar.js b/taskbar.js index 06208ec..41fad05 100644 --- a/taskbar.js +++ b/taskbar.js @@ -26,6 +26,7 @@ import Clutter from 'gi://Clutter'; import Gio from 'gi://Gio'; import GLib from 'gi://GLib'; import GObject from 'gi://GObject'; +import Graphene from 'gi://Graphene'; import Gtk from 'gi://Gtk'; import Meta from 'gi://Meta'; import Shell from 'gi://Shell'; @@ -261,7 +262,7 @@ export var Taskbar = class { let fade1 = new St.Widget({ style_class: 'scrollview-fade', reactive: false }); let fade2 = new St.Widget({ style_class: 'scrollview-fade', reactive: false, - pivot_point: new imports.gi.Graphene.Point({ x: .5, y: .5 }), + pivot_point: new Graphene.Point({ x: .5, y: .5 }), rotation_angle_z: 180 }); fade1.set_style(fadeStyle); diff --git a/utils.js b/utils.js index 5ea50a4..eb5df53 100644 --- a/utils.js +++ b/utils.js @@ -25,6 +25,7 @@ import Clutter from 'gi://Clutter'; import GdkPixbuf from 'gi://GdkPixbuf'; import Gio from 'gi://Gio'; import GLib from 'gi://GLib'; +import Graphene from 'gi://Graphene'; import Gtk from 'gi://Gtk'; import Meta from 'gi://Meta'; import Shell from 'gi://Shell'; @@ -33,6 +34,7 @@ import * as Config from 'resource:///org/gnome/shell/misc/config.js'; import * as Util from 'resource:///org/gnome/shell/misc/util.js'; import * as Main from 'resource:///org/gnome/shell/ui/main.js'; import * as MessageTray from 'resource:///org/gnome/shell/ui/messageTray.js'; +import * as UiPanel from 'resource:///org/gnome/shell/ui/panel.js'; const Gi = imports._gi; const Mainloop = imports.mainloop; @@ -219,15 +221,9 @@ export var setDisplayUnredirect = (enable) => { }; export var getSystemMenuInfo = function() { - if (Config.PACKAGE_VERSION < '43') - return { - name: 'aggregateMenu', - constructor: imports.ui.panel.AggregateMenu - }; - return { name: 'quickSettings', - constructor: imports.ui.panel.QuickSettings + constructor: UiPanel.QuickSettings }; } @@ -488,7 +484,7 @@ export var getIndicators = function(delegate) { } export var getPoint = function(coords) { - return new imports.gi.Graphene.Point(coords); + return new Graphene.Point(coords); } export var notify = function(text, iconName, action, isTransient) { From 517d7d2e75bf90d1b7f69fde306a7f4d043b858c Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Sat, 19 Aug 2023 02:44:53 +0200 Subject: [PATCH 36/58] modify Signals import and use addSignalMethods again --- appIcons.js | 4 ++-- extension.js | 4 ++-- progress.js | 6 +++--- taskbar.js | 4 ++-- windowPreview.js | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/appIcons.js b/appIcons.js index 931da6a..5c8dbf7 100644 --- a/appIcons.js +++ b/appIcons.js @@ -54,7 +54,7 @@ import {SETTINGS, DESKTOPSETTINGS, EXTENSION_PATH} from './extension.js'; import {gettext as _} from 'resource:///org/gnome/shell/extensions/extension.js'; const Mainloop = imports.mainloop; -const Signals = imports.signals; +const {signals: Signals} = imports; //timeout names const T2 = 'mouseScrollTimeout'; @@ -1732,7 +1732,7 @@ export var ShowAppsIconWrapper = class { this.realShowAppsIcon.destroy(); } }; -// Signals.addSignalMethods(ShowAppsIconWrapper.prototype); +Signals.addSignalMethods(ShowAppsIconWrapper.prototype); /** * A menu for the showAppsIcon diff --git a/extension.js b/extension.js index 38f9652..d151b08 100644 --- a/extension.js +++ b/extension.js @@ -34,7 +34,7 @@ import * as AppIcons from './appIcons.js'; import {Extension, gettext as _} from 'resource:///org/gnome/shell/extensions/extension.js'; const Mainloop = imports.mainloop; -const Signals = imports.signals; +const {signals: Signals} = imports; const UBUNTU_DOCK_UUID = 'ubuntu-dock@ubuntu.com'; @@ -74,7 +74,7 @@ export default class DashToPanelExtension extends Extension { //create a global object that can emit signals and conveniently expose functionalities to other extensions global.dashToPanel = {}; - // Signals.addSignalMethods(global.dashToPanel); + Signals.addSignalMethods(global.dashToPanel); _enable(this); } diff --git a/progress.js b/progress.js index eb16aa2..d22b492 100644 --- a/progress.js +++ b/progress.js @@ -27,7 +27,7 @@ import * as Utils from './utils.js'; import {SETTINGS} from './extension.js'; const Cairo = imports.cairo; -const Signals = imports.signals; +const {signals: Signals} = imports; export var ProgressManager = class { @@ -163,7 +163,7 @@ export var ProgressManager = class { } } }; -// Signals.addSignalMethods(ProgressManager.prototype); +Signals.addSignalMethods(ProgressManager.prototype); export class AppProgress { @@ -278,7 +278,7 @@ export class AppProgress { } } }; -// Signals.addSignalMethods(AppProgress.prototype); +Signals.addSignalMethods(AppProgress.prototype); export var ProgressIndicator = class { diff --git a/taskbar.js b/taskbar.js index 41fad05..6939b67 100644 --- a/taskbar.js +++ b/taskbar.js @@ -51,7 +51,7 @@ import * as WindowPreview from './windowPreview.js'; import {SETTINGS} from './extension.js'; const Mainloop = imports.mainloop; -const Signals = imports.signals; +const {signals: Signals} = imports; var DASH_ANIMATION_TIME = Dash.DASH_ANIMATION_TIME / (Dash.DASH_ANIMATION_TIME > 1 ? 1000 : 1); var DASH_ITEM_HOVER_TIMEOUT = Dash.DASH_ITEM_HOVER_TIMEOUT; @@ -1324,7 +1324,7 @@ export var Taskbar = class { } }; -// Signals.addSignalMethods(Taskbar.prototype); +Signals.addSignalMethods(Taskbar.prototype); const CloneContainerConstraint = GObject.registerClass({ }, class CloneContainerConstraint extends Clutter.BindConstraint { diff --git a/windowPreview.js b/windowPreview.js index d44828a..1f78a1f 100644 --- a/windowPreview.js +++ b/windowPreview.js @@ -33,7 +33,7 @@ import * as Utils from './utils.js'; import {SETTINGS, DESKTOPSETTINGS} from './extension.js'; const Mainloop = imports.mainloop; -const Signals = imports.signals; +const {signals: Signals} = imports; //timeout intervals const ENSURE_VISIBLE_MS = 200; From e97e5b111aa691ce0c3acee657d19169b7adfe8a Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Sat, 19 Aug 2023 14:01:26 +0200 Subject: [PATCH 37/58] fix quickSettings _volume being renamed to _volumeOutput --- panel.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/panel.js b/panel.js index 5652b12..290eb2c 100644 --- a/panel.js +++ b/panel.js @@ -179,8 +179,8 @@ export var Panel = GObject.registerClass({ enable () { let { name: systemMenuName } = Utils.getSystemMenuInfo(); - if (this.statusArea[systemMenuName]) { - Utils.getIndicators(this.statusArea[systemMenuName]._volume)._dtpIgnoreScroll = 1; + if (this.statusArea[systemMenuName] && this.statusArea[systemMenuName]._volumeOutput) { + Utils.getIndicators(this.statusArea[systemMenuName]._volumeOutput)._dtpIgnoreScroll = 1; } this.geom = this.getGeometry(); @@ -381,7 +381,7 @@ export var Panel = GObject.registerClass({ this._setShowDesktopButton(false); - delete Utils.getIndicators(this.statusArea[systemMenuName]._volume)._dtpIgnoreScroll; + delete Utils.getIndicators(this.statusArea[systemMenuName]._volumeOutput)._dtpIgnoreScroll; if (DateMenu.IndicatorPad) { Utils.hookVfunc(DateMenu.IndicatorPad.prototype, 'get_preferred_width', DateMenu.IndicatorPad.prototype.vfunc_get_preferred_width); @@ -1237,7 +1237,7 @@ export var Panel = GObject.registerClass({ } else if (scrollAction === 'CHANGE_VOLUME' && !event.is_pointer_emulated()) { let proto = Volume.Indicator.prototype; let func = proto._handleScrollEvent || proto.vfunc_scroll_event || proto._onScrollEvent; - let indicator = Main.panel.statusArea[Utils.getSystemMenuInfo().name]._volume; + let indicator = Main.panel.statusArea[Utils.getSystemMenuInfo().name]._volumeOutput; if (indicator.quickSettingsItems) // new quick settings menu in gnome-shell > 42 From ef733f33f555143185c876690e15e4409f6eeccc Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Sat, 19 Aug 2023 14:03:05 +0200 Subject: [PATCH 38/58] export panelBoxes and fix its import --- panel.js | 2 +- panelManager.js | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/panel.js b/panel.js index 290eb2c..434041c 100644 --- a/panel.js +++ b/panel.js @@ -64,7 +64,7 @@ const Mainloop = imports.mainloop; const Gi = imports._gi; let tracker = Shell.WindowTracker.get_default(); -var panelBoxes = ['_leftBox', '_centerBox', '_rightBox']; +export var panelBoxes = ['_leftBox', '_centerBox', '_rightBox']; //timeout names const T2 = 'startIntellihideTimeout'; diff --git a/panelManager.js b/panelManager.js index 23601bc..a62ecb3 100755 --- a/panelManager.js +++ b/panelManager.js @@ -29,7 +29,6 @@ import * as Overview from './overview.js'; import * as Panel from './panel.js'; -import * as panelBoxes from './panel.js'; import * as PanelSettings from './panelSettings.js'; import * as Proximity from './proximity.js'; import * as Taskbar from './taskbar.js'; @@ -203,7 +202,7 @@ export var PanelManager = class { ] ); - panelBoxes.forEach(c => this._signalsHandler.add( + Panel.panelBoxes.forEach(c => this._signalsHandler.add( [ Main.panel[c], 'actor-added', From 11b04333c103899811ba8b5e646aa4dc1a9fdacc Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Sat, 19 Aug 2023 15:31:03 +0200 Subject: [PATCH 39/58] use Extension.openPreferences --- appIcons.js | 5 ++--- extension.js | 4 ++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/appIcons.js b/appIcons.js index 5c8dbf7..affdd35 100644 --- a/appIcons.js +++ b/appIcons.js @@ -44,13 +44,12 @@ import * as PopupMenu from 'resource:///org/gnome/shell/ui/popupMenu.js'; import * as Util from 'resource:///org/gnome/shell/misc/util.js'; import * as Workspace from 'resource:///org/gnome/shell/ui/workspace.js'; import * as BoxPointer from 'resource:///org/gnome/shell/ui/boxpointer.js'; -import * as ExtensionUtils from 'resource:///org/gnome/shell/misc/extensionUtils.js'; import * as Utils from './utils.js'; import * as PanelSettings from './panelSettings.js'; import * as Taskbar from './taskbar.js'; import * as Progress from './progress.js'; -import {SETTINGS, DESKTOPSETTINGS, EXTENSION_PATH} from './extension.js'; +import {DTP_EXTENSION, SETTINGS, DESKTOPSETTINGS, EXTENSION_PATH} from './extension.js'; import {gettext as _} from 'resource:///org/gnome/shell/extensions/extension.js'; const Mainloop = imports.mainloop; @@ -1824,7 +1823,7 @@ export var MyShowAppsIconMenu = class extends PopupMenu.PopupMenu { }); let settingsMenuItem = this._appendMenuItem(_('Dash to Panel Settings')); - settingsMenuItem.connect('activate', () => ExtensionUtils.openPrefs()) + settingsMenuItem.connect('activate', () => DTP_EXTENSION.openPreferences()) if(this.sourceActor == Main.layoutManager.dummyCursor) { this._appendSeparator(); diff --git a/extension.js b/extension.js index d151b08..a632ebb 100644 --- a/extension.js +++ b/extension.js @@ -43,6 +43,7 @@ let extensionChangedHandler; let disabledUbuntuDock; let extensionSystem = Main.extensionManager; +export var DTP_EXTENSION = null; export var SETTINGS = null; export var DESKTOPSETTINGS = null; export var PERSISTENTSTORAGE = null; @@ -65,6 +66,8 @@ export default class DashToPanelExtension extends Extension { enable() { console.log(_('This is a translatable text')); + DTP_EXTENSION = this; + // The Ubuntu Dock extension might get enabled after this extension extensionChangedHandler = extensionSystem.connect('extension-state-changed', (data, extension) => { if (extension.uuid === UBUNTU_DOCK_UUID && extension.state === 1) { @@ -84,6 +87,7 @@ export default class DashToPanelExtension extends Extension { panelManager.disable(); + DTP_EXTENSION = null; SETTINGS = null; panelManager = null; From 011c9d5d262afc19bb709c813e34a2a51396aa3d Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Sat, 19 Aug 2023 15:33:06 +0200 Subject: [PATCH 40/58] open-application-menu and _toggleAppMenuare no longer available, comment the key binding replacement for now --- extension.js | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/extension.js b/extension.js index a632ebb..5cf2457 100644 --- a/extension.js +++ b/extension.js @@ -91,13 +91,13 @@ export default class DashToPanelExtension extends Extension { SETTINGS = null; panelManager = null; - Utils.removeKeybinding('open-application-menu'); - Utils.addKeybinding( - 'open-application-menu', - new Gio.Settings({ schema_id: WindowManager.SHELL_KEYBINDINGS_SCHEMA }), - Main.wm._toggleAppMenu.bind(Main.wm), - Shell.ActionMode.NORMAL | Shell.ActionMode.POPUP - ); + // Utils.removeKeybinding('open-application-menu'); + // Utils.addKeybinding( + // 'open-application-menu', + // new Gio.Settings({ schema_id: WindowManager.SHELL_KEYBINDINGS_SCHEMA }), + // Main.wm._toggleAppMenu.bind(Main.wm), + // Shell.ActionMode.NORMAL | Shell.ActionMode.POPUP + // ); if (!reset) { extensionSystem.disconnect(extensionChangedHandler); @@ -156,16 +156,16 @@ function _enable(extension) { panelManager.enable(); - Utils.removeKeybinding('open-application-menu'); - Utils.addKeybinding( - 'open-application-menu', - new Gio.Settings({ schema_id: WindowManager.SHELL_KEYBINDINGS_SCHEMA }), - () => { - if(SETTINGS.get_boolean('show-appmenu')) - Main.wm._toggleAppMenu(); - else - panelManager.primaryPanel.taskbar.popupFocusedAppSecondaryMenu(); - }, - Shell.ActionMode.NORMAL | Shell.ActionMode.POPUP - ); + // Utils.removeKeybinding('open-application-menu'); + // Utils.addKeybinding( + // 'open-application-menu', + // new Gio.Settings({ schema_id: WindowManager.SHELL_KEYBINDINGS_SCHEMA }), + // () => { + // if(SETTINGS.get_boolean('show-appmenu')) + // Main.wm._toggleAppMenu(); + // else + // panelManager.primaryPanel.taskbar.popupFocusedAppSecondaryMenu(); + // }, + // Shell.ActionMode.NORMAL | Shell.ActionMode.POPUP + // ); } From d9e55635fcdc21cf89e7b92d172f58191e9e4e5f Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Sat, 19 Aug 2023 15:35:58 +0200 Subject: [PATCH 41/58] add the reset parameter back to extension disable function --- extension.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/extension.js b/extension.js index 5cf2457..a5d13b5 100644 --- a/extension.js +++ b/extension.js @@ -82,9 +82,7 @@ export default class DashToPanelExtension extends Extension { _enable(this); } - disable() { - reset = false - + disable(reset = false) { panelManager.disable(); DTP_EXTENSION = null; From 116eeec5ba599700afd93efeaa64eedc0fe2199e Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Sat, 19 Aug 2023 23:25:39 +0200 Subject: [PATCH 42/58] export proximity Mode --- proximity.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proximity.js b/proximity.js index 2d0c4ca..61d356b 100644 --- a/proximity.js +++ b/proximity.js @@ -28,7 +28,7 @@ const MIN_UPDATE_MS = 200; //timeout names const T1 = 'limitUpdateTimeout'; -var Mode = { +export var Mode = { ALL_WINDOWS: 0, FOCUSED_WINDOWS: 1, MAXIMIZED_WINDOWS: 2 From d4a2eb219fa44177431cb7ea807758898ffca4fe Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Sun, 20 Aug 2023 02:15:20 +0200 Subject: [PATCH 43/58] export missing variables --- appIcons.js | 2 +- intellihide.js | 2 +- taskbar.js | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/appIcons.js b/appIcons.js index affdd35..70cd54b 100644 --- a/appIcons.js +++ b/appIcons.js @@ -68,7 +68,7 @@ const DOUBLE_CLICK_DELAY_MS = 450; let LABEL_GAP = 5; let MAX_INDICATORS = 4; -var DEFAULT_PADDING_SIZE = 4; +export var DEFAULT_PADDING_SIZE = 4; let DOT_STYLE = { DOTS: "DOTS", diff --git a/intellihide.js b/intellihide.js index 681be12..d35ade4 100644 --- a/intellihide.js +++ b/intellihide.js @@ -45,7 +45,7 @@ const T4 = 'panelBoxClipTimeout'; var SIDE_CONTROLS_ANIMATION_TIME = OverviewControls.SIDE_CONTROLS_ANIMATION_TIME / (OverviewControls.SIDE_CONTROLS_ANIMATION_TIME > 1 ? 1000 : 1); -var Hold = { +export var Hold = { NONE: 0, TEMPORARY: 1, PERMANENT: 2 diff --git a/taskbar.js b/taskbar.js index 6939b67..5f361da 100644 --- a/taskbar.js +++ b/taskbar.js @@ -53,9 +53,9 @@ import {SETTINGS} from './extension.js'; const Mainloop = imports.mainloop; const {signals: Signals} = imports; -var DASH_ANIMATION_TIME = Dash.DASH_ANIMATION_TIME / (Dash.DASH_ANIMATION_TIME > 1 ? 1000 : 1); +export var DASH_ANIMATION_TIME = Dash.DASH_ANIMATION_TIME / (Dash.DASH_ANIMATION_TIME > 1 ? 1000 : 1); var DASH_ITEM_HOVER_TIMEOUT = Dash.DASH_ITEM_HOVER_TIMEOUT; -var MIN_ICON_SIZE = 4; +export var MIN_ICON_SIZE = 4; const T1 = 'ensureAppIconVisibilityTimeout' const T2 = 'showLabelTimeout' From fe83d4d36a6ec30afcac87db5bcbdd532b78960c Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Sun, 20 Aug 2023 02:57:57 +0200 Subject: [PATCH 44/58] fix SHELL_KEYBINDINGS_SCHEMA import --- overview.js | 6 +++--- panelManager.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/overview.js b/overview.js index 9a9e647..22626e0 100644 --- a/overview.js +++ b/overview.js @@ -29,8 +29,8 @@ import Shell from 'gi://Shell'; import St from 'gi://St'; import * as Main from 'resource:///org/gnome/shell/ui/main.js'; import * as Workspace from 'resource:///org/gnome/shell/ui/workspace.js'; -import * as MessageTray from 'resource:///org/gnome/shell/ui/messageTray.js'; -import { WindowPreview } from 'resource:///org/gnome/shell/ui/windowPreview.js'; +import * as WindowManager from 'resource:///org/gnome/shell/ui/windowManager.js'; +import {WindowPreview} from 'resource:///org/gnome/shell/ui/windowPreview.js'; import {SETTINGS} from './extension.js'; import Meta from 'gi://Meta'; @@ -357,7 +357,7 @@ export var Overview = class { }, this); if (Main.wm._switchToApplication) { - let gsSettings = new Gio.Settings({ schema_id: MessageTray.SHELL_KEYBINDINGS_SCHEMA }); + let gsSettings = new Gio.Settings({ schema_id: WindowManager.SHELL_KEYBINDINGS_SCHEMA }); for (let i = 1; i < 10; ++i) { Utils.addKeybinding(GS_HOTKEYS_KEY + i, gsSettings, Main.wm._switchToApplication.bind(Main.wm)); diff --git a/panelManager.js b/panelManager.js index a62ecb3..1dd45e1 100755 --- a/panelManager.js +++ b/panelManager.js @@ -52,7 +52,7 @@ import * as PanelMenu from 'resource:///org/gnome/shell/ui/panelMenu.js'; import * as Layout from 'resource:///org/gnome/shell/ui/layout.js'; import * as WM from 'resource:///org/gnome/shell/ui/windowManager.js'; import {SETTINGS} from './extension.js'; -import { SecondaryMonitorDisplay, WorkspacesView } from 'resource:///org/gnome/shell/ui/workspacesView.js'; +import {SecondaryMonitorDisplay, WorkspacesView} from 'resource:///org/gnome/shell/ui/workspacesView.js'; const Gi = imports._gi; From 8a61a0d7301d9f1aa5fe1c4289ffe04f4b70a11e Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Sun, 20 Aug 2023 17:36:30 +0200 Subject: [PATCH 45/58] fix version in about panel --- prefs.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/prefs.js b/prefs.js index a4a83ea..2061c58 100644 --- a/prefs.js +++ b/prefs.js @@ -2082,7 +2082,9 @@ const Preferences = class { // About Panel - // TODO this._builder.get_object('extension_version').set_label(this._settings.version.toString() + (this._settings.commit ? ' (' + this._settings.commit + ')' : '')); + const extension = ExtensionPreferences.lookupByURL(import.meta.url); + const {metadata} = extension; + this._builder.get_object('extension_version').set_label(metadata.version.toString() + (metadata.commit ? ' (' + metadata.commit + ')' : '')); this._builder.get_object('importexport_export_button').connect('clicked', widget => { this._showFileChooser( From 4625beef12ab266f721ea7890488f19eb41ba9b0 Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Sun, 20 Aug 2023 17:36:57 +0200 Subject: [PATCH 46/58] fix ngettext import in prefs --- prefs.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/prefs.js b/prefs.js index 2061c58..cd7acc5 100644 --- a/prefs.js +++ b/prefs.js @@ -31,7 +31,7 @@ import Gdk from 'gi://Gdk'; import * as PanelSettings from './panelSettings.js'; import * as Pos from './panelPositions.js'; -import {ExtensionPreferences, gettext as _} from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js'; +import {ExtensionPreferences, gettext as _, ngettext} from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js'; const Mainloop = imports.mainloop; @@ -684,7 +684,7 @@ const Preferences = class { this._builder.get_object('animate_appicon_hover_options_extent_scale') .set_format_value_func((scale, value) => { - return Gettext.ngettext("%d icon", "%d icons", value).format(value); + return ngettext("%d icon", "%d icons", value).format(value); }); } From ae812b34d0634e1996360302724be8d34ffef77e Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Sun, 20 Aug 2023 18:28:44 +0200 Subject: [PATCH 47/58] fix _realHasOverview access in extension _disable --- extension.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extension.js b/extension.js index a5d13b5..251d260 100644 --- a/extension.js +++ b/extension.js @@ -146,7 +146,7 @@ function _enable(extension) { if (SETTINGS.get_boolean('hide-overview-on-startup') && Main.layoutManager._startingUp) { Main.sessionMode.hasOverview = false; Main.layoutManager.connect('startup-complete', () => { - Main.sessionMode.hasOverview = this._realHasOverview + Main.sessionMode.hasOverview = extension._realHasOverview }); } From ac43d822f3c71a1c78044574fe23f049757bc020 Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Sun, 20 Aug 2023 19:10:38 +0200 Subject: [PATCH 48/58] remove open-application-menu keybinding, appmenu will be removed --- extension.js | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/extension.js b/extension.js index 251d260..b270333 100644 --- a/extension.js +++ b/extension.js @@ -89,14 +89,6 @@ export default class DashToPanelExtension extends Extension { SETTINGS = null; panelManager = null; - // Utils.removeKeybinding('open-application-menu'); - // Utils.addKeybinding( - // 'open-application-menu', - // new Gio.Settings({ schema_id: WindowManager.SHELL_KEYBINDINGS_SCHEMA }), - // Main.wm._toggleAppMenu.bind(Main.wm), - // Shell.ActionMode.NORMAL | Shell.ActionMode.POPUP - // ); - if (!reset) { extensionSystem.disconnect(extensionChangedHandler); delete global.dashToPanel; @@ -153,17 +145,4 @@ function _enable(extension) { panelManager = new PanelManager.PanelManager(); panelManager.enable(); - - // Utils.removeKeybinding('open-application-menu'); - // Utils.addKeybinding( - // 'open-application-menu', - // new Gio.Settings({ schema_id: WindowManager.SHELL_KEYBINDINGS_SCHEMA }), - // () => { - // if(SETTINGS.get_boolean('show-appmenu')) - // Main.wm._toggleAppMenu(); - // else - // panelManager.primaryPanel.taskbar.popupFocusedAppSecondaryMenu(); - // }, - // Shell.ActionMode.NORMAL | Shell.ActionMode.POPUP - // ); } From 222e3ed7fc23a9d6edb74ecfb571ffeef982455f Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Sun, 20 Aug 2023 19:16:50 +0200 Subject: [PATCH 49/58] update QuickSettings access in utils --- utils.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/utils.js b/utils.js index eb5df53..8da0def 100644 --- a/utils.js +++ b/utils.js @@ -34,7 +34,6 @@ import * as Config from 'resource:///org/gnome/shell/misc/config.js'; import * as Util from 'resource:///org/gnome/shell/misc/util.js'; import * as Main from 'resource:///org/gnome/shell/ui/main.js'; import * as MessageTray from 'resource:///org/gnome/shell/ui/messageTray.js'; -import * as UiPanel from 'resource:///org/gnome/shell/ui/panel.js'; const Gi = imports._gi; const Mainloop = imports.mainloop; @@ -223,7 +222,7 @@ export var setDisplayUnredirect = (enable) => { export var getSystemMenuInfo = function() { return { name: 'quickSettings', - constructor: UiPanel.QuickSettings + constructor: Main.panel.statusArea.quickSettings.constructor }; } From 217816da8d751d2ad3bc1826b3559cba5967fa5b Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Sun, 20 Aug 2023 19:18:14 +0200 Subject: [PATCH 50/58] update ActivitiesButton access in panel --- panel.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/panel.js b/panel.js index 434041c..abfdb97 100644 --- a/panel.js +++ b/panel.js @@ -41,7 +41,6 @@ import * as PanelStyle from './panelStyle.js'; import * as Main from 'resource:///org/gnome/shell/ui/main.js'; import * as Dash from 'resource:///org/gnome/shell/ui/dash.js'; import * as CtrlAltTab from 'resource:///org/gnome/shell/ui/ctrlAltTab.js'; -import * as GSPanel from 'resource:///org/gnome/shell/ui/panel.js'; import * as PanelMenu from 'resource:///org/gnome/shell/ui/panelMenu.js'; import St from 'gi://St'; import GLib from 'gi://GLib'; @@ -126,7 +125,7 @@ export var Panel = GObject.registerClass({ this._setPanelMenu(systemMenuInfo.name, systemMenuInfo.constructor, this.panel); this._setPanelMenu('dateMenu', DateMenu.DateMenuButton, this.panel); - this._setPanelMenu('activities', GSPanel.ActivitiesButton, this.panel); + this._setPanelMenu('activities', Main.panel.statusArea.activities.constructor, this.panel); this.panel.add_child(this._leftBox); this.panel.add_child(this._centerBox); From 0418059f615cdd15c35afbf920ef221eb09b65ac Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Sun, 20 Aug 2023 20:22:15 +0200 Subject: [PATCH 51/58] use SearchController from Main.overview to fix show apps button --- taskbar.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/taskbar.js b/taskbar.js index 5f361da..addfc86 100644 --- a/taskbar.js +++ b/taskbar.js @@ -39,7 +39,6 @@ import * as IconGrid from 'resource:///org/gnome/shell/ui/iconGrid.js'; import * as Main from 'resource:///org/gnome/shell/ui/main.js'; import * as PopupMenu from 'resource:///org/gnome/shell/ui/popupMenu.js'; import * as Workspace from 'resource:///org/gnome/shell/ui/workspace.js'; -import * as SearchController from 'resource:///org/gnome/shell/ui/searchController.js'; import * as AppIcons from './appIcons.js'; import * as Panel from './panel.js'; @@ -52,6 +51,7 @@ import {SETTINGS} from './extension.js'; const Mainloop = imports.mainloop; const {signals: Signals} = imports; +const SearchController = Main.overview.searchController; export var DASH_ANIMATION_TIME = Dash.DASH_ANIMATION_TIME / (Dash.DASH_ANIMATION_TIME > 1 ? 1000 : 1); var DASH_ITEM_HOVER_TIMEOUT = Dash.DASH_ITEM_HOVER_TIMEOUT; From 817c8cbf810c7c5fa9d872ab739557e49479d7b6 Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Sun, 20 Aug 2023 23:33:03 +0200 Subject: [PATCH 52/58] remove option to show appmenu appmenu has been removed with gnome 45 --- panel.js | 23 ------------------- prefs.js | 6 +---- ...shell.extensions.dash-to-panel.gschema.xml | 5 ---- ui/SettingsBehavior.ui | 12 ---------- 4 files changed, 1 insertion(+), 45 deletions(-) diff --git a/panel.js b/panel.js index abfdb97..22f9f0f 100644 --- a/panel.js +++ b/panel.js @@ -217,7 +217,6 @@ export var Panel = GObject.registerClass({ this.panel.add_child(this.taskbar.actor); - this._setAppmenuVisible(SETTINGS.get_boolean('show-appmenu')); this._setShowDesktopButton(true); this._setAllocationMap(); @@ -330,7 +329,6 @@ export var Panel = GObject.registerClass({ this._signalsHandler.destroy(); this.panel.remove_child(this.taskbar.actor); - this._setAppmenuVisible(false); if (this.intellihide) { this.intellihide.destroy(); @@ -514,11 +512,6 @@ export var Panel = GObject.registerClass({ ], () => this.taskbar.resetAppIcons() ], - [ - SETTINGS, - 'changed::show-appmenu', - () => this._setAppmenuVisible(SETTINGS.get_boolean('show-appmenu')) - ], [ SETTINGS, [ @@ -1012,22 +1005,6 @@ export var Panel = GObject.registerClass({ this._unmappedButtons.splice(this._unmappedButtons.indexOf(actor), 1); } - _setAppmenuVisible(isVisible) { - let parent; - let appMenu = this.statusArea.appMenu; - - if(appMenu) - parent = appMenu.container.get_parent(); - - if (parent) { - parent.remove_child(appMenu.container); - } - - if (isVisible && appMenu) { - this._leftBox.insert_child_above(appMenu.container, null); - } - } - _formatVerticalClock() { // https://github.com/GNOME/gnome-desktop/blob/master/libgnome-desktop/gnome-wall-clock.c#L310 if (this.statusArea.dateMenu) { diff --git a/prefs.js b/prefs.js index cd7acc5..2e78629 100644 --- a/prefs.js +++ b/prefs.js @@ -1312,11 +1312,6 @@ const Preferences = class { 'sensitive', Gio.SettingsBindFlags.DEFAULT); - this._settings.bind('show-appmenu', - this._builder.get_object('show_appmenu_switch'), - 'active', - Gio.SettingsBindFlags.DEFAULT); - this._settings.bind('show-window-previews', this._builder.get_object('show_window_previews_switch'), 'active', @@ -1903,6 +1898,7 @@ const Preferences = class { this._settings.set_value('secondarymenu-contains-showdetails', this._settings.get_default_value('secondarymenu-contains-showdetails')); }); + // TODO setting secondarymenu-contains-appmenu is not being used anywhere this._settings.bind('secondarymenu-contains-appmenu', this._builder.get_object('secondarymenu_appmenu_switch'), 'active', diff --git a/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml b/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml index 7e8ea3a..9e9fb6f 100644 --- a/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml +++ b/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml @@ -429,11 +429,6 @@ Show desktop animation time Window fade animation time when showing the destop - - false - Show appMenu button - Show appMenu on the right hand side of the panel - true Show window preview diff --git a/ui/SettingsBehavior.ui b/ui/SettingsBehavior.ui index 18db943..677f38a 100644 --- a/ui/SettingsBehavior.ui +++ b/ui/SettingsBehavior.ui @@ -43,18 +43,6 @@ - - - Show <i>AppMenu</i> button - Top Bar > Show App Menu must be enabled in Tweak Tool - - - center - - - - - Ungroup applications From 6b2629a572fe0faea24e6235a44743a5b56469e3 Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Sat, 26 Aug 2023 23:56:54 +0200 Subject: [PATCH 53/58] move away from event.get_source --- panel.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/panel.js b/panel.js index 22f9f0f..240643f 100644 --- a/panel.js +++ b/panel.js @@ -903,10 +903,14 @@ export var Panel = GObject.registerClass({ this.showAppsIconWrapper.popupMenu(Main.layoutManager.dummyCursor); return Clutter.EVENT_STOP; - } else if (Main.modalCount > 0 || event.get_source() != actor || - (!isPress && type != Clutter.EventType.TOUCH_BEGIN) || - (isPress && button != 1)) { - return Clutter.EVENT_PROPAGATE; + } else { + const targetActor = global.stage.get_event_actor(event); + + if (Main.modalCount > 0 || targetActor != actor || + (!isPress && type != Clutter.EventType.TOUCH_BEGIN) || + (isPress && button != 1)) { + return Clutter.EVENT_PROPAGATE; + } } let params = this.checkIfVertical() ? [stageY, 'y', 'height'] : [stageX, 'x', 'width']; @@ -1190,7 +1194,9 @@ export var Panel = GObject.registerClass({ let scrollAction = SETTINGS.get_string('scroll-panel-action'); let direction = Utils.getMouseScrollDirection(event); - if (!this._checkIfIgnoredScrollSource(event.get_source()) && !this._timeoutsHandler.getId(T6)) { + const targetActor = global.stage.get_event_actor(event); + + if (!this._checkIfIgnoredScrollSource(targetActor) && !this._timeoutsHandler.getId(T6)) { if (direction && scrollAction === 'SWITCH_WORKSPACE') { let args = [global.display]; From c4c114d921290e4f6d69943d2e250bf8d48a7751 Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Mon, 28 Aug 2023 16:34:46 +0200 Subject: [PATCH 54/58] copy getAppFromSource into taskbar.js since it is not exported yet --- taskbar.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/taskbar.js b/taskbar.js index addfc86..9dcf044 100644 --- a/taskbar.js +++ b/taskbar.js @@ -41,6 +41,7 @@ import * as PopupMenu from 'resource:///org/gnome/shell/ui/popupMenu.js'; import * as Workspace from 'resource:///org/gnome/shell/ui/workspace.js'; import * as AppIcons from './appIcons.js'; +import * as AppDisplay from 'resource:///org/gnome/shell/ui/appDisplay.js'; import * as Panel from './panel.js'; import * as PanelManager from './panelManager.js'; import * as PanelSettings from './panelSettings.js'; @@ -61,6 +62,14 @@ const T1 = 'ensureAppIconVisibilityTimeout' const T2 = 'showLabelTimeout' const T3 = 'resetHoverTimeout' +// TODO will be exported in the next gnome 45 release again +function getAppFromSource(source) { + if (source instanceof AppDisplay.AppIcon) + return source.app; + else + return null; +} + /** * Extend DashItemContainer * @@ -621,7 +630,7 @@ export var Taskbar = class { } _onDragMotion(dragEvent) { - let app = Dash.getAppFromSource(dragEvent.source); + let app = getAppFromSource(dragEvent.source); if (app == null) return DND.DragMotionResult.CONTINUE; From 3fe3eddc003991820bc4af783c4a812f208cdffc Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Sun, 3 Sep 2023 20:54:33 +0200 Subject: [PATCH 55/58] fix scroll panel to change volume --- panel.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panel.js b/panel.js index 240643f..35a36ba 100644 --- a/panel.js +++ b/panel.js @@ -1217,7 +1217,7 @@ export var Panel = GObject.registerClass({ Utils.activateSiblingWindow(windows, direction); } else if (scrollAction === 'CHANGE_VOLUME' && !event.is_pointer_emulated()) { - let proto = Volume.Indicator.prototype; + let proto = Volume.OutputIndicator.prototype; let func = proto._handleScrollEvent || proto.vfunc_scroll_event || proto._onScrollEvent; let indicator = Main.panel.statusArea[Utils.getSystemMenuInfo().name]._volumeOutput; From a3fc2fd0debb2c666bea60c3329b0295daa0dde5 Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Mon, 4 Sep 2023 22:17:43 +0200 Subject: [PATCH 56/58] use Clutter.ActorAlign instead of St.Align --- taskbar.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/taskbar.js b/taskbar.js index 9dcf044..1e0b48a 100644 --- a/taskbar.js +++ b/taskbar.js @@ -284,8 +284,10 @@ export var Taskbar = class { this.previewMenu.enable(); let rtl = Clutter.get_default_text_direction() == Clutter.TextDirection.RTL; - this.actor = new St.Bin({ child: this._container, - y_align: St.Align.START, x_align:rtl?St.Align.END:St.Align.START + this.actor = new St.Bin({ + child: this._container, + y_align: Clutter.ActorAlign.START, + x_align: rtl ? Clutter.ActorAlign.END : Clutter.ActorAlign.START }); let adjustment = this._scrollView[orientation[0] + 'scroll'].adjustment; From 70c640b957f2cff08e00783de692e8ab9e17eabf Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Thu, 7 Sep 2023 01:08:12 +0200 Subject: [PATCH 57/58] replace Meta.Rectangle with Mtk.Rectangle --- appIcons.js | 4 ++-- proximity.js | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/appIcons.js b/appIcons.js index 70cd54b..2f5e647 100644 --- a/appIcons.js +++ b/appIcons.js @@ -28,7 +28,7 @@ import GLib from 'gi://GLib'; import Graphene from 'gi://Graphene'; import Gtk from 'gi://Gtk'; import GObject from 'gi://GObject'; -import Meta from 'gi://Meta'; +import Mtk from 'gi://Mtk'; import Shell from 'gi://Shell'; import St from 'gi://St'; @@ -396,7 +396,7 @@ export var TaskbarAppIcon = GObject.registerClass({ if (this.get_stage() == null) return; - let rect = new Meta.Rectangle(); + let rect = new Mtk.Rectangle(); [rect.x, rect.y] = this.get_transformed_position(); [rect.width, rect.height] = this.get_transformed_size(); diff --git a/proximity.js b/proximity.js index 61d356b..9dcff42 100644 --- a/proximity.js +++ b/proximity.js @@ -16,6 +16,7 @@ */ import Meta from 'gi://Meta'; +import Mtk from 'gi://Mtk'; import * as Layout from 'resource:///org/gnome/shell/ui/layout.js'; import * as Main from 'resource:///org/gnome/shell/ui/main.js'; @@ -56,7 +57,7 @@ export class ProximityWatch { _updateWatchRect() { let [actorX, actorY] = this.actor.get_position(); - this.rect = new Meta.Rectangle({ + this.rect = new Mtk.Rectangle({ x: actorX - this.threshold[0], y: actorY - this.threshold[1], width: this.actor.width + this.threshold[0] * 2, From c3db082e5b1dfdb50fd0715efb6bb8eebd99872f Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Thu, 7 Sep 2023 01:11:25 +0200 Subject: [PATCH 58/58] use getAppFromSource from Dash again --- taskbar.js | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/taskbar.js b/taskbar.js index 1e0b48a..b80e4aa 100644 --- a/taskbar.js +++ b/taskbar.js @@ -41,7 +41,6 @@ import * as PopupMenu from 'resource:///org/gnome/shell/ui/popupMenu.js'; import * as Workspace from 'resource:///org/gnome/shell/ui/workspace.js'; import * as AppIcons from './appIcons.js'; -import * as AppDisplay from 'resource:///org/gnome/shell/ui/appDisplay.js'; import * as Panel from './panel.js'; import * as PanelManager from './panelManager.js'; import * as PanelSettings from './panelSettings.js'; @@ -62,13 +61,6 @@ const T1 = 'ensureAppIconVisibilityTimeout' const T2 = 'showLabelTimeout' const T3 = 'resetHoverTimeout' -// TODO will be exported in the next gnome 45 release again -function getAppFromSource(source) { - if (source instanceof AppDisplay.AppIcon) - return source.app; - else - return null; -} /** * Extend DashItemContainer @@ -632,7 +624,7 @@ export var Taskbar = class { } _onDragMotion(dragEvent) { - let app = getAppFromSource(dragEvent.source); + let app = Dash.getAppFromSource(dragEvent.source); if (app == null) return DND.DragMotionResult.CONTINUE;