summaryrefslogtreecommitdiff
path: root/accounts/gkleen@sif/niri/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'accounts/gkleen@sif/niri/default.nix')
-rw-r--r--accounts/gkleen@sif/niri/default.nix271
1 files changed, 155 insertions, 116 deletions
diff --git a/accounts/gkleen@sif/niri/default.nix b/accounts/gkleen@sif/niri/default.nix
index fde08ae9..35a3d799 100644
--- a/accounts/gkleen@sif/niri/default.nix
+++ b/accounts/gkleen@sif/niri/default.nix
@@ -3,6 +3,7 @@ let
3 cfg = config.programs.niri; 3 cfg = config.programs.niri;
4 4
5 kdl = flakeInputs.niri-flake.lib.kdl; 5 kdl = flakeInputs.niri-flake.lib.kdl;
6 sleaf = name: arg: kdl.node name [arg] [];
6 7
7 niri = cfg.package; 8 niri = cfg.package;
8 terminal = lib.getExe config.programs.kitty.package; 9 terminal = lib.getExe config.programs.kitty.package;
@@ -35,7 +36,11 @@ let
35 if jq -e '.is_focused' <<<"$window_json" >/dev/null; then 36 if jq -e '.is_focused' <<<"$window_json" >/dev/null; then
36 niri msg action focus-workspace-previous 37 niri msg action focus-workspace-previous
37 else 38 else
38 niri msg action focus-window --id "$(jq -r '.id' <<<"$window_json")" 39 if [[ $(jq -r --arg workspace_name "$workspace_name" 'map(select(.name == $workspace_name)) | .[0].is_focused' <<<"$workspaces_json") != "true" ]] && [[ $(jq -r --arg workspace_name "$workspace_name" 'map(select(.name == $workspace_name)) | .[0].id' <<<"$workspaces_json") = $(jq -r '.workspace_id' <<<"$window_json") ]]; then
40 niri msg action focus-workspace "$workspace_name"
41 else
42 niri msg action focus-window --id "$(jq -r '.id' <<<"$window_json")"
43 fi
39 fi 44 fi
40 exit 0 45 exit 0
41 fi 46 fi
@@ -130,7 +135,7 @@ let
130 135
131 windows_json="$(niri msg -j windows)" 136 windows_json="$(niri msg -j windows)"
132 active_workspace="$(jq -r '.[] | select(.is_focused) | .workspace_id' <<<"$windows_json")" 137 active_workspace="$(jq -r '.[] | select(.is_focused) | .workspace_id' <<<"$windows_json")"
133 window_ix="$(gojq -r --arg active_workspace "$active_workspace" '.[] | select('"$window_select"') | "\(.title)\u0000icon\u001f\(.app_id)"' <<<"$windows_json" | fuzzel --log-level=warning --dmenu --index)" 138 window_ix="$(gojq -r --arg active_workspace "$active_workspace" '.[] | select('"$window_select"') | "\(.title)\u0000icon\u001f\(.app_id)"' <<<"$windows_json" | fuzzel --width=60 --log-level=warning --dmenu --index)"
134 # shellcheck disable=SC2016 139 # shellcheck disable=SC2016
135 window_json="$(gojq -rc --arg active_workspace "$active_workspace" --arg window_ix "$window_ix" 'map(select('"$window_select"')) | .[($window_ix | tonumber)]' <<<"$windows_json")" 140 window_json="$(gojq -rc --arg active_workspace "$active_workspace" --arg window_ix "$window_ix" 'map(select('"$window_select"')) | .[($window_ix | tonumber)]' <<<"$windows_json")"
136 141
@@ -143,7 +148,7 @@ let
143 148
144 with_predicate_window = pred: pkgs.writeShellApplication { 149 with_predicate_window = pred: pkgs.writeShellApplication {
145 name = "with-predicate-window"; 150 name = "with-predicate-window";
146 runtimeInputs = [ niri pkgs.gojq pkgs.socat config.programs.fuzzel.package pkgs.gawk ]; 151 runtimeInputs = [ niri pkgs.gojq pkgs.socat ];
147 text = '' 152 text = ''
148 action="$1" 153 action="$1"
149 shift 154 shift
@@ -445,8 +450,8 @@ in {
445 { title = "^Access Request.*"; } 450 { title = "^Access Request.*"; }
446 { title = ".*Passkey credentials$"; } 451 { title = ".*Passkey credentials$"; }
447 ]; 452 ];
448 windowRuleExtra = [ 453 windowRuleExtra = with kdl; [
449 (kdl.leaf "open-focused" false) 454 (sleaf "open-focused" false)
450 ]; 455 ];
451 key = "Mod+Control+P"; 456 key = "Mod+Control+P";
452 app-id = "org.keepassxc.KeePassXC"; 457 app-id = "org.keepassxc.KeePassXC";
@@ -473,6 +478,20 @@ in {
473 app-id = "com.github.wwmm.easyeffects"; 478 app-id = "com.github.wwmm.easyeffects";
474 spawn = [ "easyeffects" ]; 479 spawn = [ "easyeffects" ];
475 } 480 }
481 { name = "time";
482 key = "Mod+Control+K";
483 app-id = "chrome-kimai.yggdrasil.li__-Default";
484 spawn = [ (toString (pkgs.resholve.writeScript "kimai" {
485 interpreter = pkgs.runtimeShell;
486 inputs = [ pkgs.dex ];
487 execer = [ "cannot:${lib.getExe pkgs.dex}" ];
488 } ''
489 exec dex $HOME/.local/state/nix/profile/share/applications/kimai.desktop
490 '')) ];
491 windowRuleExtra = with kdl; [
492 (sleaf "block-out-from" "screencast")
493 ];
494 }
476 ]; 495 ];
477 programs.niri.config = 496 programs.niri.config =
478 let 497 let
@@ -482,10 +501,12 @@ in {
482 then v 501 then v
483 else null; 502 else null;
484 opt-props = lib.filterAttrs (lib.const (value: value != null)); 503 opt-props = lib.filterAttrs (lib.const (value: value != null));
504 normalize-nodes = nodes: lib.remove null (lib.flatten nodes);
485 in 505 in
486 [ (flag "prefer-no-csd") 506 normalize-nodes [
507 (flag "prefer-no-csd")
487 508
488 (leaf "screenshot-path" "~/screenshots/%Y-%m-%dT%H:%M:%S.png") 509 (sleaf "screenshot-path" "~/screenshots/%Y-%m-%dT%H:%M:%S.png")
489 510
490 (plain "hotkey-overlay" [ 511 (plain "hotkey-overlay" [
491 (flag "skip-at-startup") 512 (flag "skip-at-startup")
@@ -493,27 +514,27 @@ in {
493 514
494 (plain "input" [ 515 (plain "input" [
495 (plain "keyboard" [ 516 (plain "keyboard" [
496 (leaf "repeat-delay" 300) 517 (sleaf "repeat-delay" 300)
497 (leaf "repeat-rate" 50) 518 (sleaf "repeat-rate" 50)
498 519
499 (plain "xkb" [ 520 (plain "xkb" [
500 (leaf "layout" "us,us") 521 (sleaf "layout" "us,us")
501 (leaf "variant" "dvp,") 522 (sleaf "variant" "dvp,")
502 (leaf "options" "compose:caps,grp:win_space_toggle") 523 (sleaf "options" "compose:caps,grp:win_space_toggle")
503 ]) 524 ])
504 ]) 525 ])
505 526
506 (flag "workspace-auto-back-and-forth") 527 (flag "workspace-auto-back-and-forth")
507 # (leaf "focus-follows-mouse" {}) 528 # (sleaf "focus-follows-mouse" {})
508 # (flag "warp-mouse-to-focus") 529 # (flag "warp-mouse-to-focus")
509 530
510 # (plain "touchpad" [ (flag "off") ]) 531 # (plain "touchpad" [ (flag "off") ])
511 (plain "trackball" [ 532 (plain "trackball" [
512 (leaf "scroll-method" "on-button-down") 533 (sleaf "scroll-method" "on-button-down")
513 (leaf "scroll-button" 278) 534 (sleaf "scroll-button" 278)
514 ]) 535 ])
515 (plain "touch" [ 536 (plain "touch" [
516 (leaf "map-to-output" "eDP-1") 537 (sleaf "map-to-output" "eDP-1")
517 ]) 538 ])
518 ]) 539 ])
519 540
@@ -521,7 +542,7 @@ in {
521 (plain "hot-corners" [(flag "off")]) 542 (plain "hot-corners" [(flag "off")])
522 ]) 543 ])
523 544
524 (plain "environment" (lib.mapAttrsToList leaf { 545 (plain "environment" (lib.mapAttrsToList sleaf {
525 NIXOS_OZONE_WL = "1"; 546 NIXOS_OZONE_WL = "1";
526 QT_QPA_PLATFORM = "wayland"; 547 QT_QPA_PLATFORM = "wayland";
527 QT_WAYLAND_DISABLE_WINDOWDECORATION = "1"; 548 QT_WAYLAND_DISABLE_WINDOWDECORATION = "1";
@@ -529,49 +550,52 @@ in {
529 SDL_VIDEODRIVER = "wayland"; 550 SDL_VIDEODRIVER = "wayland";
530 DISPLAY = ":0"; 551 DISPLAY = ":0";
531 ELECTRON_OZONE_PLATFORM_HINT = "auto"; 552 ELECTRON_OZONE_PLATFORM_HINT = "auto";
553 SSH_ASKPASS_REQUIRE = "prefer";
554 SSH_ASKPASS = lib.getExe pkgs.kdePackages.ksshaskpass;
555 SUDO_ASKPASS = lib.getExe pkgs.kdePackages.ksshaskpass;
532 })) 556 }))
533 557
534 (node "output" "eDP-1" [ 558 (node "output" ["eDP-1"] [
535 (leaf "scale" 1.5) 559 (sleaf "scale" 1.5)
536 (leaf "position" { x = 0; y = 0; }) 560 (sleaf "position" { x = 0; y = 0; })
537 ]) 561 ])
538 (node "output" "Ancor Communications Inc ASUS PB287Q 0x0000DD9B" [ 562 (node "output" ["Ancor Communications Inc ASUS PB287Q 0x0000DD9B"] [
539 (leaf "scale" 1.5) 563 (sleaf "scale" 1.5)
540 (leaf "position" { x = 2560; y = 0; }) 564 (sleaf "position" { x = 2560; y = 0; })
541 ]) 565 ])
542 (node "output" "HP Inc. HP 727pu CN4417143K" [ 566 (node "output" ["HP Inc. HP 727pu CN4417143K"] [
543 (leaf "mode" "2560x1440@119.998") 567 (sleaf "mode" "2560x1440@119.998")
544 (leaf "scale" 1) 568 (sleaf "scale" 1)
545 (leaf "position" { x = 2560; y = 0; }) 569 (sleaf "position" { x = 2560; y = 0; })
546 (flag "variable-refresh-rate") 570 (flag "variable-refresh-rate")
547 ]) 571 ])
548 572
549 (plain "debug" [ 573 (plain "debug" [
550 (leaf "render-drm-device" "/dev/dri/by-path/pci-0000:00:02.0-render") 574 (sleaf "render-drm-device" "/dev/dri/by-path/pci-0000:00:02.0-render")
551 ]) 575 ])
552 576
553 (plain "animations" [ 577 (plain "animations" [
554 (leaf "slowdown" 0.5) 578 (sleaf "slowdown" 0.5)
555 (plain "workspace-switch" [(flag "off")]) 579 (plain "workspace-switch" [(flag "off")])
556 ]) 580 ])
557 581
558 (plain "layout" [ 582 (plain "layout" [
559 (leaf "gaps" 8) 583 (sleaf "gaps" 8)
560 (plain "struts" [ 584 (plain "struts" [
561 (leaf "left" 26) 585 (sleaf "left" 26)
562 (leaf "right" 26) 586 (sleaf "right" 26)
563 (leaf "top" 0) 587 (sleaf "top" 0)
564 (leaf "bottom" 0) 588 (sleaf "bottom" 0)
565 ]) 589 ])
566 (plain "border" [ 590 (plain "border" [
567 (leaf "width" 2) 591 (sleaf "width" 2)
568 (leaf "active-gradient" { 592 (sleaf "active-gradient" {
569 from = "hsla(195 100% 45% 1)"; 593 from = "hsla(195 100% 45% 1)";
570 to = "hsla(155 100% 37.5% 1)"; 594 to = "hsla(155 100% 37.5% 1)";
571 angle = 29; 595 angle = 29;
572 relative-to = "workspace-view"; 596 relative-to = "workspace-view";
573 }) 597 })
574 (leaf "inactive-gradient" { 598 (sleaf "inactive-gradient" {
575 from = "hsla(0 0% 27.7% 1)"; 599 from = "hsla(0 0% 27.7% 1)";
576 to = "hsla(0 0% 23% 1)"; 600 to = "hsla(0 0% 23% 1)";
577 angle = 29; 601 angle = 29;
@@ -582,29 +606,29 @@ in {
582 (flag "off") 606 (flag "off")
583 ]) 607 ])
584 608
585 (plain "preset-column-widths" (map (prop: leaf "proportion" prop) [ 609 (plain "preset-column-widths" (map (prop: sleaf "proportion" prop) [
586 (1. / 4.) (1. / 3.) (1. / 2.) (2. / 3.) (3. / 4.) (1.) 610 (1. / 4.) (1. / 3.) (1. / 2.) (2. / 3.) (3. / 4.) (1.)
587 ])) 611 ]))
588 (plain "default-column-width" [ (leaf "proportion" (1. / 2.)) ]) 612 (plain "default-column-width" [ (sleaf "proportion" (1. / 2.)) ])
589 (plain "preset-window-heights" (map (prop: leaf "proportion" prop) [ 613 (plain "preset-window-heights" (map (prop: sleaf "proportion" prop) [
590 (1. / 3.) (1. / 2.) (2. / 3.) (1.) 614 (1. / 3.) (1. / 2.) (2. / 3.) (1.)
591 ])) 615 ]))
592 616
593 (flag "always-center-single-column") 617 (flag "always-center-single-column")
594 618
595 (plain "tab-indicator" [ 619 (plain "tab-indicator" [
596 (leaf "gap" 4) 620 (sleaf "gap" 4)
597 (leaf "width" 8) 621 (sleaf "width" 8)
598 (leaf "gaps-between-tabs" 4) 622 (sleaf "gaps-between-tabs" 4)
599 (flag "place-within-column") 623 (flag "place-within-column")
600 (leaf "length" { total-proportion = 1.; }) 624 (sleaf "length" { total-proportion = 1.; })
601 (leaf "active-gradient" { 625 (sleaf "active-gradient" {
602 from = "hsla(195 100% 60% 0.75)"; 626 from = "hsla(195 100% 60% 0.75)";
603 to = "hsla(155 100% 50% 0.75)"; 627 to = "hsla(155 100% 50% 0.75)";
604 angle = 29; 628 angle = 29;
605 relative-to = "workspace-view"; 629 relative-to = "workspace-view";
606 }) 630 })
607 (leaf "inactive-gradient" { 631 (sleaf "inactive-gradient" {
608 from = "hsla(0 0% 42% 0.66)"; 632 from = "hsla(0 0% 42% 0.66)";
609 to = "hsla(0 0% 35% 0.66)"; 633 to = "hsla(0 0% 35% 0.66)";
610 angle = 29; 634 angle = 29;
@@ -618,124 +642,121 @@ in {
618 ]) 642 ])
619 643
620 (map (name: 644 (map (name:
621 (node "workspace" name [ 645 (node "workspace" [name] [
622 (leaf "open-on-output" "eDP-1") 646 (sleaf "open-on-output" "eDP-1")
623 ]) 647 ])
624 ) (map ({name, ...}: name) cfg.scratchspaces)) 648 ) (map ({name, ...}: name) cfg.scratchspaces))
625 (map (name: 649 (map (name:
626 (leaf "workspace" name) 650 (sleaf "workspace" name)
627 ) ["comm" "web" "vid" "bmr"]) 651 ) ["comm" "web" "vid" "bmr"])
628 652
629 (plain "window-rule" [ 653 (plain "window-rule" [
630 (leaf "clip-to-geometry" true) 654 (sleaf "clip-to-geometry" true)
631 ]) 655 ])
632 656
633 (plain "window-rule" [ 657 (plain "window-rule" [
634 (leaf "match" { is-floating = true; }) 658 (sleaf "match" { is-floating = true; })
635 (leaf "geometry-corner-radius" 8) 659 (sleaf "geometry-corner-radius" 8)
636 (plain "shadow" [ (flag "on") ]) 660 (plain "shadow" [ (flag "on") ])
637 ]) 661 ])
638 662
639 (plain "window-rule" [ 663 (plain "window-rule" [
640 (leaf "match" { app-id = "^org\\.keepassxc\\.KeePassXC$"; }) 664 (sleaf "match" { app-id = "^org\\.keepassxc\\.KeePassXC$"; })
641 (leaf "block-out-from" "screencast") 665 (sleaf "block-out-from" "screencast")
642 ]) 666 ])
643 (plain "window-rule" [ 667 (plain "window-rule" (normalize-nodes [
644 (map (title: 668 (map (title:
645 (leaf "match" { app-id = "^org\\.keepassxc\\.KeePassXC$"; inherit title; }) 669 (sleaf "match" { app-id = "^org\\.keepassxc\\.KeePassXC$"; inherit title; })
646 ) ["^Unlock Database.*" "^Access Request.*" ".*Passkey credentials$"]) 670 ) ["^Unlock Database.*" "^Access Request.*" ".*Passkey credentials$" "Browser Access Request$"])
647 (leaf "open-focused" true) 671 (sleaf "open-focused" true)
648 (leaf "open-floating" true) 672 (sleaf "open-floating" true)
649 ]) 673 ]))
650 674
651 (map ({ name, match, exclude, windowRuleExtra, ... }: 675 (map ({ name, match, exclude, windowRuleExtra, ... }:
652 (optional-node (match != []) (plain "window-rule" [ 676 (optional-node (match != []) (plain "window-rule" (normalize-nodes [
653 (map (leaf "match") match) 677 (map (sleaf "match") match)
654 (map (leaf "exclude") exclude) 678 (map (sleaf "exclude") exclude)
655 (leaf "open-on-workspace" name) 679 (sleaf "open-on-workspace" name)
656 (leaf "open-maximized" true) 680 (sleaf "open-maximized" true)
657 windowRuleExtra 681 windowRuleExtra
658 ])) 682 ])))
659 ) cfg.scratchspaces) 683 ) cfg.scratchspaces)
660 684
661 (plain "window-rule" [ 685 (plain "window-rule" [
662 (leaf "match" { app-id = "^emacs$"; }) 686 (sleaf "match" { app-id = "^emacs$"; })
663 (leaf "match" { app-id = "^firefox$"; }) 687 (sleaf "match" { app-id = "^firefox$"; })
664 (plain "default-column-width" [(leaf "proportion" (2. / 3.))]) 688 (plain "default-column-width" [(sleaf "proportion" (2. / 3.))])
665 ]) 689 ])
666 (plain "window-rule" [ 690 (plain "window-rule" [
667 (leaf "match" { app-id = "^kitty$"; }) 691 (sleaf "match" { app-id = "^kitty$"; })
668 (leaf "match" { app-id = "^kitty-play$"; }) 692 (sleaf "match" { app-id = "^kitty-play$"; })
669 (plain "default-column-width" [(leaf "proportion" (1. / 3.))]) 693 (plain "default-column-width" [(sleaf "proportion" (1. / 3.))])
670 ]) 694 ])
671 695
672 (plain "window-rule" [ 696 (plain "window-rule" [
673 (leaf "match" { app-id = "^thunderbird$"; }) 697 (sleaf "match" { app-id = "^thunderbird$"; })
674 (leaf "match" { app-id = "^Element$"; }) 698 (sleaf "match" { app-id = "^Element$"; })
675 (leaf "match" { app-id = "^Rainbow$"; }) 699 (sleaf "match" { app-id = "^chrome-web\.openrainbow\.com__-Default$"; })
676 (leaf "open-on-workspace" "comm") 700 (sleaf "open-on-workspace" "comm")
677 ]) 701 ])
678 (plain "window-rule" [ 702 (plain "window-rule" [
679 (leaf "match" { app-id = "^firefox$"; }) 703 (sleaf "match" { app-id = "^firefox$"; })
680 (leaf "open-on-workspace" "web") 704 (sleaf "open-on-workspace" "web")
681 (leaf "open-maximized" true) 705 (sleaf "open-maximized" true)
682 ]) 706 ])
683 (plain "window-rule" [ 707 (plain "window-rule" [
684 (leaf "match" { app-id = "^mpv$"; }) 708 (sleaf "match" { app-id = "^mpv$"; })
685 (leaf "open-on-workspace" "vid") 709 (sleaf "open-on-workspace" "vid")
686 (plain "default-column-width" [(leaf "proportion" 1.)]) 710 (plain "default-column-width" [(sleaf "proportion" 1.)])
687 ]) 711 ])
688 (plain "window-rule" [ 712 (plain "window-rule" [
689 (leaf "match" { app-id = "^kitty-play$"; }) 713 (sleaf "match" { app-id = "^kitty-play$"; })
690 (leaf "open-on-workspace" "vid") 714 (sleaf "open-on-workspace" "vid")
691 (leaf "open-focused" false) 715 (sleaf "open-focused" false)
692 ]) 716 ])
693 (plain "window-rule" [ 717 (plain "window-rule" [
694 (leaf "match" { app-id = "^pdfpc$"; }) 718 (sleaf "match" { app-id = "^chrome-audiobookshelf\.yggdrasil\.li__-Default$"; })
695 (plain "default-column-width" [(leaf "proportion" 1.)]) 719 (sleaf "match" { app-id = "^YouTube Music Desktop App$"; })
720 (sleaf "open-on-workspace" "vid")
696 ]) 721 ])
697 (plain "window-rule" [ 722 (plain "window-rule" [
698 (leaf "match" { app-id = "^pdfpc$"; title = "^.*presentation.*$"; }) 723 (sleaf "match" { app-id = "^pdfpc$"; })
699 (plain "default-column-width" [(leaf "proportion" 1.)]) 724 (plain "default-column-width" [(sleaf "proportion" 1.)])
700 (leaf "open-fullscreen" true)
701 (leaf "open-on-workspace" "bmr")
702 (leaf "open-focused" false)
703 ]) 725 ])
704 (plain "window-rule" [ 726 (plain "window-rule" [
705 (map (leaf "match") [ 727 (sleaf "match" { app-id = "^pdfpc$"; title = "^.*presentation.*$"; })
728 (plain "default-column-width" [(sleaf "proportion" 1.)])
729 (sleaf "open-fullscreen" true)
730 (sleaf "open-on-workspace" "bmr")
731 (sleaf "open-focused" false)
732 ])
733 (plain "window-rule" (normalize-nodes [
734 (map (sleaf "match") [
706 { app-id = "^Gimp-"; title = "^Quit GIMP$"; } 735 { app-id = "^Gimp-"; title = "^Quit GIMP$"; }
707 { app-id = "^org\\.kde\\.polkit-kde-authentication-agent-1$"; } 736 { app-id = "^org\\.kde\\.polkit-kde-authentication-agent-1$"; }
708 { app-id = "^xdg-desktop-portal-gtk$"; } 737 { app-id = "^xdg-desktop-portal-gtk$"; }
709 ]) 738 ])
710 (leaf "open-floating" true) 739 (sleaf "open-floating" true)
711 ]) 740 ]))
712 (plain "window-rule" [ 741 (plain "window-rule" [
713 (leaf "match" { app-id = "^org\\.pwmt\\.zathura$"; }) 742 (sleaf "match" { app-id = "^org\\.pwmt\\.zathura$"; })
714 (leaf "match" { app-id = "^evince$"; }) 743 (sleaf "match" { app-id = "^evince$"; })
715 (leaf "match" { app-id = "^org\\.gnome\\.Papers$"; }) 744 (sleaf "match" { app-id = "^org\\.gnome\\.Papers$"; })
716 (leaf "default-column-display" "tabbed") 745 (sleaf "default-column-display" "tabbed")
717 ]) 746 ])
718 747
719 (plain "layer-rule" [ 748 (plain "layer-rule" [
720 (leaf "match" { namespace = "^notifications$"; }) 749 (sleaf "match" { namespace = "^notifications$"; })
721 (leaf "match" { namespace = "^waybar$"; }) 750 (sleaf "match" { namespace = "^waybar$"; })
722 (leaf "match" { namespace = "^launcher$"; }) 751 (sleaf "match" { namespace = "^launcher$"; })
723 (leaf "block-out-from" "screencast") 752 (sleaf "block-out-from" "screencast")
724 ]) 753 ])
725 754
726 (plain "binds" 755 (plain "binds"
727 (let 756 (let
728 bind = name: cfg: node name (opt-props { 757 bind = name: cfg: node name [(lib.removeAttrs cfg ["action"])] (lib.mapAttrsToList leaf (lib.removeAttrs cfg.action ["__functor"]));
729 cooldown-ms = cfg.cooldown-ms or null;
730 }
731 // (lib.optionalAttrs (!(cfg.repeat or true)) {
732 repeat = false;
733 })
734 // (lib.optionalAttrs (cfg.allow-when-locked or false) {
735 allow-when-locked = true;
736 })) (lib.mapAttrsToList leaf (lib.removeAttrs cfg.action ["__functor"]));
737 in 758 in
738 [ 759 normalize-nodes [
739 (lib.mapAttrsToList bind (with config.lib.niri.actions; { 760 (lib.mapAttrsToList bind (with config.lib.niri.actions; {
740 "Mod+Slash".action = show-hotkey-overlay; 761 "Mod+Slash".action = show-hotkey-overlay;
741 762
@@ -790,12 +811,12 @@ in {
790 done < <(export LC_ALL=C.UTF-8; echo; find "$RESULTS_DIR" -type f -printf $'%T@ %p\n' | sort -n | cut -d' ' -f2- | xargs -r cat) 811 done < <(export LC_ALL=C.UTF-8; echo; find "$RESULTS_DIR" -type f -printf $'%T@ %p\n' | sort -n | cut -d' ' -f2- | xargs -r cat)
791 $FOUND || echo 812 $FOUND || echo
792 } 813 }
793 FUZZEL_RES=$(prev | fuzzel --dmenu --prompt "qalc> ") || exit $? 814 FUZZEL_RES=$(prev | fuzzel --dmenu --prompt "qalc> " --width=60) || exit $?
794 if [[ "$FUZZEL_RES" =~ .*\ =\ .* ]]; then 815 if [[ "$FUZZEL_RES" =~ .*\ =\ .* ]]; then
795 QALC_RES="$FUZZEL_RES" 816 QALC_RES="$FUZZEL_RES"
796 QALC_RET=0 817 QALC_RET=0
797 else 818 else
798 QALC_RES=$(qalc "$FUZZEL_RES" 2>&1) 819 QALC_RES=$(qalc -set "autocalc off" "$FUZZEL_RES" 2>&1)
799 QALC_RET=$? 820 QALC_RET=$?
800 fi 821 fi
801 [[ -n "$QALC_RES" ]] || exit 1 822 [[ -n "$QALC_RES" ]] || exit 1
@@ -815,11 +836,26 @@ in {
815 notify-send "$QALC_RES" 836 notify-send "$QALC_RES"
816 ''; 837 '';
817 })); 838 }));
839 "Mod+Shift+U".action =
840 let
841 qalcKitty = pkgs.symlinkJoin {
842 name = "qalc-kitty";
843 paths = [ config.programs.kitty.package ];
844 buildInputs = [ pkgs.makeWrapper ];
845 postBuild = ''
846 wrapProgram $out/bin/kitty \
847 --add-flags "--config ${pkgs.writeText "kitty.conf" ''
848 include $HOME/${config.xdg.configFile."kitty/kitty.conf".target}
849 shell ${lib.getExe pkgs.libqalculate}
850 ''}"
851 '';
852 };
853 in spawn (lib.getExe' qalcKitty "kitty");
818 "Mod+E".action = spawn (lib.getExe (pkgs.writeShellApplication { 854 "Mod+E".action = spawn (lib.getExe (pkgs.writeShellApplication {
819 name = "emoji-fuzzel"; 855 name = "emoji-fuzzel";
820 runtimeInputs = with pkgs; [ config.programs.fuzzel.package wtype wl-clipboard-rs ]; 856 runtimeInputs = with pkgs; [ config.programs.fuzzel.package wtype wl-clipboard-rs ];
821 text = '' 857 text = ''
822 FUZZEL_RES=$(fuzzel --dmenu --prompt "emoji> " <"$HOME"/.local/share/emoji-data/list.txt) || exit $? 858 FUZZEL_RES=$(fuzzel --dmenu --prompt "emoji> " --cache "$HOME"/.cache/fuzzel-emoji --width=60 <"$HOME"/.local/share/emoji-data/list.txt) || exit $?
823 [[ -n "$FUZZEL_RES" ]] || exit 1 859 [[ -n "$FUZZEL_RES" ]] || exit 1
824 wl-copy "$(cut -d ':' -f 1 <<<"$FUZZEL_RES" | tr -d '\n')" && wtype -k XF86Paste 860 wl-copy "$(cut -d ':' -f 1 <<<"$FUZZEL_RES" | tr -d '\n')" && wtype -k XF86Paste
825 ''; 861 '';
@@ -960,6 +996,9 @@ in {
960 996
961 "Mod+D".action = with-urgent-window-action "{\"Action\":{\"FocusWindow\":{\"id\": .id}}}"; 997 "Mod+D".action = with-urgent-window-action "{\"Action\":{\"FocusWindow\":{\"id\": .id}}}";
962 "Mod+Shift+D".action = with-focused-window-action "{\"Action\":{\"UnsetUrgent\":{\"id\": .id}}}"; 998 "Mod+Shift+D".action = with-focused-window-action "{\"Action\":{\"UnsetUrgent\":{\"id\": .id}}}";
999
1000 "Mod+K".action = spawn (lib.getExe' pkgs.worktime "worktime-ui");
1001 "Mod+Shift+K".action = spawn (lib.getExe' pkgs.worktime "worktime-stop");
963 })) 1002 }))
964 (map ({ name, selector, spawn, key, ...}: if key != null && selector != null && spawn != null then bind key { action = focus-or-spawn-action selector name spawn; } else null) cfg.scratchspaces) 1003 (map ({ name, selector, spawn, key, ...}: if key != null && selector != null && spawn != null then bind key { action = focus-or-spawn-action selector name spawn; } else null) cfg.scratchspaces)
965 (map ({ name, moveKey, ...}: if moveKey != null then bind moveKey { action = kdl.magic-leaf "move-column-to-workspace" name; } else null) cfg.scratchspaces) 1004 (map ({ name, moveKey, ...}: if moveKey != null then bind moveKey { action = kdl.magic-leaf "move-column-to-workspace" name; } else null) cfg.scratchspaces)