about summary refs log tree commit diff stats
path: root/modules/home.legacy/conf/xdg
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--modules/home.legacy/conf/xdg/default.nix46
-rwxr-xr-xmodules/home.legacy/conf/xdg/url-handler.sh (renamed from modules/home.legacy/conf/xdg/url_handler.sh)10
2 files changed, 26 insertions, 30 deletions
diff --git a/modules/home.legacy/conf/xdg/default.nix b/modules/home.legacy/conf/xdg/default.nix
index 4099720d..ad0cd226 100644
--- a/modules/home.legacy/conf/xdg/default.nix
+++ b/modules/home.legacy/conf/xdg/default.nix
@@ -1,22 +1,18 @@
 {
-  sysLib,
   pkgs,
-  config,
+  lib,
   ...
 }: let
-  url_handler = sysLib.writeShellScript {
-    name = "url_handler";
-    src = ./url_handler.sh;
-    keepPath = true;
-    # Naming dependencies for this will be difficult, as it depend on overridden packages.
-    dependencies = with pkgs; [
-      rofi
-      libnotify
-      zathura
+  url-handler = pkgs.writeShellApplication {
+    name = "url-handler";
+    text = builtins.readFile ./url-handler.sh;
+    inheritPath = false;
+    runtimeInputs = [
+      pkgs.rofi
+      pkgs.libnotify
+      pkgs.zathura
+      pkgs.tskm
     ];
-    replacementStrings = {
-      ALL_PROJECTS_PIPE = "${config.soispha.taskwarrior.projects.projects_pipe}";
-    };
   };
 in {
   imports = [
@@ -27,22 +23,22 @@ in {
     mimeApps = {
       enable = true;
       defaultApplications = {
-        "application/pdf" = ["url_handler.desktop"];
-        "application/x-pdf" = ["url_handler.desktop"];
+        "application/pdf" = ["url-handler.desktop"];
+        "application/x-pdf" = ["url-handler.desktop"];
 
-        "text/html" = ["url_handler.desktop"];
-        "text/xml" = ["url_handler.desktop"];
-        "x-scheme-handler/http" = ["url_handler.desktop"];
-        "x-scheme-handler/https" = ["url_handler.desktop"];
-        "x-scheme-handler/about" = ["url_handler.desktop"];
-        "x-scheme-handler/unknown" = ["url_handler.desktop"];
+        "text/html" = ["url-handler.desktop"];
+        "text/xml" = ["url-handler.desktop"];
+        "x-scheme-handler/http" = ["url-handler.desktop"];
+        "x-scheme-handler/https" = ["url-handler.desktop"];
+        "x-scheme-handler/about" = ["url-handler.desktop"];
+        "x-scheme-handler/unknown" = ["url-handler.desktop"];
       };
     };
     desktopEntries = {
-      url_handler = {
-        name = "url_handler";
+      url-handler = {
+        name = "url-handler";
         genericName = "Web Browser";
-        exec = "${url_handler}/bin/url_handler %u";
+        exec = "${lib.getExe url-handler} %u";
         terminal = false;
         categories = [
           "Application"
diff --git a/modules/home.legacy/conf/xdg/url_handler.sh b/modules/home.legacy/conf/xdg/url-handler.sh
index 95eedffb..f15df384 100755
--- a/modules/home.legacy/conf/xdg/url_handler.sh
+++ b/modules/home.legacy/conf/xdg/url-handler.sh
@@ -1,9 +1,9 @@
-#!/usr/bin/env dash
+#!/usr/bin/env sh
 
-# shellcheck source=/dev/null
-SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH
-
-project="$(echo "%ALL_PROJECTS_PIPE|nvim|zathura|" | rofi -sep "|" -dmenu)"
+project="$({
+    tskm projects list
+    echo nvim zathura
+} | rofi -sep "$(printf "\n")" -dmenu)"
 
 if [ "$project" = "nvim" ]; then
     "$TERMINAL" -e nvim "$1"