Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature to hide native titlebar for maximized/tiled windows #964

Closed
crillon opened this issue Jun 5, 2023 · 5 comments
Closed

Feature to hide native titlebar for maximized/tiled windows #964

crillon opened this issue Jun 5, 2023 · 5 comments

Comments

@crillon
Copy link

crillon commented Jun 5, 2023

Is your feature request related to a problem? Please describe.
The title bar is useless when the window is maximized or tiled.
I found out that in #68 people say this feature is present, but it's not

image
image

I don't know, is this a bug or has this feature been removed?

Describe the solution you'd like

  • Add an option to the settings menu to remove titlebar when window is
    • Maximized
    • Tiled
    • Both
    • Always

Describe alternatives you've considered
There is an extension GTK Title Bar that does just that, but unfortunately it doesn't work when the window is tiled by Material Shell, and it doesn't support gnome 44.

@crillon
Copy link
Author

crillon commented Jun 5, 2023

I read the code and found that the feature is there, but it doesn't work.
So..

  • Occurs on:
    • X.Org
    • Wayland
  • GNOME Shell version: 44.1
  • Distro: Manjaro 23.0 (6.1.31-2-MANJARO)

Looks like the problem is here:

export const setTitleBarVisibility = function (
metaWindow: MetaWindowWithMsProperties,
visible: boolean
) {
const windowXID = getWindowXID(metaWindow);
if (!windowXID || metaWindow.is_client_decorated() || !metaWindow.decorated)
return;
try {
Util.trySpawn([
'xprop',
'-id',
windowXID,
'-f',
'_MOTIF_WM_HINTS',
'32c',
'-set',
'_MOTIF_WM_HINTS',
`2, 0, ${visible ? '1' : '2'} 0, 0`,
]);
} catch (e) {
Me.logFocus('xprop', e);
}
metaWindow.titleBarVisible = visible;
};

  1. The feature doesn't work even in gnome 43. I think the problem is in line 28, with !metaWindow.decorated (I don't know TypeScript and JS. So I can't find what is "decorated", how and where it changes);
  2. In gnome 44, line 40 does not work, to hide the titlebar now you need to use 0 instead of 2, I did not find good info about this, so I just refer to other extensions: No Titlebar When Maximized and Gnome Shell 44 support velitasali/gtktitlebar#36 (comment)

I changed the code to this..

export const setTitleBarVisibility = function (
    metaWindow: MetaWindowWithMsProperties,
    visible: boolean
) {
    const windowXID = getWindowXID(metaWindow);
    if (!windowXID || metaWindow.is_client_decorated()) // 1
        return;
    try {
        Util.trySpawn([
            'xprop',
            '-id',
            windowXID,
            '-f',
            '_MOTIF_WM_HINTS',
            '32c',
            '-set',
            '_MOTIF_WM_HINTS',
            `2, 0, ${visible ? '1' : '0'} 0, 0`, // 2
        ]);
    } catch (e) {
        Me.logFocus('xprop', e);
    }

    metaWindow.titleBarVisible = visible;
};

..and it looks like everything is working, but I haven't tested it very well, so there may be some unknown issues with this code.

@mawkler
Copy link

mawkler commented Jun 7, 2023

I started seeing the same issue after upgrading to GNOME 44

@henrybarreto
Copy link

henrybarreto commented Jun 9, 2023

Your fix seems solved the problem for now.

diff --git a/src/utils/windows.ts b/src/utils/windows.ts
index 2787b37..23f8efb 100644
--- a/src/utils/windows.ts
+++ b/src/utils/windows.ts
@@ -25,7 +25,8 @@ export const setTitleBarVisibility = function (
     visible: boolean
 ) {
     const windowXID = getWindowXID(metaWindow);
-    if (!windowXID || metaWindow.is_client_decorated() || !metaWindow.decorated)
+    if (!windowXID || metaWindow.is_client_decorated())
+        // 1
         return;
     try {
         Util.trySpawn([
@@ -37,7 +38,7 @@ export const setTitleBarVisibility = function (
             '32c',
             '-set',
             '_MOTIF_WM_HINTS',
-            `2, 0, ${visible ? '1' : '2'} 0, 0`,
+            `2, 0, ${visible ? '1' : '0'} 0, 0`, // 2
         ]);
     } catch (e) {
         Me.logFocus('xprop', e);

@jivanpal
Copy link

jivanpal commented Jul 30, 2023

Issue not present on GNOME 42.5 to 42.9.

@PapyElGringo
Copy link
Collaborator

Hey guys ! Thanks for waiting ! I made a PR to fix this #977

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants