summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--home/wayland/home.nix1
-rw-r--r--home/wayland/modules/ttyasrt.nix34
-rw-r--r--home/wayland/pkgs/wayland-scripts/default.nix2
-rwxr-xr-xhome/wayland/pkgs/wayland-scripts/src/bin/ttyasrt23
4 files changed, 60 insertions, 0 deletions
diff --git a/home/wayland/home.nix b/home/wayland/home.nix
index a399178..df9f910 100644
--- a/home/wayland/home.nix
+++ b/home/wayland/home.nix
@@ -6,6 +6,7 @@
./modules/zathura.nix
./modules/firefox.nix
./modules/mimeapps.nix
+ ./modules/ttyasrt.nix
./modules/sway/home.nix
];
diff --git a/home/wayland/modules/ttyasrt.nix b/home/wayland/modules/ttyasrt.nix
new file mode 100644
index 0000000..ba9a2c5
--- /dev/null
+++ b/home/wayland/modules/ttyasrt.nix
@@ -0,0 +1,34 @@
+{ pkgs, ... }: let
+ wayland-scripts = pkgs.callPackage ../pkgs/wayland-scripts {};
+ ttyasrt = "${wayland-scripts}/bin/ttyasrt";
+in {
+ home.packages = [ wayland-scripts ];
+
+ xdg.desktopEntries = {
+ "nnn".settings = {
+ Type = "Application";
+ Name = "nnn";
+ Comment = "Terminal file manager";
+ TryExec = "nnn";
+ Exec = "${ttyasrt} nnn -decC";
+ Icon = "nnn";
+ MimeType = "inode/directory";
+ Categories = "System;FileTools;FileManager";
+ Keywords = "File;Manager;Management;Explorer;Launcher";
+ };
+
+ "nvim".settings = {
+ Name = "Neovim wrapper";
+ GenericName = "Text Editor";
+ Comment = "Edit text files";
+ TryExec = "nvim";
+ Exec = "${ttyasrt} nvim %F";
+ Type = "Application";
+ Keywords = "Text;editor;";
+ Icon = "nvim";
+ Categories = "Utility;TextEditor;";
+ StartupNotify = "false";
+ MimeType = "text/plain";
+ };
+ };
+}
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