Blame SOURCES/0001-appDisplay-Show-full-app-name-on-hover.patch

c7fac9
From fb3165447d4dac048d0b085bf0266027da66df2c Mon Sep 17 00:00:00 2001
c7fac9
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
c7fac9
Date: Thu, 21 Jun 2018 18:03:31 +0200
c7fac9
Subject: [PATCH] appDisplay: Show full app name on hover
c7fac9
c7fac9
---
c7fac9
 data/theme/gnome-shell-sass/_common.scss |  8 ++++
c7fac9
 js/ui/appDisplay.js                      | 48 ++++++++++++++++++++++++
c7fac9
 2 files changed, 56 insertions(+)
c7fac9
c7fac9
diff --git a/data/theme/gnome-shell-sass/_common.scss b/data/theme/gnome-shell-sass/_common.scss
c7fac9
index f1aaea689..5bf01a540 100644
c7fac9
--- a/data/theme/gnome-shell-sass/_common.scss
c7fac9
+++ b/data/theme/gnome-shell-sass/_common.scss
c7fac9
@@ -1402,6 +1402,14 @@ StScrollBar {
c7fac9
 
c7fac9
   }
c7fac9
 
c7fac9
+  .app-well-hover-text {
c7fac9
+      text-align: center;
c7fac9
+      color: $osd_fg_color;
c7fac9
+      background-color: $osd_bg_color;
c7fac9
+      border-radius: 5px;
c7fac9
+      padding: 3px;
c7fac9
+  }
c7fac9
+
c7fac9
   .app-well-app-running-dot { //running apps indicator
c7fac9
     width: 10px; height: 3px;
c7fac9
     background-color: $selected_bg_color;
c7fac9
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
c7fac9
index 74c772d50..070057c69 100644
c7fac9
--- a/js/ui/appDisplay.js
c7fac9
+++ b/js/ui/appDisplay.js
c7fac9
@@ -1628,6 +1628,20 @@ var AppIcon = new Lang.Class({
c7fac9
         this.actor.connect('clicked', this._onClicked.bind(this));
c7fac9
         this.actor.connect('popup-menu', this._onKeyboardPopupMenu.bind(this));
c7fac9
 
c7fac9
+        this._hoverText = null;
c7fac9
+        this._hoverTimeoutId = 0;
c7fac9
+
c7fac9
+        if (this.icon.label) {
c7fac9
+            this._hoverText = new St.Label({ style_class: 'app-well-hover-text',
c7fac9
+                                             text: this.icon.label.text,
c7fac9
+                                             visible: false });
c7fac9
+            this._hoverText.clutter_text.line_wrap = true;
c7fac9
+            Main.layoutManager.addChrome(this._hoverText);
c7fac9
+
c7fac9
+            this.actor.connect('notify::hover', this._syncHoverText.bind(this));
c7fac9
+            this.connect('sync-tooltip', this._syncHoverText.bind(this));
c7fac9
+        }
c7fac9
+
c7fac9
         this._menu = null;
c7fac9
         this._menuManager = new PopupMenu.PopupMenuManager(this);
c7fac9
 
c7fac9
@@ -1659,12 +1673,39 @@ var AppIcon = new Lang.Class({
c7fac9
             this.app.disconnect(this._stateChangedId);
c7fac9
         this._stateChangedId = 0;
c7fac9
         this._removeMenuTimeout();
c7fac9
+        this._removeHoverTimeout();
c7fac9
+        if (this._hoverText)
c7fac9
+            this._hoverText.destroy();
c7fac9
+        this._hoverText = null;
c7fac9
     },
c7fac9
 
c7fac9
     _createIcon(iconSize) {
c7fac9
         return this.app.create_icon_texture(iconSize);
c7fac9
     },
c7fac9
 
c7fac9
+    _syncHoverText() {
c7fac9
+        if (this.shouldShowTooltip()) {
c7fac9
+            if (this._hoverTimeoutId)
c7fac9
+                return;
c7fac9
+
c7fac9
+            this._hoverTimeoutId = Mainloop.timeout_add(300, () => {
c7fac9
+                this._hoverText.style = `max-width: ${2 * this.icon.iconSize}px;`;
c7fac9
+                this._hoverText.ensure_style();
c7fac9
+
c7fac9
+                let [x, y] = this.icon.label.get_transformed_position();
c7fac9
+                let offset = (this._hoverText.width - this.icon.label.width) / 2;
c7fac9
+                this._hoverText.set_position(Math.floor(x - offset), Math.floor(y));
c7fac9
+                this._hoverText.show();
c7fac9
+
c7fac9
+                this._hoverTimeoutId = 0;
c7fac9
+                return GLib.SOURCE_REMOVE;
c7fac9
+            });
c7fac9
+        } else {
c7fac9
+            this._removeHoverTimeout();
c7fac9
+            this._hoverText.hide();
c7fac9
+        }
c7fac9
+    },
c7fac9
+
c7fac9
     _removeMenuTimeout() {
c7fac9
         if (this._menuTimeoutId > 0) {
c7fac9
             Mainloop.source_remove(this._menuTimeoutId);
c7fac9
@@ -1672,6 +1713,13 @@ var AppIcon = new Lang.Class({
c7fac9
         }
c7fac9
     },
c7fac9
 
c7fac9
+    _removeHoverTimeout() {
c7fac9
+        if (this._hoverTimeoutId > 0) {
c7fac9
+            Mainloop.source_remove(this._hoverTimeoutId);
c7fac9
+            this._hoverTimeoutId = 0;
c7fac9
+        }
c7fac9
+    },
c7fac9
+
c7fac9
     _updateRunningStyle() {
c7fac9
         if (this.app.state != Shell.AppState.STOPPED)
c7fac9
             this._dot.show();
c7fac9
-- 
c7fac9
2.20.1
c7fac9