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

Native window decorations for GNOME Wayland #3284

Closed
DiegoMagdaleno opened this issue Feb 2, 2021 · 66 comments
Closed

Native window decorations for GNOME Wayland #3284

DiegoMagdaleno opened this issue Feb 2, 2021 · 66 comments

Comments

@DiegoMagdaleno
Copy link

Hi, im a developer, and Im interested in kitty, I was sad when I saw it doesn't support client side decorations, since im a wayland gnome user, I would love to say I have other options, but sadly with my HiDPI monitor, it looks like wayland is my only option.

I would be glad to try to get to some extent some client side decorations working, what is kitty missing to support this feature? is it possible? is the possibility of supporting this good?

Thanks! And of course thank you for your awesome software, it makes using the terminal much much better.

@kovidgoyal
Copy link
Owner

It supports client side decorations already, they are just simple white
borders without any functionality other than dragging/resizing. If you want
decorations with more functionality you would need to actually implement
it in wl_window.c. Possibly using something like libdecoration, or since
GNOME is the only window manager stupid enough to not implement server
side decorations, just directly use gtk libraries. But note that I am not
willing to have kitty require GTK as a hard dependency at either build
or run time. That means putting the code into a separate .so module that
is built only if gtk is found in setup.py via pkg-config and that is
loaded dynamically at runtime via dlopen.

@DiegoMagdaleno
Copy link
Author

Thanks, I get into it! And yeah I respect your decision and it was actually what I had in mind!

@kovidgoyal
Copy link
Owner

Cool, all the best. Feel free to ask questions if you need clarification,
although I am no Wayland expert.

@kovidgoyal kovidgoyal changed the title What would it take to suport Client Side Decorations? Native window decorations for GNOME Wayland Feb 6, 2021
@ljrk0
Copy link
Contributor

ljrk0 commented Mar 9, 2021

Note that there's work on adding glfw CSD support via libdecoration already:
glfw/glfw#1693

@kovidgoyal
Copy link
Owner

I looked into this and libdecoration is half baked, at best. It currently supports only a simple titlebar drawn using cairo, which is pointless since it wont be native anyway. And it hasn't even been released, ever.

If I were you I'd skip libdecoration entirely and just draw the titlebar using gtk libraries. Or better, stop using GNOME.

@DragonSWDev
Copy link

It currently supports only a simple titlebar drawn using cairo, which is pointless since it wont be native anyway

There is some work in progress to implement GTK plugin for libdecoration which should integrate with desktop pretty nicely. Even without it it's probably still better to have simple cairo titlebar than non functional or even no titlebar at all.

There is also some interest in SDL to pickup libdecoration. When it will happen libdecoration probably will be available in repositories of popular distributions.

@kovidgoyal
Copy link
Owner

Is this work happening in a public repository somewhere? And there is no need for libcairo just to draw a title. kitty already includes both harfbuzz and fontconfig/freetype that are together perfectly capable of doing simple single line text layout/rendering. In fact, I think I will just add support for rendering titles to the current empty titlebar. Should be a day or so of work.

@DragonSWDev
Copy link

DragonSWDev commented Mar 29, 2021

There is merge request about this on libdecoration GitLab. I also tested this and it worked pretty reliably. Not perfect but gives some preview how it should work in future.

Your solution seems nice for now. libdecoration is fine (at least for me) but it's still WIP so maybe waiting for official support on GLFW side isn't bad idea.

@kovidgoyal
Copy link
Owner

In master now kitty has fully functional though non native decorations on GNOME.

@molaeiali
Copy link

After updating to 0.20.0 today on Arch Gnome 40, My window decorations are gone, is this related? Is this a feature or a bug? Is there any way to bring them back in the config?
Screenshot from 2021-04-19 19-19-45

@kovidgoyal
Copy link
Owner

They arent gone they are just not native. If you want native set linux_display_server to x11 in kitty.conf which was what it used to default to.

@ljrk0
Copy link
Contributor

ljrk0 commented Apr 19, 2021

After updating to 0.20.0 today on Arch Gnome 40, My window decorations are gone, is this related? Is this a feature or a bug? Is there any way to bring them back in the config?

These are window decorations! They are "non native" in the sense of they aren't GNOME themed, but they are "there" ;)

Basically there are two camps when it comes to window decorations: client side and server side. The latter is the more classical approach of having the window decorations be drawn by the desktop environment and the application itself is only responsible for the "content". This was what everyone did in the X11 world, even GNOME.

With Wayland, GNOME deprecated support for server side decorations in their own software. There are wayland compositors that allow for SSDs, Mutter doesn't. That means, each Wayland application must draw its own CSDs in GNOME.

Before the latest update you ran kitty as XWayland application, and thus GNOME added SSDs due to backwards compatibility.
Kitty now defaults to wayland directly and brings their own CSDs which are more minimal than what GNOMEs X11 SSDs provided.

You can either switch back to Xwayland, implement "proper" CSDs in kitty yourself or nag the GNOME team to support SSDs again in Wayland :)

