From d368ea3f6f09dd4e9ca061799a33c36588d0e4d0 Mon Sep 17 00:00:00 2001 From: John Bowdre Date: Sat, 30 Sep 2023 13:14:30 -0500 Subject: [PATCH] hypr++; --- flake.nix | 7 +++++-- home/features/desktop/common/default.nix | 2 ++ home/features/desktop/hyprland/default.nix | 4 ---- hosts/pixnix/default.nix | 2 +- pkgs/hyprslurp/default.nix | 16 ++++++++++++++++ pkgs/primary-xwayland/default.nix | 22 ++++++++++++++++++++++ 6 files changed, 46 insertions(+), 7 deletions(-) create mode 100644 pkgs/hyprslurp/default.nix create mode 100644 pkgs/primary-xwayland/default.nix diff --git a/flake.nix b/flake.nix index 57322ef..1f24999 100644 --- a/flake.nix +++ b/flake.nix @@ -48,8 +48,11 @@ inherit (self) outputs; lib = nixpkgs.lib // home-manager.lib; systems = [ "x86_64-linux" "aarch64-linux" ]; - forEachSystem = f: lib.genAttrs systems (sys: f pkgsFor.${sys}); - pkgsFor = nixpkgs.legacyPackages; + forEachSystem = f: lib.genAttrs systems (system: f pkgsFor.${system}); + pkgsFor = lib.genAttrs systems (system: import nixpkgs { + inherit system; + config.allowUnfree = true; + }); in { inherit lib; diff --git a/home/features/desktop/common/default.nix b/home/features/desktop/common/default.nix index 2c63c08..f7e9be4 100644 --- a/home/features/desktop/common/default.nix +++ b/home/features/desktop/common/default.nix @@ -1,2 +1,4 @@ { + imports = [ + ]; } diff --git a/home/features/desktop/hyprland/default.nix b/home/features/desktop/hyprland/default.nix index 98248bd..07be4dd 100644 --- a/home/features/desktop/hyprland/default.nix +++ b/home/features/desktop/hyprland/default.nix @@ -24,10 +24,6 @@ gaps_out = 20; border_size = 2.7; cursor_inactive_timeout = 4; - "col.active_border" = "0xff${config.colorscheme.colors.base0C}"; - "col.inactive_border" = "0xff${config.colorscheme.colors.base02}"; - "col.group_border_active" = "0xff${config.colorscheme.colors.base0B}"; - "col.group_border" = "0xff${config.colorscheme.colors.base04}"; }; input = { kb_layout = "br,us"; diff --git a/hosts/pixnix/default.nix b/hosts/pixnix/default.nix index 8bb4f8c..d723c92 100644 --- a/hosts/pixnix/default.nix +++ b/hosts/pixnix/default.nix @@ -27,7 +27,7 @@ dconf.enable = true; }; - servies.logind = { + services.logind = { lidSwitch = "suspend"; lidSwitchExternalPower = "lock"; }; diff --git a/pkgs/hyprslurp/default.nix b/pkgs/hyprslurp/default.nix new file mode 100644 index 0000000..1870ab6 --- /dev/null +++ b/pkgs/hyprslurp/default.nix @@ -0,0 +1,16 @@ +{ writeShellApplication, hyprland, jq, slurp }: +writeShellApplication { + name = "hyprslurp"; + runtimeInputs = [ hyprland jq slurp ]; + text = '' + hyprctl clients -j | \ + jq -r \ + --argjson workspaces "$(\ + hyprctl monitors -j | \ + jq -r 'map(.activeWorkspace.id)'\ + )" \ + 'map(select([.workspace.id] | inside($workspaces)))' | \ + jq -r '.[] | "\(.at[0]),\(.at[1]) \(.size[0])x\(.size[1])"' | \ + slurp "$@" + ''; +} diff --git a/pkgs/primary-xwayland/default.nix b/pkgs/primary-xwayland/default.nix new file mode 100644 index 0000000..65d789a --- /dev/null +++ b/pkgs/primary-xwayland/default.nix @@ -0,0 +1,22 @@ +# Sets the largest monitor as primary xwayland display, or select one with slurp +{ lib, writeShellApplication, xrandr, slurp }: (writeShellApplication { + name = "primary-xwayland"; + runtimeInputs = [ slurp xrandr ]; + + text = /* bash */ '' + if [ "$#" -ge 1 ] && [ "$1" == "largest" ]; then + output=$(xrandr --listmonitors | tail -n +2 | awk '{printf "%s %s\n", $3, $4}' | sort | tail -1 | cut -d ' ' -f2) + else + selected=$(slurp -f "%wx%h+%x+%y" -o) + output=$(xrandr | grep "$selected" | cut -d ' ' -f1) + fi + + echo "Setting $output" + xrandr --output "$output" --primary + ''; +}) // { + meta = with lib; { + license = licenses.mit; + platforms = platforms.all; + }; +}