diff options
author | Georges Basile Stavracas Neto <georges.stavracas@gmail.com> | 2022-08-22 18:46:20 -0300 |
---|---|---|
committer | Georges Basile Stavracas Neto <georges.stavracas@gmail.com> | 2022-08-22 20:17:22 -0300 |
commit | c1d73d8cae31a0a364c43b1979d0f5cdc1a981ce (patch) | |
tree | ff7a2c096f0a02d62c77f1de8336b80676290930 | |
parent | 235dd7be76c28aeed5d7a4a041bdfbaec39f68ac (diff) | |
download | gnome-shell-gbsneto/quick-settings-arrow.tar.gz |
quickSettings: Rotate menu arrowsgbsneto/quick-settings-arrow
Static arrows representing menus are inconsistent with the rest of
the platform, where we rotate arrows to represent that the menu is
open. Make quick settings arrows do the same.
-rw-r--r-- | js/ui/quickSettings.js | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/js/ui/quickSettings.js b/js/ui/quickSettings.js index ad9033c79..b1a86e1ae 100644 --- a/js/ui/quickSettings.js +++ b/js/ui/quickSettings.js @@ -115,6 +115,7 @@ var QuickMenuToggle = GObject.registerClass({ child: new St.Icon({ style_class: 'quick-toggle-arrow', icon_name: 'go-next-symbolic', + pivot_point: new Graphene.Point({x: 0.5, y: 0.5}), }), style_class: 'quick-toggle-arrow-button', x_expand: false, @@ -133,6 +134,16 @@ var QuickMenuToggle = GObject.registerClass({ if (this.menuEnabled) this.menu.open(); }); + + this.menu.connect('open-state-changed', (popup, isOpen) => { + const ltr = this.text_direction !== Clutter.TextDirection.RTL; + const angle = ltr ? 90 : -90; + this._menuButton.child.ease({ + rotationAngleZ: isOpen ? angle : 0, + delay: isOpen ? 0 : POPUP_ANIMATION_TIME / 2, + duration: POPUP_ANIMATION_TIME / 2, + }); + }); } }); @@ -200,7 +211,10 @@ var QuickSlider = GObject.registerClass({ sliderBin.connect('event', (bin, event) => this.slider.event(event, false)); this._menuButton = new St.Button({ - child: new St.Icon({icon_name: 'go-next-symbolic'}), + child: new St.Icon({ + icon_name: 'go-next-symbolic', + pivot_point: new Graphene.Point({x: 0.5, y: 0.5}), + }), style_class: 'icon-button', can_focus: true, x_expand: false, @@ -216,6 +230,16 @@ var QuickSlider = GObject.registerClass({ if (this.menuEnabled) this.menu.open(); }); + + this.menu.connect('open-state-changed', (popup, isOpen) => { + const ltr = this.text_direction !== Clutter.TextDirection.RTL; + const angle = ltr ? 90 : -90; + this._menuButton.child.ease({ + rotationAngleZ: isOpen ? angle : 0, + delay: isOpen ? 0 : POPUP_ANIMATION_TIME / 2, + duration: POPUP_ANIMATION_TIME / 2, + }); + }); } }); |