summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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" "$@" &