move urlview to default.nix

This commit is contained in:
Motiejus Jakštys 2024-04-15 16:24:10 +03:00 committed by Motiejus Jakštys
parent 2e71677213
commit 1d8d38b51a
2 changed files with 6 additions and 24 deletions

View File

@ -206,13 +206,12 @@ in {
set-option -g default-terminal "screen-256color"
set-option -sa terminal-features ',xterm-256color:RGB'
run-shell ${pkgs.writeShellScript "urlview"
(builtins.readFile
(pkgs.substituteAll {
src = ./urlview.tmux;
extract_url = pkgs.extract_url;
})
.outPath)}
run-shell ${pkgs.writeShellScript "urlview" ''
tmux bind-key u capture-pane -J \\\; \
save-buffer "''${TMPDIR:-/tmp}/tmux-buffer" \\\; \
delete-buffer \\\; \
split-window -l 10 "${pkgs.extract_url}/bin/extract_url -c ${pkgs.writeText "urlviewrc" "COMMAND firefox"} ''${TMPDIR:-/tmp}/tmux-buffer'"
''}
'';
};
}

View File

@ -1,17 +0,0 @@
# shellcheck shell=bash
get_tmux_option() {
local option=$1
local default_value=$2
local option_value
option_value=$(tmux show-option -gqv "$option")
if [ -z "$option_value" ]; then
echo "$default_value"
else
echo "$option_value"
fi
}
tmux bind-key "$(get_tmux_option "@urlview-key" "u")" capture-pane -J \\\; \
save-buffer "${TMPDIR:-/tmp}/tmux-buffer" \\\; \
delete-buffer \\\; \
split-window -l 10 "@extract_url@/bin/extract_url '${TMPDIR:-/tmp}/tmux-buffer'"