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

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