style: improve theming with global variables

This commit is contained in:
b12f 2024-09-04 22:28:41 +02:00
parent 9fc9b6b5c8
commit 165fa48bfa
Signed by: b12f
GPG key ID: 729956E1124F8F26
16 changed files with 342 additions and 287 deletions

View file

@ -716,7 +716,8 @@
"nixpkgs": "nixpkgs_4",
"nixpkgs-master": "nixpkgs-master",
"nixpkgs-unstable": "nixpkgs-unstable",
"openstreetmap": "openstreetmap"
"openstreetmap": "openstreetmap",
"themes": "themes"
}
},
"systems": {
@ -749,6 +750,21 @@
"type": "github"
}
},
"themes": {
"locked": {
"lastModified": 1715166503,
"narHash": "sha256-eG3+PTzJntnMrO9J2fCtshU+XX18uI8iIjDKU9NkJXA=",
"owner": "RGBCube",
"repo": "ThemeNix",
"rev": "c188d0d729841f71f576dfb544e70c0340bf52a8",
"type": "github"
},
"original": {
"owner": "RGBCube",
"repo": "ThemeNix",
"type": "github"
}
},
"utils": {
"inputs": {
"systems": "systems_2"

View file

@ -15,6 +15,8 @@
home-manager.url = "github:nix-community/home-manager/release-24.05";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
themes.url = "github:RGBCube/ThemeNix";
flake-parts.url = "github:hercules-ci/flake-parts";
nixos-flake.url = "github:srid/nixos-flake";
@ -61,6 +63,7 @@
imports = [
inputs.nixos-flake.flakeModule
./public-keys.nix
./theme.nix
./lib
./modules
./hosts

View file

@ -1,5 +1,4 @@
{
withSystem,
self,
inputs,
...
@ -7,6 +6,7 @@
flake = {
nixosConfigurations = {
stroopwafel = self.nixos-flake.lib.mkLinuxSystem {
nixpkgs.hostPlatform = "x86_64-linux";
imports = [
inputs.impermanence.nixosModules.impermanence

View file

@ -1,20 +1,3 @@
@define-color base00 #1a181a;
@define-color base01 #2d2a2e;
@define-color base02 #303030;
@define-color base03 #949494;
@define-color base04 #d3d1d4;
@define-color base05 #e3e1e4;
@define-color base06 #303030;
@define-color base07 #ff5f5f;
@define-color base08 #f85e84;
@define-color base09 #df5923;
@define-color base0A #e5c463;
@define-color base0B #9ecd6f;
@define-color base0C #ef9062;
@define-color base0D #7accd7;
@define-color base0E #ab9df2;
@define-color base0F #d70000;
* {
min-height: 0;
border: none;

View file

@ -1,4 +1,4 @@
{
{ flake, ...}: with flake.self.theme.with0x; {
env = {
TERM = "xterm-256color";
};
@ -164,8 +164,8 @@
# Default colors
primary = {
background = "0x1a181a";
foreground = "0xe3e1e4";
background = base00;
foreground = base05;
};
# Cursor colors
@ -184,8 +184,8 @@
# Allowed values are CellForeground/CellBackground, which reference the
# affected cell, or hexadecimal colors like #ff00ff.
matches = {
foreground = "0xe5c463";
background = "0x1a181a";
foreground = base0A;
background = base00;
};
focused_match = {
foreground = "CellBackground";
@ -203,58 +203,58 @@
# Allowed values are CellForeground/CellBackground, which reference the
# affected cell, or hexadecimal colors like #ff00ff.
selection = {
text = "0x1a181a";
background = "0xf85e84";
text = base00;
background = base08;
};
# Normal colors
normal = {
black = "0x1a181a";
red = "0xf85e84";
green = "0x9ecd6f";
yellow = "0xe5c463";
blue = "0x7accd7";
magenta = "0xab9df2";
cyan = "0xef9062";
white = "0xe3e1e4";
black = base00;
red = base08;
green = base09;
yellow = base0A;
blue = base0D;
magenta = base0E;
cyan = base0C;
white = base05;
};
# Bright colors
bright = {
black = "0x949494";
red = "0xf85e84";
green = "0x9ecd6f";
yellow = "0xe5c463";
blue = "0x7accd7";
magenta = "0xab9df2";
cyan = "0xef9062";
white = "0xff5f5f";
black = base00;
red = base08;
green = base09;
yellow = base0A;
blue = base0D;
magenta = base0E;
cyan = base0C;
white = base07;
};
indexed_colors = [
{
index = 16;
color = "0xdf5923";
color = base09;
}
{
index = 17;
color = "0xd70000";
color = base0F;
}
{
index = 18;
color = "0x2d2a2e";
color = base01;
}
{
index = 19;
color = "0x303030";
color = base02;
}
{
index = 20;
color = "0xd3d1d4";
color = base04;
}
{
index = 21;
color = "0x303030";
color = base02;
}
];
};

View file

@ -1,4 +1,4 @@
{
args@{
lib,
config,
pkgs,
@ -111,7 +111,7 @@ in {
home-manager.users."${psCfg.user.name}" = {
home.file."xinitrc".source = ./.xinitrc;
xdg.configFile."alacritty/alacritty.toml".source = tomlFormat.generate "alacritty.toml" (import ./alacritty.nix);
xdg.configFile."alacritty/alacritty.toml".source = tomlFormat.generate "alacritty.toml" ((import ./alacritty.nix) args);
xdg.configFile."xmodmap".source = ./.config/xmodmap;
xdg.configFile."user-dirs.dirs".source = ./.config/user-dirs.dirs;
xdg.configFile."user-dirs.locale".source = ./.config/user-dirs.locale;
@ -119,6 +119,12 @@ in {
xdg.configFile."libinput-gestures.conf".source = ./.config/libinput-gestures.conf;
xdg.configFile."wallpaper.jpg".source = ./assets/wallpaper.jpg;
dconf.settings = {
"org/gnome/desktop/interface" = {
color-scheme = "prefer-dark";
};
};
gtk = {
enable = true;
font.name = "Lato";
@ -136,7 +142,7 @@ in {
gtk-xft-hinting = "1";
gtk-xft-hintstyle = "hintfull";
gtk-xft-rgba = "rgb";
gtk-application-prefer-dark-theme = "true";
gtk-application-prefer-dark-theme = "1";
};
};

View file

@ -2,6 +2,7 @@
lib,
config,
pkgs,
flake,
...
}:
with lib; let
@ -10,20 +11,20 @@ in {
home-manager.users."${psCfg.user.name}" = {
services.mako = {
enable = true;
extraConfig = ''
extraConfig = with flake.self.theme.withHashtag; ''
padding=10
margin=5,5,0
default-timeout=5000
background-color=#1a181a
text-color=#e3e1e4
border-color=#ff5f5f
background-color=${base00}
text-color=${base05}
border-color=${base07}
font=Hack 14
[urgency=high]
background-color=#ff5f5f
text-color=#1a181a
border-color=#1a181a
background-color=${base07}
text-color=${base00}
border-color=${base00}
layer=overlay
font=Hack 14
'';

View file

@ -1,19 +0,0 @@
## Base16 Burn
# Author: Benjamin Bädorf
set $base00 #1a181a
set $base01 #2d2a2e
set $base02 #303030
set $base03 #949494
set $base04 #d3d1d4
set $base05 #e3e1e4
set $base06 #303030
set $base07 #ff5f5f
set $base08 #f85e84
set $base09 #df5923
set $base0A #e5c463
set $base0B #9ecd6f
set $base0C #ef9062
set $base0D #7accd7
set $base0E #ab9df2
set $base0F #d70000

View file

@ -1,14 +1,12 @@
{
pkgs,
psCfg,
config,
...
}:
with pkgs;
''
}: with pkgs; ''
# Set shut down, restart and locking features
''
+ (
if psCfg.core.hibernation.enable
if config.pub-solar.core.hibernation.enable
then ''
set $mode_system (e)xit, (l)ock, (h)ibernate, (r)eboot, (Shift+s)hutdown
''
@ -24,7 +22,7 @@ with pkgs;
bindsym l exec ${swaylock-bg}/bin/swaylock-bg, mode "default"
''
+ (
if psCfg.core.hibernation.enable
if config.pub-solar.core.hibernation.enable
then ''
bindsym h exec ${systemd}/bin/systemctl hibernate, mode "default"
''

View file

@ -1,3 +1,21 @@
{ flake, ... }: with flake.self.theme.withHashtag; ''
set $base00 ${base00}
set $base01 ${base01}
set $base02 ${base02}
set $base03 ${base03}
set $base04 ${base04}
set $base05 ${base05}
set $base06 ${base06}
set $base07 ${base07}
set $base08 ${base08}
set $base09 ${base09}
set $base0A ${base0A}
set $base0B ${base0B}
set $base0C ${base0C}
set $base0D ${base0D}
set $base0E ${base0E}
set $base0F ${base0F}
# Border BG Text Ind Child Border
client.focused $base00 $base01 $base07 $base0D $base07
client.focused_inactive $base00 $base01 $base07 $base03 $base00
@ -14,3 +32,4 @@ exec_always import-gtk-settings \
# Workaround to fix cursor scaling, see https://github.com/swaywm/sway/issues/4112
seat seat0 xcursor_theme Adwaita
''

View file

@ -1,8 +1,14 @@
{
args@{
config,
pkgs,
...
}: ''
}: let
applications = builtins.readFile ./config.d/applications.conf;
custom-keybindings = builtins.readFile ./config.d/custom-keybindings.conf;
gaps = builtins.readFile ./config.d/gaps.conf;
mode-system = import ./config.d/mode_system.conf.nix args;
systemd = builtins.readFile ./config.d/systemd.conf;
in ''
# Default config for sway
#
# Copy this to ~/.config/sway/config and edit it to your liking.
@ -27,11 +33,6 @@
default_border pixel 1
### Output configuration
#
# Default wallpaper (more resolutions are available in @datadir@/backgrounds/sway/)
output * bg ~/.config/wallpaper.jpg fill
### Key bindings
#
# Basics:
@ -214,4 +215,11 @@
}
bindsym $mod+r mode "resize"
include ~/.config/sway/config.d/*''
${applications}
${gaps}
${custom-keybindings}
${mode-system}
${systemd}
include ~/.config/sway/config.d/*
''

View file

@ -1,4 +1,4 @@
{
args@{
lib,
config,
pkgs,
@ -77,14 +77,7 @@ in {
systemd.user.services.xsettingsd = import ./xsettingsd.service.nix {inherit pkgs psCfg;};
systemd.user.targets.sway-session = import ./sway-session.target.nix {inherit pkgs psCfg;};
xdg.configFile."sway/config".text = import ./config/config.nix {inherit config pkgs;};
xdg.configFile."sway/config.d/colorscheme.conf".source = ./config/config.d/colorscheme.conf;
xdg.configFile."sway/config.d/theme.conf".source = ./config/config.d/theme.conf;
xdg.configFile."sway/config.d/gaps.conf".source = ./config/config.d/gaps.conf;
xdg.configFile."sway/config.d/custom-keybindings.conf".source = ./config/config.d/custom-keybindings.conf;
xdg.configFile."sway/config.d/mode_system.conf".text = import ./config/config.d/mode_system.conf.nix {inherit pkgs psCfg;};
xdg.configFile."sway/config.d/applications.conf".source = ./config/config.d/applications.conf;
xdg.configFile."sway/config.d/systemd.conf".source = ./config/config.d/systemd.conf;
xdg.configFile."sway/config".text = import ./config/config.nix args;
services.swayidle = with pkgs; {
enable = true;

View file

@ -2,13 +2,14 @@
lib,
config,
pkgs,
flake,
...
}:
with lib; let
psCfg = config.pub-solar;
in {
home-manager.users."${psCfg.user.name}" = {
programs.waybar = {
programs.waybar = with flake.self.theme.withHashtag; {
enable = true;
settings.main = {
layer = "top";
@ -88,7 +89,25 @@ in {
};
};
};
style = builtins.readFile ./.config/waybar/style.css;
style = ''
@define-color base00 ${base00};
@define-color base01 ${base01};
@define-color base02 ${base02};
@define-color base03 ${base03};
@define-color base04 ${base04};
@define-color base05 ${base05};
@define-color base06 ${base06};
@define-color base07 ${base07};
@define-color base08 ${base08};
@define-color base09 ${base09};
@define-color base0A ${base0A};
@define-color base0B ${base0B};
@define-color base0C ${base0C};
@define-color base0D ${base0D};
@define-color base0E ${base0E};
@define-color base0F ${base0F};
''+ builtins.readFile ./.config/waybar/style.css;
systemd.enable = true;
systemd.target = "sway-session.target";
};

View file

@ -2,6 +2,7 @@
lib,
config,
pkgs,
flake,
...
}:
with lib; let
@ -23,8 +24,8 @@ in {
users.users."${psCfg.user.name}".packages = with pkgs;
[
tealdeer
asciinema
bat
blesh
eza
fd
@ -73,7 +74,7 @@ in {
# starship.toml has sane defaults that can be changed there
programs.starship = {
enable = true;
settings = import ./starship.toml.nix;
settings = import ./starship.toml.nix flake.self.theme.withHashtag;
};
programs.bash = import ./bash {

View file

@ -1,20 +1,20 @@
{
format = "$username$hostname$directory($git_branch$git_commit$git_state$git_status)($c$deno$golang$haskell$nodejs$php$python$ruby$rust$terraform[](fg:#F85E84 bg:#000000))($docker_context[](fg:#06969A))($container)$fill(\${custom.triton})$nix_shell$status[ |](fg:#F85E84)$line_break$character";
theme: with theme; {
format = "$username$hostname$directory($git_branch$git_commit$git_state$git_status)($c$deno$golang$haskell$nodejs$php$python$ruby$rust$terraform[](fg:#F85E84 bg:${base00}))($docker_context[](fg:#06969A))($container)$fill(\${custom.triton})$nix_shell$status[ |](fg:#F85E84)$line_break$character";
# Disable the blank line at the start of the prompt
add_newline = false;
# You can also replace your username with a neat symbol like  to save some space
username = {
style_user = "bg:#000000 fg:#F85E84";
style_root = "bg:#F85E84 fg:#000000";
style_user = "bg:${base00} fg:#F85E84";
style_root = "bg:#F85E84 fg:${base00}";
format = ''[$user ]($style)'';
};
hostname = {
ssh_symbol = "";
trim_at = "";
style = "bg:#000000 fg:#F85E84";
style = "bg:${base00} fg:#F85E84";
};
character = {

27
theme.nix Normal file
View file

@ -0,0 +1,27 @@
{
inputs,
...
}: {
flake = {
theme = inputs.themes.custom {
"name" = "burn";
"author" = "b12f";
"base00" = "#1a181a";
"base01" = "#2d2a2e";
"base02" = "#303030";
"base03" = "#949494";
"base04" = "#d3d1d4";
"base05" = "#e3e1e4";
"base06" = "#303030";
"base07" = "#ff5f5f";
"base08" = "#f85e84";
"base09" = "#df5923";
"base0A" = "#e5c463";
"base0B" = "#9ecd6f";
"base0C" = "#ef9062";
"base0D" = "#7accd7";
"base0E" = "#ab9df2";
"base0F" = "#d70000";
};
};
}