Skip to content

Commit

Permalink
wayfire: init hm module
Browse files Browse the repository at this point in the history
  • Loading branch information
0x5a4 committed Jan 18, 2025
1 parent 51ad2ce commit 2eeda3b
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions modules/wayfire/hm.nix
Original file line number Diff line number Diff line change
@@ -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";
};
}
);
}

0 comments on commit 2eeda3b

Please sign in to comment.