diff options
Diffstat (limited to 'users/kassouni/palette')
| -rw-r--r-- | users/kassouni/palette/default.nix | 11 | ||||
| -rw-r--r-- | users/kassouni/palette/reboot.nix | 12 | ||||
| -rw-r--r-- | users/kassouni/palette/rebuild.nix | 20 | ||||
| -rw-r--r-- | users/kassouni/palette/screenshot.nix | 12 | ||||
| -rw-r--r-- | users/kassouni/palette/shutdown.nix | 12 |
5 files changed, 49 insertions, 18 deletions
diff --git a/users/kassouni/palette/default.nix b/users/kassouni/palette/default.nix index 08c68b1..235f774 100644 --- a/users/kassouni/palette/default.nix +++ b/users/kassouni/palette/default.nix @@ -5,17 +5,16 @@ let (builtins.readDir ./.) ); commands = map (file: pkgs.callPackage (./. + "/${file}") { }) commandFiles; - palette = pkgs.symlinkJoin { - name = "palette"; - paths = commands; - }; in { home.packages = [ (pkgs.writers.writeBashBin "open-palette" '' set -eu - choice=$(${pkgs.coreutils}/bin/ls ${palette}/bin | ${pkgs.rofi}/bin/rofi -dmenu -i -p palette) - exec "${palette}/bin/$choice" + exes=(${lib.concatMapStringsSep " " (c: c.exe) commands}) + idx=$(${pkgs.rofi}/bin/rofi -dmenu -i -format i -p palette <<EOF +${lib.concatMapStrings (c: "${c.icon} ${c.name}\n") commands}EOF + ) + exec "''${exes[$idx]}" '') ]; } diff --git a/users/kassouni/palette/reboot.nix b/users/kassouni/palette/reboot.nix index 0b5d51f..bc25ef4 100644 --- a/users/kassouni/palette/reboot.nix +++ b/users/kassouni/palette/reboot.nix @@ -1,5 +1,9 @@ { writers, systemd }: -writers.writeBashBin "reboot" '' - set -eu - ${systemd}/bin/systemctl reboot -'' +{ + name = "reboot"; + icon = ""; + exe = writers.writeBash "reboot" '' + set -eu + exec ${systemd}/bin/systemctl reboot + ''; +} diff --git a/users/kassouni/palette/rebuild.nix b/users/kassouni/palette/rebuild.nix new file mode 100644 index 0000000..e42a7c5 --- /dev/null +++ b/users/kassouni/palette/rebuild.nix @@ -0,0 +1,20 @@ +{ writers, ghostty }: +{ + name = "rebuild"; + icon = ""; + # Rebuilds need a terminal: sudo prompts for a password and nixos-rebuild + # streams a lot of output. Spawn ghostty with a login shell so it inherits + # the system sudo (setuid) and the user's nix from PATH. Mirrors `make rebuild`. + exe = writers.writeBash "rebuild" '' + set -eu + exec ${ghostty}/bin/ghostty -e bash -lc ' + set -eu + cd /home/kassouni/Developer/nixos-config + nix flake update xmonad-config + sudo nixos-rebuild switch --flake . + echo + echo "Rebuild finished. Press enter to close." + read -r _ + ' + ''; +} diff --git a/users/kassouni/palette/screenshot.nix b/users/kassouni/palette/screenshot.nix index 2190024..6f2beea 100644 --- a/users/kassouni/palette/screenshot.nix +++ b/users/kassouni/palette/screenshot.nix @@ -1,5 +1,9 @@ { writers, maim, xclip }: -writers.writeBashBin "screenshot" '' - set -eu - ${maim}/bin/maim -s | ${xclip}/bin/xclip -selection clipboard -t image/png -'' +{ + name = "screenshot"; + icon = ""; + exe = writers.writeBash "screenshot" '' + set -eu + ${maim}/bin/maim -s | ${xclip}/bin/xclip -selection clipboard -t image/png + ''; +} diff --git a/users/kassouni/palette/shutdown.nix b/users/kassouni/palette/shutdown.nix index 919cf0a..2db9425 100644 --- a/users/kassouni/palette/shutdown.nix +++ b/users/kassouni/palette/shutdown.nix @@ -1,5 +1,9 @@ { writers, systemd }: -writers.writeBashBin "shutdown" '' - set -eu - ${systemd}/bin/systemctl poweroff -'' +{ + name = "shutdown"; + icon = ""; + exe = writers.writeBash "shutdown" '' + set -eu + exec ${systemd}/bin/systemctl poweroff + ''; +} |
