Skip to content

Commit

Permalink
Alt-tab: Remove the down arrow from the swithcer layout
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
JosephMcc committed Sep 22, 2024
1 parent 1a710ec commit ecbd7de
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 55 deletions.
32 changes: 26 additions & 6 deletions data/theme/cinnamon-sass/widgets/_alttab.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
&:outlined { border-color: red; }
&:selected {
border-color: $borders_color;
background-color: $base_color
background-color: $light_bg_color
}
}

Expand All @@ -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;
}
}
53 changes: 4 additions & 49 deletions js/ui/appSwitcher/classicSwitcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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() {

Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -777,7 +776,6 @@ AppList.prototype = {

this._curApp = -1;
this._iconSize = 0;
this._showArrows = showArrows;
this._mouseTimeOutId = 0;
this._activeMonitor = activeMonitor;
},
Expand Down Expand Up @@ -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) {
Expand All @@ -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();
}
};

Expand Down

0 comments on commit ecbd7de

Please sign in to comment.