@@ -47,7 +47,6 @@ const { layoutManager, loadTheme, overview, panel, setThemeStylesheet, screenShi
47
47
const { ScreenShield } = imports . ui . screenShield ;
48
48
const { AppSwitcher, AppIcon, WindowSwitcherPopup } = imports . ui . altTab ;
49
49
const { SwitcherList } = imports . ui . switcherPopup ;
50
- const { WindowPreview } = imports . ui . windowPreview ;
51
50
const { Workspace } = imports . ui . workspace ;
52
51
const { WorkspaceThumbnail } = imports . ui . workspaceThumbnail ;
53
52
const Tags = Me . imports . tags ;
@@ -2541,14 +2540,33 @@ let default_isoverviewwindow_ws_thumbnail: any;
2541
2540
let default_init_appswitcher : any ;
2542
2541
let default_getwindowlist_windowswitcher : any ;
2543
2542
let default_getcaption_windowpreview : any ;
2543
+ let default_getcaption_workspace : any ;
2544
2544
2545
2545
/**
2546
2546
* Decorates the default gnome-shell workspace/overview handling
2547
2547
* of skip_task_bar. And have those window types included in pop-shell.
2548
2548
* Should only be called on extension#enable()
2549
+ *
2550
+ * NOTE to future maintainer:
2551
+ * Skip taskbar has been left out by upstream for a reason. And the
2552
+ * Shell.WindowTracker seems to skip handling skip taskbar windows, so they are
2553
+ * null or undefined. GNOME 40+ and lower version checking should be done to
2554
+ * constantly support having them within pop-shell.
2555
+ *
2556
+ * Known skip taskbars ddterm, conky, guake, minimized to tray apps, etc.
2557
+ *
2558
+ * While minimize to tray are the target for this feature,
2559
+ * skip taskbars that float/and avail workspace all
2560
+ * need to added to config.ts as default floating
2561
+ *
2549
2562
*/
2550
2563
function _show_skip_taskbar_windows ( ) {
2551
2564
if ( ! GNOME_VERSION ?. startsWith ( "40." ) ) {
2565
+ // TODO GNOME 40 added a call to windowtracker and app var is not checked if null
2566
+ // in WindowPreview._init(). Then new WindowPreview() is being called on
2567
+ // _addWindowClone() of workspace.js.
2568
+ // So it has to be skipped being overriden for now.
2569
+
2552
2570
// Handle the overview
2553
2571
default_isoverviewwindow_ws = Workspace . prototype . _isOverviewWindow ;
2554
2572
Workspace . prototype . _isOverviewWindow = function ( window : any ) {
@@ -2560,15 +2578,30 @@ function _show_skip_taskbar_windows() {
2560
2578
}
2561
2579
2562
2580
// Handle _getCaption errors
2563
- default_getcaption_windowpreview = WindowPreview . prototype . _getCaption ;
2564
- WindowPreview . prototype . _getCaption = function ( ) {
2565
- if ( this . metaWindow . title )
2566
- return this . metaWindow . title ;
2567
-
2568
- let tracker = Shell . WindowTracker . get_default ( ) ;
2569
- let app = tracker . get_window_app ( this . metaWindow ) ;
2570
- return app ? app . get_name ( ) : "" ;
2571
- } ;
2581
+ if ( GNOME_VERSION ?. startsWith ( "3.36" ) ) {
2582
+ // imports.ui.windowPreview is not in 3.36,
2583
+ // _getCaption() is still in workspace.js
2584
+ default_getcaption_workspace = Workspace . prototype . _getCaption ;
2585
+ Workspace . prototype . _getCaption = function ( ) {
2586
+ if ( this . metaWindow . title )
2587
+ return this . metaWindow . title ;
2588
+
2589
+ let tracker = Shell . WindowTracker . get_default ( ) ;
2590
+ let app = tracker . get_window_app ( this . metaWindow ) ;
2591
+ return app ? app . get_name ( ) : "" ;
2592
+ }
2593
+ } else {
2594
+ const { WindowPreview } = imports . ui . windowPreview ;
2595
+ default_getcaption_windowpreview = WindowPreview . prototype . _getCaption ;
2596
+ WindowPreview . prototype . _getCaption = function ( ) {
2597
+ if ( this . metaWindow . title )
2598
+ return this . metaWindow . title ;
2599
+
2600
+ let tracker = Shell . WindowTracker . get_default ( ) ;
2601
+ let app = tracker . get_window_app ( this . metaWindow ) ;
2602
+ return app ? app . get_name ( ) : "" ;
2603
+ } ;
2604
+ }
2572
2605
2573
2606
// Handle the workspace thumbnail
2574
2607
default_isoverviewwindow_ws_thumbnail =
@@ -2651,14 +2684,38 @@ function _show_skip_taskbar_windows() {
2651
2684
* This is the cleanup/restore of the decorator for skip_taskbar when pop-shell
2652
2685
* is disabled.
2653
2686
* Should only be called on extension#disable()
2687
+ *
2688
+ * Default functions should be checked if they exist,
2689
+ * especially when skip taskbar setting was left on during an update
2690
+ *
2654
2691
*/
2655
2692
function _hide_skip_taskbar_windows ( ) {
2656
2693
if ( ! GNOME_VERSION ?. startsWith ( "40." ) ) {
2657
- Workspace . prototype . _isOverviewWindow = default_isoverviewwindow_ws ;
2694
+ if ( default_isoverviewwindow_ws )
2695
+ Workspace . prototype . _isOverviewWindow = default_isoverviewwindow_ws ;
2696
+ }
2697
+
2698
+ if ( GNOME_VERSION ?. startsWith ( "3.36" ) ) {
2699
+ if ( default_getcaption_workspace )
2700
+ Workspace . prototype . _getCaption = default_getcaption_workspace ;
2701
+ } else {
2702
+ if ( default_getcaption_windowpreview ) {
2703
+ const { WindowPreview } = imports . ui . windowPreview ;
2704
+ WindowPreview . prototype . _getCaption =
2705
+ default_getcaption_windowpreview ;
2706
+ }
2707
+ }
2708
+
2709
+ if ( default_isoverviewwindow_ws_thumbnail ) {
2710
+ WorkspaceThumbnail . prototype . _isOverviewWindow =
2711
+ default_isoverviewwindow_ws_thumbnail ;
2712
+ }
2713
+
2714
+ if ( default_init_appswitcher )
2715
+ AppSwitcher . prototype . _init = default_init_appswitcher ;
2716
+
2717
+ if ( default_getwindowlist_windowswitcher ) {
2718
+ WindowSwitcherPopup . prototype . _getWindowList =
2719
+ default_getwindowlist_windowswitcher ;
2658
2720
}
2659
- WindowPreview . prototype . _getCaption = default_getcaption_windowpreview ;
2660
- WorkspaceThumbnail . prototype . _isOverviewWindow =
2661
- default_isoverviewwindow_ws_thumbnail ;
2662
- AppSwitcher . prototype . _init = default_init_appswitcher ;
2663
- WindowSwitcherPopup . prototype . _getWindowList = default_getwindowlist_windowswitcher ;
2664
2721
}
0 commit comments