diff options
| author | Gregor Kleen <gkleen@yggdrasil.li> | 2025-01-14 11:30:32 +0100 |
|---|---|---|
| committer | Gregor Kleen <gkleen@yggdrasil.li> | 2025-01-14 11:30:32 +0100 |
| commit | 21b52a31e1eff5c8142f26e091fde083c21db55f (patch) | |
| tree | 650eb693d91b353c866c42dfae49b7c5daee5ca9 /accounts/gkleen@sif/default.nix | |
| parent | bef130240c10b90d912aa06239402a6ad98867fe (diff) | |
| download | nixos-21b52a31e1eff5c8142f26e091fde083c21db55f.tar nixos-21b52a31e1eff5c8142f26e091fde083c21db55f.tar.gz nixos-21b52a31e1eff5c8142f26e091fde083c21db55f.tar.bz2 nixos-21b52a31e1eff5c8142f26e091fde083c21db55f.tar.xz nixos-21b52a31e1eff5c8142f26e091fde083c21db55f.zip | |
niri
Diffstat (limited to 'accounts/gkleen@sif/default.nix')
| -rw-r--r-- | accounts/gkleen@sif/default.nix | 309 |
1 files changed, 6 insertions, 303 deletions
diff --git a/accounts/gkleen@sif/default.nix b/accounts/gkleen@sif/default.nix index 83dcf989..bcfd1224 100644 --- a/accounts/gkleen@sif/default.nix +++ b/accounts/gkleen@sif/default.nix | |||
| @@ -92,6 +92,7 @@ in { | |||
| 92 | home-manager.users.${userName} = { | 92 | home-manager.users.${userName} = { |
| 93 | imports = [ | 93 | imports = [ |
| 94 | ./libvirt | 94 | ./libvirt |
| 95 | ./niri | ||
| 95 | flakeInputs.nix-index-database.hmModules.nix-index | 96 | flakeInputs.nix-index-database.hmModules.nix-index |
| 96 | flakeInputs.impermanence.nixosModules.home-manager.impermanence | 97 | flakeInputs.impermanence.nixosModules.home-manager.impermanence |
| 97 | ]; | 98 | ]; |
| @@ -250,287 +251,6 @@ in { | |||
| 250 | "kitty_mod+m" = "detach_window ask"; | 251 | "kitty_mod+m" = "detach_window ask"; |
| 251 | }; | 252 | }; |
| 252 | }; | 253 | }; |
| 253 | waybar = { | ||
| 254 | enable = true; | ||
| 255 | systemd = { | ||
| 256 | enable = true; | ||
| 257 | target = "hyprland-session.target"; | ||
| 258 | }; | ||
| 259 | settings = let | ||
| 260 | windowRewrites = { | ||
| 261 | "(.*) — Mozilla Firefox" = "$1"; | ||
| 262 | "(.*) - Mozilla Thunderbird" = "$1"; | ||
| 263 | "(.*) - mpv" = "$1"; | ||
| 264 | }; | ||
| 265 | iconSize = 11; | ||
| 266 | in [ | ||
| 267 | { | ||
| 268 | layer = "top"; | ||
| 269 | position = "top"; | ||
| 270 | height = 14; | ||
| 271 | output = [ "eDP-1" "DP-2" "DP-3" ]; | ||
| 272 | modules-left = [ "hyprland/workspaces" ]; | ||
| 273 | modules-center = [ "hyprland/window" ]; | ||
| 274 | modules-right = [ # "custom/worktime" "custom/worktime-today" | ||
| 275 | "custom/weather" "custom/keymap" "privacy" "tray" "wireplumber" "backlight" "battery" "idle_inhibitor" "clock" ]; | ||
| 276 | |||
| 277 | "custom/weather" = { | ||
| 278 | format = "{}"; | ||
| 279 | tooltip = true; | ||
| 280 | interval = 3600; | ||
| 281 | exec = "${lib.getExe pkgs.wttrbar} --hide-conditions --nerd --custom-indicator \"<span font=\\\"Symbols Nerd Font Mono\\\" size=\\\"120%\\\">{ICON}</span> {FeelsLikeC}°\""; | ||
| 282 | return-type = "json"; | ||
| 283 | }; | ||
| 284 | "custom/keymap" = { | ||
| 285 | format = "{}"; | ||
| 286 | tooltip = true; | ||
| 287 | return-type = "json"; | ||
| 288 | exec = pkgs.writers.writePython3 "keymap" {} '' | ||
| 289 | import os | ||
| 290 | import socket | ||
| 291 | import re | ||
| 292 | import subprocess | ||
| 293 | import json | ||
| 294 | |||
| 295 | |||
| 296 | def output(keymap): | ||
| 297 | short = keymap | ||
| 298 | if keymap == "English (programmer Dvorak)": | ||
| 299 | short = "dvp" | ||
| 300 | elif keymap == "English (US)": | ||
| 301 | short = "<span color=\"#ffffff\">us</span>" | ||
| 302 | print(json.dumps({'text': short, 'tooltip': keymap}, separators=(',', ':')), flush=True) # noqa: E501 | ||
| 303 | |||
| 304 | |||
| 305 | r = subprocess.run(["hyprctl", "devices", "-j"], check=True, stdout=subprocess.PIPE, text=True) # noqa: E501 | ||
| 306 | for keyboard in json.loads(r.stdout)['keyboards']: | ||
| 307 | if keyboard['name'] != "at-translated-set-2-keyboard": | ||
| 308 | continue | ||
| 309 | output(keyboard['active_keymap']) | ||
| 310 | |||
| 311 | sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) | ||
| 312 | sock.connect(os.environ["XDG_RUNTIME_DIR"] + "/hypr/" + os.environ["HYPRLAND_INSTANCE_SIGNATURE"] + "/.socket2.sock") # noqa: E501 | ||
| 313 | expected = re.compile(r'^activelayout>>at-translated-set-2-keyboard,(?P<keymap>.+)$') # noqa: E501 | ||
| 314 | for line in sock.makefile(buffering=1, encoding='utf-8'): | ||
| 315 | if match := expected.match(line): | ||
| 316 | output(match.group("keymap")) | ||
| 317 | ''; | ||
| 318 | on-click = "hyprctl switchxkblayout at-translated-set-2-keyboard next"; | ||
| 319 | }; | ||
| 320 | "custom/worktime" = { | ||
| 321 | interval = 60; | ||
| 322 | exec = getExe pkgs.worktime; | ||
| 323 | tooltip = false; | ||
| 324 | }; | ||
| 325 | "custom/worktime-today" = { | ||
| 326 | interval = 60; | ||
| 327 | exec = "${getExe pkgs.worktime} today"; | ||
| 328 | tooltip = false; | ||
| 329 | }; | ||
| 330 | "hyprland/workspaces" = { | ||
| 331 | all-outputs = true; | ||
| 332 | }; | ||
| 333 | "hyprland/window" = { | ||
| 334 | separate-outputs = true; | ||
| 335 | icon = true; | ||
| 336 | icon-size = 14; | ||
| 337 | rewrite = windowRewrites; | ||
| 338 | }; | ||
| 339 | clock = { | ||
| 340 | interval = 1; | ||
| 341 | # timezone = "Europe/Berlin"; | ||
| 342 | format = "W{:%V-%u %F %H:%M:%S%Ez}"; | ||
| 343 | tooltip-format = "<tt><small>{calendar}</small></tt>"; | ||
| 344 | calendar = { | ||
| 345 | mode = "year"; | ||
| 346 | mode-mon-col = 3; | ||
| 347 | weeks-pos = "left"; | ||
| 348 | on-scroll = 1; | ||
| 349 | format = { | ||
| 350 | months = "<span color='#ffead3'><b>{}</b></span>"; | ||
| 351 | days = "{}"; | ||
| 352 | weeks = "<span color='#99ffdd'><b>{}</b></span>"; | ||
| 353 | weekdays = "<span color='#ffcc66'><b>{}</b></span>"; | ||
| 354 | today = "<span color='#ff6699'><b>{}</b></span>"; | ||
| 355 | }; | ||
| 356 | }; | ||
| 357 | }; | ||
| 358 | battery = { | ||
| 359 | format = "<span font=\"Symbols Nerd Font Mono\" size=\"90%\">{icon}</span>"; | ||
| 360 | icon-size = iconSize - 2; | ||
| 361 | states = { warning = 30; critical = 15; }; | ||
| 362 | format-icons = ["󰂎" "󰁺" "󰁻" "󰁼" "󰁽" "󰁾" "󰁿" "󰂀" "󰂁" "󰂂" "󰁹" ]; | ||
| 363 | format-charging = "󰂄"; | ||
| 364 | format-plugged = "󰚥"; | ||
| 365 | tooltip-format = "{capacity}% {timeTo}"; | ||
| 366 | interval = 20; | ||
| 367 | }; | ||
| 368 | tray = { | ||
| 369 | icon-size = 16; | ||
| 370 | # show-passive-items = true; | ||
| 371 | spacing = 1; | ||
| 372 | }; | ||
| 373 | privacy = { | ||
| 374 | icon-spacing = 7; | ||
| 375 | icon-size = iconSize; | ||
| 376 | modules = [ | ||
| 377 | { type = "screenshare"; } | ||
| 378 | { type = "audio-in"; } | ||
| 379 | ]; | ||
| 380 | }; | ||
| 381 | idle_inhibitor = { | ||
| 382 | format = "<span font=\"Symbols Nerd Font Mono\" size=\"90%\">{icon}</span>"; | ||
| 383 | icon-size = iconSize; | ||
| 384 | format-icons = { activated = "󰈈"; deactivated = "󰈉"; }; | ||
| 385 | timeout = 120; | ||
| 386 | }; | ||
| 387 | backlight = { | ||
| 388 | format = "<span font=\"Symbols Nerd Font Mono\" size=\"90%\">{icon}</span>"; | ||
| 389 | icon-size = iconSize; | ||
| 390 | tooltip-format = "{percent}%"; | ||
| 391 | format-icons = ["󰃚" "󰃛" "󰃜" "󰃝" "󰃞" "󰃟" "󰃠"]; | ||
| 392 | on-scroll-up = "lightctl -d -e4 -n1 up"; | ||
| 393 | on-scroll-down = "lightctl -d -e4 -n1 down"; | ||
| 394 | }; | ||
| 395 | wireplumber = { | ||
| 396 | format = "<span font=\"Symbols Nerd Font Mono\" size=\"90%\">{icon}</span>"; | ||
| 397 | icon-size = iconSize; | ||
| 398 | tooltip-format = "{volume}% {node_name}"; | ||
| 399 | format-icons = ["󰕿" "󰖀" "󰕾"]; | ||
| 400 | format-muted = "<span font=\"Symbols Nerd Font Mono\" size=\"90%\">󰝟</span>"; | ||
| 401 | # ignored-sinks = ["Easy Effects Sink"]; | ||
| 402 | on-scroll-up = "volumectl -d -u up"; | ||
| 403 | on-scroll-down = "volumectl -d -u down"; | ||
| 404 | on-click = "volumectl -d toggle-mute"; | ||
| 405 | }; | ||
| 406 | } | ||
| 407 | { | ||
| 408 | layer = "top"; | ||
| 409 | position = "top"; | ||
| 410 | height = 14; | ||
| 411 | output = [ "!eDP-1" "!DP-2" "!DP-3" ]; | ||
| 412 | modules-left = [ "hyprland/workspaces" ]; | ||
| 413 | modules-center = [ "hyprland/window" ]; | ||
| 414 | modules-right = [ "clock" ]; | ||
| 415 | |||
| 416 | "hyprland/workspaces" = { | ||
| 417 | all-outputs = false; | ||
| 418 | }; | ||
| 419 | "hyprland/window" = { | ||
| 420 | separate-outputs = true; | ||
| 421 | icon = true; | ||
| 422 | icon-size = 14; | ||
| 423 | rewrite = windowRewrites; | ||
| 424 | }; | ||
| 425 | clock = { | ||
| 426 | interval = 1; | ||
| 427 | # timezone = "Europe/Berlin"; | ||
| 428 | format = "{:%H:%M}"; | ||
| 429 | tooltip-format = "W{:%V-%u %F %H:%M:%S%Ez}"; | ||
| 430 | }; | ||
| 431 | } | ||
| 432 | ]; | ||
| 433 | style = '' | ||
| 434 | @define-color white #ffffff; | ||
| 435 | @define-color grey #555555; | ||
| 436 | @define-color blue #1a8fff; | ||
| 437 | @define-color green #23fd00; | ||
| 438 | @define-color orange #f28a21; | ||
| 439 | @define-color red #f2201f; | ||
| 440 | |||
| 441 | * { | ||
| 442 | border: none; | ||
| 443 | font-family: "Fira Sans Nerd Font"; | ||
| 444 | font-size: 10pt; | ||
| 445 | min-height: 0; | ||
| 446 | } | ||
| 447 | |||
| 448 | window#waybar { | ||
| 449 | background-color: rgba(0, 0, 0, 0.66); | ||
| 450 | color: @white; | ||
| 451 | } | ||
| 452 | |||
| 453 | .modules-left { | ||
| 454 | margin-left: 9px; | ||
| 455 | } | ||
| 456 | .modules-right { | ||
| 457 | margin-right: 9px; | ||
| 458 | } | ||
| 459 | |||
| 460 | .module { | ||
| 461 | margin: 0 5px; | ||
| 462 | } | ||
| 463 | |||
| 464 | #workspaces button { | ||
| 465 | color: @grey; | ||
| 466 | } | ||
| 467 | #workspaces button.hosting-monitor { | ||
| 468 | color: @white; | ||
| 469 | } | ||
| 470 | #workspaces button.visible { | ||
| 471 | color: @blue; | ||
| 472 | } | ||
| 473 | #workspaces button.active { | ||
| 474 | color: @green; | ||
| 475 | } | ||
| 476 | #workspaces button.urgent { | ||
| 477 | color: @red; | ||
| 478 | } | ||
| 479 | |||
| 480 | #custom-weather, #custom-keymap, #custom-worktime, #custom-worktime-today { | ||
| 481 | color: @grey; | ||
| 482 | margin: 0 5px; | ||
| 483 | } | ||
| 484 | #custom-weather, #custom-worktime-today { | ||
| 485 | margin-right: 3px; | ||
| 486 | } | ||
| 487 | #custom-keymap, #custom-weather { | ||
| 488 | margin-left: 3px; | ||
| 489 | } | ||
| 490 | |||
| 491 | #tray { | ||
| 492 | margin: 0; | ||
| 493 | } | ||
| 494 | #battery, #idle_inhibitor, #backlight, #wireplumber { | ||
| 495 | color: @grey; | ||
| 496 | margin: 0 5px 0 2px; | ||
| 497 | } | ||
| 498 | #idle_inhibitor { | ||
| 499 | margin-right: 2px; | ||
| 500 | margin-left: 3px; | ||
| 501 | } | ||
| 502 | #battery { | ||
| 503 | margin-right: 3px; | ||
| 504 | } | ||
| 505 | #battery.discharging { | ||
| 506 | color: @white; | ||
| 507 | } | ||
| 508 | #battery.warning { | ||
| 509 | color: @orange; | ||
| 510 | } | ||
| 511 | #battery.critical { | ||
| 512 | color: @red; | ||
| 513 | } | ||
| 514 | #battery.charging { | ||
| 515 | color: @white; | ||
| 516 | } | ||
| 517 | #idle_inhibitor.activated { | ||
| 518 | color: @white; | ||
| 519 | } | ||
| 520 | |||
| 521 | #idle_inhibitor { | ||
| 522 | padding-top: 1px; | ||
| 523 | } | ||
| 524 | |||
| 525 | #privacy { | ||
| 526 | color: @red; | ||
| 527 | margin: -1px 2px 0px 5px; | ||
| 528 | } | ||
| 529 | #clock { | ||
| 530 | /* margin-right: 5px; */ | ||
| 531 | } | ||
| 532 | ''; | ||
| 533 | }; | ||
| 534 | wpaperd = { | 254 | wpaperd = { |
| 535 | enable = true; | 255 | enable = true; |
| 536 | settings.default = { | 256 | settings.default = { |
| @@ -543,7 +263,7 @@ in { | |||
| 543 | enable = true; | 263 | enable = true; |
| 544 | settings = { | 264 | settings = { |
| 545 | main = { | 265 | main = { |
| 546 | terminal = lib.getExe pkgs.kitty; | 266 | terminal = lib.getExe cfg.programs.kitty.package; |
| 547 | layer = "overlay"; | 267 | layer = "overlay"; |
| 548 | icon-theme = "Paper"; | 268 | icon-theme = "Paper"; |
| 549 | font = "Fira Sans"; | 269 | font = "Fira Sans"; |
| @@ -639,13 +359,13 @@ in { | |||
| 639 | enable = true; | 359 | enable = true; |
| 640 | events = [ | 360 | events = [ |
| 641 | { event = "before-sleep"; command = lockCommand; } | 361 | { event = "before-sleep"; command = lockCommand; } |
| 642 | { event = "after-resume"; command = "${cfg.wayland.windowManager.hyprland.package}/bin/hyprctl dispatch dpms on"; } | 362 | # { event = "after-resume"; command = "${cfg.wayland.windowManager.hyprland.package}/bin/hyprctl dispatch dpms on"; } |
| 643 | { event = "lock"; command = lockCommand; } | 363 | { event = "lock"; command = lockCommand; } |
| 644 | ]; | 364 | ]; |
| 645 | timeouts = [ | 365 | timeouts = [ |
| 646 | { timeout = 300; | 366 | # { timeout = 300; |
| 647 | command = "${cfg.wayland.windowManager.hyprland.package}/bin/hyprctl dispatch dpms off"; | 367 | # command = "${cfg.wayland.windowManager.hyprland.package}/bin/hyprctl dispatch dpms off"; |
| 648 | } | 368 | # } |
| 649 | { timeout = 330; command = lockCommand; } | 369 | { timeout = 330; command = lockCommand; } |
| 650 | ]; | 370 | ]; |
| 651 | extraArgs = [ | 371 | extraArgs = [ |
| @@ -927,23 +647,6 @@ in { | |||
| 927 | color-scheme = "prefer-dark"; | 647 | color-scheme = "prefer-dark"; |
| 928 | }; | 648 | }; |
| 929 | }; | 649 | }; |
| 930 | |||
| 931 | wayland.windowManager.hyprland = { | ||
| 932 | enable = true; | ||
| 933 | settings = import ./hyprland.nix inputs; | ||
| 934 | }; | ||
| 935 | |||
| 936 | xdg.portal = { | ||
| 937 | enable = true; | ||
| 938 | xdgOpenUsePortal = true; | ||
| 939 | config = { | ||
| 940 | common.default = [ "gtk" ]; | ||
| 941 | hyprland.default = [ "gtk" "kde" "hyprland" ]; | ||
| 942 | }; | ||
| 943 | extraPortals = with pkgs; [ | ||
| 944 | xdg-desktop-portal-kde xdg-desktop-portal-gtk xdg-desktop-portal-wlr xdg-desktop-portal-hyprland | ||
| 945 | ]; | ||
| 946 | }; | ||
| 947 | }; | 650 | }; |
| 948 | }; | 651 | }; |
| 949 | } | 652 | } |
