mirror of
https://github.com/morgan9e/dash-to-panel
synced 2026-04-14 00:04:17 +09:00
296
appIcons.js
296
appIcons.js
@@ -22,40 +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;
|
||||
const Signals = imports.signals;
|
||||
const Meta = imports.gi.Meta;
|
||||
const Shell = imports.gi.Shell;
|
||||
const St = imports.gi.St;
|
||||
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 Mtk from 'gi://Mtk';
|
||||
import Shell from 'gi://Shell';
|
||||
import St from 'gi://St';
|
||||
|
||||
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';
|
||||
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 Utils from './utils.js';
|
||||
import * as PanelSettings from './panelSettings.js';
|
||||
import * as Taskbar from './taskbar.js';
|
||||
import * as Progress from './progress.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;
|
||||
|
||||
const Config = imports.misc.config;
|
||||
const AppDisplay = imports.ui.appDisplay;
|
||||
const AppMenu = imports.ui.appMenu;
|
||||
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
|
||||
|
||||
const Me = ExtensionUtils.getCurrentExtension();
|
||||
const Utils = Me.imports.utils;
|
||||
const PanelSettings = Me.imports.panelSettings;
|
||||
const Taskbar = Me.imports.taskbar;
|
||||
const Progress = Me.imports.progress;
|
||||
const _ = imports.gettext.domain(Utils.TRANSLATION_DOMAIN).gettext;
|
||||
const {signals: Signals} = imports;
|
||||
|
||||
//timeout names
|
||||
const T2 = 'mouseScrollTimeout';
|
||||
@@ -70,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",
|
||||
@@ -110,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) {
|
||||
@@ -149,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() });
|
||||
@@ -206,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));
|
||||
}
|
||||
@@ -232,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);
|
||||
@@ -278,7 +276,7 @@ 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,
|
||||
@@ -296,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 {
|
||||
@@ -308,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;
|
||||
}
|
||||
@@ -365,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]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -398,7 +396,7 @@ 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();
|
||||
@@ -410,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.
|
||||
@@ -442,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);
|
||||
@@ -453,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();
|
||||
|
||||
@@ -488,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);
|
||||
@@ -510,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);
|
||||
@@ -543,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')]();
|
||||
@@ -559,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);
|
||||
@@ -579,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();;
|
||||
@@ -601,14 +599,14 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
@@ -622,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;');
|
||||
@@ -679,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()
|
||||
@@ -696,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);
|
||||
@@ -751,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;
|
||||
@@ -833,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()
|
||||
@@ -844,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();
|
||||
|
||||
@@ -992,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()) {
|
||||
@@ -1035,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) {
|
||||
@@ -1054,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
|
||||
@@ -1075,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) {
|
||||
@@ -1090,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();
|
||||
@@ -1288,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();
|
||||
@@ -1308,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.
|
||||
@@ -1327,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;
|
||||
@@ -1374,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);
|
||||
|
||||
@@ -1387,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());
|
||||
@@ -1395,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() :
|
||||
@@ -1404,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;
|
||||
});
|
||||
@@ -1419,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;
|
||||
@@ -1428,9 +1426,9 @@ function cssHexTocssRgba(cssHex, opacity) {
|
||||
return 'rgba(' + [r, g, b].join(',') + ',' + opacity + ')';
|
||||
}
|
||||
|
||||
function getIconPadding(monitorIndex) {
|
||||
let panelSize = PanelSettings.getPanelSize(Me.settings, monitorIndex);
|
||||
let padding = Me.settings.get_int('appicon-padding');
|
||||
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;
|
||||
|
||||
if (padding * 2 > availSize) {
|
||||
@@ -1449,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);
|
||||
@@ -1458,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];
|
||||
@@ -1508,7 +1506,7 @@ function getIconPadding(monitorIndex) {
|
||||
/**
|
||||
* This function is used for extendDashItemContainer
|
||||
*/
|
||||
function ItemShowLabel() {
|
||||
export function ItemShowLabel() {
|
||||
if (!this._labelText)
|
||||
return;
|
||||
|
||||
@@ -1589,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();
|
||||
@@ -1620,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',
|
||||
@@ -1635,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();
|
||||
}
|
||||
@@ -1677,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;');
|
||||
@@ -1721,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();
|
||||
}
|
||||
@@ -1738,7 +1736,7 @@ Signals.addSignalMethods(ShowAppsIconWrapper.prototype);
|
||||
/**
|
||||
* 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());
|
||||
@@ -1780,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();
|
||||
@@ -1813,19 +1811,19 @@ 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'));
|
||||
settingsMenuItem.connect('activate', () => ExtensionUtils.openPrefs())
|
||||
settingsMenuItem.connect('activate', () => DTP_EXTENSION.openPreferences())
|
||||
|
||||
if(this.sourceActor == Main.layoutManager.dummyCursor) {
|
||||
this._appendSeparator();
|
||||
@@ -1877,10 +1875,10 @@ var MyShowAppsIconMenu = class extends PopupMenu.PopupMenu {
|
||||
};
|
||||
|
||||
|
||||
var getIconContainerStyle = function(isVertical) {
|
||||
export 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;';
|
||||
|
||||
@@ -55,15 +55,16 @@
|
||||
*
|
||||
*******************************************************************************/
|
||||
|
||||
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 {EXTENSION_UUID} from './extension.js';
|
||||
|
||||
import * as ExtensionUtils from 'resource:///org/gnome/shell/misc/extensionUtils.js';
|
||||
|
||||
const IDENTIFIER_UUID = "130cbc66-235c-4bd6-8571-98d2d8bba5e2";
|
||||
|
||||
var DesktopIconsUsableAreaClass = class {
|
||||
export var DesktopIconsUsableAreaClass = class {
|
||||
constructor() {
|
||||
this._extensionManager = Main.extensionManager;
|
||||
this._timedMarginsID = 0;
|
||||
@@ -154,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);
|
||||
}
|
||||
}
|
||||
|
||||
166
extension.js
166
extension.js
@@ -18,54 +18,94 @@
|
||||
*/
|
||||
|
||||
|
||||
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;
|
||||
const Mainloop = imports.mainloop;
|
||||
const Signals = imports.signals;
|
||||
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 Me = ExtensionUtils.getCurrentExtension();
|
||||
const { PanelManager } = Me.imports.panelManager;
|
||||
const Utils = Me.imports.utils;
|
||||
const AppIcons = Me.imports.appIcons;
|
||||
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 Mainloop = imports.mainloop;
|
||||
const {signals: Signals} = imports;
|
||||
|
||||
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;
|
||||
|
||||
function init() {
|
||||
this._realHasOverview = Main.sessionMode.hasOverview;
|
||||
export var DTP_EXTENSION = null;
|
||||
export var SETTINGS = null;
|
||||
export var DESKTOPSETTINGS = null;
|
||||
export var PERSISTENTSTORAGE = null;
|
||||
export var EXTENSION_UUID = null;
|
||||
export var EXTENSION_PATH = null;
|
||||
|
||||
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;
|
||||
|
||||
this.initTranslations();
|
||||
|
||||
//create an object that persists until gnome-shell is restarted, even if the extension is disabled
|
||||
PERSISTENTSTORAGE = {};
|
||||
}
|
||||
|
||||
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) {
|
||||
_enable(this);
|
||||
}
|
||||
});
|
||||
|
||||
//create a global object that can emit signals and conveniently expose functionalities to other extensions
|
||||
global.dashToPanel = {};
|
||||
Signals.addSignalMethods(global.dashToPanel);
|
||||
|
||||
_enable(this);
|
||||
}
|
||||
|
||||
disable(reset = false) {
|
||||
panelManager.disable();
|
||||
|
||||
DTP_EXTENSION = null;
|
||||
SETTINGS = null;
|
||||
panelManager = null;
|
||||
|
||||
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() {
|
||||
function _enable(extension) {
|
||||
let ubuntuDock = Main.extensionManager ?
|
||||
Main.extensionManager.lookup(UBUNTU_DOCK_UUID) : //gnome-shell >= 3.33.4
|
||||
ExtensionUtils.extensions[UBUNTU_DOCK_UUID];
|
||||
@@ -88,63 +128,21 @@ 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');
|
||||
EXTENSION_UUID = extension.uuid
|
||||
EXTENSION_PATH = extension.path
|
||||
|
||||
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
|
||||
Main.sessionMode.hasOverview = extension._realHasOverview
|
||||
});
|
||||
}
|
||||
|
||||
panelManager = new PanelManager();
|
||||
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(Me.settings.get_boolean('show-appmenu'))
|
||||
Main.wm._toggleAppMenu();
|
||||
else
|
||||
panelManager.primaryPanel.taskbar.popupFocusedAppSecondaryMenu();
|
||||
},
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -15,21 +15,21 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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';
|
||||
import {SETTINGS} from './extension.js';
|
||||
|
||||
//timeout intervals
|
||||
const CHECK_POINTER_MS = 200;
|
||||
@@ -45,13 +45,13 @@ 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
|
||||
};
|
||||
|
||||
var Intellihide = class {
|
||||
export var Intellihide = class {
|
||||
|
||||
constructor(dtpPanel) {
|
||||
this._dtpPanel = dtpPanel;
|
||||
@@ -63,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();
|
||||
@@ -85,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;
|
||||
@@ -120,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();
|
||||
@@ -154,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) {
|
||||
@@ -174,7 +174,7 @@ var Intellihide = class {
|
||||
}
|
||||
],
|
||||
[
|
||||
Me.settings,
|
||||
SETTINGS,
|
||||
[
|
||||
'changed::intellihide-use-pressure',
|
||||
'changed::intellihide-hide-from-windows',
|
||||
@@ -232,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);
|
||||
@@ -332,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;
|
||||
}
|
||||
|
||||
@@ -406,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;
|
||||
|
||||
@@ -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
|
||||
|
||||
79
overview.js
79
overview.js
@@ -20,19 +20,20 @@
|
||||
* 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 * 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';
|
||||
|
||||
const Meta = imports.gi.Meta;
|
||||
import Meta from 'gi://Meta';
|
||||
|
||||
const GS_HOTKEYS_KEY = 'switch-to-application-';
|
||||
|
||||
@@ -45,7 +46,7 @@ const LABEL_MARGIN = 60;
|
||||
const T1 = 'swipeEndTimeout';
|
||||
const T2 = 'numberOverlayTimeout';
|
||||
|
||||
var Overview = class {
|
||||
export var Overview = class {
|
||||
|
||||
constructor() {
|
||||
this._numHotkeys = 10;
|
||||
@@ -68,7 +69,7 @@ var Overview = class {
|
||||
this._adaptAlloc(true);
|
||||
|
||||
this._signalsHandler.add([
|
||||
Me.settings,
|
||||
SETTINGS,
|
||||
[
|
||||
'changed::stockgs-keep-dash',
|
||||
'changed::panel-sizes'
|
||||
@@ -93,7 +94,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';
|
||||
@@ -184,19 +185,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();
|
||||
}
|
||||
|
||||
@@ -220,7 +221,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();
|
||||
@@ -274,14 +275,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();
|
||||
@@ -306,12 +307,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') {
|
||||
@@ -333,13 +334,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);
|
||||
}
|
||||
|
||||
@@ -356,7 +357,7 @@ 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: WindowManager.SHELL_KEYBINDINGS_SCHEMA });
|
||||
|
||||
for (let i = 1; i < 10; ++i) {
|
||||
Utils.addKeybinding(GS_HOTKEYS_KEY + i, gsSettings, Main.wm._switchToApplication.bind(Main.wm));
|
||||
@@ -370,38 +371,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() {
|
||||
@@ -415,7 +416,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;
|
||||
@@ -425,10 +426,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
|
||||
@@ -443,14 +444,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();
|
||||
|
||||
198
panel.js
198
panel.js
@@ -27,42 +27,43 @@
|
||||
* 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;
|
||||
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;
|
||||
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 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';
|
||||
import * as AppIcons from './appIcons.js';
|
||||
import * as Utils from './utils.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 * 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 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/status/volume.js';
|
||||
import * as Progress from './progress.js';
|
||||
|
||||
const Intellihide = Me.imports.intellihide;
|
||||
const Transparency = Me.imports.transparency;
|
||||
const _ = imports.gettext.domain(Me.imports.utils.TRANSLATION_DOMAIN).gettext;
|
||||
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/extension.js';
|
||||
|
||||
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';
|
||||
@@ -71,7 +72,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) {
|
||||
@@ -81,7 +82,7 @@ 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;
|
||||
@@ -90,7 +91,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;
|
||||
@@ -124,7 +125,7 @@ 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);
|
||||
@@ -177,8 +178,8 @@ 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();
|
||||
@@ -205,25 +206,24 @@ 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);
|
||||
}
|
||||
};
|
||||
|
||||
this.dynamicTransparency = new Transparency.DynamicTransparency(this);
|
||||
|
||||
this.taskbar = new Taskbar(this);
|
||||
this.taskbar = new Taskbar.Taskbar(this);
|
||||
|
||||
this.panel.add_child(this.taskbar.actor);
|
||||
|
||||
this._setAppmenuVisible(Me.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
|
||||
@@ -329,7 +329,6 @@ var Panel = GObject.registerClass({
|
||||
this._signalsHandler.destroy();
|
||||
|
||||
this.panel.remove_child(this.taskbar.actor);
|
||||
this._setAppmenuVisible(false);
|
||||
|
||||
if (this.intellihide) {
|
||||
this.intellihide.destroy();
|
||||
@@ -379,7 +378,7 @@ 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);
|
||||
@@ -411,7 +410,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;
|
||||
@@ -498,7 +497,7 @@ var Panel = GObject.registerClass({
|
||||
|
||||
this._signalsHandler.add(
|
||||
[
|
||||
Me.settings,
|
||||
SETTINGS,
|
||||
[
|
||||
'changed::panel-sizes',
|
||||
'changed::group-apps'
|
||||
@@ -506,7 +505,7 @@ var Panel = GObject.registerClass({
|
||||
() => this._resetGeometry()
|
||||
],
|
||||
[
|
||||
Me.settings,
|
||||
SETTINGS,
|
||||
[
|
||||
'changed::appicon-margin',
|
||||
'changed::appicon-padding'
|
||||
@@ -514,12 +513,7 @@ var Panel = GObject.registerClass({
|
||||
() => this.taskbar.resetAppIcons()
|
||||
],
|
||||
[
|
||||
Me.settings,
|
||||
'changed::show-appmenu',
|
||||
() => this._setAppmenuVisible(Me.settings.get_boolean('show-appmenu'))
|
||||
],
|
||||
[
|
||||
Me.settings,
|
||||
SETTINGS,
|
||||
[
|
||||
'changed::showdesktop-button-width',
|
||||
'changed::trans-use-custom-bg',
|
||||
@@ -530,7 +524,7 @@ var Panel = GObject.registerClass({
|
||||
() => this._setShowDesktopButtonStyle()
|
||||
],
|
||||
[
|
||||
Me.desktopSettings,
|
||||
DESKTOPSETTINGS,
|
||||
'changed::clock-format',
|
||||
() => {
|
||||
this._clockFormat = null;
|
||||
@@ -541,19 +535,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()]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -581,19 +575,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() {
|
||||
@@ -632,24 +626,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',
|
||||
@@ -909,10 +903,14 @@ 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'];
|
||||
@@ -964,7 +962,7 @@ 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;
|
||||
}
|
||||
|
||||
@@ -1011,22 +1009,6 @@ 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) {
|
||||
@@ -1064,7 +1046,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') {
|
||||
@@ -1095,8 +1077,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);
|
||||
}]);
|
||||
@@ -1107,7 +1089,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) {
|
||||
@@ -1130,11 +1112,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 + ";";
|
||||
@@ -1151,7 +1133,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) {
|
||||
@@ -1209,10 +1191,12 @@ 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)) {
|
||||
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];
|
||||
|
||||
@@ -1224,7 +1208,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;
|
||||
@@ -1233,9 +1217,9 @@ 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]._volume;
|
||||
let indicator = Main.panel.statusArea[Utils.getSystemMenuInfo().name]._volumeOutput;
|
||||
|
||||
if (indicator.quickSettingsItems)
|
||||
// new quick settings menu in gnome-shell > 42
|
||||
@@ -1246,7 +1230,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, () => {}]);
|
||||
@@ -1261,8 +1245,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))
|
||||
@@ -1272,7 +1256,7 @@ var Panel = GObject.registerClass({
|
||||
}
|
||||
});
|
||||
|
||||
var SecondaryPanel = GObject.registerClass({
|
||||
export var SecondaryPanel = GObject.registerClass({
|
||||
}, class SecondaryPanel extends St.Widget {
|
||||
|
||||
_init(params) {
|
||||
|
||||
@@ -27,59 +27,60 @@
|
||||
* 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 * as Overview from './overview.js';
|
||||
import * as Panel 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';
|
||||
|
||||
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';
|
||||
|
||||
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 {SETTINGS} from './extension.js';
|
||||
import {SecondaryMonitorDisplay, WorkspacesView} from 'resource:///org/gnome/shell/ui/workspacesView.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;
|
||||
|
||||
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;
|
||||
|
||||
var PanelManager = class {
|
||||
export var PanelManager = class {
|
||||
|
||||
constructor() {
|
||||
this.overview = new Overview();
|
||||
this.overview = new Overview.Overview();
|
||||
this.panelsElementPositions = {};
|
||||
|
||||
this._saveMonitors();
|
||||
}
|
||||
|
||||
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));
|
||||
});
|
||||
@@ -134,7 +135,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());
|
||||
@@ -157,7 +158,7 @@ var PanelManager = class {
|
||||
//listen settings
|
||||
this._signalsHandler.add(
|
||||
[
|
||||
Me.settings,
|
||||
SETTINGS,
|
||||
[
|
||||
'changed::primary-monitor',
|
||||
'changed::multi-monitors',
|
||||
@@ -170,17 +171,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, () => {
|
||||
@@ -201,7 +202,7 @@ var PanelManager = class {
|
||||
]
|
||||
);
|
||||
|
||||
panelBoxes.forEach(c => this._signalsHandler.add(
|
||||
Panel.panelBoxes.forEach(c => this._signalsHandler.add(
|
||||
[
|
||||
Main.panel[c],
|
||||
'actor-added',
|
||||
@@ -214,7 +215,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) {}});
|
||||
}
|
||||
|
||||
@@ -276,7 +277,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);
|
||||
@@ -363,7 +364,7 @@ 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,
|
||||
@@ -384,8 +385,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));
|
||||
@@ -399,8 +400,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) {
|
||||
@@ -425,7 +426,7 @@ 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();
|
||||
|
||||
@@ -445,7 +446,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());
|
||||
}
|
||||
|
||||
@@ -465,7 +466,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
|
||||
@@ -519,7 +520,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);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -528,7 +529,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;
|
||||
@@ -639,7 +640,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;
|
||||
|
||||
@@ -15,31 +15,31 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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;
|
||||
}
|
||||
@@ -15,11 +15,10 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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) {
|
||||
export function getSettingsJson(settings, setting) {
|
||||
try {
|
||||
return JSON.parse(settings.get_string(setting));
|
||||
} catch(e) {
|
||||
@@ -27,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);
|
||||
@@ -37,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');
|
||||
@@ -45,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;
|
||||
@@ -59,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;
|
||||
@@ -76,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);
|
||||
@@ -95,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;
|
||||
|
||||
@@ -21,18 +21,19 @@
|
||||
* 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';
|
||||
import St from 'gi://St';
|
||||
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;
|
||||
const St = imports.gi.St;
|
||||
const Shell = imports.gi.Shell;
|
||||
|
||||
const Panel = Me.imports.panel;
|
||||
const Taskbar = Me.imports.taskbar;
|
||||
const Utils = Me.imports.utils;
|
||||
|
||||
var PanelStyle = class {
|
||||
export var PanelStyle = class {
|
||||
|
||||
enable(panel) {
|
||||
this.panel = panel;
|
||||
@@ -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 = {};
|
||||
|
||||
101
prefs.js
101
prefs.js
@@ -20,22 +20,22 @@
|
||||
* 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';
|
||||
|
||||
import * as PanelSettings from './panelSettings.js';
|
||||
import * as Pos from './panelPositions.js';
|
||||
|
||||
import {ExtensionPreferences, gettext as _, ngettext} from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js';
|
||||
|
||||
const Mainloop = imports.mainloop;
|
||||
|
||||
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
||||
const ExtensionUtils = imports.misc.extensionUtils;
|
||||
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;
|
||||
|
||||
const SCALE_UPDATE_TIMEOUT = 500;
|
||||
const DEFAULT_PANEL_SIZES = [ 128, 96, 64, 48, 32, 24, 16 ];
|
||||
@@ -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);
|
||||
|
||||
@@ -683,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);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1311,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',
|
||||
@@ -1902,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',
|
||||
@@ -2081,7 +2078,9 @@ const Preferences = class {
|
||||
|
||||
// About Panel
|
||||
|
||||
this._builder.get_object('extension_version').set_label(Me.metadata.version.toString() + (Me.metadata.commit ? ' (' + Me.metadata.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(
|
||||
@@ -2329,13 +2328,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('org.gnome.shell.extensions.dash-to-panel');
|
||||
this.initTranslations();
|
||||
|
||||
let preferences = new Preferences(window);
|
||||
// use default width or window
|
||||
window.set_default_size(0, 740);
|
||||
|
||||
let preferences = new Preferences(window, window._settings, this.path);
|
||||
}
|
||||
}
|
||||
|
||||
25
progress.js
25
progress.js
@@ -19,17 +19,18 @@
|
||||
* 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';
|
||||
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 Clutter = imports.gi.Clutter;
|
||||
const Pango = imports.gi.Pango;
|
||||
const St = imports.gi.St;
|
||||
const Signals = imports.signals;
|
||||
const Utils = Me.imports.utils;
|
||||
const {signals: Signals} = imports;
|
||||
|
||||
|
||||
var ProgressManager = class {
|
||||
export var ProgressManager = class {
|
||||
|
||||
constructor() {
|
||||
this._entriesByDBusName = {};
|
||||
@@ -164,7 +165,7 @@ var ProgressManager = class {
|
||||
};
|
||||
Signals.addSignalMethods(ProgressManager.prototype);
|
||||
|
||||
class AppProgress {
|
||||
export class AppProgress {
|
||||
|
||||
constructor(dbusName, appId, properties) {
|
||||
this._dbusName = dbusName;
|
||||
@@ -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 {
|
||||
@@ -280,7 +281,7 @@ class AppProgress {
|
||||
Signals.addSignalMethods(AppProgress.prototype);
|
||||
|
||||
|
||||
var ProgressIndicator = class {
|
||||
export var ProgressIndicator = class {
|
||||
|
||||
constructor(source, progressManager) {
|
||||
this._source = source;
|
||||
|
||||
18
proximity.js
18
proximity.js
@@ -15,13 +15,13 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
const Meta = imports.gi.Meta;
|
||||
import Meta from 'gi://Meta';
|
||||
import Mtk from 'gi://Mtk';
|
||||
|
||||
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;
|
||||
@@ -29,13 +29,13 @@ const MIN_UPDATE_MS = 200;
|
||||
//timeout names
|
||||
const T1 = 'limitUpdateTimeout';
|
||||
|
||||
var Mode = {
|
||||
export var Mode = {
|
||||
ALL_WINDOWS: 0,
|
||||
FOCUSED_WINDOWS: 1,
|
||||
MAXIMIZED_WINDOWS: 2
|
||||
};
|
||||
|
||||
class ProximityWatch {
|
||||
export class ProximityWatch {
|
||||
|
||||
constructor(actor, monitorIndex, mode, xThreshold, yThreshold, handler) {
|
||||
this.actor = actor;
|
||||
@@ -57,7 +57,7 @@ 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,
|
||||
@@ -66,7 +66,7 @@ class ProximityWatch {
|
||||
}
|
||||
};
|
||||
|
||||
var ProximityManager = class {
|
||||
export var ProximityManager = class {
|
||||
|
||||
constructor() {
|
||||
this._counter = 1;
|
||||
|
||||
@@ -429,11 +429,6 @@
|
||||
<summary>Show desktop animation time</summary>
|
||||
<description>Window fade animation time when showing the destop</description>
|
||||
</key>
|
||||
<key type="b" name="show-appmenu">
|
||||
<default>false</default>
|
||||
<summary>Show appMenu button</summary>
|
||||
<description>Show appMenu on the right hand side of the panel</description>
|
||||
</key>
|
||||
<key type="b" name="show-window-previews">
|
||||
<default>true</default>
|
||||
<summary>Show window preview</summary>
|
||||
|
||||
124
taskbar.js
124
taskbar.js
@@ -22,44 +22,46 @@
|
||||
*/
|
||||
|
||||
|
||||
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;
|
||||
const Signals = imports.signals;
|
||||
const Meta = imports.gi.Meta;
|
||||
const Shell = imports.gi.Shell;
|
||||
const St = imports.gi.St;
|
||||
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';
|
||||
import St from 'gi://St';
|
||||
|
||||
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';
|
||||
|
||||
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';
|
||||
import {SETTINGS} from './extension.js';
|
||||
|
||||
const Mainloop = imports.mainloop;
|
||||
const {signals: Signals} = imports;
|
||||
const SearchController = Main.overview.searchController;
|
||||
|
||||
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;
|
||||
|
||||
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;
|
||||
|
||||
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'
|
||||
const T3 = 'resetHoverTimeout'
|
||||
|
||||
|
||||
/**
|
||||
* Extend DashItemContainer
|
||||
*
|
||||
@@ -69,21 +71,21 @@ const T3 = 'resetHoverTimeout'
|
||||
* thus use this ugly pattern.
|
||||
*/
|
||||
|
||||
function extendDashItemContainer(dashItemContainer) {
|
||||
export function extendDashItemContainer(dashItemContainer) {
|
||||
dashItemContainer.showLabel = AppIcons.ItemShowLabel;
|
||||
};
|
||||
|
||||
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() {
|
||||
@@ -117,7 +119,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 +200,7 @@ var TaskbarActor = GObject.registerClass({
|
||||
* - Sync minimization application target position.
|
||||
*/
|
||||
|
||||
var Taskbar = class {
|
||||
export var Taskbar = class {
|
||||
|
||||
constructor(panel) {
|
||||
this.dtpPanel = panel;
|
||||
@@ -261,7 +263,7 @@ 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);
|
||||
@@ -274,8 +276,10 @@ 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;
|
||||
@@ -329,7 +333,7 @@ var Taskbar = class {
|
||||
'window-left-monitor'
|
||||
],
|
||||
() => {
|
||||
if (Me.settings.get_boolean('isolate-monitors')) {
|
||||
if (SETTINGS.get_boolean('isolate-monitors')) {
|
||||
this._queueRedisplay();
|
||||
}
|
||||
}
|
||||
@@ -356,7 +360,7 @@ var Taskbar = class {
|
||||
this._syncShowAppsButtonToggled.bind(this)
|
||||
],
|
||||
[
|
||||
Me.settings,
|
||||
SETTINGS,
|
||||
[
|
||||
'changed::dot-size',
|
||||
'changed::show-favorites',
|
||||
@@ -369,7 +373,7 @@ var Taskbar = class {
|
||||
}
|
||||
],
|
||||
[
|
||||
Me.settings,
|
||||
SETTINGS,
|
||||
'changed::group-apps',
|
||||
() => {
|
||||
setAttributes()
|
||||
@@ -377,7 +381,7 @@ var Taskbar = class {
|
||||
}
|
||||
],
|
||||
[
|
||||
Me.settings,
|
||||
SETTINGS,
|
||||
[
|
||||
'changed::group-apps-use-launchers',
|
||||
'changed::taskbar-locked'
|
||||
@@ -398,11 +402,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)
|
||||
}
|
||||
|
||||
@@ -692,7 +696,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
|
||||
@@ -851,8 +855,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)
|
||||
@@ -1083,8 +1087,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);
|
||||
}
|
||||
|
||||
@@ -1248,7 +1252,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) {
|
||||
@@ -1340,7 +1344,7 @@ const CloneContainerConstraint = GObject.registerClass({
|
||||
}
|
||||
});
|
||||
|
||||
var TaskbarItemContainer = GObject.registerClass({
|
||||
export var TaskbarItemContainer = GObject.registerClass({
|
||||
|
||||
}, class TaskbarItemContainer extends Dash.DashItemContainer {
|
||||
|
||||
@@ -1384,7 +1388,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;
|
||||
@@ -1551,7 +1555,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 +1563,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());
|
||||
}
|
||||
|
||||
@@ -15,19 +15,19 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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';
|
||||
import {SETTINGS} from './extension.js';
|
||||
|
||||
var DynamicTransparency = class {
|
||||
export var DynamicTransparency = class {
|
||||
|
||||
constructor(dtpPanel) {
|
||||
this._dtpPanel = dtpPanel;
|
||||
@@ -73,7 +73,7 @@ var DynamicTransparency = class {
|
||||
() => this._updateAlphaAndSet()
|
||||
],
|
||||
[
|
||||
Me.settings,
|
||||
SETTINGS,
|
||||
[
|
||||
'changed::trans-use-custom-bg',
|
||||
'changed::trans-bg-color'
|
||||
@@ -81,7 +81,7 @@ var DynamicTransparency = class {
|
||||
() => this._updateColorAndSet()
|
||||
],
|
||||
[
|
||||
Me.settings,
|
||||
SETTINGS,
|
||||
[
|
||||
'changed::trans-use-custom-opacity',
|
||||
'changed::trans-panel-opacity',
|
||||
@@ -92,7 +92,7 @@ var DynamicTransparency = class {
|
||||
() => this._updateAlphaAndSet()
|
||||
],
|
||||
[
|
||||
Me.settings,
|
||||
SETTINGS,
|
||||
[
|
||||
'changed::trans-use-custom-gradient',
|
||||
'changed::trans-gradient-top-color',
|
||||
@@ -103,7 +103,7 @@ var DynamicTransparency = class {
|
||||
() => this._updateGradientAndSet()
|
||||
],
|
||||
[
|
||||
Me.settings,
|
||||
SETTINGS,
|
||||
[
|
||||
'changed::trans-dynamic-behavior',
|
||||
'changed::trans-use-dynamic-opacity',
|
||||
@@ -112,7 +112,7 @@ var DynamicTransparency = class {
|
||||
() => this._updateProximityWatch()
|
||||
],
|
||||
[
|
||||
Me.settings,
|
||||
SETTINGS,
|
||||
'changed::trans-dynamic-anim-time',
|
||||
() => this._updateAnimationDuration()
|
||||
]
|
||||
@@ -122,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()
|
||||
@@ -132,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 => {
|
||||
@@ -144,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() {
|
||||
@@ -180,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
|
||||
}
|
||||
}
|
||||
@@ -198,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'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -43,18 +43,6 @@
|
||||
</object>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<object class="AdwActionRow">
|
||||
<property name="title" translatable="yes">Show <i>AppMenu</i> button</property>
|
||||
<property name="subtitle">Top Bar > Show App Menu must be enabled in Tweak Tool</property>
|
||||
<child>
|
||||
<object class="GtkSwitch" id="show_appmenu_switch">
|
||||
<property name="valign">center</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<object class="AdwActionRow">
|
||||
<property name="title" translatable="yes">Ungroup applications</property>
|
||||
|
||||
119
utils.js
119
utils.js
@@ -21,27 +21,28 @@
|
||||
* Some code was also adapted from the upstream Gnome Shell source code.
|
||||
*/
|
||||
|
||||
const Clutter = imports.gi.Clutter;
|
||||
const GdkPixbuf = imports.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;
|
||||
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 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';
|
||||
import St from 'gi://St';
|
||||
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);
|
||||
|
||||
// simplify global signals and function injections handling
|
||||
// abstract class
|
||||
var BasicHandler = class {
|
||||
export var BasicHandler = class {
|
||||
|
||||
constructor() {
|
||||
this._storage = new Object();
|
||||
@@ -101,7 +102,7 @@ var BasicHandler = class {
|
||||
}
|
||||
|
||||
// Manage global signals
|
||||
var GlobalSignalsHandler = class extends BasicHandler {
|
||||
export var GlobalSignalsHandler = class extends BasicHandler {
|
||||
|
||||
_create(item) {
|
||||
let handlers = [];
|
||||
@@ -134,7 +135,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 +158,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 +195,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 +210,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,40 +219,34 @@ var setDisplayUnredirect = (enable) => {
|
||||
unredirectEnabled = enable;
|
||||
};
|
||||
|
||||
var getSystemMenuInfo = function() {
|
||||
if (Config.PACKAGE_VERSION < '43')
|
||||
return {
|
||||
name: 'aggregateMenu',
|
||||
constructor: imports.ui.panel.AggregateMenu
|
||||
};
|
||||
|
||||
export var getSystemMenuInfo = function() {
|
||||
return {
|
||||
name: 'quickSettings',
|
||||
constructor: imports.ui.panel.QuickSettings
|
||||
constructor: Main.panel.statusArea.quickSettings.constructor
|
||||
};
|
||||
}
|
||||
|
||||
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 +262,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 +270,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 +280,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 +290,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 +305,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 +323,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 +355,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 +379,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 +387,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 +404,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 +433,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 +466,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 +482,11 @@ var getIndicators = function(delegate) {
|
||||
return delegate.indicators;
|
||||
}
|
||||
|
||||
var getPoint = function(coords) {
|
||||
return new imports.gi.Graphene.Point(coords);
|
||||
export var getPoint = function(coords) {
|
||||
return new 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 +517,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 +574,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 +685,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 +875,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 +913,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.
|
||||
|
||||
105
windowPreview.js
105
windowPreview.js
@@ -15,24 +15,25 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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;
|
||||
const Mainloop = imports.mainloop;
|
||||
const Meta = imports.gi.Meta;
|
||||
const PopupMenu = imports.ui.popupMenu;
|
||||
const Signals = imports.signals;
|
||||
const St = imports.gi.St;
|
||||
const WindowManager = imports.ui.windowManager;
|
||||
const Workspace = imports.ui.workspace;
|
||||
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';
|
||||
import Meta from 'gi://Meta';
|
||||
import * as PopupMenu from 'resource:///org/gnome/shell/ui/popupMenu.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';
|
||||
|
||||
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';
|
||||
import {SETTINGS, DESKTOPSETTINGS} from './extension.js';
|
||||
|
||||
const Mainloop = imports.mainloop;
|
||||
const {signals: Signals} = imports;
|
||||
|
||||
//timeout intervals
|
||||
const ENSURE_VISIBLE_MS = 200;
|
||||
@@ -61,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 {
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -693,7 +694,7 @@ var PreviewMenu = GObject.registerClass({
|
||||
}
|
||||
});
|
||||
|
||||
var Preview = GObject.registerClass({
|
||||
export var Preview = GObject.registerClass({
|
||||
}, class Preview extends St.Widget {
|
||||
|
||||
_init(previewMenu) {
|
||||
@@ -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) {
|
||||
@@ -1111,7 +1112,7 @@ var Preview = GObject.registerClass({
|
||||
}
|
||||
});
|
||||
|
||||
var WindowCloneLayout = GObject.registerClass({
|
||||
export var WindowCloneLayout = GObject.registerClass({
|
||||
}, class WindowCloneLayout extends Clutter.BinLayout {
|
||||
|
||||
_init(frameRect, bufferRect) {
|
||||
@@ -1139,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'
|
||||
|
||||
Reference in New Issue
Block a user