Ditch tmux for ghostty tabs + a more stateless living

This commit is contained in:
Daniel Lundin 2025-01-01 13:12:48 +01:00
parent 494bd5cad1
commit be77222a99
Signed by: dln
SSH key fingerprint: SHA256:dQy1Xj3UiqJYpKR5ggQ2bxgz4jCH8IF+k3AB8o0kmdI
3 changed files with 16 additions and 85 deletions

View file

@ -43,40 +43,17 @@
body = ''confirm " Really shutdown $(hostname)?" && command shutdown $argv'';
};
tmux-refresh-env = {
description = "Refresh environment variables from tmux session";
body = ''
for var in (tmux show-environment | string match -rv '^-')
set -l parts (string split -m 1 '=' $var)
if test (count $parts) -eq 2
set -Ux $parts[1] $parts[2]
end
end
'';
};
kubectl = {
description = "Wraps kubectl in grc";
wraps = "kubectl";
body = "grc.wrap kubectl $argv";
};
edit = {
description = "Open a file in already running nvim and switch tab";
e = {
description = "Open a file in already running nvim";
argumentNames = [ "file" ];
body = ''
set _file (readlink -f "$file")
if test -z "$file"
set _root (vcs_root)
set _file (fd --type f . "$_root" | sed -e "s#^$_root/##" | fzf --no-sort --layout=reverse)
set _file "$_root/$_file"
end
set _nvim_socket "$XDG_RUNTIME_DIR/nvim-persistent.sock"
if test -S "$_nvim_socket" && tmux select-window -t nvim 2>/dev/null
nvim --server "$_nvim_socket" --remote "$_file"
return 0
end
tmux new-window -S -n nvim nvim --listen "$_nvim_socket" "$_file"
nvim --server "$XDG_RUNTIME_DIR/nvim-persistent.sock" --remote (readlink -f "$file")
'';
};
@ -156,7 +133,6 @@
];
shellAbbrs = {
e = "edit";
l = "bat";
ls = "eza";
tree = "eza --tree";

View file

@ -34,8 +34,9 @@
shell-integration = "fish";
window-decoration = false;
gtk-tabs-location = "bottom";
window-decoration = true;
gtk-single-instance = true;
gtk-tabs-location = "hidden";
gtk-titlebar = false;
window-padding-x = 12;
window-padding-y = 0;
@ -49,16 +50,6 @@
"alt+shift+v=paste_from_clipboard"
"ctrl+tab=goto_split:previous"
"super+enter=toggle_fullscreen"
"ctrl+enter=unbind"
"alt+one=unbind"
"alt+two=unbind"
"alt+three=unbind"
"alt+four=unbind"
"alt+five=unbind"
"alt+six=unbind"
"alt+seven=unbind"
"alt+eight=unbind"
"alt+nine=unbind"
];
};
};
@ -116,46 +107,12 @@
'';
xdg.desktopEntries = {
ghostty-local = {
categories = [
"System"
"TerminalEmulator"
];
exec = ''ghostty --class=com.mitchellh.ghostty-local -e "tmux new-session -A -D -s main -t main"'';
genericName = "Ghostty (local)";
icon = "com.mitchellh.ghostty";
name = "Ghostty (local)";
settings = {
StartupWMClass = "com.mitchellh.ghostty-local";
TryExec = "ghostty";
};
terminal = false;
type = "Application";
};
ghostty-local-secondary = {
categories = [
"System"
"TerminalEmulator"
];
exec = ''ghostty --class=com.mitchellh.ghostty-local-secondary -e "tmux new-session -A -D -s secondary -t main"'';
genericName = "Ghostty (local) Secondary";
icon = "com.mitchellh.ghostty";
name = "Ghostty (local) Secondary";
settings = {
StartupWMClass = "com.mitchellh.ghostty-local-secondary";
TryExec = "ghostty";
};
terminal = false;
type = "Application";
};
ghostty-nemo = {
categories = [
"System"
"TerminalEmulator"
];
exec = ''ghostty --class=com.mitchellh.ghostty-nemo -e "ssh -t nemo tmux new-session -A -D -s main -t main"'';
exec = ''ghostty --class=com.mitchellh.ghostty-nemo --command="ssh -t nemo"'';
genericName = "Ghostty (nemo)";
icon = "com.mitchellh.ghostty";
name = "Ghostty (nemo)";

View file

@ -25,7 +25,6 @@
set -g status-right '%F | %R'
set -g status off
set -g update-environment "SSH_AUTH_SOCK"
setenv -g "SSH_AUTH_SOCK" "$XDG_RUNTIME_DIR/ssh-agent"
setw -g alternate-screen on
setw -g automatic-rename off
setw -g window-status-format ""
@ -34,16 +33,15 @@
set -s command-alias[1000] stty='run-shell "tmux send-keys \"stty cols #{pane_width} rows #{pane_height}\" Enter"'
bind -n M-1 if-shell 'tmux select-window -t nvim' refresh-client 'new-window -S -n nvim nvim --listen $XDG_RUNTIME_DIR/nvim-persistent.sock'
bind -n M-2 if-shell 'tmux select-window -t t1' refresh-client 'new-window -S -n t1'
bind -n M-3 if-shell 'tmux select-window -t t2' refresh-client 'new-window -S -n t2'
bind -n M-4 if-shell 'tmux select-window -t t3' refresh-client 'new-window -S -n t3'
bind -n M-5 if-shell 'tmux select-window -t t4' refresh-client 'new-window -S -n t4'
bind -n M-6 if-shell 'tmux select-window -t t5' refresh-client 'new-window -S -n t5'
bind -n M-7 if-shell 'tmux select-window -t t6' refresh-client 'new-window -S -n t6'
bind -n M-8 if-shell 'tmux select-window -t t7' refresh-client 'new-window -S -n t7'
bind -n M-9 if-shell 'tmux select-window -t t8' refresh-client 'new-window -S -n t8'
bind -n M-0 if-shell 'tmux select-window -t t9' refresh-client 'new-window -S -n t9'
bind -n C-2 if-shell 'tmux select-window -t t1' refresh-client 'new-window -S -n t1'
bind -n C-3 if-shell 'tmux select-window -t t2' refresh-client 'new-window -S -n t2'
bind -n C-4 if-shell 'tmux select-window -t t3' refresh-client 'new-window -S -n t3'
bind -n C-5 if-shell 'tmux select-window -t t4' refresh-client 'new-window -S -n t4'
bind -n C-6 if-shell 'tmux select-window -t t5' refresh-client 'new-window -S -n t5'
bind -n C-7 if-shell 'tmux select-window -t t6' refresh-client 'new-window -S -n t6'
bind -n C-8 if-shell 'tmux select-window -t t7' refresh-client 'new-window -S -n t7'
bind -n C-9 if-shell 'tmux select-window -t t8' refresh-client 'new-window -S -n t8'
bind -n C-0 if-shell 'tmux select-window -t t9' refresh-client 'new-window -S -n t9'
bind -T copy-mode-vi WheelUpPane select-pane \; send-keys -X -N 1 scroll-up
bind -T copy-mode-vi WheelDownPane select-pane \; send-keys -X -N 1 scroll-down
bind C-s set-option -g status