kovidgoyal / kitty

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

On macos Kitty grabs focus on hover when in fullscreen #6998

Closed gtnbssn closed 8 months ago

gtnbssn commented 8 months ago

Describe the bug

I use an external monitor with my laptop, very often Kitty is open in fullscreen on the laptop's screen and a browser window takes up the other monitor.

If i am working on the other monitor, moving the pointer to the other screen gives the focus to Kitty.

To Reproduce Steps to reproduce the behavior:

  1. Plug in an external monitor and open a not-Kitty window in it
  2. Open Kitty in the laptop's screen and make it fullscreen
  3. Focus on the not-Kitty window
  4. Move the pointer to the laptop screen (do not click)
  5. Type on the keyboard
  6. Your typing appears in the Kitty window

Environment details

kitty 0.31.0 (b247fda672) created by Kovid Goyal
Darwin ummon.local 23.2.0 Darwin Kernel Version 23.2.0: Wed Nov 15 21:55:06 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T6020 arm64
ProductName:        macOS ProductVersion:       14.2.1 BuildVersion:        23C71
Frozen: True
Paths:
  kitty: /Applications/kitty.app/Contents/MacOS/kitty
  base dir: /Applications/kitty.app/Contents/Resources/kitty
  extensions dir: /Applications/kitty.app/Contents/Resources/Python/lib/kitty-extensions
  system shell: /opt/homebrew/bin/fish
Loaded config files:
  /Users/gtnbssn/.config/kitty/kitty.conf

Config options different from defaults:
cursor_blink_interval   0.0
font_family             JetBrainsMono Nerd Font Mono
font_size               12.0
hide_window_decorations 1
inactive_tab_font_style (False, True)
initial_window_height   (792, 'px')
initial_window_width    (1200, 'px')
modify_font:
    cell_height 8
mouse_hide_wait         5.0
remember_window_size    False
tab_bar_style           powerline
tab_powerline_style     slanted
tab_title_template      {index} {title}
touch_scroll_multiplier 3.0
url_style               1
wheel_scroll_multiplier 3.0
window_padding_width    FloatEdges(left=1.0, top=1.0, right=1.0, bottom=1.0)
Changed shortcuts:
    kitty_mod+t →  new_tab_with_cwd
Colors:
    active_tab_background   #549a6f   
    color1                  #ff2f2f   
    color10                 #549a6f   
    color11                 #ccac00   
    color12                 #0099cc   
    color13                 #cc68c8   
    color14                 #79c4cc   
    color15                 #bccccc   
    color2                  #549a6f   
    color3                  #ccac00   
    color4                  #0099cc   
    color5                  #cc68c8   
    color6                  #79c4cc   
    color7                  #bccccc   
    color8                  #000000   
    color9                  #ff2f2f   
    cursor                  #ffffff   
    foreground              #afc2c2   
    inactive_tab_background #000000   
    inactive_tab_foreground #549a6f   
    selection_background    #7cbeff   

Important environment variables seen by the kitty process:
    PATH                                /Applications/kitty.app/Contents/MacOS:/usr/bin:/bin:/usr/sbin:/sbin
    LANG                                en_US.UTF-8
    SHELL                               /opt/homebrew/bin/fish
    USER                                gtnbssn

Additional context I was able to reproduce the problem starting Kitty with --config NONE.

My config file is (here)[https://github.com/gtnbssn/barerepodotfiles/blob/main/.config/kitty/kitty.conf]. I have tried setting focus_follows_mouse no but it did not solve my issue and isn't showing in the debug above, it is probably the default.

This only happens when Kitty is in fullscreen.

kovidgoyal commented 8 months ago

Make sure you dont have secure text input enabled. kitty itself has no code to ever grab focus on mouse over.

gtnbssn commented 8 months ago

My bad, this is an OSX problem:

https://superuser.com/questions/1313408/disabling-macos-x-auto-focus-when-moving-mouse-over-to-the-top-of-fullscreen-app

Oddly enough, it seems this only happens when the mouse comes to the fullscreen app from the top of its screen, which is why kitty looked like the culprit to me in my specific set up. (i.e. the app in the top screen doesn't steal focus back when I move the pointer back there.)

Thanks for the quick answer!