mirror of
https://github.com/kmein/niveum
synced 2026-03-16 10:11:08 +01:00
22 lines
453 B
Nix
22 lines
453 B
Nix
|
|
{
|
||
|
|
writers,
|
||
|
|
gnused,
|
||
|
|
pari,
|
||
|
|
dmenu,
|
||
|
|
xclip,
|
||
|
|
}:
|
||
|
|
writers.writeDashBin "=" ''
|
||
|
|
# https://github.com/onespaceman/menu-calc
|
||
|
|
|
||
|
|
answer=$(echo "$@" | ${pari}/bin/gp -q | ${gnused}/bin/sed '/\./ s/\.\{0,1\}0\{1,\}$//')
|
||
|
|
|
||
|
|
action=$(printf "copy\nclear" | ${dmenu}/bin/dmenu -p "= $answer")
|
||
|
|
|
||
|
|
case $action in
|
||
|
|
"clear") $0 ;;
|
||
|
|
"copy") printf %s "$answer" | ${xclip}/bin/xclip -selection clipboard;;
|
||
|
|
"") ;;
|
||
|
|
*) $0 "$answer $action" ;;
|
||
|
|
esac
|
||
|
|
''
|