Update to Gnome 40 (#1303)

* 1

* renamed ui.viewSelector to ui.searchController

* add arrowIcon null check

* add object null check

* add _showAppsButton null check

* fixed _workspacesDisplay

* removed shadow-type properties

* removed packing from ui

* renamed margin_left/right to margin_start/end

* renamed GtkRadioButton to GtkToggleButton, removed draw_indicator and image_position

* removed xalign from buttons, stock -> icon_name, GtkFileChooserButton -> BtkButton (todo connect a GtkFileChooserNative), removed format-value (todo connect GtkScaleFormatValueFunc callback)

* removed events, relief

* comment arrowIcon.set_icon_name and _hbox.get_last_child out

* called gtk4-builder-tool simplify --3to4 on Settings.ui

* fix _workspaceDisplay

* revert Settings.ui back to old gtk3 version

* removed _builder.connect_signals_full and added a BuilderScope instead, use class specific add functions, removed show_all for widgets, updated margins* for GtkGrid

* add try catch aroung object.connect

* fixed _searchEntry path

* disabled _newUpdateWorkspacesViews temporarily, because it is very buggy right now

* fixed _searchEntry path (this time for real?)

* dialog.show_all() -> dialog.show(), widget.get_toplevel() -> widget.get_root(), fixed adjustScrollableHeight (no longer crashes, still does not work correctly)

* updated GtkGrid.attach calls

* added Gtk.FileChooserNative for show_applications_icon_file_filebutton

* added packing again to ui (commented) and also added layout row/column/width/height in exchange for top_attach/left_attach/colspan/rowspan

* renamed colspan/rowspan to column-span/row-span

* removed all packaing left_attach/top_attach

* updated adjustScrollableHeight so the dialog will have a reasonable size again

* limit shell-version to 40 since it is not backwards compatible right now

* called _updateBackgrounds in layoutManager ,fixed overview <-> _overview typo?

* pass Settings instead of Settings._settings to BuilderScope

* workaround for showAppsIcon (_showAppsButton seems to be no longer be available)

* replaced newlines in the ui file with the newline unicode symbol, so code block collapsing works peroperly

* moved the scrolled window directly into each notebook tab, so the tab headers are always visible

* fixed taskbarListBox children loops

* commented non working elements out (panel on left/right, import/export settings, update)

* renamed Settings to Preferences to avoid confusion with dconf settings object

* updated this.widget to this.notebook

* fixed dialogs size and expand

* fixed window preview options having too many columns

* removed all packing with expand/fill/position (already uncommented)

* removed menu arrows since they are no longer recommended for gnome40

* removed adjustScrollableHeight, default sizes are acceptable

* updated ui required version to gtk 4.0

* updated path to dash.showAppsButton

* fixes for showAppsButton

* fixed clickToExit

* fixed import/export settings

* added disable show overview on startup option

* removed old show apps animation

* fixed panel on left/right side

* fixed scroll on volume icon

no longer will scrolling on the volume icon switch workspaces as well

* commented some setFocusedMonitor support out, caused issues on Xorg

* removed oldDash

* updated hide overview on startup, no longer closes overview after suspend etc

* removed _newOverviewRelayout

* removed _newUpdateWorkspacesViews

* commented setFocusedMonitor out completly, because show overview on non primary monitor does not work properly for now

* fixed typo

* fixed merging error

* check if func is valid in hookVfunc

* updated ui to gtk4, fixed merging error

* fixed layout for apply changes to all monitors

* fix behaviour tab and app icon margin/padding grid

* fix animate launching new windows grid row

* fixed about tab

Co-authored-by: Cole Gerdemann <corvettecole@gmail.com>
This commit is contained in:
Philipp
2021-05-08 15:07:25 +02:00
committed by GitHub
parent 925f5b27b3
commit a4224f4acc
10 changed files with 3807 additions and 4741 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -38,12 +38,13 @@ const Utils = Me.imports.utils;
const UBUNTU_DOCK_UUID = 'ubuntu-dock@ubuntu.com';
let panelManager;
let oldDash;
let extensionChangedHandler;
let disabledUbuntuDock;
let extensionSystem = (Main.extensionManager || imports.ui.extensionSystem);
function init() {
this._realHasOverview = Main.sessionMode.hasOverview;
Convenience.initTranslations(Utils.TRANSLATION_DOMAIN);
//create an object that persists until gnome-shell is restarted, even if the extension is disabled
@@ -91,6 +92,13 @@ function _enable() {
Me.settings = Convenience.getSettings('org.gnome.shell.extensions.dash-to-panel');
Me.desktopSettings = Convenience.getSettings('org.gnome.desktop.interface');
if (Me.settings.get_boolean('hide-overview-on-startup') && Main.layoutManager._startingUp) {
Main.sessionMode.hasOverview = false;
Main.layoutManager.connect('startup-complete', () => {
Main.sessionMode.hasOverview = this._realHasOverview
});
}
panelManager = new PanelManager.dtpPanelManager();
panelManager.enable();
@@ -107,21 +115,14 @@ function _enable() {
}),
Shell.ActionMode.NORMAL | Shell.ActionMode.POPUP
);
// Pretend I'm the dash: meant to make appgrd swarm animation come from the
// right position of the appShowButton.
oldDash = Main.overview._dash;
Main.overview._dash = panelManager.primaryPanel.taskbar;
}
function disable(reset) {
panelManager.disable();
Main.overview._dash = oldDash;
Me.settings.run_dispose();
Me.desktopSettings.run_dispose();
delete Me.settings;
oldDash = null;
panelManager = null;
Utils.removeKeybinding('open-application-menu');
@@ -141,4 +142,6 @@ function disable(reset) {
(extensionSystem._callExtensionEnable || extensionSystem.enableExtension).call(extensionSystem, UBUNTU_DOCK_UUID);
}
}
Main.sessionMode.hasOverview = this._realHasOverview;
}

View File

@@ -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": [ "3.18", "3.20", "3.22", "3.24", "3.26", "3.28", "3.30", "3.32", "3.34", "3.36", "3.38" ],
"shell-version": [ "40" ],
"url": "https://github.com/jderose9/dash-to-panel",
"gettext-domain": "dash-to-panel",
"version": 9999

View File

