From 2eeda3bfda1c78985b8a44d2eb3e18285a6812e1 Mon Sep 17 00:00:00 2001 From: 0x5a4 <54070204+0x5a4@users.noreply.github.com> Date: Thu, 9 Jan 2025 16:19:03 +0100 Subject: [PATCH] wayfire: init hm module --- modules/wayfire/hm.nix | 64 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 modules/wayfire/hm.nix diff --git a/modules/wayfire/hm.nix b/modules/wayfire/hm.nix new file mode 100644 index 00000000..ee59edc5 --- /dev/null +++ b/modules/wayfire/hm.nix @@ -0,0 +1,64 @@ +{ + config, + lib, + pkgs, + ... +}: + +{ + options.stylix.targets.wayfire.enable = + config.lib.stylix.mkEnableTarget "wayfire" true; + + config = + lib.mkIf (config.stylix.enable && config.stylix.targets.wayfire.enable) + ( + let + inherit (config.lib.stylix) colors; + rgb = rgb: ''\#${rgb}ff''; + + wayfireCfg = config.wayland.windowManager.wayfire; + + backgroundImage = toString ( + pkgs.runCommand "wayfire-background.png" { } '' + ${lib.getExe' pkgs.imagemagick "convert"} ${config.stylix.image} $out + '' + ); + in + { + wayland.windowManager.wayfire.settings = lib.mkIf wayfireCfg.enable { + cube = { + background = rgb colors.base00; + cubemap_image = backgroundImage; + skydome_texture = backgroundImage; + }; + + expo.background = rgb colors.base00; + vswitch.background = rgb colors.base00; + vswipe.background = rgb colors.base00; + core.background_color = rgb colors.base00; + + decoration = { + font = "${config.stylix.fonts.monospace.name} ${toString config.stylix.fonts.sizes.desktop}"; + active_color = rgb colors.base0D; + inactive_color = rgb colors.base03; + }; + }; + + wayland.windowManager.wayfire.wf-shell.settings = + lib.mkIf wayfireCfg.wf-shell.enable + { + background.image = backgroundImage; + background.fill_mode = + if config.stylix.imageScalingMode == "stretch" then + "stretch" + else if config.stylix.imageScalingMode == "fit" then + "preserve_aspect" + else + "fill_and_crop"; + + panel.background_color = rgb colors.base01; + panel.menu_icon = "${pkgs.nixos-icons}/share/icons/hicolor/256x256/apps/nix-snowflake.png"; + }; + } + ); +}