aboutsummaryrefslogtreecommitdiff
path: root/gui/pkgs
diff options
context:
space:
mode:
authorAdrian Kummerlaender2019-02-22 12:30:35 +0100
committerAdrian Kummerlaender2019-02-22 12:30:35 +0100
commita0c8daf64aaa392949b99d5e5ae5df9a763dfec8 (patch)
tree362a32a4c46ebc5c45e03d65c2efc96a3ea46b7a /gui/pkgs
parentcfab1689f5723129f0bfbb79eaabecf8e809905b (diff)
downloadnixos_home-a0c8daf64aaa392949b99d5e5ae5df9a763dfec8.tar
nixos_home-a0c8daf64aaa392949b99d5e5ae5df9a763dfec8.tar.gz
nixos_home-a0c8daf64aaa392949b99d5e5ae5df9a763dfec8.tar.bz2
nixos_home-a0c8daf64aaa392949b99d5e5ae5df9a763dfec8.tar.lz
nixos_home-a0c8daf64aaa392949b99d5e5ae5df9a763dfec8.tar.xz
nixos_home-a0c8daf64aaa392949b99d5e5ae5df9a763dfec8.tar.zst
nixos_home-a0c8daf64aaa392949b99d5e5ae5df9a763dfec8.zip
Nixify project task launcher
Task scripts and desktop shortcuts are now autogenerated using a friendly list of tasks in `gui/tasker.nix`. i.e. a separate rofi launcher is unnecessary as the generated desktop files are automatically picked up by stock rofi. This is nice.
Diffstat (limited to 'gui/pkgs')
-rw-r--r--gui/pkgs/tasker.nix47
1 files changed, 29 insertions, 18 deletions
diff --git a/gui/pkgs/tasker.nix b/gui/pkgs/tasker.nix
index a198cb8..2382be2 100644
--- a/gui/pkgs/tasker.nix
+++ b/gui/pkgs/tasker.nix
@@ -1,19 +1,30 @@
-{ stdenv, pkgs, ... }:
+{ pkgs, tasks, ... }:
-pkgs.writeTextFile {
- name = "tasker";
- executable = true;
- destination = "/bin/tasker";
-
- text = with pkgs; ''
- #!${fish}/bin/fish
-
- pushd ~/.local/share/tasks
- set task (find . -executable -type f | cut -c3- | rofi -dmenu -p "task")
-
- if test $status -eq 0
- eval $task
- end
- popd
- '';
-}
+pkgs.lib.mapAttrsToList (name: value: let
+ command = pkgs.writeTextFile {
+ name = "tasker_cmd_" + name;
+ executable = true;
+ destination = "/bin/tasker_cmd_" + name;
+ text = ''
+ #!/bin/sh
+ pushd ${toString value.directory}
+ exec ${toString value.command}
+ popd
+ '';
+ };
+ shortcut = pkgs.writeTextFile {
+ name = "tasker_shortcut_" + name;
+ executable = false;
+ destination = "/share/applications/tasker_shortcut_" + name + ".desktop";
+ text = ''
+ [Desktop Entry]
+ Type=Application
+ Name=${toString value.description}
+ Exec=${command}/bin/tasker_cmd_${toString name}
+ Terminal=false
+ '';
+ };
+in pkgs.symlinkJoin {
+ name = "tasker_task_" + name;
+ paths = [ shortcut ];
+}) tasks