From 16f0cd2513c7754d35b374410c854969446c72cf Mon Sep 17 00:00:00 2001 From: Peter Cai Date: Mon, 5 Jun 2023 08:36:44 -0400 Subject: [PATCH 1/7] sway: Set XDG_CURRENT_DESKTOP for D-Bus --- sway/.config/sway/config | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sway/.config/sway/config b/sway/.config/sway/config index bc0f148..9d35bb6 100644 --- a/sway/.config/sway/config +++ b/sway/.config/sway/config @@ -277,6 +277,9 @@ for_window [app_id="pavucontrol"] floating enable # Makes service management a bit cleaner exec_always "systemctl --user import-environment; systemctl --user start sway-session.target" +# Import environment to D-Bus as well for xdg-desktop-portals etc +exec_always dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway + # Restart kanshi if it is running # This restores monitor configuration on reload exec_always "systemctl --user is-active kanshi && systemctl --user restart kanshi" From 35053b112b2a681182be4c865ab5e0763242db11 Mon Sep 17 00:00:00 2001 From: Peter Cai Date: Thu, 15 Jun 2023 16:34:32 -0400 Subject: [PATCH 2/7] Switch to using wezterm's multi-tab support directly --- bash/.bashrc | 5 ----- wezterm/.config/wezterm/wezterm.lua | 12 +++++++++++- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/bash/.bashrc b/bash/.bashrc index b3f7974..75a6389 100644 --- a/bash/.bashrc +++ b/bash/.bashrc @@ -14,11 +14,6 @@ export MACHINE_START_SWAY=false # Whether to start Sway from bash # Source machine-specific config [[ -f ~/.machine_config ]] && source ~/.machine_config -# Execute tmux in Alacritty -if [[ "$TERM" == "alacritty" || "$TERM_PROGRAM" == "WezTerm" ]]; then - exec tmux -fi - # SSH without checking or adding host keys to known_hosts # Useful for cloud server rescue environment & installation alias sshtmp="ssh -o 'UserKnownHostsFile /dev/null' -o 'StrictHostKeyChecking no'" diff --git a/wezterm/.config/wezterm/wezterm.lua b/wezterm/.config/wezterm/wezterm.lua index 56f8aac..8a61438 100644 --- a/wezterm/.config/wezterm/wezterm.lua +++ b/wezterm/.config/wezterm/wezterm.lua @@ -3,5 +3,15 @@ return { color_scheme = "Gruvbox dark, medium (base16)", font = wezterm.font("FiraCode Nerd Font Mono"), font_size = 10.5, - enable_tab_bar = false, -- I use tmux + enable_tab_bar = true, + use_ime = true, + scrollback_lines = 65536, + tab_bar_at_bottom = true, + window_padding = { + top = '0.5cell', + -- We already have the tab bar at bottom + bottom = '0', + left = '1cell', + right = '1cell' + } } From 2832406e8f3404f25d34f9c12abbfffe6ae7af10 Mon Sep 17 00:00:00 2001 From: Peter Cai Date: Thu, 15 Jun 2023 16:39:08 -0400 Subject: [PATCH 3/7] wezterm: Fix a key binding conflict --- wezterm/.config/wezterm/wezterm.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/wezterm/.config/wezterm/wezterm.lua b/wezterm/.config/wezterm/wezterm.lua index 8a61438..8499ac1 100644 --- a/wezterm/.config/wezterm/wezterm.lua +++ b/wezterm/.config/wezterm/wezterm.lua @@ -13,5 +13,13 @@ return { bottom = '0', left = '1cell', right = '1cell' - } + }, + keys = { + -- The default Ctrl+Tab conflicts with Sway + { + key = 'Tab', + mods = 'SHIFT', + action = wezterm.action.ActivateTabRelative(-1), + }, + }, } From fb2e70ca5f2beb002e9fb25fa156b79414abdf23 Mon Sep 17 00:00:00 2001 From: Peter Cai Date: Sat, 17 Jun 2023 18:17:13 -0400 Subject: [PATCH 4/7] wezterm: Fix SHIFT + TAB --- wezterm/.config/wezterm/wezterm.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wezterm/.config/wezterm/wezterm.lua b/wezterm/.config/wezterm/wezterm.lua index 8499ac1..fdcaf06 100644 --- a/wezterm/.config/wezterm/wezterm.lua +++ b/wezterm/.config/wezterm/wezterm.lua @@ -19,7 +19,7 @@ return { { key = 'Tab', mods = 'SHIFT', - action = wezterm.action.ActivateTabRelative(-1), + action = wezterm.action.ActivateTabRelative(1), }, }, } From 798d464dd85bf0126a67fe14d911a4fb0906e6f9 Mon Sep 17 00:00:00 2001 From: Peter Cai Date: Sat, 17 Jun 2023 18:18:12 -0400 Subject: [PATCH 5/7] wezterm: add hotkey to reload config --- wezterm/.config/wezterm/wezterm.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/wezterm/.config/wezterm/wezterm.lua b/wezterm/.config/wezterm/wezterm.lua index fdcaf06..950624b 100644 --- a/wezterm/.config/wezterm/wezterm.lua +++ b/wezterm/.config/wezterm/wezterm.lua @@ -21,5 +21,11 @@ return { mods = 'SHIFT', action = wezterm.action.ActivateTabRelative(1), }, + -- Reload config forcibly + { + key = 'r', + mods = 'CTRL|SHIFT', + action = wezterm.action.ReloadConfiguration, + }, }, } From a20adc9424943ea229381cab3a0716f6eb6a6b49 Mon Sep 17 00:00:00 2001 From: Peter Cai Date: Sat, 17 Jun 2023 18:20:27 -0400 Subject: [PATCH 6/7] bash: Add shorthands for ssh-ing via WezTerm --- bash/.bashrc | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/bash/.bashrc b/bash/.bashrc index 75a6389..5cef53b 100644 --- a/bash/.bashrc +++ b/bash/.bashrc @@ -102,6 +102,39 @@ function sshts() { _ssh $(tsselect) } +# SSH shorthands for WezTerm +function assert_wezterm() { + [ "$TERM_PROGRAM" == "WezTerm" ] +} + +# sshwez and sshmuxwez are used for spawning tabs in WezTerm +# that uses its native multiplexer; this is useful for connecting +# to home servers etc. and make use of WezTerm's native panes +function sshwez() { + assert_wezterm || return + wezterm cli spawn --domain-name "SSH:$1" +} + +function sshmuxwez() { + assert_wezterm || return + wezterm cli spawn --domain-name "SSHMUX:$1" +} + +# moshwez{,ts,scrts} simply runs mosh inside a new WezTerm tab +# Ideal for remote connections +function moshwez() { + assert_wezterm || return + wezterm cli spawn -- mosh "$@" +} + +function moshwezts() { + moshwez $(tsselect) +} + +function moshwezscrts() { + moshwez $(tsselect) -- screen -RR -d +} + # Add local to path export PATH="$PATH:~/.local/bin" From a5b4ab1037e345ee8bb5105fc85f7408f85f1792 Mon Sep 17 00:00:00 2001 From: Peter Cai Date: Sat, 17 Jun 2023 18:24:34 -0400 Subject: [PATCH 7/7] wezter: Add shortcuts to spawn panes in the default domain --- wezterm/.config/wezterm/wezterm.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/wezterm/.config/wezterm/wezterm.lua b/wezterm/.config/wezterm/wezterm.lua index 950624b..738c9b5 100644 --- a/wezterm/.config/wezterm/wezterm.lua +++ b/wezterm/.config/wezterm/wezterm.lua @@ -27,5 +27,17 @@ return { mods = 'CTRL|SHIFT', action = wezterm.action.ReloadConfiguration, }, + -- Spawn panes in the **DEFAULT** domain + -- to use the current domain, use Ctrl + Alt + Shift + " or % + { + key = '"', + mods = 'CTRL|SUPER|ALT|SHIFT', + action = wezterm.action.SplitVertical { domain = 'DefaultDomain' }, + }, + { + key = '%', + mods = 'CTRL|SUPER|ALT|SHIFT', + action = wezterm.action.SplitHorizontal { domain = 'DefaultDomain' }, + }, }, }