@RedDocMD
Copy link

You can either switch back to Xwayland, implement "proper" CSDs in kitty yourself or nag the GNOME team to support SSDs again in Wayland :)

Yeah XWayland sounds good to me, as it is half of the applications that I use do that.

In master now kitty has fully functional though non native decorations on GNOME.

How do I close the terminal? I don't see a close button or something like that. Is there a way to add that? (like what do I do to add that?)

@kovidgoyal
Copy link
Owner

kovidgoyal commented Apr 20, 2021 via email

@RedDocMD
Copy link

Is there any real advantage of using native Wayland over XWayland, as far as Kitty is concerned?

@feyzee
Copy link

feyzee commented Apr 24, 2021

After updating to 0.20.0 today on Arch Gnome 40, My window decorations are gone, is this related? Is this a feature or a bug? Is there any way to bring them back in the config?
Screenshot from 2021-04-19 19-19-45

Is there a way to change the white colour for window decoration?

@metal3d
Copy link

metal3d commented Apr 24, 2021

Yes, really, please, give us a way to come back to the Gnome title... I loved kitty because It was really easy to integrate with colors and font, but this white bar is very ugly here...
image

@RedDocMD
Copy link

RedDocMD commented Apr 24, 2021

They arent gone they are just not native. If you want native set linux_display_server to x11 in kitty.conf which was what it used to default to.

This is what I think you are looking for @metal3d and @stellarexplosions

@metal3d
Copy link

metal3d commented Apr 24, 2021

OK...

# in ~/.config/kitty/kitty.conf
linux_display_server x11

Sorry for this :) Didn't seen this comment

@slrtbtfs
Copy link

slrtbtfs commented Apr 24, 2021

Is there any real advantage of using native Wayland over XWayland, as far as Kitty is concerned?

The most visible advantage of using Wayland is that the window properly scales on HiDPI screens.

When using Xwayland, kitty will look blurry if window scaling is enabled.

@feyzee
Copy link

feyzee commented Apr 25, 2021

They arent gone they are just not native. If you want native set linux_display_server to x11 in kitty.conf which was what it used to default to.

This is what I think you are looking for @metal3d and @stellarexplosions

It works, but I want to keep using Wayland. I just want to change the color of window decoration from white to something dark. AFAIK in Wayland window decorations are implemented by compositor and Gnome's Mutter only implements CSD. Is there like a setting that i can use to override the window decoration color?

image

@kovidgoyal
Copy link
Owner

kovidgoyal commented Apr 25, 2021 via email

@topazus
Copy link

topazus commented Apr 26, 2021

In my Gnome wayland, I can't scroll cursor mutiple line by the mouse wheel. It only scroll cusor one line at a time.

@Luflosi
Copy link
Contributor

Luflosi commented Apr 26, 2021

See https://sw.kovidgoyal.net/kitty/conf.html#opt-kitty.touch_scroll_multiplier.

@topazus
Copy link

topazus commented Apr 26, 2021

@Luflosi after setting touch_scroll_multiplier 5.0 in Gnome Wayland, the problem of scrolling cursor mutiple line by the mouse wheel is solved. but I wonder that the configuration parameter said that it Modify the amount scrolled by a touchpad. not mouse wheel.

btw, Is there a way to get the window title to mid position
image

@numToStr
Copy link

I am using KDE Plasma w/ Wayland and hide_window_decorations yes doesn't seem to have any effect. Is this also one of the wayland quirks?

@kovidgoyal
Copy link
Owner

kovidgoyal commented Jun 19, 2022 via email

@noizo
Copy link

noizo commented Aug 29, 2022

When i use X11 decorations, and quake-mode gnome extension to show slide down kitty window, after few slides window becomes invisible. I know it has slide down, but it's completely transparent and unusable.
As soon as i switch back to auto or wayland window becomes visible as usual.

@ceed0
Copy link

ceed0 commented Aug 29, 2022

Try to disable remember_window_size option.

@noizo
Copy link

noizo commented Aug 30, 2022

Thanks, i guess it did a trick.

@noizo
Copy link

noizo commented Sep 2, 2022

And how about native wayland decorations? Just asking @kovidgoyal

@lukurde
Copy link

lukurde commented Nov 10, 2022

libdecor (library for client-side decorators on Wayland) just merged support for using GTK decorators!

https://gitlab.gnome.org/jadahl/libdecor/-/merge_requests/43

@hykilpikonna
Copy link

After enabling linux_display_server x11, the close button shows but not the minimize/maximize buttons, which were present when I launch Gnome in X11. Is there a solution for this?

image

@DiegoMagdaleno DiegoMagdaleno removed their assignment Jan 3, 2023
@Jeoshua
Copy link

Jeoshua commented Jan 12, 2023

Honestly, I would be fine with this wayland windowing style if it would just respect dark mode. White sticks out like a sore thumb, and I just can't be the only terminal aficionado who feels this way.

