From cbcdccbdc7c83ba33e7404cb14672957fc5bff45 Mon Sep 17 00:00:00 2001 From: derped Date: Wed, 21 Feb 2024 21:53:58 +0100 Subject: [PATCH] Add hyprland. --- config/etc/rofi.rasi.nix | 7 +++++- services/desktop/hyprland.nix | 46 +++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 services/desktop/hyprland.nix diff --git a/config/etc/rofi.rasi.nix b/config/etc/rofi.rasi.nix index 6025b1a..ecad048 100644 --- a/config/etc/rofi.rasi.nix +++ b/config/etc/rofi.rasi.nix @@ -7,7 +7,12 @@ TARGET_TAB=$(sed "s/\t.*$//g" <<< ''${1}); # activate window as focused to it is easy to switch to ${brotab}/bin/bt activate --focused ''${TARGET_TAB} > /dev/null 2>&1; - ${i3}/bin/i3-msg -t run_command "[urgent=latest] focus" > /dev/null 2>&1; + # TODO: Resolve at build time. + if [ -n ''${HYPRLAND_INSTANCE_SIGNATURE} ]; then + ${hyprland}/bin/hyprctl dispatch focusurgentorlast > /dev/null 2>&1; + else + ${i3}/bin/i3-msg -t run_command "[urgent=latest] focus" > /dev/null 2>&1; + fi fi exit 0; ''); diff --git a/services/desktop/hyprland.nix b/services/desktop/hyprland.nix new file mode 100644 index 0000000..8016f89 --- /dev/null +++ b/services/desktop/hyprland.nix @@ -0,0 +1,46 @@ +{ + system, + config, + lib, + pkgs, + hyprland, + hy3, + ... +}: +with lib; + mkIf (elem "desktop::hyprland" config.machine.services) { + programs.hyprland = { + enable = true; + package = hyprland.packages."${system}".hyprland; + xwayland.enable = false; + }; + environment.systemPackages = + [ + hy3.packages."${system}".hy3 + ] + ++ (with pkgs; [ + kanagawa + eww-wayland + rofi-wayland + hyprpicker + waybar + swaybg + ]); + + # TODO: Refactor + environment = { + etc."xdg/gtk-2.0/gtkrc".text = '' + gtk-key-theme-name = "Kanagawa-BL" + ''; + etc."xdg/gtk-3.0/settings.ini".text = '' + [Settings] + gtk-key-theme-name = Kanagawa-BL + ''; + sessionVariables.NIXOS_OZONE_WL = "1"; + }; + qt = { + enable = true; + platformTheme = "gnome"; + style = "adwaita-dark"; + }; + }