From 3eb462c992e9612e3571b17269dda290f391cda6 Mon Sep 17 00:00:00 2001 From: sinanmohd Date: Tue, 16 Jul 2024 13:57:09 +0530 Subject: home/wayland/ttyasrt: init --- home/wayland/pkgs/wayland-scripts/default.nix | 2 ++ home/wayland/pkgs/wayland-scripts/src/bin/ttyasrt | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100755 home/wayland/pkgs/wayland-scripts/src/bin/ttyasrt (limited to 'home/wayland/pkgs/wayland-scripts') diff --git a/home/wayland/pkgs/wayland-scripts/default.nix b/home/wayland/pkgs/wayland-scripts/default.nix index c98def5..b43f4b7 100644 --- a/home/wayland/pkgs/wayland-scripts/default.nix +++ b/home/wayland/pkgs/wayland-scripts/default.nix @@ -37,6 +37,8 @@ stdenvNoCC.mkDerivation { postInstall = '' wrapProgram $out/bin/cwall \ --prefix PATH : ${lib.makeBinPath [ ffmpeg libnotify sway ]} + wrapProgram $out/bin/ttyasrt \ + --prefix PATH : ${lib.makeBinPath [ libnotify ]} wrapProgram $out/bin/freezshot \ --prefix PATH : ${lib.makeBinPath [ ffmpeg sway grim slurp imv ]} ''; diff --git a/home/wayland/pkgs/wayland-scripts/src/bin/ttyasrt b/home/wayland/pkgs/wayland-scripts/src/bin/ttyasrt new file mode 100755 index 0000000..5148faf --- /dev/null +++ b/home/wayland/pkgs/wayland-scripts/src/bin/ttyasrt @@ -0,0 +1,23 @@ +#!/bin/sh + +die() +{ + printf "\033[31;1merr: %b\033[0m\n" "$1" + command -v notify-send > /dev/null && + notify-send " ttyasrt" "$1" + exit "${2:-1}" +} + +######## +# MAIN # +######## + +if [ -z "$TERMINAL" ]; then + die "\$TERMIANL must be set" +fi + +if tty --silent; then + exec "$@" +else + exec "$TERMINAL" -- "$@" +fi -- cgit v1.2.3