@metal3d
Copy link

metal3d commented Jan 12, 2023

Honestly, I would be fine with this wayland windowing style if it would just respect dark mode. White sticks out like a sore thumb, and I just can't be the only terminal aficionado who feels this way.

On Linux, you can read dbus as I did it in fyne.io project:
https://github.com/fyne-io/fyne/blob/develop/app/app_xdg.go#L36

And the theme change event:
https://github.com/fyne-io/fyne/blob/develop/app/app_xdg.go#L167

@kovidgoyal
Copy link
Owner

kovidgoyal commented Jan 13, 2023 via email

@ceed0
Copy link

ceed0 commented Jan 13, 2023

@Jeoshua
Just use a script that will rewrite kitty's config to switch between light and dark theme.

Here's an example

#!/bin/sh

kitty() {
    if [ -e "${XDG_CONFIG_HOME}/kitty/kitty.conf" ]; then
        sed -ie "/^include theme-/s/light\|dark/${THEME}/" "${XDG_CONFIG_HOME}/kitty/kitty.conf"
        killall -e -USR1 kitty
    fi
}

case "$1" in
    light)
        THEME=light
        kitty
        ;;
    dark)
        THEME=dark
        kitty
        ;;
    *)
        echo "Usage: $(basename "$0") [light|dark]"
esac

@rdtorres
Copy link

After enabling linux_display_server x11, the close button shows but not the minimize/maximize buttons, which were present when I launch Gnome in X11. Is there a solution for this?

image

Just press alt + space and gnome will open a context menu from where you can do all operations : close, maximize, minimize and etc.

image

@sharpenedblade
Copy link

glfw/glfw#1639 was just merged, so glfw can show proper client side decorations that look somewhat native.

@AniAggarwal
Copy link

@kovidgoyal do you think it would be an easy addition to add an option to change or at least remove the cat emoji from the minimal decorations kitty is currently doing?
Thanks again for the huge number of features you are constantly adding!

@hrqmonteiro
Copy link

@kovidgoyal do you think it would be an easy addition to add an option to change or at least remove the cat emoji from the minimal decorations kitty is currently doing? Thanks again for the huge number of features you are constantly adding!

That cat emoji is just awful

@RushingAlien
Copy link

RushingAlien commented May 5, 2023

libdecor main branch now has a GTK plugin, so now it can draw GTK-based window decorations to wayland clients.
I think it's worth another look : https://gitlab.freedesktop.org/libdecor/libdecor

@vollowx
Copy link

vollowx commented Jul 6, 2023

After enabling linux_display_server x11, the close button shows but not the minimize/maximize buttons, which were present when I launch Gnome in X11. Is there a solution for this?

image

This should be controlled by gnome-tweaks (if you use GNOME you can), or simply use gsettings

@rlees85
Copy link

rlees85 commented Jul 27, 2023

Is there any way to minimize Kitty? Like a shortcut key? Google is coming up short - just brings me to this thread but I don't understand what Wayland decorations have to do with the ability to minimize. I use lots of apps that don't have normal decorations under Gnome Wayland yet Kitty is the only one that won't minimize.

@rdtorres posted an image above and you can see for yourself - no minimize option.

@baco
Copy link

baco commented Jul 27, 2023

Is there any way to minimize Kitty? Like a shortcut key? Google is coming up short - just

The official combination is Super+h. It is working for me. I also don't use the following in Kitty's config:

linux_display_server x11

under GNOME+Wayland

@hrqmonteiro
Copy link

Surprised that after two years this still isn't a thing, it's a basic feature and if it was a thing it'd be my favorite terminal. It doesn't mix with my desktop and my tiling extension seems to not like it.

The mantainers of this project are kind of a joke. I abandoned this terminal for Wezterm cause of this lack of very basic things.

@Octelly
Copy link

Octelly commented Dec 18, 2023

Surprised that after two years this still isn't a thing, it's a basic feature and if it was a thing it'd be my favorite terminal. It doesn't mix with my desktop and my tiling extension seems to not like it.

The mantainers of this project are kind of a joke. I abandoned this terminal for Wezterm cause of this lack of very basic things.

unfortunately ended up doing the exact same thing

@AidanNotFunny
Copy link

AidanNotFunny commented Dec 20, 2023

If I were you I'd skip libdecoration entirely and just draw the titlebar using gtk libraries. Or better, stop using GNOME.

Telling someone to just "stop using GNOME" is... interesting to say the least, especially coming from the owner of the project. Have you tried thinking before typing extra unnecessary words?

This is a terminal, for use by keyboard afficionados.

This is not a "solution" for missing functionality

@kovidgoyal
Copy link
Owner

I have now heard enough comments from morons, this thread has become an unmitigated waste of my time. If somebody wants to waste their lives catering to the dictates of GNOME, open a PR with code implementing libdecor integration and we can discuss, otherwise stop wasting my time.

Repository owner locked and limited conversation to collaborators Dec 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests