From ecbd7de47f7f384915505d57e220c90bea3ea033 Mon Sep 17 00:00:00 2001 From: JosephMcc Date: Sat, 21 Sep 2024 18:58:42 -0700 Subject: [PATCH] Alt-tab: Remove the down arrow from the swithcer layout No real need for this and in some cases ends up being drawn outside of the switcher background. Just remove it. Clean up the alt-tab theming while at it. --- data/theme/cinnamon-sass/widgets/_alttab.scss | 32 ++++++++--- js/ui/appSwitcher/classicSwitcher.js | 53 ++----------------- 2 files changed, 30 insertions(+), 55 deletions(-) diff --git a/data/theme/cinnamon-sass/widgets/_alttab.scss b/data/theme/cinnamon-sass/widgets/_alttab.scss index 71c419ab80..b92d8c35d0 100644 --- a/data/theme/cinnamon-sass/widgets/_alttab.scss +++ b/data/theme/cinnamon-sass/widgets/_alttab.scss @@ -22,7 +22,7 @@ &:outlined { border-color: red; } &:selected { border-color: $borders_color; - background-color: $base_color + background-color: $light_bg_color } } @@ -32,19 +32,39 @@ } .thumbnail { width: 256px; } + + .separator {} } .switcher-preview-backdrop { background-color: transparentize(black, 0.5); } .switcher-arrow { + background-color: transparent; border-color: transparent; color: $fg_color; &:highlighted {} } -// these still exist in the code but we don't seem to run into them anymore -// now that the switcher resizes when more windows are added -.switcher-list .separator {} -.thumbnail-scroll-gradient-left {} -.thumbnail-scroll-gradient-right {} +.thumbnail-scroll-gradient { + + &-left { + background-gradient-direction: horizontal; + background-gradient-start: transparentize($panel_bg, 0.0); + background-gradient-end: transparentize($panel_bg, 1.0); + border-radius: $base_border_radius * 2; + border-radius-topright: 0px; + border-radius-bottomright: 0px; + width: 60px; + } + + &-right { + background-gradient-direction: horizontal; + background-gradient-start: transparentize($panel_bg, 1.0); + background-gradient-end: transparentize($panel_bg, 0.0); + border-radius: $base_border_radius * 2; + border-radius-topleft: 0px; + border-radius-bottomleft: 0px; + width: 60px; + } +} diff --git a/js/ui/appSwitcher/classicSwitcher.js b/js/ui/appSwitcher/classicSwitcher.js index 2c53434972..4af8c01c14 100644 --- a/js/ui/appSwitcher/classicSwitcher.js +++ b/js/ui/appSwitcher/classicSwitcher.js @@ -67,7 +67,7 @@ ClassicSwitcher.prototype = { this._iconsEnabled = true; this._showThumbnails = this._thumbnailsEnabled && !this._iconsEnabled; - this._showArrows = this._thumbnailsEnabled && this._iconsEnabled; + this._showIconAndThumbnails = this._thumbnailsEnabled && this._iconsEnabled; this._updateList(0); @@ -188,7 +188,7 @@ ClassicSwitcher.prototype = { this.actor.remove_actor(this._appList.actor); this._appList.actor.destroy(); } - this._appList = new AppList(this._windows, this._showThumbnails, this._showArrows, this._activeMonitor); + this._appList = new AppList(this._windows, this._showThumbnails, this._activeMonitor); this.actor.add_actor(this._appList.actor); if (!this._iconsEnabled && !this._thumbnailsEnabled) { this._appList.actor.hide(); @@ -233,7 +233,7 @@ ClassicSwitcher.prototype = { this._thumbnailTimeoutId = 0; } - if (this._showArrows) { + if (this._showIconAndThumbnails) { this._thumbnailTimeoutId = Mainloop.timeout_add( THUMBNAIL_POPUP_TIME, Lang.bind(this, function() { @@ -755,7 +755,7 @@ function AppList() { AppList.prototype = { __proto__ : SwitcherList.prototype, - _init : function(windows, showThumbnails, showArrows, activeMonitor) { + _init : function(windows, showThumbnails, activeMonitor) { SwitcherList.prototype._init.call(this, true, activeMonitor); // Construct the AppIcons, add to the popup @@ -767,7 +767,6 @@ AppList.prototype = { } this.icons = []; - this._arrows = []; for (let i = 0; i < workspaceIcons.length; i++) this._addIcon(workspaceIcons[i]); if (workspaceIcons.length > 0 && otherIcons.length > 0) @@ -777,7 +776,6 @@ AppList.prototype = { this._curApp = -1; this._iconSize = 0; - this._showArrows = showArrows; this._mouseTimeOutId = 0; this._activeMonitor = activeMonitor; }, @@ -825,27 +823,6 @@ AppList.prototype = { alloc.natural_size = height; }, - _allocate: function (actor, box, flags) { - // Allocate the main list items - SwitcherList.prototype._allocate.call(this, actor, box, flags); - - if (this._showArrows) { - let arrowHeight = Math.floor(this.actor.get_theme_node().get_padding(St.Side.BOTTOM) / 3); - let arrowWidth = arrowHeight * 2; - - // Now allocate each arrow underneath its item - let childBox = new Clutter.ActorBox(); - for (let i = 0; i < this._items.length; i++) { - let itemBox = this._items[i].allocation; - childBox.x1 = Math.floor(itemBox.x1 + (itemBox.x2 - itemBox.x1 - arrowWidth) / 2); - childBox.x2 = childBox.x1 + arrowWidth; - childBox.y1 = itemBox.y2 + arrowHeight; - childBox.y2 = childBox.y1 + arrowHeight; - this._arrows[i].allocate(childBox, flags); - } - } - }, - // We override SwitcherList's _onItemEnter method to delay // activation when the thumbnail list is open _onItemEnter: function (index) { @@ -861,31 +838,9 @@ AppList.prototype = { this._itemEntered(index); }, - // We override SwitcherList's highlight() method to also deal with - // the AppList->ThumbnailList arrows. - highlight : function(n, justOutline) { - if (this._curApp != -1) { - this._arrows[this._curApp].hide(); - } - - SwitcherList.prototype.highlight.call(this, n, justOutline); - this._curApp = n; - - if (n != -1 && this._showArrows) { - this._arrows[n].show(); - } - }, - _addIcon : function(appIcon) { this.icons.push(appIcon); this.addItem(appIcon.actor, appIcon.label); - - let n = this._arrows.length; - let arrow = new St.DrawingArea({ style_class: 'switcher-arrow' }); - arrow.connect('repaint', function() { _drawArrow(arrow, St.Side.BOTTOM); }); - this._list.add_actor(arrow); - this._arrows.push(arrow); - arrow.hide(); } };