Top right corner effect to close current maximized window

For now, any maximized Qt and GTK3 (no CSD) app can be fast closed by moving the mouse pointer to the right top corner then left click, without searching and precisely positioning the mouse pointer on that small close button, this makes closing any maximized window super easy.

But GTK4 and GTK3 with CSD apps don’t follow this rule, which forces the user to precisely click on the close icon.
Is there any effect/hack that can add an action to the top right corner and makes it easy to close the current maximized window ?

1 Like

@medin:

Do you want to only close the windows by means of the Mouse or, are you prepared to accept Keyboard commands?

Only mouse using one hand if possible.

Windows close on alt+F4 I guess. If you emulate that with xdotool, it doesn’t matter if it’s csd or not. I use a top panel to which I added a widget called Spacer As Pager which allows me to do just that, top right corner and left click.
There’s also a custom screen edge script called KwinEdgeCommands but I didn’t take the time yet to look at the little error in it.
And believe it or not, the Napoleonistic app hotcorners-xd even works on current kde. Even comes with a working Skippy-xd ! Go figure. Wouldn’t really recommend that though.
In either case, emulating the key shortcut with xdotool does csd windows as well.

1 Like

On my openbox rigs I use an autostart xdotool command like: sleep3 && xdotool behave_screen_edge top-right exec xdotool key alt+F4
That doesn’t work on kde unless you set a screen margin.

1 Like

Ok, here’s a not great solution - use the “screen edges” configuration to set a top right corner action of “Present Windows - current application”. When you stick the mouse in the corner, you get an overview with (hopefully just) the offending window and then a middle click anywhere on that large target will close it.

If you are only looking to solve this issue for GTK apps, maybe get involved with this GNOME bug report that tracks this issue.

1 Like

I took another look at the custom screen edge script and I didn’t manage to get it to work. Maybe I might, but I had to install a bunch of dependencies I’m not eager to. But as far as a lazy close, kde “specific” option, that spacer widget works just fine. It can be set to a very small px size, enables overview on middle or right click and mouse scroll. In my case I don’t need top right screen edge to overview anymore which leaves me kind of a “nonchalant” corner for the mouse move. Moreover, it does the job when you don’t use titlebars as well. That being said, a custom screen edge command option would be nice to have. How hard can it be.
This thing’s been around for ages, WITH custom actions:

As a sidenote, for the…“youngsters” who don’t know what skippy-xd is. It’s an exposé/overview type kinda thing that was made twenty years ago. Still works on pretty much any desktop ( or non) environment. I’m just sayin’.

1 Like

If you are only looking to solve this issue for GTK apps, maybe get involved with this GNOME bug report that tracks this issue.

They banned me a long time from their gitlab because I simply criticized their desktop slowness in a ticket. :joy:
KDE devs are way more open and really kind, I reported many bugs with many critics and the devs were totally lovely. :kissing_heart:

1 Like

I installed the widget and added xdotool key Alt+F4 as Run Command for left lick, but it doesn’t work for me.

Hooking into this, this not only effects the close button, but in your mentioned example of Firefoxt this leads to tabs not being selectable from the top edge of the screen, insteasd, the window will de-maximize on click on the top edge of the screen.

This was not always the case however. I remember not needing to precisely hit a tab in the bar before.

image

The problem is that I’m using Wayland and xdotool works only on X11.

I tried alternatives:

  • wtype doesn’t work because KWin doesn’t implement a virtual keyboard protocol Compositor does not support the virtual keyboard protocol

  • ydotool require to be run as root and needs a daemon in the background to work

  • dotool (installed from AUR) doesn’t seem to work for me even if I added current user to input group

A, ok. Didn’t know that. I’m afraid you don’t many options then. Not unless kde implements a custom screen edge or someone comes up with a working script.
Maybe some css of the padding of the close buttons on gtk csd could work.

1 Like

I tried many solutions, but no one worked for me. Anyone succeeded in adding a custom command to a screen edge ?

Screenshot_20230831_095417

I’m sure I came across a custom script once, but for the love of…I can’t find that anymore. In either case, as I mentioned before, I’m afraid your only option is css in the gtk config file. Something like 0 margin and padding for the close button.

I just noticed today that my Brave Browser allows this action. My browser is not maximized, yet I can close it by pushing the mouse to the extreme top-right can left-click. I don’t know how they do it, but I have the resize cursor all along the top of the window, until I get to the minimize button and then I get the arrow all the way to the bottom right corner. This allows me to min, max, close and use the scroll bar on the right side. I have the browser options set to use QT.

I wish I could get a screenshot of the cursor, but I guess I will have to take photos of it with my phone.

IMG_20240119_171432179_HDR

IMG_20240119_171441988_HDR

As you can see below, the cursor is sitting in the rounded corner.
IMG_20240119_171450265_HDR

IMG_20240119_171530217_HDR

I have not opened every app I have to test, but I have not noticed this working with any other application. Only Brave. I have to admit, being able to just slam the pointer into the right side and have the scroll bar is pretty awesome.

Before anyone asks, yes, it works the same way maximized. With F11, you lose the buttons, but you still have the scroll bar.

Surely, you can’t be talking about Top right corner effect to close current maximized window - #4 by dzon?

It works also in Dolphin and any other Qt apps.
We can’t resize GTK apps far enough so that the close button is on the top corner.

1 Like