add TMUX_SESSION_NAME inheriting over ssh
This commit is contained in:
parent
391b47fa75
commit
bdaefa4d5c
6 changed files with 22 additions and 38 deletions
33
;
33
;
|
|
@ -1,33 +0,0 @@
|
||||||
{
|
|
||||||
lib,
|
|
||||||
options,
|
|
||||||
machine,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
with lib;
|
|
||||||
{
|
|
||||||
options = {
|
|
||||||
custom.program = mkOption {
|
|
||||||
type = types.attrsOf (
|
|
||||||
types.submodule (
|
|
||||||
{ config, ... }:
|
|
||||||
{
|
|
||||||
options = {
|
|
||||||
name = mkOption {
|
|
||||||
type = types.string;
|
|
||||||
};
|
|
||||||
home-config = mkOption {
|
|
||||||
type = types.deferredModule;
|
|
||||||
};
|
|
||||||
system-config = mkOption {
|
|
||||||
type = types.deferredModule;
|
|
||||||
default = _: { };
|
|
||||||
};
|
|
||||||
};
|
|
||||||
config = if builtins.isNull machine.home-only then config.system-config else config.home-config;
|
|
||||||
}
|
|
||||||
)
|
|
||||||
);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -19,6 +19,7 @@ inputs@{ machine, ... }:
|
||||||
"cp-mov" = cp-media "mov" "movies";
|
"cp-mov" = cp-media "mov" "movies";
|
||||||
"cp-ser" = cp-media "ser" "shows";
|
"cp-ser" = cp-media "ser" "shows";
|
||||||
"cp-ani" = cp-media "ani" "anime";
|
"cp-ani" = cp-media "ani" "anime";
|
||||||
|
"ragdoll" = ragdoll;
|
||||||
"dumpasm" = "${pkgs.custom.dumpasm}/bin/dumpasm";
|
"dumpasm" = "${pkgs.custom.dumpasm}/bin/dumpasm";
|
||||||
"p" = builtins.trace calc calc;
|
"p" = builtins.trace calc calc;
|
||||||
"s" = "systemctl";
|
"s" = "systemctl";
|
||||||
|
|
|
||||||
|
|
@ -22,4 +22,16 @@
|
||||||
'';
|
'';
|
||||||
in
|
in
|
||||||
"${s}/bin/cp-${name}";
|
"${s}/bin/cp-${name}";
|
||||||
|
|
||||||
|
ragdoll = "${pkgs.writeScriptBin "ragdoll" ''
|
||||||
|
RAND=$(xxd -l 32 -c 32 -p < /dev/urandom)
|
||||||
|
if [ -z "$TMUX_SESSION_NAME" ]; then
|
||||||
|
RAND=$(cat /dev/urandom | head -c 20 | base32)
|
||||||
|
export TMUX_SESSION_NAME="$RAND"
|
||||||
|
tmux rename-session -t "$(tmux display-message -p "#S")" "$TMUX_SESSION_NAME"
|
||||||
|
fi
|
||||||
|
|
||||||
|
SSH_TMUX_SESSION_NAME="ssh-from-$(hostname)-$TMUX_SESSION_NAME"
|
||||||
|
tmux detach -E "kitten ssh -t ragdoll \"export TMUX_SESSION_NAME=$SSH_TMUX_SESSION_NAME; tmux attach -t $SSH_TMUX_SESSION_NAME || tmux new -e TMUX_SESSION_NAME=$SSH_TMUX_SESSION_NAME -s $SSH_TMUX_SESSION_NAME\"; exec tmux attach -t $TMUX_SESSION_NAME"
|
||||||
|
''}/bin/ragdoll";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,11 @@ inputs@{ machine, ... }:
|
||||||
draw_minimal_borders = false;
|
draw_minimal_borders = false;
|
||||||
hide_window_decorations = true;
|
hide_window_decorations = true;
|
||||||
|
|
||||||
shell = "${pkgs.tmux}/bin/tmux";
|
shell = "${pkgs.writeScriptBin "tmux-sesh" ''
|
||||||
|
RAND=$(cat /dev/urandom | head -c 20 | base32)
|
||||||
|
export TMUX_SESSION_NAME="kitty-$RAND"
|
||||||
|
exec ${pkgs.tmux}/bin/tmux new -e TMUX_SESSION_NAME=$TMUX_SESSION_NAME -s "$TMUX_SESSION_NAME"
|
||||||
|
''}/bin/tmux-sesh";
|
||||||
clipboard_control = "write-clipboard write-primary read-clipboard read-primary";
|
clipboard_control = "write-clipboard write-primary read-clipboard read-primary";
|
||||||
|
|
||||||
foreground = "#fcfcfc";
|
foreground = "#fcfcfc";
|
||||||
|
|
|
||||||
|
|
@ -107,9 +107,12 @@ vim.cmd([[
|
||||||
|
|
||||||
-- multicursor
|
-- multicursor
|
||||||
vim.g.VM_default_mappings = 1
|
vim.g.VM_default_mappings = 1
|
||||||
|
vim.g.VM_mouse_mappings = 1
|
||||||
vim.g.VM_reselect_first = 1
|
vim.g.VM_reselect_first = 1
|
||||||
vim.g.VM_notify_previously_selected = 1
|
vim.g.VM_notify_previously_selected = 1
|
||||||
vim.g.VM_theme = "iceblue"
|
vim.g.VM_theme = "iceblue"
|
||||||
|
vim.g.VM_maps["Undo"] = 'u'
|
||||||
|
vim.g.VM_maps["Redo"] = '<C-r>'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,8 +39,6 @@ inputs@{ machine, ... }:
|
||||||
# unbind every single normal keybinding
|
# unbind every single normal keybinding
|
||||||
unbind-key -a
|
unbind-key -a
|
||||||
|
|
||||||
set -g status-left "#{?client_prefix,#[bg=colour2],#[bg=colour1]}#[fg=colour0] #S "
|
|
||||||
|
|
||||||
# for special characters to work right
|
# for special characters to work right
|
||||||
# like <C-_>
|
# like <C-_>
|
||||||
# set-window-option -g xterm-keys on
|
# set-window-option -g xterm-keys on
|
||||||
|
|
@ -60,6 +58,7 @@ inputs@{ machine, ... }:
|
||||||
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel
|
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel
|
||||||
bind v copy-mode
|
bind v copy-mode
|
||||||
bind p paste-buffer -p
|
bind p paste-buffer -p
|
||||||
|
bind d detach
|
||||||
set -s set-clipboard on
|
set -s set-clipboard on
|
||||||
|
|
||||||
# get back normal terminal emulator bindings
|
# get back normal terminal emulator bindings
|
||||||
|
|
@ -164,8 +163,6 @@ inputs@{ machine, ... }:
|
||||||
bind-key [ copy-mode \; send-keys [
|
bind-key [ copy-mode \; send-keys [
|
||||||
bind-key ] copy-mode \; send-keys ]
|
bind-key ] copy-mode \; send-keys ]
|
||||||
|
|
||||||
bind d select-pane -l \; send-keys [
|
|
||||||
|
|
||||||
# f: file search
|
# f: file search
|
||||||
# unbound: git files
|
# unbound: git files
|
||||||
# g: git hashes
|
# g: git hashes
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue