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

gtk: window border is not removed if window-decoration is false #2023

Closed
echasnovski opened this issue Aug 1, 2024 · 30 comments · Fixed by #2222 or #5581
Closed

gtk: window border is not removed if window-decoration is false #2023

echasnovski opened this issue Aug 1, 2024 · 30 comments · Fixed by #2222 or #5581
Labels
gui GUI or app issue regardless of platform (i.e. Swift, GTK) needs-confirmation A reproduction has been reported, but the bug hasn't been confirmed or reproduced by a maintainer. os/linux
Milestone

Comments

@echasnovski
Copy link
Collaborator

On current main (4cf6202) window border is not removed with window-decoration=false but it is removed with gtk-titlebar=false.
I've bisected the behavior change to 2d7baaa (i.e. #1950).

As documentation says that both titlebar and borders should be disabled when window-decoration=false, I am not sure if this is an issue with documentation or code.

OS: Linux
Window manager: i3

Screenshots:

ghostty (with default config):

screenshot_2024-08-01_12:15:56

ghostty --window-decoration=false:

screenshot_2024-08-01_12:16:16

ghostty --gtk-titlebar=false:

screenshot_2024-08-01_12:16:34

@mitchellh mitchellh added the needs-confirmation A reproduction has been reported, but the bug hasn't been confirmed or reproduced by a maintainer. label Aug 1, 2024
@mitchellh
Copy link
Contributor

Hm, I could use a GTK expert on this one. We have to create the titlebar for toggling window decorations to work, adding it later didn't work in my testing (but could be a skill issue). Should we update the docs here?

cc @tristan957 @jcollie

@tristan957
Copy link
Collaborator

Reading the GTK documentation, it isn't clear how the two properties interact. What is the benefit of having separate window-decoration and gtk-titlebar options? Should they just be combined into a unified window-decoration option with the caveat that on linux window-decoration also turns off the titlebar?

@neurocyte
Copy link
Collaborator

neurocyte commented Aug 1, 2024

There are four different states, so two bits make sense. The naming of the options seems wrong though.

window-decoration, gtk-titlebar

  1. true, true = full gtk title bar and normal border with rounded corners
  2. false, true = no titlebar, normal border with rounded corners
  3. true, false = plain titlebar with no controls, normal border with rounded corners
  4. false, false = no window decorations at all

@mitchellh
Copy link
Contributor

The issue is that we want to provide toggle_window_decorations action. For that to work, the header must already exist. We can't at runtime with an existing window toggle them without that (again, may be a skill issue but the obvious approach didn't work for me).

For that reason, I'm leaning towards updating the docs that this may include a border unless BOTH are false.

@neurocyte
Copy link
Collaborator

To match the documentation and parameter names I would say that gtk-titlebar=false should mean state 2 (in my last post) and window-decoration=false should mean state 4 (irrespective of gtk-titlebar). State 3 is pretty useless I'd say.

mitchellh added a commit that referenced this issue Sep 12, 2024
Fixes #2023
Fixes regression from #2051

#2051 introduced a regression where `window-decoration=false` had no
effect when libadwaita was in use. Further, the
`toggle_window_decorations` keybinding also had no effect whatsoever.

This commit fixes this and #2023 by explicitly hiding the header bar
when window decorations are disabled. We hide the header bar rather than
the full top bar because we still want the tab bar to show up with
window decorations disabled.
@mitchellh
Copy link
Contributor

I believe this will be fixed with #2222. If someone could confirm that'd be great. It wasn't my intention to fix this issue with that PR but it may work. If it didn't work then please comment and I'll reopen.

@echasnovski
Copy link
Collaborator Author

@mitchellh, I still can reproduce the same behavior in debug build at info: ghostty version=0.1.0-main+3558ac9a.

The main confusion here for me is that --window-decoration=false does not remove border (although based on the name I'd assume it would) while --gtk-titlebar=false does (although based on the name I'd assume it would not).

@mitchellh mitchellh reopened this Sep 12, 2024
@mitchellh
Copy link
Contributor

Got it. Yeah I think we need to fix this with docs because it appears to just be a silly GTK quirk and potentially theme dependent too.

@mitchellh mitchellh added os/linux gui GUI or app issue regardless of platform (i.e. Swift, GTK) labels Oct 6, 2024
@mitchellh mitchellh changed the title Window border is not removed if window-decoration is false gtk: window border is not removed if window-decoration is false Oct 6, 2024
@tjbarber
Copy link

Confirmed that this is still happening, but they do go away with:

gtk-titlebar=false
window-decoration=false

@davidbudzynski
Copy link

