kovidgoyal / kitty

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

[Hyprland] New window flash black on opening #7963

Closed Frost-Phoenix closed 1 week ago

Frost-Phoenix commented 1 week ago

Describe the bug When opening a new window in hyprland, the initial background color seems to be black and after a few frames it changes to the right color / background_opacity. So it look like the window is flashing black when opening. Setting the background_opacity to 1 seems to fix the issue.

Screenshots

https://github.com/user-attachments/assets/0e55735b-b0d6-4bf7-a867-dd75911dcc4d

Environment details

Kitty debug info ``` kitty 0.36.4 created by Kovid Goyal Linux laptop 6.11.2 #1-NixOS SMP PREEMPT_DYNAMIC Fri Oct 4 14:38:57 UTC 2024 x86_64 <<< Welcome to NixOS 24.11.20241006.c31898a (x86_64) - /dev/tty >>> Run 'nixos-help' for the NixOS manual. DISTRIB_CODENAME=vicuna DISTRIB_DESCRIPTION="NixOS 24.11 (Vicuna)" DISTRIB_ID=nixos DISTRIB_RELEASE="24.11" LSB_VERSION="24.11 (Vicuna)" Running under: Wayland (Hyprland, built from branch at commit 6ae89940c761d4ed4317df0af29e8df41d472091 ().) missing: blur OpenGL: '4.6 (Core Profile) Mesa 24.2.2' Detected version: 4.6 Frozen: False Fonts: medium: CaskaydiaCoveNF-Regular: /nix/store/q8y7x6bbmga68h8bhygcy15lk59n22sk-home-manager-path/share/fonts/truetype/NerdFonts/CaskaydiaCoveNerdFont-Regular.ttf:0 Features: () bold: CaskaydiaCoveNF-SemiBold: /nix/store/q8y7x6bbmga68h8bhygcy15lk59n22sk-home-manager-path/share/fonts/truetype/NerdFonts/CaskaydiaCoveNerdFont-SemiBold.ttf:0 Features: () italic: CaskaydiaCoveNF-Italic: /nix/store/q8y7x6bbmga68h8bhygcy15lk59n22sk-home-manager-path/share/fonts/truetype/NerdFonts/CaskaydiaCoveNerdFont-Italic.ttf:0 Features: () bi: CaskaydiaCoveNF-SemiBoldItalic: /nix/store/q8y7x6bbmga68h8bhygcy15lk59n22sk-home-manager-path/share/fonts/truetype/NerdFonts/CaskaydiaCoveNerdFont-SemiBoldItalic.ttf:0 Features: () Paths: kitty: /nix/store/vhms4hlp9b9adf93y1hhkcqzl8ciwm74-kitty-0.36.4/bin/kitty base dir: /nix/store/vhms4hlp9b9adf93y1hhkcqzl8ciwm74-kitty-0.36.4/lib/kitty extensions dir: /nix/store/vhms4hlp9b9adf93y1hhkcqzl8ciwm74-kitty-0.36.4/lib/kitty/kitty system shell: /run/current-system/sw/bin/zsh Loaded config files: /home/frostphoenix/.config/kitty/kitty.conf Config options different from defaults: active_tab_font_style (False, False) background_opacity 0.5 confirm_os_window_close 0 enable_audio_bell False font_family CaskaydiaCove Nerd Font font_size 15.0 mouse_hide_wait 60.0 scrollback_lines 10000 shell_integration frozenset({'no-rc'}) tab_bar_style powerline tab_title_template {index} Added shortcuts: alt+1 → goto_tab 1 alt+2 → goto_tab 2 alt+3 → goto_tab 3 alt+4 → goto_tab 4 Changed shortcuts: kitty_mod+left → no-op kitty_mod+right → no-op Colors: active_tab_background #7c6f64 active_tab_foreground #fbf1c7 background #1d2021 color0 #3c3836 color1 #cc241d color10 #b8bb26 color11 #fabd2f color12 #83a598 color13 #d3869b color14 #8ec07c color15 #fbf1c7 color2 #98971a color3 #d79921 color4 #458588 color5 #b16286 color6 #689d6a color7 #a89984 color8 #928374 color9 #fb4934 cursor #bdae93 cursor_text_color #665c54 foreground #ebdbb2 inactive_tab_background #3c3836 inactive_tab_foreground #fbf1c7 selection_background #d65d0e selection_foreground #ebdbb2 url_color #458588 Important environment variables seen by the kitty process: PATH /nix/store/vhms4hlp9b9adf93y1hhkcqzl8ciwm74-kitty-0.36.4/bin:/nix/store/irkcg78qfr4q5hfmjw8k6w92f8bgb39f-imagemagick-7.1.1-38/bin:/nix/store/q4kwh6ws0s1jd9sq6k4dsr72697bbpjk-ncurses-6.4.20221231-dev/bin:/run/wrappers/bin:/home/frostphoenix/.nix-profile/bin:/nix/profile/bin:/home/frostphoenix/.local/state/nix/profile/bin:/etc/profiles/per-user/frostphoenix/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin:/nix/store/b74nxf0yn2dzha02mgdxyklaqjaijzqp-binutils-wrapper-2.42/bin:/nix/store/9j787nklwc2zzzczkkbb6v8zxgg8hf2i-pciutils-3.13.0/bin:/nix/store/059q5mjhwq6bkbx4k91p5sg20ds3ji3r-pkgconf-wrapper-2.3.0/bin LANG en_US.UTF-8 EDITOR nano SHELL /run/current-system/sw/bin/zsh DISPLAY :0 WAYLAND_DISPLAY wayland-1 USER frostphoenix XDG_CONFIG_DIRS /etc/xdg:/home/frostphoenix/.nix-profile/etc/xdg:/nix/profile/etc/xdg:/home/frostphoenix/.local/state/nix/profile/etc/xdg:/etc/profiles/per-user/frostphoenix/etc/xdg:/nix/var/nix/profiles/default/etc/xdg:/run/current-system/sw/etc/xdg XDG_SESSION_PATH /org/freedesktop/DisplayManager/Session0 XDG_BACKEND wayland XDG_SEAT seat0 XDG_SESSION_DESKTOP hyprland XDG_SESSION_TYPE wayland XDG_GREETER_DATA_DIR /var/lib/lightdm-data/frostphoenix XDG_CURRENT_DESKTOP Hyprland XDG_SEAT_PATH /org/freedesktop/DisplayManager/Seat0 XDG_SESSION_CLASS user XDG_VTNR 7 XDG_SESSION_ID 1 XDG_RUNTIME_DIR /run/user/1000 XDG_DATA_DIRS /nix/store/9xlf3cb1x6d64swl3gc4lwggfxxpzxh6-desktops/share:/home/frostphoenix/.nix-profile/share:/nix/profile/share:/home/frostphoenix/.local/state/nix/profile/share:/etc/profiles/per-user/frostphoenix/share:/nix/var/nix/profiles/default/share:/run/current-system/sw/share ```

