From d2b969d15722462244e2f32eff19e2e507b40f14 Mon Sep 17 00:00:00 2001 From: Charles Gagnon Date: Fri, 24 May 2019 18:17:13 -0400 Subject: [PATCH] Add setting to define previews animation time --- Settings.ui | 49 +++++++++++++++++++ prefs.js | 10 +++- ...shell.extensions.dash-to-panel.gschema.xml | 9 +++- windowPreview.js | 5 +- 4 files changed, 68 insertions(+), 5 deletions(-) diff --git a/Settings.ui b/Settings.ui index 4fa4f91..add7730 100644 --- a/Settings.ui +++ b/Settings.ui @@ -2158,6 +2158,11 @@ 10 25 + + 1000 + 10 + 50 + 50 500 @@ -2290,6 +2295,50 @@ + + + True + True + + + True + False + 12 + 12 + 12 + 12 + 32 + + + True + False + True + Animation time (ms) + 0 + + + 0 + 0 + + + + + True + True + 4 + 0 + preview_animation_time_adjustment + True + + + 1 + 0 + + + + + + True diff --git a/prefs.js b/prefs.js index 937ff94..37ad7ec 100644 --- a/prefs.js +++ b/prefs.js @@ -1061,6 +1061,11 @@ const Settings = new Lang.Class({ this._settings.set_int('leave-timeout', widget.get_value()); })); + this._builder.get_object('animation_time_spinbutton').set_value(this._settings.get_int('window-preview-animation-time')); + this._builder.get_object('animation_time_spinbutton').connect('value-changed', Lang.bind (this, function(widget) { + this._settings.set_int('window-preview-animation-time', widget.get_value()); + })); + this._builder.get_object('peek_mode_opacity_spinbutton').set_value(this._settings.get_int('peek-mode-opacity')); this._builder.get_object('peek_mode_opacity_spinbutton').connect('value-changed', Lang.bind (this, function(widget) { this._settings.set_int('peek-mode-opacity', widget.get_value()); @@ -1099,7 +1104,10 @@ const Settings = new Lang.Class({ this._builder.get_object('preview_timeout_spinbutton').set_value(this._settings.get_int('show-window-previews-timeout')); this._settings.set_value('leave-timeout', this._settings.get_default_value('leave-timeout')); - this._builder.get_object('leave_timeout_spinbutton').set_value(this._settings.get_int('leave-timeout')); + this._builder.get_object('leave_timeout_spinbutton').set_value(this._settings.get_int('leave-timeout')); + + this._settings.set_value('window-preview-animation-time', this._settings.get_default_value('window-preview-animation-time')); + this._builder.get_object('animation_time_spinbutton').set_value(this._settings.get_int('window-preview-animation-time')); this._settings.set_value('peek-mode', this._settings.get_default_value('peek-mode')); this._settings.set_value('window-preview-show-title', this._settings.get_default_value('window-preview-show-title')); diff --git a/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml b/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml index fdcf2dd..f44ada9 100644 --- a/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml +++ b/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml @@ -413,12 +413,17 @@ "#dddddd" Window previews title font color - This defines the Window previews titles font color. + This defines the window preview titles font color. 14 Window previews title font size - This defines the Window previews titles font size. + This defines the window preview titles font size. + + + 300 + Window previews animation time + This defines the window previews animation time. 'inherit' diff --git a/windowPreview.js b/windowPreview.js index f241280..d2fc89f 100644 --- a/windowPreview.js +++ b/windowPreview.js @@ -17,7 +17,6 @@ const Clutter = imports.gi.Clutter; const Config = imports.misc.config; -const GLib = imports.gi.GLib; const Gtk = imports.gi.Gtk; const Main = imports.ui.main; const Mainloop = imports.mainloop; @@ -48,6 +47,7 @@ const PEEK_INDEX_PROP = '_dtpPeekInitialIndex'; var headerHeight = 0; var isLeftButtons = false; var scaleFactor = 1; +var animationTime = 0; var PreviewMenu = Utils.defineClass({ Name: 'DashToPanel-PreviewMenu', @@ -333,6 +333,7 @@ var PreviewMenu = Utils.defineClass({ isLeftButtons = Meta.prefs_get_button_layout().left_buttons.indexOf(Meta.ButtonFunction.CLOSE) >= 0; scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor; headerHeight = this._dtpSettings.get_boolean('window-preview-show-title') ? HEADER_HEIGHT * scaleFactor : 0; + animationTime = this._dtpSettings.get_int('window-preview-animation-time') * .001; }, _resetHiddenState: function() { @@ -862,7 +863,7 @@ var Preview = Utils.defineClass({ function getTweenOpts(opts) { let defaults = { - time: Taskbar.DASH_ANIMATION_TIME * 1.5, + time: animationTime, transition: 'easeInOutQuad' };