mirror of
https://github.com/kmein/niveum
synced 2026-03-16 10:11:08 +01:00
feat: menu-calc (also for i3), nix-index
This commit is contained in:
@@ -193,6 +193,7 @@ in {
|
||||
"${modifier}+Return" = "exec ${(defaultApplications pkgs).terminal}";
|
||||
"${modifier}+t" = "exec ${(defaultApplications pkgs).fileManager}";
|
||||
"${modifier}+y" = "exec ${(defaultApplications pkgs).browser}";
|
||||
"${modifier}+0" = "exec ${pkgs.scripts.menu-calc}/bin/=";
|
||||
|
||||
"${modifier}+Shift+w" = "exec ${pkgs.scripts.k-lock}/bin/k-lock";
|
||||
"${modifier}+a" =
|
||||
|
||||
@@ -111,6 +111,7 @@ in {
|
||||
hc # print files as qr codes
|
||||
youtubeDL
|
||||
bc # calculator
|
||||
pari # gp -- better calculator
|
||||
scripts.infschmv
|
||||
scripts.default-gateway
|
||||
scripts.showkeys-toggle
|
||||
@@ -149,6 +150,8 @@ in {
|
||||
# kmein.slide
|
||||
scripts.tolino-screensaver
|
||||
scripts.rfc
|
||||
scripts.tag
|
||||
scripts.menu-calc
|
||||
nix-prefetch-git
|
||||
scripts.nix-git
|
||||
nixfmt
|
||||
@@ -165,6 +168,9 @@ in {
|
||||
spotify
|
||||
spotify-tui
|
||||
playerctl
|
||||
|
||||
nix-index
|
||||
scripts.nix-index-update
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
@@ -327,4 +327,33 @@ in rec {
|
||||
bvg = pkgs.callPackage ./bvg.nix { };
|
||||
nav = pkgs.callPackage ./nav.nix { };
|
||||
k-lock = pkgs.callPackage ./k-lock.nix { };
|
||||
|
||||
menu-calc = pkgs.writers.writeDashBin "=" ''
|
||||
# https://github.com/onespaceman/menu-calc
|
||||
|
||||
answer=$(echo "$@" | ${pkgs.pari}/bin/gp -q | ${pkgs.gnused}/bin/sed '/\./ s/\.\{0,1\}0\{1,\}$//')
|
||||
|
||||
action=$(printf "copy\nclear" | ${pkgs.dmenu}/bin/dmenu -p "= $answer")
|
||||
|
||||
case $action in
|
||||
"clear") $0 ;;
|
||||
"copy") printf %s "$answer" | ${pkgs.xclip}/bin/xclip -selection clipboard;;
|
||||
"") ;;
|
||||
*) $0 "$answer $action" ;;
|
||||
esac
|
||||
'';
|
||||
|
||||
nix-index-update = pkgs.writers.writeDashBin "nix-index-update" ''
|
||||
mkdir -p $HOME/.cache/nix-index
|
||||
tag=$(git -c 'versionsort.suffix=-' \
|
||||
ls-remote \
|
||||
--exit-code \
|
||||
--refs \
|
||||
--tags \
|
||||
--sort='v:refname' \
|
||||
https://github.com/Mic92/nix-index-database \
|
||||
| awk 'END {match($2, /([^/]+)$/, m); print m[0]}')
|
||||
curl -L "https://github.com/Mic92/nix-index-database/releases/download/$tag/files" -o $XDG_RUNTIME_DIR/files-$tag
|
||||
mv $XDG_RUNTIME_DIR/files-$tag $HOME/.cache/nix-index/files
|
||||
'';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user