{ pkgs }: pkgs.symlinkJoin { name = "alacritty-tv"; paths = [ (pkgs.writeDashBin "alacritty" '' # usage: # 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 ;; --singleton) singleton=1 shift ;; *) break esac done config=/etc/alacritty/$profile.toml if ! test -e "$config"; then echo "$0: warning: bad profile: $profile; using default instead" >&2 profile=default config=/etc/alacritty/default.toml fi export WINIT_X11_SCALE_FACTOR=$( ${pkgs.haskellPackages.xoutinfo}/bin/xoutinfo | ${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" "$@" & fi else exec ${pkgs.alacritty}/bin/alacritty --config-file "$config" "$@" fi '') pkgs.alacritty ]; }