From 2ef8078e6ec07636f74a8ae854c76cf092fa5475 Mon Sep 17 00:00:00 2001 From: Charlie Root Date: Sun, 5 May 2024 21:33:33 +0200 Subject: [PATCH] more hyprland fixed --- flake.lock | 281 +++++++++++++++++++++++++- flake.nix | 3 + hosts/vali/mars/configuration.nix | 2 +- hosts/vali/mars/hyprland/hyprland.nix | 94 ++++++++- hosts/vali/mars/programs.nix | 1 + modules/cli/fish.nix | 2 +- 6 files changed, 376 insertions(+), 7 deletions(-) diff --git a/flake.lock b/flake.lock index bab3cae..4e20c99 100644 --- a/flake.lock +++ b/flake.lock @@ -216,6 +216,21 @@ } }, "flake-compat_2": { + "locked": { + "lastModified": 1688025799, + "narHash": "sha256-ktpB4dRtnksm9F5WawoIkEneh1nrEvuxb5lJFt1iOyw=", + "owner": "nix-community", + "repo": "flake-compat", + "rev": "8bf105319d44f6b9f0d764efa4fdef9f1cc9ba1c", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_3": { "flake": false, "locked": { "lastModified": 1673956053, @@ -231,6 +246,22 @@ "type": "github" } }, + "flake-compat_4": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-parts": { "inputs": { "nixpkgs-lib": [ @@ -294,6 +325,28 @@ "type": "indirect" } }, + "flake-parts_4": { + "inputs": { + "nixpkgs-lib": [ + "nixpkgs-wayland", + "nix-eval-jobs", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1712014858, + "narHash": "sha256-sB4SWl2lX95bExY2gMFG5HIzvva5AVMJd4Igm+GpZNw=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "9126214d0a59633752a136528f5f3b9aa8565b7d", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, "flake-utils": { "inputs": { "systems": "systems_3" @@ -312,6 +365,24 @@ "type": "github" } }, + "flake-utils_2": { + "inputs": { + "systems": "systems_4" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "fromYaml": { "flake": false, "locked": { @@ -585,6 +656,25 @@ "type": "github" } }, + "lib-aggregate": { + "inputs": { + "flake-utils": "flake-utils_2", + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1714910950, + "narHash": "sha256-gaq5bphSsY+htEXFDkImOrH3MVCkxFTvCiwdCJj096E=", + "owner": "nix-community", + "repo": "lib-aggregate", + "rev": "26fabca301e1133abd3d9192b1bcb6fb45b30f1d", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "lib-aggregate", + "type": "github" + } + }, "neovim-flake": { "inputs": { "flake-utils": "flake-utils", @@ -631,6 +721,27 @@ "type": "github" } }, + "nix-eval-jobs": { + "inputs": { + "flake-parts": "flake-parts_4", + "nix-github-actions": "nix-github-actions", + "nixpkgs": "nixpkgs_5", + "treefmt-nix": "treefmt-nix" + }, + "locked": { + "lastModified": 1713858845, + "narHash": "sha256-StJq7Zy+/iVBUAKFzhHWlsirFucZ3gNtzXhAYXAsNnw=", + "owner": "nix-community", + "repo": "nix-eval-jobs", + "rev": "7b6640f2a10701bf0db16aff048070f400e8ea7c", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nix-eval-jobs", + "type": "github" + } + }, "nix-filter": { "locked": { "lastModified": 1693833173, @@ -646,6 +757,28 @@ "type": "github" } }, + "nix-github-actions": { + "inputs": { + "nixpkgs": [ + "nixpkgs-wayland", + "nix-eval-jobs", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1703863825, + "narHash": "sha256-rXwqjtwiGKJheXB43ybM8NwWB8rO2dSRrEqes0S7F5Y=", + "owner": "nix-community", + "repo": "nix-github-actions", + "rev": "5163432afc817cf8bd1f031418d1869e4c9d5547", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nix-github-actions", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1703013332, @@ -662,6 +795,42 @@ "type": "github" } }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1714870069, + "narHash": "sha256-CNCqCGOHdxuiVnVkhTpp2WcqSSmSfeQjubhDOcgwGjU=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "4b620020fd73bdd5104e32c702e65b60b6869426", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "nixpkgs-wayland": { + "inputs": { + "flake-compat": "flake-compat_2", + "lib-aggregate": "lib-aggregate", + "nix-eval-jobs": "nix-eval-jobs", + "nixpkgs": "nixpkgs_6" + }, + "locked": { + "lastModified": 1714926024, + "narHash": "sha256-LbSVziNYk/nxfYeyxKNhV/ryfbCUUZVlWoG5KG0sOxk=", + "owner": "nix-community", + "repo": "nixpkgs-wayland", + "rev": "eb44cc5dcc75c33e7f246c9f38b96f158b3f6e9d", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs-wayland", + "type": "github" + } + }, "nixpkgs_2": { "locked": { "lastModified": 1714253743, @@ -711,6 +880,38 @@ } }, "nixpkgs_5": { + "locked": { + "lastModified": 1713805509, + "narHash": "sha256-YgSEan4CcrjivCNO5ZNzhg7/8ViLkZ4CB/GrGBVSudo=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "1e1dc66fe68972a76679644a5577828b6a7e8be4", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_6": { + "locked": { + "lastModified": 1714763106, + "narHash": "sha256-DrDHo74uTycfpAF+/qxZAMlP/Cpe04BVioJb6fdI0YY=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "e9be42459999a253a9f92559b1f5b72e1b44c13d", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_7": { "locked": { "lastModified": 1713596654, "narHash": "sha256-LJbHQQ5aX1LVth2ST+Kkse/DRzgxlVhTL1rxthvyhZc=", @@ -726,6 +927,22 @@ "type": "github" } }, + "nixpkgs_8": { + "locked": { + "lastModified": 1711163522, + "narHash": "sha256-YN/Ciidm+A0fmJPWlHBGvVkcarYWSC+s3NTPk/P+q3c=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "44d0940ea560dee511026a53f0e2e2cde489b4d4", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "nur": { "locked": { "lastModified": 1714905988, @@ -751,9 +968,11 @@ "hyprland-plugins": "hyprland-plugins", "neovim-nightly-overlay": "neovim-nightly-overlay", "nixpkgs": "nixpkgs_4", + "nixpkgs-wayland": "nixpkgs-wayland", "nur": "nur", "split-monitor-workspaces": "split-monitor-workspaces", - "stylix": "stylix" + "stylix": "stylix", + "waybar": "waybar" } }, "rust-analyzer-src": { @@ -803,10 +1022,10 @@ "base16-kitty": "base16-kitty", "base16-tmux": "base16-tmux", "base16-vim": "base16-vim", - "flake-compat": "flake-compat_2", + "flake-compat": "flake-compat_3", "gnome-shell": "gnome-shell", "home-manager": "home-manager_3", - "nixpkgs": "nixpkgs_5" + "nixpkgs": "nixpkgs_7" }, "locked": { "lastModified": 1714555012, @@ -867,6 +1086,62 @@ "type": "github" } }, + "systems_4": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "nixpkgs-wayland", + "nix-eval-jobs", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1711963903, + "narHash": "sha256-N3QDhoaX+paWXHbEXZapqd1r95mdshxToGowtjtYkGI=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "49dc4a92b02b8e68798abd99184f228243b6e3ac", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + }, + "waybar": { + "inputs": { + "flake-compat": "flake-compat_4", + "nixpkgs": "nixpkgs_8" + }, + "locked": { + "lastModified": 1714718861, + "narHash": "sha256-mCQdrn0Y3oOVZP/CileWAhuBX6aARBNrfxyqJBB4NxA=", + "owner": "Alexays", + "repo": "Waybar", + "rev": "231d6972d7a023e9358ab7deda509baac49006cb", + "type": "github" + }, + "original": { + "owner": "Alexays", + "repo": "Waybar", + "type": "github" + } + }, "xdph": { "inputs": { "hyprland-protocols": "hyprland-protocols", diff --git a/flake.nix b/flake.nix index 92c8ee9..27cf670 100644 --- a/flake.nix +++ b/flake.nix @@ -13,6 +13,8 @@ url = "github:hyprwm/hyprland-plugins"; inputs.hyprland.follows = "hyprland"; }; + + nixpkgs-wayland.url = "github:nix-community/nixpkgs-wayland"; split-monitor-workspaces = { url = "github:Duckonaut/split-monitor-workspaces"; inputs.hyprland.follows = "hyprland"; @@ -36,6 +38,7 @@ neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay"; + waybar.url = "github:Alexays/Waybar"; fenix = { url = "github:nix-community/fenix"; inputs.nixpkgs.follows = "nixpkgs"; diff --git a/hosts/vali/mars/configuration.nix b/hosts/vali/mars/configuration.nix index 7fa6e3c..842309c 100644 --- a/hosts/vali/mars/configuration.nix +++ b/hosts/vali/mars/configuration.nix @@ -34,7 +34,7 @@ system = { hostname = "mars"; username = "vali"; - gitPath = "/home/vali/Git/nichts"; + gitPath = "/home/vali/repos/nichts"; }; home-manager = { enable = true; diff --git a/hosts/vali/mars/hyprland/hyprland.nix b/hosts/vali/mars/hyprland/hyprland.nix index 5fcc4a8..66027a5 100644 --- a/hosts/vali/mars/hyprland/hyprland.nix +++ b/hosts/vali/mars/hyprland/hyprland.nix @@ -5,6 +5,8 @@ let username = config.modules.other.system.username; inherit (inputs.hyprland.packages.${pkgs.system}) hyprland; inherit (inputs.anyrun.packages.${pkgs.system}) anyrun; + inherit (inputs.nixpkgs-wayland.packages.${pkgs.system}) wl-clipboard swww wlsunset; + inherit (inputs.waybar.packages.${pkgs.system}) waybar; in { options.modules.programs.hyprland.enable = mkEnableOption "hyprland"; config = mkIf cfg.enable { @@ -80,6 +82,12 @@ in { "28, monitor:DP-1" "29, monitor:DP-1" "30, monitor:DP-1" + + # scratchpads + "special:btop, decorate:false" + "special:pipewire, decorate:false" + "special:nixos, decorate:false" + "special:keepassxc, decorate:false" ]; input = { kb_layout = "de"; @@ -152,6 +160,21 @@ in { animate_mouse_windowdragging = false; force_default_wallpaper = 0; }; + + windowrulev2 = [ + "float, class:^(Tor Browser)$" + "float, class:^(mpv)$" + "float, class:^(imv)$" + "float, title:^(Picture-in-Picture)$" + "float, title:^(.*)(Choose User Profile)(.*)$" + "float, title:^(blob:null/)(.*)$" + "float, class:^(xdg-desktop-portal-gtk)$" + "float, class:^(code), title: ^(Open*)" + "size 70% 70%, class:^(code), title: ^(Open*)" + "center, class: ^(code), title: ^(Open*)" + "float, class:^(org.keepassxc.KeePassXC)$" + ]; + bind = [ "$mainMod, RETURN, exec, ${pkgs.kitty}/bin/kitty" "$mainMod, Q, killactive" @@ -179,7 +202,14 @@ in { "$mainMod SHIFT, 8, split-movetoworkspacesilent, 8" "$mainMod SHIFT, 9, split-movetoworkspacesilent, 9" "$mainMod SHIFT, 0, split-movetoworkspacesilent, 10" - ]; + "$mainMod, S, exec, ${pkgs.grimblast}/bin/grimblast copy area" + "$mainMod, R, exec, ${hyprland}/bin/hyprctl reload" + "$mainMod, B, togglespecialworkspace, btop" + "$mainMod, V, togglespecialworkspace, pipewire" + "$mainMod, N, togglespecialworkspace, nixos" + "$mainMod, X, togglespecialworkspace, keepassxc" + "$mainMod CONTROL, B, exec, ${pkgs.procps}/bin/pkill waybar || ${waybar}/bin/waybar" + ]; binde = [ # window focus "$mainMod, H, movefocus, l" @@ -188,6 +218,31 @@ in { "$mainMod, L, movefocus, r" ]; + + bindl = let + play-pause = "${pkgs.playerctl}/bin/playerctl play-pause"; + stop = "${pkgs.playerctl}/bin/playerctl stop"; + prev = "${pkgs.playerctl}/bin/playerctl previous"; + next = "${pkgs.playerctl}/bin/playerctl next"; + toggle-mute = "${pkgs.pamixer}/bin/pamixer --toggle-mute"; + in [ + ", XF86AudioMedia, exec, ${play-pause}" + ", XF86AudioPlay, exec, ${play-pause}" + ", XF86AudioStop, exec, ${stop}" + ", XF86AudioPrev, exec, ${prev}" + ", XF86AudioNext, exec, ${next}" + ", XF86AudioMute, exec, ${toggle-mute}" + ]; + + # locked + repeat + bindle = let + volume_up = "${pkgs.pamixer}/bin/pamixer -ui 5"; + volume_down = "${pkgs.pamixer}/bin/pamixer -ud 5"; + in [ + ", XF86AudioRaiseVolume, exec, ${volume_up}" + ", XF86AudioLowerVolume, exec, ${volume_down}" + ]; + bindm = [ "$mainMod, mouse:272, movewindow" "$mainMod, mouse:273, resizewindow" @@ -196,6 +251,42 @@ in { pass_mouse_when_bound = false; movefocus_cycles_fullscreen = false; }; + exec-once = let + handle_hyprland_events = pkgs.writeShellScriptBin "handle_hyprland_events" '' + #!/bin/sh + + handle() { + case $1 in + configreloaded*) + ${hyprland}/bin/hyprctl notify 1 2500 "" " Reloading Hyprland..." + ;; + esac + } + ''; + in [ + "${waybar}/bin/waybar" + + # run persistent special workspace windows + "[workspace special:nixos silent;tile] ${pkgs.kitty}/bin/kitty -d ~/repos/nichts -e nvim" + "[workspace special:keepassxc silent;tile] ${pkgs.keepassxc}/bin/keepassxc" + + "${swww}/bin/swww init" + "${wlsunset}/bin/wlsunset -S 06:00 -s 20:00" + ]; + + exec = [ + # kill (almost) everything on special workspaces + "${pkgs.procps}/bin/pkill btop" + "${pkgs.procps}/bin/pkill helvum" + "${pkgs.procps}/bin/pkill pavucontrol" + # and run it all again + "[workspace special:btop silent;tile] ${pkgs.kitty}/bin/kitty -e ${pkgs.btop}/bin/btop" + "[workspace special:pipewire silent;tile] ${pkgs.helvum}/bin/helvum" + "[workspace special:pipewire silent;tile] ${pkgs.pavucontrol}/bin/pavucontrol" + + "${pkgs.networkmanagerapplet}/bin/nm-applet --indicator" + ]; + plugin = { split-monitor-workspaces = { count = 10; @@ -231,7 +322,6 @@ in { })) dunst libnotify - hyprpaper ]; }; } diff --git a/hosts/vali/mars/programs.nix b/hosts/vali/mars/programs.nix index bb3f228..244a45d 100644 --- a/hosts/vali/mars/programs.nix +++ b/hosts/vali/mars/programs.nix @@ -38,6 +38,7 @@ in { grc grimblast git + helvum httpie i3lock imagemagick diff --git a/modules/cli/fish.nix b/modules/cli/fish.nix index fee12ce..52935ec 100644 --- a/modules/cli/fish.nix +++ b/modules/cli/fish.nix @@ -55,7 +55,7 @@ in { cd = "z"; v = "nvim"; e = "emacs"; - update = "sudo nixos-rebuild switch --flake \"${gitPath}#${hostname}\" --log-format internal-json &| nom --json"; + update = "sudo nixos-rebuild switch --flake \"${gitPath}#${hostname}\" --log-format internal-json |& nom --json"; flake = "cd '${gitPath}'"; } // cfg.extraAliases; };