I'm having similar issue using Arch and Qtile WM. It looks like window-decoration = false yields removes decorations but rounded corners stay like so:

Image

if I comment out window-decoration = false and add gtk-titlebar = false, this solves my issue with rounded corners being present.

Image

I'm assuming that gtk-titlebar is Linux specific or Linux with a WM specific and
window-decoration is irrelevant?

adomixaszvers added a commit to adomixaszvers/dotfiles-nix that referenced this issue Dec 28, 2024
adomixaszvers added a commit to adomixaszvers/dotfiles-nix that referenced this issue Dec 31, 2024
@treeman
Copy link

treeman commented Jan 1, 2025

As of today (1.0.2-main+60611b8a) I can no longer disable borders with window-decoration nor gtk-titlebar:

window-decoration = false
gtk-titlebar = false

Image

gtk-titlebar doesn't seem to have any effect anymore.

Edit: Reverting to 1.0.1-HEAD+a8e5eef1 fixed the issue

@davidbudzynski
Copy link

davidbudzynski commented Jan 1, 2025 via email

@jcollie
Copy link
Collaborator

jcollie commented Jan 1, 2025

See #4224

@treeman
Copy link

treeman commented Jan 2, 2025

See #4224

Thank you, gtk-adwaita = false made the borders go away again.

@Gelmo
Copy link

Gelmo commented Jan 2, 2025

Small problem. With gtk-adwaita = false, the tabs are no longer respecting the window theme. Config:

theme = DraculaFix
window-theme = ghostty
gtk-titlebar = false
gtk-adwaita = false

Screenshot:
Image

Description:

The top window shows gtk-adwaita = true, and the bottom window shows gtk-adwaita = false. I'd like to have the lack of border from the bottom window, with the colors used in the top window. I actually prefer the styling of the non-Adwaita tab bar, but wish it was the same colors as specified for the Ghostty theme.

I think the following should all be configurable by the user:

  • No title bar (both windows shown above)
  • No border (the bottom window shown above)
  • Properly themed tabs regardless of whether or not Adwaita is used

Ideal config:

theme = DraculaFix
window-theme = ghostty
gtk-titlebar = false
gtk-border = false
tab-theme = ghostty

Or

theme = DraculaFix
window-theme = ghostty
gtk-titlebar = false
gtk-border = false
tab-theme = ghostty
gtk-adwaita = false

The only difference in the above configs would be the layout/rounding/highlighting of the tab bar (Adwaita layout vs vanilla GTK layout), with both using the same colors.

I suppose this could help get what I want - #4089 - But still leaving my opinions here in case others feel the same

@tristan957
Copy link
Collaborator

Small problem. With gtk-adwaita = false, the tabs are no longer respecting the window theme.

Yes, this is expected behavior, and is documented as such. Please read the documentation.

@Gelmo
Copy link

Gelmo commented Jan 3, 2025

Yes, this is expected behavior, and is documented as such. Please read the documentation.

Right, I have done so. I'm posting because my desired behavior is not currently supported, and it's related to this issue. As discussed in this issue and #4224 the gtk window border is shown unless you set gtk-adwaita = false.

I'm stating that setting gtk-adwaita = false results in other changes, as well, which are undesirable to this user (me). And therefore, having a way to disable the border while respecting the used theme could be beneficial.

I wanted to post my comment in response to this - #4224 (comment) - However, with that discussion being listed as "Answered" I feel that it may not get attention from the appropriate people; that's why I posted here.

I doubt I am the only person who wants to be able to remove the border while also having their set GTK theme respected. Maybe I am now, with Ghostty being recently made public, but over time there will be others with the same gripe.

I use a non-Adwaita GTK theme. I don't think it's unreasonable to expect to be able to use my set GTK theme without being forced onto another theme (Adwaita) that doesn't fit the rest of my environment.

Should I post this in the other discussion? Open a new discussion? Give up on any hope of Ghostty being able to be configured as desired and go back to another terminal emulator?

@Gelmo
Copy link

Gelmo commented Jan 3, 2025

Here's a screenshot of another GTK application that respects my set theme

Image

Just to confirm that the issue is unrelated to my set theme.

Edit: I have "resolved" this by copying my gtk theme from the globally installed location to .config/gtk-4.0/. For all other GTK apps that I use, the theme is picked up correctly from the global install location /usr/share/themes/. Might want to look into why globally-installed themes aren't being found.

@tristan957
Copy link
Collaborator

I'm stating that setting gtk-adwaita = false results in other changes, as well, which are undesirable to this user (me). And therefore, having a way to disable the border while respecting the used theme could be beneficial.

