[gnome-shell/wip/fmuellner/use-fallback-titles: 2/2] workspace: Fall back to app name in window caption



commit 61cff5af1c9df4302929f4c466d21e6bda5f9f3a
Author: Florian Müllner <fmuellner gnome org>
Date:   Tue Feb 20 18:29:00 2018 +0100

    workspace: Fall back to app name in window caption
    
    Just like we did for the window list in app icons' context menu,
    provide a fallback for window captions in the window picker rather
    than showing blank items to the user.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/issues/26

 js/ui/workspace.js | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/workspace.js b/js/ui/workspace.js
index a64cf7dec..49cd40ae0 100644
--- a/js/ui/workspace.js
+++ b/js/ui/workspace.js
@@ -446,13 +446,13 @@ var WindowOverlay = new Lang.Class({
         this.border = new St.Bin({ style_class: 'window-clone-border' });
 
         let title = new St.Label({ style_class: 'window-caption',
-                                   text: metaWindow.title });
+                                   text: this._getCaption() });
         title.clutter_text.ellipsize = Pango.EllipsizeMode.END;
         windowClone.actor.label_actor = title;
 
         this._updateCaptionId = metaWindow.connect('notify::title',
             Lang.bind(this, function(w) {
-                this.title.text = w.title;
+                this.title.text = this._getCaption();
                 this.relayout(false);
             }));
 
@@ -565,6 +565,16 @@ var WindowOverlay = new Lang.Class({
         }
     },
 
+    _getCaption: function() {
+        let metaWindow = this._windowClone.metaWindow;
+        if (metaWindow.title)
+            return metaWindow.title;
+
+        let tracker = Shell.WindowTracker.get_default();
+        let app = tracker.get_window_app(metaWindow);
+        return app.get_name();
+    },
+
     _animateOverlayActor: function(actor, x, y, width, height) {
         let params = { x: x,
                        y: y,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]