Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow user to set workspace OSD timeout duration #12093

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions data/org.cinnamon.gschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,14 @@
</description>
</key>

<key name="workspace-osd-timeout" type="d">
<default>0.8</default>
<summary>Set the workspace OSD timeout length, in seconds.</summary>
<description>
How long the name of the workspace is shown on the screen when activated.
</description>
</key>

<key name="workspace-expo-view-as-grid" type="b">
<default>false</default>
<summary>Display the Expo view as a grid</summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ def on_module_selected(self):
switch = GSettingsSwitch(_("Enable workspace OSD"), "org.cinnamon", "workspace-osd-visible")
settings.add_row(switch)

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.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)

Expand Down
10 changes: 6 additions & 4 deletions js/ui/windowManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -254,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");

Expand Down Expand Up @@ -394,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) {
Expand Down Expand Up @@ -1256,9 +1258,9 @@ var WindowManager = class WindowManager {

osd.actor.ease({
z_position: -.0001,
duration: WORKSPACE_OSD_TIMEOUT * EASING_MULTIPLIER,
duration: this.workspace_osd_ease_duration * EASING_MULTIPLIER,
onComplete: () => this._hideWorkspaceOSD()
})
});
}

_hideWorkspaceOSD(now = false) {
Expand All @@ -1273,7 +1275,7 @@ var WindowManager = class WindowManager {
osd.actor.opacity = 255;
osd.actor.ease({
opacity: 0,
duration: WORKSPACE_OSD_TIMEOUT * EASING_MULTIPLIER,
duration: this.workspace_osd_ease_duration * EASING_MULTIPLIER,
mode: Clutter.AnimationMode.LINEAR,
onStopped: () => osd.destroy()
});
Expand Down