Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 28 additions & 14 deletions modules/bemenu/hm.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
{ config, lib, ... }:
{
options.stylix.targets.bemenu = {
enable = config.lib.stylix.mkEnableTarget "bemenu" true;
mkTarget,
lib,
config,
...
}:
mkTarget {
name = "bemenu";
humanName = "bemenu";

extraOptions = {
fontSize = lib.mkOption {
description = ''
Font size used for bemenu.
Expand All @@ -20,15 +26,26 @@
};
};

config =
lib.mkIf (config.stylix.enable && config.stylix.targets.bemenu.enable)
configElements = [
(
{ cfg, fonts }:
{
programs.bemenu.settings = {
# Font name
fn = "${fonts.sansSerif.name} ${
lib.optionalString (cfg.fontSize != null) (builtins.toString cfg.fontSize)
}";
};
}
)
(
{ colors, opacity }:
{
programs.bemenu.settings =
with config.lib.stylix.colors.withHashtag;
with colors.withHashtag;
let
inherit (config.stylix.targets.bemenu) alternate fontSize;
bemenuOpacity = lib.toHexString (
((builtins.ceil (config.stylix.opacity.popups * 100)) * 255) / 100
((builtins.ceil (opacity.popups * 100)) * 255) / 100
);
in
{
Expand All @@ -48,11 +65,8 @@

ab = "${if alternate then base00 else base01}"; # Alternate bg
af = "${if alternate then base04 else base05}"; # Alternate fg

# Font name
fn = "${config.stylix.fonts.sansSerif.name} ${
lib.optionalString (fontSize != null) (builtins.toString fontSize)
}";
};
};
}
)
];
}
78 changes: 44 additions & 34 deletions modules/dunst/hm.nix
Original file line number Diff line number Diff line change
@@ -1,40 +1,50 @@
{ config, lib, ... }:
{
options.stylix.targets.dunst.enable =
config.lib.stylix.mkEnableTarget "Dunst" true;
{ mkTarget, lib, ... }:
mkTarget {
name = "dunst";
humanName = "Dunst";

config = lib.mkIf (config.stylix.enable && config.stylix.targets.dunst.enable) {
services.dunst.settings =
with config.lib.stylix.colors.withHashtag;
let
inherit (config.stylix) fonts;
dunstOpacity = lib.toHexString (
((builtins.floor (config.stylix.opacity.popups * 100 + 0.5)) * 255) / 100
);
in
configElements = [
(
{ fonts }:
{
global = {
separator_color = base02;
font = "${fonts.sansSerif.name} ${toString fonts.sizes.popups}";
};
services.dunst.settings.global.font =
"${fonts.sansSerif.name} ${toString fonts.sizes.popups}";
}
)
(
{ colors, opacity }:
{
services.dunst.settings =
with colors.withHashtag;
let
dunstOpacity = lib.toHexString (
((builtins.floor (opacity.popups * 100 + 0.5)) * 255) / 100
);
in
{
global = {
separator_color = base02;
};

urgency_low = {
background = base01 + dunstOpacity;
foreground = base05;
frame_color = base0B;
};
urgency_low = {
background = base01 + dunstOpacity;
foreground = base05;
frame_color = base0B;
};

urgency_normal = {
background = base01 + dunstOpacity;
foreground = base05;
frame_color = base0E;
};
urgency_normal = {
background = base01 + dunstOpacity;
foreground = base05;
frame_color = base0E;
};

urgency_critical = {
background = base01 + dunstOpacity;
foreground = base05;
frame_color = base08;
};
};
};
urgency_critical = {
background = base01 + dunstOpacity;
foreground = base05;
frame_color = base08;
};
};
}
)
];
}
43 changes: 24 additions & 19 deletions modules/fcitx5/hm.nix
Original file line number Diff line number Diff line change
@@ -1,40 +1,45 @@
{
config,
lib,
...
}:
{
options.stylix.targets.fcitx5.enable =
config.lib.stylix.mkEnableTarget "fcitx5" true;
{ mkTarget, ... }:
mkTarget {
name = "fcitx5";
humanName = "fcitx5";

config =
lib.mkIf (config.stylix.enable && config.stylix.targets.fcitx5.enable)
configElements = [
(
{ fonts }:
{
i18n.inputMethod.fcitx5.settings.addons.classicui.globalSection = with fonts; {
Font = "${sansSerif.name} ${toString sizes.popups}";
MenuFont = "${sansSerif.name} ${toString sizes.popups}";
TrayFont = "${sansSerif.name} ${toString sizes.popups}";
};
}
)
(
{ colors }:
{
i18n.inputMethod.fcitx5 = {
settings.addons.classicui.globalSection = with config.stylix.fonts; {
settings.addons.classicui.globalSection = {
Theme = "stylix";
UseDarkTheme = false;
UseAccentColor = false;

Font = "${sansSerif.name} ${toString sizes.popups}";
MenuFont = "${sansSerif.name} ${toString sizes.popups}";
TrayFont = "${sansSerif.name} ${toString sizes.popups}";
};
themes.stylix = {
# Adapted from https://github.com/sanweiya/fcitx5-mellow-themes under the BSD 2 license (compatible with this project's license (MIT))
# Copyright (c) 2024, sanweiya
highlightImage = config.lib.stylix.colors {
highlightImage = colors {
template = ./highlight.svg.mustache;
extension = ".svg";
};
panelImage = config.lib.stylix.colors {
panelImage = colors {
template = ./panel.svg.mustache;
extension = ".svg";
};
theme = import ./template.nix {
colors = config.lib.stylix.colors.withHashtag;
colors = colors.withHashtag;
};
};
};
};
}
)
];
}
46 changes: 18 additions & 28 deletions modules/feh/hm.nix
Original file line number Diff line number Diff line change
@@ -1,36 +1,26 @@
{
mkTarget,
lib,
pkgs,
config,
lib,
...
}:
let
cfg = config.stylix.targets.feh;
in
{
options.stylix.targets.feh = {
enable = config.lib.stylix.mkEnableTarget "the desktop background using Feh" (
config.stylix.image != null
);
};
mkTarget {
name = "feh";
humanName = "the desktop background using Feh";
autoEnable =
with config.xsession.windowManager;
bspwm.enable
|| herbstluftwm.enable
|| i3.enable
|| spectrwm.enable
|| xmonad.enable;

config.xsession.initExtra =
lib.mkIf
(
config.stylix.enable
&& cfg.enable
&& (
with config.xsession.windowManager;
bspwm.enable
|| herbstluftwm.enable
|| i3.enable
|| spectrwm.enable
|| xmonad.enable
)
)
(
configElements =
{ imageScalingMode, image }:
{
xsession.initExtra =
let
inherit (config.stylix) imageScalingMode;
bg-arg =
if imageScalingMode == "fill" then
"--bg-fill"
Expand All @@ -44,6 +34,6 @@ in
else
"--bg-max";
in
"${lib.getExe pkgs.feh} --no-fehbg ${bg-arg} ${config.stylix.image}"
);
"${lib.getExe pkgs.feh} --no-fehbg ${bg-arg} ${image}";
};
}
83 changes: 48 additions & 35 deletions modules/fnott/hm.nix
Original file line number Diff line number Diff line change
@@ -1,39 +1,52 @@
{ lib, config, ... }:
{
options.stylix.targets.fnott.enable =
config.lib.stylix.mkEnableTarget "Fnott" true;
{ mkTarget, lib, ... }:
mkTarget {
name = "fnott";
humanName = "Fnott";

config.services.fnott.settings =
lib.mkIf (config.stylix.enable && config.stylix.targets.fnott.enable)
(
let
font = "${config.stylix.fonts.sansSerif.name}:size=${toString config.stylix.fonts.sizes.popups}";
fg = c: "${c}ff";
bg =
c:
"${c}${
lib.toHexString (
((builtins.floor (config.stylix.opacity.popups * 100 + 0.5)) * 255) / 100
)
}";
in
with config.lib.stylix.colors;
{
main = {
title-font = font;
summary-font = font;
body-font = font;

title-color = fg base05;
summary-color = fg base05;
body-color = fg base05;
progress-bar-color = fg base02;
background = bg base00;
configElements = [
(
{ fonts }:
{
services.fnott.settings =
let
font = "${fonts.sansSerif.name}:size=${toString fonts.sizes.popups}";
in
{
main = {
title-font = font;
summary-font = font;
body-font = font;
};
};
}
)
(
{ colors, opacity }:
{
services.fnott.settings =
let
fg = c: "${c}ff";
bg =
c:
"${c}${
lib.toHexString (((builtins.floor (opacity.popups * 100 + 0.5)) * 255) / 100)
}";
in
with colors;
{
main = {
title-color = fg base05;
summary-color = fg base05;
body-color = fg base05;
progress-bar-color = fg base02;
background = bg base00;
};

low.border-color = fg base0B;
normal.border-color = fg base0E;
critical.border-color = fg base08;
}
);
low.border-color = fg base0B;
normal.border-color = fg base0E;
critical.border-color = fg base08;
};
}
)
];
}
Loading