local wezterm = require 'wezterm'; local keys = require 'keys'; -- Position the first window at top‑right quarter of the screen wezterm.on('gui-startup', function() local screens = wezterm.gui.screens() local scr = screens.main or screens.active if not scr then -- If screens can't be fetched yet, fall back to spawning normally wezterm.mux.spawn_window({}) return end -- Safely calculate a sizing multiplier if the screen has scaled High-DPI -- Laptops usually report a DPI of 144, 192, etc., whereas base is 96. local scale = 1.0 if scr.dpi and scr.dpi > 96 then scale = scr.dpi / 96 end -- Standard target dimensions (half width, half height) local quarter_width = math.floor(scr.width / 2) local quarter_height = math.floor(scr.height / 2) -- Adjust target location to keep window from hanging off scaled laptop margins local x = scr.x + (scr.width - (quarter_width / scale)) local y = scr.y -- Inject position parameters straight into the initial spawn call (prevents crashing and jumping) local tab, pane, window = wezterm.mux.spawn_window({ position = { x = math.floor(x), y = math.floor(y), } }) if window then local gui_window = window:gui_window() if gui_window then gui_window:set_inner_size(quarter_width, quarter_height) end end end) return { font = wezterm.font_with_fallback({ {family="JetBrains Mono", weight = "Regular"}, "DejaVu Sans", "Hack", "Noto Sans Bamum", "Noto Sans Ol Chiki", }), font_size = 11, disable_default_key_bindings = true, hide_tab_bar_if_only_one_tab = true, enable_tab_bar = true, -- SCROLL BAR CONFIGURATION enable_scroll_bar = true, -- MOUSE BINDINGS (DEFINED HERE, NOT IN keys.lua) mouse_bindings = { -- Double-click: Select word under cursor { event = { Down = { streak = 2, button = "Left" } }, action = wezterm.action.SelectTextAtMouseCursor("Word"), }, -- Triple-click: Select line under cursor { event = { Down = { streak = 3, button = "Left" } }, action = wezterm.action.SelectTextAtMouseCursor("Line"), }, -- Middle click: Paste from clipboard { event = { Down = { streak = 1, button = "Middle" } }, action = wezterm.action.PasteFrom("Clipboard"), }, -- RIGHT CLICK: PASTE FROM CLIPBOARD (FIXED) { event = { Down = { streak = 1, button = "Right" } }, action = wezterm.action.PasteFrom("Clipboard"), }, }, keys = keys, adjust_window_size_when_changing_font_size = false, color_scheme = 'Modus-Vivendi', } --[[ Action Result Drag to select Automatically copies to clipboard Double-click Selects and copies the word under cursor Triple-click Selects and copies the entire line Middle click Pastes from clipboard RIGHT CLICK PASTES FROM CLIPBOARD (FIXED) Scroll bar Visible on the right side Shift + PageUp/PageDown Scroll by page Ctrl + Shift + Up/Down Scroll by line ]]