Using Adwaita has pros and cons, and is something that every user must balance for their own sake. Reworking the Adwaita theme to meet expectations that it is not meant for is not something that I would advocate for within Ghostty.

@Gelmo
Copy link

Gelmo commented Jan 3, 2025

Using Adwaita has pros and cons, and is something that every user must balance for their own sake. Reworking the Adwaita theme to meet expectations that it is not meant for is not something that I would advocate for within Ghostty.

Yes, I agree that adwaita behavior shouldn't be modified. I'm saying that when adwaita is disabled, it should use the globally-set GTK theme, and in my case, it doesn't unless the theme is installed locally for the user (which is not necessary for other GTK applications that I utilize)

@jcollie
Copy link
Collaborator

jcollie commented Jan 3, 2025

We're going to explore the use of some Wayland protocols to enable server-side decorations if we're not running on Gnome. So it may be possible to keep Adwaita and have server-side decorations. No promises, this is at the concept stage and very experimental and probably won't make 1.0.2.

@tristan957
Copy link
Collaborator

Yes, I agree that adwaita behavior shouldn't be modified. I'm saying that when adwaita is disabled, it should use the globally-set GTK theme, and in my case, it doesn't unless the theme is installed locally for the user (which is not necessary for other GTK applications that I utilize)

We are not doing anything that would preclude GTK from picking up your theme if adwaita is disabled.

@Gelmo
Copy link

Gelmo commented Jan 3, 2025

We're going to explore the use of some Wayland protocols to enable server-side decorations if we're not running on Gnome.

What about people using X11?

@Gelmo
Copy link

Gelmo commented Jan 3, 2025

We are not doing anything that would preclude GTK from picking up your theme if adwaita is disabled.

That's what I would have assumed, but it doesn't explain why other GTK apps didn't require my theme to be installed per-user

@mitchellh
Copy link
Contributor

What about people using X11?

We have experienced volunteers doing good work pursuing Wayland improvements and don’t presently have the same enthusiasm for X11. I’m not against it at all, it’s just the present state of contribution.

@JenChampagne
Copy link

For what it's worth, I'm on X11 and was able to hide borders with the following config when I was on commit 037de64e:

gtk-adwaita=false
gtk-titlebar=false
window-decoration=false

I just upgraded to commit ff9414d9 and borders are back despite those configs. I was able to narrow it down to commit c4ece2a, so I'll stay on the prior commit for now.

I don't have the ability to help with code at the moment but I'm happy to be a test subject at least 😆

Some of my system details in case it's helpful:
OS: Linux hostname 6.5.0-0.deb12.4-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.5.10-1~bpo12+1 (2023-11-23) x86_64 GNU/Linux
X.Org version: 1.21.1.7
i3: 4.22 (2023-01-02)

@treeman
Copy link

treeman commented Jan 31, 2025

With Ghostty 1.1.0 the borders are still present.

With window-decoration = none I still get a small border but with commit 1baf8928 I don't get this border (1baf8928 on the left without a border, and 1.1.0 on the right with a small dark blue border):

Image

If I add gtk-adwaita = false then i get the same border as in the second image of OP.

Edit: This is on Void Linux with X11.

@pluiedev
Copy link
Contributor

pluiedev commented Feb 5, 2025

This is fundamentally because libadwaita adds a slight outline to all windows and there's no easy way to disable that aside from custom CSS. The actual fix itself is very simple, but I'm not sure if we want to include this as a part of our SSD styling:

.window {
  outline-width: 0px;
}

Without CSS:
Image

With CSS:
Image

EDIT: Looks like there's actually a bug on our end. We're applying CSD styling even when we're using SSDs.

@treeman
Copy link

treeman commented Feb 5, 2025

The small extra border I wrote about above is still there after the latest fix (small blue border to the right):

liby pushed a commit to liby/ghostty that referenced this issue Feb 11, 2025
rockorager pushed a commit to rockorager/ghostty that referenced this issue Feb 12, 2025
@CatalinVoineag
Copy link

I still have this issue even after the fix was merged.

I managed to fix mine by adding custom CSS to my ghostty config


# ghostty/config file
window-decoration = false
gtk-custom-css = ./custom.css


# custom.css file
window {
  padding: 0
}

ibhagwan added a commit to ibhagwan/dots that referenced this issue Feb 22, 2025
ibhagwan added a commit to ibhagwan/dots that referenced this issue Feb 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gui GUI or app issue regardless of platform (i.e. Swift, GTK) needs-confirmation A reproduction has been reported, but the bug hasn't been confirmed or reproduced by a maintainer. os/linux
Projects
None yet