From 400361a4cf3c2e24bbcbc451d20e3c29e42dfa59 Mon Sep 17 00:00:00 2001 From: zipzorp Date: Fri, 2 Jun 2023 19:03:08 -0500 Subject: [PATCH 1/9] Update classicSwitcher.js Added dynamic thumbnail sizing for thumbnail-only alt+tab window selector. Improved icon sizing for icon-only alt+tab window selector. --- js/ui/appSwitcher/classicSwitcher.js | 38 ++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/js/ui/appSwitcher/classicSwitcher.js b/js/ui/appSwitcher/classicSwitcher.js index 8619f634a0..36939cc21e 100644 --- a/js/ui/appSwitcher/classicSwitcher.js +++ b/js/ui/appSwitcher/classicSwitcher.js @@ -29,7 +29,10 @@ const THUMBNAIL_FADE_TIME = 0.1; // seconds const PREVIEW_DELAY_TIMEOUT = 0; // milliseconds var PREVIEW_SWITCHER_FADEOUT_TIME = 0.2; // seconds -const iconSizes = [96, 64, 48]; +const iconSizes = [256, 128, 64]; + +const thumbnailMaxSize = 1000; // maximum size of thumbnail in the thumbnail-only alt+tab window selector +const thumbnailMinSize = 100; // minimum size of thumbnail in the thumbnail-only alt+tab window selector function mod(a, b) { return (a + b) % b; @@ -803,19 +806,32 @@ AppList.prototype = { let availWidth = this._activeMonitor.width - parentPadding - this.actor.get_theme_node().get_horizontal_padding(); let height = 0; - for(let i = 0; i < iconSizes.length; i++) { - this._iconSize = iconSizes[i]; - height = (iconSizes[i] * global.ui_scale) + iconSpacing; - let w = height * this._items.length + totalSpacing; - if (w <= availWidth) + if (this._showThumbnails) { + if (this._items.length == 1) { + this._iconSize = thumbnailMaxSize; + height = (thumbnailMaxSize * global.ui_scale) + iconSpacing; + } else { + this._iconSize = Math.min((availWidth / this._items.length) - iconSpacing, thumbnailMaxSize); + this._iconSize = Math.max(this._iconSize, thumbnailMinSize); + height = this._iconSize * global.ui_scale; + } + } else { + if (this._items.length == 1) { + this._iconSize = iconSizes[0]; + height = (iconSizes[0] * global.ui_scale) + iconSpacing; + } else { + for (let i = 0; i < iconSizes.length; i++) { + this._iconSize = iconSizes[i]; + height = (iconSizes[i] * global.ui_scale) + iconSpacing; + let w = height * this._items.length + totalSpacing; + if (w <= availWidth) break; + } + } } - if (this._items.length == 1) { - this._iconSize = iconSizes[0]; - height = (iconSizes[0] * global.ui_scale) + iconSpacing; - } - for(let i = 0; i < this.icons.length; i++) { + + for (let i = 0; i < this.icons.length; i++) { if (this.icons[i].icon != null) break; this.icons[i].set_size(this._iconSize); From 3947bd720c0788a0d16a4277fed707c7bdfdd685 Mon Sep 17 00:00:00 2001 From: x1 Date: Mon, 5 Jun 2023 15:38:14 -0500 Subject: [PATCH 2/9] Fixed icon sizing. --- js/ui/appSwitcher/classicSwitcher.js | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/js/ui/appSwitcher/classicSwitcher.js b/js/ui/appSwitcher/classicSwitcher.js index 36939cc21e..d07ba7c143 100644 --- a/js/ui/appSwitcher/classicSwitcher.js +++ b/js/ui/appSwitcher/classicSwitcher.js @@ -29,7 +29,7 @@ const THUMBNAIL_FADE_TIME = 0.1; // seconds const PREVIEW_DELAY_TIMEOUT = 0; // milliseconds var PREVIEW_SWITCHER_FADEOUT_TIME = 0.2; // seconds -const iconSizes = [256, 128, 64]; +const iconMinSize = 64; // minimum size of the icons in icon-only alt+tab window selector const thumbnailMaxSize = 1000; // maximum size of thumbnail in the thumbnail-only alt+tab window selector const thumbnailMinSize = 100; // minimum size of thumbnail in the thumbnail-only alt+tab window selector @@ -783,6 +783,7 @@ AppList.prototype = { this._showArrows = showArrows; this._mouseTimeOutId = 0; this._activeMonitor = activeMonitor; + this._showThumbnails = showThumbnails; }, _getPreferredHeight: function (actor, forWidth, alloc) { @@ -816,18 +817,8 @@ AppList.prototype = { height = this._iconSize * global.ui_scale; } } else { - if (this._items.length == 1) { - this._iconSize = iconSizes[0]; - height = (iconSizes[0] * global.ui_scale) + iconSpacing; - } else { - for (let i = 0; i < iconSizes.length; i++) { - this._iconSize = iconSizes[i]; - height = (iconSizes[i] * global.ui_scale) + iconSpacing; - let w = height * this._items.length + totalSpacing; - if (w <= availWidth) - break; - } - } + this._iconSize = Math.max(this._activeMonitor.width / 14, iconMinHeight); + height = (this._iconSize * global.ui_scale) + iconSpacing; } From 04dfef72c86ee6abc7eec51ee54fb6278962fb97 Mon Sep 17 00:00:00 2001 From: x1 Date: Mon, 5 Jun 2023 18:10:34 -0500 Subject: [PATCH 3/9] Improved label text sizing --- js/ui/appSwitcher/classicSwitcher.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/js/ui/appSwitcher/classicSwitcher.js b/js/ui/appSwitcher/classicSwitcher.js index d07ba7c143..3c2f3f73eb 100644 --- a/js/ui/appSwitcher/classicSwitcher.js +++ b/js/ui/appSwitcher/classicSwitcher.js @@ -418,28 +418,28 @@ AppIcon.prototype = { vertical: true }); this.icon = null; this._iconBin = new St.Bin(); + this.label = new St.Label(); + let bin = new St.Bin({ x_align: St.Align.MIDDLE }); this.actor.add(this._iconBin, { x_fill: false, y_fill: false } ); let title = window.get_title(); if (title) { if (window.minimized) { - this.label = new St.Label({ text: "[" + title + "]"}); + this.label.set_text("[" + title + "]"); let contrast_effect = new Clutter.BrightnessContrastEffect(); contrast_effect.set_brightness_full(-0.5, -0.5, -0.5); this._iconBin.add_effect(contrast_effect); } else { - this.label = new St.Label({ text: title }); + this.label.set_text(title); } - - let bin = new St.Bin({ x_align: St.Align.MIDDLE }); - bin.add_actor(this.label); - this.actor.add(bin); } else { - this.label = new St.Label({ text: this.app ? this.app.get_name() : window.title }); - this.actor.add(this.label, { x_fill: false }); + this.label.set_text(this.app ? this.app.get_name() : window.title ); + // this.actor.add(this.label, { x_fill: false }); } + bin.add_actor(this.label, { x_fill: false }); + this.actor.add(bin); }, set_size: function(size) { @@ -464,6 +464,8 @@ AppIcon.prototype = { size *= global.ui_scale; this._iconBin.set_size(size, size); this._iconBin.child = this.icon; + this.fontSize = Math.max(size / 16, 14 * global.ui_scale); + this.label.set_style("font-size: " + this.fontSize + "px;"); } }; @@ -814,7 +816,7 @@ AppList.prototype = { } else { this._iconSize = Math.min((availWidth / this._items.length) - iconSpacing, thumbnailMaxSize); this._iconSize = Math.max(this._iconSize, thumbnailMinSize); - height = this._iconSize * global.ui_scale; + height = (this._iconSize * global.ui_scale) + iconSpacing; } } else { this._iconSize = Math.max(this._activeMonitor.width / 14, iconMinHeight); From 2c0629a40e8e98cf61a1bb1e99fe04d89461e7eb Mon Sep 17 00:00:00 2001 From: x1 Date: Mon, 5 Jun 2023 19:37:01 -0500 Subject: [PATCH 4/9] dynamic label font sizing --- js/ui/appSwitcher/classicSwitcher.js | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/js/ui/appSwitcher/classicSwitcher.js b/js/ui/appSwitcher/classicSwitcher.js index 3c2f3f73eb..2f485631b3 100644 --- a/js/ui/appSwitcher/classicSwitcher.js +++ b/js/ui/appSwitcher/classicSwitcher.js @@ -418,7 +418,7 @@ AppIcon.prototype = { vertical: true }); this.icon = null; this._iconBin = new St.Bin(); - this.label = new St.Label(); + this.label = new St.Label({text: " "}); let bin = new St.Bin({ x_align: St.Align.MIDDLE }); this.actor.add(this._iconBin, { x_fill: false, y_fill: false } ); @@ -461,11 +461,13 @@ AppIcon.prototype = { icon_type: St.IconType.FULLCOLOR, icon_size: size }); } + this.fontSize = Math.max(size / 16, 14); + this.fontSize = Math.min(this.fontSize, 32); + this.label.set_style("font-size: " + this.fontSize + "px;"); + this.label.set_height(this.fontSize * 1.2 + this.bottomPadding); size *= global.ui_scale; this._iconBin.set_size(size, size); this._iconBin.child = this.icon; - this.fontSize = Math.max(size / 16, 14 * global.ui_scale); - this.label.set_style("font-size: " + this.fontSize + "px;"); } }; @@ -812,17 +814,20 @@ AppList.prototype = { if (this._showThumbnails) { if (this._items.length == 1) { this._iconSize = thumbnailMaxSize; - height = (thumbnailMaxSize * global.ui_scale) + iconSpacing; + height = thumbnailMaxSize; + // height = (thumbnailMaxSize / global.ui_scale) + iconSpacing; } else { this._iconSize = Math.min((availWidth / this._items.length) - iconSpacing, thumbnailMaxSize); this._iconSize = Math.max(this._iconSize, thumbnailMinSize); - height = (this._iconSize * global.ui_scale) + iconSpacing; + height = this._iconSize; } } else { this._iconSize = Math.max(this._activeMonitor.width / 14, iconMinHeight); - height = (this._iconSize * global.ui_scale) + iconSpacing; - } - + height = this._iconSize; + } + // height *= global.ui_scale; + height += iconSpacing; + this._iconSize /= global.ui_scale; for (let i = 0; i < this.icons.length; i++) { if (this.icons[i].icon != null) From c758804634291d31b605a20837e04b661267e80f Mon Sep 17 00:00:00 2001 From: x1 Date: Mon, 5 Jun 2023 19:40:30 -0500 Subject: [PATCH 5/9] comment cleanup --- js/ui/appSwitcher/classicSwitcher.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/js/ui/appSwitcher/classicSwitcher.js b/js/ui/appSwitcher/classicSwitcher.js index 2f485631b3..ed94b53809 100644 --- a/js/ui/appSwitcher/classicSwitcher.js +++ b/js/ui/appSwitcher/classicSwitcher.js @@ -29,10 +29,10 @@ const THUMBNAIL_FADE_TIME = 0.1; // seconds const PREVIEW_DELAY_TIMEOUT = 0; // milliseconds var PREVIEW_SWITCHER_FADEOUT_TIME = 0.2; // seconds -const iconMinSize = 64; // minimum size of the icons in icon-only alt+tab window selector +const iconMinSize = 32; // minimum size of the icons in icon-only alt+tab window selector const thumbnailMaxSize = 1000; // maximum size of thumbnail in the thumbnail-only alt+tab window selector -const thumbnailMinSize = 100; // minimum size of thumbnail in the thumbnail-only alt+tab window selector +const thumbnailMinSize = 64; // minimum size of thumbnail in the thumbnail-only alt+tab window selector function mod(a, b) { return (a + b) % b; @@ -436,7 +436,6 @@ AppIcon.prototype = { } else { this.label.set_text(this.app ? this.app.get_name() : window.title ); - // this.actor.add(this.label, { x_fill: false }); } bin.add_actor(this.label, { x_fill: false }); this.actor.add(bin); @@ -815,7 +814,6 @@ AppList.prototype = { if (this._items.length == 1) { this._iconSize = thumbnailMaxSize; height = thumbnailMaxSize; - // height = (thumbnailMaxSize / global.ui_scale) + iconSpacing; } else { this._iconSize = Math.min((availWidth / this._items.length) - iconSpacing, thumbnailMaxSize); this._iconSize = Math.max(this._iconSize, thumbnailMinSize); @@ -825,7 +823,6 @@ AppList.prototype = { this._iconSize = Math.max(this._activeMonitor.width / 14, iconMinHeight); height = this._iconSize; } - // height *= global.ui_scale; height += iconSpacing; this._iconSize /= global.ui_scale; From 86e90f7889bae5ec31ad290339d45f1ababcb13a Mon Sep 17 00:00:00 2001 From: x1 Date: Mon, 5 Jun 2023 20:13:30 -0500 Subject: [PATCH 6/9] Simplified height calc, increased min font size --- js/ui/appSwitcher/classicSwitcher.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/js/ui/appSwitcher/classicSwitcher.js b/js/ui/appSwitcher/classicSwitcher.js index ed94b53809..10c4257baa 100644 --- a/js/ui/appSwitcher/classicSwitcher.js +++ b/js/ui/appSwitcher/classicSwitcher.js @@ -460,8 +460,9 @@ AppIcon.prototype = { icon_type: St.IconType.FULLCOLOR, icon_size: size }); } - this.fontSize = Math.max(size / 16, 14); + this.fontSize = Math.max(size / 16, 16); this.fontSize = Math.min(this.fontSize, 32); + this.fontSize *= global.ui_scale; this.label.set_style("font-size: " + this.fontSize + "px;"); this.label.set_height(this.fontSize * 1.2 + this.bottomPadding); size *= global.ui_scale; @@ -813,17 +814,14 @@ AppList.prototype = { if (this._showThumbnails) { if (this._items.length == 1) { this._iconSize = thumbnailMaxSize; - height = thumbnailMaxSize; } else { this._iconSize = Math.min((availWidth / this._items.length) - iconSpacing, thumbnailMaxSize); this._iconSize = Math.max(this._iconSize, thumbnailMinSize); - height = this._iconSize; } } else { this._iconSize = Math.max(this._activeMonitor.width / 14, iconMinHeight); - height = this._iconSize; } - height += iconSpacing; + height = this._iconSize + iconSpacing; this._iconSize /= global.ui_scale; for (let i = 0; i < this.icons.length; i++) { From 3e0efcba0dacfb6c5cc6606916d30d0d6be6e715 Mon Sep 17 00:00:00 2001 From: x1 Date: Tue, 6 Jun 2023 12:01:55 -0500 Subject: [PATCH 7/9] adjusted max/min font size --- js/ui/appSwitcher/classicSwitcher.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/js/ui/appSwitcher/classicSwitcher.js b/js/ui/appSwitcher/classicSwitcher.js index 10c4257baa..00f98fc94f 100644 --- a/js/ui/appSwitcher/classicSwitcher.js +++ b/js/ui/appSwitcher/classicSwitcher.js @@ -460,9 +460,9 @@ AppIcon.prototype = { icon_type: St.IconType.FULLCOLOR, icon_size: size }); } - this.fontSize = Math.max(size / 16, 16); - this.fontSize = Math.min(this.fontSize, 32); - this.fontSize *= global.ui_scale; + this.fontSize = Math.max(size / 20, 10); // allow font no smaller than 12 pt + this.fontSize = Math.min(this.fontSize, 26); // allow font no larger than 32 pt + this.fontSize *= global.ui_scale; // scale fonts for ui scale this.label.set_style("font-size: " + this.fontSize + "px;"); this.label.set_height(this.fontSize * 1.2 + this.bottomPadding); size *= global.ui_scale; From 14b061b0ebff2342e2a550f03b8deceb5784405c Mon Sep 17 00:00:00 2001 From: x1 Date: Tue, 6 Jun 2023 21:27:47 -0500 Subject: [PATCH 8/9] added settings for min font size and max thumb sz --- .gitignore | 1 + data/org.cinnamon.gschema.xml | 10 ++++++++++ .../cinnamon-settings/modules/cs_windows.py | 10 ++++++++-- js/ui/appSwitcher/classicSwitcher.js | 16 ++++++++++------ 4 files changed, 29 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 8f66827a0f..f0874c1c81 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ debian/files debian/tmp/ obj-x86_64-linux-gnu *.pyc +sync_files.sh diff --git a/data/org.cinnamon.gschema.xml b/data/org.cinnamon.gschema.xml index edd5104a50..859aa16300 100644 --- a/data/org.cinnamon.gschema.xml +++ b/data/org.cinnamon.gschema.xml @@ -434,6 +434,16 @@ Warp mouse pointer to the new focused window + + 12 + The minimum font size for the alt-tab switcher + + + + 1000 + The maximum size of thumbnails in the "Thumbnails only" alt-tab switcher + + false not used - lives in org.cinnamon.muffin now diff --git a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_windows.py b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_windows.py index a7780471fb..33da9b7c4f 100755 --- a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_windows.py +++ b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_windows.py @@ -176,8 +176,14 @@ def update_setting(widget, pspec): widget = GSettingsSpinButton(_("Delay before displaying the alt-tab switcher"), "org.cinnamon", "alttab-switcher-delay", units=_("milliseconds"), mini=0, maxi=1000, step=50, page=150) settings.add_row(widget) - widget = GSettingsSwitch(_("Show windows from all workspaces"), "org.cinnamon", "alttab-switcher-show-all-workspaces") + widget = GSettingsSpinButton(_("The minimum text size for the alt-tab switcher"), "org.cinnamon", "alttab-switcher-text-minimum-size", units=_("pt"), mini=4, maxi=128, step=1) settings.add_row(widget) - widget = GSettingsSwitch(_("Warp mouse pointer to the new focused window"), "org.cinnamon", "alttab-switcher-warp-mouse-pointer") + widget = GSettingsSpinButton(_("Maximum size of thumbnails in thumbnail-only alt-tab switcher"), "org.cinnamon", "alttab-switcher-thumbnail-maximum-size", units=_("px"), mini=32, maxi=2000, step=20) settings.add_row(widget) + + widget = GSettingsSwitch(_("Show windows from all workspaces"), "org.cinnamon", "alttab-switcher-show-all-workspaces") + settings.add_row(widget) + + # widget = GSettingsSwitch(_("Warp mouse pointer to the new focused window"), "org.cinnamon", "alttab-switcher-warp-mouse-pointer") + # settings.add_row(widget) diff --git a/js/ui/appSwitcher/classicSwitcher.js b/js/ui/appSwitcher/classicSwitcher.js index 00f98fc94f..b9d4e3f477 100644 --- a/js/ui/appSwitcher/classicSwitcher.js +++ b/js/ui/appSwitcher/classicSwitcher.js @@ -31,8 +31,10 @@ var PREVIEW_SWITCHER_FADEOUT_TIME = 0.2; // seconds const iconMinSize = 32; // minimum size of the icons in icon-only alt+tab window selector -const thumbnailMaxSize = 1000; // maximum size of thumbnail in the thumbnail-only alt+tab window selector -const thumbnailMinSize = 64; // minimum size of thumbnail in the thumbnail-only alt+tab window selector +var thumbnailMaxSize = 1000; // maximum size of thumbnail in the thumbnail-only alt+tab window selector +const thumbnailMinSize = 32; // minimum size of thumbnail in the thumbnail-only alt+tab window selector + +var fontMinSize = 12; // minimum size of dynamically-sized fonts, in px function mod(a, b) { return (a + b) % b; @@ -71,7 +73,8 @@ ClassicSwitcher.prototype = { this._showThumbnails = this._thumbnailsEnabled && !this._iconsEnabled; this._showArrows = this._thumbnailsEnabled && this._iconsEnabled; - + fontMinSize = global.settings.get_int("alttab-switcher-text-minimum-size"); + thumbnailMaxSize = global.settings.get_int("alttab-switcher-thumbnail-maximum-size"); this._updateList(0); this.actor.connect('get-preferred-width', Lang.bind(this, this._getPreferredWidth)); @@ -460,10 +463,11 @@ AppIcon.prototype = { icon_type: St.IconType.FULLCOLOR, icon_size: size }); } - this.fontSize = Math.max(size / 20, 10); // allow font no smaller than 12 pt - this.fontSize = Math.min(this.fontSize, 26); // allow font no larger than 32 pt + + this.fontSize = Math.max(size / 24, fontMinSize); // allow font no smaller than 12 pt + this.fontSize = Math.min(this.fontSize, 20); // allow font no larger than 26 pt this.fontSize *= global.ui_scale; // scale fonts for ui scale - this.label.set_style("font-size: " + this.fontSize + "px;"); + this.label.set_style("font-size: " + this.fontSize + "pt;"); this.label.set_height(this.fontSize * 1.2 + this.bottomPadding); size *= global.ui_scale; this._iconBin.set_size(size, size); From 258c7f9a388a8bca07798384e9a5cfa624d40b43 Mon Sep 17 00:00:00 2001 From: x1 Date: Tue, 6 Jun 2023 23:22:13 -0500 Subject: [PATCH 9/9] clean up; rc --- js/ui/appSwitcher/classicSwitcher.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/ui/appSwitcher/classicSwitcher.js b/js/ui/appSwitcher/classicSwitcher.js index b9d4e3f477..32403bca66 100644 --- a/js/ui/appSwitcher/classicSwitcher.js +++ b/js/ui/appSwitcher/classicSwitcher.js @@ -34,7 +34,7 @@ const iconMinSize = 32; // minimum size of the icons in icon-only alt+tab window var thumbnailMaxSize = 1000; // maximum size of thumbnail in the thumbnail-only alt+tab window selector const thumbnailMinSize = 32; // minimum size of thumbnail in the thumbnail-only alt+tab window selector -var fontMinSize = 12; // minimum size of dynamically-sized fonts, in px +var fontMinSize = 12; // minimum size of dynamically-sized fonts, in pt function mod(a, b) { return (a + b) % b; @@ -465,7 +465,7 @@ AppIcon.prototype = { } this.fontSize = Math.max(size / 24, fontMinSize); // allow font no smaller than 12 pt - this.fontSize = Math.min(this.fontSize, 20); // allow font no larger than 26 pt + this.fontSize = Math.min(this.fontSize, 20); // allow font no larger than 20 pt this.fontSize *= global.ui_scale; // scale fonts for ui scale this.label.set_style("font-size: " + this.fontSize + "pt;"); this.label.set_height(this.fontSize * 1.2 + this.bottomPadding);