Codebase list gnome-shell-extension-workspaces-to-dock / 2ed74f3
Update upstream source from tag 'upstream/52' Update to upstream version '52' with Debian dir 4a62a5cc0e0f952af1f98bf77b4266867009232c Raphaƫl Hertzog 4 years ago
11 changed file(s) with 545 addition(s) and 912 deletion(s). Raw diff Collapse all Expand all
281281
282282 Change Log:
283283 -----------
284 **Version 52 (Oct 1, 2019)**
285 - Support for Gnome 3.34
286
284287 **Version 51 (Jul 25, 2019)**
285288 - Bug fixes
286289
5959 cat extension.js | grep -v '_DEBUG_' > "$temp_dir/extension.js"
6060 cat intellihide.js | grep -v '_DEBUG_' > "$temp_dir/intellihide.js"
6161 cat myPressureBarrier.js | grep -v '_DEBUG_' > "$temp_dir/myPressureBarrier.js"
62 cat myWorkspaceSwitcherPopup.js | grep -v '_DEBUG_' > "$temp_dir/myWorkspaceSwitcherPopup.js"
62 cat myWorkspaceSwitcher.js | grep -v '_DEBUG_' > "$temp_dir/myWorkspaceSwitcher.js"
6363 cat myWorkspaceThumbnail.js | grep -v '_DEBUG_' > "$temp_dir/myWorkspaceThumbnail.js"
6464 cat placeDisplay.js | grep -v '_DEBUG_' > "$temp_dir/placeDisplay.js"
6565 cat prefs.js | grep -v '_DEBUG_' > "$temp_dir/prefs.js"
2626 const Main = imports.ui.main;
2727 const WorkspacesView = imports.ui.workspacesView;
2828 const WorkspaceThumbnail = imports.ui.workspaceThumbnail;
29 const Tweener = imports.ui.tweener;
3029 const WorkspaceSwitcherPopup = imports.ui.workspaceSwitcherPopup;
3130 const Overview = imports.ui.overview;
3231 const OverviewControls = imports.ui.overviewControls;
3332 const Layout = imports.ui.layout;
3433 const MessageTray = imports.ui.messageTray;
3534
36 const ExtensionSystem = imports.ui.extensionSystem;
3735 const ExtensionUtils = imports.misc.extensionUtils;
3836 const Config = imports.misc.config;
3937 const Me = ExtensionUtils.getCurrentExtension();
4139 const Convenience = Me.imports.convenience;
4240 const MyWorkspaceThumbnail = Me.imports.myWorkspaceThumbnail;
4341 const ShortcutsPanel = Me.imports.shortcutsPanel;
44 const MyWorkspaceSwitcherPopup = Me.imports.myWorkspaceSwitcherPopup;
42 const MyWorkspaceSwitcher = Me.imports.myWorkspaceSwitcher;
4543 const MyPressureBarrier = Me.imports.myPressureBarrier;
4644
4745 const DashToDock_UUID = "dash-to-dock@micxgx.gmail.com";
104102 return desc;
105103 }
106104
107 var MyThumbnailsSlider = GObject.registerClass(
108 class WorkspacesToDock_MyThumbnailsSlider extends St.Widget {
109 _init(params) {
110 this._settings = Convenience.getSettings('org.gnome.shell.extensions.workspaces-to-dock');
111 let initialTriggerWidth = 1;
112
113 // Default local params
114 let localDefaults = {
115 side: St.Side.LEFT,
116 initialSlideValue: 1,
117 initialSlideoutSize: initialTriggerWidth
118 }
119
120 let localParams = Params.parse(params, localDefaults, true);
121
122 if (params){
123 // Remove local params before passing the params to the parent
124 // constructor to avoid errors.
125 let prop;
126 for (prop in localDefaults) {
127 if ((prop in params))
128 delete params[prop];
129 }
130 }
105 var MyThumbnailsSlider = GObject.registerClass({
106 Properties: {
107 'side': GObject.ParamSpec.enum(
108 'side', 'side', 'side',
109 GObject.ParamFlags.READWRITE | GObject.ParamFlags.CONSTRUCT_ONLY,
110 St.Side, St.Side.RIGHT),
111 'slidex': GObject.ParamSpec.double(
112 'slidex', 'slidex', 'slidex',
113 GObject.ParamFlags.READWRITE | GObject.ParamFlags.CONSTRUCT,
114 0, 1, 1),
115 'slideout-size': GObject.ParamSpec.double(
116 'slideout-size', 'slideout-size', 'slideout-size',
117 GObject.ParamFlags.READWRITE,
118 0, Infinity, 1),
119 'partial-slideout-size': GObject.ParamSpec.double(
120 'partial-slideout-size', 'partial-slideout-size', 'partial-slideout-size',
121 GObject.ParamFlags.READWRITE,
122 0, Infinity, DOCK_EDGE_VISIBLE_OVERVIEW_WIDTH + 1)
123 }
124 }, class WorkspacesToDock_MyThumbnailsSlider extends St.Widget {
125 _init(params = {}) {
126 // slide parameter: 1 = visible, 0 = hidden.
127 this._side = params.side;
128 this._slidex = params.slidex;
129 this._slideoutSize = 1;
130 this._partialSlideoutSize = DOCK_EDGE_VISIBLE_OVERVIEW_WIDTH + 1;
131131
132132 super._init(params);
133133 this._child = null;
134
135 // slide parameter: 1 = visible, 0 = hidden.
136 this._slidex = localParams.initialSlideValue;
137 this._side = localParams.side;
138 this._slideoutSize = localParams.initialSlideoutSize; // minimum size when slid out
139 this._partialSlideoutSize = initialTriggerWidth + DOCK_EDGE_VISIBLE_OVERVIEW_WIDTH;
140134 }
141135
142136 vfunc_allocate(box, flags) {
222216 }
223217
224218 set slidex(value) {
219 if (this._slidex == value)
220 return;
221
225222 this._slidex = value;
226 this._child.queue_relayout();
223 this.notify('slidex');
224 if (this._child)
225 this._child.queue_relayout();
227226 }
228227
229228 get slidex() {
231230 }
232231
233232 set slideoutSize(value) {
233 if (this._slideoutSize == value)
234 return;
235
234236 this._slideoutSize = value;
237 this.notify('slideout-size');
235238 }
236239
237240 get slideoutSize() {
239242 }
240243
241244 set partialSlideoutSize(value) {
245 if (this._partialSlideoutSize == value)
246 return;
247
242248 this._partialSlideoutSize = value;
249 this.notify('partial-slideout-size');
243250 }
244251
245252 get partialSlideoutSize() {
269276
270277 // Set position of dock
271278 this._position = getPosition(this._settings);
279 if (_DEBUG_) global.log("dockedWorkspaces: init POSITION is " + this._position);
272280 this._isHorizontal = (this._position == St.Side.TOP ||
273281 this._position == St.Side.BOTTOM);
274282
310318 this._shortcutsPanel.connect("update-favorite-apps", this._onShortcutsPanelUpdated.bind(this));
311319 this._shortcutsPanel.connect("update-running-apps", this._onShortcutsPanelUpdated.bind(this));
312320
313 // Create custom workspace switcher popup
321 // Create custom workspace switcher
314322 this._workspaceSwitcher = null;
315323 if (this._isHorizontal && this._settings.get_boolean('horizontal-workspace-switching'))
316 this._workspaceSwitcher = new MyWorkspaceSwitcherPopup.WorkspaceSwitcher();
324 this._workspaceSwitcher = new MyWorkspaceSwitcher.WorkspaceSwitcher();
317325
318326 // Create position styles for dock container
319327 let positionStyleClass = ['top', 'right', 'bottom', 'left'];
426434 if (shortcutsPanelOrientation == 1) {
427435 if (this._centerContainer && this._centerPanelsIndependently) {
428436 this._panelsContainer.add(this._shortcutsPanel.actor,{x_fill: false, y_fill: false, x_align: St.Align.MIDDLE, y_align: St.Align.MIDDLE});
429 this._panelsContainer.add(this._thumbnailsBox.actor,{x_fill: false, y_fill: false, x_align: St.Align.MIDDLE, y_align: St.Align.MIDDLE});
437 this._panelsContainer.add(this._thumbnailsBox,{x_fill: false, y_fill: false, x_align: St.Align.MIDDLE, y_align: St.Align.MIDDLE});
430438 } else {
431439 this._panelsContainer.add_actor(this._shortcutsPanel.actor);
432 this._panelsContainer.add_actor(this._thumbnailsBox.actor);
440 this._panelsContainer.add_actor(this._thumbnailsBox);
433441 }
434442 } else {
435443 if (this._centerContainer && this._centerPanelsIndependently) {
436 this._panelsContainer.add(this._thumbnailsBox.actor,{x_fill: false, y_fill: false, x_align: St.Align.MIDDLE, y_align: St.Align.MIDDLE});
444 this._panelsContainer.add(this._thumbnailsBox,{x_fill: false, y_fill: false, x_align: St.Align.MIDDLE, y_align: St.Align.MIDDLE});
437445 this._panelsContainer.add(this._shortcutsPanel.actor,{x_fill: false, y_fill: false, x_align: St.Align.MIDDLE, y_align: St.Align.MIDDLE});
438446 } else {
439 this._panelsContainer.add_actor(this._thumbnailsBox.actor);
447 this._panelsContainer.add_actor(this._thumbnailsBox);
440448 this._panelsContainer.add_actor(this._shortcutsPanel.actor);
441449 }
442450 }
443451
444452 // Create the sliding actor whose allocation is to be tracked for input regions
445 let slideoutSize = this._settings.get_boolean('dock-edge-visible') ? this._triggerWidth + DOCK_EDGE_VISIBLE_WIDTH : this._triggerWidth;
446 this._slider = new MyThumbnailsSlider({side: this._position, initialSlideoutSize: slideoutSize});
453 //let slideoutSize = this._settings.get_boolean('dock-edge-visible') ? this._triggerWidth + DOCK_EDGE_VISIBLE_WIDTH : this._triggerWidth;
454 //this._slider = new MyThumbnailsSlider({side: this._position, slideout-size: slideoutSize});
455 this._slider = new MyThumbnailsSlider({side: this._position});
447456
448457 // Create the dock main actor
449458 this.actor = new St.Bin({ name: 'workspacestodockMainActor',
463472 let workspaceManager = global.workspace_manager;
464473 this._signalHandler.push(
465474 [
466 this._thumbnailsBox.actor,
475 this._thumbnailsBox,
467476 'notify::width',
468477 this._thumbnailsBoxResized.bind(this)
469478 ],
470479 [
471 this._thumbnailsBox.actor,
480 this._thumbnailsBox,
472481 'notify::height',
473482 this._thumbnailsBoxResized.bind(this)
474483 ],
488497 this._onIconsChanged.bind(this)
489498 ],
490499 [
491 ExtensionSystem._signals,
500 Main.extensionManager,
492501 'extension-state-changed',
493502 this._onExtensionSystemStateChanged.bind(this)
494503 ],
521530
522531 // Connect DashToDock hover signal if the extension is already loaded and enabled
523532 this._hoveringDash = false;
524 DashToDockExtension = ExtensionUtils.extensions[DashToDock_UUID];
533 DashToDockExtension = Main.extensionManager.lookup(DashToDock_UUID);
525534 if (DashToDockExtension) {
526 if (DashToDockExtension.state == ExtensionSystem.ExtensionState.ENABLED) {
535 if (DashToDockExtension.state == ExtensionUtils.ExtensionState.ENABLED) {
527536 if (_DEBUG_) global.log("dockeWorkspaces: init - DashToDock extension is installed and enabled");
528537 DashToDock = DashToDockExtension.imports.extension;
529538 if (DashToDock) {
753762 let allocation = this.actor.allocation;
754763 let width = allocation.x2 - allocation.x1;
755764 let height = allocation.y2 - allocation.y1;
765 if (_DEBUG_) global.log("WORKSPACESDISPLAY - ALLOCATION X = "+x+" Y = "+y+" W = "+width+" H = "+height);
756766
757767 let spacing = Main.overview._controls.actor.get_theme_node().get_length('spacing');
758768 let monitors = Main.layoutManager.monitors;
778788
779789 // Iterate through monitors
780790 for (let i = 0; i < monitors.length; i++) {
791 if (_DEBUG_) global.log("WORKSPACESDISPLAY - MONITOR = "+i);
792
781793 let geometry = { x: monitors[i].x, y: monitors[i].y, width: monitors[i].width, height: monitors[i].height };
794 if (_DEBUG_) global.log("WORKSPACESDISPLAY - INIT GEOMETRY.X = "+geometry.x+" Y = "+geometry.y+" W = "+geometry.width+" H = "+geometry.height);
782795
783796 // Adjust index to point to correct dock
784797 // Only needed when using DashToDock.dockManager
937950 // Adjust y and height for workspacesView geometry for primary monitor (top panel, etc.)
938951 if (i == this._primaryIndex) {
939952 geometry.y = y;
940 geometry.height = height;
941 }
953 if (height > 0)
954 geometry.height = height;
955 }
956
957 if (_DEBUG_) global.log("WORKSPACESDISPLAY - INTERMEDIATE GEOMETRY.X = "+geometry.x+" Y = "+geometry.y+" W = "+geometry.width+" H = "+geometry.height);
942958
943959 // What if dash and thumbnailsBox are not on the primary monitor?
944960 let controlsHeight = dashHeight + thumbnailsHeight;
9861002 }
9871003 }
9881004 geometry.height -= controlsHeight;
989
990
991 if (_DEBUG_) global.log("MONITOR = "+i);
1005 if (_DEBUG_) global.log("WORKSPACESDISPLAY - FINAL GEOMETRY.X = "+geometry.x+" Y = "+geometry.y+" W = "+geometry.width+" H = "+geometry.height);
1006
9921007 this._workspacesViews[i].setMyActualGeometry(geometry);
9931008 }
9941009 };
14081423 }
14091424 }
14101425
1426 if (this._dockState == DockState.SHOWING) {
1427 // Prevent dock from getting stuck animated in when mouse is no longer hovering
1428 if (this._checkHoverStatusId > 0) {
1429 Mainloop.source_remove(this._checkHoverStatusId);
1430 this._checkHoverStatusId = 0;
1431 }
1432 this._checkHoverStatusId = Mainloop.timeout_add(100, this._checkHoverStatus.bind(this));
1433 return;
1434 }
1435
14111436 if (this._settings.get_boolean('require-click-to-show')) {
14121437 // check if metaWin is maximized
14131438 let workspaceManager = global.workspace_manager;
16171642
16181643 _onDashToDockBoxDestroy() {
16191644 if (_DEBUG_) global.log("dockedWorkspaces: _onDashToDockBoxDestroy for DASHTODOCK");
1620 this._signalHandler.disconnectWithLabel('DashToDockBoxHoverSignal');
1645 this._hoveringDash = false;
1646 this._disconnectDashToDockSignals();
1647
1648 // Restore dock if still enabled
1649 if (this._checkDashToDockStatusId > 0) {
1650 Mainloop.source_remove(this._checkDashToDockStatusId);
1651 this._checkDashToDockStatusId = 0;
1652 }
1653 this._checkDashToDockStatusId = Mainloop.timeout_add(500, this._checkDashToDockStatus.bind(this));
1654 }
1655
1656 _checkDashToDockStatus() {
1657 if (DashToDock)
1658 this._connectDashToDockSignals();
1659
1660 this._checkDashToDockStatusId = 0;
16211661 }
16221662
16231663 _disconnectDashToDockSignals() {
16691709 ]
16701710 );
16711711 }
1672 } else {
1673 this._signalHandler.pushWithLabel(
1674 'DashToDockHoverSignal',
1675 [
1676 DashToDock.dock._box,
1677 'notify::hover',
1678 this._onDashToDockHoverChanged.bind(this)
1679 ],
1680 [
1681 DashToDock.dock._box,
1682 'leave-event',
1683 this._onDashToDockLeave.bind(this)
1684 ],
1685 [
1686 DashToDock.dock,
1687 'showing',
1688 this._onDashToDockShowing.bind(this)
1689 ],
1690 [
1691 DashToDock.dock,
1692 'hiding',
1693 this._onDashToDockHiding.bind(this)
1694 ]
1695 );
16961712 }
16971713 }
16981714 }
17031719 if (extension.uuid == DashToDock_UUID) {
17041720 if (_DEBUG_) global.log("dockedWorkspaces: _onExtensionSystemStateChanged for "+extension.uuid+" state= "+extension.state);
17051721 DashToDockExtension = extension;
1706 if (DashToDockExtension.state == ExtensionSystem.ExtensionState.ENABLED) {
1722 if (DashToDockExtension.state == ExtensionUtils.ExtensionState.ENABLED) {
17071723 DashToDock = DashToDockExtension.imports.extension;
17081724 if (DashToDock) {
17091725 DashToDockExtension.hasDockPositionKey = false;
17171733 }
17181734 this._connectDashToDockSignals();
17191735 }
1720 } else if (extension.state == ExtensionSystem.ExtensionState.DISABLED || extension.state == ExtensionSystem.ExtensionState.UNINSTALLED) {
1736 } else if (extension.state == ExtensionUtils.ExtensionState.DISABLED || extension.state == ExtensionUtils.ExtensionState.UNINSTALLED) {
17211737 DashToDock = null;
17221738 this._hoveringDash = false;
17231739 this._disconnectDashToDockSignals();
17871803 let ws = activeWs.get_neighbor(direction);
17881804
17891805 if (Main.wm._workspaceSwitcherPopup == null) {
1790 if (this._isHorizontal && this._settings.get_boolean('horizontal-workspace-switching')) {
1791 Main.wm._workspaceSwitcherPopup = new MyWorkspaceSwitcherPopup.MyWorkspaceSwitcherPopup();
1792 } else {
1793 Main.wm._workspaceSwitcherPopup = new WorkspaceSwitcherPopup.WorkspaceSwitcherPopup();
1794 }
1806 Main.wm._workspaceSwitcherPopup = new WorkspaceSwitcherPopup.WorkspaceSwitcherPopup();
17951807 }
17961808
17971809 // Set the workspaceSwitcherPopup actor to non reactive,
17981810 // to prevent it from grabbing focus away from the dock
1799 Main.wm._workspaceSwitcherPopup.actor.reactive = false;
1811 Main.wm._workspaceSwitcherPopup.reactive = false;
18001812 Main.wm._workspaceSwitcherPopup.connect('destroy', function() {
18011813 Main.wm._workspaceSwitcherPopup = null;
18021814 });
19151927 this._dockState = DockState.SHOWING;
19161928 }
19171929
1918 Tweener.addTween(this._slider, {
1919 slidex: sliderVariable,
1920 time: time,
1921 delay: delay,
1922 transition: 'easeOutQuad',
1930 if (_DEBUG_) global.log("... animateIN: BEGIN SLIDING. Set dockstate = "+getDockStateDesc(this._dockState));
1931 this._slider.ease_property('slidex', sliderVariable, {
1932 duration: time * 1000,
1933 delay: delay * 1000,
1934 mode: Clutter.AnimationMode.EASE_OUT_QUAD,
19231935 onComplete: () => {
19241936 if (_DEBUG_) global.log("dockedWorkspaces: _animateIN onComplete");
19251937 if (!force && !fixedPosition) {
19992011 }
20002012 }
20012013
2002 Tweener.addTween(this._slider, {
2003 slidex: sliderVariable,
2004 time: time,
2005 delay: delay,
2006 transition: 'easeOutQuad',
2014 this._slider.ease_property('slidex', sliderVariable, {
2015 duration: time * 1000,
2016 delay: delay * 1000,
2017 mode: Clutter.AnimationMode.EASE_OUT_QUAD,
20072018 onComplete: () => {
20082019 if (_DEBUG_) global.log("dockedWorkspaces: _animateOUT onComplete");
20092020 this._dockState = DockState.HIDDEN;
20152026 // autohide function to remove show-hide animations
20162027 _removeAnimations() {
20172028 if (_DEBUG_) global.log("dockedWorkspaces: _removeAnimations");
2018 Tweener.removeTweens(this._slider);
2029 this._slider.remove_all_transitions();
20192030 }
20202031
20212032 // autohide function to fade out opaque background
20222033 _fadeOutBackground(time, delay) {
20232034 if (_DEBUG_) global.log("dockedWorkspaces: _fadeOutBackground");
20242035 // CSS time is in ms
2025 this._thumbnailsBox.actor.set_style('transition-duration:' + time*1000 + ';' +
2036 this._thumbnailsBox.set_style('transition-duration:' + time*1000 + ';' +
20262037 'transition-delay:' + delay*1000 + ';' +
20272038 'background-color: rgba(0,0,0,0);' +
20282039 'border-color:' + this._defaultBorder);
20422053 _fadeInBackground(time, delay) {
20432054 if (_DEBUG_) global.log("dockedWorkspaces: _fadeInBackground");
20442055 // CSS time is in ms
2045 this._thumbnailsBox.actor.set_style('transition-duration:' + time*1000 + ';' +
2056 this._thumbnailsBox.set_style('transition-duration:' + time*1000 + ';' +
20462057 'transition-delay:' + delay*1000 + ';' +
20472058 'background-color: rgba(0,0,0,0);' +
20482059 'border-color:' + this._customBorder);
20722083 // Fixed dock has opacity set to 0 but is still reactive.
20732084 this._dock.reactive = false;
20742085 this._shortcutsPanel.setReactiveState(false);
2075 this._thumbnailsBox.actor.reactive = false;
2086 this._thumbnailsBox.reactive = false;
20762087 for (let i = 0; i < this._thumbnailsBox._thumbnails.length; i++) {
20772088 let thumbnail = this._thumbnailsBox._thumbnails[i];
20782089 thumbnail.setCaptionReactiveState(false);
20892100 // Return thumbnail windowclones to reactive state
20902101 this._dock.reactive = true;
20912102 this._shortcutsPanel.setReactiveState(true);
2092 this._thumbnailsBox.actor.reactive = true;
2103 this._thumbnailsBox.reactive = true;
20932104 for (let i = 0; i < this._thumbnailsBox._thumbnails.length; i++) {
20942105 let thumbnail = this._thumbnailsBox._thumbnails[i];
20952106 thumbnail.setCaptionReactiveState(true);
21062117 _getBackgroundColor() {
21072118 if (_DEBUG_) global.log("dockedWorkspaces: _getBackgroundColor");
21082119 // Remove custom style
2109 let oldStyle = this._thumbnailsBox.actor.get_style();
2110 this._thumbnailsBox.actor.set_style(null);
2120 let oldStyle = this._thumbnailsBox.get_style();
2121 this._thumbnailsBox.set_style(null);
21112122
21122123 // Prevent shell crash if the actor is not on the stage
21132124 // It happens enabling/disabling repeatedly the extension
2114 if (!this._thumbnailsBox.actor.get_stage())
2125 if (!this._thumbnailsBox.get_stage())
21152126 return null;
21162127
2117 let themeNode = this._thumbnailsBox.actor.get_theme_node();
2118 this._thumbnailsBox.actor.set_style(oldStyle);
2128 let themeNode = this._thumbnailsBox.get_theme_node();
2129 this._thumbnailsBox.set_style(oldStyle);
21192130
21202131 // Just in case the theme has different border colors ..
21212132 // We want to find the inside border-color of the dock because it is
23782389
23792390 } else {
23802391 let controlsTop = 45;
2381 y = this._monitor.y + Main.panel.actor.height + controlsTop + Main.overview._searchEntryBin.height;
2392 y = this._monitor.y + Main.panel.height + controlsTop + Main.overview._searchEntryBin.height;
23822393 height = this._monitor.height - (y + Main.overview._searchEntryBin.height);
23832394 }
23842395 }
23992410 // allows us to control the trigger space for showing/hiding and scrolling
24002411 if (this._isHorizontal) {
24012412 if (this._settings.get_boolean('customize-height')) {
2402 let [minThumbnailsBoxWidth, minThumbnailsBoxHeight, natThumbnailsBoxWidth, natThumbnailsBoxHeight] = this._thumbnailsBox.actor.get_preferred_size();
2413 let [minThumbnailsBoxWidth, minThumbnailsBoxHeight, natThumbnailsBoxWidth, natThumbnailsBoxHeight] = this._thumbnailsBox.get_preferred_size();
24032414 let minShortcutsPanelWidth = 0, minShortcutsPanelHeight = 0, natShortcutsPanelWidth = 0, natShortcutsPanelHeight = 0;
24042415 if (this._settings.get_boolean('show-shortcuts-panel')) {
24052416 [minShortcutsPanelWidth, minShortcutsPanelHeight, natShortcutsPanelWidth, natShortcutsPanelHeight] = this._shortcutsPanel.actor.get_preferred_size();
24342445 }
24352446 } else {
24362447 if (this._settings.get_boolean('customize-height')) {
2437 let [minThumbnailsBoxWidth, minThumbnailsBoxHeight, natThumbnailsBoxWidth, natThumbnailsBoxHeight] = this._thumbnailsBox.actor.get_preferred_size();
2448 let [minThumbnailsBoxWidth, minThumbnailsBoxHeight, natThumbnailsBoxWidth, natThumbnailsBoxHeight] = this._thumbnailsBox.get_preferred_size();
24382449 let minShortcutsPanelWidth = 0, minShortcutsPanelHeight = 0, natShortcutsPanelWidth = 0, natShortcutsPanelHeight = 0;
24392450 if (this._settings.get_boolean('show-shortcuts-panel')) {
24402451 [minShortcutsPanelWidth, minShortcutsPanelHeight, natShortcutsPanelWidth, natShortcutsPanelHeight] = this._shortcutsPanel.actor.get_preferred_size();
24922503 if (this._settings.get_boolean('customize-thumbnail-visible-width')) {
24932504 slidePartialVisibleWidth = this._settings.get_double('thumbnail-visible-width');
24942505 } else {
2495 let themeVisibleWidth = this._thumbnailsBox.actor.get_theme_node().get_length('visible-width');
2506 let themeVisibleWidth = this._thumbnailsBox.get_theme_node().get_length('visible-width');
24962507 if (themeVisibleWidth > 0)
24972508 slidePartialVisibleWidth = themeVisibleWidth;
24982509 }
11 "name": "Workspaces to Dock",
22 "description": "Transform Gnome Shell's overview workspaces into an intelligent dock.",
33 "original-author": "passingthru67@gmail.com",
4 "shell-version": ["3.32"],
4 "shell-version": ["3.34"],
55 "url": "https://github.com/passingthru67/workspaces-to-dock",
66 "uuid": "workspaces-to-dock@passingthru67.gmail.com",
77 "gettext-domain": "workspacestodock",
8 "version": 51
8 "version": 52
99 }
0 /* ========================================================================================================
1 * dockedWorkspaces.js - dock object that holds the workspaces thumbnailsBox
2 * --------------------------------------------------------------------------------------------------------
3 * CREDITS: This code was copied from the Frippery Bottom Panel extension http://frippery.org/extensions/
4 * and modified to create a workspaces switcher popup. Copyright (C) 2011-2015 R M Yorston.
5 *
6 * Part of this code also comes from gnome-shell-extensions:
7 * http://git.gnome.org/browse/gnome-shell-extensions/
8 * ========================================================================================================
9 */
10
11 const _DEBUG_ = false;
12
13 const { Clutter, GLib, GObject, Meta, St, Shell } = imports.gi;
14 const Lang = imports.lang;
15 const Mainloop = imports.mainloop;
16
17 const Main = imports.ui.main;
18 const WorkspacesView = imports.ui.workspacesView;
19 const WindowManager = imports.ui.windowManager;
20 const Tweener = imports.ui.tweener;
21
22 const Me = imports.misc.extensionUtils.getCurrentExtension();
23 const Convenience = Me.imports.convenience;
24
25 let nrows = 1;
26
27 var WorkspaceSwitcher = class WorkspacesToDock_WorkspaceSwitcher {
28 constructor(params) {
29 this._resetBindings();
30 global.workspace_manager.override_workspace_layout(Meta.DisplayCorner.TOPLEFT, false, nrows, -1);
31 }
32
33 destroy() {
34 this._resetBindings();
35 global.workspace_manager.override_workspace_layout(Meta.DisplayCorner.TOPLEFT, false, -1, 1);
36 }
37
38 _resetBindings() {
39 // Reset bindings to active showWorkspaceSwitcher function
40 let wm = Main.wm;
41
42 wm.setCustomKeybindingHandler('switch-to-workspace-left',
43 Shell.ActionMode.NORMAL |
44 Shell.ActionMode.OVERVIEW,
45 wm._showWorkspaceSwitcher.bind(wm));
46 wm.setCustomKeybindingHandler('switch-to-workspace-right',
47 Shell.ActionMode.NORMAL |
48 Shell.ActionMode.OVERVIEW,
49 wm._showWorkspaceSwitcher.bind(wm));
50 wm.setCustomKeybindingHandler('switch-to-workspace-up',
51 Shell.ActionMode.NORMAL |
52 Shell.ActionMode.OVERVIEW,
53 wm._showWorkspaceSwitcher.bind(wm));
54 wm.setCustomKeybindingHandler('switch-to-workspace-down',
55 Shell.ActionMode.NORMAL |
56 Shell.ActionMode.OVERVIEW,
57 wm._showWorkspaceSwitcher.bind(wm));
58 wm.setCustomKeybindingHandler('switch-to-workspace-last',
59 Shell.ActionMode.NORMAL |
60 Shell.ActionMode.OVERVIEW,
61 wm._showWorkspaceSwitcher.bind(wm));
62 wm.setCustomKeybindingHandler('move-to-workspace-left',
63 Shell.ActionMode.NORMAL |
64 Shell.ActionMode.OVERVIEW,
65 wm._showWorkspaceSwitcher.bind(wm));
66 wm.setCustomKeybindingHandler('move-to-workspace-right',
67 Shell.ActionMode.NORMAL |
68 Shell.ActionMode.OVERVIEW,
69 wm._showWorkspaceSwitcher.bind(wm));
70 wm.setCustomKeybindingHandler('move-to-workspace-up',
71 Shell.ActionMode.NORMAL |
72 Shell.ActionMode.OVERVIEW,
73 wm._showWorkspaceSwitcher.bind(wm));
74 wm.setCustomKeybindingHandler('move-to-workspace-down',
75 Shell.ActionMode.NORMAL |
76 Shell.ActionMode.OVERVIEW,
77 wm._showWorkspaceSwitcher.bind(wm));
78 wm.setCustomKeybindingHandler('switch-to-workspace-1',
79 Shell.ActionMode.NORMAL |
80 Shell.ActionMode.OVERVIEW,
81 wm._showWorkspaceSwitcher.bind(wm));
82 wm.setCustomKeybindingHandler('switch-to-workspace-2',
83 Shell.ActionMode.NORMAL |
84 Shell.ActionMode.OVERVIEW,
85 wm._showWorkspaceSwitcher.bind(wm));
86 wm.setCustomKeybindingHandler('switch-to-workspace-3',
87 Shell.ActionMode.NORMAL |
88 Shell.ActionMode.OVERVIEW,
89 wm._showWorkspaceSwitcher.bind(wm));
90 wm.setCustomKeybindingHandler('switch-to-workspace-4',
91 Shell.ActionMode.NORMAL |
92 Shell.ActionMode.OVERVIEW,
93 wm._showWorkspaceSwitcher.bind(wm));
94 wm.setCustomKeybindingHandler('switch-to-workspace-5',
95 Shell.ActionMode.NORMAL |
96 Shell.ActionMode.OVERVIEW,
97 wm._showWorkspaceSwitcher.bind(wm));
98 wm.setCustomKeybindingHandler('switch-to-workspace-6',
99 Shell.ActionMode.NORMAL |
100 Shell.ActionMode.OVERVIEW,
101 wm._showWorkspaceSwitcher.bind(wm));
102 wm.setCustomKeybindingHandler('switch-to-workspace-7',
103 Shell.ActionMode.NORMAL |
104 Shell.ActionMode.OVERVIEW,
105 wm._showWorkspaceSwitcher.bind(wm));
106 wm.setCustomKeybindingHandler('switch-to-workspace-8',
107 Shell.ActionMode.NORMAL |
108 Shell.ActionMode.OVERVIEW,
109 wm._showWorkspaceSwitcher.bind(wm));
110 wm.setCustomKeybindingHandler('switch-to-workspace-9',
111 Shell.ActionMode.NORMAL |
112 Shell.ActionMode.OVERVIEW,
113 wm._showWorkspaceSwitcher.bind(wm));
114 wm.setCustomKeybindingHandler('switch-to-workspace-10',
115 Shell.ActionMode.NORMAL |
116 Shell.ActionMode.OVERVIEW,
117 wm._showWorkspaceSwitcher.bind(wm));
118 wm.setCustomKeybindingHandler('switch-to-workspace-11',
119 Shell.ActionMode.NORMAL |
120 Shell.ActionMode.OVERVIEW,
121 wm._showWorkspaceSwitcher.bind(wm));
122 wm.setCustomKeybindingHandler('switch-to-workspace-12',
123 Shell.ActionMode.NORMAL |
124 Shell.ActionMode.OVERVIEW,
125 wm._showWorkspaceSwitcher.bind(wm));
126 wm.setCustomKeybindingHandler('move-to-workspace-1',
127 Shell.ActionMode.NORMAL,
128 wm._showWorkspaceSwitcher.bind(wm));
129 wm.setCustomKeybindingHandler('move-to-workspace-2',
130 Shell.ActionMode.NORMAL,
131 wm._showWorkspaceSwitcher.bind(wm));
132 wm.setCustomKeybindingHandler('move-to-workspace-3',
133 Shell.ActionMode.NORMAL,
134 wm._showWorkspaceSwitcher.bind(wm));
135 wm.setCustomKeybindingHandler('move-to-workspace-4',
136 Shell.ActionMode.NORMAL,
137 wm._showWorkspaceSwitcher.bind(wm));
138 wm.setCustomKeybindingHandler('move-to-workspace-5',
139 Shell.ActionMode.NORMAL,
140 wm._showWorkspaceSwitcher.bind(wm));
141 wm.setCustomKeybindingHandler('move-to-workspace-6',
142 Shell.ActionMode.NORMAL,
143 wm._showWorkspaceSwitcher.bind(wm));
144 wm.setCustomKeybindingHandler('move-to-workspace-7',
145 Shell.ActionMode.NORMAL,
146 wm._showWorkspaceSwitcher.bind(wm));
147 wm.setCustomKeybindingHandler('move-to-workspace-8',
148 Shell.ActionMode.NORMAL,
149 wm._showWorkspaceSwitcher.bind(wm));
150 wm.setCustomKeybindingHandler('move-to-workspace-9',
151 Shell.ActionMode.NORMAL,
152 wm._showWorkspaceSwitcher.bind(wm));
153 wm.setCustomKeybindingHandler('move-to-workspace-10',
154 Shell.ActionMode.NORMAL,
155 wm._showWorkspaceSwitcher.bind(wm));
156 wm.setCustomKeybindingHandler('move-to-workspace-11',
157 Shell.ActionMode.NORMAL,
158 wm._showWorkspaceSwitcher.bind(wm));
159 wm.setCustomKeybindingHandler('move-to-workspace-12',
160 Shell.ActionMode.NORMAL,
161 wm._showWorkspaceSwitcher.bind(wm));
162 wm.setCustomKeybindingHandler('move-to-workspace-last',
163 Shell.ActionMode.NORMAL,
164 wm._showWorkspaceSwitcher.bind(wm));
165
166 wm._workspaceSwitcherPopup = null;
167 }
168 };
+0
-571
workspaces-to-dock@passingthru67.gmail.com/myWorkspaceSwitcherPopup.js less more
0 /* ========================================================================================================
1 * dockedWorkspaces.js - dock object that holds the workspaces thumbnailsBox
2 * --------------------------------------------------------------------------------------------------------
3 * CREDITS: This code was copied from the Frippery Bottom Panel extension http://frippery.org/extensions/
4 * and modified to create a workspaces switcher popup. Copyright (C) 2011-2015 R M Yorston.
5 *
6 * Part of this code also comes from gnome-shell-extensions:
7 * http://git.gnome.org/browse/gnome-shell-extensions/
8 * ========================================================================================================
9 */
10
11 const _DEBUG_ = false;
12
13 const { Clutter, GLib, GObject, Meta, St, Shell } = imports.gi;
14 const Lang = imports.lang;
15 const Mainloop = imports.mainloop;
16
17 const Main = imports.ui.main;
18 const WorkspacesView = imports.ui.workspacesView;
19 const WindowManager = imports.ui.windowManager;
20 const Tweener = imports.ui.tweener;
21
22 const Me = imports.misc.extensionUtils.getCurrentExtension();
23 const Convenience = Me.imports.convenience;
24
25 var ANIMATION_TIME = 0.1;
26 var DISPLAY_TIMEOUT = 600;
27
28 let GSFunctions = {};
29 let nrows = 1;
30
31 function get_ncols() {
32 let workspaceManager = global.workspace_manager;
33 let ncols = Math.floor(workspaceManager.n_workspaces/nrows);
34 if ( workspaceManager.n_workspaces%nrows != 0 )
35 ++ncols
36
37 return ncols;
38 }
39
40 var MyWorkspaceSwitcherPopupList = GObject.registerClass(
41 class WorkspacesToDock_MyWorkspaceSwitcherPopupList extends St.Widget {
42 _init() {
43 super._init({ style_class: 'workspace-switcher' });
44
45 this._itemSpacing = 0;
46 this._childHeight = 0;
47 this._childWidth = 0;
48
49 this.connect('style-changed', () => {
50 this._itemSpacing = this.get_theme_node().get_length('spacing');
51 });
52 }
53
54 // vfunc_get_preferred_height(forWidth) {
55 // let workArea = Main.layoutManager.getWorkAreaForMonitor(Main.layoutManager.primaryIndex);
56 // let themeNode = this.get_theme_node();
57 //
58 // let availHeight = workArea.height;
59 // availHeight -= themeNode.get_vertical_padding();
60 //
61 // let height = 0;
62 // for (let child of this.get_children()) {
63 // let [childMinHeight, childNaturalHeight] = child.get_preferred_height(-1);
64 // let [childMinWidth, childNaturalWidth] = child.get_preferred_width(childNaturalHeight);
65 // height += childNaturalHeight * workArea.width / workArea.height;
66 // }
67 //
68 // let workspaceManager = global.workspace_manager;
69 // let spacing = this._itemSpacing * (workspaceManager.n_workspaces - 1);
70 // height += spacing;
71 // height = Math.min(height, availHeight);
72 //
73 // this._childHeight = (height - spacing) / workspaceManager.n_workspaces;
74 //
75 // return themeNode.adjust_preferred_height(height, height);
76 // }
77 //
78 // vfunc_get_preferred_width(forHeight) {
79 // let workArea = Main.layoutManager.getWorkAreaForMonitor(Main.layoutManager.primaryIndex);
80 // this._childWidth = Math.round(this._childHeight * workArea.width / workArea.height);
81 //
82 // return [this._childWidth, this._childWidth];
83 // }
84
85 vfunc_get_preferred_width(forHeight) {
86 let workArea = Main.layoutManager.getWorkAreaForMonitor(Main.layoutManager.primaryIndex);
87 let themeNode = this.get_theme_node();
88
89 let availWidth = workArea.width;
90 availWidth -= themeNode.get_horizontal_padding();
91
92 let width = 0;
93 for (let child of this.get_children()) {
94 let [childMinHeight, childNaturalHeight] = child.get_preferred_height(-1);
95 let [childMinWidth, childNaturalWidth] = child.get_preferred_width(childNaturalHeight);
96 width += childNaturalHeight * workArea.width / workArea.height;
97 }
98
99 let workspaceManager = global.workspace_manager;
100 let spacing = this._itemSpacing * (workspaceManager.n_workspaces - 1);
101 width += spacing;
102 width = Math.min(width, availWidth);
103
104 this._childWidth = (width - spacing) / workspaceManager.n_workspaces;
105
106 return themeNode.adjust_preferred_height(width, width);
107 }
108
109 vfunc_get_preferred_height(forWidth) {
110 let workArea = Main.layoutManager.getWorkAreaForMonitor(Main.layoutManager.primaryIndex);
111 this._childHeight = Math.round(this._childWidth * workArea.height / workArea.width);
112
113 return [this._childHeight, this._childHeight];
114 }
115
116 vfunc_allocate(box, flags) {
117 this.set_allocation(box, flags);
118
119 let themeNode = this.get_theme_node();
120 box = themeNode.get_content_box(box);
121
122 let childBox = new Clutter.ActorBox();
123
124 // let y = box.y1;
125 // let prevChildBoxY2 = box.y1 - this._itemSpacing;
126 // for (let child of this.get_children()) {
127 // childBox.x1 = box.x1;
128 // childBox.x2 = box.x1 + this._childWidth;
129 // childBox.y1 = prevChildBoxY2 + this._itemSpacing;
130 // childBox.y2 = Math.round(y + this._childHeight);
131 // y += this._childHeight + this._itemSpacing;
132 // prevChildBoxY2 = childBox.y2;
133 // child.allocate(childBox, flags);
134 // }
135 let x = box.x1;
136 let prevChildBoxX2 = box.x1 - this._itemSpacing;
137 for (let child of this.get_children()) {
138 childBox.y1 = box.y1;
139 childBox.y2 = box.y1 + this._childHeight;
140 childBox.x1 = prevChildBoxX2 + this._itemSpacing;
141 childBox.x2 = Math.round(x + this._childWidth);
142 x += this._childWidth + this._itemSpacing;
143 prevChildBoxX2 = childBox.x2;
144 child.allocate(childBox, flags);
145 }
146 }
147 });
148
149 var MyWorkspaceSwitcherPopup = GObject.registerClass(
150 class WorkspacesToDock_MyWorkspaceSwitcherPopup extends St.Widget {
151 _init() {
152 super._init({ x: 0,
153 y: 0,
154 width: global.screen_width,
155 height: global.screen_height,
156 style_class: 'workspace-switcher-group' });
157
158 this.actor = this;
159
160 Main.uiGroup.add_actor(this);
161
162 this._timeoutId = 0;
163
164 this._container = new St.BoxLayout({ style_class: 'workspace-switcher-container' });
165 this.add_child(this._container);
166
167 this._list = new MyWorkspaceSwitcherPopupList();
168 this._container.add_child(this._list);
169
170 this._redisplay();
171
172 this.hide();
173
174 let workspaceManager = global.workspace_manager;
175 this._workspaceManagerSignals = [];
176 this._workspaceManagerSignals.push(workspaceManager.connect('workspace-added',
177 this._redisplay.bind(this)));
178 this._workspaceManagerSignals.push(workspaceManager.connect('workspace-removed',
179 this._redisplay.bind(this)));
180
181 this.connect('destroy', this._onDestroy.bind(this));
182
183 this._settings = Convenience.getSettings('org.gnome.shell.extensions.workspaces-to-dock');
184 }
185
186 _redisplay() {
187 let workspaceManager = global.workspace_manager;
188
189 this._list.destroy_all_children();
190
191 for (let i = 0; i < workspaceManager.n_workspaces; i++) {
192 let indicator = null;
193
194 if (i == this._activeWorkspaceIndex && this._direction == Meta.MotionDirection.LEFT)
195 indicator = new St.Bin({ style_class: 'ws-switcher-active-up' });
196 else if(i == this._activeWorkspaceIndex && this._direction == Meta.MotionDirection.RIGHT)
197 indicator = new St.Bin({ style_class: 'ws-switcher-active-down' });
198 else if (i == this._activeWorkspaceIndex && this._direction == Meta.MotionDirection.UP)
199 indicator = new St.Bin({ style_class: 'ws-switcher-active-up' });
200 else if(i == this._activeWorkspaceIndex && this._direction == Meta.MotionDirection.DOWN)
201 indicator = new St.Bin({ style_class: 'ws-switcher-active-down' });
202 else
203 indicator = new St.Bin({ style_class: 'ws-switcher-box' });
204
205 this._list.add_actor(indicator);
206
207 }
208
209 let workArea = Main.layoutManager.getWorkAreaForMonitor(Main.layoutManager.primaryIndex);
210 let [containerMinHeight, containerNatHeight] = this._container.get_preferred_height(global.screen_width);
211 let [containerMinWidth, containerNatWidth] = this._container.get_preferred_width(containerNatHeight);
212 this._container.x = workArea.x + Math.floor((workArea.width - containerNatWidth) / 2);
213 this._container.y = workArea.y + Math.floor((workArea.height - containerNatHeight) / 2);
214 }
215
216 _show() {
217 if (this._settings.get_boolean('hide-workspace-switcher-popup'))
218 return;
219
220 Tweener.addTween(this._container, { opacity: 255,
221 time: ANIMATION_TIME,
222 transition: 'easeOutQuad'
223 });
224 this.actor.show();
225 }
226
227 display(direction, activeWorkspaceIndex) {
228 this._direction = direction;
229 this._activeWorkspaceIndex = activeWorkspaceIndex;
230
231 this._redisplay();
232 if (this._timeoutId != 0)
233 Mainloop.source_remove(this._timeoutId);
234 this._timeoutId = Mainloop.timeout_add(DISPLAY_TIMEOUT, this._onTimeout.bind(this));
235 GLib.Source.set_name_by_id(this._timeoutId, '[gnome-shell] this._onTimeout');
236 this._show();
237 }
238
239 _onTimeout() {
240 Mainloop.source_remove(this._timeoutId);
241 this._timeoutId = 0;
242 Tweener.addTween(this._container, { opacity: 0.0,
243 time: ANIMATION_TIME,
244 transition: 'easeOutQuad',
245 onComplete() { this.destroy(); },
246 onCompleteScope: this
247 });
248 return GLib.SOURCE_REMOVE;
249 }
250
251 _onDestroy() {
252 // Disconnect GSettings signals
253 this._settings.run_dispose();
254
255 if (this._timeoutId)
256 Mainloop.source_remove(this._timeoutId);
257 this._timeoutId = 0;
258
259 let workspaceManager = global.workspace_manager;
260 for (let i = 0; i < this._workspaceManagerSignals.length; i++)
261 workspaceManager.disconnect(this._workspaceManagerSignals[i]);
262
263 this._workspaceManagerSignals = [];
264 }
265 });
266
267 var WorkspaceSwitcher = class WorkspacesToDock_WorkspaceSwitcher {
268 constructor(params) {
269 // Override Gnome Shell functions
270 this._overrideGnomeShellFunctions();
271 this._resetBindings();
272
273 global.workspace_manager.override_workspace_layout(Meta.DisplayCorner.TOPLEFT, false, nrows, -1);
274 }
275
276 destroy() {
277 // Restor Gnome Shell functions
278 this._restoreGnomeShellFunctions();
279 this._resetBindings();
280
281 global.workspace_manager.override_workspace_layout(Meta.DisplayCorner.TOPLEFT, false, -1, 1);
282 }
283
284 _overrideGnomeShellFunctions() {
285 // Override showWorkspacesSwitcher to show custom horizontal workspace switcher popup
286 GSFunctions['WindowManager_showWorkspaceSwitcher'] = WindowManager.WindowManager.prototype._showWorkspaceSwitcher;
287 WindowManager.WindowManager.prototype._showWorkspaceSwitcher = function(display, window, binding) {
288 let workspaceManager = display.get_workspace_manager();
289
290 if (!Main.sessionMode.hasWorkspaces)
291 return;
292
293 if (workspaceManager.n_workspaces == 1)
294 return;
295
296 let [action,,,target] = binding.get_name().split('-');
297 let newWs;
298 let direction;
299
300 if (action == 'move') {
301 // "Moving" a window to another workspace doesn't make sense when
302 // it cannot be unstuck, and is potentially confusing if a new
303 // workspaces is added at the start/end
304 if (window.is_always_on_all_workspaces() ||
305 (Meta.prefs_get_workspaces_only_on_primary() &&
306 window.get_monitor() != Main.layoutManager.primaryIndex))
307 return;
308 }
309
310 if (target == 'last') {
311 direction = Meta.MotionDirection.RIGHT;
312 newWs = workspaceManager.get_workspace_by_index(workspaceManager.n_workspaces - 1);
313 } else if (isNaN(target)) {
314 // Prepend a new workspace dynamically
315 if (workspaceManager.get_active_workspace_index() == 0 &&
316 action == 'move' && target == 'left' && this._isWorkspacePrepended == false) {
317 this.insertWorkspace(0);
318 this._isWorkspacePrepended = true;
319 }
320
321 direction = Meta.MotionDirection[target.toUpperCase()];
322 newWs = workspaceManager.get_active_workspace().get_neighbor(direction);
323 } else if (target > 0) {
324 target--;
325 newWs = workspaceManager.get_workspace_by_index(target);
326
327 if (workspaceManager.get_active_workspace().index() > target)
328 direction = Meta.MotionDirection.LEFT;
329 else
330 direction = Meta.MotionDirection.RIGHT;
331 }
332
333 if (direction != Meta.MotionDirection.LEFT &&
334 direction != Meta.MotionDirection.RIGHT)
335 return;
336
337 if (action == 'switch')
338 this.actionMoveWorkspace(newWs);
339 else
340 this.actionMoveWindow(window, newWs);
341
342 if (!Main.overview.visible) {
343 if (this._workspaceSwitcherPopup == null) {
344 this._workspaceSwitcherPopup = new MyWorkspaceSwitcherPopup();
345 this._workspaceSwitcherPopup.connect('destroy', () => {
346 this._workspaceTracker.unblockUpdates();
347 this._workspaceSwitcherPopup = null;
348 this._isWorkspacePrepended = false;
349 });
350 }
351 this._workspaceSwitcherPopup.display(direction, newWs.index());
352 }
353 };
354
355 // Override updateWorkspaceActors for horizontal animation of overview windows
356 GSFunctions['WorkspacesView_updateWorkspaceActors'] = WorkspacesView.WorkspacesView.prototype._updateWorkspaceActors;
357 WorkspacesView.WorkspacesView.prototype._updateWorkspaceActors = function(showAnimation) {
358 let workspaceManager = global.workspace_manager;
359 let active = workspaceManager.get_active_workspace_index();
360
361 this._animating = showAnimation;
362
363 for (let w = 0; w < this._workspaces.length; w++) {
364 let workspace = this._workspaces[w];
365
366 Tweener.removeTweens(workspace.actor);
367
368 let x = (w - active) * this._fullGeometry.width;
369
370 if (showAnimation) {
371 let params = { x: x,
372 time: WorkspacesView.WORKSPACE_SWITCH_TIME,
373 transition: 'easeOutQuad'
374 };
375 // we have to call _updateVisibility() once before the
376 // animation and once afterwards - it does not really
377 // matter which tween we use, so we pick the first one ...
378 if (w == 0) {
379 this._updateVisibility();
380 params.onComplete = () => {
381 this._animating = false;
382 this._updateVisibility();
383 };
384 }
385 Tweener.addTween(workspace.actor, params);
386 } else {
387 workspace.actor.set_position(x, 0);
388 if (w == 0)
389 this._updateVisibility();
390 }
391 }
392 };
393
394 // Override overview scroll event for horizontal scrolling of workspaces
395 GSFunctions['WorkspacesDisplay_onScrollEvent'] = WorkspacesView.WorkspacesDisplay.prototype._onScrollEvent;
396 WorkspacesView.WorkspacesDisplay.prototype._onScrollEvent = function(actor, event) {
397 if (!this.actor.mapped)
398 return Clutter.EVENT_PROPAGATE;
399
400 if (this._workspacesOnlyOnPrimary &&
401 this._getMonitorIndexForEvent(event) != this._primaryIndex)
402 return Clutter.EVENT_PROPAGATE;
403
404 let workspaceManager = global.workspace_manager;
405 let activeWs = workspaceManager.get_active_workspace();
406 let ws;
407 switch (event.get_scroll_direction()) {
408 case Clutter.ScrollDirection.UP:
409 ws = activeWs.get_neighbor(Meta.MotionDirection.LEFT);
410 break;
411 case Clutter.ScrollDirection.DOWN:
412 ws = activeWs.get_neighbor(Meta.MotionDirection.RIGHT);
413 break;
414 case Clutter.ScrollDirection.LEFT:
415 ws = activeWs.get_neighbor(Meta.MotionDirection.LEFT);
416 break;
417 case Clutter.ScrollDirection.RIGHT:
418 ws = activeWs.get_neighbor(Meta.MotionDirection.RIGHT);
419 break;
420 default:
421 return Clutter.EVENT_PROPAGATE;
422 }
423 Main.wm.actionMoveWorkspace(ws);
424 return Clutter.EVENT_STOP;
425 };
426
427 }
428
429 _restoreGnomeShellFunctions() {
430 // Restore showWorkspacesSwitcher to show normal workspace switcher popup
431 WindowManager.WindowManager.prototype._showWorkspaceSwitcher = GSFunctions['WindowManager_showWorkspaceSwitcher'];
432
433 // Restore updateWorkspaceActors to original vertical animation of overview windows
434 WorkspacesView.WorkspacesView.prototype._updateWorkspaceActors = GSFunctions['WorkspacesView_updateWorkspaceActors'];
435
436 // Restore onScrollEvent to original vertical scrolling of workspaces
437 WorkspacesView.WorkspacesDisplay.prototype._onScrollEvent = GSFunctions['WorkspacesDisplay_onScrollEvent']
438 }
439
440 _resetBindings() {
441 // Reset bindings to active showWorkspaceSwitcher function
442 let wm = Main.wm;
443
444 wm.setCustomKeybindingHandler('switch-to-workspace-left',
445 Shell.ActionMode.NORMAL |
446 Shell.ActionMode.OVERVIEW,
447 wm._showWorkspaceSwitcher.bind(wm));
448 wm.setCustomKeybindingHandler('switch-to-workspace-right',
449 Shell.ActionMode.NORMAL |
450 Shell.ActionMode.OVERVIEW,
451 wm._showWorkspaceSwitcher.bind(wm));
452 wm.setCustomKeybindingHandler('switch-to-workspace-up',
453 Shell.ActionMode.NORMAL |
454 Shell.ActionMode.OVERVIEW,
455 wm._showWorkspaceSwitcher.bind(wm));
456 wm.setCustomKeybindingHandler('switch-to-workspace-down',
457 Shell.ActionMode.NORMAL |
458 Shell.ActionMode.OVERVIEW,
459 wm._showWorkspaceSwitcher.bind(wm));
460 wm.setCustomKeybindingHandler('switch-to-workspace-last',
461 Shell.ActionMode.NORMAL |
462 Shell.ActionMode.OVERVIEW,
463 wm._showWorkspaceSwitcher.bind(wm));
464 wm.setCustomKeybindingHandler('move-to-workspace-left',
465 Shell.ActionMode.NORMAL |
466 Shell.ActionMode.OVERVIEW,
467 wm._showWorkspaceSwitcher.bind(wm));
468 wm.setCustomKeybindingHandler('move-to-workspace-right',
469 Shell.ActionMode.NORMAL |
470 Shell.ActionMode.OVERVIEW,
471 wm._showWorkspaceSwitcher.bind(wm));
472 wm.setCustomKeybindingHandler('move-to-workspace-up',
473 Shell.ActionMode.NORMAL |
474 Shell.ActionMode.OVERVIEW,
475 wm._showWorkspaceSwitcher.bind(wm));
476 wm.setCustomKeybindingHandler('move-to-workspace-down',
477 Shell.ActionMode.NORMAL |
478 Shell.ActionMode.OVERVIEW,
479 wm._showWorkspaceSwitcher.bind(wm));
480 wm.setCustomKeybindingHandler('switch-to-workspace-1',
481 Shell.ActionMode.NORMAL |
482 Shell.ActionMode.OVERVIEW,
483 wm._showWorkspaceSwitcher.bind(wm));
484 wm.setCustomKeybindingHandler('switch-to-workspace-2',
485 Shell.ActionMode.NORMAL |
486 Shell.ActionMode.OVERVIEW,
487 wm._showWorkspaceSwitcher.bind(wm));
488 wm.setCustomKeybindingHandler('switch-to-workspace-3',
489 Shell.ActionMode.NORMAL |
490 Shell.ActionMode.OVERVIEW,
491 wm._showWorkspaceSwitcher.bind(wm));
492 wm.setCustomKeybindingHandler('switch-to-workspace-4',
493 Shell.ActionMode.NORMAL |
494 Shell.ActionMode.OVERVIEW,
495 wm._showWorkspaceSwitcher.bind(wm));
496 wm.setCustomKeybindingHandler('switch-to-workspace-5',
497 Shell.ActionMode.NORMAL |
498 Shell.ActionMode.OVERVIEW,
499 wm._showWorkspaceSwitcher.bind(wm));
500 wm.setCustomKeybindingHandler('switch-to-workspace-6',
501 Shell.ActionMode.NORMAL |
502 Shell.ActionMode.OVERVIEW,
503 wm._showWorkspaceSwitcher.bind(wm));
504 wm.setCustomKeybindingHandler('switch-to-workspace-7',
505 Shell.ActionMode.NORMAL |
506 Shell.ActionMode.OVERVIEW,
507 wm._showWorkspaceSwitcher.bind(wm));
508 wm.setCustomKeybindingHandler('switch-to-workspace-8',
509 Shell.ActionMode.NORMAL |
510 Shell.ActionMode.OVERVIEW,
511 wm._showWorkspaceSwitcher.bind(wm));
512 wm.setCustomKeybindingHandler('switch-to-workspace-9',
513 Shell.ActionMode.NORMAL |
514 Shell.ActionMode.OVERVIEW,
515 wm._showWorkspaceSwitcher.bind(wm));
516 wm.setCustomKeybindingHandler('switch-to-workspace-10',
517 Shell.ActionMode.NORMAL |
518 Shell.ActionMode.OVERVIEW,
519 wm._showWorkspaceSwitcher.bind(wm));
520 wm.setCustomKeybindingHandler('switch-to-workspace-11',
521 Shell.ActionMode.NORMAL |
522 Shell.ActionMode.OVERVIEW,
523 wm._showWorkspaceSwitcher.bind(wm));
524 wm.setCustomKeybindingHandler('switch-to-workspace-12',
525 Shell.ActionMode.NORMAL |
526 Shell.ActionMode.OVERVIEW,
527 wm._showWorkspaceSwitcher.bind(wm));
528 wm.setCustomKeybindingHandler('move-to-workspace-1',
529 Shell.ActionMode.NORMAL,
530 wm._showWorkspaceSwitcher.bind(wm));
531 wm.setCustomKeybindingHandler('move-to-workspace-2',
532 Shell.ActionMode.NORMAL,
533 wm._showWorkspaceSwitcher.bind(wm));
534 wm.setCustomKeybindingHandler('move-to-workspace-3',
535 Shell.ActionMode.NORMAL,
536 wm._showWorkspaceSwitcher.bind(wm));
537 wm.setCustomKeybindingHandler('move-to-workspace-4',
538 Shell.ActionMode.NORMAL,
539 wm._showWorkspaceSwitcher.bind(wm));
540 wm.setCustomKeybindingHandler('move-to-workspace-5',
541 Shell.ActionMode.NORMAL,
542 wm._showWorkspaceSwitcher.bind(wm));
543 wm.setCustomKeybindingHandler('move-to-workspace-6',
544 Shell.ActionMode.NORMAL,
545 wm._showWorkspaceSwitcher.bind(wm));
546 wm.setCustomKeybindingHandler('move-to-workspace-7',
547 Shell.ActionMode.NORMAL,
548 wm._showWorkspaceSwitcher.bind(wm));
549 wm.setCustomKeybindingHandler('move-to-workspace-8',
550 Shell.ActionMode.NORMAL,
551 wm._showWorkspaceSwitcher.bind(wm));
552 wm.setCustomKeybindingHandler('move-to-workspace-9',
553 Shell.ActionMode.NORMAL,
554 wm._showWorkspaceSwitcher.bind(wm));
555 wm.setCustomKeybindingHandler('move-to-workspace-10',
556 Shell.ActionMode.NORMAL,
557 wm._showWorkspaceSwitcher.bind(wm));
558 wm.setCustomKeybindingHandler('move-to-workspace-11',
559 Shell.ActionMode.NORMAL,
560 wm._showWorkspaceSwitcher.bind(wm));
561 wm.setCustomKeybindingHandler('move-to-workspace-12',
562 Shell.ActionMode.NORMAL,
563 wm._showWorkspaceSwitcher.bind(wm));
564 wm.setCustomKeybindingHandler('move-to-workspace-last',
565 Shell.ActionMode.NORMAL,
566 wm._showWorkspaceSwitcher.bind(wm));
567
568 wm._workspaceSwitcherPopup = null;
569 }
570 };
1515 const Background = imports.ui.background;
1616 const DND = imports.ui.dnd;
1717 const Main = imports.ui.main;
18 const Tweener = imports.ui.tweener;
1918 const Workspace = imports.ui.workspace;
2019 const WorkspacesView = imports.ui.workspacesView;
2120
2726 const _ = Gettext.gettext;
2827
2928 // The maximum size of a thumbnail is 1/10 the width and height of the screen
30 let MAX_THUMBNAIL_SCALE = 1/10.;
31
32 var RESCALE_ANIMATION_TIME = 0.2;
33 var SLIDE_ANIMATION_TIME = 0.2;
29 let MAX_THUMBNAIL_SCALE = 1 / 10.;
30
31 var RESCALE_ANIMATION_TIME = 200;
32 var SLIDE_ANIMATION_TIME = 200;
3433
3534 // When we create workspaces by dragging, we add a "cut" into the top and
3635 // bottom of each workspace so that the user doesn't have to hit the
4039 var WORKSPACE_KEEP_ALIVE_TIME = 100;
4140
4241 var MUTTER_SCHEMA = 'org.gnome.mutter';
43 //var OVERRIDE_SCHEMA = 'org.gnome.shell.overrides';
4442
4543 /* Return the actual position reverseing left and right in rtl */
4644 function getPosition(settings) {
238236 return Clutter.EVENT_STOP;
239237 }
240238
241 _onDragBegin(draggable, time) {
239 _onDragBegin(_draggable, _time) {
242240 this.inDrag = true;
243241 this.emit('drag-begin');
244242 }
245243
246 _onDragCancelled(draggable, time) {
244 _onDragCancelled(_draggable, _time) {
247245 this.emit('drag-cancelled');
248246 }
249247
250 _onDragEnd(draggable, time, snapback) {
248 _onDragEnd(_draggable, _time, _snapback) {
251249 this.inDrag = false;
252250
253251 // We may not have a parent if DnD completed successfully, in
268266
269267
270268 var ThumbnailState = {
271 NEW : 0,
272 ANIMATING_IN : 1,
269 NEW: 0,
270 ANIMATING_IN: 1,
273271 NORMAL: 2,
274 REMOVING : 3,
275 ANIMATING_OUT : 4,
276 ANIMATED_OUT : 5,
277 COLLAPSING : 6,
278 DESTROYED : 7
272 REMOVING: 3,
273 ANIMATING_OUT: 4,
274 ANIMATED_OUT: 5,
275 COLLAPSING: 6,
276 DESTROYED: 7
279277 };
280278
281279 /**
282280 * @metaWorkspace: a #Meta.Workspace
283281 */
284 var MyWorkspaceThumbnail = class WorkspacesToDock_MyWorkspaceThumbnail {
285 constructor(metaWorkspace, thumbnailsBox) {
282 var MyWorkspaceThumbnail = GObject.registerClass({
283 Properties: {
284 'collapse-fraction': GObject.ParamSpec.double(
285 'collapse-fraction', 'collapse-fraction', 'collapse-fraction',
286 GObject.ParamFlags.READWRITE,
287 0, 1, 0),
288 'slide-position': GObject.ParamSpec.double(
289 'slide-position', 'slide-position', 'slide-position',
290 GObject.ParamFlags.READWRITE,
291 0, 1, 0),
292 }
293 }, class WorkspacesToDock_MyWorkspaceThumbnail extends St.Widget {
294 _init(metaWorkspace, thumbnailsBox) {
295 super._init({
296 clip_to_allocation: true,
297 style_class: 'workspace-thumbnail'
298 });
299 this._delegate = this;
300
286301 this.metaWorkspace = metaWorkspace;
287302 this.monitorIndex = Main.layoutManager.primaryIndex;
288303
289 this._getWinTextureIdleId = 0;
290304 this._thumbnailsBox = thumbnailsBox;
291305
292306 this._removed = false;
293307
294 this.actor = new St.Widget({ clip_to_allocation: true,
295 style_class: 'workspace-thumbnail' });
296 this.actor._delegate = this;
297
298308 this._contents = new Clutter.Actor();
299 this.actor.add_child(this._contents);
300
301 this.actor.connect('destroy', this._onDestroy.bind(this));
309 this.add_child(this._contents);
310
311 this.connect('destroy', this._onDestroy.bind(this));
302312
303313 this.caption = new ThumbnailCaption.ThumbnailCaption(this);
304314
330340
331341 // Track window changes
332342 this._windowAddedId = this.metaWorkspace.connect('window-added',
333 this._windowAdded.bind(this));
343 this._windowAdded.bind(this));
334344 this._windowRemovedId = this.metaWorkspace.connect('window-removed',
335345 this._windowRemoved.bind(this));
336346 this._windowEnteredMonitorId = global.display.connect('window-entered-monitor',
350360 }
351361
352362 setPorthole(x, y, width, height) {
353 this.actor.set_size(width, height);
363 this.set_size(width, height);
354364 this._contents.set_position(-x, -y);
355365 }
356366
367377
368378 for (let i = 0; i < this._windows.length; i++) {
369379 let clone = this._windows[i];
370 let metaWindow = clone.metaWindow;
371380 if (i == 0) {
372381 clone.setStackAbove(this._bgManager.backgroundActor);
373382 } else {
377386 }
378387 }
379388
380 set slidePosition(slidePosition) {
389 // eslint-disable-next-line camelcase
390 set slide_position(slidePosition) {
391 if (this._slidePosition == slidePosition)
392 return;
381393 this._slidePosition = slidePosition;
382 this.actor.queue_relayout();
383 }
384
385 get slidePosition() {
394 this.notify('slide-position');
395 this.queue_relayout();
396 }
397
398 // eslint-disable-next-line camelcase
399 get slide_position() {
386400 return this._slidePosition;
387401 }
388402
389 set collapseFraction(collapseFraction) {
403 // eslint-disable-next-line camelcase
404 set collapse_fraction(collapseFraction) {
405 if (this._collapseFraction == collapseFraction)
406 return;
390407 this._collapseFraction = collapseFraction;
391 this.actor.queue_relayout();
392 }
393
394 get collapseFraction() {
408 this.notify('collapse-fraction');
409 this.queue_relayout();
410 }
411
412 // eslint-disable-next-line camelcase
413 get collapse_fraction() {
395414 return this._collapseFraction;
396415 }
397416
453472 return;
454473 }
455474
456 if (this._allWindows.indexOf(metaWin) == -1) {
475 if (!this._allWindows.includes(metaWin)) {
457476 let minimizedChangedId = metaWin.connect('notify::minimized',
458477 this._updateMinimized.bind(this));
459478 this._allWindows.push(metaWin);
523542 this._doAddWindow(metaWin);
524543 }
525544
526 destroy() {
527 if (this.actor)
528 this.actor.destroy();
529 }
530
531545 workspaceRemoved() {
532546 if (this._removed)
533547 return;
544558 this._allWindows[i].disconnect(this._minimizedChangedIds[i]);
545559 }
546560
547 _onDestroy(actor) {
561 _onDestroy() {
548562 this.caption.destroy();
549563 this.workspaceRemoved();
550564
551565 if (this._bgManager) {
552 this._bgManager.destroy();
553 this._bgManager = null;
566 this._bgManager.destroy();
567 this._bgManager = null;
554568 }
555569
556570 this._windows = [];
557 this.actor = null;
558571 }
559572
560573 // Tests if @actor belongs to this workspace and monitor
577590
578591 // Create a clone of a (non-desktop) window and add it to the window list
579592 _addWindowClone(win, refresh) {
580 // We may have to wait for the window texture to be available.
581 // Such is the case with Chrome browser in Wayland
582 if (this._getWinTextureIdleId > 0) {
583 Mainloop.source_remove(this._getWinTextureIdleId);
584 this._getWinTextureIdleId = 0;
585 }
586 if (!win.get_texture()) {
587 if (_DEBUG_) global.log("myWorkspaceThumbnail: _addWindowClone - WINDOW TEXTURE NOT YET AVAILABLE");
588 this._getWinTextureIdleId = Mainloop.idle_add(() => {
589 this._addWindowClone(win, refresh);
590 });
591 return;
592 }
593
594593 let clone = new MyWindowClone(win);
595594
596595 clone.connect('selected', (clone, time) => {
734733
735734 return false;
736735 }
737 };
738 Signals.addSignalMethods(MyWorkspaceThumbnail.prototype);
739
740 var MyThumbnailsBox = GObject.registerClass(
741 class WorkspacesToDock_MyThumbnailsBox extends St.Widget {
736 });
737
738
739 var MyThumbnailsBox = GObject.registerClass({
740 Properties: {
741 'indicator-x': GObject.ParamSpec.double(
742 'indicator-x', 'indicator-x', 'indicator-x',
743 GObject.ParamFlags.READWRITE,
744 0, Infinity, 0),
745 'indicator-y': GObject.ParamSpec.double(
746 'indicator-y', 'indicator-y', 'indicator-y',
747 GObject.ParamFlags.READWRITE,
748 0, Infinity, 0),
749 'scale': GObject.ParamSpec.double(
750 'scale', 'scale', 'scale',
751 GObject.ParamFlags.READWRITE,
752 0, Infinity, 0)
753 }
754 }, class WorkspacesToDock_MyThumbnailsBox extends St.Widget {
742755 _init(dock) {
743756 this._dock = dock;
744757 this._gsCurrentVersion = Config.PACKAGE_VERSION.split('.');
759772 request_mode: Clutter.RequestMode.WIDTH_FOR_HEIGHT });
760773 }
761774
762 this.actor = this;
763 this.actor._delegate = this;
775 this._delegate = this;
764776
765777 // Add addtional style class when workspace is fixed and set to full height
766778 if (this._mySettings.get_boolean('customize-height') && this._mySettings.get_int('customize-height-option') == 1) {
767779 if (this._mySettings.get_double('top-margin') == 0 || this._mySettings.get_double('bottom-margin') == 0) {
768 this.actor.add_style_class_name('workspace-thumbnails-fullheight');
780 this.add_style_class_name('workspace-thumbnails-fullheight');
769781 }
770782 }
771783
823835 // this._onDragEnd.bind(this));
824836 //Main.overview.connect('window-drag-cancelled',
825837 // this._onDragCancelled.bind(this));
826
827 //Main.layoutManager.connect('monitors-changed', () => {
828 // this._destroyThumbnails();
829 // if (Main.overview.visible)
830 // this._createThumbnails();
831 //});
832
833 //global.display.connect('workareas-changed',
834 // this._updatePorthole.bind(this));
835838
836839 // Connect global signals
837840 let workspaceManager = global.workspace_manager;
898901 this._settings.connect('changed::dynamic-workspaces',
899902 this._updateSwitcherVisibility.bind(this));
900903
904 //Main.layoutManager.connect('monitors-changed', () => {
905 // this._destroyThumbnails();
906 // if (Main.overview.visible)
907 // this._createThumbnails();
908 //});
909
910 //global.display.connect('workareas-changed',
911 // this._updatePorthole.bind(this));
912
901913 this._switchWorkspaceNotifyId = 0;
902914 this._nWorkspacesNotifyId = 0;
903915 this._syncStackingId = 0;
915927 // Destroy thumbnails
916928 this._destroyThumbnails();
917929
918 this.actor = null;
919930 this._indicator = null;
920931
921932 if (_DEBUG_) global.log("myWorkspaceThumbnail: dispose settings");
933944 }
934945
935946 _activateThumbnailAtPoint(stageX, stageY, time) {
936 let [r, x, y] = this.transform_stage_point(stageX, stageY);
947 let [r_, x, y] = this.transform_stage_point(stageX, stageY);
937948
938949 for (let i = 0; i < this._thumbnails.length; i++) {
939 let thumbnail = this._thumbnails[i]
940 let [w, h] = thumbnail.actor.get_transformed_size();
950 let thumbnail = this._thumbnails[i];
951 let [w, h] = thumbnail.get_transformed_size();
941952 if (this._isHorizontal) {
942 if (x >= thumbnail.actor.x && x <= thumbnail.actor.x + w) {
953 if (x >= thumbnail.x && x <= thumbnail.x + w) {
943954 thumbnail.activate(time);
944955 break;
945956 }
946957 } else {
947 if (y >= thumbnail.actor.y && y <= thumbnail.actor.y + h) {
958 if (y >= thumbnail.y && y <= thumbnail.y + h) {
948959 thumbnail.activate(time);
949960 break;
950961 }
10581069 if (this._dropPlaceholderPos == 0)
10591070 targetBase = this._dropPlaceholder.x;
10601071 else
1061 targetBase = this._thumbnails[0].actor.x;
1072 targetBase = this._thumbnails[0].x;
10621073 } else {
10631074 if (this._dropPlaceholderPos == 0)
10641075 targetBase = this._dropPlaceholder.y;
10651076 else
1066 targetBase = this._thumbnails[0].actor.y;
1077 targetBase = this._thumbnails[0].y;
10671078 }
10681079 let targetTop = targetBase - spacing - WORKSPACE_CUT_SIZE;
10691080 let length = this._thumbnails.length;
10711082 // Allow the reorder target to have a 10px "cut" into
10721083 // each side of the thumbnail, to make dragging onto the
10731084 // placeholder easier
1074 let [w, h] = this._thumbnails[i].actor.get_transformed_size();
1085 let [w, h] = this._thumbnails[i].get_transformed_size();
1086
10751087 let targetBottom, nextTargetBase, nextTargetTop;
10761088 if (this._isHorizontal) {
10771089 targetBottom = targetBase + WORKSPACE_CUT_SIZE;
10891101 this._dropWorkspace = i;
10901102 break
10911103 }
1092 targetBase = nextTargetBase;
1093 targetTop = nextTargetTop;
1104 //targetBase = nextTargetBase;
1105 //targetTop = nextTargetTop;
10941106 } else {
10951107 targetBottom = targetBase + WORKSPACE_CUT_SIZE;
10961108 nextTargetBase = targetBase + h + spacing;
11071119 this._dropWorkspace = i;
11081120 break
11091121 }
1110 targetBase = nextTargetBase;
1111 targetTop = nextTargetTop;
1112 }
1122 //targetBase = nextTargetBase;
1123 //targetTop = nextTargetTop;
1124 }
1125
1126 targetBase = nextTargetBase;
1127 targetTop = nextTargetTop;
11131128 }
11141129
11151130 if (this._dropPlaceholderPos != placeholderPos) {
11681183 // an old one which just became empty)
11691184 let thumbnail = this._thumbnails[newWorkspaceIndex];
11701185 this._setThumbnailState(thumbnail, ThumbnailState.NEW);
1171 thumbnail.slidePosition = 1;
1186 thumbnail.slide_position = 1;
11721187
11731188 this._queueUpdateStates();
11741189
11841199 this._switchWorkspaceNotifyId =
11851200 global.window_manager.connect('switch-workspace',
11861201 this._activeWorkspaceChanged.bind(this));
1187
11881202 // passingthru67: not using n-workspaces notification (workspacesChanged) but workspaceAdded and workspaceRemoved
11891203 // Please see myThumbnailsBox._init function signal handlers above
11901204 //this._nWorkspacesNotifyId =
11921206 // this._workspacesChanged.bind(this));
11931207 this._nWorkspacesNotifyId = 0;
11941208
1209 this._workspacesReorderedId =
1210 workspaceManager.connect('workspaces-reordered', () => {
1211 this._thumbnails.sort((a, b) => {
1212 return a.metaWorkspace.index() - b.metaWorkspace.index();
1213 });
1214 this.queue_relayout();
1215 });
11951216 this._syncStackingId =
11961217 Main.overview.connect('windows-restacked',
11971218 this._syncStacking.bind(this));
12071228
12081229 this.addThumbnails(0, workspaceManager.n_workspaces);
12091230
1210 if (this.actor)
1211 this._updateSwitcherVisibility();
1231 this._updateSwitcherVisibility();
12121232 }
12131233
12141234 _destroyThumbnails() {
12231243 let workspaceManager = global.workspace_manager;
12241244 workspaceManager.disconnect(this._nWorkspacesNotifyId);
12251245 this._nWorkspacesNotifyId = 0;
1246 }
1247 if (this._workspacesReorderedId > 0) {
1248 let workspaceManager = global.workspace_manager;
1249 workspaceManager.disconnect(this._workspacesReorderedId);
1250 this._workspacesReorderedId = 0;
12261251 }
12271252
12281253 if (this._syncStackingId > 0) {
12411266 let workspaceManager = global.workspace_manager;
12421267 let oldNumWorkspaces = validThumbnails.length;
12431268 let newNumWorkspaces = workspaceManager.n_workspaces;
1244 let active = workspaceManager.get_active_workspace_index();
12451269
12461270 if (newNumWorkspaces > oldNumWorkspaces) {
12471271 this.addThumbnails(oldNumWorkspaces, newNumWorkspaces - oldNumWorkspaces);
13481372 thumbnail.setPorthole(this._porthole.x, this._porthole.y,
13491373 this._porthole.width, this._porthole.height);
13501374 this._thumbnails.push(thumbnail);
1351 if (this.actor)
1352 this.add_actor(thumbnail.actor);
1375 this.add_actor(thumbnail);
13531376
13541377 if (start > 0 && this._spliceIndex == -1) {
13551378 // not the initial fill, and not splicing via DND
13561379 thumbnail.state = ThumbnailState.NEW;
1357 thumbnail.slidePosition = 1; // start slid out
1380 thumbnail.slide_position = 1; // start slid out
13581381 this._haveNewThumbnails = true;
13591382 } else {
13601383 thumbnail.state = ThumbnailState.NORMAL;
13661389 this._queueUpdateStates();
13671390
13681391 // The thumbnails indicator actually needs to be on top of the thumbnails
1369 if (this._indicator)
1370 this._indicator.raise_top();
1392 this._indicator.raise_top();
13711393
13721394 // Clear the splice index, we got the message
13731395 this._spliceIndex = -1;
14121434 }
14131435
14141436 set scale(scale) {
1437 if (this._scale == scale)
1438 return;
1439
14151440 this._scale = scale;
1441 this.notify('scale');
14161442 this.queue_relayout();
14171443 }
14181444
14201446 return this._scale;
14211447 }
14221448
1423 set indicatorY(indicatorY) {
1449 // eslint-disable-next-line camelcase
1450 set indicator_y(indicatorY) {
1451 if (this._indicatorY == indicatorY)
1452 return;
1453
14241454 this._indicatorY = indicatorY;
1455 this.notify('indicator-y');
14251456 this.queue_relayout();
14261457 }
14271458
1428 get indicatorY() {
1459 // eslint-disable-next-line camelcase
1460 get indicator_y() {
14291461 return this._indicatorY;
14301462 }
14311463
14321464 // passingthru67 - added set indicatorX for when position isHorizontal
1433 set indicatorX(indicatorX) {
1465 set indicator_x(indicatorX) {
1466 if (this._indicatorX == indicatorX)
1467 return;
1468
14341469 this._indicatorX = indicatorX;
1470 this.notify('indicator-x');
14351471 this.queue_relayout();
14361472 }
14371473
14381474 // passingthru67 - added get indicatorX for when position isHorizontal
1439 get indicatorX() {
1475 get indicator_x() {
14401476 return this._indicatorX;
14411477 }
14421478
14561492 }
14571493 }
14581494
1459 _tweenScale() {
1460 Tweener.addTween(this,
1461 { scale: this._targetScale,
1462 time: RESCALE_ANIMATION_TIME,
1463 transition: 'easeOutQuad',
1464 onComplete: this._queueUpdateStates,
1465 onCompleteScope: this });
1466 }
1467
14681495 _updateStates() {
14691496 this._stateUpdateQueued = false;
14701497
14761503 this._iterateStateThumbnails(ThumbnailState.REMOVING, thumbnail => {
14771504 this._setThumbnailState(thumbnail, ThumbnailState.ANIMATING_OUT);
14781505
1479 Tweener.addTween(thumbnail,
1480 { slidePosition: 1,
1481 time: SLIDE_ANIMATION_TIME,
1482 transition: 'linear',
1483 onComplete: () => {
1484 this._setThumbnailState(thumbnail, ThumbnailState.ANIMATED_OUT);
1485 this._queueUpdateStates();
1486 }
1487 });
1506 thumbnail.ease_property('slide-position', 1, {
1507 duration: SLIDE_ANIMATION_TIME,
1508 mode: Clutter.AnimationMode.LINEAR,
1509 onComplete: () => {
1510 this._setThumbnailState(thumbnail, ThumbnailState.ANIMATED_OUT);
1511 this._queueUpdateStates();
1512 }
1513 });
14881514 });
14891515
14901516 // As long as things are sliding out, don't proceed
14941520 // Once that's complete, we can start scaling to the new size and collapse any removed thumbnails
14951521 this._iterateStateThumbnails(ThumbnailState.ANIMATED_OUT, thumbnail => {
14961522 this._setThumbnailState(thumbnail, ThumbnailState.COLLAPSING);
1497 Tweener.addTween(thumbnail,
1498 { collapseFraction: 1,
1499 time: RESCALE_ANIMATION_TIME,
1500 transition: 'easeOutQuad',
1501 onComplete: () => {
1502 this._stateCounts[thumbnail.state]--;
1503 thumbnail.state = ThumbnailState.DESTROYED;
1504
1505 let index = this._thumbnails.indexOf(thumbnail);
1506 this._thumbnails.splice(index, 1);
1507 thumbnail.destroy();
1508
1509 this._queueUpdateStates();
1510 }
1511 });
1523 thumbnail.ease_property('collapse-fraction', 1, {
1524 duration: RESCALE_ANIMATION_TIME,
1525 mode: Clutter.AnimationMode.EASE_OUT_QUAD,
1526 onComplete: () => {
1527 this._stateCounts[thumbnail.state]--;
1528 thumbnail.state = ThumbnailState.DESTROYED;
1529
1530 let index = this._thumbnails.indexOf(thumbnail);
1531 this._thumbnails.splice(index, 1);
1532 thumbnail.destroy();
1533
1534 this._queueUpdateStates();
1535 }
1536 });
15121537 });
15131538
15141539 if (this._pendingScaleUpdate) {
1515 this._tweenScale();
1540 this.ease_property('scale', this._targetScale, {
1541 mode: Clutter.AnimationMode.EASE_OUT_QUAD,
1542 duration: RESCALE_ANIMATION_TIME,
1543 onComplete: () => this._queueUpdateStates()
1544 });
15161545 this._pendingScaleUpdate = false;
15171546 }
15181547
15231552 // And then slide in any new thumbnails
15241553 this._iterateStateThumbnails(ThumbnailState.NEW, thumbnail => {
15251554 this._setThumbnailState(thumbnail, ThumbnailState.ANIMATING_IN);
1526 Tweener.addTween(thumbnail,
1527 { slidePosition: 0,
1528 time: SLIDE_ANIMATION_TIME,
1529 transition: 'easeOutQuad',
1530 onComplete: () => {
1531 this._setThumbnailState(thumbnail, ThumbnailState.NORMAL);
1532 }
1533 });
1555 thumbnail.ease_property('slide-position', 0, {
1556 duration: SLIDE_ANIMATION_TIME,
1557 mode: Clutter.AnimationMode.EASE_OUT_QUAD,
1558 onComplete: () => {
1559 this._setThumbnailState(thumbnail, ThumbnailState.NORMAL);
1560 }
1561 });
15341562 });
15351563 }
15361564
16531681 vfunc_allocate(box, flags) {
16541682 this.set_allocation(box, flags);
16551683
1656 this._thumbnailsBoxWidth = this.actor.width;
1657 this._thumbnailsBoxHeight = this.actor.height;
1684 this._thumbnailsBoxWidth = this.width;
1685 this._thumbnailsBoxHeight = this.height;
16581686
16591687 // passingthru67: we use this._position instead of rtl
16601688 // let rtl = (Clutter.get_default_text_direction () == Clutter.TextDirection.RTL);
17831811 let thumbnail = this._thumbnails[i];
17841812
17851813 if (i > 0) {
1786 // x += spacing - Math.round(thumbnail.collapseFraction * spacing);
1814 // x += spacing - Math.round(thumbnail.collapse_fraction * spacing);
17871815 x += spacing;
17881816 }
17891817
17971825 }
17981826
17991827 if (i == this._dropPlaceholderPos) {
1800 let [minWidth, placeholderWidth] = this._dropPlaceholder.get_preferred_width(-1);
1828 let [, placeholderWidth] = this._dropPlaceholder.get_preferred_width(-1);
18011829 childBox.y1 = y1;
1802 childBox.y2 = y1 + thumbnailHeight + captionBackgroundHeight;
1830 childBox.y2 = y2;
18031831 childBox.x1 = Math.round(x);
18041832 childBox.x2 = Math.round(x + placeholderWidth);
18051833 this._dropPlaceholder.allocate(childBox, flags);
1806 Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
1834 Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
18071835 this._dropPlaceholder.show();
18081836 });
18091837 x += placeholderWidth + spacing;
18151843 // we compute an actual scale separately for each thumbnail.
18161844 let x1 = Math.round(x);
18171845 let x2 = Math.round(x + thumbnailWidth);
1846 // passingthru67 - roundedHScale now defined above
18181847 roundedHScale = (x2 - x1) / portholeWidth;
18191848
18201849 if (thumbnail.metaWorkspace == indicatorWorkspace) {
18301859 // passingthru67 - size needs to include caption area
18311860 childBox.y2 = y1 + portholeHeight + (captionBackgroundHeight/roundedVScale);
18321861
1833 thumbnail.actor.set_scale(roundedHScale, roundedVScale);
1834 thumbnail.actor.allocate(childBox, flags);
1862 thumbnail.set_scale(roundedHScale, roundedVScale);
1863 thumbnail.allocate(childBox, flags);
18351864
18361865 // passingthru67 - set myWorkspaceThumbnail labels
18371866 if (this._mySettings.get_boolean('workspace-captions'))
18401869 // We round the collapsing portion so that we don't get thumbnails resizing
18411870 // during an animation due to differences in rounded, but leave the uncollapsed
18421871 // portion unrounded so that non-animating we end up with the right total
1843 x += thumbnailWidth - Math.round(thumbnailWidth * thumbnail.collapseFraction);
1872 x += thumbnailWidth - Math.round(thumbnailWidth * thumbnail.collapse_fraction);
18441873 }
18451874
18461875 if (this._position == St.Side.TOP) {
18601889 let thumbnail = this._thumbnails[i];
18611890
18621891 if (i > 0)
1863 y += spacing + captionBackgroundHeight - Math.round(thumbnail.collapseFraction * spacing);
1892 y += spacing + captionBackgroundHeight - Math.round(thumbnail.collapse_fraction * spacing);
18641893
18651894 let x1, x2;
1866
18671895 if (this._position == St.Side.LEFT) {
1868 x1 = box.x1 + slideOffset * thumbnail.slidePosition;
1896 x1 = box.x1 + slideOffset * thumbnail.slide_position;
18691897 x2 = x1 + thumbnailWidth;
18701898 } else {
1871 x1 = box.x2 - thumbnailWidth + slideOffset * thumbnail.slidePosition;
1899 x1 = box.x2 - thumbnailWidth + slideOffset * thumbnail.slide_position;
18721900 x2 = x1 + thumbnailWidth;
18731901 }
18741902
18751903 if (i == this._dropPlaceholderPos) {
1876 let [minHeight, placeholderHeight] = this._dropPlaceholder.get_preferred_height(-1);
1904 let [, placeholderHeight] = this._dropPlaceholder.get_preferred_height(-1);
18771905 childBox.x1 = x1;
1878 childBox.x2 = x1 + thumbnailWidth;
1906 childBox.x2 = x2;
18791907 childBox.y1 = Math.round(y);
18801908 childBox.y2 = Math.round(y + placeholderHeight);
18811909 this._dropPlaceholder.allocate(childBox, flags);
1882 Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
1910 Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
18831911 this._dropPlaceholder.show();
18841912 });
1913 // passingthru67 - include captionBackgroundHeight
18851914 y += placeholderHeight + spacing + captionBackgroundHeight;
18861915 }
18871916
18941923
18951924 // passingthru67 - roundedVScale now defined above with roundedHScale
18961925 roundedVScale = (y2 - y1) / portholeHeight;
1926
18971927
18981928 if (thumbnail.metaWorkspace == indicatorWorkspace) {
18991929 indicatorY1 = y1;
19081938 // passingthru67 - size needs to include caption area
19091939 childBox.y2 = y1 + portholeHeight + (captionBackgroundHeight/roundedVScale);
19101940
1911 thumbnail.actor.set_scale(roundedHScale, roundedVScale);
1912 thumbnail.actor.allocate(childBox, flags);
1941 thumbnail.set_scale(roundedHScale, roundedVScale);
1942 thumbnail.allocate(childBox, flags);
19131943
19141944 // passingthru67 - set myWorkspaceThumbnail labels
19151945 if (this._mySettings.get_boolean('workspace-captions'))
19181948 // We round the collapsing portion so that we don't get thumbnails resizing
19191949 // during an animation due to differences in rounded, but leave the uncollapsed
19201950 // portion unrounded so that non-animating we end up with the right total
1921 y += thumbnailHeight - Math.round(thumbnailHeight * thumbnail.collapseFraction);
1951 y += thumbnailHeight - Math.round(thumbnailHeight * thumbnail.collapse_fraction);
19221952 }
19231953
19241954 if (this._position == St.Side.LEFT) {
19311961 childBox.x1 -= indicatorLeftFullBorder;
19321962 childBox.x2 += indicatorRightFullBorder;
19331963 childBox.y1 = indicatorY1 - indicatorTopFullBorder;
1964
19341965 // passingthru67 - indicator needs to include caption
19351966 childBox.y2 = (indicatorY2 ? indicatorY2 + captionBackgroundHeight : (indicatorY1 + thumbnailHeight + captionBackgroundHeight)) + indicatorBottomFullBorder;
19361967 }
19381969 this._indicator.allocate(childBox, flags);
19391970 }
19401971
1941 _activeWorkspaceChanged(wm, from, to, direction) {
1972 _activeWorkspaceChanged(_wm, _from, _to, _direction) {
19421973 let thumbnail;
19431974 let workspaceManager = global.workspace_manager;
19441975 let activeWorkspace = workspaceManager.get_active_workspace();
19531984 if (thumbnail == null)
19541985 return
19551986
1956 // passingthru67 - needed in case thumbnail.actor is null outside of overview
1957 if (thumbnail.actor == null)
1958 return
1959
19601987 this._animatingIndicator = true;
19611988 let indicatorThemeNode = this._indicator.get_theme_node();
19621989
19631990 if (this._isHorizontal) {
19641991 let indicatorLeftFullBorder = indicatorThemeNode.get_padding(St.Side.LEFT) + indicatorThemeNode.get_border_width(St.Side.LEFT);
19651992 this.indicatorX = this._indicator.allocation.x1 + indicatorLeftFullBorder;
1966 Tweener.addTween(this,
1967 { indicatorX: thumbnail.actor.allocation.x1,
1968 time: WorkspacesView.WORKSPACE_SWITCH_TIME,
1969 transition: 'easeOutQuad',
1970 onComplete: () => {
1971 this._animatingIndicator = false;
1972 this._queueUpdateStates();
1973 },
1974 onCompleteScope: this
1975 });
1993 this.ease_property('indicator-x', thumbnail.allocation.x1, {
1994 progress_mode: Clutter.AnimationMode.EASE_OUT_QUAD,
1995 duration: WorkspacesView.WORKSPACE_SWITCH_TIME,
1996 onComplete: () => {
1997 this._animatingIndicator = false;
1998 this._queueUpdateStates();
1999 }
2000 });
19762001 } else {
19772002 let indicatorTopFullBorder = indicatorThemeNode.get_padding(St.Side.TOP) + indicatorThemeNode.get_border_width(St.Side.TOP);
1978 this.indicatorY = this._indicator.allocation.y1 + indicatorTopFullBorder;
1979 Tweener.addTween(this,
1980 { indicatorY: thumbnail.actor.allocation.y1,
1981 time: WorkspacesView.WORKSPACE_SWITCH_TIME,
1982 transition: 'easeOutQuad',
1983 onComplete: () => {
1984 this._animatingIndicator = false;
1985 this._queueUpdateStates();
1986 },
1987 onCompleteScope: this
1988 });
2003 this.indicator_y = this._indicator.allocation.y1 + indicatorTopFullBorder;
2004 this.ease_property('indicator-y', thumbnail.allocation.y1, {
2005 progress_mode: Clutter.AnimationMode.EASE_OUT_QUAD,
2006 duration: WorkspacesView.WORKSPACE_SWITCH_TIME,
2007 onComplete: () => {
2008 this._animatingIndicator = false;
2009 this._queueUpdateStates();
2010 }
2011 });
19892012 }
19902013 }
19912014 });
13521352 });
13531353
13541354 let thumbnailSizeSpinner = new Gtk.SpinButton();
1355 thumbnailSizeSpinner.set_range(10, 25);
1355 thumbnailSizeSpinner.set_range(5, 25);
13561356 thumbnailSizeSpinner.set_value(this.settings.get_double('thumbnail-size') * 100);
13571357 thumbnailSizeSpinner.set_digits(1);
13581358 thumbnailSizeSpinner.set_increments(.5, 1);
2323 const IconGrid = imports.ui.iconGrid;
2424
2525 const Util = imports.misc.util;
26 const ExtensionSystem = imports.ui.extensionSystem;
2726 const ExtensionUtils = imports.misc.extensionUtils;
2827 const Me = imports.misc.extensionUtils.getCurrentExtension();
2928
308307 this._iconContainer.add_child(this._dot);
309308
310309 this._icon = new IconGrid.BaseIcon(null, iconParams);
311 this._icon.actor.add_style_class_name('workspacestodock-shortcut-button-icon');
310 this._icon.add_style_class_name('workspacestodock-shortcut-button-icon');
312311 if (appType == ApplicationType.PLACE) {
313 this._icon.actor.add_style_class_name('workspacestodock-shortcut-button-symbolic-icon');
312 this._icon.add_style_class_name('workspacestodock-shortcut-button-symbolic-icon');
314313 }
315314 this._icon.setIconSize(this._iconSize);
316315
317 this._iconContainer.add_child(this._icon.actor);
316 this._iconContainer.add_child(this._icon);
318317
319318 this._menu = null;
320 this._menuManager = new PopupMenu.PopupMenuManager(this);
319 this._menuManager = new PopupMenu.PopupMenuManager(this.actor);
321320 this._menuTimeoutId = 0;
322321
323322 // Connect button signals
1414 const Workspace = imports.ui.workspace;
1515 const WorkspaceThumbnail = imports.ui.workspaceThumbnail;
1616 const Overview = imports.ui.overview;
17 const Tweener = imports.ui.tweener;
1817 const IconGrid = imports.ui.iconGrid;
1918 const PopupMenu = imports.ui.popupMenu;
2019 const DND = imports.ui.dnd;
2827 const _ = Gettext.gettext;
2928
3029 var CAPTION_APP_ICON_ZOOM = 8;
31 let TASKBAR_TOOLTIP_SHOW_TIME = 0.15;
32 let TASKBAR_TOOLTIP_HIDE_TIME = 0.1;
30 let TASKBAR_TOOLTIP_SHOW_TIME = 150;
31 let TASKBAR_TOOLTIP_HIDE_TIME = 100;
3332 let TASKBAR_TOOLTIP_HOVER_TIMEOUT = 10;
3433
3534 const WindowAppsUpdateAction = {
6665 iconParams['createIcon'] = (iconSize) => { return app.create_icon_texture(iconSize);};
6766
6867 this._icon = new IconGrid.BaseIcon(app.get_name(), iconParams);
69 this._icon.actor.add_style_class_name('workspacestodock-caption-windowapps-button-icon');
68 this._icon.add_style_class_name('workspacestodock-caption-windowapps-button-icon');
7069 this._iconSize = this._mySettings.get_double('workspace-caption-taskbar-icon-size');
7170 this._icon.setIconSize(this._mySettings.get_double('workspace-caption-taskbar-icon-size'));
7271
7372 this.actor = new St.Button({style_class:'workspacestodock-caption-windowapps-button'});
74 this.actor.set_child(this._icon.actor);
73 this.actor.set_child(this._icon);
7574 this.actor._delegate = this;
7675
7776 // this._tooltipText = this._app.get_name();
8079 this.tooltip = new St.Label({ style_class: 'dash-label workspacestodock-caption-windowapps-button-tooltip'});
8180 this.tooltip.hide();
8281 Main.layoutManager.addChrome(this.tooltip);
82 Main.layoutManager.uiGroup.set_child_below_sibling(this.tooltip, Main.layoutManager.modalDialogGroup);
8383 this.tooltip_actor = this.tooltip;
8484
8585 // Connect signals
145145 // we show as the item is being dragged.
146146 getDragActorSource() {
147147 this.hideTooltip();
148 return this._icon.actor;
148 return this._icon;
149149 }
150150
151151 showTooltip() {
194194 }
195195
196196 this.tooltip.set_position(x, y);
197 Tweener.addTween(this.tooltip,
198 { opacity: 255,
199 time: TASKBAR_TOOLTIP_SHOW_TIME,
200 transition: 'easeOutQuad',
201 });
202
197 this.tooltip.ease({
198 opacity: 255,
199 duration: TASKBAR_TOOLTIP_SHOW_TIME,
200 mode: Clutter.AnimationMode.EASE_OUT_QUAD
201 });
203202 }
204203
205204 hideTooltip() {
208207 this._tooltipHoverTimeoutId = 0;
209208 }
210209
211 Tweener.addTween(this.tooltip,
212 { opacity: 0,
213 time: TASKBAR_TOOLTIP_HIDE_TIME,
214 transition: 'easeOutQuad',
215 onComplete: () => {
216 this.tooltip.hide();
217 }
218 });
210 this.tooltip.ease({
211 opacity: 0,
212 duration: TASKBAR_TOOLTIP_HIDE_TIME,
213 mode: Clutter.AnimationMode.EASE_OUT_QUAD,
214 onComplete: () => {
215 this.tooltip.hide();
216 }
217 });
219218 }
220219 };
221220
229228 iconParams['createIcon'] = (iconSize) => { return app.create_icon_texture(iconSize);};
230229
231230 this._icon = new IconGrid.BaseIcon(app.get_name(), iconParams);
232 this._icon.actor.add_style_class_name('workspacestodock-caption-windowapps-menu-icon');
231 this._icon.add_style_class_name('workspacestodock-caption-windowapps-menu-icon');
233232 this._icon.setIconSize(this._mySettings.get_double('workspace-caption-menu-icon-size'));
234233 // this._label = new St.Label({ text: app.get_name(), style_class: 'workspacestodock-caption-windowapps-menu-label' });
235234 this._label = new St.Label({ text: this._metaWin.title, style_class: 'workspacestodock-caption-windowapps-menu-label' });
236235
237236 this._buttonBox = new St.BoxLayout({style_class:'workspacestodock-caption-windowapps-menu-button'});
238 this._buttonBox.add(this._icon.actor, {x_fill: false, y_fill: false, x_align: St.Align.START, y_align: St.Align.MIDDLE});
237 this._buttonBox.add(this._icon, {x_fill: false, y_fill: false, x_align: St.Align.START, y_align: St.Align.MIDDLE});
239238 this._buttonBox.add(this._label, {x_fill: true, y_fill: false, x_align: St.Align.START, y_align: St.Align.MIDDLE, expand: true});
240239
241240 this._closeButton = new St.Button({style_class:'workspacestodock-caption-windowapps-menu-close'});
334333 global.window_manager.connect('switch-workspace',
335334 this.activeWorkspaceChanged.bind(this));
336335
337 this._menuManager = new PopupMenu.PopupMenuManager(this);
336 this._menuManager = new PopupMenu.PopupMenuManager(this.actor);
338337
339338 this._initCaption();
340 this._thumbnailRealizeId = this._thumbnail.actor.connect("realize", this._initTaskbar.bind(this));
339 this._thumbnailRealizeId = this._thumbnail.connect("realize", this._initTaskbar.bind(this));
341340 }
342341
343342 destroy() {
512511
513512 // Add caption to thumbnail actor
514513 this.actor.add_actor(this._wsCaption);
515 this._thumbnail.actor.add_actor(this._wsCaptionBackground);
516 this._thumbnail.actor.add_actor(this.actor);
514 this._thumbnail.add_actor(this._wsCaptionBackground);
515 this._thumbnail.add_actor(this.actor);
517516
518517 // Make thumbnail background transparent so that it doesn't show through
519518 // on edges where border-radius is set on caption
520 this._thumbnail.actor.set_style("background-color: rgba(0,0,0,0.0)");
519 this._thumbnail.set_style("background-color: rgba(0,0,0,0.0)");
521520
522521 // Create menu and menuitems
523522 let side = this._position;
571570 _initTaskbar() {
572571 if (_DEBUG_ && !this._thumbnail._removed) global.log("myWorkspaceThumbnail: _initTaskbar for metaWorkspace "+this._thumbnail.metaWorkspace.index());
573572 if(this._thumbnailRealizeId > 0){
574 this._thumbnail.actor.disconnect(this._thumbnailRealizeId);
573 this._thumbnail.disconnect(this._thumbnailRealizeId);
575574 this._thumbnailRealizeId = 0;
576575 } else {
577576 return;