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

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