wezterm
wezterm copied to clipboard
mouse click on wezterm, but activate the lower level window. (keyboard input always work)
What Operating System(s) are you seeing this problem on?
Linux Wayland
Which Wayland compositor or X11 Window manager(s) are you using?
Mutter
WezTerm version
wezterm 20240203-110809-5046fc22
Did you try the latest nightly build to see if the issue is better (or worse!) than your current version?
Yes, and I updated the version box above to show the version of the nightly that I tried
Describe the bug
This issue happen occasionally, when try click use mouse on wezterm window(whatever left key or right key), instead click on current wezterm window, it always activate the window underneath, although, keyboard input always work as expected.
- [ ] )
To Reproduce
It happen occasionally.
Configuration
-- Pull in the wezterm API
local wezterm = require 'wezterm'
local act = wezterm.action
local mux = wezterm.mux
-- This table will hold the configuration.
local config = {}
-- In newer versions of wezterm, use the config_builder which will
-- help provide clearer error messages
if wezterm.config_builder then
config = wezterm.config_builder()
end
config.set_environment_variables = {
SHELL="/usr/bin/bash"
}
config.xim_im_name = 'fcitx'
config.window_close_confirmation = 'AlwaysPrompt'
-- 使用非 login shell, 即 .bashrc
config.default_prog = { '/usr/bin/bash' }
config.enable_scroll_bar = true
config.scrollback_lines = 1000000
-- enable this settings, and start from another terminal, e.g. konsole
-- config.debug_key_events = true
config.enable_wayland = false
-- This is where you actually apply your config choices
-- For example, changing the color scheme:
-- config.color_scheme = 'Vs Code Dark+ (Gogh)'
config.window_background_opacity = 0.85
-- config.warn_about_missing_glyphs = false
-- config.font_dirs = { 'fonts' }
-- config.font = wezterm.font_with_fallback {
-- 'Source Code Pro for Powerline',
-- 'PowerlineSymbols',
-- }
-- config.font_size = 15
-- config.font = wezterm.font 'Inconsolata Nerd Font Mono'
config.disable_default_key_bindings = true
-- config.disable_default_mouse_bindings = true
config.leader = { key = 'x', mods = 'CTRL' }
config.keys = {
{
key = '3',
mods = 'LEADER',
action = act.SplitHorizontal { domain = 'CurrentPaneDomain' },
},
{
key = '2',
mods = 'LEADER',
action = act.SplitVertical { domain = 'CurrentPaneDomain' },
},
{
key = 'o',
mods = 'LEADER',
action = act.PaneSelect
},
{
key = '=',
mods = 'LEADER',
action = act.ResetFontSize
},
{
key = '-',
mods = 'LEADER',
action = act.ResetFontSize
},
{
key = 'r',
mods = 'LEADER',
action = act.ActivateKeyTable {
name = 'resize_pane',
one_shot = false
},
},
{ key = 'x', mods = 'LEADER', action = act.SendKey { key = 'x', mods = 'CTRL' } },
{ key = 'h', mods = 'ALT', action = act.ActivatePaneDirection 'Left' },
{ key = 'l', mods = 'ALT', action = act.ActivatePaneDirection 'Right' },
{ key = 'k', mods = 'ALT', action = act.ActivatePaneDirection 'Up' },
{ key = 'j', mods = 'ALT', action = act.ActivatePaneDirection 'Down' },
{ key = 'RightArrow', mods = 'CTRL', action = act.AdjustPaneSize { 'Right', 5 } },
{ key = 'LeftArrow', mods = 'CTRL', action = act.AdjustPaneSize { 'Left', 5 } },
{ key = 'UpArrow', mods = 'CTRL', action = act.AdjustPaneSize { 'Up', 5 } },
{ key = 'DownArrow', mods = 'CTRL', action = act.AdjustPaneSize { 'Down', 5 } },
{ key = '0', mods = 'ALT', action = act.ActivateTabRelative(1) },
{ key = '9', mods = 'ALT', action = act.ActivateTabRelative(-1) },
{ key = '0', mods = 'CTRL|ALT', action = act.MoveTabRelative(1) },
{ key = '9', mods = 'CTRL|ALT', action = act.MoveTabRelative(-1) },
{ key = 'e', mods = 'SHIFT|CTRL', action = act.TogglePaneZoomState },
{ key = 'F10', mods = '', action = act.ToggleFullScreen },
-- { key = 'Enter', mods = 'ALT', action = act.ToggleFullScreen },
-- { key = '\'', mods = 'CTRL', action = act.SplitVertical{ domain = 'CurrentPaneDomain' } },
-- { key = '%', mods = 'SHIFT|CTRL', action = act.SplitHorizontal{ domain = 'CurrentPaneDomain' } },
{ key = '-', mods = 'CTRL', action = act.DecreaseFontSize },
{ key = '=', mods = 'CTRL', action = act.IncreaseFontSize },
-- { key = 'n', mods = 'CTRL', action = act.SpawnWindow },
-- { key = 'N', mods = 'SHIFT|CTRL', action = act.SpawnWindow },
-- { key = 'P', mods = 'CTRL', action = act.ActivateCommandPalette },
-- { key = 'P', mods = 'SHIFT|CTRL', action = act.ActivateCommandPalette },
-- { key = 'R', mods = 'CTRL', action = act.ReloadConfiguration },
-- { key = 'R', mods = 'SHIFT|CTRL', action = act.ReloadConfiguration },
-- { key = 'U', mods = 'CTRL', action = act.CharSelect{ copy_on_select = true, copy_to = 'ClipboardAndPrimarySelection' } },
-- { key = 'U', mods = 'SHIFT|CTRL', action = act.CharSelect{ copy_on_select = true, copy_to = 'ClipboardAndPrimarySelection' } },
-- { key = 'X', mods = 'CTRL', action = act.ActivateCopyMode },
-- { key = 'X', mods = 'SHIFT|CTRL', action = act.ActivateCopyMode },
-- { key = 'Z', mods = 'CTRL', action = act.TogglePaneZoomState },
-- { key = 'Z', mods = 'SHIFT|CTRL', action = act.TogglePaneZoomState },
{ key = 'k', mods = 'SHIFT|CTRL', action = act.ClearScrollback 'ScrollbackAndViewport' },
{ key = 'l', mods = 'SHIFT|CTRL', action = act.ShowDebugOverlay },
-- { key = 'm', mods = 'SHIFT|CTRL', action = act.Hide },
-- { key = 'n', mods = 'SHIFT|CTRL', action = act.SpawnWindow },
-- { key = 'n', mods = 'SUPER', action = act.SpawnWindow },
-- { key = 'p', mods = 'SHIFT|CTRL', action = act.ActivateCommandPalette },
-- { key = 'r', mods = 'SHIFT|CTRL', action = act.ReloadConfiguration },
{ key = 'r', mods = 'SUPER', action = act.ReloadConfiguration },
-- { key = 't', mods = 'SHIFT|CTRL', action = act.SpawnTab 'CurrentPaneDomain' },
{
key = 't',
mods = 'SHIFT|CTRL',
action = wezterm.action_callback(
function(win, pane)
local mux_win = win:mux_window()
local idx = active_tab_idx(mux_win)
local tab = mux_win:spawn_tab({})
win:perform_action(wezterm.action.MoveTab(idx+1), pane)
end
),
},
-- { key = 'u', mods = 'SHIFT|CTRL', action = act.CharSelect{ copy_on_select = true, copy_to = 'ClipboardAndPrimarySelection' } },
{ key = 'y', mods = 'CTRL', action = act.PasteFrom 'Clipboard' },
{ key = 'w', mods = 'SHIFT|CTRL', action = act.CloseCurrentTab{ confirm = true } },
{ key = 'x', mods = 'SHIFT|CTRL', action = act.ActivateCopyMode },
{ key = 'z', mods = 'SHIFT|CTRL', action = act.TogglePaneZoomState },
{ key = 'phys:Space', mods = 'SHIFT|CTRL', action = act.QuickSelect },
{ key = 'f', mods = 'SHIFT|CTRL', action = act.Search 'CurrentSelectionOrEmptyString' },
{ key = 'w', mods = 'ALT', action = act.EmitEvent 'CopyToHackForDte' },
{ key = 's', mods = 'CTRL', action = act.EmitEvent 'SearchHackForDte' },
{ key = '<', mods = 'SHIFT|ALT', action = act.EmitEvent 'ScrollToTopForDte' },
{ key = '>', mods = 'SHIFT|ALT', action = act.EmitEvent 'ScrollToBottomForDte' },
{
key = 'v', mods = 'CTRL',
action = wezterm.action_callback(
function(window, pane)
ScrollByPageForDte(window, pane, 1, {key = 'v', mods = 'CTRL'})
end
)
},
{
key = 'v', mods = 'ALT',
action = wezterm.action_callback(
function(window, pane)
ScrollByPageForDte(window, pane, -1, {key = 'v', mods = 'ALT'})
end
)
},
{
key = 'p', mods = 'ALT',
action = wezterm.action_callback(
function(window, pane)
ScrollByLineForDte(window, pane, -2, {key = 'p', mods = 'ALT'})
end
)
},
{
key = 'n', mods = 'ALT',
action = wezterm.action_callback(
function(window, pane)
ScrollByLineForDte(window, pane, 2, {key = 'n', mods = 'ALT'})
end
)
},
-- { key = 'LeftArrow', mods = 'SHIFT|CTRL', action = act.ActivatePaneDirection 'Left' },
-- { key = 'LeftArrow', mods = 'SHIFT|ALT|CTRL', action = act.AdjustPaneSize{ 'Left', 1 } },
-- { key = 'RightArrow', mods = 'SHIFT|CTRL', action = act.ActivatePaneDirection 'Right' },
-- { key = 'RightArrow', mods = 'SHIFT|ALT|CTRL', action = act.AdjustPaneSize{ 'Right', 1 } },
-- { key = 'UpArrow', mods = 'SHIFT|CTRL', action = act.ActivatePaneDirection 'Up' },
-- { key = 'UpArrow', mods = 'SHIFT|ALT|CTRL', action = act.AdjustPaneSize{ 'Up', 1 } },
-- { key = 'DownArrow', mods = 'SHIFT|CTRL', action = act.ActivatePaneDirection 'Down' },
-- { key = 'DownArrow', mods = 'SHIFT|ALT|CTRL', action = act.AdjustPaneSize{ 'Down', 1 } },
-- { key = 'Insert', mods = 'SHIFT', action = act.PasteFrom 'PrimarySelection' },
-- { key = 'Insert', mods = 'CTRL', action = act.CopyTo 'PrimarySelection' },
}
-- Show which key table is active in the status area
wezterm.on(
'update-status',
function(window, pane)
local name = window:active_key_table()
if name then
name = 'TABLE: ' .. name
end
window:set_right_status(name or '')
end
)
-- key_index = #config.keys
-- wezterm.on(
-- 'update-status',
-- function(window, pane)
-- local info = pane:get_foreground_process_info()
-- if not (info ~= nil and #info.argv > 1 and string.find(info.argv[2], 'dte')) then
-- key1 = { key = 'w', mods = 'ALT', action = act.CopyTo 'Clipboard' }
-- last_key = config.keys[key_index+1]
-- if last_key ~= nil and last_key.key == key1.key and last_key.mods == key1.mods then
-- return
-- end
-- table.insert(config.keys, key1)
-- end
-- end
-- )
wezterm.on(
'CopyToHackForDte',
function(window, pane)
local info = pane:get_foreground_process_info()
if info ~= nil and #info.argv > 1 and string.find(info.argv[2], 'dte') then
window:perform_action(act.SendKey { key = 'w', mods = 'ALT' }, pane)
else
window:perform_action(act.CopyTo 'Clipboard', pane)
end
end
)
wezterm.on(
'SearchHackForDte',
function(window, pane)
local info = pane:get_foreground_process_info()
if info ~= nil and #info.argv > 1 and info.argv[2] ~= 'dte' then
window:perform_action(act.SendKey { key = 's', mods = 'CTRL' }, pane)
else
window:perform_action(act.Search 'CurrentSelectionOrEmptyString', pane)
end
end
)
wezterm.on(
'ScrollToTopForDte',
function(window, pane)
local info = pane:get_foreground_process_info()
if info ~= nil and #info.argv > 1 and string.find(info.argv[2], 'dte') then
window:perform_action(act.SendKey { key = '<', mods = 'SHIFT|ALT' }, pane)
else
window:perform_action(act.ScrollToTop, pane)
end
end
)
wezterm.on(
'ScrollToBottomForDte',
function(window, pane)
local info = pane:get_foreground_process_info()
if info ~= nil and #info.argv > 1 and string.find(info.argv[2], 'dte') then
window:perform_action(act.SendKey { key = '>', mods = 'SHIFT|ALT' }, pane)
else
window:perform_action(act.ScrollToBottom, pane)
end
end
)
function ScrollByPageForDte(window, pane, page_number, key)
local info = pane:get_foreground_process_info()
if info ~= nil and #info.argv > 1 and string.find(info.argv[2], 'dte') then
window:perform_action(act.SendKey(key), pane)
else
window:perform_action(act.ScrollByPage(page_number), pane)
end
end
function ScrollByLineForDte(window, pane, line_number, key)
local info = pane:get_foreground_process_info()
if info ~= nil and #info.argv > 1 and string.find(info.argv[2], 'dte') then
window:perform_action(act.SendKey(key), pane)
else
window:perform_action(act.ScrollByLine(line_number), pane)
end
end
function active_tab_idx(mux_win)
for _, item in ipairs(mux_win:tabs_with_info()) do
-- wezterm.log_info('idx: ', idx, 'tab:', item)
if item.is_active then
return item.index
end
end
end
function maximum_when_startup()
-- start use maximum window mode. can be close use F10 (bind blow)
wezterm.on(
'gui-startup',
function(window)
local tab, pane, window = mux.spawn_window(cmd or {})
local gui_window = window:gui_window();
gui_window:perform_action(wezterm.action.ToggleFullScreen, pane)
end
)
end
-- maximum_when_startup()
config.key_tables = {
resize_pane = {
{ key = 'LeftArrow', action = act.AdjustPaneSize { 'Left', 5 } },
{ key = 'RightArrow', action = act.AdjustPaneSize { 'Right', 5 } },
{ key = 'UpArrow', action = act.AdjustPaneSize { 'Up', 5 } },
{ key = 'DownArrow', action = act.AdjustPaneSize { 'Down', 5 } },
-- Cancel the mode by pressing escape
{ key = 'Escape', action = 'PopKeyTable' },
},
search_mode = {
{ key = 'Enter', mods = 'NONE', action = act.CopyMode 'PriorMatch' },
{ key = 'Escape', mods = 'NONE', action = act.CopyMode 'Close' },
{ key = 'g', mods = 'CTRL', action = act.CopyMode 'Close' },
{ key = 'n', mods = 'CTRL', action = act.CopyMode 'NextMatch' },
{ key = 'p', mods = 'CTRL', action = act.CopyMode 'PriorMatch' },
{ key = 'r', mods = 'CTRL', action = act.CopyMode 'CycleMatchType' },
{ key = 'u', mods = 'CTRL', action = act.CopyMode 'ClearPattern' },
{ key = 'PageUp', mods = 'NONE', action = act.CopyMode 'PriorMatchPage' },
{ key = 'PageDown', mods = 'NONE', action = act.CopyMode 'NextMatchPage' },
{ key = 'UpArrow', mods = 'NONE', action = act.CopyMode 'PriorMatch' },
{ key = 'DownArrow', mods = 'NONE', action = act.CopyMode 'NextMatch' },
},
}
config.mouse_bindings = {
-- 关闭自动点开链接
{
event = { Up = { streak = 1, button = 'Left' } },
mods = 'NONE',
action = act.Nop,
},
-- 鼠标移动慢一些
{
event = { Down = { streak = 1, button = { WheelUp = 1 } } },
mods = 'NONE',
action = act.ScrollByLine(-3),
},
{
event = { Down = { streak = 1, button = { WheelDown = 1 } } },
mods = 'NONE',
action = act.ScrollByLine(3),
},
}
-- and finally, return the configuration to wezterm
return config
Expected Behavior
because wezterm window is on front, so, click use mouse should click on current wezterm window instead, but it always select the window underneath.
Logs
No
Anything else?
Have no idea how to fix that, except close wezterm use keyboard (Ctrl + D) and exit it, then reluanch it.
Does it also happens when you start Wezterm with its default config? (with wezterm -n
)
If not, try to reduce your config to the minimum that has the issue you're describing
Okay, let me try it smoothly, because this issue not happen predictable, even, only happen once for several days some times, so, i guess it hard to trace like this.
But, i guess i can start it from another console (e.g. konsole), is there any special option need provided when try start like this?
This issue happen again. (as i said, it not always happen), i try comment all my config out, and reload config, but no luck.
Here is one more detail:
When double click use mouse on wezterm, if the content under cursor is text, it is possible work as expect to mark the current line. but, if click on blank area, it always select the lower level window.
This is happening to me too, same thing about it being unpredictable and on mine when it happens not only it clicks through the terminal to the lower level window but I cannot resize it.
Restarting the application doesn't solve it, but log out and login fixes it.
Arch linux with xorg, wezterm version 20240203.110809.5046fc22-1
Hi, @rafaelgdgs , i disable several of my old config which probably cause this issue:
-- i enable this before
-- config.enable_scroll_bar = true
-- i add this settings before to make the link not clickable.
-- {
-- event = { Up = { streak = 1, button = 'Left' } },
-- mods = 'NONE',
-- action = act.Nop,
-- },
All my left config all involves keybinding, i don't think it cause current issue anyway.
I use Arch too, although, i use wayland, maybe you can check my above config, too see if there is settings which both set by me and you, and tell me here, thanks.
I got the same issuse, my system is Archlinux/Gnome/Xorg/Nvidia 1070
, with all packages updated.
But the problem only occurs when the wezterm is maximized.
the wezterm version is 20240203-110809-5046fc22
I got the same issuse, my system is
Archlinux/Gnome/Xorg/Nvidia 1070
, with all packages updated.But the problem only occurs when the wezterm is maximized.
the wezterm version is
20240203-110809-5046fc22
Hi, @dojiong , could you please check you config whether some part same as mine?
maybe we can give some clue about what broken wezterm.
@zw963 I deleted the config file, got the same problem. But when I restart system, the problem disappeared.
@zw963 oooooops, this problem is back after another system restart.
I clone the repo with latest main branch, then compiles/run ./target/debug/wezterm -n
, got the same problem.
window's focus is lost because it received a FocusOut event window/src/os/x11/window.rs#646
I found that the initial window area is not focus out when click. After maxizized, click the addition area will got a focus out
Hi, i guess it is possible this issue caused by update to newest GNOME.
because this issue happen when i open gparted, and when i click on gparted, it activate the lower window.
Hi, @rafaelgdgs , i disable several of my old config which probably cause this issue:
-- i enable this before -- config.enable_scroll_bar = true -- i add this settings before to make the link not clickable. -- { -- event = { Up = { streak = 1, button = 'Left' } }, -- mods = 'NONE', -- action = act.Nop, -- },
All my left config all involves keybinding, i don't think it cause current issue anyway.
I use Arch too, although, i use wayland, maybe you can check my above config, too see if there is settings which both set by me and you, and tell me here, thanks.
Hy @zw963, I'm using the default config for WezTerm so I don't think your config was the problem, about it being caused by GNOME update yes I'm using GNOME 46 but I don't understand a lot to figure out the cause
Just found out something, when my current session is with this bug about the resize and click through, the same problem appears on another program, vscode from the arch repo (code 1.88.0-1), I cannot resize it and after log out and login it fixes for both, idk what they got in common
Experiencing the same thing on Ubuntu 24.04 x11. Did any of you solve this issue?