1
1
Fork 0

Compare commits

...

2 commits

Author SHA1 Message Date
b218264db7
programs: add qalculate
Signed-off-by: Myned <dev@bjork.tech>
2025-02-12 17:10:53 -06:00
2f90414bff
rofi: copy calc result to clipboard
Signed-off-by: Myned <dev@bjork.tech>
2025-02-12 17:10:36 -06:00
4 changed files with 41 additions and 2 deletions

View file

@ -9,12 +9,14 @@ with lib; let
hm = config.home-manager.users.${config.custom.username};
cliphist = getExe hm.services.cliphist.package;
echo = getExe' pkgs.coreutils "echo";
networkmanager_dmenu = getExe pkgs.networkmanager_dmenu;
notify-send = getExe pkgs.libnotify;
pkill = getExe' pkgs.procps "pkill";
rofi = getExe hm.programs.rofi.finalPackage;
rofi-rbw = getExe pkgs.rofi-rbw;
rofimoji = getExe pkgs.rofimoji;
wl-copy = getExe' pkgs.wl-clipboard "wl-copy";
in {
options.custom.menus.rofi = {
enable = mkOption {default = false;};
@ -26,7 +28,14 @@ in {
quit = "${pkill} --exact rofi";
in {
show = "${quit} || ${rofi} -show drun -show-icons";
calculator.show = "${quit} || ${rofi} -show calc";
calculator.show = concatStringsSep " " [
"${quit} || ${rofi}"
"-show calc"
"-no-history"
"-calc-error-color '#dc322f'"
''-calc-command "${echo} -n '{result}' | ${wl-copy}"''
];
clipboard = {
show = "${quit} || ${rofi} -show clipboard -show-icons";

View file

@ -21,6 +21,7 @@ with lib; {
nixgl.enable = true;
nushell.enable = true;
polkit.enable = true;
qalculate.enable = true;
ssh.enable = true;
starship.enable = true;
sudo.enable = true;

View file

@ -0,0 +1,30 @@
{
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.custom.programs.qalculate;
in {
options.custom.programs.qalculate = {
enable = mkOption {default = false;};
};
config = mkIf cfg.enable {
# https://github.com/Qalculate/libqalculate
# https://qalculate.github.io/manual/qalc.html
environment.systemPackages = [pkgs.libqalculate];
home-manager.sharedModules = [
{
xdg.configFile = {
# https://github.com/svenstaro/rofi-calc?tab=readme-ov-file#advanced-usage
"qalculate/qalc.cfg".text = ''
digit_grouping=2
'';
};
}
];
};
}

View file

@ -28,7 +28,6 @@ in {
fzf # Fuzzy search
jq # JSON parser
killport # Kill processes on port
libqalculate # Calculator
lf # Terminal file manager
lm_sensors # System sensors
nix-output-monitor # Nix build parser