summaryrefslogtreecommitdiff
path: root/nixos/parts
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2024-12-12 08:31:51 +0100
committerMartin Fischer <martin@push-f.com>2024-12-12 08:32:40 +0100
commitdda8485d57bc59bd4781ea43cf1dc200351afebe (patch)
tree13a443388f8ab1ca91306f256c0f7dffc7e7db5b /nixos/parts
parentd17efc051d99e27abd44655acaf508e360c41bac (diff)
enable SSH host-specific terminal background colors
Diffstat (limited to 'nixos/parts')
-rw-r--r--nixos/parts/graphical.nix12
1 files changed, 12 insertions, 0 deletions
diff --git a/nixos/parts/graphical.nix b/nixos/parts/graphical.nix
index 990cd9e..8c340fc 100644
--- a/nixos/parts/graphical.nix
+++ b/nixos/parts/graphical.nix
@@ -18,6 +18,18 @@
brightnessctl
wl-clipboard # for wl-copy and wl-paste
+ # When I ssh into a server my terminal changes to a host-specific background color via
+ # a LocalCommand configured in ~/.ssh/config and a ZSH function to reset the color on exit.
+ (writeShellScriptBin "set-bg" ''
+ #!/usr/bin/env bash
+ rgb_with_slashes=$(echo "$1" | sed -r 's,(..)(..),\1/\2/,')
+ echo -en "\033]11;rgb:$rgb_with_slashes\007"
+ '')
+ (writeShellScriptBin "reset-bg" ''
+ #!/usr/bin/env bash
+ echo -en "\033]111\007"
+ '')
+
# graphical tools
imv
mpv