kovidgoyal / kitty

Cross-platform, fast, feature-rich, GPU based terminal
https://sw.kovidgoyal.net/kitty/
GNU General Public License v3.0
22.14k stars 908 forks source link

`background_opacity` not working in fullscreen under Sway #7338

Closed josswright closed 1 month ago

josswright commented 1 month ago

Describe the bug I am running kitty under sway with background_opacity set to 0.9, and a background defined in sway's config file: via `output "*" bg " fill'.

The opacity setting works perfectly until I make kitty fullscreen, either by keyboard shortcut or by startup options. I originally noticed this when I tried to run kitty with its --start-as fullscreen option.

When I exit fullscreen, then background opacity works as before.

I saw in another issue that there's something strange about how sway sets its background image, so maybe this is related?

To Reproduce Steps to reproduce the behavior:

  1. Run kitty, with -o background_opacity=0.8 in sway with a background set, then maximise (either by sway's keyboard shortcut, or kitty's.)
  2. (Alternatively) Run kitty --start-as fullscreen -o background_opacity=0.8.

The background of the kitty window will be solid background colour.

Environment details

kitty 0.33.1 created by Kovid Goyal
Linux lovecraft 6.8.2-arch2-1 #1 SMP PREEMPT_DYNAMIC Thu, 28 Mar 2024 17:06:35 +0000 x86_64
Arch Linux 6.8.2-arch2-1 (/dev/tty)

Running under: Wayland
Frozen: False
Paths:
  kitty: /usr/bin/kitty
  base dir: /usr/lib/kitty
  extensions dir: /usr/lib/kitty/kitty
  system shell: /usr/bin/zsh
Loaded config files:
  /home/<user>/.config/kitty/kitty.conf

Config options different from defaults:
allow_remote_control       yes
background_opacity         0.97
bold_font                  Space Mono Pure Bold
bold_italic_font           Space Mono Pure Bold Italic
click_interval             0.5
close_on_child_death       True
confirm_os_window_close    0
copy_on_select             clipboard
cursor_blink_interval      0.5
cursor_shape               3
cursor_stop_blinking_after 0
disable_ligatures          2
enable_audio_bell          False
font_family                Space Mono Pure
font_size                  10.0
initial_window_height      (200, 'px')
initial_window_width       (320, 'px')
input_delay                1
italic_font                Space Mono Pure Italic
macos_option_as_alt        3
mouse_hide_wait            10.0
remember_window_size       False
scrollback_pager           ['less', '+G', '-R']
select_by_word_characters  :@-./_~?&=%+#
shell_integration          frozenset({'no-sudo'})
symbol_map:
    U+0400 - U+04ff → SF Mono
    U+2800 - U+28ff → Fira Code Medium
    U+3040 - U+309f → Sarasa Mono CL
    U+30a0 - U+30ff → Sarasa Mono CL
    U+4e00 - U+9fff → Sarasa Mono CL
    U+ff00 - U+ffef → Sarasa Mono CL
url_style                  1
window_border_width        (1.0, 'pt')
Changed shortcuts:
    kitty_mod+- →  decrease_font_size
    kitty_mod+= →  increase_font_size
    kitty_mod+backspace →  restore_font_size
    kitty_mod+e →  run_simple_kitten text url_hints
    kitty_mod+u →  input_unicode_character
Colors:
    active_border_color        #526270   
    active_tab_background      #171d23   
    active_tab_foreground      #d8e2ec   
    background                 #171d23   
    color0                     #171d23   
    color1                     #d95468   
    color10                    #1d252c   
    color11                    #28323a   
    color12                    #b7c5d3   
    color13                    #f6f6f8   
    color14                    #dd9d82   
    color15                    #fbfbfd   
    color2                     #8bd49c   
    color3                     #ebbf83   
    color4                     #539afc   
    color5                     #b62d65   
    color6                     #70e1e8   
    color7                     #d8e2ec   
    color8                     #526270   
    color9                     #ff9e64   
    cursor                     #d8e2ec   
    foreground                 #d8e2ec   
    inactive_border_color      #1d252c   
    inactive_tab_background    #1d252c   
    inactive_tab_foreground    #b7c5d3   
    selection_background       #d8e2ec   
    selection_foreground       #171d23   
    tab_bar_background         #1d252c   
    url_color                  #b7c5d3   

Important environment variables seen by the kitty process:
    PATH                                <censored>
    LANG                                en_GB.UTF-8
    VISUAL                              /usr/bin/vim
    EDITOR                              /usr/bin/vim
    SHELL                               /usr/bin/zsh
    DISPLAY                             :0
    WAYLAND_DISPLAY                     wayland-1
    USER                                <censored>
    XCURSOR_SIZE                        24
    XDG_SEAT                            seat0
    XDG_SESSION_TYPE                    wayland
    XDG_SESSION_CLASS                   user
    LC_MESSAGES                         
    XDG_VTNR                            1
    XDG_SESSION_ID                      4720
    XDG_RUNTIME_DIR                     /run/user/1000

Additional context (Behavoiur is reproduced with kitty --config NONE -o background_opacity=0.8.)

My terminal theme is set via Tinted Theming both for kitty directly, and for zsh via a base16 shell script, so I don't think that this will be due to an interaction with the background colour as mentioned in comments about background_opacity in kitty's default config file.

kovidgoyal commented 1 month ago

This is a wayland limitation, with their usual security theatre excuse for removing useful functionality.

https://gitlab.freedesktop.org/wayland/wayland-protocols/-/issues/116

josswright commented 1 month ago

Ugh. Thanks for replying! Looks like, as of this comment, it's still being actively debated by people wanting fullscreen transparent terminals, so here's hoping that it can be resolved sensibly.

josswright commented 1 month ago

Just to add, in case anyone else stumbles across this, two potential workarounds for a specific, fullscreen terminal. (I use thits for focused writing.)

Tinted background image: kitty --start-as=fullscreen -o background_tint=0.9 -o background_image_layout=cscaled -o background_image=<path_to_background_png>

Alternatively, switch to an empty workspace and hide the bar, so you get effective fullscreen for that terminal. If you use waybar under sway, you can toggle hiding it with a kill -SIGUSR1:

killall -SIGUSR1 waybar
kitty
killall -SIGUSR1 waybar

Both are just minor hacks with annoyances, so I hope that the fundamental wayland issue will be resolved, but for my usage the second is just about working for now.