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

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