summaryrefslogtreecommitdiffstats
path: root/pkgs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2025-07-17 11:44:33 +0200
committertv <tv@krebsco.de>2025-07-17 12:04:47 +0200
commit36b0881b4af8d9509eb33a75ab5bb980dd502359 (patch)
tree44712f35b3b0d8d69d2d3f2d64ee72901a97a9ad /pkgs
parent34ea4cacef3c12a45d774cff652651557d422161 (diff)
alacritty-tv: add --dtach option
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/simple/alacritty-tv.nix18
1 files changed, 17 insertions, 1 deletions
diff --git a/pkgs/simple/alacritty-tv.nix b/pkgs/simple/alacritty-tv.nix
index 86ca10f..ebf609e 100644
--- a/pkgs/simple/alacritty-tv.nix
+++ b/pkgs/simple/alacritty-tv.nix
@@ -5,16 +5,21 @@ pkgs.symlinkJoin {
paths = [
(pkgs.writeDashBin "alacritty" ''
# usage:
- # alacritty [--profile=PROFILE] [--singleton] [ARGS...]
+ # alacritty [--dtach] [--profile=PROFILE] [--singleton] [COMMAND [ARGS...]]
# where
# PROFILE must have a corresponding file /etc/alacritty/PROFILE.toml
set -efu
+ dtach=
profile=default
singleton=
while :; do
case ''${1-} in
+ --dtach)
+ dtach=1
+ shift
+ ;;
--profile=*)
profile=''${1#--profile=}
shift
@@ -41,6 +46,17 @@ pkgs.symlinkJoin {
${pkgs.jq}/bin/jq .device_scale_factor
)
+ if test "$dtach" = 1; then
+ if test $# = 0; then
+ _CURRENT_DESKTOP_NAME=''${_CURRENT_DESKTOP_NAME-$(${pkgs.xextras}/bin/net-current-desktop)}
+ SHELL=''${SHELL-${pkgs.bash}/bin/bash}
+ sock=$XDG_RUNTIME_DIR/Alacritty-$DISPLAY-dtach-$_CURRENT_DESKTOP_NAME-$$.sock
+ set -- -e ${pkgs.dtach}/bin/dtach -c "$sock" -r winch -z "$SHELL"
+ else
+ echo 'alacritty-tv: warning: option --dtach ignored: arguments provided' >&2
+ fi
+ fi
+
if test "$singleton" = 1; then
if ! ${pkgs.alacritty}/bin/alacritty --config-file "$config" msg create-window "$@"; then
${pkgs.alacritty}/bin/alacritty --config-file "$config" "$@" &