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, ... }:
{
xsession.windowManager.bspwm = let theme = import ../theme.nix; in {
xsession.windowManager.bspwm = let theme = import ../theme.nix "light"; in {
enable = true;
settings = {
normal_border_color = theme.colors.disabled;

View File

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

View File

@ -1,173 +1,194 @@
{ pkgs, ... }:
{ pkgs, lib, ... }:
{
services.polybar = {
enable = true;
script = ""; # required but we start polybar via bspwm, so dont start it here.
config = rec {
theme = import ../theme.nix;
config =
let
theme = import ../theme.nix "light";
colors = theme.colors;
in
rec {
common-bar = {
width = "100%";
height = "${theme.sizing.str.xxl}pt";
radius = 0;
common-bar = {
width = "100%";
height = "${theme.sizing.str.xl}pt";
radius = theme.border-radius;
override-redirect = true;
#;dpi = 96
#;dpi = 96
background = theme.colors.background;
foreground = theme.colors.foreground;
line-size = "3pt";
background-0 = "#efefef";
background-1 = colors.background;
background-2 = colors.background;
background-3 = colors.background;
background-4 = colors.background;
background-5 = "#2e2e2e";
border-size = "${theme.sizing.str.m}pt";
border-color = "#00000000";
foreground = colors.foreground;
line-size = "3pt";
padding-left = 0;
padding-right = 1;
border-size = "${theme.sizing.str.xs}pt";
border-color = colors.primary;
module-margin = 1;
padding-left = 0;
padding-right = 1;
separator = "|";
separator-foreground = theme.colors.disabled;
module-margin = 1;
font-0 = "monospace;2";
wm-restack = "bspwm";
separator = "|";
separator-foreground = colors.disabled;
cursor-click = "pointer";
cursor-scroll = "ns-resize";
font-0 = "Charcoal;2";
# wm-restack = "bspwm";
enable-ipc = true;
cursor-click = "pointer";
cursor-scroll = "ns-resize";
enable-ipc = true;
};
"global/wm" = {
margin-bottom = 0;
};
"bar/primary" = lib.recursiveUpdate common-bar {
monitor = "DP-2";
modules-left = "xworkspaces xwindow";
modules-right = "filesystem memory cpu wlan date";
};
"bar/secondary" = lib.recursiveUpdate common-bar {
monitor = "HDMI-1";
modules-left = "xworkspaces";
modules-center = "date";
modules-right = "systray";
};
"module/xworkspaces" = {
type = "internal/xworkspaces";
group-by-monitor = true;
pin-workspaces = true;
label-active = "%name%";
label-active-background = colors.background-alt;
label-active-underline = colors.primary;
label-active-padding = 1;
label-occupied = "%name%";
label-occupied-padding = 1;
label-urgent = "%name%";
label-urgent-background = colors.alert;
label-urgent-padding = 1;
label-empty = "%name%";
label-empty-foreground = colors.disabled;
label-empty-padding = 1;
};
"module/systray" = {
type = "internal/tray";
format-margin = "8pt";
tray-spacing = "16pt";
};
"module/xwindow" = {
type = "internal/xwindow";
label = "%title:0:60:...%";
};
"module/filesystem" = {
type = "internal/fs";
interval = 25;
mount-0 = "/";
label-mounted = "%{F${colors.primary}}%mountpoint%%{F-} %percentage_used%%";
label-unmounted = "%mountpoint% not mounted";
label-unmounted-foreground = colors.disabled;
};
"module/pulseaudio" = {
type = "internal/pulseaudio";
format-volume-prefix = "VOL ";
format-volume-prefix-foreground = colors.primary;
format-volume = "<label-volume>";
label-volume = "%percentage%%";
label-muted = "muted";
label-muted-foreground = colors.disabled;
};
"module/xkeyboard" = {
type = "internal/xkeyboard";
blacklist-0 = "num lock";
label-layout = "%layout%";
label-layout-foreground = colors.primary;
label-indicator-padding = 2;
label-indicator-margin = 1;
label-indicator-foreground = colors.background;
label-indicator-background = colors.secondary;
};
"module/memory" = {
type = "internal/memory";
interval = 2;
format-prefix = "RAM ";
format-prefix-foreground = colors.primary;
label = "%percentage_used:2%%";
};
"module/cpu" = {
type = "internal/cpu";
interval = 2;
format-prefix = "CPU ";
format-prefix-foreground = colors.primary;
label = "%percentage:2%%";
};
"network-base" = {
type = "internal/network";
interval = 5;
format-connected = "<label-connected>";
format-disconnected = "<label-disconnected>";
label-disconnected = "%{F${colors.primary}}%ifname%%{F${colors.disabled}} disconnected";
};
"module/wlan" = {
"inherit" = "network-base";
interface-type = "wireless";
label-connected = "%{F${colors.primary}}%ifname%%{F-} %essid% %local_ip%";
};
"module/eth" = {
"inherit" = "network-base";
interface-type = "wired";
label-connected = "%{F${colors.primary}}%ifname%%{F-} %local_ip%";
};
"module/date" = {
type = "internal/date";
interval = 1;
date = "%l:%M%P";
date-alt = "%Y-%m-%d %H:%M:%S";
label = "%date%";
label-foreground = colors.primary;
};
"settings" = {
screenchange-reload = true;
pseudo-transparency = false;
#; vim:ft=dosini
};
};
"bar/primary" = common-bar // {
monitor = "DP-2";
modules-left = "xworkspaces xwindow";
modules-right = "filesystem memory cpu wlan date";
};
"bar/secondary" = common-bar // {
monitor = "HDMI-1";
modules-left = "xworkspaces";
modules-center = "date";
modules-right = "systray";
};
"module/xworkspaces" = {
type = "internal/xworkspaces";
group-by-monitor = true;
pin-workspaces = true;
label-active = "%name%";
label-active-background = theme.colors.background-alt;
label-active-underline = theme.colors.primary;
label-active-padding = 1;
label-occupied = "%name%";
label-occupied-padding = 1;
label-urgent = "%name%";
label-urgent-background = theme.colors.alert;
label-urgent-padding = 1;
label-empty = "%name%";
label-empty-foreground = theme.colors.disabled;
label-empty-padding = 1;
};
};
extraConfig = ''
[module/systray]
type = internal/tray
format-margin = 8pt
tray-spacing = 16pt
[module/xwindow]
type = internal/xwindow
label = %title:0:60:...%
[module/filesystem]
type = internal/fs
interval = 25
mount-0 = /
label-mounted = %{F#F0C674}%mountpoint%%{F-} %percentage_used%%
label-unmounted = %mountpoint% not mounted
label-unmounted-foreground = ''${colors.disabled}
[module/pulseaudio]
type = internal/pulseaudio
format-volume-prefix = "VOL "
format-volume-prefix-foreground = ''${colors.primary}
format-volume = <label-volume>
label-volume = %percentage%%
label-muted = muted
label-muted-foreground = ''${colors.disabled}
[module/xkeyboard]
type = internal/xkeyboard
blacklist-0 = num lock
label-layout = %layout%
label-layout-foreground = ''${colors.primary}
label-indicator-padding = 2
label-indicator-margin = 1
label-indicator-foreground = ''${colors.background}
label-indicator-background = ''${colors.secondary}
[module/memory]
type = internal/memory
interval = 2
format-prefix = "RAM "
format-prefix-foreground = ''${colors.primary}
label = %percentage_used:2%%
[module/cpu]
type = internal/cpu
interval = 2
format-prefix = "CPU "
format-prefix-foreground = ''${colors.primary}
label = %percentage:2%%
[network-base]
type = internal/network
interval = 5
format-connected = <label-connected>
format-disconnected = <label-disconnected>
label-disconnected = %{F#F0C674}%ifname%%{F#707880} disconnected
[module/wlan]
inherit = network-base
interface-type = wireless
label-connected = %{F#F0C674}%ifname%%{F-} %essid% %local_ip%
[module/eth]
inherit = network-base
interface-type = wired
label-connected = %{F#F0C674}%ifname%%{F-} %local_ip%
[module/date]
type = internal/date
interval = 1
date = %l:%M%P
date-alt = %Y-%m-%d %H:%M:%S
label = %date%
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;
colors = {
background = "#282A2E";
@ -12,12 +13,16 @@
alert = "#A54242";
disabled = "#707880";
};
sizing = rec {
xs = 1;
s = 2;
m = 4;
l = 8;
xl = 16;
xxl = 24;
x3l = 32;
x4l = 64;
str = {
xs = toString xs;
@ -25,6 +30,21 @@
m = toString m;
l = toString l;
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" ]
then
echo "Using local flake..."
sudo nixos-rebuild switch --flake .
sudo nixos-rebuild switch --show-trace --flake .
reset_bspwm
else
echo "Committing flake and pushing..."