From 68e680721c875c5b677b5c60e754cdf81cc0e909 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Sun, 24 Feb 2019 17:24:47 +0100 Subject: Define type of task entries --- gui/pkgs/tasker.nix | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'gui') diff --git a/gui/pkgs/tasker.nix b/gui/pkgs/tasker.nix index b3cf61b..bc87ee9 100644 --- a/gui/pkgs/tasker.nix +++ b/gui/pkgs/tasker.nix @@ -1,19 +1,22 @@ { pkgs, tasks, ... }: -pkgs.lib.mapAttrsToList (name: value: let +pkgs.lib.mapAttrsToList (name: conf: let command = pkgs.writeTextFile { name = "tasker_cmd_" + name; executable = true; destination = "/bin/tasker_cmd_" + name; - text = if value.terminal then '' - #!/bin/sh - exec ${pkgs.kitty}/bin/kitty -d ${value.directory} ${value.command} - '' else '' - #!/bin/sh - pushd ${value.directory} - exec ${value.command} - popd - ''; + text = pkgs.lib.attrByPath [ conf.type ] "" { + terminal = '' + #!/bin/sh + exec ${pkgs.kitty}/bin/kitty -d ${conf.directory} ${conf.command} + ''; + launcher = '' + #!/bin/sh + pushd ${conf.directory} + exec ${conf.command} + popd + ''; + }; }; shortcut = pkgs.writeTextFile { name = "tasker_shortcut_" + name; @@ -22,7 +25,7 @@ pkgs.lib.mapAttrsToList (name: value: let text = '' [Desktop Entry] Type=Application - Name=${value.description} + Name=${conf.description} GenericName=Tasker Exec=${command}/bin/tasker_cmd_${name} Terminal=false -- cgit v1.2.3