ssokolow / quicktile

Adds window-tiling hotkeys to any X11 desktop. (An analogue to WinSplit Revolution for people who don't want to use Compiz Grid)
https://ssokolow.com/quicktile/
GNU General Public License v2.0
869 stars 78 forks source link

Some applications have a margin when tiled #49

Closed maxfrigge closed 4 years ago

maxfrigge commented 9 years ago

I am running Elementary OS (based on Gnome & Ubuntu 14.04) and some applications are not getting tiled correctly. They are too small and have a margin on all sides.

This happens for example with

Other applications like Firefox or SublimeText are getting tiled just fine.

Here is a Screenshot of the Terminal set to half screen.

screenshot from 2015-04-21 18 42 20

ssokolow commented 9 years ago

Based on previous experience, I can say that it's very likely to be a bug in either your applications or your desktop because of how much work QuickTile delegates to the desktop's window manager.

(Quicktile basically asks the window manager for the current sizes, does some math, and then asks the window manager to resize things... and I delegated the code to do all that asking to the GTK/GNOME library libwnck.)

Unfortunately, at the moment, I can't really do any testing because that looks like a composited desktop and my VirtualBox won't give guest OSes accelerated graphics. (Its "Does the host OS have OpenGL?" test stub started segfaulting after I upgraded my nVidia drivers.)

maxfrigge commented 9 years ago

Sounds reasonable. Is there a way i could test getting/setting the window size in the command line using libwnck? That way I could file a bug for Elementary OS.

ssokolow commented 9 years ago

There doesn't appear to be a specific command-line frontend for libwnck, but you could ask your package manager for a list of reverse dependencies (packages which depend on it) and see if any of those might serve the purpose.

Just keep in mind that I depend on the GTK+ 2.x version and the GTK+ 3.x version may or may not exhibit the same behaviour.

raidoz commented 9 years ago

Happens to me with Gnome 3 and some windows(like nautilus) as well. Both under Ubuntu 14.10 and 15.04.

ssokolow commented 9 years ago

Unfortunately, again, I'd need VirtualBox to test that. I run Lubuntu 14.04 LTS un-composited and I dislike the UI decisions GNOME is pushing on GTK+ 3.x enough that I'm planning to migrate to LXQt as soon as it's feasible for me.

(Of course, first, I'm going to have to write a minor patch for Ark to replicate the one trivial feature I still depend on file-roller for.)

peteruithoven commented 7 years ago

I've got a tip after opening an issue at the Gala window manager repo: https://github.com/elementary/gala/issues/104#issuecomment-335011632

I'm planning to migrate to LXQt as soon as it's feasible for me.

What does this mean?

ssokolow commented 6 years ago

I've got a tip after opening an issue at the Gala window manager repo: elementary/gala#104

I'll double-check when I have time to address this, but QuickTile should be relying on libwnck (a GNOME-family library, just like GTK+) for getting and setting window geometry specifically to avoid this kind of "What definition of 'window geometry'?" mess.

Given what a debacle GTK+ 3.x has been for me in other areas, I'm not too pleased at the prospect of having to implement a special workaround for their inability to keep their own libraries in a consistent and useful state.

I'm planning to migrate to LXQt as soon as it's feasible for me.

What does this mean?

The way you've quoted the line about LXQt has me confused since it doesn't appear in the link you provided. Who's planning to move to LXQt?

peteruithoven commented 6 years ago

I'm planning to migrate to LXQt as soon as it's feasible for me.

Came from your comment earlier: https://github.com/ssokolow/quicktile/issues/49#issuecomment-96219875

ssokolow commented 6 years ago

*facepalm* I searched what you linked but not my own earlier comments in this thread.

Anyway, it probably won't mean much for you, since LXQt intends to use KWin so they can support X11 and Wayland with a single Qt-based window manager and I'm currently using a blend of LXDE and KDE which includes KWin.

(I had to mix KDE stuff in at one point because I'd added a third monitor, I had a month to wait for a $5 mounting plate to arrive from Hong Kong, and LXDE on Lubuntu 14.04 doesn't do well with non-rectangular desktops. Since then, I've just been too busy to switch back to a more pure LXDE.)

Lahorde commented 6 years ago

+1 same issue on arch with nautilus. I also have some small spaces around xfce4-terminal window

ConnorGriffin commented 6 years ago

Not sure about nautilus, but xfce4-terminal and other terminal emulators force the window size to align to cell dimensions., so the terminal window size is always a factor of your font character height/width. I'm not sure of any way around this with xfce4-terminal.

ssokolow commented 6 years ago

Technically, they ask for their window sizes to be locked to multiples of a certain increment and the window manager enforces it.

That can be demonstrated by setting arbitrary dimensions with the "Force" option in KWin's Window Rules feature, which is capable of overruling the application.

I tested it using gVim and gVim appears to round the reported available space to the nearest multiple internally, rather than always rounding down, so I got either padding or slightly clipped widgets depending on the size I forced.

nreith commented 4 years ago

See my comment over on #95 Hacky, but I scripted the whole thing so it works as of Elementary OS Hera 5.1. https://github.com/ssokolow/quicktile/issues/95#issuecomment-569970736

ssokolow commented 4 years ago

...and, as I mentioned on #95, I'm now looking for testing on the pre-release version of QuickTile for GTK 3.x that I just pushed to https://github.com/ssokolow/quicktile/tree/gtk3_port

That includes feedback on the installation instructions, which is explicitly about making a script like that as unnecessary as possible.

Just make sure you use this URL rather than the one from the README if you're installing via pip and a URL. The README's URL will only stop pointing to the GTK+ 2.x version when the pre-release gets pushed to the master branch:

sudo pip3 install https://github.com/ssokolow/quicktile/archive/gtk3_port.zip
ssokolow commented 4 years ago

That said, thank you for giving an example of how to fix things like the borders issue. Once I get back from fixing another thing that's in even more desperate need of fixing, I'll go through your script and add stuff like that to the QuickTile FAQ.

(I'm holding off on the site changes because I'm planning to rewrite the API docs using Sphinx and, when I do, I can make everything into one Sphinx-generated site.)

ssokolow commented 4 years ago

Also, if your system has the margins issue, please try QuickTile for GTK 3 without the margin fix.

Given that libwnck is supposed to be responsible for that sort of thing, I have a hypothesis that updating QuickTile to depend on the libwnck paired with GTK 3.x will have resolved the problem.

damaru2 commented 4 years ago

I just reinstalled from

sudo pip3 install https://github.com/ssokolow/quicktile/archive/gtk3_port.zip

as you said, and I am still having the issue with Firefox, which is the only one of my programs that I have seen that has this problem.

ssokolow commented 4 years ago

OK, I'll add a workaround to the FAQ where I keep other such "problem originates from the other end" fixes.

I'm actually in the process of reworking it all into a proper Sphinx-based manual right now, so I can do that right away, but having it go up will be deferred until I'm ready to merge the GTK 3 branch into master.

Does this look good to you as a FAQ entry?

Also, can you tell me what the line numbers are so I can add them to those code blocks? Even if they change in future versions, it'd be a nice hint as to where in the file to look for it.


Screenshot_2020-01-18 Frequently Asked Questions — QuickTile 0 4 documentation

damaru2 commented 4 years ago

Note I am not the same person that wrote a comment before. I don't know about those line numbers. I'm on Xubuntu and my default theme Greybird (elemetary does not come installed by default). I could install it and give it a try. Greybird does not seem to come with any decoration shadows, but other components have shadows. I guess I'll have to play around with those to find my own workaround. I hope the update works out of the box. Thank you for your hard work.

ssokolow commented 4 years ago

Oh, sorry about that. I'm a little out of sorts today because I had an appointment yesterday that required me to get up far too early.

@nreith Your feedback?

fidergo-stephane-gourichon commented 4 years ago

If you run xfwm4-tweaks-settings then go to last tab "compositor", is it enabled ?

I experienced a bug similar to this one when it was enabled, only on gtk3 apps (like PDF viewer, Gnome calculator), and never experienced such bug when the compositor is disabled.

Still, this may be a poor workaround as the real issue might be in the GTK3 theme anyway.

(I disable the XFCE compositor anyway because it causes issues when I plug/unplug monitors, and anyway I use another compositor compton when I want one, to play tear-free videos.)

damaru2 commented 4 years ago

I had it enabled. If I disable it, the size of the firefox windows when I move them to one side is still small but instead of having shadows or a transparent background around it, it is plain black. So I guess I would still need to find the setting that creates those borders

nreith commented 4 years ago

Screenshot from 2020-01-18 22 21 17

ssokolow commented 4 years ago

@nreith Thanks. If this looks good to you, I'll commit it to the changeset I'm planning to push as soon as I finish reworking the docs.


Screenshot_2020-01-19 Frequently Asked Questions — QuickTile 0 4 documentation

nreith commented 4 years ago

Looks good. I'm not an Elementary expert and using Budgie more at the moment. But those are the lines and it worked for me. Looking forward to trying out your new gtk3 version when I get a chance.

ssokolow commented 4 years ago

Good to hear it.

Since I wouldn't know where to begin looking for a proper fix, aside from directly contacting random Elementary OS people, and I won't have time for that sort of thing in the near future, I'm going to have the FAQ entry commit auto-close this when it gets pushed to GitHub.

damaru2 commented 4 years ago

It seems the problem I am experiencing is not due to the decoration of my system's theme in gtk3 (greybird), but it is a firefox issue instead, due to the client-side decoration (CSD) that firefox has. When you have the CSD enabled ( it removes the title bar and it is enabled by default) it adds shadow-boxes around the window. If I disable the CSD I have the annoying title bar but tiling works well. I will report more on this if I figure out how to remove the shadows while keeping the title bar hidden.

In any case @ssokolow you could add this to the faq as well. I am running firefox 72.0.1 (It seems CSD is enabled in linux by default from version 66)

damaru2 commented 4 years ago

Ok, I fixed it with the following workaround: disable firefox CSD (go to menu->customize and check the box that says Title Bar that is on the bottom left side of the window) and in order to remove Firefox title bar one can use devilspie with this config

$ cat ~/.devilspie/firefox.ds                                                                             
if (is (application_name) "Firefox") and (contains (window_name) "Mozilla Firefox")
             (begin
                (undecorate)
             )

and make devilspie autostart.

The only downside of this approach is that the buttons of the title bar are hidden too (minimize, maximize and close) but that is not a problem for me.

ssokolow commented 4 years ago

I am running firefox 72.0.1 (It seems CSD is enabled in linux by default from version 66)

Apparently it's either conditional on the desktop environment you're running it under or the Canonical builds require users to manually opt in. I'm on 72.0.1 on KDE and CSD never got flipped on.

It seems the problem I am experiencing is not due to the decoration of my system's theme in gtk3 (greybird), but it is a firefox issue instead, due to the client-side decoration (CSD) that firefox has.

I was unable to replicate the problem by manually turning on the CSD under KWin 5.5.5 and the Breeze theme on Kubuntu 16.04 LTS. Windows tile as expected.

Can you give more information on your setup. If you haven't narrowed things down first and I can find time once I'm finished getting the GTK+ 3.x QuickTile released, I'll try poking at it in a VM.

In any case @ssokolow you could add this to the faq as well.

Do this look good to you?

Screenshot_2020-01-23 Frequently Asked Questions — QuickTile 0 4 documentation

ssokolow commented 4 years ago

Since I'm so close to being ready to push the updated docs, I'll take your silence as "no problems with it" and commit that FAQ entry.

As far as I can tell, this is firmly a bug in either libwnck (not correctly identifying the actual window extents) or the theme (not correctly informing the window manager where the window decorations end and the shadow begins) so I'm going to include a closes #49 in the commit message.

Feel free to poke me if you find something simple that QuickTile can do to work around this problem.

damaru2 commented 4 years ago

It looks good to me