diff options
Diffstat (limited to 'accounts/gkleen@sif/niri')
| -rw-r--r-- | accounts/gkleen@sif/niri/default.nix | 385 | ||||
| -rw-r--r-- | accounts/gkleen@sif/niri/mako.nix | 6 | ||||
| -rw-r--r-- | accounts/gkleen@sif/niri/swayosd.nix | 66 | ||||
| -rw-r--r-- | accounts/gkleen@sif/niri/waybar.nix | 358 |
4 files changed, 193 insertions, 622 deletions
diff --git a/accounts/gkleen@sif/niri/default.nix b/accounts/gkleen@sif/niri/default.nix index bf997b7d..5ae372c1 100644 --- a/accounts/gkleen@sif/niri/default.nix +++ b/accounts/gkleen@sif/niri/default.nix | |||
| @@ -3,13 +3,10 @@ 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; |
| 9 | makoctl = lib.getExe' config.services.mako.package "makoctl"; | ||
| 10 | loginctl = lib.getExe' hostConfig.systemd.package "loginctl"; | ||
| 11 | systemctl = lib.getExe' hostConfig.systemd.package "systemctl"; | ||
| 12 | swayosd-client = lib.getExe' config.services.swayosd.package "swayosd-client"; | ||
| 13 | 10 | ||
| 14 | focus_or_spawn = pkgs.writeShellApplication { | 11 | focus_or_spawn = pkgs.writeShellApplication { |
| 15 | name = "focus-or-spawn"; | 12 | name = "focus-or-spawn"; |
| @@ -134,7 +131,7 @@ let | |||
| 134 | 131 | ||
| 135 | windows_json="$(niri msg -j windows)" | 132 | windows_json="$(niri msg -j windows)" |
| 136 | active_workspace="$(jq -r '.[] | select(.is_focused) | .workspace_id' <<<"$windows_json")" | 133 | active_workspace="$(jq -r '.[] | select(.is_focused) | .workspace_id' <<<"$windows_json")" |
| 137 | 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)" | 134 | 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)" |
| 138 | # shellcheck disable=SC2016 | 135 | # shellcheck disable=SC2016 |
| 139 | window_json="$(gojq -rc --arg active_workspace "$active_workspace" --arg window_ix "$window_ix" 'map(select('"$window_select"')) | .[($window_ix | tonumber)]' <<<"$windows_json")" | 136 | window_json="$(gojq -rc --arg active_workspace "$active_workspace" --arg window_ix "$window_ix" 'map(select('"$window_select"')) | .[($window_ix | tonumber)]' <<<"$windows_json")" |
| 140 | 137 | ||
| @@ -164,12 +161,6 @@ let | |||
| 164 | with-urgent-window-action = config.lib.niri.actions.spawn (lib.getExe (with_predicate_window ".is_urgent")); | 161 | with-urgent-window-action = config.lib.niri.actions.spawn (lib.getExe (with_predicate_window ".is_urgent")); |
| 165 | with-focused-window-action = config.lib.niri.actions.spawn (lib.getExe (with_predicate_window ".is_focused")); | 162 | with-focused-window-action = config.lib.niri.actions.spawn (lib.getExe (with_predicate_window ".is_focused")); |
| 166 | in { | 163 | in { |
| 167 | imports = [ | ||
| 168 | ./waybar.nix | ||
| 169 | ./mako.nix | ||
| 170 | ./swayosd.nix | ||
| 171 | ]; | ||
| 172 | |||
| 173 | options = { | 164 | options = { |
| 174 | programs.niri.scratchspaces = lib.mkOption { | 165 | programs.niri.scratchspaces = lib.mkOption { |
| 175 | type = lib.types.listOf (lib.types.submodule ({ config, ... }: { | 166 | type = lib.types.listOf (lib.types.submodule ({ config, ... }: { |
| @@ -230,36 +221,7 @@ in { | |||
| 230 | }; | 221 | }; |
| 231 | 222 | ||
| 232 | config = { | 223 | config = { |
| 233 | systemd.user.services.xwayland-satellite = { | 224 | home.packages = [ pkgs.xwayland-satellite-unstable ]; |
| 234 | Unit = { | ||
| 235 | BindsTo = [ "graphical-session.target" ]; | ||
| 236 | PartOf = [ "graphical-session.target" ]; | ||
| 237 | After = [ "graphical-session.target" ]; | ||
| 238 | Requisite = [ "graphical-session.target" ]; | ||
| 239 | }; | ||
| 240 | Service = { | ||
| 241 | Type = "notify"; | ||
| 242 | NotifyAccess = "all"; | ||
| 243 | Environment = [ "DISPLAY=:0" ]; | ||
| 244 | ExecStart = ''${lib.getExe pkgs.xwayland-satellite-unstable} ''${DISPLAY}''; | ||
| 245 | ExecStartPre = "${systemctl} --user import-environment DISPLAY"; | ||
| 246 | StandardOutput = "journal"; | ||
| 247 | }; | ||
| 248 | Install = { | ||
| 249 | WantedBy = [ "graphical-session.target" ]; | ||
| 250 | }; | ||
| 251 | }; | ||
| 252 | |||
| 253 | services.swayidle = { | ||
| 254 | events = [ | ||
| 255 | { event = "after-resume"; command = "${lib.getExe niri} msg action power-on-monitors"; } | ||
| 256 | ]; | ||
| 257 | timeouts = [ | ||
| 258 | { timeout = 540; | ||
| 259 | command = "${lib.getExe niri} msg action power-off-monitors"; | ||
| 260 | } | ||
| 261 | ]; | ||
| 262 | }; | ||
| 263 | 225 | ||
| 264 | systemd.user.sockets.niri-workspace-history = { | 226 | systemd.user.sockets.niri-workspace-history = { |
| 265 | Socket = { | 227 | Socket = { |
| @@ -449,8 +411,8 @@ in { | |||
| 449 | { title = "^Access Request.*"; } | 411 | { title = "^Access Request.*"; } |
| 450 | { title = ".*Passkey credentials$"; } | 412 | { title = ".*Passkey credentials$"; } |
| 451 | ]; | 413 | ]; |
| 452 | windowRuleExtra = [ | 414 | windowRuleExtra = with kdl; [ |
| 453 | (kdl.leaf "open-focused" false) | 415 | (sleaf "open-focused" false) |
| 454 | ]; | 416 | ]; |
| 455 | key = "Mod+Control+P"; | 417 | key = "Mod+Control+P"; |
| 456 | app-id = "org.keepassxc.KeePassXC"; | 418 | app-id = "org.keepassxc.KeePassXC"; |
| @@ -477,6 +439,20 @@ in { | |||
| 477 | app-id = "com.github.wwmm.easyeffects"; | 439 | app-id = "com.github.wwmm.easyeffects"; |
| 478 | spawn = [ "easyeffects" ]; | 440 | spawn = [ "easyeffects" ]; |
| 479 | } | 441 | } |
| 442 | { name = "time"; | ||
| 443 | key = "Mod+Control+K"; | ||
| 444 | app-id = "chrome-kimai.yggdrasil.li__-Default"; | ||
| 445 | spawn = [ (toString (pkgs.resholve.writeScript "kimai" { | ||
| 446 | interpreter = pkgs.runtimeShell; | ||
| 447 | inputs = [ pkgs.dex ]; | ||
| 448 | execer = [ "cannot:${lib.getExe pkgs.dex}" ]; | ||
| 449 | } '' | ||
| 450 | exec dex $HOME/.local/state/nix/profile/share/applications/kimai.desktop | ||
| 451 | '')) ]; | ||
| 452 | windowRuleExtra = with kdl; [ | ||
| 453 | (sleaf "block-out-from" "screencast") | ||
| 454 | ]; | ||
| 455 | } | ||
| 480 | ]; | 456 | ]; |
| 481 | programs.niri.config = | 457 | programs.niri.config = |
| 482 | let | 458 | let |
| @@ -486,10 +462,12 @@ in { | |||
| 486 | then v | 462 | then v |
| 487 | else null; | 463 | else null; |
| 488 | opt-props = lib.filterAttrs (lib.const (value: value != null)); | 464 | opt-props = lib.filterAttrs (lib.const (value: value != null)); |
| 465 | normalize-nodes = nodes: lib.remove null (lib.flatten nodes); | ||
| 489 | in | 466 | in |
| 490 | [ (flag "prefer-no-csd") | 467 | normalize-nodes [ |
| 468 | (flag "prefer-no-csd") | ||
| 491 | 469 | ||
| 492 | (leaf "screenshot-path" "~/screenshots/%Y-%m-%dT%H:%M:%S.png") | 470 | (sleaf "screenshot-path" "~/screenshots/%Y-%m-%dT%H:%M:%S.png") |
| 493 | 471 | ||
| 494 | (plain "hotkey-overlay" [ | 472 | (plain "hotkey-overlay" [ |
| 495 | (flag "skip-at-startup") | 473 | (flag "skip-at-startup") |
| @@ -497,27 +475,27 @@ in { | |||
| 497 | 475 | ||
| 498 | (plain "input" [ | 476 | (plain "input" [ |
| 499 | (plain "keyboard" [ | 477 | (plain "keyboard" [ |
| 500 | (leaf "repeat-delay" 300) | 478 | (sleaf "repeat-delay" 300) |
| 501 | (leaf "repeat-rate" 50) | 479 | (sleaf "repeat-rate" 50) |
| 502 | 480 | ||
| 503 | (plain "xkb" [ | 481 | (plain "xkb" [ |
| 504 | (leaf "layout" "us,us") | 482 | (sleaf "layout" "us,us") |
| 505 | (leaf "variant" "dvp,") | 483 | (sleaf "variant" "dvp,") |
| 506 | (leaf "options" "compose:caps,grp:win_space_toggle") | 484 | (sleaf "options" "compose:caps,grp:win_space_toggle") |
| 507 | ]) | 485 | ]) |
| 508 | ]) | 486 | ]) |
| 509 | 487 | ||
| 510 | (flag "workspace-auto-back-and-forth") | 488 | (flag "workspace-auto-back-and-forth") |
| 511 | # (leaf "focus-follows-mouse" {}) | 489 | # (sleaf "focus-follows-mouse" {}) |
| 512 | # (flag "warp-mouse-to-focus") | 490 | # (flag "warp-mouse-to-focus") |
| 513 | 491 | ||
| 514 | # (plain "touchpad" [ (flag "off") ]) | 492 | # (plain "touchpad" [ (flag "off") ]) |
| 515 | (plain "trackball" [ | 493 | (plain "trackball" [ |
| 516 | (leaf "scroll-method" "on-button-down") | 494 | (sleaf "scroll-method" "on-button-down") |
| 517 | (leaf "scroll-button" 278) | 495 | (sleaf "scroll-button" 278) |
| 518 | ]) | 496 | ]) |
| 519 | (plain "touch" [ | 497 | (plain "touch" [ |
| 520 | (leaf "map-to-output" "eDP-1") | 498 | (sleaf "map-to-output" "eDP-1") |
| 521 | ]) | 499 | ]) |
| 522 | ]) | 500 | ]) |
| 523 | 501 | ||
| @@ -525,7 +503,7 @@ in { | |||
| 525 | (plain "hot-corners" [(flag "off")]) | 503 | (plain "hot-corners" [(flag "off")]) |
| 526 | ]) | 504 | ]) |
| 527 | 505 | ||
| 528 | (plain "environment" (lib.mapAttrsToList leaf { | 506 | (plain "environment" (lib.mapAttrsToList sleaf { |
| 529 | NIXOS_OZONE_WL = "1"; | 507 | NIXOS_OZONE_WL = "1"; |
| 530 | QT_QPA_PLATFORM = "wayland"; | 508 | QT_QPA_PLATFORM = "wayland"; |
| 531 | QT_WAYLAND_DISABLE_WINDOWDECORATION = "1"; | 509 | QT_WAYLAND_DISABLE_WINDOWDECORATION = "1"; |
| @@ -538,47 +516,47 @@ in { | |||
| 538 | SUDO_ASKPASS = lib.getExe pkgs.kdePackages.ksshaskpass; | 516 | SUDO_ASKPASS = lib.getExe pkgs.kdePackages.ksshaskpass; |
| 539 | })) | 517 | })) |
| 540 | 518 | ||
| 541 | (node "output" "eDP-1" [ | 519 | (node "output" ["eDP-1"] [ |
| 542 | (leaf "scale" 1.5) | 520 | (sleaf "scale" 1.5) |
| 543 | (leaf "position" { x = 0; y = 0; }) | 521 | (sleaf "position" { x = 0; y = 0; }) |
| 544 | ]) | 522 | ]) |
| 545 | (node "output" "Ancor Communications Inc ASUS PB287Q 0x0000DD9B" [ | 523 | (node "output" ["Ancor Communications Inc ASUS PB287Q 0x0000DD9B"] [ |
| 546 | (leaf "scale" 1.5) | 524 | (sleaf "scale" 1.5) |
| 547 | (leaf "position" { x = 2560; y = 0; }) | 525 | (sleaf "position" { x = 2560; y = 0; }) |
| 548 | ]) | 526 | ]) |
| 549 | (node "output" "HP Inc. HP 727pu CN4417143K" [ | 527 | (node "output" ["HP Inc. HP 727pu CN4417143K"] [ |
| 550 | (leaf "mode" "2560x1440@119.998") | 528 | (sleaf "mode" "2560x1440@119.998") |
| 551 | (leaf "scale" 1) | 529 | (sleaf "scale" 1) |
| 552 | (leaf "position" { x = 2560; y = 0; }) | 530 | (sleaf "position" { x = 2560; y = 0; }) |
| 553 | (flag "variable-refresh-rate") | 531 | (flag "variable-refresh-rate") |
| 554 | ]) | 532 | ]) |
| 555 | 533 | ||
| 556 | (plain "debug" [ | 534 | (plain "debug" [ |
| 557 | (leaf "render-drm-device" "/dev/dri/by-path/pci-0000:00:02.0-render") | 535 | (sleaf "render-drm-device" "/dev/dri/by-path/pci-0000:00:02.0-render") |
| 558 | ]) | 536 | ]) |
| 559 | 537 | ||
| 560 | (plain "animations" [ | 538 | (plain "animations" [ |
| 561 | (leaf "slowdown" 0.5) | 539 | (sleaf "slowdown" 0.5) |
| 562 | (plain "workspace-switch" [(flag "off")]) | 540 | (plain "workspace-switch" [(flag "off")]) |
| 563 | ]) | 541 | ]) |
| 564 | 542 | ||
| 565 | (plain "layout" [ | 543 | (plain "layout" [ |
| 566 | (leaf "gaps" 8) | 544 | (sleaf "gaps" 8) |
| 567 | (plain "struts" [ | 545 | (plain "struts" [ |
| 568 | (leaf "left" 26) | 546 | (sleaf "left" 26) |
| 569 | (leaf "right" 26) | 547 | (sleaf "right" 26) |
| 570 | (leaf "top" 0) | 548 | (sleaf "top" 0) |
| 571 | (leaf "bottom" 0) | 549 | (sleaf "bottom" 0) |
| 572 | ]) | 550 | ]) |
| 573 | (plain "border" [ | 551 | (plain "border" [ |
| 574 | (leaf "width" 2) | 552 | (sleaf "width" 2) |
| 575 | (leaf "active-gradient" { | 553 | (sleaf "active-gradient" { |
| 576 | from = "hsla(195 100% 45% 1)"; | 554 | from = "hsla(195 100% 45% 1)"; |
| 577 | to = "hsla(155 100% 37.5% 1)"; | 555 | to = "hsla(155 100% 37.5% 1)"; |
| 578 | angle = 29; | 556 | angle = 29; |
| 579 | relative-to = "workspace-view"; | 557 | relative-to = "workspace-view"; |
| 580 | }) | 558 | }) |
| 581 | (leaf "inactive-gradient" { | 559 | (sleaf "inactive-gradient" { |
| 582 | from = "hsla(0 0% 27.7% 1)"; | 560 | from = "hsla(0 0% 27.7% 1)"; |
| 583 | to = "hsla(0 0% 23% 1)"; | 561 | to = "hsla(0 0% 23% 1)"; |
| 584 | angle = 29; | 562 | angle = 29; |
| @@ -589,29 +567,29 @@ in { | |||
| 589 | (flag "off") | 567 | (flag "off") |
| 590 | ]) | 568 | ]) |
| 591 | 569 | ||
| 592 | (plain "preset-column-widths" (map (prop: leaf "proportion" prop) [ | 570 | (plain "preset-column-widths" (map (prop: sleaf "proportion" prop) [ |
| 593 | (1. / 4.) (1. / 3.) (1. / 2.) (2. / 3.) (3. / 4.) (1.) | 571 | (1. / 4.) (1. / 3.) (1. / 2.) (2. / 3.) (3. / 4.) (1.) |
| 594 | ])) | 572 | ])) |
| 595 | (plain "default-column-width" [ (leaf "proportion" (1. / 2.)) ]) | 573 | (plain "default-column-width" [ (sleaf "proportion" (1. / 2.)) ]) |
| 596 | (plain "preset-window-heights" (map (prop: leaf "proportion" prop) [ | 574 | (plain "preset-window-heights" (map (prop: sleaf "proportion" prop) [ |
| 597 | (1. / 3.) (1. / 2.) (2. / 3.) (1.) | 575 | (1. / 3.) (1. / 2.) (2. / 3.) (1.) |
| 598 | ])) | 576 | ])) |
| 599 | 577 | ||
| 600 | (flag "always-center-single-column") | 578 | (flag "always-center-single-column") |
| 601 | 579 | ||
| 602 | (plain "tab-indicator" [ | 580 | (plain "tab-indicator" [ |
| 603 | (leaf "gap" 4) | 581 | (sleaf "gap" 4) |
| 604 | (leaf "width" 8) | 582 | (sleaf "width" 8) |
| 605 | (leaf "gaps-between-tabs" 4) | 583 | (sleaf "gaps-between-tabs" 4) |
| 606 | (flag "place-within-column") | 584 | (flag "place-within-column") |
| 607 | (leaf "length" { total-proportion = 1.; }) | 585 | (sleaf "length" { total-proportion = 1.; }) |
| 608 | (leaf "active-gradient" { | 586 | (sleaf "active-gradient" { |
| 609 | from = "hsla(195 100% 60% 0.75)"; | 587 | from = "hsla(195 100% 60% 0.75)"; |
| 610 | to = "hsla(155 100% 50% 0.75)"; | 588 | to = "hsla(155 100% 50% 0.75)"; |
| 611 | angle = 29; | 589 | angle = 29; |
| 612 | relative-to = "workspace-view"; | 590 | relative-to = "workspace-view"; |
| 613 | }) | 591 | }) |
| 614 | (leaf "inactive-gradient" { | 592 | (sleaf "inactive-gradient" { |
| 615 | from = "hsla(0 0% 42% 0.66)"; | 593 | from = "hsla(0 0% 42% 0.66)"; |
| 616 | to = "hsla(0 0% 35% 0.66)"; | 594 | to = "hsla(0 0% 35% 0.66)"; |
| 617 | angle = 29; | 595 | angle = 29; |
| @@ -625,130 +603,121 @@ in { | |||
| 625 | ]) | 603 | ]) |
| 626 | 604 | ||
| 627 | (map (name: | 605 | (map (name: |
| 628 | (node "workspace" name [ | 606 | (node "workspace" [name] [ |
| 629 | (leaf "open-on-output" "eDP-1") | 607 | (sleaf "open-on-output" "eDP-1") |
| 630 | ]) | 608 | ]) |
| 631 | ) (map ({name, ...}: name) cfg.scratchspaces)) | 609 | ) (map ({name, ...}: name) cfg.scratchspaces)) |
| 632 | (map (name: | 610 | (map (name: |
| 633 | (leaf "workspace" name) | 611 | (sleaf "workspace" name) |
| 634 | ) ["comm" "web" "vid" "bmr"]) | 612 | ) ["comm" "web" "vid" "bmr"]) |
| 635 | 613 | ||
| 636 | (plain "window-rule" [ | 614 | (plain "window-rule" [ |
| 637 | (leaf "clip-to-geometry" true) | 615 | (sleaf "clip-to-geometry" true) |
| 638 | ]) | 616 | ]) |
| 639 | 617 | ||
| 640 | (plain "window-rule" [ | 618 | (plain "window-rule" [ |
| 641 | (leaf "match" { is-floating = true; }) | 619 | (sleaf "match" { is-floating = true; }) |
| 642 | (leaf "geometry-corner-radius" 8) | 620 | (sleaf "geometry-corner-radius" 8) |
| 643 | (plain "shadow" [ (flag "on") ]) | 621 | (plain "shadow" [ (flag "on") ]) |
| 644 | ]) | 622 | ]) |
| 645 | 623 | ||
| 646 | (plain "window-rule" [ | 624 | (plain "window-rule" [ |
| 647 | (leaf "match" { app-id = "^org\\.keepassxc\\.KeePassXC$"; }) | 625 | (sleaf "match" { app-id = "^org\\.keepassxc\\.KeePassXC$"; }) |
| 648 | (leaf "block-out-from" "screencast") | 626 | (sleaf "block-out-from" "screencast") |
| 649 | ]) | 627 | ]) |
| 650 | (plain "window-rule" [ | 628 | (plain "window-rule" (normalize-nodes [ |
| 651 | (map (title: | 629 | (map (title: |
| 652 | (leaf "match" { app-id = "^org\\.keepassxc\\.KeePassXC$"; inherit title; }) | 630 | (sleaf "match" { app-id = "^org\\.keepassxc\\.KeePassXC$"; inherit title; }) |
| 653 | ) ["^Unlock Database.*" "^Access Request.*" ".*Passkey credentials$"]) | 631 | ) ["^Unlock Database.*" "^Access Request.*" ".*Passkey credentials$" "Browser Access Request$"]) |
| 654 | (leaf "open-focused" true) | 632 | (sleaf "open-focused" true) |
| 655 | (leaf "open-floating" true) | 633 | (sleaf "open-floating" true) |
| 656 | ]) | 634 | ])) |
| 657 | 635 | ||
| 658 | (map ({ name, match, exclude, windowRuleExtra, ... }: | 636 | (map ({ name, match, exclude, windowRuleExtra, ... }: |
| 659 | (optional-node (match != []) (plain "window-rule" [ | 637 | (optional-node (match != []) (plain "window-rule" (normalize-nodes [ |
| 660 | (map (leaf "match") match) | 638 | (map (sleaf "match") match) |
| 661 | (map (leaf "exclude") exclude) | 639 | (map (sleaf "exclude") exclude) |
| 662 | (leaf "open-on-workspace" name) | 640 | (sleaf "open-on-workspace" name) |
| 663 | (leaf "open-maximized" true) | 641 | (sleaf "open-maximized" true) |
| 664 | windowRuleExtra | 642 | windowRuleExtra |
| 665 | ])) | 643 | ]))) |
| 666 | ) cfg.scratchspaces) | 644 | ) cfg.scratchspaces) |
| 667 | 645 | ||
| 668 | (plain "window-rule" [ | 646 | (plain "window-rule" [ |
| 669 | (leaf "match" { app-id = "^emacs$"; }) | 647 | (sleaf "match" { app-id = "^emacs$"; }) |
| 670 | (leaf "match" { app-id = "^firefox$"; }) | 648 | (sleaf "match" { app-id = "^firefox$"; }) |
| 671 | (plain "default-column-width" [(leaf "proportion" (2. / 3.))]) | 649 | (plain "default-column-width" [(sleaf "proportion" (2. / 3.))]) |
| 672 | ]) | 650 | ]) |
| 673 | (plain "window-rule" [ | 651 | (plain "window-rule" [ |
| 674 | (leaf "match" { app-id = "^kitty$"; }) | 652 | (sleaf "match" { app-id = "^kitty$"; }) |
| 675 | (leaf "match" { app-id = "^kitty-play$"; }) | 653 | (sleaf "match" { app-id = "^kitty-play$"; }) |
| 676 | (plain "default-column-width" [(leaf "proportion" (1. / 3.))]) | 654 | (plain "default-column-width" [(sleaf "proportion" (1. / 3.))]) |
| 677 | ]) | 655 | ]) |
| 678 | 656 | ||
| 679 | (plain "window-rule" [ | 657 | (plain "window-rule" [ |
| 680 | (leaf "match" { app-id = "^thunderbird$"; }) | 658 | (sleaf "match" { app-id = "^thunderbird$"; }) |
| 681 | (leaf "match" { app-id = "^Element$"; }) | 659 | (sleaf "match" { app-id = "^Element$"; }) |
| 682 | (leaf "match" { app-id = "^Rainbow$"; }) | 660 | (sleaf "match" { app-id = "^chrome-web\.openrainbow\.com__-Default$"; }) |
| 683 | (leaf "open-on-workspace" "comm") | 661 | (sleaf "open-on-workspace" "comm") |
| 684 | ]) | 662 | ]) |
| 685 | (plain "window-rule" [ | 663 | (plain "window-rule" [ |
| 686 | (leaf "match" { app-id = "^Kimai$"; }) | 664 | (sleaf "match" { app-id = "^firefox$"; }) |
| 687 | (leaf "open-on-workspace" "comm") | 665 | (sleaf "open-on-workspace" "web") |
| 688 | (leaf "open-fullscreen" false) | 666 | (sleaf "open-maximized" true) |
| 689 | (plain "default-column-width" [(leaf "proportion" (2. / 3.))]) | ||
| 690 | ]) | 667 | ]) |
| 691 | (plain "window-rule" [ | 668 | (plain "window-rule" [ |
| 692 | (leaf "match" { app-id = "^firefox$"; }) | 669 | (sleaf "match" { app-id = "^mpv$"; }) |
| 693 | (leaf "open-on-workspace" "web") | 670 | (sleaf "open-on-workspace" "vid") |
| 694 | (leaf "open-maximized" true) | 671 | (plain "default-column-width" [(sleaf "proportion" 1.)]) |
| 695 | ]) | 672 | ]) |
| 696 | (plain "window-rule" [ | 673 | (plain "window-rule" [ |
| 697 | (leaf "match" { app-id = "^mpv$"; }) | 674 | (sleaf "match" { app-id = "^kitty-play$"; }) |
| 698 | (leaf "open-on-workspace" "vid") | 675 | (sleaf "open-on-workspace" "vid") |
| 699 | (plain "default-column-width" [(leaf "proportion" 1.)]) | 676 | (sleaf "open-focused" false) |
| 700 | ]) | 677 | ]) |
| 701 | (plain "window-rule" [ | 678 | (plain "window-rule" [ |
| 702 | (leaf "match" { app-id = "^kitty-play$"; }) | 679 | (sleaf "match" { app-id = "^chrome-audiobookshelf\.yggdrasil\.li__-Default$"; }) |
| 703 | (leaf "open-on-workspace" "vid") | 680 | (sleaf "match" { app-id = "^YouTube Music Desktop App$"; }) |
| 704 | (leaf "open-focused" false) | 681 | (sleaf "open-on-workspace" "vid") |
| 705 | ]) | 682 | ]) |
| 706 | (plain "window-rule" [ | 683 | (plain "window-rule" [ |
| 707 | (leaf "match" { app-id = "^pdfpc$"; }) | 684 | (sleaf "match" { app-id = "^pdfpc$"; }) |
| 708 | (plain "default-column-width" [(leaf "proportion" 1.)]) | 685 | (plain "default-column-width" [(sleaf "proportion" 1.)]) |
| 709 | ]) | 686 | ]) |
| 710 | (plain "window-rule" [ | 687 | (plain "window-rule" [ |
| 711 | (leaf "match" { app-id = "^pdfpc$"; title = "^.*presentation.*$"; }) | 688 | (sleaf "match" { app-id = "^pdfpc$"; title = "^.*presentation.*$"; }) |
| 712 | (plain "default-column-width" [(leaf "proportion" 1.)]) | 689 | (plain "default-column-width" [(sleaf "proportion" 1.)]) |
| 713 | (leaf "open-fullscreen" true) | 690 | (sleaf "open-fullscreen" true) |
| 714 | (leaf "open-on-workspace" "bmr") | 691 | (sleaf "open-on-workspace" "bmr") |
| 715 | (leaf "open-focused" false) | 692 | (sleaf "open-focused" false) |
| 716 | ]) | 693 | ]) |
| 717 | (plain "window-rule" [ | 694 | (plain "window-rule" (normalize-nodes [ |
| 718 | (map (leaf "match") [ | 695 | (map (sleaf "match") [ |
| 719 | { app-id = "^Gimp-"; title = "^Quit GIMP$"; } | 696 | { app-id = "^Gimp-"; title = "^Quit GIMP$"; } |
| 720 | { app-id = "^org\\.kde\\.polkit-kde-authentication-agent-1$"; } | 697 | { app-id = "^org\\.kde\\.polkit-kde-authentication-agent-1$"; } |
| 721 | { app-id = "^xdg-desktop-portal-gtk$"; } | 698 | { app-id = "^xdg-desktop-portal-gtk$"; } |
| 722 | ]) | 699 | ]) |
| 723 | (leaf "open-floating" true) | 700 | (sleaf "open-floating" true) |
| 724 | ]) | 701 | ])) |
| 725 | (plain "window-rule" [ | 702 | (plain "window-rule" [ |
| 726 | (leaf "match" { app-id = "^org\\.pwmt\\.zathura$"; }) | 703 | (sleaf "match" { app-id = "^org\\.pwmt\\.zathura$"; }) |
| 727 | (leaf "match" { app-id = "^evince$"; }) | 704 | (sleaf "match" { app-id = "^evince$"; }) |
| 728 | (leaf "match" { app-id = "^org\\.gnome\\.Papers$"; }) | 705 | (sleaf "match" { app-id = "^org\\.gnome\\.Papers$"; }) |
| 729 | (leaf "default-column-display" "tabbed") | 706 | (sleaf "default-column-display" "tabbed") |
| 730 | ]) | 707 | ]) |
| 731 | 708 | ||
| 732 | (plain "layer-rule" [ | 709 | (plain "layer-rule" [ |
| 733 | (leaf "match" { namespace = "^notifications$"; }) | 710 | (sleaf "match" { namespace = "^notifications$"; }) |
| 734 | (leaf "match" { namespace = "^waybar$"; }) | 711 | (sleaf "match" { namespace = "^bar$"; }) |
| 735 | (leaf "match" { namespace = "^launcher$"; }) | 712 | (sleaf "match" { namespace = "^launcher$"; }) |
| 736 | (leaf "block-out-from" "screencast") | 713 | (sleaf "block-out-from" "screencast") |
| 737 | ]) | 714 | ]) |
| 738 | 715 | ||
| 739 | (plain "binds" | 716 | (plain "binds" |
| 740 | (let | 717 | (let |
| 741 | bind = name: cfg: node name (opt-props { | 718 | bind = name: cfg: node name [(lib.removeAttrs cfg ["action"])] (lib.mapAttrsToList leaf (lib.removeAttrs cfg.action ["__functor"])); |
| 742 | cooldown-ms = cfg.cooldown-ms or null; | ||
| 743 | } | ||
| 744 | // (lib.optionalAttrs (!(cfg.repeat or true)) { | ||
| 745 | repeat = false; | ||
| 746 | }) | ||
| 747 | // (lib.optionalAttrs (cfg.allow-when-locked or false) { | ||
| 748 | allow-when-locked = true; | ||
| 749 | })) (lib.mapAttrsToList leaf (lib.removeAttrs cfg.action ["__functor"])); | ||
| 750 | in | 719 | in |
| 751 | [ | 720 | normalize-nodes [ |
| 752 | (lib.mapAttrsToList bind (with config.lib.niri.actions; { | 721 | (lib.mapAttrsToList bind (with config.lib.niri.actions; { |
| 753 | "Mod+Slash".action = show-hotkey-overlay; | 722 | "Mod+Slash".action = show-hotkey-overlay; |
| 754 | 723 | ||
| @@ -803,12 +772,12 @@ in { | |||
| 803 | 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) | 772 | 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) |
| 804 | $FOUND || echo | 773 | $FOUND || echo |
| 805 | } | 774 | } |
| 806 | FUZZEL_RES=$(prev | fuzzel --dmenu --prompt "qalc> ") || exit $? | 775 | FUZZEL_RES=$(prev | fuzzel --dmenu --prompt "qalc> " --width=60) || exit $? |
| 807 | if [[ "$FUZZEL_RES" =~ .*\ =\ .* ]]; then | 776 | if [[ "$FUZZEL_RES" =~ .*\ =\ .* ]]; then |
| 808 | QALC_RES="$FUZZEL_RES" | 777 | QALC_RES="$FUZZEL_RES" |
| 809 | QALC_RET=0 | 778 | QALC_RET=0 |
| 810 | else | 779 | else |
| 811 | QALC_RES=$(qalc "$FUZZEL_RES" 2>&1) | 780 | QALC_RES=$(qalc -set "autocalc off" "$FUZZEL_RES" 2>&1) |
| 812 | QALC_RET=$? | 781 | QALC_RET=$? |
| 813 | fi | 782 | fi |
| 814 | [[ -n "$QALC_RES" ]] || exit 1 | 783 | [[ -n "$QALC_RES" ]] || exit 1 |
| @@ -828,11 +797,26 @@ in { | |||
| 828 | notify-send "$QALC_RES" | 797 | notify-send "$QALC_RES" |
| 829 | ''; | 798 | ''; |
| 830 | })); | 799 | })); |
| 800 | "Mod+Shift+U".action = | ||
| 801 | let | ||
| 802 | qalcKitty = pkgs.symlinkJoin { | ||
| 803 | name = "qalc-kitty"; | ||
| 804 | paths = [ config.programs.kitty.package ]; | ||
| 805 | buildInputs = [ pkgs.makeWrapper ]; | ||
| 806 | postBuild = '' | ||
| 807 | wrapProgram $out/bin/kitty \ | ||
| 808 | --add-flags "--config ${pkgs.writeText "kitty.conf" '' | ||
| 809 | include $HOME/${config.xdg.configFile."kitty/kitty.conf".target} | ||
| 810 | shell ${lib.getExe pkgs.libqalculate} | ||
| 811 | ''}" | ||
| 812 | ''; | ||
| 813 | }; | ||
| 814 | in spawn (lib.getExe' qalcKitty "kitty"); | ||
| 831 | "Mod+E".action = spawn (lib.getExe (pkgs.writeShellApplication { | 815 | "Mod+E".action = spawn (lib.getExe (pkgs.writeShellApplication { |
| 832 | name = "emoji-fuzzel"; | 816 | name = "emoji-fuzzel"; |
| 833 | runtimeInputs = with pkgs; [ config.programs.fuzzel.package wtype wl-clipboard-rs ]; | 817 | runtimeInputs = with pkgs; [ config.programs.fuzzel.package wtype wl-clipboard-rs ]; |
| 834 | text = '' | 818 | text = '' |
| 835 | FUZZEL_RES=$(fuzzel --dmenu --prompt "emoji> " <"$HOME"/.local/share/emoji-data/list.txt) || exit $? | 819 | FUZZEL_RES=$(fuzzel --dmenu --prompt "emoji> " --cache "$HOME"/.cache/fuzzel-emoji --width=60 <"$HOME"/.local/share/emoji-data/list.txt) || exit $? |
| 836 | [[ -n "$FUZZEL_RES" ]] || exit 1 | 820 | [[ -n "$FUZZEL_RES" ]] || exit 1 |
| 837 | wl-copy "$(cut -d ':' -f 1 <<<"$FUZZEL_RES" | tr -d '\n')" && wtype -k XF86Paste | 821 | wl-copy "$(cut -d ':' -f 1 <<<"$FUZZEL_RES" | tr -d '\n')" && wtype -k XF86Paste |
| 838 | ''; | 822 | ''; |
| @@ -916,63 +900,74 @@ in { | |||
| 916 | "Mod+Right".action = set-column-width "+10%"; | 900 | "Mod+Right".action = set-column-width "+10%"; |
| 917 | 901 | ||
| 918 | "Mod+Shift+Z" = { | 902 | "Mod+Shift+Z" = { |
| 919 | action = spawn (lib.getExe niri) "msg" "action" "power-off-monitors"; | 903 | action = power-off-monitors; |
| 920 | allow-when-locked = true; | 904 | allow-when-locked = true; |
| 921 | }; | 905 | }; |
| 922 | "Mod+Shift+L".action = spawn loginctl "lock-session"; | ||
| 923 | "Mod+Shift+E".action = quit; | 906 | "Mod+Shift+E".action = quit; |
| 924 | "Mod+Shift+Minus" = { | 907 | |
| 925 | action = spawn systemctl "suspend"; | 908 | # "Mod+Semicolon".action = spawn makoctl "dismiss" "--group"; |
| 909 | # "Mod+Shift+Semicolon".action = spawn makoctl "dismiss" "--all"; | ||
| 910 | # "Mod+Period".action = spawn makoctl "menu" "--" (lib.getExe config.programs.fuzzel.package) "--dmenu"; | ||
| 911 | # "Mod+Comma".action = spawn makoctl "restore"; | ||
| 912 | |||
| 913 | "Mod+Control+W".action = with-empty-unnamed-workspace-action "{\"Action\":{\"FocusWorkspace\":{\"reference\":{\"Id\": $workspace_id}}}}"; | ||
| 914 | "Mod+Control+Shift+W".action = with-empty-unnamed-workspace-action "{\"Action\":{\"MoveColumnToWorkspace\":{\"reference\":{\"Id\": $workspace_id}, \"focus\": true}}}"; | ||
| 915 | |||
| 916 | "Mod+X".action = set-dynamic-cast-window; | ||
| 917 | "Mod+Shift+X".action = set-dynamic-cast-monitor; | ||
| 918 | "Mod+Control+Shift+X".action = clear-dynamic-cast-target; | ||
| 919 | |||
| 920 | "Mod+D".action = with-urgent-window-action "{\"Action\":{\"FocusWindow\":{\"id\": .id}}}"; | ||
| 921 | "Mod+Shift+D".action = with-focused-window-action "{\"Action\":{\"UnsetUrgent\":{\"id\": .id}}}"; | ||
| 922 | |||
| 923 | "Mod+K".action = spawn (lib.getExe' pkgs.worktime "worktime-ui"); | ||
| 924 | "Mod+Shift+K".action = spawn (lib.getExe' pkgs.worktime "worktime-stop"); | ||
| 925 | })) | ||
| 926 | (lib.mapAttrsToList (name: cfg: node name [(lib.removeAttrs cfg ["action"])] [cfg.action]) (let | ||
| 927 | shell = obj: leaf "send-unix" [ | ||
| 928 | { path = ''''${XDG_RUNTIME_DIR}/shell.sock''; } | ||
| 929 | (builtins.toJSON obj + "\n") | ||
| 930 | ]; | ||
| 931 | in { | ||
| 932 | "XF86AudioRaiseVolume" = { | ||
| 926 | allow-when-locked = true; | 933 | allow-when-locked = true; |
| 934 | action = shell { Volume.volume = "up"; }; | ||
| 927 | }; | 935 | }; |
| 928 | "Mod+Shift+Control+Minus" = { | 936 | "XF86AudioLowerVolume" = { |
| 929 | action = spawn systemctl "hibernate"; | ||
| 930 | allow-when-locked = true; | 937 | allow-when-locked = true; |
| 938 | action = shell { Volume.volume = "down"; }; | ||
| 931 | }; | 939 | }; |
| 932 | "Mod+Shift+P" = { | 940 | "XF86AudioMute" = { |
| 933 | action = spawn (lib.getExe pkgs.playerctl) "-a" "pause"; | ||
| 934 | allow-when-locked = true; | 941 | allow-when-locked = true; |
| 942 | action = shell { Volume.muted = "toggle"; }; | ||
| 935 | }; | 943 | }; |
| 936 | 944 | "XF86AudioMicMute" = { | |
| 937 | "XF86MonBrightnessUp" = { | ||
| 938 | action = spawn swayosd-client "--brightness" "raise"; | ||
| 939 | allow-when-locked = true; | 945 | allow-when-locked = true; |
| 946 | action = shell { Volume."mic-muted" = "toggle"; }; | ||
| 940 | }; | 947 | }; |
| 941 | "XF86MonBrightnessDown" = { | 948 | "XF86MonBrightnessUp" = { |
| 942 | action = spawn swayosd-client "--brightness" "lower"; | 949 | action = shell { Brightness = "up"; }; |
| 943 | allow-when-locked = true; | 950 | allow-when-locked = true; |
| 944 | }; | 951 | }; |
| 945 | "XF86AudioRaiseVolume" = { | 952 | "XF86MonBrightnessDown" = { |
| 946 | action = spawn swayosd-client "--output-volume" "raise"; | 953 | action = shell { Brightness = "down"; }; |
| 947 | allow-when-locked = true; | 954 | allow-when-locked = true; |
| 948 | }; | 955 | }; |
| 949 | "XF86AudioLowerVolume" = { | 956 | "Mod+Shift+L".action = shell { LockSession = {}; }; |
| 950 | action = spawn swayosd-client "--output-volume" "lower"; | 957 | "Mod+Shift+Minus" = { |
| 958 | action = shell { Suspend = {}; }; | ||
| 951 | allow-when-locked = true; | 959 | allow-when-locked = true; |
| 952 | }; | 960 | }; |
| 953 | "XF86AudioMute" = { | 961 | "Mod+Shift+Control+Minus" = { |
| 954 | action = spawn swayosd-client "--output-volume" "mute-toggle"; | 962 | action = shell { Hibernate = {}; }; |
| 955 | allow-when-locked = true; | 963 | allow-when-locked = true; |
| 956 | }; | 964 | }; |
| 957 | "XF86AudioMicMute" = { | 965 | "Mod+Shift+P" = { |
| 958 | action = spawn swayosd-client "--input-volume" "mute-toggle"; | 966 | action = shell { Mpris = { PauseAll = {}; }; }; |
| 959 | allow-when-locked = true; | 967 | allow-when-locked = true; |
| 960 | }; | 968 | }; |
| 961 | 969 | "Mod+Semicolon".action = shell { Notifications = { DismissGroup = {}; }; }; | |
| 962 | "Mod+Semicolon".action = spawn makoctl "dismiss" "--group"; | 970 | "Mod+Shift+Semicolon".action = shell { Notifications = { DismissAll = {}; }; }; |
| 963 | "Mod+Shift+Semicolon".action = spawn makoctl "dismiss" "--all"; | ||
| 964 | "Mod+Period".action = spawn makoctl "menu" "--" (lib.getExe config.programs.fuzzel.package) "--dmenu"; | ||
| 965 | "Mod+Comma".action = spawn makoctl "restore"; | ||
| 966 | |||
| 967 | "Mod+Control+W".action = with-empty-unnamed-workspace-action "{\"Action\":{\"FocusWorkspace\":{\"reference\":{\"Id\": $workspace_id}}}}"; | ||
| 968 | "Mod+Control+Shift+W".action = with-empty-unnamed-workspace-action "{\"Action\":{\"MoveColumnToWorkspace\":{\"reference\":{\"Id\": $workspace_id}, \"focus\": true}}}"; | ||
| 969 | |||
| 970 | "Mod+X".action = set-dynamic-cast-window; | ||
| 971 | "Mod+Shift+X".action = set-dynamic-cast-monitor; | ||
| 972 | "Mod+Control+Shift+X".action = clear-dynamic-cast-target; | ||
| 973 | |||
| 974 | "Mod+D".action = with-urgent-window-action "{\"Action\":{\"FocusWindow\":{\"id\": .id}}}"; | ||
| 975 | "Mod+Shift+D".action = with-focused-window-action "{\"Action\":{\"UnsetUrgent\":{\"id\": .id}}}"; | ||
| 976 | })) | 971 | })) |
| 977 | (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) | 972 | (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) |
| 978 | (map ({ name, moveKey, ...}: if moveKey != null then bind moveKey { action = kdl.magic-leaf "move-column-to-workspace" name; } else null) cfg.scratchspaces) | 973 | (map ({ name, moveKey, ...}: if moveKey != null then bind moveKey { action = kdl.magic-leaf "move-column-to-workspace" name; } else null) cfg.scratchspaces) |
diff --git a/accounts/gkleen@sif/niri/mako.nix b/accounts/gkleen@sif/niri/mako.nix index 810bff89..3d246d96 100644 --- a/accounts/gkleen@sif/niri/mako.nix +++ b/accounts/gkleen@sif/niri/mako.nix | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | { config, lib, pkgs, ... }: | 1 | { config, lib, pkgs, ... }: |
| 2 | { | 2 | { |
| 3 | config = { | 3 | config = lib.mkIf false { |
| 4 | services.mako = { | 4 | services.mako = { |
| 5 | enable = true; | 5 | enable = true; |
| 6 | settings = { | 6 | settings = { |
| @@ -14,8 +14,7 @@ | |||
| 14 | outer-margin = 1; | 14 | outer-margin = 1; |
| 15 | max-history = 100; | 15 | max-history = 100; |
| 16 | max-icon-size = 48; | 16 | max-icon-size = 48; |
| 17 | }; | 17 | |
| 18 | criteria = { | ||
| 19 | grouped.format = "<b>(%g)</b> <i>%s</i>\\n%b"; | 18 | grouped.format = "<b>(%g)</b> <i>%s</i>\\n%b"; |
| 20 | "urgency=low".text-color = "#999999ff"; | 19 | "urgency=low".text-color = "#999999ff"; |
| 21 | "urgency=critical".background-color = "#900000dd"; | 20 | "urgency=critical".background-color = "#900000dd"; |
| @@ -25,6 +24,7 @@ | |||
| 25 | ignore-timeout = true; | 24 | ignore-timeout = true; |
| 26 | default-timeout = 2000; | 25 | default-timeout = 2000; |
| 27 | }; | 26 | }; |
| 27 | "app-name=worktime".history = false; | ||
| 28 | "mode=silent".invisible = true; | 28 | "mode=silent".invisible = true; |
| 29 | }; | 29 | }; |
| 30 | package = pkgs.symlinkJoin { | 30 | package = pkgs.symlinkJoin { |
diff --git a/accounts/gkleen@sif/niri/swayosd.nix b/accounts/gkleen@sif/niri/swayosd.nix deleted file mode 100644 index 54ebb302..00000000 --- a/accounts/gkleen@sif/niri/swayosd.nix +++ /dev/null | |||
| @@ -1,66 +0,0 @@ | |||
| 1 | { pkgs, ... }: | ||
| 2 | { | ||
| 3 | config = { | ||
| 4 | services.swayosd = { | ||
| 5 | enable = true; | ||
| 6 | topMargin = 0.4769706078; | ||
| 7 | stylePath = pkgs.runCommand "style.css" { | ||
| 8 | passAsFile = [ "src" ]; | ||
| 9 | src = '' | ||
| 10 | window#osd { | ||
| 11 | padding: 12px 20px; | ||
| 12 | border-radius: 999px; | ||
| 13 | border: none; | ||
| 14 | background: rgba(0, 0, 0, 0.87); | ||
| 15 | |||
| 16 | #container { | ||
| 17 | margin: 16px; | ||
| 18 | } | ||
| 19 | |||
| 20 | image, | ||
| 21 | label { | ||
| 22 | color: rgb(255, 255, 255); | ||
| 23 | |||
| 24 | &:disabled { | ||
| 25 | opacity: 1; | ||
| 26 | color: rgb(84, 84, 84); | ||
| 27 | } | ||
| 28 | } | ||
| 29 | |||
| 30 | progressbar { | ||
| 31 | min-height: 6px; | ||
| 32 | border-radius: 999px; | ||
| 33 | background: transparent; | ||
| 34 | border: none; | ||
| 35 | |||
| 36 | trough, progress { | ||
| 37 | min-height: inherit; | ||
| 38 | border-radius: inherit; | ||
| 39 | border: none; | ||
| 40 | } | ||
| 41 | |||
| 42 | trough { | ||
| 43 | background: rgb(127, 127, 127); | ||
| 44 | } | ||
| 45 | progress { | ||
| 46 | background: rgb(255, 255, 255); | ||
| 47 | } | ||
| 48 | |||
| 49 | &:disabled { | ||
| 50 | opacity: 1; | ||
| 51 | |||
| 52 | trough { | ||
| 53 | background: rgb(19, 19, 19); | ||
| 54 | } | ||
| 55 | progress { | ||
| 56 | background: rgb(38, 38, 38); | ||
| 57 | } | ||
| 58 | } | ||
| 59 | } | ||
| 60 | } | ||
| 61 | ''; | ||
| 62 | buildInputs = with pkgs; [sass]; | ||
| 63 | } "scss -C --sourcemap=none --style=compact $srcPath $out"; | ||
| 64 | }; | ||
| 65 | }; | ||
| 66 | } | ||
diff --git a/accounts/gkleen@sif/niri/waybar.nix b/accounts/gkleen@sif/niri/waybar.nix deleted file mode 100644 index c02a9a76..00000000 --- a/accounts/gkleen@sif/niri/waybar.nix +++ /dev/null | |||
| @@ -1,358 +0,0 @@ | |||
| 1 | { lib, config, pkgs, ... }: | ||
| 2 | let | ||
| 3 | swayosd-client = lib.getExe' config.services.swayosd.package "swayosd-client"; | ||
| 4 | in { | ||
| 5 | config = { | ||
| 6 | programs.waybar = { | ||
| 7 | enable = true; | ||
| 8 | systemd = { | ||
| 9 | enable = true; | ||
| 10 | target = "graphical-session.target"; | ||
| 11 | }; | ||
| 12 | settings = let | ||
| 13 | windowRewrites = { | ||
| 14 | "(.*) — Mozilla Firefox" = "$1"; | ||
| 15 | "(.*) - Mozilla Thunderbird" = "$1"; | ||
| 16 | "(.*) - mpv" = "$1"; | ||
| 17 | }; | ||
| 18 | iconSize = 11; | ||
| 19 | in [ | ||
| 20 | { | ||
| 21 | layer = "top"; | ||
| 22 | position = "top"; | ||
| 23 | height = 21; | ||
| 24 | output = [ "eDP-1" "DP-2" "DP-3" ]; | ||
| 25 | modules-left = [ "niri/workspaces" ]; | ||
| 26 | modules-center = [ "niri/window" ]; | ||
| 27 | modules-right = [ "custom/worktime" "custom/worktime-today" | ||
| 28 | "custom/weather" | ||
| 29 | "custom/keymap" | ||
| 30 | "privacy" "tray" "wireplumber" "backlight" "battery" "idle_inhibitor" "custom/mako" "custom/lid_inhibitor" "clock" ]; | ||
| 31 | |||
| 32 | "custom/lid_inhibitor" = { | ||
| 33 | format = "{}"; | ||
| 34 | return-type = "json"; | ||
| 35 | exec = lib.getExe pkgs.waybar-systemd-inhibit; | ||
| 36 | on-click = lib.getExe' pkgs.waybar-systemd-inhibit "waybar-systemd-inhibit-toggle"; | ||
| 37 | }; | ||
| 38 | "custom/mako" = { | ||
| 39 | format = "{}"; | ||
| 40 | return-type = "json"; | ||
| 41 | exec = pkgs.writers.writePython3 "mako-silent" { libraries = [ pkgs.python3Packages.dbus-next ]; } '' | ||
| 42 | from dbus_next.aio import MessageBus | ||
| 43 | |||
| 44 | import asyncio | ||
| 45 | |||
| 46 | import json | ||
| 47 | |||
| 48 | |||
| 49 | loop = asyncio.new_event_loop() | ||
| 50 | asyncio.set_event_loop(loop) | ||
| 51 | |||
| 52 | |||
| 53 | async def main(): | ||
| 54 | bus = await MessageBus().connect() | ||
| 55 | # the introspection xml would normally be included in your project, but | ||
| 56 | # this is convenient for development | ||
| 57 | introspection = await bus.introspect('org.freedesktop.Notifications', '/fr/emersion/Mako') # noqa: E501 | ||
| 58 | |||
| 59 | obj = bus.get_proxy_object('org.freedesktop.Notifications', '/fr/emersion/Mako', introspection) # noqa: E501 | ||
| 60 | mako = obj.get_interface('fr.emersion.Mako') | ||
| 61 | properties = obj.get_interface('org.freedesktop.DBus.Properties') | ||
| 62 | |||
| 63 | async def print_mode(): | ||
| 64 | modes = await mako.get_modes() | ||
| 65 | is_silent = "silent" in modes | ||
| 66 | icon = "󰂛" if is_silent else "󰂚" | ||
| 67 | text = f"<span font=\"Symbols Nerd Font Mono\" size=\"90%\">{icon}</span>" # noqa: E501 | ||
| 68 | if is_silent: | ||
| 69 | text = f"<span color=\"#ffffff\">{text}</span>" | ||
| 70 | print(json.dumps({'text': text, 'tooltip': ', '.join(modes)}, separators=(',', ':')), flush=True) # noqa: E501 | ||
| 71 | |||
| 72 | async def on_properties_changed(interface_name, changed_properties, invalidated_properties): # noqa: E501 | ||
| 73 | if "Modes" not in invalidated_properties: | ||
| 74 | return | ||
| 75 | |||
| 76 | await print_mode() | ||
| 77 | |||
| 78 | properties.on_properties_changed(on_properties_changed) | ||
| 79 | await print_mode() | ||
| 80 | |||
| 81 | await loop.create_future() | ||
| 82 | |||
| 83 | |||
| 84 | loop.run_until_complete(main()) | ||
| 85 | ''; | ||
| 86 | on-click = "makoctl mode -t silent"; | ||
| 87 | }; | ||
| 88 | "custom/weather" = { | ||
| 89 | format = "{}"; | ||
| 90 | tooltip = true; | ||
| 91 | interval = 3600; | ||
| 92 | exec = "${lib.getExe pkgs.wttrbar} --hide-conditions --nerd --custom-indicator \"<span font=\\\"Symbols Nerd Font Mono\\\" size=\\\"100%\\\">{ICON}</span> {FeelsLikeC}°\""; | ||
| 93 | return-type = "json"; | ||
| 94 | }; | ||
| 95 | "custom/keymap" = { | ||
| 96 | format = "{}"; | ||
| 97 | tooltip = true; | ||
| 98 | return-type = "json"; | ||
| 99 | exec = pkgs.writers.writePython3 "keymap" {} '' | ||
| 100 | import os | ||
| 101 | import socket | ||
| 102 | import json | ||
| 103 | |||
| 104 | |||
| 105 | def output(keymap): | ||
| 106 | short = keymap | ||
| 107 | if keymap == "English (programmer Dvorak)": | ||
| 108 | short = "dvp" | ||
| 109 | elif keymap == "English (US)": | ||
| 110 | short = "<span color=\"#ffffff\">us</span>" | ||
| 111 | print(json.dumps({'text': short, 'tooltip': keymap}, separators=(',', ':')), flush=True) # noqa: E501 | ||
| 112 | |||
| 113 | |||
| 114 | keyboard_layouts = [] | ||
| 115 | |||
| 116 | sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) | ||
| 117 | sock.connect(os.environ["NIRI_SOCKET"]) | ||
| 118 | sock.send(b"\"EventStream\"\n") | ||
| 119 | for line in sock.makefile(buffering=1, encoding='utf-8'): | ||
| 120 | if line_json := json.loads(line): | ||
| 121 | if "KeyboardLayoutsChanged" in line_json: | ||
| 122 | keyboard_layouts = line_json["KeyboardLayoutsChanged"]["keyboard_layouts"]["names"] # noqa: E501 | ||
| 123 | output(keyboard_layouts[line_json["KeyboardLayoutsChanged"]["keyboard_layouts"]["current_idx"]]) # noqa: E501 | ||
| 124 | if "KeyboardLayoutSwitched" in line_json: | ||
| 125 | output(keyboard_layouts[line_json["KeyboardLayoutSwitched"]["idx"]]) # noqa: E501 | ||
| 126 | ''; | ||
| 127 | on-click = "niri msg action switch-layout next"; | ||
| 128 | }; | ||
| 129 | "custom/worktime" = { | ||
| 130 | interval = 60; | ||
| 131 | exec = "${lib.getExe pkgs.worktime} time --waybar"; | ||
| 132 | return-type = "json"; | ||
| 133 | }; | ||
| 134 | "custom/worktime-today" = { | ||
| 135 | interval = 60; | ||
| 136 | exec = "${lib.getExe pkgs.worktime} today --waybar"; | ||
| 137 | return-type = "json"; | ||
| 138 | }; | ||
| 139 | "niri/workspaces" = { | ||
| 140 | ignore = map ({ name, ... }: name) config.programs.niri.scratchspaces; | ||
| 141 | }; | ||
| 142 | "niri/window" = { | ||
| 143 | separate-outputs = true; | ||
| 144 | icon = true; | ||
| 145 | icon-size = 14; | ||
| 146 | rewrite = windowRewrites; | ||
| 147 | }; | ||
| 148 | clock = { | ||
| 149 | interval = 1; | ||
| 150 | # timezone = "Europe/Berlin"; | ||
| 151 | format = "W{:%V-%u %F %H:%M:%S%Ez}"; | ||
| 152 | tooltip-format = "<tt><small>{calendar}</small></tt>"; | ||
| 153 | calendar = { | ||
| 154 | mode = "year"; | ||
| 155 | mode-mon-col = 3; | ||
| 156 | weeks-pos = "left"; | ||
| 157 | on-scroll = 1; | ||
| 158 | format = { | ||
| 159 | months = "<span color='#ffead3'><b>{}</b></span>"; | ||
| 160 | days = "{}"; | ||
| 161 | weeks = "<span color='#99ffdd'><b>{}</b></span>"; | ||
| 162 | weekdays = "<span color='#ffcc66'><b>{}</b></span>"; | ||
| 163 | today = "<span color='#ff6699'><b>{}</b></span>"; | ||
| 164 | }; | ||
| 165 | }; | ||
| 166 | }; | ||
| 167 | battery = { | ||
| 168 | format = "<span font=\"Symbols Nerd Font Mono\" size=\"90%\">{icon}</span>"; | ||
| 169 | icon-size = iconSize - 2; | ||
| 170 | states = { warning = 30; critical = 15; }; | ||
| 171 | format-icons = ["󰂎" "󰁺" "󰁻" "󰁼" "󰁽" "󰁾" "󰁿" "󰂀" "󰂁" "󰂂" "󰁹" ]; | ||
| 172 | format-charging = "󰂄"; | ||
| 173 | format-plugged = "󰚥"; | ||
| 174 | tooltip-format = "{capacity}% {timeTo}"; | ||
| 175 | interval = 20; | ||
| 176 | }; | ||
| 177 | tray = { | ||
| 178 | icon-size = 16; | ||
| 179 | # show-passive-items = true; | ||
| 180 | spacing = 1; | ||
| 181 | }; | ||
| 182 | privacy = { | ||
| 183 | icon-spacing = 7; | ||
| 184 | icon-size = iconSize; | ||
| 185 | modules = [ | ||
| 186 | { type = "screenshare"; } | ||
| 187 | { type = "audio-in"; } | ||
| 188 | ]; | ||
| 189 | }; | ||
| 190 | idle_inhibitor = { | ||
| 191 | format = "<span font=\"Symbols Nerd Font Mono\" size=\"90%\">{icon}</span>"; | ||
| 192 | icon-size = iconSize; | ||
| 193 | format-icons = { activated = "󰈈"; deactivated = "󰈉"; }; | ||
| 194 | timeout = 120; | ||
| 195 | }; | ||
| 196 | backlight = { | ||
| 197 | format = "<span font=\"Symbols Nerd Font Mono\" size=\"90%\">{icon}</span>"; | ||
| 198 | icon-size = iconSize; | ||
| 199 | tooltip-format = "{percent}%"; | ||
| 200 | format-icons = ["󰃚" "󰃛" "󰃜" "󰃝" "󰃞" "󰃟" "󰃠"]; | ||
| 201 | on-scroll-up = "${swayosd-client} --brightness raise"; | ||
| 202 | on-scroll-down = "${swayosd-client} --brightness lower"; | ||
| 203 | }; | ||
| 204 | wireplumber = { | ||
| 205 | format = "<span font=\"Symbols Nerd Font Mono\" size=\"90%\">{icon}</span>"; | ||
| 206 | icon-size = iconSize; | ||
| 207 | tooltip-format = "{volume}% {node_name}"; | ||
| 208 | format-icons = ["󰕿" "󰖀" "󰕾"]; | ||
| 209 | format-muted = "<span font=\"Symbols Nerd Font Mono\" size=\"90%\">󰝟</span>"; | ||
| 210 | # ignored-sinks = ["Easy Effects Sink"]; | ||
| 211 | on-scroll-up = "${swayosd-client} --output-volume raise"; | ||
| 212 | on-scroll-down = "${swayosd-client} --output-volume lower"; | ||
| 213 | on-click = "${swayosd-client} --output-volume mute-toggle"; | ||
| 214 | }; | ||
| 215 | } | ||
| 216 | { | ||
| 217 | layer = "top"; | ||
| 218 | position = "top"; | ||
| 219 | height = 14; | ||
| 220 | output = [ "!eDP-1" "!DP-2" "!DP-3" "*" ]; | ||
| 221 | modules-left = [ "niri/workspaces" ]; | ||
| 222 | modules-center = [ "niri/window" ]; | ||
| 223 | modules-right = [ "clock" ]; | ||
| 224 | |||
| 225 | "niri/workspaces" = { | ||
| 226 | ignore = map ({ name, ... }: name) config.programs.niri.scratchspaces; | ||
| 227 | }; | ||
| 228 | "niri/window" = { | ||
| 229 | separate-outputs = true; | ||
| 230 | icon = true; | ||
| 231 | icon-size = 14; | ||
| 232 | rewrite = windowRewrites; | ||
| 233 | }; | ||
| 234 | clock = { | ||
| 235 | interval = 1; | ||
| 236 | # timezone = "Europe/Berlin"; | ||
| 237 | format = "{:%H:%M}"; | ||
| 238 | tooltip-format = "W{:%V-%u %F %H:%M:%S%Ez}"; | ||
| 239 | }; | ||
| 240 | } | ||
| 241 | ]; | ||
| 242 | style = '' | ||
| 243 | @define-color white #ffffff; | ||
| 244 | @define-color grey #555555; | ||
| 245 | @define-color blue #1a8fff; | ||
| 246 | @define-color green #23fd00; | ||
| 247 | @define-color orange #f28a21; | ||
| 248 | @define-color red #f2201f; | ||
| 249 | |||
| 250 | * { | ||
| 251 | border: none; | ||
| 252 | font-family: "Fira Sans"; | ||
| 253 | font-size: 10pt; | ||
| 254 | min-height: 0; | ||
| 255 | } | ||
| 256 | |||
| 257 | window#waybar { | ||
| 258 | background-color: rgba(0, 0, 0, 0.66); | ||
| 259 | color: @white; | ||
| 260 | } | ||
| 261 | |||
| 262 | .modules-left { | ||
| 263 | margin-left: 38px; | ||
| 264 | } | ||
| 265 | .modules-right { | ||
| 266 | margin-right: 38px; | ||
| 267 | } | ||
| 268 | |||
| 269 | .module { | ||
| 270 | margin: 0 5px; | ||
| 271 | } | ||
| 272 | |||
| 273 | #workspaces button { | ||
| 274 | color: @white; | ||
| 275 | padding: 2px 5px; | ||
| 276 | } | ||
| 277 | #workspaces button.empty { | ||
| 278 | color: @grey; | ||
| 279 | } | ||
| 280 | #workspaces button.active { | ||
| 281 | color: @green; | ||
| 282 | } | ||
| 283 | #workspaces button.urgent { | ||
| 284 | color: @red; | ||
| 285 | } | ||
| 286 | |||
| 287 | #custom-weather, #custom-keymap, #custom-worktime, #custom-worktime-today { | ||
| 288 | color: @grey; | ||
| 289 | margin: 0 5px; | ||
| 290 | } | ||
| 291 | #custom-weather { | ||
| 292 | margin-right: 3px; | ||
| 293 | } | ||
| 294 | #custom-keymap { | ||
| 295 | margin-left: 3px; | ||
| 296 | margin-right: 3px; | ||
| 297 | } | ||
| 298 | |||
| 299 | #tray { | ||
| 300 | margin: 0; | ||
| 301 | } | ||
| 302 | #battery, #idle_inhibitor, #backlight, #wireplumber, #custom-mako, #custom-lid_inhibitor { | ||
| 303 | color: @grey; | ||
| 304 | margin: 0 5px 0 2px; | ||
| 305 | } | ||
| 306 | #idle_inhibitor { | ||
| 307 | margin-right: 4px; | ||
| 308 | margin-left: 6px; | ||
| 309 | } | ||
| 310 | #custom-mako { | ||
| 311 | margin-right: 4px; | ||
| 312 | margin-left: 3px; | ||
| 313 | } | ||
| 314 | #custom-lid_inhibitor { | ||
| 315 | margin-right: 3px; | ||
| 316 | margin-left: 3px; | ||
| 317 | } | ||
| 318 | #battery { | ||
| 319 | margin-right: 3px; | ||
| 320 | } | ||
| 321 | #battery.discharging { | ||
| 322 | color: @white; | ||
| 323 | } | ||
| 324 | #battery.warning { | ||
| 325 | color: @orange; | ||
| 326 | } | ||
| 327 | #battery.critical { | ||
| 328 | color: @red; | ||
| 329 | } | ||
| 330 | #battery.charging { | ||
| 331 | color: @white; | ||
| 332 | } | ||
| 333 | #idle_inhibitor.activated { | ||
| 334 | color: @white; | ||
| 335 | } | ||
| 336 | #custom-worktime.running, #custom-worktime-today.running { | ||
| 337 | color: @white; | ||
| 338 | } | ||
| 339 | #custom-worktime.over, #custom-worktime-today.over { | ||
| 340 | color: @orange; | ||
| 341 | } | ||
| 342 | |||
| 343 | #idle_inhibitor, #custom-lid_inhibitor { | ||
| 344 | padding-top: 1px; | ||
| 345 | } | ||
| 346 | |||
| 347 | #privacy { | ||
| 348 | color: @red; | ||
| 349 | margin: -1px 4px 0px 3px; | ||
| 350 | } | ||
| 351 | #clock { | ||
| 352 | /* margin-right: 5px; */ | ||
| 353 | font-feature-settings: "tnum"; | ||
| 354 | } | ||
| 355 | ''; | ||
| 356 | }; | ||
| 357 | }; | ||
| 358 | } | ||
