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 8619f634a0..32403bca66 100644 --- a/js/ui/appSwitcher/classicSwitcher.js +++ b/js/ui/appSwitcher/classicSwitcher.js @@ -29,7 +29,12 @@ 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 iconMinSize = 32; // minimum size of the icons in icon-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 pt function mod(a, b) { return (a + b) % b; @@ -68,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)); @@ -415,28 +421,27 @@ AppIcon.prototype = { vertical: true }); this.icon = null; this._iconBin = new St.Bin(); + 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 } ); 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 ); } + bin.add_actor(this.label, { x_fill: false }); + this.actor.add(bin); }, set_size: function(size) { @@ -458,6 +463,12 @@ AppIcon.prototype = { icon_type: St.IconType.FULLCOLOR, icon_size: size }); } + + 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 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); size *= global.ui_scale; this._iconBin.set_size(size, size); this._iconBin.child = this.icon; @@ -780,6 +791,7 @@ AppList.prototype = { this._showArrows = showArrows; this._mouseTimeOutId = 0; this._activeMonitor = activeMonitor; + this._showThumbnails = showThumbnails; }, _getPreferredHeight: function (actor, forWidth, alloc) { @@ -803,19 +815,20 @@ 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) - break; - } - if (this._items.length == 1) { - this._iconSize = iconSizes[0]; - height = (iconSizes[0] * global.ui_scale) + iconSpacing; - } + if (this._showThumbnails) { + if (this._items.length == 1) { + this._iconSize = thumbnailMaxSize; + } else { + this._iconSize = Math.min((availWidth / this._items.length) - iconSpacing, thumbnailMaxSize); + this._iconSize = Math.max(this._iconSize, thumbnailMinSize); + } + } else { + this._iconSize = Math.max(this._activeMonitor.width / 14, iconMinHeight); + } + height = this._iconSize + iconSpacing; + this._iconSize /= global.ui_scale; - 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);