kovidgoyal / kitty

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

X11 window size and cursor size inconsist with the scaling of gnome #7905

Closed YaQia closed 3 weeks ago

YaQia commented 3 weeks ago

Describe the bug The first kitty opened in gnome will have this problem when having 200% scaling. Once your initial_window_width and initial_window_height are set with col / row numbers, the window will shrink to 1/2 width and 1/2 height. Additionally, whatever initial_window_width and initial_window_height are, the cursor size of it will shrink to 1/2 width and 1/2 height.

To Reproduce Steps to reproduce the behavior:

  1. Login to gnome (to ensure you haven't open any kitty window)
  2. Open a kitty terminal with X11 as linux_display_server. More specifically, full config is:
    
    font_family      FiraCode Nerd Font 
    bold_font        auto
    italic_font      auto
    bold_italic_font auto

font_size 11.0

symbol_map U+2010 Source Code Pro

touch_scroll_multiplier 1.0

remember_window_size no initial_window_width 1280 initial_window_height 720

enabled_layouts splits, stack

hide_window_decorations no

background_opacity 0.9

editor nvim

shell_integration enabled

ksb_builtin_last_visited_cmd_output

allow_remote_control no

linux_display_server X11

wayland_enable_ime yes

: New window

map kitty_mod+enter launch --location=hsplit map kitty_mod+\ launch --location=vsplit

: Close window

map kitty_mod+w close_window

map shift+cmd+d close_window

map kitty_mod+h neighboring_window left map kitty_mod+l neighboring_window right map kitty_mod+j neighboring_window down map kitty_mod+k neighboring_window up

: Resize window

map ctrl+alt+n resize_window narrower map ctrl+alt+w resize_window wider map ctrl+alt+t resize_window taller map ctrl+alt+s resize_window shorter map ctrl+alt+home resize_window reset

: Move window

map ctrl+alt+k move_window up map ctrl+alt+h move_window left map ctrl+alt+l move_window right map ctrl+alt+j move_window down

map kitty_mod+alt+k layout_action move_to_screen_edge top map kitty_mod+alt+h layout_action move_to_screen_edge left map kitty_mod+alt+l layout_action move_to_screen_edge right map kitty_mod+alt+j layout_action move_to_screen_edge bottom

: Next layout

map kitty_mod+` next_layout

BEGIN_KITTY_THEME

Tango Dark

include current-theme.conf

END_KITTY_THEME

3. Move your cursor up to the window
4. You will notice the cursor size is shrunk.

**Screenshots**
[录屏 2024-09-27 01-33-37.webm](https://github.com/user-attachments/assets/7fac2232-8e87-40a5-b572-39499ab2f6e1)

**Environment details**
```kitty 0.36.3 created by Kovid Goyal
Linux archlinux 6.10.10-arch1-1 #1 SMP PREEMPT_DYNAMIC Thu, 12 Sep 2024 17:21:02 +0000 x86_64
Arch Linux 6.10.10-arch1-1 (/dev/tty)

DISTRIB_ID="Arch"
DISTRIB_RELEASE="rolling"
DISTRIB_DESCRIPTION="Arch Linux"
Running under: X11
OpenGL: '4.6 (Core Profile) Mesa 24.2.3-arch1.1' Detected version: 4.6
Frozen: False
Fonts:
  medium: FiraCodeNF-Reg: /usr/share/fonts/TTF/FiraCodeNerdFont-Regular.ttf:0
          Features: ()
    bold: FiraCodeNF-SemBd: /usr/share/fonts/TTF/FiraCodeNerdFont-SemiBold.ttf:0
          Features: ()
  italic: FiraCodeNF-Ret: /usr/share/fonts/TTF/FiraCodeNerdFont-Retina.ttf:0
          Features: ()
      bi: FiraCodeNF-SemBd: /usr/share/fonts/TTF/FiraCodeNerdFont-SemiBold.ttf:0
          Features: ()
Paths:
  kitty: /usr/bin/kitty
  base dir: /usr/lib/kitty
  extensions dir: /usr/lib/kitty/kitty
  system shell: /usr/bin/fish
Loaded config files:
  /home/ethan/.config/kitty/kitty.conf

Config options different from defaults:
background_opacity    0.9
editor                nvim
enabled_layouts       ['splits', 'stack']
font_family           FiraCode Nerd Font
initial_window_height (720, 'px')
initial_window_width  (1280, 'px')
linux_display_server  x11
remember_window_size  False
symbol_map:
    U+2010 - U+2010 → Source Code Pro
Added shortcuts:
    ctrl+alt+h →  move_window left
    ctrl+alt+home →  resize_window reset
    ctrl+alt+j →  move_window down
    ctrl+alt+k →  move_window up
    ctrl+alt+l →  move_window right
    ctrl+alt+n →  resize_window narrower
    ctrl+alt+s →  resize_window shorter
    ctrl+alt+t →  resize_window taller
    ctrl+alt+w →  resize_window wider
    kitty_mod+\ →  launch --location=vsplit
    kitty_mod+alt+h →  layout_action move_to_screen_edge left
    kitty_mod+alt+j →  layout_action move_to_screen_edge bottom
    kitty_mod+alt+k →  layout_action move_to_screen_edge top
    kitty_mod+alt+l →  layout_action move_to_screen_edge right
Changed shortcuts:
    kitty_mod+` →  next_layout
    kitty_mod+enter →  launch --location=hsplit
    kitty_mod+h →  neighboring_window left
    kitty_mod+j →  neighboring_window down
    kitty_mod+k →  neighboring_window up
    kitty_mod+l →  neighboring_window right
Colors:
    color1                #cc0000   
    color10               #8ae234   
    color11               #fce94f   
    color12               #729fcf   
    color13               #ad7fa8   
    color14               #34e2e2   
    color15               #eeeeec   
    color2                #4e9a06   
    color3                #c4a000   
    color4                #3465a4   
    color5                #75507b   
    color6                #06989a   
    color7                #d3d7cf   
    color8                #555753   
    color9                #ef2929   
    cursor                #ffffff   
    foreground            #ffffff   
    selection_background  #b4d5ff   

Important environment variables seen by the kitty process:
    PATH                                /opt/riscv/bin:/opt/riscv64-linux/bin:/home/ethan/.local/share/gem/ruby/3.0.0/bin:/usr/share/bcc/tools:/home/ethan/.cargo/bin:/home/ethan/.local/bin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
    LANG                                zh_CN.UTF-8
    SHELL                               /usr/bin/fish
    DISPLAY                             :0
    WAYLAND_DISPLAY                     wayland-0
    USER                                ethan
    XDG_DATA_DIRS                       /home/ethan/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share/:/usr/share/
    XDG_RUNTIME_DIR                     /run/user/1000
    XDG_CURRENT_DESKTOP                 GNOME
    XDG_MENU_PREFIX                     gnome-
    XDG_SESSION_CLASS                   user
    XDG_SESSION_DESKTOP                 gnome
    XDG_SESSION_TYPE                    wayland
YaQia commented 3 weeks ago

It is notable that this will only happen to the very first kitty terminal opened. That's why the video shows only one window with shrunk cursor.

YaQia commented 3 weeks ago

Now I guess it was gnome47 intruducing this bug, I have downgraded into kitty 0.33.1-2, still see the shrunk cursor.

kovidgoyal commented 3 weeks ago

On X11 your WM needs to se Xft.dpi for scaling to work properly. Report the issue to the WM developers.

YaQia commented 3 weeks ago

Nope, I am not using X11, just using Xwayland to run kitty. Kitty is the only application has this issue.

kovidgoyal commented 3 weeks ago

If you are using xwayland then you are running kitty with x11 so you need to set the appropriate settings in xrdb. Or run kitty using wayland.