Make hyprland theme light/dark togglable

This commit is contained in:
larstvei 2025-09-05 21:18:17 +02:00
parent 11ada196c2
commit e1ded294f3
3 changed files with 47 additions and 17 deletions

View File

@ -12,22 +12,9 @@
imports = [
zen-browser.homeModules.beta
./hyprland
./theme
];
xdg.portal = {
enable = true;
extraPortals = [
pkgs.xdg-desktop-portal-hyprland
pkgs.xdg-desktop-portal-gtk
];
config.hyprland."org.freedesktop.impl.portal.Settings" = "darkman";
};
services.darkman = {
enable = true;
settings.portal = true;
};
programs.zen-browser = {
enable = true;
policies = {

View File

@ -8,13 +8,10 @@
misc = {
disable_hyprland_logo = true;
background_color = "0x1A1D23";
};
general = {
border_size = 2;
"col.active_border" = "0xFF81A1C1";
"col.inactive_border" = "0xFF677691";
layout = "master";
};
@ -119,6 +116,8 @@
"$mod, =, resizeactive, +10"
"$mod, -, resizeactive, -10"
"$mod, D, exec, darkman toggle"
# Text input (macOS-like way of producing Norwegian characters)
"$mod, A, exec, wtype 'å'"
"$mod, O, exec, wtype 'ø'"

View File

@ -0,0 +1,44 @@
{ pkgs, ... }:
let
bg = {
light = "FAFAFA";
dark = "2E3440";
};
fg = {
light = "37474F";
dark = "ECEFF4";
};
primary = {
light = "673AB7";
dark = "81A1C1";
};
secondary = {
light = "90A4AE";
dark = "677691";
};
in
{
xdg.portal = {
enable = true;
extraPortals = [
pkgs.xdg-desktop-portal-hyprland
pkgs.xdg-desktop-portal-gtk
];
config.hyprland."org.freedesktop.impl.portal.Settings" = "darkman";
};
services.darkman = {
enable = true;
settings.portal = true;
lightModeScripts.hyprland-light = ''
hyprctl keyword misc:background_color 0x${bg.light}
hyprctl keyword general:col.active_border 0xFF${primary.light}
hyprctl keyword general:col.inactive_border 0xFF${secondary.light}
'';
darkModeScripts.hyprland-dark = ''
hyprctl keyword misc:background_color 0x${bg.dark}
hyprctl keyword general:col.active_border 0xFF${primary.dark}
hyprctl keyword general:col.inactive_border 0xFF${secondary.dark}
'';
};
}