Updated some theming
This commit is contained in:
parent
2a8fcf627b
commit
e10079e578
@ -11,26 +11,30 @@ let
|
|||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.desktop.theming.background = {
|
options.desktop.theming.background = {
|
||||||
path = mkOption {
|
image = {
|
||||||
|
url = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
default = "minimal/a_flower_on_a_dark_background.png";
|
default = "https://raw.githubusercontent.com/dharmx/walls/refs/heads/main/digital/a_drawing_of_a_spider_on_a_white_surface.png";
|
||||||
description = "Path to the background image.";
|
description = "URL to the background image.";
|
||||||
|
};
|
||||||
|
hash = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "sha256-eCEjM7R9yeHNhZZtvHjrgkfwT25JA7FeMoVwnQ887CQ=";
|
||||||
|
description = "SHA256 hash of the background image.";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
themed = mkEnableOption "themed background";
|
themed = mkEnableOption "themed background";
|
||||||
invert = mkEnableOption "invert background";
|
inverted = mkEnableOption "invert background";
|
||||||
src = mkOption {
|
|
||||||
default = pkgs.fetchFromGitHub {
|
|
||||||
owner = "dharmx";
|
|
||||||
repo = "walls";
|
|
||||||
rev = "6bf4d733ebf2b484a37c17d742eb47e5139e6a14";
|
|
||||||
sha256 = "sha256-M96jJy3L0a+VkJ+DcbtrRAquwDWaIG9hAUxenr/TcQU=";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
config =
|
config =
|
||||||
with pkgs;
|
with pkgs;
|
||||||
let
|
let
|
||||||
|
src = pkgs.fetchurl {
|
||||||
|
url = cfg.image.url;
|
||||||
|
hash = cfg.image.hash;
|
||||||
|
};
|
||||||
|
|
||||||
theme = writeTextFile {
|
theme = writeTextFile {
|
||||||
name = "gowall-theme";
|
name = "gowall-theme";
|
||||||
text = builtins.toJSON {
|
text = builtins.toJSON {
|
||||||
@ -61,44 +65,55 @@ in
|
|||||||
executable = true;
|
executable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
fileExtension =
|
||||||
|
name:
|
||||||
|
let
|
||||||
|
parts = splitString "." name;
|
||||||
|
in
|
||||||
|
if length parts > 1 then lists.last parts else "";
|
||||||
|
|
||||||
|
fileName =
|
||||||
|
name:
|
||||||
|
let
|
||||||
|
parts = splitString "/" name;
|
||||||
|
in
|
||||||
|
if length parts > 1 then lists.last parts else name;
|
||||||
|
|
||||||
|
image = fileName cfg.image.url;
|
||||||
|
|
||||||
background-themed = stdenv.mkDerivation {
|
background-themed = stdenv.mkDerivation {
|
||||||
name = "background-themed-1.0.0";
|
name = "background-themed-1.0.0";
|
||||||
src = cfg.src;
|
src = src;
|
||||||
|
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
gowall
|
gowall
|
||||||
imagemagick
|
imagemagick
|
||||||
(writeShellScriptBin "xdg-open" "")
|
(writeShellScriptBin "xdg-open" "")
|
||||||
|
tree
|
||||||
];
|
];
|
||||||
|
|
||||||
buildPhase =
|
unpackPhase = ''
|
||||||
if cfg.themed then
|
cp ${src} ./${image}
|
||||||
if cfg.invert then
|
chmod u+w ./${image}
|
||||||
''
|
'';
|
||||||
cp ${theme} ./theme.json
|
|
||||||
|
|
||||||
export HOME=$PWD
|
buildPhase = ''
|
||||||
convert ./${cfg.path} -channel RGB -negate ./${cfg.path}
|
${optionalString cfg.inverted ''
|
||||||
|
convert ./${image} -channel RGB -negate ./${image}
|
||||||
gowall convert ./${cfg.path} -o themed -t ./theme.json
|
''}
|
||||||
mv Pictures/gowall/themed.* ./
|
${optionalString cfg.themed ''
|
||||||
mogrify -format png themed.*
|
|
||||||
''
|
|
||||||
else
|
|
||||||
''
|
|
||||||
cp ${theme} ./theme.json
|
cp ${theme} ./theme.json
|
||||||
|
|
||||||
export HOME=$PWD
|
export HOME=$PWD
|
||||||
|
|
||||||
gowall convert ./${cfg.path} -o themed -t ./theme.json
|
gowall convert ./${image} --output themed -t ./theme.json
|
||||||
mv Pictures/gowall/themed.* ./
|
tree
|
||||||
|
mv ./themed/*.* ./
|
||||||
|
''}
|
||||||
|
mv ./${image} themed.${fileExtension image}
|
||||||
|
${optionalString (fileExtension image != "png") ''
|
||||||
mogrify -format png themed.*
|
mogrify -format png themed.*
|
||||||
''
|
''}
|
||||||
else
|
|
||||||
''
|
|
||||||
cp ${cfg.path} ./themed
|
|
||||||
|
|
||||||
mogrify -format png themed
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
|
@ -110,8 +110,11 @@ in
|
|||||||
# Configure qt theme
|
# Configure qt theme
|
||||||
qt = mkIf config.desktop.enable {
|
qt = mkIf config.desktop.enable {
|
||||||
enable = true;
|
enable = true;
|
||||||
platformTheme.name = "adwaita";
|
platformTheme.name = "gtk";
|
||||||
style.name = if cfg.darkMode then "adwaita-dark" else "adwaita-light";
|
style = {
|
||||||
|
name = if cfg.darkMode then "adwaita-dark" else "adwaita-light";
|
||||||
|
package = pkgs.adwaita-qt;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# Configure gtk theme
|
# Configure gtk theme
|
||||||
|
@ -35,6 +35,8 @@ let
|
|||||||
|
|
||||||
fontModules = [
|
fontModules = [
|
||||||
# Import all fonts
|
# Import all fonts
|
||||||
|
./fonts/adwaita-mono.nix
|
||||||
|
./fonts/adwaita-sans.nix
|
||||||
./fonts/cozette-vector.nix
|
./fonts/cozette-vector.nix
|
||||||
./fonts/cozette.nix
|
./fonts/cozette.nix
|
||||||
./fonts/dejavu-sans.nix
|
./fonts/dejavu-sans.nix
|
||||||
@ -190,8 +192,8 @@ in
|
|||||||
{
|
{
|
||||||
enable = true;
|
enable = true;
|
||||||
# TODO: Toggles
|
# TODO: Toggles
|
||||||
gtk3.extraCss = disableCSD;
|
gtk3.extraCss = mkIf config.modules.river.enable disableCSD;
|
||||||
gtk4.extraCss = disableCSD;
|
gtk4.extraCss = mkIf config.modules.river.enable disableCSD;
|
||||||
};
|
};
|
||||||
|
|
||||||
# TODO: Make cursors configurable using modules.
|
# TODO: Make cursors configurable using modules.
|
||||||
|
8
user-modules/desktop/theming/fonts/adwaita-mono.nix
Normal file
8
user-modules/desktop/theming/fonts/adwaita-mono.nix
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{ pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
name = "Adwaita Mono";
|
||||||
|
package = pkgs.adwaita-fonts;
|
||||||
|
recommendedSize = 12;
|
||||||
|
fallbackFonts = [ ];
|
||||||
|
}
|
8
user-modules/desktop/theming/fonts/adwaita-sans.nix
Normal file
8
user-modules/desktop/theming/fonts/adwaita-sans.nix
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{ pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
name = "Adwaita Sans";
|
||||||
|
package = pkgs.adwaita-fonts;
|
||||||
|
recommendedSize = 12;
|
||||||
|
fallbackFonts = [ ];
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user