gnunn1 / tilix

A tiling terminal emulator for Linux using GTK+ 3
https://gnunn1.github.io/tilix-web
Mozilla Public License 2.0
5.36k stars 293 forks source link

Wayland and Quake Issues Merged Bugs #1314

Closed gnunn1 closed 6 years ago

gnunn1 commented 6 years ago

There are a number of bugs reported with regards to Wayland and Quake. As noted previously, Quake mode in Wayland is very problematic because applications have limited access to understanding screen geometry and no access to setting position. Bugs that have been reported against this functionalionality include:

1312

1290

1285

I've had a look at resolving these issues and frankly I just don't think it's possible to have a perfect experience under Wayland without getting into writing Wayland extensions or something else equally exotic (for an app developer that is).

This situation cannot continue as I do not have the desire to keep closing these bugs, here are the possible solutions I am considering:

  1. Completely disable quake mode in Wayland. Easiest to do but least desirable

  2. Force the x11 back-end when running tilix under quake mode in wayland. Since tilix is single process this is only going to work if tilix is started in quake mode first. Also leads to other issues like mixed-monitor scaling not working which is a key benefit of Wayland for many users.

At this point I am planning on going with Option 1, I'm tired of dealing with Wayland issues for quake mode and I do not see a better resolution at this time.

Thus you can expect quake mode to be disabled in the next version of tilix. Those who want to use it can do so my manually forcing the X11 back-end via the GDK_BACKEND=x11 variable.

gnunn1 commented 6 years ago

Quake mode is now disabled in Wayland.

ggalmazor commented 6 years ago

Hi @gnunn1! Your decision is totally understandable. I'm worried, though, as everything is pointing towards a massive Wayland adoption by almost every major distribution.

In my case, I use Tilix exclusively in quake mode. It seems that forcing the X11 back-end is the way to go for me. How does the GDK_BACKEND=x11 option work? Is that an env variable I need to set globally?

gnunn1 commented 6 years ago

Hopefully you could just set it in the desktop file as part of the command, i.e.

GDK_BACKEND=x11 tilix --quake

noirbizarre commented 6 years ago

So bad, was working fine here with wayland/HiDPI/multiple screen. I don't understand this decision, removing a so useful feature to everybody for a few edge cases bugs without any replacement. Better done than perfect, no ? I've been using this feature extensively since its release and the wrong sizing was nothing compared to the lack of this feature. Why not display a warning in the configuration panel, a message in the readme... anything else than hardcoding if isWayland then disable() ? I saw some gnome-shell extension but none is working.

Isn't it possible to bypass that (ie. enable quake mode in wayland with the knowledge there can be some bugs) ?

gnunn1 commented 6 years ago

@noirbizarre I can understand your point of view but at the end of the day I just do not have the bandwidth to deal with all of the bugs surrounding the feature. As mentioned previously, you can still use the feature in Wayland, just run tilix using the x11 backend.

noirbizarre commented 6 years ago

@gnunn1 I just found #1322 in which @repsac-by is providing an extension for gnome-shell (https://github.com/repsac-by/gnome-shell-extension-quake-mode) This is not solution for any wayland session but it works well for me under gnome-shell and I though it was worth mentionning here in case anyone find this issue

Jomik commented 6 years ago

Would be nice to make this a setting that can be enabled, with a warning that it may not work properly. I never had any issues with Tilix under Wayland, getting this new update made me quite sad. The aforementioned extension sadly doesn't work as well, as it doesn't actually hide the application from your ALT+TAB, etc.

arashm commented 6 years ago

The feature was working perfectly fine for me. Although I have two monitors, since I was using quake mode in fullscreen, I never had any issue about where the window opens etc, and I think it was even smoother when using with wayland (in terms of animation). Too bad this decision is made. I wish this was an option for users and all other bugs would marked as "wontfix" or "upstream bug" maybe.

zbraniecki commented 6 years ago

