thelio76: theming

This commit is contained in:
Alex 2024-08-02 12:49:54 -04:00
parent 3c3d062ed5
commit efd33a2dd4
5 changed files with 205 additions and 161 deletions

View File

@ -1,6 +1,6 @@
{ pkgs, ... }: { pkgs, ... }:
{ {
xsession.windowManager.bspwm = let theme = import ../theme.nix; in { xsession.windowManager.bspwm = let theme = import ../theme.nix "light"; in {
enable = true; enable = true;
settings = { settings = {
normal_border_color = theme.colors.disabled; normal_border_color = theme.colors.disabled;

View File

@ -1,4 +1,7 @@
{ ... }: { ... }:
let
theme = import ../theme.nix "light";
in
{ {
services.picom = { services.picom = {
enable = true; enable = true;
@ -6,7 +9,7 @@
activeOpacity = 1; activeOpacity = 1;
inactiveOpacity = 0.75; inactiveOpacity = 0.75;
shadow = true; # shadow = true;
vSync = true; vSync = true;
settings = { settings = {
@ -15,7 +18,7 @@
size = 50; size = 50;
deviation = 10.0; deviation = 10.0;
}; };
corner-radius = 15; corner-radius = theme.border-radius;
}; };
}; };
} }

View File

@ -1,24 +1,35 @@
{ pkgs, ... }: { pkgs, lib, ... }:
{ {
services.polybar = { services.polybar = {
enable = true; enable = true;
script = ""; # required but we start polybar via bspwm, so dont start it here. script = ""; # required but we start polybar via bspwm, so dont start it here.
config = rec { config =
theme = import ../theme.nix; let
theme = import ../theme.nix "light";
colors = theme.colors;
in
rec {
common-bar = { common-bar = {
width = "100%"; width = "100%";
height = "${theme.sizing.str.xl}pt"; height = "${theme.sizing.str.xxl}pt";
radius = theme.border-radius; radius = 0;
override-redirect = true;
#;dpi = 96 #;dpi = 96
background = theme.colors.background; background-0 = "#efefef";
foreground = theme.colors.foreground; background-1 = colors.background;
background-2 = colors.background;
background-3 = colors.background;
background-4 = colors.background;
background-5 = "#2e2e2e";
foreground = colors.foreground;
line-size = "3pt"; line-size = "3pt";
border-size = "${theme.sizing.str.m}pt"; border-size = "${theme.sizing.str.xs}pt";
border-color = "#00000000"; border-color = colors.primary;
padding-left = 0; padding-left = 0;
padding-right = 1; padding-right = 1;
@ -26,10 +37,10 @@
module-margin = 1; module-margin = 1;
separator = "|"; separator = "|";
separator-foreground = theme.colors.disabled; separator-foreground = colors.disabled;
font-0 = "monospace;2"; font-0 = "Charcoal;2";
wm-restack = "bspwm"; # wm-restack = "bspwm";
cursor-click = "pointer"; cursor-click = "pointer";
cursor-scroll = "ns-resize"; cursor-scroll = "ns-resize";
@ -37,14 +48,17 @@
enable-ipc = true; enable-ipc = true;
}; };
"bar/primary" = common-bar // { "global/wm" = {
margin-bottom = 0;
};
"bar/primary" = lib.recursiveUpdate common-bar {
monitor = "DP-2"; monitor = "DP-2";
modules-left = "xworkspaces xwindow"; modules-left = "xworkspaces xwindow";
modules-right = "filesystem memory cpu wlan date"; modules-right = "filesystem memory cpu wlan date";
}; };
"bar/secondary" = common-bar // { "bar/secondary" = lib.recursiveUpdate common-bar {
monitor = "HDMI-1"; monitor = "HDMI-1";
modules-left = "xworkspaces"; modules-left = "xworkspaces";
modules-center = "date"; modules-center = "date";
@ -59,115 +73,122 @@
pin-workspaces = true; pin-workspaces = true;
label-active = "%name%"; label-active = "%name%";
label-active-background = theme.colors.background-alt; label-active-background = colors.background-alt;
label-active-underline = theme.colors.primary; label-active-underline = colors.primary;
label-active-padding = 1; label-active-padding = 1;
label-occupied = "%name%"; label-occupied = "%name%";
label-occupied-padding = 1; label-occupied-padding = 1;
label-urgent = "%name%"; label-urgent = "%name%";
label-urgent-background = theme.colors.alert; label-urgent-background = colors.alert;
label-urgent-padding = 1; label-urgent-padding = 1;
label-empty = "%name%"; label-empty = "%name%";
label-empty-foreground = theme.colors.disabled; label-empty-foreground = colors.disabled;
label-empty-padding = 1; label-empty-padding = 1;
}; };
"module/systray" = {
type = "internal/tray";
format-margin = "8pt";
tray-spacing = "16pt";
}; };
extraConfig = ''
[module/systray]
type = internal/tray
format-margin = 8pt "module/xwindow" = {
tray-spacing = 16pt type = "internal/xwindow";
label = "%title:0:60:...%";
};
[module/xwindow] "module/filesystem" = {
type = internal/xwindow type = "internal/fs";
label = %title:0:60:...% interval = 25;
[module/filesystem] mount-0 = "/";
type = internal/fs
interval = 25
mount-0 = / label-mounted = "%{F${colors.primary}}%mountpoint%%{F-} %percentage_used%%";
label-mounted = %{F#F0C674}%mountpoint%%{F-} %percentage_used%% label-unmounted = "%mountpoint% not mounted";
label-unmounted-foreground = colors.disabled;
};
label-unmounted = %mountpoint% not mounted "module/pulseaudio" = {
label-unmounted-foreground = ''${colors.disabled} type = "internal/pulseaudio";
format-volume-prefix = "VOL ";
format-volume-prefix-foreground = colors.primary;
format-volume = "<label-volume>";
[module/pulseaudio] label-volume = "%percentage%%";
type = internal/pulseaudio
format-volume-prefix = "VOL " label-muted = "muted";
format-volume-prefix-foreground = ''${colors.primary} label-muted-foreground = colors.disabled;
format-volume = <label-volume> };
label-volume = %percentage%% "module/xkeyboard" = {
type = "internal/xkeyboard";
blacklist-0 = "num lock";
label-muted = muted label-layout = "%layout%";
label-muted-foreground = ''${colors.disabled} label-layout-foreground = colors.primary;
[module/xkeyboard] label-indicator-padding = 2;
type = internal/xkeyboard label-indicator-margin = 1;
blacklist-0 = num lock label-indicator-foreground = colors.background;
label-indicator-background = colors.secondary;
};
label-layout = %layout% "module/memory" = {
label-layout-foreground = ''${colors.primary} type = "internal/memory";
interval = 2;
format-prefix = "RAM ";
format-prefix-foreground = colors.primary;
label = "%percentage_used:2%%";
};
label-indicator-padding = 2 "module/cpu" = {
label-indicator-margin = 1 type = "internal/cpu";
label-indicator-foreground = ''${colors.background} interval = 2;
label-indicator-background = ''${colors.secondary} format-prefix = "CPU ";
format-prefix-foreground = colors.primary;
label = "%percentage:2%%";
};
[module/memory] "network-base" = {
type = internal/memory type = "internal/network";
interval = 2 interval = 5;
format-prefix = "RAM " format-connected = "<label-connected>";
format-prefix-foreground = ''${colors.primary} format-disconnected = "<label-disconnected>";
label = %percentage_used:2%% label-disconnected = "%{F${colors.primary}}%ifname%%{F${colors.disabled}} disconnected";
};
[module/cpu] "module/wlan" = {
type = internal/cpu "inherit" = "network-base";
interval = 2 interface-type = "wireless";
format-prefix = "CPU " label-connected = "%{F${colors.primary}}%ifname%%{F-} %essid% %local_ip%";
format-prefix-foreground = ''${colors.primary} };
label = %percentage:2%%
[network-base] "module/eth" = {
type = internal/network "inherit" = "network-base";
interval = 5 interface-type = "wired";
format-connected = <label-connected> label-connected = "%{F${colors.primary}}%ifname%%{F-} %local_ip%";
format-disconnected = <label-disconnected> };
label-disconnected = %{F#F0C674}%ifname%%{F#707880} disconnected
[module/wlan] "module/date" = {
inherit = network-base type = "internal/date";
interface-type = wireless interval = 1;
label-connected = %{F#F0C674}%ifname%%{F-} %essid% %local_ip%
[module/eth] date = "%l:%M%P";
inherit = network-base date-alt = "%Y-%m-%d %H:%M:%S";
interface-type = wired
label-connected = %{F#F0C674}%ifname%%{F-} %local_ip%
[module/date] label = "%date%";
type = internal/date label-foreground = colors.primary;
interval = 1 };
date = %l:%M%P "settings" = {
date-alt = %Y-%m-%d %H:%M:%S screenchange-reload = true;
pseudo-transparency = false;
label = %date% #; vim:ft=dosini
label-foreground = ''${colors.primary} };
};
[settings]
screenchange-reload = true
pseudo-transparency = true
; vim:ft=dosini
'';
}; };
} }

View File

@ -1,4 +1,5 @@
{ mode:
let
border-radius = 5; border-radius = 5;
colors = { colors = {
background = "#282A2E"; background = "#282A2E";
@ -12,12 +13,16 @@
alert = "#A54242"; alert = "#A54242";
disabled = "#707880"; disabled = "#707880";
}; };
sizing = rec { sizing = rec {
xs = 1; xs = 1;
s = 2; s = 2;
m = 4; m = 4;
l = 8; l = 8;
xl = 16; xl = 16;
xxl = 24;
x3l = 32;
x4l = 64;
str = { str = {
xs = toString xs; xs = toString xs;
@ -25,6 +30,21 @@
m = toString m; m = toString m;
l = toString l; l = toString l;
xl = toString xl; xl = toString xl;
xxl = toString xxl;
x3l = toString x3l;
x4l = toString x4l;
}; };
}; };
in
if mode == "light" then {
inherit border-radius sizing;
colors = colors // {
primary = "#9a9aea";
foreground = "#2e2e1e";
background = "#bababa";
background-alt = "#a9a9a9";
};
} else {
inherit border-radius sizing;
colors = colors // { };
} }

View File

@ -51,7 +51,7 @@ else
if [ "$commitchanges" == "false" ] if [ "$commitchanges" == "false" ]
then then
echo "Using local flake..." echo "Using local flake..."
sudo nixos-rebuild switch --flake . sudo nixos-rebuild switch --show-trace --flake .
reset_bspwm reset_bspwm
else else
echo "Committing flake and pushing..." echo "Committing flake and pushing..."