Additional context

hyprland.conf (don't know if this is relevant or not) ``` monitor=,preferred,auto,auto animations { bezier=fluent_decel, 0, 0.2, 0.4, 1 bezier=easeOutCirc, 0, 0.55, 0.45, 1 bezier=easeOutCubic, 0.33, 1, 0.68, 1 bezier=fade_curve, 0, 0.55, 0.45, 1 animation=windowsIn, 0, 4, easeOutCubic, popin 20% animation=windowsOut, 0, 4, fluent_decel, popin 80% animation=windowsMove, 1, 2, fluent_decel, slide animation=fadeIn, 1, 3, fade_curve animation=fadeOut, 1, 3, fade_curve animation=fadeSwitch, 0, 1, easeOutCirc animation=fadeShadow, 1, 10, easeOutCirc animation=fadeDim, 1, 4, fluent_decel animation=workspaces, 1, 4, easeOutCubic, fade enabled=true } decoration { blur { brightness=1 contrast=1.400000 enabled=true ignore_opacity=true new_optimizations=true noise=0 passes=2 size=2 xray=true } col.shadow=rgba(00000055) drop_shadow=true rounding=0 shadow_ignore_window=true shadow_offset=0 2 shadow_range=20 shadow_render_power=3 } dwindle { force_split=0 no_gaps_when_only=false preserve_split=yes pseudotile=yes special_scale_factor=1.000000 split_width_multiplier=1.000000 use_active_for_splits=true } general { $mainMod=SUPER border_part_of_window=false border_size=2 col.active_border=rgb(98971A) col.inactive_border=rgb(928374) gaps_in=5 gaps_out=10 layout=dwindle no_border_on_floating=false } input { touchpad { natural_scroll=true } float_switch_override_focus=0 follow_mouse=0 kb_layout=us,fr kb_options=grp:alt_caps_toggle mouse_refocus=0 numlock_by_default=true sensitivity=0 } master { new_status=master no_gaps_when_only=false special_scale_factor=1 } misc { always_follow_on_dnd=true animate_manual_resizes=false disable_autoreload=true disable_hyprland_logo=true enable_swallow=true focus_on_activate=true layers_hog_keyboard_focus=true middle_click_paste=false new_window_takes_over_fullscreen=2 } bind=$mainMod, F1, exec, show-keybinds bind=$mainMod, Return, exec, kitty bind=ALT, Return, exec, kitty --title float_kitty bind=$mainMod SHIFT, Return, exec, kitty --start-as=fullscreen -o 'font_size=16' bind=$mainMod, B, exec, hyprctl dispatch exec '[workspace 1 silent] floorp' bind=$mainMod, Q, killactive, bind=$mainMod, F, fullscreen, 0 bind=$mainMod SHIFT, F, fullscreen, 1 bind=$mainMod, Space, exec, toggle_float bind=$mainMod, D, exec, rofi -show drun || pkill rofi bind=$mainMod SHIFT, D, exec, webcord --enable-features=UseOzonePlatform --ozone-platform=wayland bind=$mainMod SHIFT, S, exec, hyprctl dispatch exec '[workspace 5 silent] SoundWireServer' bind=$mainMod, Escape, exec, swaylock bind=ALT, Escape, exec, hyprlock bind=$mainMod SHIFT, Escape, exec, power-menu bind=$mainMod, P, pseudo, bind=$mainMod, J, togglesplit, bind=$mainMod, T, exec, toggle_oppacity bind=$mainMod, E, exec, nemo bind=$mainMod SHIFT, B, exec, toggle_waybar bind=$mainMod, C ,exec, hyprpicker -a bind=$mainMod, W,exec, wallpaper-picker bind=$mainMod, N, exec, swaync-client -t -sw bind=$mainMod SHIFT, W, exec, vm-start bind=,Print, exec, screenshot --copy bind=$mainMod, Print, exec, screenshot --save bind=$mainMod SHIFT, Print, exec, screenshot --swappy bind=$mainMod, left, movefocus, l bind=$mainMod, right, movefocus, r bind=$mainMod, up, movefocus, u bind=$mainMod, down, movefocus, d bind=$mainMod, 1, workspace, 1 bind=$mainMod, 2, workspace, 2 bind=$mainMod, 3, workspace, 3 bind=$mainMod, 4, workspace, 4 bind=$mainMod, 5, workspace, 5 bind=$mainMod, 6, workspace, 6 bind=$mainMod, 7, workspace, 7 bind=$mainMod, 8, workspace, 8 bind=$mainMod, 9, workspace, 9 bind=$mainMod, 0, workspace, 10 bind=$mainMod SHIFT, 1, movetoworkspacesilent, 1 bind=$mainMod SHIFT, 2, movetoworkspacesilent, 2 bind=$mainMod SHIFT, 3, movetoworkspacesilent, 3 bind=$mainMod SHIFT, 4, movetoworkspacesilent, 4 bind=$mainMod SHIFT, 5, movetoworkspacesilent, 5 bind=$mainMod SHIFT, 6, movetoworkspacesilent, 6 bind=$mainMod SHIFT, 7, movetoworkspacesilent, 7 bind=$mainMod SHIFT, 8, movetoworkspacesilent, 8 bind=$mainMod SHIFT, 9, movetoworkspacesilent, 9 bind=$mainMod SHIFT, 0, movetoworkspacesilent, 10 bind=$mainMod CTRL, c, movetoworkspace, empty bind=$mainMod SHIFT, left, movewindow, l bind=$mainMod SHIFT, right, movewindow, r bind=$mainMod SHIFT, up, movewindow, u bind=$mainMod SHIFT, down, movewindow, d bind=$mainMod CTRL, left, resizeactive, -80 0 bind=$mainMod CTRL, right, resizeactive, 80 0 bind=$mainMod CTRL, up, resizeactive, 0 -80 bind=$mainMod CTRL, down, resizeactive, 0 80 bind=$mainMod ALT, left, moveactive, -80 0 bind=$mainMod ALT, right, moveactive, 80 0 bind=$mainMod ALT, up, moveactive, 0 -80 bind=$mainMod ALT, down, moveactive, 0 80 bind=,XF86AudioPlay,exec, playerctl play-pause bind=,XF86AudioNext,exec, playerctl next bind=,XF86AudioPrev,exec, playerctl previous bind=,XF86AudioStop,exec, playerctl stop bind=$mainMod, mouse_down, workspace, e-1 bind=$mainMod, mouse_up, workspace, e+1 bind=$mainMod, V, exec, cliphist list | rofi -dmenu -theme-str 'window {width: 50%;}' | cliphist decode | wl-copy bind=,XF86AudioMute, exec, swayosd-client --output-volume mute-toggle bindl=,XF86MonBrightnessUp, exec, swayosd-client --brightness raise 5%+ bindl=,XF86MonBrightnessDown, exec, swayosd-client --brightness lower 5%- bindl=$mainMod, XF86MonBrightnessUp, exec, brightnessctl set 100% bindl=$mainMod, XF86MonBrightnessDown, exec, brightnessctl set 0% bindle=,XF86AudioRaiseVolume, exec, swayosd-client --output-volume +2 --max-volume=100 bindle=,XF86AudioLowerVolume, exec, swayosd-client --output-volume -2 bindle=$mainMod, f11, exec, swayosd-client --output-volume +2 --max-volume=100 bindle=$mainMod, f12, exec, swayosd-client --output-volume -2 bindm=$mainMod, mouse:272, movewindow bindm=$mainMod, mouse:273, resizewindow bindr=CAPS,Caps_Lock,exec,swayosd-client --caps-lock bindr=,Scroll_Lock,exec,swayosd-client --scroll-lock bindr=,Num_Lock,exec,swayosd-client --num-lock exec-once = /nix/store/4a86f7kq7757fjwf5zzwk0jxixn4330n-dbus-1.14.10/bin/dbus-update-activation-environment --systemd DISPLAY HYPRLAND_INSTANCE_SIGNATURE WAYLAND_DISPLAY XDG_CURRENT_DESKTOP && systemctl --user stop hyprland-session.target && systemctl --user start hyprland-session.target exec-once=systemctl --user import-environment & exec-once=hash dbus-update-activation-environment 2>/dev/null & exec-once=dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP & exec-once=nm-applet & exec-once=poweralertd & exec-once=wl-clip-persist --clipboard both & exec-once=wl-paste --watch cliphist store & exec-once=waybar & exec-once=swaync & exec-once=hyprctl setcursor Bibata-Modern-Ice 24 & exec-once=swaybg -m fill -i $(find ~/Pictures/wallpapers/ -maxdepth 1 -type f) & exec-once=hyprlock exec-once=swayosd-server windowrule=float,Viewnior windowrule=center,Viewnior windowrule=size 1200 800,Viewnior windowrule=float,imv windowrule=center,imv windowrule=size 1200 725,imv windowrule=float,mpv windowrule=center,mpv windowrule=tile,Aseprite windowrule=size 1200 725,mpv windowrule=float,title:^(float_kitty)$ windowrule=center,title:^(float_kitty)$ windowrule=size 950 600,title:^(float_kitty)$ windowrule=float,audacious windowrule=pin,rofi windowrule=tile, neovide windowrule=idleinhibit focus,mpv windowrule=float,udiskie windowrule=float,title:^(Transmission)$ windowrule=float,title:^(Volume Control)$ windowrule=float,title:^(Firefox — Sharing Indicator)$ windowrule=move 0 0,title:^(Firefox — Sharing Indicator)$ windowrule=size 700 450,title:^(Volume Control)$ windowrule=move 40 55%,title:^(Volume Control)$ windowrulev2=float, title:^(Picture-in-Picture)$ windowrulev2=opacity 1.0 override 1.0 override, title:^(Picture-in-Picture)$ windowrulev2=pin, title:^(Picture-in-Picture)$ windowrulev2=opacity 1.0 override 1.0 override, title:^(.*imv.*)$ windowrulev2=opacity 1.0 override 1.0 override, title:^(.*mpv.*)$ windowrulev2=opacity 1.0 override 1.0 override, class:(Aseprite) windowrulev2=opacity 1.0 override 1.0 override, class:(Unity) windowrulev2=opacity 1.0 override 1.0 override, class:(floorp) windowrulev2=opacity 1.0 override 1.0 override, class:(evince) windowrulev2=workspace 1, class:^(floorp)$ windowrulev2=workspace 3, class:^(evince)$ windowrulev2=workspace 4, class:^(Gimp-2.10)$ windowrulev2=workspace 4, class:^(Aseprite)$ windowrulev2=workspace 5, class:^(Audacious)$ windowrulev2=workspace 5, class:^(Spotify)$ windowrulev2=workspace 8, class:^(com.obsproject.Studio)$ windowrulev2=workspace 10, class:^(discord)$ windowrulev2=workspace 10, class:^(WebCord)$ windowrulev2=idleinhibit focus, class:^(mpv)$ windowrulev2=idleinhibit fullscreen, class:^(firefox)$ windowrulev2=float,class:^(zenity)$ windowrulev2=center,class:^(zenity)$ windowrulev2=size 850 500,class:^(zenity)$ windowrulev2=float,class:^(org.gnome.FileRoller)$ windowrulev2=center,class:^(org.gnome.FileRoller)$ windowrulev2=size 850 500,class:^(org.gnome.FileRoller)$ windowrulev2=size 850 500,title:^(File Upload)$ windowrulev2=float,class:^(pavucontrol)$ windowrulev2=float,class:^(SoundWireServer)$ windowrulev2=float,class:^(.sameboy-wrapped)$ windowrulev2=float,class:^(file_progress)$ windowrulev2=float,class:^(confirm)$ windowrulev2=float,class:^(dialog)$ windowrulev2=float,class:^(download)$ windowrulev2=float,class:^(notification)$ windowrulev2=float,class:^(error)$ windowrulev2=float,class:^(confirmreset)$ windowrulev2=float,title:^(Open File)$ windowrulev2=float,title:^(File Upload)$ windowrulev2=float,title:^(branchdialog)$ windowrulev2=float,title:^(Confirm to replace files)$ windowrulev2=float,title:^(File Operation Progress)$ windowrulev2=opacity 0.0 override,class:^(xwaylandvideobridge)$ windowrulev2=noanim,class:^(xwaylandvideobridge)$ windowrulev2=noinitialfocus,class:^(xwaylandvideobridge)$ windowrulev2=maxsize 1 1,class:^(xwaylandvideobridge)$ windowrulev2=noblur,class:^(xwaylandvideobridge)$ xwayland { force_zero_scaling = true } ```
kovidgoyal commented 1 week ago

I doubt this has anything to do with kitty, probably part of the window creation/placement animation that you have configured hyprland to do. I cant replicate it on my system in hyprland.

Running kitty with

kitty -o background_opacity=0.5 -o background=red

I have limited amounts of time I can devote to window manager specific issues. But if you wish to investigate and submit a PR, feel free. Relevant code is in wl_window.c. kitty actually uses a single pixel custom surface as the background until the window is created and this reflects the background color and opacity correctly as far as I know, see attach_temp_buffer_during_window_creation().

Frost-Phoenix commented 1 week ago

Sorry to bother you again. I tested with kitty -o background_opacity=0.1 -o background=red while having hyprland animations disabled and I still have the same problem.

https://github.com/user-attachments/assets/661ec679-8b6f-44b3-9e4e-8dc652387349

Do you think this could be a hyprland problem ?

Frost-Phoenix commented 1 week ago

I tried with an other terminal (Wezterm) and the problem didn't occurred, even with the hyprland animation enabled. So I think this might be on kitty's side and not hyprland.

kovidgoyal commented 1 week ago

I cannot replicate so I cant help and it definitely looks like a hyprland issue. kitty never changes the opacity of the surfaces it creates. As I said a PR is welcome.