Alexays / Waybar

Highly customizable Wayland bar for Sway and Wlroots based compositors. :v: :tada:
MIT License
5.86k stars 660 forks source link

Hide title in `sway/window` when window title is shown by Sway #997

Open savchenko opened 3 years ago

savchenko commented 3 years ago

While immensely useful, sway/window module can become a visual distraction when title is displayed by Sway and Waybar simultaneously. Consider two examples.

  1. Sway is in stacking mode, title is shown in Waybar only: image

  2. Sway is in tabbed mode, title is shown by both applications: image

Latter is confusing as information is clearly redundant. Would it be possible to add a check before displaying a title? Something like this:

# Pseudocode
if sway.window.mode() == "tabbed" and sway.window.focused():
    waybar.module['sway/window'].format = ""
else
    waybar.module['sway/window'].format = "{}"
max-k commented 3 years ago

Hi, With the following config in Sway, you'll avoid to show window title when there is only one windows opened:

default_border none
hide_edge_borders --i3 smart
smart_borders smart

The problem will still be present when more than one window is opened in tabbed mode.

savchenko commented 3 years ago

@max-k , Thank you for the suggestion, I've already had something similar, albeit without the --i3 flag which is now added :) Could you explain smart_borders smart? Looking at man 5 sway it can be either "on", "no_gaps" or "off".

@Alexays, Would you consider adding something like rysolv.com / bugbounty / etc. to Waybar repo?

max-k commented 3 years ago

@savchenko You're right. I read this in the chapter dedicated to hide_edge_borders parameter.

hide_edge_borders [--i3] none|vertical|horizontal|both|smart|smart_no_gaps

    Hides window borders adjacent to the screen edges. Default is none. The --i3 option enables i3-compatible behavior to hide the title bar on tabbed and stacked containers with one child. The smart|smart_no_gaps options are equivalent to setting smart_borders smart|no_gaps and hide_edge_borders none.

But there is probably a typo here.

max-k commented 3 years ago

@savchenko I double-checked and this combination of parameters is sufficient.

default_border none
hide_edge_borders --i3 smart

No need to use smart_borders at all.

savchenko commented 3 years ago

@max-k ,

Well, hiding the border is a bit brute-force. Here is what works with Sway v1.5:

default_border pixel 2
default_floating_border pixel 2
hide_edge_borders --i3 smart
smart_borders on
smart_gaps on
titlebar_border_thickness 0

And yes, it works only with the single window opened, so this issue is still valid.