diff options
-rw-r--r-- | gui/conf/xmonad.hs | 1 | ||||
-rw-r--r-- | gui/default.nix | 2 | ||||
-rw-r--r-- | gui/pkgs/tasker.nix | 47 | ||||
-rw-r--r-- | gui/tasker.nix | 20 | ||||
-rw-r--r-- | gui/xmonad.nix | 6 |
5 files changed, 52 insertions, 24 deletions
diff --git a/gui/conf/xmonad.hs b/gui/conf/xmonad.hs index f1222a7..668d818 100644 --- a/gui/conf/xmonad.hs +++ b/gui/conf/xmonad.hs @@ -145,7 +145,6 @@ commonKeybindings host = , ("C-M1-l" , spawn "i3lock -c 000000") -- application launchers , ("M-<Space>" , spawn "rofi -show combi") - , ("C-<Space>" , spawn "tasker") , ("M-<Return>" , spawn "kitty") , ("M-S-<Return>" , spawn "nvim-qt --no-ext-tabline") , ("<Print>" , spawn "flameshot gui") diff --git a/gui/default.nix b/gui/default.nix index 2cc011e..6948139 100644 --- a/gui/default.nix +++ b/gui/default.nix @@ -9,6 +9,8 @@ in { ./kitty.nix ./vim.nix ./zathura.nix + # desktop shortcuts for project specific tasks + ./tasker.nix # applications grouped by purpose ./apps/file.nix ./apps/web.nix 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 diff --git a/gui/tasker.nix b/gui/tasker.nix new file mode 100644 index 0000000..bb006fa --- /dev/null +++ b/gui/tasker.nix @@ -0,0 +1,20 @@ +{ pkgs, ... }: + +let + tasks = { + "bsc_edit" = { + description = "Grid refinement BSc thesis editor"; + directory = "~/university/documents/bachelor/arbeit"; + command = "nix-shell --run 'nvim-qt --no-ext-tabline'"; + }; + "bsc_view" = { + description = "Grid refinement BSc thesis PDF"; + directory = "~/university/documents/bachelor/arbeit"; + command = "evince build/main.pdf"; + }; + }; +in { + home.packages = let + task_derivations = pkgs.callPackage ./pkgs/tasker.nix { inherit pkgs; inherit tasks; }; + in task_derivations; +} diff --git a/gui/xmonad.nix b/gui/xmonad.nix index f265278..52de48d 100644 --- a/gui/xmonad.nix +++ b/gui/xmonad.nix @@ -26,13 +26,9 @@ in { }; }; - home.packages = let - tasker = pkgs.lib.callPackageWith pkgs ./pkgs/tasker.nix { }; - in with pkgs; [ + home.packages = with pkgs; [ # lockscreen i3lock - # task launcher - tasker ]; services.screen-locker = { |