@@ -33,7 +33,6 @@ const Gdk = imports.gi.Gdk;
const Gio = imports.gi.Gio;
const Mainloop = imports.mainloop;
const IconGrid = imports.ui.iconGrid;
const ViewSelector = imports.ui.viewSelector;
const Meta = imports.gi.Meta;
@@ -421,7 +420,7 @@ var dtpOverview = Utils.defineClass({
if (this._clickToExitEnabled)
return;
let views = Utils.getAppDisplayViews();
let view = imports.ui.appDisplay;
this._oldOverviewReactive = Main.overview._overview.reactive
Main.overview._overview.reactive = true;
@@ -435,76 +434,10 @@ var dtpOverview = Utils.defineClass({
let [x, y] = global.get_pointer();
let pickedActor = global.stage.get_actor_at_pos(Clutter.PickMode.ALL, x, y);
let activePage = Main.overview.viewSelector.getActivePage();
if (activePage == ViewSelector.ViewPage.APPS) {
if(pickedActor != Main.overview._overview
&& (views.length > 1 && pickedActor != Main.overview.viewSelector.appDisplay._controls.get_parent())
&& pickedActor != (views[0].view.actor || views[0].view)
&& (views.length > 1 && pickedActor != views[1].view._scrollView)
&& (views.length > 1 && pickedActor != views[1].view._grid)) {
return Clutter.EVENT_PROPAGATE;
}
if(Me.settings.get_boolean('animate-show-apps')) {
let view = Utils.find(views, v => v.view.actor.visible).view;
view.animate(IconGrid.AnimationDirection.OUT, Lang.bind(this, function() {
Main.overview.viewSelector._appsPage.hide();
Main.overview.hide();
}));
} else {
Main.overview.hide();
}
} else if (activePage == ViewSelector.ViewPage.WINDOWS) {
let overviewControls = Main.overview._overview._controls || Main.overview._controls;
if(pickedActor == overviewControls._thumbnailsBox
|| pickedActor == overviewControls.dash._container) {
return Clutter.EVENT_PROPAGATE;
}
if (pickedActor instanceof Meta.BackgroundActor) {
Utils.find(overviewControls._thumbnailsBox._thumbnails, t =>
pickedActor == t._bgManager.backgroundActor
).activate();
return Clutter.EVENT_STOP;
}
Main.overview.toggle();
} else {
Main.overview.toggle();
}
});
Main.overview._overview.add_action(this._clickAction);
[Main.overview.viewSelector._workspacesDisplay].concat(views.map(v => v.view)).forEach(v => {
if (v._swipeTracker) {
this._signalsHandler.addWithLabel('clickToExit', [
v._swipeTracker,
'begin',
Lang.bind(this, this._onSwipeBegin)
],[
v._swipeTracker,
'end',
Lang.bind(this, this._onSwipeEnd)
]);
} else if (v._panAction) {
this._signalsHandler.addWithLabel('clickToExit', [
v._panAction,
'gesture-begin',
Lang.bind(this, this._onSwipeBegin)
],[
v._panAction,
'gesture-cancel',
Lang.bind(this, this._onSwipeEnd)
],[
v._panAction,
'gesture-end',
Lang.bind(this, this._onSwipeEnd)
]);
}
});
this._clickToExitEnabled = true;
},

View File

@@ -53,7 +53,6 @@ const DND = imports.ui.dnd;
const Shell = imports.gi.Shell;
const PopupMenu = imports.ui.popupMenu;
const IconGrid = imports.ui.iconGrid;
const ViewSelector = imports.ui.viewSelector;
const DateMenu = imports.ui.dateMenu;
const Volume = imports.ui.status.volume;
const Progress = Me.imports.progress;
@@ -74,20 +73,6 @@ const T5 = 'trackerFocusAppTimeout';
const T6 = 'scrollPanelDelayTimeout';
const T7 = 'waitPanelBoxAllocation';
function setMenuArrow(arrowIcon, side) {
let parent = arrowIcon.get_parent();
let iconNames = {
'0': 'pan-down-symbolic', //TOP
'1': 'pan-start-symbolic', //RIGHT
'2': 'pan-up-symbolic', //BOTTOM
'3': 'pan-end-symbolic' //LEFT
};
parent.remove_child(arrowIcon);
arrowIcon.set_icon_name(iconNames[side]);
parent.add_child(arrowIcon);
}
var dtpPanel = Utils.defineClass({
Name: 'DashToPanel-Panel',
Extends: St.Widget,
@@ -147,10 +132,6 @@ var dtpPanel = Utils.defineClass({
this._setPanelMenu('dateMenu', DateMenu.DateMenuButton, this.panel.actor);
this._setPanelMenu('activities', Panel.ActivitiesButton, this.panel.actor);
if (this.statusArea.aggregateMenu) {
setMenuArrow(this.statusArea.aggregateMenu._indicators.get_last_child(), position);
}
this.panel.add_child(this._leftBox);
this.panel.add_child(this._centerBox);
this.panel.add_child(this._rightBox);
@@ -159,8 +140,6 @@ var dtpPanel = Utils.defineClass({
this.statusArea = Main.panel.statusArea;
this.menuManager = Main.panel.menuManager;
setMenuArrow(this.statusArea.aggregateMenu._indicators.get_last_child(), position);
panelBoxes.forEach(p => this[p] = Main.panel[p]);
['activities', 'aggregateMenu', 'dateMenu'].forEach(b => {
@@ -231,14 +210,7 @@ var dtpPanel = Utils.defineClass({
Main.overview._overview.insert_child_at_index(this._myPanelGhost, 0);
} else {
let overviewControls = Main.overview._overview._controls || Main.overview._controls;
if (this.geom.position == St.Side.BOTTOM) {
Main.overview._overview.add_actor(this._myPanelGhost);
} else if (this.geom.position == St.Side.LEFT) {
overviewControls._group.insert_child_at_index(this._myPanelGhost, 0);
} else {
overviewControls._group.add_actor(this._myPanelGhost);
}
}
if (this.panel._leftCorner) {
@@ -300,15 +272,6 @@ var dtpPanel = Utils.defineClass({
}
};
if (this.statusArea.appMenu) {
setMenuArrow(this.statusArea.appMenu._arrow, position);
this._leftBox.remove_child(this.statusArea.appMenu.container);
}
if (this.statusArea.keyboard) {
setMenuArrow(this.statusArea.keyboard._hbox.get_last_child(), position);
}
this.dynamicTransparency = new Transparency.DynamicTransparency(this);
this.taskbar = new Taskbar.taskbar(this);
@@ -322,11 +285,6 @@ var dtpPanel = Utils.defineClass({
this.panel.actor.add_style_class_name('dashtopanelMainPanel ' + this.getOrientation());
// Since Gnome 3.8 dragging an app without having opened the overview before cause the attemp to
//animate a null target since some variables are not initialized when the viewSelector is created
if(Main.overview.viewSelector._activePage == null)
Main.overview.viewSelector._activePage = Main.overview.viewSelector._workspacesPage;
this._setPanelGhostSize();
this._timeoutsHandler.add([T2, Me.settings.get_int('intellihide-enable-start-delay'), () => this.intellihide = new Intellihide.Intellihide(this)]);
@@ -366,6 +324,7 @@ var dtpPanel = Utils.defineClass({
this.statusArea.activities.actor,
'captured-event',
(actor, e) => {
// todo this is not being called right now, so the overview is not shown on the correct monitor
if (e.type() == Clutter.EventType.BUTTON_PRESS || e.type() == Clutter.EventType.TOUCH_BEGIN) {
//temporarily use as primary the monitor on which the activities btn was clicked
this.panelManager.setFocusedMonitor(this.monitor, true);
@@ -481,15 +440,6 @@ var dtpPanel = Utils.defineClass({
originalParent ? originalParent.insert_child_at_index(container, b[1]) : null;
delete container._dtpOriginalParent;
});
if (this.statusArea.appMenu) {
setMenuArrow(this.statusArea.appMenu._arrow, St.Side.TOP);
this._leftBox.add_child(this.statusArea.appMenu.container);
}
if (this.statusArea.keyboard) {
setMenuArrow(this.statusArea.keyboard._hbox.get_last_child(), St.Side.TOP);
}
}
if (!this.panel._leftCorner.actor.mapped) {
@@ -500,7 +450,6 @@ var dtpPanel = Utils.defineClass({
this._setShowDesktopButton(false);
delete Utils.getIndicators(this.statusArea.aggregateMenu._volume)._dtpIgnoreScroll;
setMenuArrow(this.statusArea.aggregateMenu._indicators.get_last_child(), St.Side.TOP);
if (DateMenu.IndicatorPad) {
Utils.hookVfunc(DateMenu.IndicatorPad.prototype, 'get_preferred_width', DateMenu.IndicatorPad.prototype.vfunc_get_preferred_width);
@@ -766,8 +715,7 @@ var dtpPanel = Utils.defineClass({
let paddingSide = this.getPosition() == St.Side.LEFT ? 'left' : 'right';
let scaleFactor = Utils.getScaleFactor();
let style = offset ? 'padding-' + paddingSide + ':' + (offset / scaleFactor) + 'px;' : null;
let searchEntry = Main.overview._searchEntry || Main.overview._overview._searchEntry;
let searchEntry = Main.overview._overview._controls._searchEntry;
searchEntry.get_parent().set_style(style);
}
},
@@ -1461,7 +1409,7 @@ var dtpPanel = Utils.defineClass({
_checkIfIgnoredScrollSource: function(source) {
let ignoredConstr = ['WorkspaceIndicator'];
return source._dtpIgnoreScroll || ignoredConstr.indexOf(source.constructor.name) >= 0;
return source.get_parent()._dtpIgnoreScroll || ignoredConstr.indexOf(source.constructor.name) >= 0;
},
_initProgressManager: function() {
@@ -1532,7 +1480,6 @@ var dtpSecondaryAggregateMenu = Utils.defineClass({
this._indicators.add_child(Utils.getIndicators(this._volume));
this._indicators.add_child(Utils.getIndicators(this._power));
this._indicators.add_child(PopupMenu.arrowIcon(St.Side.BOTTOM));
this.menu.addMenuItem(this._volume.menu);
this._volume._volumeMenu._readOutput();

View File

@@ -76,6 +76,8 @@ var dtpPanelManager = Utils.defineClass({
this.dtpPrimaryMonitor = Main.layoutManager.monitors[dtpPrimaryIndex] || Main.layoutManager.primaryMonitor;
this.proximityManager = new Proximity.ProximityManager();
this._oldGetShowAppsButton = imports.ui.main.overview.dash.showAppsButton;
Utils.wrapActor(Main.panel);
Utils.wrapActor(Main.overview.dash || 0);
@@ -129,11 +131,6 @@ var dtpPanelManager = Utils.defineClass({
if (reset) return;
this._oldViewSelectorAnimateIn = Main.overview.viewSelector._animateIn;
Main.overview.viewSelector._animateIn = Lang.bind(this.primaryPanel, newViewSelectorAnimateIn);
this._oldViewSelectorAnimateOut = Main.overview.viewSelector._animateOut;
Main.overview.viewSelector._animateOut = Lang.bind(this.primaryPanel, newViewSelectorAnimateOut);
if (Config.PACKAGE_VERSION > '3.35.1') {
this._oldDoSpringAnimation = AppDisplay.BaseAppView.prototype._doSpringAnimation;
AppDisplay.BaseAppView.prototype._doSpringAnimation = newDoSpringAnimation;
@@ -157,20 +154,13 @@ var dtpPanelManager = Utils.defineClass({
this._enableHotCornersId = Main.layoutManager._interfaceSettings.connect('changed::enable-hot-corners', () => Main.layoutManager._updateHotCorners());
}
this._oldOverviewRelayout = Main.overview._relayout;
Main.overview._relayout = Lang.bind(Main.overview, this._newOverviewRelayout);
this._oldUpdateWorkspacesViews = Main.overview.viewSelector._workspacesDisplay._updateWorkspacesViews;
Main.overview.viewSelector._workspacesDisplay._updateWorkspacesViews = Lang.bind(Main.overview.viewSelector._workspacesDisplay, this._newUpdateWorkspacesViews);
this._oldGetShowAppsButton = Main.overview.getShowAppsButton;
Main.overview.getShowAppsButton = this._newGetShowAppsButton.bind(this);
this._needsDashItemContainerAllocate = !Dash.DashItemContainer.prototype.hasOwnProperty('vfunc_allocate');
// Since Gnome 3.8 dragging an app without having opened the overview before cause the attemp to
//animate a null target since some variables are not initialized when the viewSelector is created
if(Main.overview.viewSelector._activePage == null)
Main.overview.viewSelector._activePage = Main.overview.viewSelector._workspacesPage;
if (this._needsDashItemContainerAllocate) {
Utils.hookVfunc(Dash.DashItemContainer.prototype, 'allocate', this._newDashItemContainerAllocate);
}
LookingGlass.LookingGlass.prototype._oldResize = LookingGlass.LookingGlass.prototype._resize;
LookingGlass.LookingGlass.prototype._resize = _newLookingGlassResize;
@@ -340,14 +330,6 @@ var dtpPanelManager = Utils.defineClass({
Main.layoutManager._updatePanelBarrier = this._oldUpdatePanelBarrier;
Main.layoutManager._updatePanelBarrier();
Main.overview.viewSelector._animateIn = this._oldViewSelectorAnimateIn;
Main.overview.viewSelector._animateOut = this._oldViewSelectorAnimateOut;
Main.overview._relayout = this._oldOverviewRelayout;
Main.overview._relayout();
Main.overview.viewSelector._workspacesDisplay._updateWorkspacesViews = this._oldUpdateWorkspacesViews;
Utils.getPanelGhost().set_size(-1, -1);
if (this._oldDoSpringAnimation) {
@@ -366,18 +348,16 @@ var dtpPanelManager = Utils.defineClass({
},
setFocusedMonitor: function(monitor, ignoreRelayout) {
this._needsIconAllocate = 1;
// todo show overview on non primary monitor is not working right now on gnome40
if (!this.checkIfFocusedMonitor(monitor)) {
Main.overview.viewSelector._workspacesDisplay._primaryIndex = monitor.index;
// this._needsIconAllocate = 1;
Main.overview._overview.clear_constraints();
Main.overview._overview.add_constraint(new Layout.MonitorConstraint({ index: monitor.index }));
// if (!this.checkIfFocusedMonitor(monitor)) {
// Main.overview._overview._controls._workspacesDisplay._primaryIndex = monitor.index;
if (ignoreRelayout) return;
this._newOverviewRelayout.call(Main.overview);
}
// Main.overview._overview.clear_constraints();
// Main.overview._overview.add_constraint(new Layout.MonitorConstraint({ index: monitor.index }));
// }
},
_saveMonitors: function() {
@@ -393,7 +373,7 @@ var dtpPanelManager = Utils.defineClass({
},
checkIfFocusedMonitor: function(monitor) {
return Main.overview.viewSelector._workspacesDisplay._primaryIndex == monitor.index;
return Main.overview._overview._controls._workspacesDisplay._primaryIndex == monitor.index;
},
_createPanel: function(monitor, isStandalone) {
@@ -511,66 +491,6 @@ var dtpPanelManager = Utils.defineClass({
});
},
_newOverviewRelayout: function() {
// To avoid updating the position and size of the workspaces
// we just hide the overview. The positions will be updated
// when it is next shown.
this.hide();
let workArea = Main.layoutManager.getWorkAreaForMonitor(Main.overview.viewSelector._workspacesDisplay._primaryIndex);
this._coverPane.set_position(0, workArea.y);
this._coverPane.set_size(workArea.width, workArea.height);
this._updateBackgrounds();
},
_newUpdateWorkspacesViews: function() {
for (let i = 0; i < this._workspacesViews.length; i++)
this._workspacesViews[i].destroy();
this._workspacesViews = [];
let monitors = Main.layoutManager.monitors;
for (let i = 0; i < monitors.length; i++) {
let workspaces;
let view;
if (this._workspacesOnlyOnPrimary && i != Main.layoutManager.primaryIndex) {
view = new WorkspacesView.ExtraWorkspaceView(i);
view.getActiveWorkspace = view.getActiveWorkspace || function() { return this._workspace; };
workspaces = [view._workspace];
} else {
view = new WorkspacesView.WorkspacesView(i, this._scrollAdjustment || 0);
workspaces = view._workspaces;
}
Utils.wrapActor(view);
view.actor.connect('scroll-event', this._onScrollEvent.bind(this));
if (i == Main.layoutManager.primaryIndex && view.scrollAdjustment) {
this._scrollAdjustment = view.scrollAdjustment;
this._scrollAdjustment.connect('notify::value',
this._scrollValueChanged.bind(this));
}
workspaces.forEach(w => w.setFullGeometry = geom => w._fullGeometry = geom);
this._workspacesViews.push(view);
}
this._workspacesViews.forEach(wv => Main.layoutManager.overviewGroup.add_actor(wv.actor));
if (this._syncWorkspacesFullGeometry) {
//gnome-shell 3.36.4
if (this._fullGeometry)
this._syncWorkspacesFullGeometry();
if (this._actualGeometry)
this._syncWorkspacesActualGeometry();
} else if (this._updateWorkspacesFullGeometry) {
this._updateWorkspacesFullGeometry();
this._updateWorkspacesActualGeometry();
}
},
_newGetShowAppsButton: function() {
let focusedMonitorIndex = Utils.findIndex(this.allPanels, p => this.checkIfFocusedMonitor(p.monitor));
@@ -661,47 +581,6 @@ var IconAnimator = Utils.defineClass({
}
});
function newViewSelectorAnimateIn(oldPage) {
if (oldPage)
oldPage.hide();
let vs = Main.overview.viewSelector;
vs.emit('page-empty');
vs._activePage.show();
if (vs._activePage == vs._appsPage && oldPage == vs._workspacesPage) {
// Restore opacity, in case we animated via _fadePageOut
vs._activePage.opacity = 255;
let animate = Me.settings.get_boolean('animate-show-apps');
if(animate)
vs.appDisplay.animate(IconGrid.AnimationDirection.IN);
} else {
vs._fadePageIn();
}
}
function newViewSelectorAnimateOut(page) {
let oldPage = page;
let vs = Main.overview.viewSelector;
if (page == vs._appsPage &&
vs._activePage == vs._workspacesPage &&
!Main.overview.animationInProgress) {
let animate = Me.settings.get_boolean('animate-show-apps');
if(animate)
vs.appDisplay.animate(IconGrid.AnimationDirection.OUT, Lang.bind(this,
function() {
vs._animateIn(oldPage)
}));
else
vs._animateIn(oldPage)
} else {
vs._fadePageOut(page);
}
}
function newGetPositionForDirection(direction, fromWs, toWs) {
let [xDest, yDest] = WM.WindowManager.prototype._getPositionForDirection(direction, fromWs, toWs);

597
prefs.js
View File

@@ -157,24 +157,18 @@ function mergeObjects(main, bck) {
return main;
};
const Settings = new Lang.Class({
Name: 'DashToPanel.Settings',
const Preferences = new Lang.Class({
Name: 'DashToPanel.Preferences',
_init: function() {
this._settings = Convenience.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._builder.add_from_file(Me.path + '/Settings.ui');
this.notebook = this._builder.get_object('settings_notebook');
this.viewport = new Gtk.Viewport();
this.viewport.add(this.notebook);
this.widget = new Gtk.ScrolledWindow();
this.widget.add(this.viewport);
this.notebook.set_size_request(680, 740);
// Timeout to delay the update of the settings
this._panel_size_timeout = 0;
@@ -187,10 +181,7 @@ const Settings = new Lang.Class({
this._tray_padding_timeout = 0;
this._statusicon_padding_timeout = 0;
this._leftbox_padding_timeout = 0;
this._bindSettings();
this._builder.connect_signals_full(Lang.bind(this, this._connector));
},
/**
@@ -340,7 +331,10 @@ const Settings = new Lang.Class({
_displayPanelPositionsForMonitor: function(monitorIndex) {
let taskbarListBox = this._builder.get_object('taskbar_display_listbox');
taskbarListBox.get_children().forEach(c => c.destroy());
while(taskbarListBox.get_first_child())
{
taskbarListBox.remove(taskbarListBox.get_first_child());
}
let labels = {};
let panelPosition = this._getPanelPosition(monitorIndex);
@@ -352,13 +346,16 @@ const Settings = new Lang.Class({
let monitorSync = this._settings.get_boolean('panel-element-positions-monitors-sync');
let monitors = monitorSync ? this.monitors : [monitorIndex];
taskbarListBox.get_children().forEach(c => {
let child = taskbarListBox.get_first_child();
while (child != null)
{
newPanelElementPositions.push({
element: c.id,
visible: c.visibleToggleBtn.get_active(),
position: c.positionCombo.get_active_id()
});
element: child.id,
visible: child.visibleToggleBtn.get_active(),
position: child.positionCombo.get_active_id()
});
child = child.get_next_sibling();
}
monitors.forEach(m => panelElementPositionsSettings[m] = newPanelElementPositions);
this._settings.set_string('panel-element-positions', JSON.stringify(panelElementPositionsSettings));
@@ -377,7 +374,7 @@ const Settings = new Lang.Class({
panelElementPositions.forEach(el => {
let row = new Gtk.ListBoxRow();
let grid = new Gtk.Grid({ margin: 2, margin_left: 12, margin_right: 12, column_spacing: 8 });
let grid = new Gtk.Grid({ margin_start: 12, margin_end: 12, column_spacing: 8 });
let upDownGrid = new Gtk.Grid({ column_spacing: 2 });
let upBtn = new Gtk.Button({ tooltip_text: _('Move up') });
let upImg = new Gtk.Image({ icon_name: 'go-up-symbolic', pixel_size: 12 });
@@ -406,43 +403,41 @@ const Settings = new Lang.Class({
visibleToggleBtn.connect('toggled', () => updateElementsSettings());
positionCombo.connect('changed', () => updateElementsSettings());
upBtn.add(upImg);
downBtn.add(downImg);
upBtn.set_child(upImg);
downBtn.set_child(downImg);
upDownGrid.add(upBtn);
upDownGrid.add(downBtn);
upDownGrid.attach(upBtn, 0, 0, 1, 1);
upDownGrid.attach(downBtn, 1, 0, 1, 1);
grid.add(upDownGrid);
grid.add(new Gtk.Label({ label: labels[el.element], xalign: 0, hexpand: true }));
grid.attach(upDownGrid, 0, 0, 1, 1);
grid.attach(new Gtk.Label({ label: labels[el.element], xalign: 0, hexpand: true }), 1, 0, 1, 1);
if (Pos.optionDialogFunctions[el.element]) {
let cogImg = new Gtk.Image({ icon_name: 'emblem-system-symbolic' });
let optionsBtn = new Gtk.Button({ tooltip_text: _('More options') });
optionsBtn.get_style_context().add_class('circular');
optionsBtn.add(cogImg);
grid.add(optionsBtn);
optionsBtn.set_child(cogImg);
grid.attach(optionsBtn, 2, 0, 1, 1);
optionsBtn.connect('clicked', () => this[Pos.optionDialogFunctions[el.element]]());
}
grid.add(visibleToggleBtn);
grid.add(positionCombo);
grid.attach(visibleToggleBtn, 3, 0, 1, 1);
grid.attach(positionCombo, 4, 0, 1, 1);
row.id = el.element;
row.visibleToggleBtn = visibleToggleBtn;
row.positionCombo = positionCombo;
row.add(grid);
taskbarListBox.add(row);
row.set_child(grid);
taskbarListBox.insert(row, -1);
});
taskbarListBox.show_all();
},
_showShowAppsButtonOptions: function() {
let dialog = new Gtk.Dialog({ title: _('Show Applications options'),
transient_for: this.widget.get_toplevel(),
transient_for: this.notebook.get_root(),
use_header_bar: true,
modal: true });
@@ -451,32 +446,39 @@ const Settings = new Lang.Class({
dialog.add_button(_('Reset to defaults'), 1);
let box = this._builder.get_object('show_applications_options');
dialog.get_content_area().add(box);
dialog.get_content_area().append(box);
let fileChooser = this._builder.get_object('show_applications_icon_file_filebutton');
let fileChooserButton = this._builder.get_object('show_applications_icon_file_filebutton');
let fileChooser = new Gtk.FileChooserNative({ title: _('Open icon'), transient_for: dialog });
let fileImage = this._builder.get_object('show_applications_current_icon_image');
let fileFilter = new Gtk.FileFilter();
fileFilter.add_pixbuf_formats();
fileChooser.filter = fileFilter;
let handleIconChange = function(newIconPath) {
if (newIconPath && GLib.file_test(newIconPath, GLib.FileTest.EXISTS)) {
let file = Gio.File.new_for_path(newIconPath)
let file = Gio.File.new_for_path(newIconPath);
let pixbuf = GdkPixbuf.Pixbuf.new_from_stream_at_scale(file.read(null), 32, 32, true, null);
fileImage.set_from_pixbuf(pixbuf);
fileChooser.set_filename(newIconPath);
fileChooser.set_file(file);
fileChooserButton.set_label(newIconPath);
} else {
newIconPath = '';
fileImage.set_from_icon_name('view-app-grid-symbolic', 32);
fileChooser.unselect_all();
fileChooser.set_current_folder(GLib.get_user_special_dir(GLib.UserDirectory.DIRECTORY_PICTURES));
fileImage.set_from_icon_name('view-app-grid-symbolic');
let picturesFolder = Gio.File.new_for_path(GLib.get_user_special_dir(GLib.UserDirectory.DIRECTORY_PICTURES));
fileChooser.set_file(picturesFolder);
fileChooserButton.set_label("(None)");
}
this._settings.set_string('show-apps-icon-file', newIconPath || '');
};
fileFilter.add_pixbuf_formats();
fileChooser.filter = fileFilter;
fileChooserButton.connect('clicked', Lang.bind(this, function() {
fileChooser.show();
}));
fileChooser.connect('file-set', widget => handleIconChange.call(this, widget.get_filename()));
fileChooser.connect('response', widget => handleIconChange.call(this, widget.get_file().get_path()));
handleIconChange.call(this, this._settings.get_string('show-apps-icon-file'));
dialog.connect('response', Lang.bind(this, function(dialog, id) {
@@ -494,12 +496,13 @@ const Settings = new Lang.Class({
return;
}));
dialog.show_all();
dialog.show();
dialog.set_default_size(1, 1);
},
_showDesktopButtonOptions: function() {
let dialog = new Gtk.Dialog({ title: _('Show Desktop options'),
transient_for: this.widget.get_toplevel(),
transient_for: this.notebook.get_root(),
use_header_bar: true,
modal: true });
@@ -508,7 +511,7 @@ const Settings = new Lang.Class({
dialog.add_button(_('Reset to defaults'), 1);
let box = this._builder.get_object('box_show_showdesktop_options');
dialog.get_content_area().add(box);
dialog.get_content_area().append(box);
this._builder.get_object('show_showdesktop_width_spinbutton').set_value(this._settings.get_int('showdesktop-button-width'));
this._builder.get_object('show_showdesktop_width_spinbutton').connect('value-changed', Lang.bind (this, function(widget) {
@@ -546,7 +549,8 @@ const Settings = new Lang.Class({
return;
}));
dialog.show_all();
dialog.show();
dialog.set_default_size(1, 1);
},
_bindSettings: function() {
@@ -641,7 +645,7 @@ const Settings = new Lang.Class({
this._builder.get_object('dot_style_options_button').connect('clicked', Lang.bind(this, function() {
let dialog = new Gtk.Dialog({ title: _('Running Indicator Options'),
transient_for: this.widget.get_toplevel(),
transient_for: this.notebook.get_root(),
use_header_bar: true,
modal: true });
@@ -650,7 +654,7 @@ const Settings = new Lang.Class({
dialog.add_button(_('Reset to defaults'), 1);
let box = this._builder.get_object('box_dots_options');
dialog.get_content_area().add(box);
dialog.get_content_area().append(box);
this._settings.bind('dot-color-dominant',
this._builder.get_object('dot_color_dominant_switch'),
@@ -783,7 +787,8 @@ const Settings = new Lang.Class({
return;
}));
dialog.show_all();
dialog.show();
dialog.set_default_size(1, 1);
}));
@@ -986,7 +991,7 @@ const Settings = new Lang.Class({
this._builder.get_object('trans_dyn_options_button').connect('clicked', Lang.bind(this, function() {
let dialog = new Gtk.Dialog({ title: _('Dynamic opacity options'),
transient_for: this.widget.get_toplevel(),
transient_for: this.notebook.get_root(),
use_header_bar: true,
modal: true });
@@ -995,7 +1000,7 @@ const Settings = new Lang.Class({
dialog.add_button(_('Reset to defaults'), 1);
let box = this._builder.get_object('box_dynamic_opacity_options');
dialog.get_content_area().add(box);
dialog.get_content_area().append(box);
dialog.connect('response', Lang.bind(this, function(dialog, id) {
if (id == 1) {
@@ -1018,7 +1023,8 @@ const Settings = new Lang.Class({
return;
}));
dialog.show_all();
dialog.show();
dialog.set_default_size(1, 1);
}));
@@ -1129,7 +1135,7 @@ const Settings = new Lang.Class({
this._builder.get_object('intellihide_options_button').connect('clicked', Lang.bind(this, function() {
let dialog = new Gtk.Dialog({ title: _('Intellihide options'),
transient_for: this.widget.get_toplevel(),
transient_for: this.notebook.get_root(),
use_header_bar: true,
modal: true });
@@ -1138,7 +1144,7 @@ const Settings = new Lang.Class({
dialog.add_button(_('Reset to defaults'), 1);
let box = this._builder.get_object('box_intellihide_options');
dialog.get_content_area().add(box);
dialog.get_content_area().append(box);
dialog.connect('response', Lang.bind(this, function(dialog, id) {
if (id == 1) {
@@ -1173,7 +1179,8 @@ const Settings = new Lang.Class({
return;
}));
dialog.show_all();
dialog.show();
dialog.set_default_size(1, 1);
}));
@@ -1184,11 +1191,6 @@ const Settings = new Lang.Class({
this._settings.set_int('show-apps-icon-side-padding', widget.get_value());
}));
this._settings.bind('animate-show-apps',
this._builder.get_object('application_button_animation_switch'),
'active',
Gio.SettingsBindFlags.DEFAULT);
this._settings.bind('show-apps-override-escape',
this._builder.get_object('show_applications_esc_key_switch'),
'active',
@@ -1256,7 +1258,7 @@ const Settings = new Lang.Class({
this._builder.get_object('show_window_previews_button').connect('clicked', Lang.bind(this, function() {
let dialog = new Gtk.Dialog({ title: _('Window preview options'),
transient_for: this.widget.get_toplevel(),
transient_for: this.notebook.get_root(),
use_header_bar: true,
modal: true });
@@ -1266,9 +1268,7 @@ const Settings = new Lang.Class({
let scrolledWindow = this._builder.get_object('box_window_preview_options');
adjustScrollableHeight(this._builder.get_object('viewport_window_preview_options'), scrolledWindow);
dialog.get_content_area().add(scrolledWindow);
dialog.get_content_area().append(scrolledWindow);
this._builder.get_object('preview_timeout_spinbutton').set_value(this._settings.get_int('show-window-previews-timeout'));
this._builder.get_object('preview_timeout_spinbutton').connect('value-changed', Lang.bind (this, function(widget) {
@@ -1482,7 +1482,7 @@ const Settings = new Lang.Class({
return;
}));
dialog.show_all();
dialog.show();
}));
@@ -1501,6 +1501,11 @@ const Settings = new Lang.Class({
'active',
Gio.SettingsBindFlags.DEFAULT);
this._settings.bind('hide-overview-on-startup',
this._builder.get_object('hide_overview_on_startup_switch'),
'active',
Gio.SettingsBindFlags.DEFAULT);
this._settings.bind('group-apps',
this._builder.get_object('group_apps_switch'),
'active',
@@ -1542,7 +1547,7 @@ const Settings = new Lang.Class({
this._builder.get_object('show_group_apps_options_button').connect('clicked', Lang.bind(this, function() {
let dialog = new Gtk.Dialog({ title: _('Ungrouped application options'),
transient_for: this.widget.get_toplevel(),
transient_for: this.notebook.get_root(),
use_header_bar: true,
modal: true });
@@ -1551,7 +1556,7 @@ const Settings = new Lang.Class({
dialog.add_button(_('Reset to defaults'), 1);
let box = this._builder.get_object('box_group_apps_options');
dialog.get_content_area().add(box);
dialog.get_content_area().append(box);
this._builder.get_object('group_apps_label_font_size_spinbutton').set_value(this._settings.get_int('group-apps-label-font-size'));
this._builder.get_object('group_apps_label_font_size_spinbutton').connect('value-changed', Lang.bind (this, function(widget) {
@@ -1613,7 +1618,8 @@ const Settings = new Lang.Class({
return;
}));
dialog.show_all();
dialog.show();
dialog.set_default_size(600, 1);
}));
@@ -1637,7 +1643,7 @@ const Settings = new Lang.Class({
this._builder.get_object('middle_click_options_button').connect('clicked', Lang.bind(this, function() {
let dialog = new Gtk.Dialog({ title: _('Customize middle-click behavior'),
transient_for: this.widget.get_toplevel(),
transient_for: this.notebook.get_root(),
use_header_bar: true,
modal: true });
@@ -1646,7 +1652,7 @@ const Settings = new Lang.Class({
dialog.add_button(_('Reset to defaults'), 1);
let box = this._builder.get_object('box_middle_click_options');
dialog.get_content_area().add(box);
dialog.get_content_area().append(box);
this._builder.get_object('shift_click_action_combo').set_active_id(this._settings.get_string('shift-click-action'));
@@ -1685,7 +1691,8 @@ const Settings = new Lang.Class({
return;
}));
dialog.show_all();
dialog.show();
dialog.set_default_size(700, 1);
}));
@@ -1702,7 +1709,7 @@ const Settings = new Lang.Class({
// Create dialog for panel scroll options
this._builder.get_object('scroll_panel_options_button').connect('clicked', Lang.bind(this, function() {
let dialog = new Gtk.Dialog({ title: _('Customize panel scroll behavior'),
transient_for: this.widget.get_toplevel(),
transient_for: this.notebook.get_root(),
use_header_bar: true,
modal: true });
@@ -1711,7 +1718,7 @@ const Settings = new Lang.Class({
dialog.add_button(_('Reset to defaults'), 1);
let box = this._builder.get_object('scroll_panel_options_box');
dialog.get_content_area().add(box);
dialog.get_content_area().append(box);
this._builder.get_object('scroll_panel_options_delay_spinbutton').set_value(this._settings.get_int('scroll-panel-delay'));
this._builder.get_object('scroll_panel_options_delay_spinbutton').connect('value-changed', Lang.bind (this, function(widget) {
@@ -1738,14 +1745,15 @@ const Settings = new Lang.Class({
return;
}));
dialog.show_all();
dialog.show();
dialog.set_default_size(640, 1);
}));
// Create dialog for icon scroll options
this._builder.get_object('scroll_icon_options_button').connect('clicked', Lang.bind(this, function() {
let dialog = new Gtk.Dialog({ title: _('Customize icon scroll behavior'),
transient_for: this.widget.get_toplevel(),
transient_for: this.notebook.get_root(),
use_header_bar: true,
modal: true });
@@ -1754,7 +1762,7 @@ const Settings = new Lang.Class({
dialog.add_button(_('Reset to defaults'), 1);
let box = this._builder.get_object('scroll_icon_options_box');
dialog.get_content_area().add(box);
dialog.get_content_area().append(box);
this._builder.get_object('scroll_icon_options_delay_spinbutton').set_value(this._settings.get_int('scroll-icon-delay'));
this._builder.get_object('scroll_icon_options_delay_spinbutton').connect('value-changed', Lang.bind (this, function(widget) {
@@ -1774,7 +1782,8 @@ const Settings = new Lang.Class({
return;
}));
dialog.show_all();
dialog.show();
dialog.set_default_size(640, 1);
}));
@@ -1842,7 +1851,7 @@ const Settings = new Lang.Class({
this._builder.get_object('overlay_button').connect('clicked', Lang.bind(this, function() {
let dialog = new Gtk.Dialog({ title: _('Advanced hotkeys options'),
transient_for: this.widget.get_toplevel(),
transient_for: this.notebook.get_root(),
use_header_bar: true,
modal: true });
@@ -1851,7 +1860,7 @@ const Settings = new Lang.Class({
dialog.add_button(_('Reset to defaults'), 1);
let box = this._builder.get_object('box_overlay_shortcut');
dialog.get_content_area().add(box);
dialog.get_content_area().append(box);
dialog.connect('response', Lang.bind(this, function(dialog, id) {
if (id == 1) {
@@ -1868,7 +1877,8 @@ const Settings = new Lang.Class({
return;
}));
dialog.show_all();
dialog.show();
dialog.set_default_size(600, 1);
}));
@@ -1876,7 +1886,7 @@ const Settings = new Lang.Class({
this._builder.get_object('secondarymenu_options_button').connect('clicked', Lang.bind(this, function() {
let dialog = new Gtk.Dialog({ title: _('Secondary Menu Options'),
transient_for: this.widget.get_toplevel(),
transient_for: this.notebook.get_root(),
use_header_bar: true,
modal: true });
@@ -1885,7 +1895,7 @@ const Settings = new Lang.Class({
dialog.add_button(_('Reset to defaults'), 1);
let box = this._builder.get_object('box_secondarymenu_options');
dialog.get_content_area().add(box);
dialog.get_content_area().append(box);
this._settings.bind('secondarymenu-contains-appmenu',
this._builder.get_object('secondarymenu_appmenu_switch'),
@@ -1910,7 +1920,8 @@ const Settings = new Lang.Class({
return;
}));
dialog.show_all();
dialog.show();
dialog.set_default_size(480, 1);
}));
@@ -1918,7 +1929,7 @@ const Settings = new Lang.Class({
this._builder.get_object('button_advanced_options').connect('clicked', Lang.bind(this, function() {
let dialog = new Gtk.Dialog({ title: _('Advanced Options'),
transient_for: this.widget.get_toplevel(),
transient_for: this.notebook.get_root(),
use_header_bar: true,
modal: true });
@@ -1927,7 +1938,7 @@ const Settings = new Lang.Class({
dialog.add_button(_('Reset to defaults'), 1);
let box = this._builder.get_object('box_advanced_options');
dialog.get_content_area().add(box);
dialog.get_content_area().append(box);
dialog.connect('response', Lang.bind(this, function(dialog, id) {
if (id == 1) {
@@ -1941,7 +1952,8 @@ const Settings = new Lang.Class({
return;
}));
dialog.show_all();
dialog.show();
dialog.set_default_size(480, 1);
}));
@@ -2119,9 +2131,8 @@ const Settings = new Lang.Class({
this._builder.get_object('importexport_export_button').connect('clicked', widget => {
this._showFileChooser(
_('Export settings'),
{ action: Gtk.FileChooserAction.SAVE,
do_overwrite_confirmation: true },
Gtk.STOCK_SAVE,
{ action: Gtk.FileChooserAction.SAVE },
"Save",
filename => {
let file = Gio.file_new_for_path(filename);
let raw = file.replace(null, false, Gio.FileCreateFlags.NONE, null);
@@ -2137,8 +2148,9 @@ const Settings = new Lang.Class({
this._showFileChooser(
_('Import settings'),
{ action: Gtk.FileChooserAction.OPEN },
Gtk.STOCK_OPEN,
"Open",
filename => {
if (filename && GLib.file_test(filename, GLib.FileTest.EXISTS)) {
let settingsFile = Gio.File.new_for_path(filename);
let [ , pid, stdin, stdout, stderr] =
GLib.spawn_async_with_pipes(
@@ -2154,13 +2166,13 @@ const Settings = new Lang.Class({
GLib.close(stderr);
let [ , , , retCode] = GLib.spawn_command_line_sync(GSET + ' -d ' + Me.uuid);
if (retCode == 0) {
GLib.child_watch_add(GLib.PRIORITY_DEFAULT, pid, () => GLib.spawn_command_line_sync(GSET + ' -e ' + Me.uuid));
}
stdin.splice(settingsFile.read(null), Gio.OutputStreamSpliceFlags.CLOSE_SOURCE | Gio.OutputStreamSpliceFlags.CLOSE_TARGET, null);
}
}
);
});
@@ -2178,234 +2190,240 @@ const Settings = new Lang.Class({
},
_showFileChooser: function(title, params, acceptBtn, acceptHandler) {
let dialog = new Gtk.FileChooserDialog(mergeObjects({ title: title, transient_for: this.widget.get_toplevel() }, params));
let dialog = new Gtk.FileChooserDialog(mergeObjects({ title: title, transient_for: this.notebook.get_root() }, params));
dialog.add_button(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL);
dialog.add_button("Cancel", Gtk.ResponseType.CANCEL);
dialog.add_button(acceptBtn, Gtk.ResponseType.ACCEPT);
if (dialog.run() == Gtk.ResponseType.ACCEPT) {
try {
acceptHandler(dialog.get_filename());
} catch(e) {
log('error from dash-to-panel filechooser: ' + e);
}
}
dialog.show();
dialog.connect('response', Lang.bind(this, function(dialog, id) {
acceptHandler.call(this, dialog.get_file().get_path());
dialog.destroy();
},
}));
}
});
/**
* Object containing all signals defined in the glade file
*/
_SignalHandler: {
animate_appicon_hover_options_duration_scale_format_value_cb: function(scale, value) {
const BuilderScope = GObject.registerClass({
Implements: [Gtk.BuilderScope],
}, class BuilderScope extends GObject.Object {
_init(preferences) {
this._preferences = preferences;
super._init();
}
vfunc_create_closure(builder, handlerName, flags, connectObject) {
if (flags & Gtk.BuilderClosureFlags.SWAPPED)
throw new Error('Unsupported template signal flag "swapped"');
if (typeof this[handlerName] === 'undefined')
throw new Error(`${handlerName} is undefined`);
return this[handlerName].bind(connectObject || this);
}
on_btn_click(connectObject) {
connectObject.set_label("Clicked");
}
animate_appicon_hover_options_duration_scale_format_value_cb(scale, value) {
return _("%d ms").format(value);
},
}
animate_appicon_hover_options_rotation_scale_format_value_cb: function(scale, value) {
animate_appicon_hover_options_rotation_scale_format_value_cb(scale, value) {
return _("%d °").format(value);
},
}
animate_appicon_hover_options_travel_scale_format_value_cb: function(scale, value) {
animate_appicon_hover_options_travel_scale_format_value_cb(scale, value) {
return _("%d %%").format(value);
},
}
animate_appicon_hover_options_zoom_scale_format_value_cb: function(scale, value) {
animate_appicon_hover_options_zoom_scale_format_value_cb(scale, value) {
return _("%d %%").format(value);
},
}
animate_appicon_hover_options_convexity_scale_format_value_cb: function(scale, value) {
animate_appicon_hover_options_convexity_scale_format_value_cb(scale, value) {
return _("%.1f").format(value);
},
}
animate_appicon_hover_options_extent_scale_format_value_cb: function(scale, value) {
animate_appicon_hover_options_extent_scale_format_value_cb(scale, value) {
return Gettext.ngettext("%d icon", "%d icons", value).format(value);
},
}
position_bottom_button_clicked_cb: function(button) {
if (!this._ignorePositionRadios && button.get_active()) this._setPanelPosition(Pos.BOTTOM);
},
position_bottom_button_clicked_cb(button) {
if (!this._preferences._ignorePositionRadios && button.get_active()) this._preferences._setPanelPosition(Pos.BOTTOM);
}
position_top_button_clicked_cb: function(button) {
if (!this._ignorePositionRadios && button.get_active()) this._setPanelPosition(Pos.TOP);
},
position_top_button_clicked_cb(button) {
if (!this._preferences._ignorePositionRadios && button.get_active()) this._preferences._setPanelPosition(Pos.TOP);
}
position_left_button_clicked_cb: function(button) {
if (!this._ignorePositionRadios && button.get_active()) this._setPanelPosition(Pos.LEFT);
},
position_left_button_clicked_cb(button) {
if (!this._preferences._ignorePositionRadios && button.get_active()) this._preferences._setPanelPosition(Pos.LEFT);
}
position_right_button_clicked_cb: function(button) {
if (!this._ignorePositionRadios && button.get_active()) this._setPanelPosition(Pos.RIGHT);
},
position_right_button_clicked_cb(button) {
if (!this._preferences._ignorePositionRadios && button.get_active()) this._preferences._setPanelPosition(Pos.RIGHT);
}
dots_bottom_button_toggled_cb: function(button) {
dots_bottom_button_toggled_cb(button) {
if (button.get_active())
this._settings.set_string('dot-position', "BOTTOM");
},
this._preferences._settings.set_string('dot-position', "BOTTOM");
}
dots_top_button_toggled_cb: function(button) {
dots_top_button_toggled_cb(button) {
if (button.get_active())
this._settings.set_string('dot-position', "TOP");
},
this._preferences._settings.set_string('dot-position', "TOP");
}
dots_left_button_toggled_cb: function(button) {
dots_left_button_toggled_cb(button) {
if (button.get_active())
this._settings.set_string('dot-position', "LEFT");
},
this._preferences._settings.set_string('dot-position', "LEFT");
}
dots_right_button_toggled_cb: function(button) {
dots_right_button_toggled_cb(button) {
if (button.get_active())
this._settings.set_string('dot-position', "RIGHT");
},
this._preferences._settings.set_string('dot-position', "RIGHT");
}
preview_title_position_bottom_button_toggled_cb: function(button) {
preview_title_position_bottom_button_toggled_cb(button) {
if (button.get_active())
this._settings.set_string('window-preview-title-position', 'BOTTOM');
},
this._preferences._settings.set_string('window-preview-title-position', 'BOTTOM');
}
preview_title_position_top_button_toggled_cb: function(button) {
preview_title_position_top_button_toggled_cb(button) {
if (button.get_active())
this._settings.set_string('window-preview-title-position', 'TOP');
},
this._preferences._settings.set_string('window-preview-title-position', 'TOP');
}
panel_length_scale_format_value_cb: function(scale, value) {
return value+ '%';
},
panel_size_scale_format_value_cb: function(scale, value) {
panel_size_scale_format_value_cb(scale, value) {
return value+ ' px';
},
}
panel_size_scale_value_changed_cb: function(scale) {
// Avoid settings the size continuously
if (this._panel_size_timeout > 0)
Mainloop.source_remove(this._panel_size_timeout);
this._panel_size_timeout = Mainloop.timeout_add(SCALE_UPDATE_TIMEOUT, Lang.bind(this, function() {
const value = scale.get_value();
const monitorSync = this._settings.get_boolean('panel-element-positions-monitors-sync');
const monitorsToSetFor = monitorSync ? this.monitors : [this._currentMonitorIndex];
monitorsToSetFor.forEach(monitorIndex => {
PanelSettings.setPanelSize(this._settings, monitorIndex, value);
});
this._panel_size_timeout = 0;
return GLib.SOURCE_REMOVE;
}));
},
tray_size_scale_format_value_cb: function(scale, value) {
return value+ ' px';
},
tray_size_scale_value_changed_cb: function(scale) {
panel_size_scale_value_changed_cb(scale) {
// Avoid settings the size consinuosly
if (this._tray_size_timeout > 0)
Mainloop.source_remove(this._tray_size_timeout);
if (this._preferences._panel_size_timeout > 0)
Mainloop.source_remove(this._preferences._panel_size_timeout);
this._tray_size_timeout = Mainloop.timeout_add(SCALE_UPDATE_TIMEOUT, Lang.bind(this, function() {
this._settings.set_int('tray-size', scale.get_value());
this._tray_size_timeout = 0;
return GLib.SOURCE_REMOVE;
}));
},
leftbox_size_scale_format_value_cb: function(scale, value) {
return value+ ' px';
},
leftbox_size_scale_value_changed_cb: function(scale) {
// Avoid settings the size consinuosly
if (this._leftbox_size_timeout > 0)
Mainloop.source_remove(this._leftbox_size_timeout);
this._leftbox_size_timeout = Mainloop.timeout_add(SCALE_UPDATE_TIMEOUT, Lang.bind(this, function() {
this._settings.set_int('leftbox-size', scale.get_value());
this._leftbox_size_timeout = 0;
return GLib.SOURCE_REMOVE;
}));
},
appicon_margin_scale_format_value_cb: function(scale, value) {
return value+ ' px';
},
appicon_margin_scale_value_changed_cb: function(scale) {
// Avoid settings the size consinuosly
if (this._appicon_margin_timeout > 0)
Mainloop.source_remove(this._appicon_margin_timeout);
this._appicon_margin_timeout = Mainloop.timeout_add(SCALE_UPDATE_TIMEOUT, Lang.bind(this, function() {
this._settings.set_int('appicon-margin', scale.get_value());
this._appicon_margin_timeout = 0;
return GLib.SOURCE_REMOVE;
}));
},
appicon_padding_scale_format_value_cb: function(scale, value) {
return value + ' px';
},
appicon_padding_scale_value_changed_cb: function(scale) {
// Avoid settings the size consinuosly
if (this._appicon_padding_timeout > 0)
Mainloop.source_remove(this._appicon_padding_timeout);
this._appicon_padding_timeout = Mainloop.timeout_add(SCALE_UPDATE_TIMEOUT, Lang.bind(this, function() {
this._settings.set_int('appicon-padding', scale.get_value());
this._appicon_padding_timeout = 0;
return GLib.SOURCE_REMOVE;
}));
},
tray_padding_scale_format_value_cb: function(scale, value) {
return value+ ' px';
},
tray_padding_scale_value_changed_cb: function(scale) {
// Avoid settings the size consinuosly
if (this._tray_padding_timeout > 0)
Mainloop.source_remove(this._tray_padding_timeout);
this._tray_padding_timeout = Mainloop.timeout_add(SCALE_UPDATE_TIMEOUT, Lang.bind(this, function() {
this._settings.set_int('tray-padding', scale.get_value());
this._tray_padding_timeout = 0;
return GLib.SOURCE_REMOVE;
}));
},
statusicon_padding_scale_format_value_cb: function(scale, value) {
return value+ ' px';
},
statusicon_padding_scale_value_changed_cb: function(scale) {
// Avoid settings the size consinuosly
if (this._statusicon_padding_timeout > 0)
Mainloop.source_remove(this._statusicon_padding_timeout);
this._statusicon_padding_timeout = Mainloop.timeout_add(SCALE_UPDATE_TIMEOUT, Lang.bind(this, function() {
this._settings.set_int('status-icon-padding', scale.get_value());
this._statusicon_padding_timeout = 0;
return GLib.SOURCE_REMOVE;
}));
},
leftbox_padding_scale_format_value_cb: function(scale, value) {
return value+ ' px';
},
leftbox_padding_scale_value_changed_cb: function(scale) {
// Avoid settings the size consinuosly
if (this._leftbox_padding_timeout > 0)
Mainloop.source_remove(this._leftbox_padding_timeout);
this._leftbox_padding_timeout = Mainloop.timeout_add(SCALE_UPDATE_TIMEOUT, Lang.bind(this, function() {
this._settings.set_int('leftbox-padding', scale.get_value());
this._leftbox_padding_timeout = 0;
this._preferences._panel_size_timeout = Mainloop.timeout_add(SCALE_UPDATE_TIMEOUT, Lang.bind(this, function() {
this._preferences._settings.set_int('panel-size', scale.get_value());
this._preferences._panel_size_timeout = 0;
return GLib.SOURCE_REMOVE;
}));
}
tray_size_scale_format_value_cb(scale, value) {
return value+ ' px';
}
tray_size_scale_value_changed_cb(scale) {
// Avoid settings the size consinuosly
if (this._preferences._tray_size_timeout > 0)
Mainloop.source_remove(this._preferences._tray_size_timeout);
this._preferences._tray_size_timeout = Mainloop.timeout_add(SCALE_UPDATE_TIMEOUT, Lang.bind(this, function() {
this._preferences._settings.set_int('tray-size', scale.get_value());
this._preferences._tray_size_timeout = 0;
return GLib.SOURCE_REMOVE;
}));
}
leftbox_size_scale_format_value_cb(scale, value) {
return value+ ' px';
}
leftbox_size_scale_value_changed_cb(scale) {
// Avoid settings the size consinuosly
if (this._preferences._leftbox_size_timeout > 0)
Mainloop.source_remove(this._preferences._leftbox_size_timeout);
this._preferences._leftbox_size_timeout = Mainloop.timeout_add(SCALE_UPDATE_TIMEOUT, Lang.bind(this, function() {
this._preferences._settings.set_int('leftbox-size', scale.get_value());
this._preferences._leftbox_size_timeout = 0;
return GLib.SOURCE_REMOVE;
}));
}
appicon_margin_scale_format_value_cb(scale, value) {
return value+ ' px';
}
appicon_margin_scale_value_changed_cb(scale) {
// Avoid settings the size consinuosly
if (this._preferences._appicon_margin_timeout > 0)
Mainloop.source_remove(this._preferences._appicon_margin_timeout);
this._preferences._appicon_margin_timeout = Mainloop.timeout_add(SCALE_UPDATE_TIMEOUT, Lang.bind(this, function() {
this._preferences._settings.set_int('appicon-margin', scale.get_value());
this._preferences._appicon_margin_timeout = 0;
return GLib.SOURCE_REMOVE;
}));
}
appicon_padding_scale_format_value_cb(scale, value) {
return value + ' px';
}
appicon_padding_scale_value_changed_cb(scale) {
// Avoid settings the size consinuosly
if (this._preferences._appicon_padding_timeout > 0)
Mainloop.source_remove(this._preferences._appicon_padding_timeout);
this._preferences._appicon_padding_timeout = Mainloop.timeout_add(SCALE_UPDATE_TIMEOUT, Lang.bind(this, function() {
this._preferences._settings.set_int('appicon-padding', scale.get_value());
this._preferences._appicon_padding_timeout = 0;
return GLib.SOURCE_REMOVE;
}));
}
tray_padding_scale_format_value_cb(scale, value) {
return value+ ' px';
}
tray_padding_scale_value_changed_cb(scale) {
// Avoid settings the size consinuosly
if (this._preferences._tray_padding_timeout > 0)
Mainloop.source_remove(this._preferences._tray_padding_timeout);
this._preferences._tray_padding_timeout = Mainloop.timeout_add(SCALE_UPDATE_TIMEOUT, Lang.bind(this, function() {
this._preferences._settings.set_int('tray-padding', scale.get_value());
this._preferences._tray_padding_timeout = 0;
return GLib.SOURCE_REMOVE;
}));
}
statusicon_padding_scale_format_value_cb(scale, value) {
return value+ ' px';
}
statusicon_padding_scale_value_changed_cb(scale) {
// Avoid settings the size consinuosly
if (this._preferences._statusicon_padding_timeout > 0)
Mainloop.source_remove(this._preferences._statusicon_padding_timeout);
this._preferences._statusicon_padding_timeout = Mainloop.timeout_add(SCALE_UPDATE_TIMEOUT, Lang.bind(this, function() {
this._preferences._settings.set_int('status-icon-padding', scale.get_value());
this._preferences._statusicon_padding_timeout = 0;
return GLib.SOURCE_REMOVE;
}));
}
leftbox_padding_scale_format_value_cb(scale, value) {
return value+ ' px';
}
leftbox_padding_scale_value_changed_cb(scale) {
// Avoid settings the size consinuosly
if (this._preferences._leftbox_padding_timeout > 0)
Mainloop.source_remove(this._preferences._leftbox_padding_timeout);
this._preferences._leftbox_padding_timeout = Mainloop.timeout_add(SCALE_UPDATE_TIMEOUT, Lang.bind(this, function() {
this._preferences._settings.set_int('leftbox-padding', scale.get_value());
this._preferences._leftbox_padding_timeout = 0;
return GLib.SOURCE_REMOVE;
}));
}
});
@@ -2414,20 +2432,7 @@ function init() {
}
function buildPrefsWidget() {
let settings = new Settings();
let widget = settings.widget;
let preferences = new Preferences();
// I'd like the scrolled window to default to a size large enough to show all without scrolling, if it fits on the screen
// But, it doesn't seem possible, so I'm setting a minimum size if there seems to be enough screen real estate
widget.show_all();
adjustScrollableHeight(settings.viewport, widget);
return widget;
}
function adjustScrollableHeight(viewport, scrollableWindow) {
let viewportSize = viewport.size_request();
let screenHeight = scrollableWindow.get_screen().get_height() - 120;
scrollableWindow.set_size_request(viewportSize.width, viewportSize.height > screenHeight ? screenHeight : viewportSize.height);
return preferences.notebook;
}

View File

@@ -384,11 +384,6 @@
<summary>Override escape key</summary>
<description>Override the escape key to return to the desktop when entering the overview using the Show Applications button</description>
</key>
<key type="b" name="animate-show-apps">
<default>true</default>
<summary>Animate Show Applications from the desktop</summary>
<description>Animate Show Applications from the desktop</description>
</key>
<key type="as" name="show-apps-button-context-menu-commands">
<default>[]</default>
<summary>Show Apps button context menu commands</summary>
@@ -559,6 +554,11 @@
<summary>Close overview by clicking in empty space</summary>
<description>Close overview or app grid by clicking in empty space</description>
</key>
<key type="b" name="hide-overview-on-startup">
<default>false</default>
<summary>Hide overview on startup</summary>
<description>Hide overview on startup, which would be shown by default at gnome startup.</description>
</key>
<key type="b" name="group-apps">
<default>true</default>
<summary>Group applications</summary>

View File

@@ -35,7 +35,8 @@ const Shell = imports.gi.Shell;
const St = imports.gi.St;
const Mainloop = imports.mainloop;
const AppDisplay = imports.ui.appDisplay;
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;
@@ -247,7 +248,8 @@ var taskbar = Utils.defineClass({
}
this.showAppsButton.connect('notify::checked', Lang.bind(this, this._onShowAppsButtonToggled));
this.showAppsButton.checked = Main.overview.viewSelector._showAppsButton.checked;
this.showAppsButton.checked = (SearchController._showAppsButton) ? SearchController._showAppsButton.checked : false;
this._showAppsIcon.childScale = 1;
this._showAppsIcon.childOpacity = 255;
@@ -352,7 +354,7 @@ var taskbar = Utils.defineClass({
],
[
// Ensure the ShowAppsButton status is kept in sync
Main.overview.viewSelector._showAppsButton,
SearchController._showAppsButton,
'notify::checked',
Lang.bind(this, this._syncShowAppsButtonToggled)
],
@@ -1214,26 +1216,16 @@ var taskbar = Utils.defineClass({
// application button, cutomize the behaviour. Otherwise the shell has changed the
// status (due to the _syncShowAppsButtonToggled function below) and it
// has already performed the desired action.
let selector = SearchController;
let animate = Me.settings.get_boolean('animate-show-apps');
let selector = Main.overview.viewSelector;
if (selector._showAppsButton.checked !== this.showAppsButton.checked) {
if (selector._showAppsButton &&
selector._showAppsButton.checked !== this.showAppsButton.checked) {
// find visible view
let visibleView;
Utils.getAppDisplayViews().every(function(v, index) {
if (v.view.actor.visible) {
visibleView = index;
return false;
}
else
return true;
});
if (this.showAppsButton.checked) {
if (Me.settings.get_boolean('show-apps-override-escape')) {
//override escape key to return to the desktop when entering the overview using the showapps button
Main.overview.viewSelector._onStageKeyPress = function(actor, event) {
SearchController._onStageKeyPress = function(actor, event) {
if (Main.modalCount == 1 && event.get_key_symbol() === Clutter.KEY_Escape) {
this._searchActive ? this.reset() : Main.overview.hide();
@@ -1248,7 +1240,7 @@ var taskbar = Utils.defineClass({
// runs if we are already inside the overview.
if (!Main.overview._shown) {
this.forcedOverview = true;
let grid = Utils.getAppDisplayViews()[visibleView].view._grid;
let grid = AppDisplay._grid;
let onShownCb;
let overviewSignal = Config.PACKAGE_VERSION > '3.38.1' ? 'showing' : 'shown';
let overviewShowingId = Main.overview.connect(overviewSignal, () => {
@@ -1256,31 +1248,8 @@ var taskbar = Utils.defineClass({
onShownCb();
});
if (animate) {
// Animate in the the appview, hide the appGrid to avoiud flashing
// Go to the appView before entering the overview, skipping the workspaces.
// Do this manually avoiding opacity in transitions so that the setting of the opacity
// to 0 doesn't get overwritten.
Main.overview.viewSelector._activePage.hide();
Main.overview.viewSelector._activePage = Main.overview.viewSelector._appsPage;
Main.overview.viewSelector._activePage.show();
grid.actor.opacity = 0;
// The animation has to be trigered manually because the AppDisplay.animate
// method is waiting for an allocation not happening, as we skip the workspace view
// and the appgrid could already be allocated from previous shown.
// It has to be triggered after the overview is shown as wrong coordinates are obtained
// otherwise.
onShownCb = () => Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
grid.actor.opacity = 255;
grid.animateSpring(IconGrid.AnimationDirection.IN, this.showAppsButton);
});
} else {
Main.overview.viewSelector._activePage = Main.overview.viewSelector._appsPage;
Main.overview.viewSelector._activePage.show();
onShownCb = () => grid.emit('animation-done');
}
}
//temporarily use as primary the monitor on which the showapps btn was clicked, this is
//restored by the panel when exiting the overview
@@ -1288,34 +1257,20 @@ var taskbar = Utils.defineClass({
let overviewHiddenId = Main.overview.connect('hidden', () => {
Main.overview.disconnect(overviewHiddenId);
delete Main.overview.viewSelector._onStageKeyPress;
delete SearchController._onStageKeyPress;
});
// Finally show the overview
selector._showAppsButton.checked = true;
Main.overview.show();
Main.overview.show(2 /*APP_GRID*/);
}
else {
if (this.forcedOverview) {
// force exiting overview if needed
if (animate) {
// Manually trigger springout animation without activating the
// workspaceView to avoid the zoomout animation. Hide the appPage
// onComplete to avoid ugly flashing of original icons.
let view = Utils.getAppDisplayViews()[visibleView].view;
view.animate(IconGrid.AnimationDirection.OUT, Lang.bind(this, function() {
Main.overview.viewSelector._appsPage.hide();
Main.overview.hide();
selector._showAppsButton.checked = false;
this.forcedOverview = false;
}));
}
else {
Main.overview.hide();
this.forcedOverview = false;
}
}
else {
selector._showAppsButton.checked = false;
this.forcedOverview = false;
@@ -1325,7 +1280,7 @@ var taskbar = Utils.defineClass({
},
_syncShowAppsButtonToggled: function() {
let status = Main.overview.viewSelector._showAppsButton.checked;
let status = SearchController._showAppsButton.checked;
if (this.showAppsButton.checked !== status)
this.showAppsButton.checked = status;
},

View File

@@ -187,9 +187,14 @@ var GlobalSignalsHandler = defineClass({
let object = item[0];
let event = item[1][i];
let callback = item[2]
try {
let id = object.connect(event, callback);
handlers.push([object, id]);
} catch (e)
{
}
}
return handlers;
@@ -304,7 +309,7 @@ var getScaleFactor = function() {
var getAppDisplayViews = function() {
//gnome-shell 3.38 only has one view and it is now the appDisplay
return Main.overview.viewSelector.appDisplay._views || [{ view: Main.overview.viewSelector.appDisplay }];
return imports.ui.appDisplay._views || [{ view: imports.ui.appDisplay }];
};
var findIndex = function(array, predicate) {
@@ -340,7 +345,7 @@ var mergeObjects = function(main, bck) {
};
var hookVfunc = function(proto, symbol, func) {
if (Gi.hook_up_vfunc_symbol) {
if (Gi.hook_up_vfunc_symbol && func) {
//gjs > 1.53.3
proto[Gi.hook_up_vfunc_symbol](symbol, func);
} else {