Really sad about it. The feature was working perfectly fine for me as well. Now trying to use the gnome shell extension replacement but it keeps creating new windows and shows the quake window in panorama view :(

avastmick commented 6 years ago

All is not lost! As @gnunn1 states above, if you do want to use it in Wayland you can enable the keyboard shortcut using the following command:

env GDK_BACKEND=x11 tilix --quake

You put this as the keyboard mapping Command, in place of just tilix --quake.

I map that to F10, as per the instructions and it works fine, with no issues whatsoever, auto hides, shows on multiple monitors, etc. I have created a terminal profile for it to optimise, turning off the scroll bar and tuning size etc.

env GDK_BACKEND=x11 tilix --profile=quake --quake

zbraniecki commented 6 years ago

@avastmick I tried it on arch linux with no success. The tilix opens new regular window and displays the notification about not supporting Wayland. I had to use the gnome extension which unfortunately don't work well (opens a new window every now and then and leaves the previous quake window floating :/)

avastmick commented 6 years ago

@zbraniecki that's strange. I too am on Arch with Gnome 3.28 and with the above command it works as expected on Wayland. It should work as the application is being opened in X11 via Xwayland, not native Wayland, so the message is not shown. Have a look at the Arch Linux Wiki on Wayland to troubleshoot.

arashm commented 6 years ago

I have Archlinux and it works fine for me too (except it sometimes opens in different monitor that I want to). I have set this shortcut in gnome settings:

env GDK_BACKEND=x11 tilix --quake --window-style=borderless --profile=Dropdown --full-screen
Frederik-Baetens commented 6 years ago

A lot of people (including me) were really satisfied with how it worked, please re-enable wayland quake mode, even if you won't put any further work into it. As said previously, make it an option which says that it's not officially supported.

I understand that it wasn't a perfect solution, however, removing quake mode seems to have caused a lot more upset than leaving it in.

Venemo commented 6 years ago

Actually, I switched to tilix from guake precisely because it had quake mode in Wayland... :(

Queuecumber commented 6 years ago

Just for information's sake, is the plan to never support this under wayland or is the plan to have this issue as a catch-all until wayland matures and implements the features necessary to make this work?

gnunn1 commented 6 years ago

Wayland will never implement window positioning which is what is needed. It's possible gnome and gtk could implement something, if they do I'm happy to revisit it but not holding my breath.

Venemo commented 6 years ago

@gnunn1 I'd be interested to help out, if possible. Can you give me a list of what features are needed on Wayland and why? How did you do it, before removing the support completely? Even if window positioning is not supported, I still see some possible compromises there. For instance, Wayland could still be supported in maximized or fullscreen mode, which don't need positioning.

If other stuff is also needed or buggy, let's start a conversation with the Wayland devs to see what their opinion is on how it should be done.

gnunn1 commented 6 years ago

Window positioning is the important one, it let's you control which monitor the window appears, sizing of the windows, etc. Previously it used a hack where if the window was 100% wide the window manager would position it on top.

As to supporting a full screen only mode I have no interest in supporting the feature if it's too compromised.

berkiyo commented 3 years ago

Thanks to arashm, it seems adding this in GNOME Settings works:

env GDK_BACKEND=x11 tilix --quake --window-style=borderless --profile=Dropdown

Looks like the last two flags do the trick!

Crandel commented 3 years ago

I don't want to install Xwayland for tilix, please return quake option back, you can hide it deeply in configs, but this is the most important feature for me to use tilix at all. using x11 under wayland - dirty hack and not acceptable for me

Arcitec commented 2 years ago

Update: This message is outdated and the technique in it is unreliable. Read further down in the discussion for a mid-2022 summary of all PROPER solutions for Wayland quake/dropdown-terminals!

Old Message:


@arashm @berkiyo I just want to give you and everyone else a huge thanks. "Borderless window style" was what I needed for making this a nice looking dropdown terminal. And the suggestion to use a separate Dropdown profile to be able to configure the dropdown appearance individually is a smart one too. I might do that someday. But for now, I only use these settings:

env GDK_BACKEND=x11 tilix --quake --window-style=borderless

I also decided to hide the Tilix tab/title-bar... Simply disable "Preferences: Appearance: Show the terminal title even if it's the only terminal". This will remove the "Terminal 1:" titlebar from the quake window. And it also cleans up your regular Tilix window sessions, since they will now only gain titlebars after you split the window.

Edit: You can actually just go to "Preferences: Quake" and enable "Hide the toolbar of the window" to get rid of the toolbar. You can then skip the "window-style" argument and just launch quake mode like this:

env GDK_BACKEND=x11 tilix --quake

The "Preferences: Quake" section also allows you to configure things such as how tall the dropdown window will be, etc.

If you don't see that settings section on Wayland, you may have to launch the main Tilix itself in x11 mode, via env GDK_BACKEND=x11 tilix, and then do your Quake settings in there.

@Crandel Well if you want a 100% wayland solution, use ddterm instead: https://extensions.gnome.org/extension/3780/ddterm/ ... It's a super good, beautiful GNOME extension with transparency and nice animations. But I don't like using many extensions, so that's why I am moving to Tilix quake mode instead.

Crandel commented 2 years ago

Hi @Bananaman , I don't use Gnome shell, I use Swaywm. I found different solution for this WM and stop using tilix. Now I use wezterm - GPU-accelerated terminal, written in Rust. Also I use scratchpad to show/hide terminal, so now I'm not dependent on quake mode anymore. This is how in my swaywm config looks like.

for_window [app_id=wezterm] {
    move to scratchpad
    [app_id=wezterm] scratchpad show
    border none, move position center, resize set width 100 ppt height 100 ppt
}
bindsym --to-code exec swaymsg [app_id=wezterm]  scratchpad show || exec wezterm
Arcitec commented 2 years ago

@Crandel Ah okay nice. Wow it's crazy how many GPU accelerated terminals there are. I heard of Alacritty and Kitty. But never heard of wezterm. Well, I will use Tilix because things work well for me now. :D

Crandel commented 2 years ago

@Bananaman I use Alacritty as my fallback terminal. Wezterm is super powerful, configured via Lua, has tabs and splits, build in multiplexer mode and many more. And its much faster when command produce a huge amount of output text.

curiousercreative commented 2 years ago

As of 1.9.4 GDK_BACKEND=x11 tilix --quake is no longer working and now behaves the same as tilix --quake under Wayland.

EDIT: bizaare that this stopped working suddenly. I saw that version 1.9.4 was published on Feb 10th and thought my system somehow updated to a new version. Awhile later now I see that 1.9.4 was published Feb 10 2021 and in reinstalling via apt (and perhaps whatever else I was trying) quake window workaround is working for me once more thankfully.

Arcitec commented 2 years ago

bizaare that this stopped working suddenly.

Not bizarre at all. It was explained in the 1st post in this thread:

Workaround 2: Force the x11 back-end when running tilix under quake mode in wayland. Since tilix is single process this is only going to work if tilix is started in quake mode first. Also leads to other issues like mixed-monitor scaling not working which is a key benefit of Wayland for many users.

Relevant part: "Since tilix is single process this is only going to work if tilix is started in quake mode first."

You started a tilix process in wayland mode, therefore it doesn't matter what environment variable you send to tilix --quake since the (single) Tilix process is already running in wayland mode.

Arcitec commented 2 years ago

Everyone:

What @gnunn1 said about Wayland is true. It's impossible for an application to control its own position in Wayland. Therefore, Quake mode is impossible.

I found out about the only "hack/trick" that exists, and it's most likely incompatible with Tilix since I doubt that GTK would support this technique. The trick is as follows:

Detailed information about how to write such code is available here: https://gitlab.freedesktop.org/wayland/weston/-/issues/518

The reason I think this won't work for Tilix is because Tilix uses the GTK toolkit which I am almost certain wouldn't support rendering itself to subsurfaces in this way.

I add the info in case it's useful but I have almost 0% belief that it would work for Tilix!

Arcitec commented 2 years ago

I've now (May 2022) finally moved permanently to Wayland, and have three solutions for Quake mode on Wayland. Here's the summary for everybody:

 

1. Tilix Native (Hacky)

This requires that you edit the Tilix .desktop file to make it ALWAYS launch Tilix in X11 mode. You also have to bind env GDK_BACKEND=x11 tilix --quake to ensure that the dropdown mode also runs in X11. Tilix must always launch in X11 mode regardless of launch method, otherwise this technique breaks.

Pros:

Cons:

Verdict:

 

2. Using repsac's GNOME Shell extension to control Tilix's window position.

This is an extension for GNOME, which launches the actual Wayland version of Tilix, and then uses GNOME's built-in shell features to position the window as a "fake dropdown/quake terminal".

Pros:

Cons:

Verdict:

 

3. Using the ddterm extension for GNOME Shell

This is an extremely advanced extension for GNOME (GitHub page). It's a full Quake-mode terminal emulator running inside your shell, and it internally uses VTE (the exact same terminal core that Tilix, GNOME Console and GNOME Terminal uses, among others).

It integrates into the GNOME shell/compositor itself and is therefore able to fully control the window size and position even on Wayland. It's super configurable and allows animations (how it bounces in/out of view, or disable it for instant appearance), transparency, theming and colors, multiple tabs, and full control over which screen size and side it uses (top/left/right/bottom). It's a great complement to Tilix, without having to use the x11 hack:

Pros:

Cons:

Verdict:

Hope this helps!

 

Update: I've written a tool to convert Tilix colors to ddterm, and also written a setup guide for ddterm to make it as nice as possible for Tilix users. With this small guide, you can quickly get your ddterm to perfectly match Tilix!

ddterm Setup Guide:

How to convert Tilix color schemes to ddterm colors:

  1. Set the ddterm "Colors: Palette" to "Custom".
  2. Open Tilix Preferences, go to your profile and its Colors tab.
  3. Change the Tilix "Color scheme" to "Custom", which will keep your current colors and make the Export button clickable.
  4. Click on Export to save the Tilix colors as a JSON file somewhere on disk.
  5. Change Tilix back to the actual color scheme you were using (in my case "Monokai Dark"), and close the Tilix preferences.
  6. NOTE: You DON'T have to disable the ddterm extension before the next step. You don't even have to close the ddterm preferences window. The extension automatically detects when we write to its database and updates the colors immediately, live, in both the terminal and the settings GUI!
  7. Run the script below and give it the path to your Tilix color JSON file, such as python3 tilix-to-ddterm.py tilix-monokai-dark.json (if that's what you saved the script and the color scheme JSON as), which will then write the colors directly into ddterm's database. The extension will immediately load the new colors.
  8. If you want to verify that Tilix and ddterm have the exact same color mappings, you can run the popular "neofetch" utility, which outputs a color swatch to let you see all terminal colors.
# Save this file as tilix-to-ddterm.py!
# Run it with "python3 tilix-to-ddterm.py <name of your tilix color JSON file>".

from pathlib import Path
from pprint import pprint
import json
import re
import subprocess
import sys

if len(sys.argv) < 2:
    print("Please provide a Tilix JSON color scheme filename.")
    exit(1)

tilix_file = Path(sys.argv[1])
if not tilix_file.is_file():
    print("Invalid filename.")
    exit(1)

out_palette = []
with tilix_file.open("rt", encoding="utf-8") as f:
    tilix_data = json.loads(f.read())
    if not "palette" in tilix_data:
        print("Invalid JSON file. Not a Tilix color scheme.")
        exit(1)

    in_palette = tilix_data["palette"]

    for color in in_palette:
        m = re.match(r"^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$", color.lower(), re.IGNORECASE)
        if not m:
            print(f"Invalid color: {color}. Exiting...")
            exit(1)

        out_palette.append(f"rgb(0x{m.group(1)}, 0x{m.group(2)}, 0x{m.group(3)})")

if len(out_palette) != 16:
    print(f"Wrong color amount in JSON file. Expected 16, found {len(out_palette)}. Exiting...")
    exit(1)

out_palette_arg = "['" + "', '".join(out_palette) + "']"
print(f"Writing {tilix_file} palette to ddterm's dconf storage: {out_palette_arg}.")
subprocess.run(["dconf", "write", "/com/github/amezin/ddterm/palette", out_palette_arg], shell=False, check=True)

Alright, have fun and enjoy! :) Give this post a vote if it was helpful! :P

RafalSkolasinski commented 2 years ago

Thanks @Bananaman for suggesting ddterm. It does work well and your script for converting colour scheme is really helpful!

Just wanted to mention that it is a bit more of a stop-gap solution for a quake mode when other workarounds do not work well. It is unfortunately missing tiling option :(.

P.S. On your point on

The GNOME overview will show the "hidden" Tilix "quake" terminal permanently.

with respac-by's extension, that's not the case anymore, see https://github.com/repsac-by/gnome-shell-extension-quake-mode/issues/40.

Arcitec commented 2 years ago

@RafalSkolasinski

Thanks @Bananaman for suggesting ddterm. It does work well and your script for converting colour scheme is really helpful!

Glad that it helped! :)

 

Just wanted to mention that it is a bit more of a stop-gap solution for a quake mode when other workarounds do not work well. It is unfortunately missing tiling option :(.

Oh you mean tiling side-by-side? Yeah ddterm lacks that, but it's a freaking dropdown terminal. :D Most people I've seen, me included, only use 1 session in our dropdown. No tiling or tabs at all. At most, I press Ctrl-Shift-N which opens new tabs inside the ddterm dropdown, if I need to quickly do two commands and want to see both of their outputs. You can also use Alt-1/9 to switch instantly to a specific tab. A dropdown is usually just used for quick, temporary commands, like "F12; sudo dnf install somenewpackage; F12". For serious work I launch the actual Tilix (I have a global hotkey Super-T to launch it) and do full tiling.

 

Thanks for letting me know that the repsac extension has patched GNOME to hide the window from the overview and alt-tab. That's a good change. I'll edit the post above to mention it now.

Their patch is a little bit worrying because it overwrites some GNOME Shell functions which other extensions also hook, so it may not be stable if you use things like Pop-Shell (which also overwrites those exact same functions) at the same time, since you then get a hook on top of a hook on top of the original function:

https://github.com/repsac-by/gnome-shell-extension-quake-mode/pull/44/files

For example, Pop Shell's hook (I haven't looked at their code in a while) could unhide the window that repsac's hook hides. It's not a bad solution that they've chosen, but just beware that it might not always work.

Another worrying thing is its method of identifying the Tilix "dropdown" window: "Get the Tilix app, get the 1st window owned by the app, hide that". That method breaks if the dropdown window isn't the 1st window owned by Tilix. Keep in mind that Tilix is a single-process app and that all windows run in the same process. So the new hiding could hide the wrong Tilix window very easily, if you exit from the Dropdown window (type exit) and then start a normal Tilix window (which now becomes window 1). The normal window will then be the 1st window and will be hidden instead.

Actually, looking at their code some more, they may never update the this.win reference to the "dropdown window", so if you exit the repsac extension's dropdown window, the dropdown may never come back... Or perhaps it might come back but in that case it would identify the wrong (an existing Tilix "1st window") as "the dropdown". Still too hacky for me.

But anyway, for people who use that extension instead, you'll probably like tilix --window-style=borderless which removes the borders on the dropdown. So if the repsac extension supports providing app arguments, you can use that to hide the window style on the dropdown.

RafalSkolasinski commented 2 years ago

Oh you mean tiling side-by-side? Yeah ddterm lacks that, but it's a freaking dropdown terminal. :D Most people I've seen, me included, only use 1 session in our dropdown. No tiling or tabs at all. At most, I press Ctrl-Shift-N which opens new tabs inside the ddterm dropdown, if I need to quickly do two commands and want to see both of their outputs. A dropdown is usually just used for quick, temporary commands, like "F12; sudo dnf install somenewpackage; F12". For serious work I launch the actual Tilix (hotkey Super-T to launch it) and do full tiling.

I agree, tabs cover most of use cases. But as I work a lot with k8s and microservices I often need to track outputs of multiple terminals at once so I definitely still feel lack of tiles

Arcitec commented 2 years ago

@RafalSkolasinski Hmm, I guess your old workflow was to start a bunch of services in a dropdown terminal and then just letting them sit there? Try to look for a "real" management GUI for that instead. I recommend this one: https://cockpit-project.org/

It runs a service which manages your containers and you can just watch it all in a browser with status monitoring etc. :)

Edit: I see that Kubernetes support was removed from Cockpit in 2018 because nobody wanted to maintain it. It supports other container formats such as Docker/Podman though. There are other projects that can manage Kubernetes, and the point was that it would be worth looking for a "proper" admin panel for kubernetes instead of running jankily in a dropdown term. :D

RafalSkolasinski commented 2 years ago

I'd disagree, there's nothing better than k9s and kubectl to dive deep and find out what you need for debugging ;-).

For GUI there's Lens which is quite okay. But when you want to at the same time track logs of differentpods to see how "events" propagates etc... Tilix + k9s beats everything.