wilfm / GnomeExtensionMaximusTwo

Removes the title bar on maximised windows. See: https://extensions.gnome.org/extension/844/maximus-two/
63 stars 27 forks source link

Title bar visible after starting an application maximized #2

Open theArchonius opened 9 years ago

theArchonius commented 9 years ago

I'm using Ubuntu Gnome 14.10 with GNOME Shell 3.12.2. The extension works well if I maximize or minimize a running application window - but if an application starts maximized, the title bar remains visible (but you can't use the minimize/maximize/close buttons on it). Minimizing and maximizing the window hides the title bar, but it's annoying to do that every time the application starts...

oliveiraev commented 9 years ago

:+1: Gnome Shell 3.12.2 @ Ubuntu-Gnome 14.10

wilfm commented 9 years ago

I can reproduce this issue (with most applciations) - I shall fix it when I have time

psivesely commented 9 years ago

I have almost the same bug--for me the title bar just appears black on apps launched fullscreen--and un- then re-maximizing it also fixes for me. I'm using Gnome Shell 3.14.1.5.

JonathanReeve commented 9 years ago

I think I'm having a similar issue. For me, when I'm running a maximized app, then suspend and wake up my computer, the formerly maximized app appears with a black bar at the top of the screen where the title bar would have been. Unmaximizing and remaximizing it fixes it, but it's annoying to have to do that every time.

ArchKudo commented 9 years ago

I also have the same problem with chromium and firefox and others, however it works fine with gnome apps like gedit, gnome-terminal....Hope you fix that soon, Anyways thanks for the amazing extension.. GNOME Shell 3.14.1.5 (Arch Linux 3.17.2-1-ARCH)

aditiapratama commented 9 years ago

affecting me as well, ubuntu 14.10 GNOME Shell 3.14.1

tomm commented 9 years ago

Affecting me too. Debian 8 (testing), gnome shell 3.14.1. I see black title bars on newly opened maximised windows. Hit alt-f10-f10 and the black bar disappears.

mpdeimos commented 9 years ago

Same here. For some windoes this is reproducible if I maximze then lock screen and then unlock. Result is black titlebar.

mk0x9 commented 9 years ago

Fedora 21, gnome-shell 3.14.2, same as #13. Need to press M-down and M-up to restore state of the window after screenlock.

muhammedabuali commented 9 years ago

I think this issue can be fixed with an ugly hack using wmctrl

ronjouch commented 9 years ago

@muhammedabuali can you post your ugly hack here? I'll be glad to try it out.

muhammedabuali commented 9 years ago

@ronjouch sure. the idea is that the blak top bar appears because the extension hides the titlebar after the etension is opened and it disapears if we manually unmaximize and maximize again.

with wmctrl given the id of the window we can make it full screen and not full screen later so it will appear normal here is a script to toggle the titlebar of the current window to make the title appear set the flag to 0

FLAG=1 ;\
ID=$(xprop -root 32x '\t$0' _NET_ACTIVE_WINDOW | cut -f 2);\
xprop -id $ID -f _GTK_HIDE_TITLEBAR_WHEN_MAXIMIZED 32c -set _GTK_HIDE_TITLEBAR_WHEN_MAXIMIZED $FLAG;\
wmctrl -i -r $ID -b add,fullscreen ;\
sleep 0.01 ;\
wmctrl -i -r $ID -b remove,fullscreen
muhammedabuali commented 9 years ago

to apply this hack : you need wmctrl installed edit the file

.local/share/gnome-shell/extensions/maximus-two@wilfinitlike.gmail.com/decoration.js

go to the line 125 and insert after it the following

    let cmd_full = ['wmctrl', '-i', '-r' , id , '-b', 'add,fullscreen'];
    let sleep_time = '0.01'
    let cmd_sleep = ['sleep', sleep_time];
    let cmd_unfull = ['wmctrl', '-i', '-r' , id , '-b', 'remove,fullscreen'];

    Util.spawn(cmd_full);
    Util.spawn(cmd_sleep);
    Util.spawn(cmd_unfull);
ronjouch commented 9 years ago

@muhammedabuali thanks for sharing your patch! Just tried it, but on my 4-years-old laptop, it yields irregular results:

I tried fiddling with the sleep_time, that didn't change anything. Is your script always working on your machine? Am using wmctrl 1.07 on Gnome 3.16.0 and Linux 3.19.3-3-ARCH.

muhammedabuali commented 9 years ago

I haven't encountered the second case on my machine I have the exact setup as you

muhammedabuali commented 9 years ago

I think this works out better

add this to the constants in the start of the decoration.js file

const MAXIMIZED = (Meta.MaximizeFlags.HORIZONTAL | Meta.MaximizeFlags.VERTICAL);

and replace the older snippet with this one

if (hide) {
        let cmd_toggle = ['wmctrl', '-i', '-r' , id , '-b', 'toggle,maximized_vert,maximized_horz'];
        let cmd_full = ['wmctrl', '-i', '-r' , id , '-b', 'add,maximized_vert,maximized_horz'];

        if (win.get_maximized() === MAXIMIZED && !win.minimized) {
            Util.spawn(cmd_toggle);
            Util.spawn(cmd_toggle);
            Util.spawn(cmd_full);
        }
}
ronjouch commented 9 years ago

@muhammedabuali cool, this second approach seems to work more frequently (I'd say ~80% on my machine). However, once in a while I end up in one of two failure states: a. displaying the black titlebar, or b. window ending up appearing unmaximized (windowed).

Leaving it activated and trying to fiddle with it.

wilfm commented 9 years ago

nice idea - I will try having a fiddle around as well and see if it improves anything or can be improved. A thing I haven't checked is whether xprop & xwininfo (and wmctrl) work under Wayland. I suspect not, so the Wayland window manager may need a special version of the extension using whatever tools it has.

gutenye commented 9 years ago

@wilfm I run GNOME 3.16 on Archlinux under Wayland, it works with @muhammedabuali 's patch

wilfm commented 8 years ago

Probably the issues fixed for current versions with updates, but once I have sorted out documentation, other pull requests etc I'll make a few development versions available with interesting fixes like this.

ronjouch commented 8 years ago

Am running v5 from the github releases zip, indeed it looks fixed :+1:

Pajn commented 8 years ago

I have this issue with latest version on extensions.gnome.org, is that an older version than the one here?