From 5723c8aa62d541c133626b0ef220898ff18b2453 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciar=C3=A1n=20McKenna?= Date: Sat, 24 Feb 2024 18:22:50 +0100 Subject: [PATCH 1/5] windowManager.js: Get workspace-osd-timeout from gsettings --- js/ui/windowManager.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js index 9901ccaef4..50ccf273ff 100644 --- a/js/ui/windowManager.js +++ b/js/ui/windowManager.js @@ -30,7 +30,6 @@ const EASING_MULTIPLIER = 1000; // multiplier for tweening.time ---> easing.dura const DIM_TIME = 0.500; const DIM_BRIGHTNESS = -0.2; const UNDIM_TIME = 0.250; -const WORKSPACE_OSD_TIMEOUT = 0.4; /* edge zones for tiling/snapping identification copied from muffin/src/core/window-private.h @@ -1256,9 +1255,9 @@ var WindowManager = class WindowManager { osd.actor.ease({ z_position: -.0001, - duration: WORKSPACE_OSD_TIMEOUT * EASING_MULTIPLIER, + duration: global.settings.get_double('workspace-osd-timeout') * EASING_MULTIPLIER / 2, // divide by 2 as timeout is ease-in + ease-out onComplete: () => this._hideWorkspaceOSD() - }) + }); } _hideWorkspaceOSD(now = false) { @@ -1273,7 +1272,7 @@ var WindowManager = class WindowManager { osd.actor.opacity = 255; osd.actor.ease({ opacity: 0, - duration: WORKSPACE_OSD_TIMEOUT * EASING_MULTIPLIER, + duration: global.settings.get_double('workspace-osd-timeout') * EASING_MULTIPLIER / 2, // divide by 2 as timeout is ease-in + ease-out mode: Clutter.AnimationMode.LINEAR, onStopped: () => osd.destroy() }); From 67b61a182b07de98ea2aa1301caf90a8739691be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciar=C3=A1n=20McKenna?= Date: Sat, 24 Feb 2024 18:23:12 +0100 Subject: [PATCH 2/5] org.cinnamon.gschema.xml: Add definition for workspace-osd-timeout --- data/org.cinnamon.gschema.xml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/data/org.cinnamon.gschema.xml b/data/org.cinnamon.gschema.xml index edd5104a50..e7c1784076 100644 --- a/data/org.cinnamon.gschema.xml +++ b/data/org.cinnamon.gschema.xml @@ -351,6 +351,14 @@ + + 0.8 + Set the workspace OSD timeout length, in seconds. + + How long the name of the workspace is shown on the screen when activated. + + + false Display the Expo view as a grid From 739dc3451bd2ad05e36956b09151d46ecec2c3d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciar=C3=A1n=20McKenna?= Date: Sat, 24 Feb 2024 18:24:19 +0100 Subject: [PATCH 3/5] cs_workspaces.py: Add slider for changing workspace-osd-timeout --- .../cinnamon-settings/modules/cs_workspaces.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_workspaces.py b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_workspaces.py index 0a5709d6e3..7a637f8422 100755 --- a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_workspaces.py +++ b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_workspaces.py @@ -29,6 +29,15 @@ def on_module_selected(self): switch = GSettingsSwitch(_("Enable workspace OSD"), "org.cinnamon", "workspace-osd-visible") settings.add_row(switch) + slider = GSettingsRange(_("Workspace OSD timeout"), "org.cinnamon", "workspace-osd-timeout", _("Shorter"), _("Longer"), mini=0.0, maxi=1.0, step=0.2, show_value=True) + slider.content_widget.set_has_origin(False) + slider.content_widget.add_mark(0.2, Gtk.PositionType.TOP, None) + slider.content_widget.add_mark(0.4, Gtk.PositionType.TOP, None) + slider.content_widget.add_mark(0.6, Gtk.PositionType.TOP, None) + slider.content_widget.add_mark(0.8, Gtk.PositionType.TOP, None) + + settings.add_reveal_row(slider, "org.cinnamon", "workspace-osd-visible") + switch = GSettingsSwitch(_("Allow cycling through workspaces"), "org.cinnamon.muffin", "workspace-cycle") settings.add_row(switch) @@ -38,6 +47,7 @@ def on_module_selected(self): switch = GSettingsSwitch(_("Display Expo view as a grid"), "org.cinnamon", "workspace-expo-view-as-grid") settings.add_row(switch) + # Edge Flip doesn't work well, so it's there in gsettings, but we don't show it to users yet # switch = GSettingsSwitch(_("Enable Edge Flip"), "org.cinnamon", "enable-edge-flip") # settings.add_row(switch) From 8adbfebf617798daf46815ca2a66b7ea5368bd1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciar=C3=A1n=20McKenna?= Date: Mon, 26 Feb 2024 15:12:36 +0100 Subject: [PATCH 4/5] cs_workspaces.py: Remove value 0 and rename title --- .../share/cinnamon/cinnamon-settings/modules/cs_workspaces.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_workspaces.py b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_workspaces.py index 7a637f8422..84f6d06ad3 100755 --- a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_workspaces.py +++ b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_workspaces.py @@ -29,9 +29,8 @@ def on_module_selected(self): switch = GSettingsSwitch(_("Enable workspace OSD"), "org.cinnamon", "workspace-osd-visible") settings.add_row(switch) - slider = GSettingsRange(_("Workspace OSD timeout"), "org.cinnamon", "workspace-osd-timeout", _("Shorter"), _("Longer"), mini=0.0, maxi=1.0, step=0.2, show_value=True) + slider = GSettingsRange(_("Workspace OSD duration"), "org.cinnamon", "workspace-osd-timeout", _("Shorter"), _("Longer"), mini=0.2, maxi=1.0, step=0.2, show_value=True) slider.content_widget.set_has_origin(False) - slider.content_widget.add_mark(0.2, Gtk.PositionType.TOP, None) slider.content_widget.add_mark(0.4, Gtk.PositionType.TOP, None) slider.content_widget.add_mark(0.6, Gtk.PositionType.TOP, None) slider.content_widget.add_mark(0.8, Gtk.PositionType.TOP, None) @@ -47,7 +46,6 @@ def on_module_selected(self): switch = GSettingsSwitch(_("Display Expo view as a grid"), "org.cinnamon", "workspace-expo-view-as-grid") settings.add_row(switch) - # Edge Flip doesn't work well, so it's there in gsettings, but we don't show it to users yet # switch = GSettingsSwitch(_("Enable Edge Flip"), "org.cinnamon", "enable-edge-flip") # settings.add_row(switch) From 1af62c1e99bff9ee46d67ba4294b67983f12639e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciar=C3=A1n=20McKenna?= Date: Mon, 26 Feb 2024 15:14:43 +0100 Subject: [PATCH 5/5] windowManager.js: Simplify workspace-osd-timeout usage --- js/ui/windowManager.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js index 50ccf273ff..f8b7dcdb06 100644 --- a/js/ui/windowManager.js +++ b/js/ui/windowManager.js @@ -253,6 +253,7 @@ var WindowManager = class WindowManager { global.settings.connect('changed::desktop-effects-map', this.onSettingsChanged.bind(this)); global.settings.connect('changed::desktop-effects-minimize', this.onSettingsChanged.bind(this)); global.settings.connect('changed::window-effect-speed', this.onSettingsChanged.bind(this)); + global.settings.connect('changed::workspace-osd-timeout', this.onSettingsChanged.bind(this)); this.onSettingsChanged(global.settings, "desktop-effects-workspace"); @@ -393,6 +394,8 @@ var WindowManager = class WindowManager { this.desktop_effects_minimize_type = global.settings.get_string("desktop-effects-minimize"); this.window_effect_multiplier = WINDOW_ANIMATION_TIME_MULTIPLIERS[global.settings.get_int("window-effect-speed")]; + + this.workspace_osd_ease_duration = global.settings.get_double("workspace-osd-timeout") / 2; // divided by 2 as timeout is fade-in + fade-out } _shouldAnimate(actor, types=null) { @@ -1255,7 +1258,7 @@ var WindowManager = class WindowManager { osd.actor.ease({ z_position: -.0001, - duration: global.settings.get_double('workspace-osd-timeout') * EASING_MULTIPLIER / 2, // divide by 2 as timeout is ease-in + ease-out + duration: this.workspace_osd_ease_duration * EASING_MULTIPLIER, onComplete: () => this._hideWorkspaceOSD() }); } @@ -1272,7 +1275,7 @@ var WindowManager = class WindowManager { osd.actor.opacity = 255; osd.actor.ease({ opacity: 0, - duration: global.settings.get_double('workspace-osd-timeout') * EASING_MULTIPLIER / 2, // divide by 2 as timeout is ease-in + ease-out + duration: this.workspace_osd_ease_duration * EASING_MULTIPLIER, mode: Clutter.AnimationMode.LINEAR, onStopped: () => osd.destroy() });