Compare commits

...

2 commits

Author SHA1 Message Date
c98869240a
feat(home): Picom 2024-11-22 22:40:54 -08:00
0b5219c89f
fix(home): Various polybar fixes 2024-11-22 22:09:36 -08:00
3 changed files with 137 additions and 22 deletions

View file

@ -0,0 +1,96 @@
{
lib,
config,
pkgs,
...
}:
let
inherit (lib) mkEnableOption mkIf;
cfg = config.marleyos.services.picom;
hasXorg = config.xsession.enable;
in
{
options.marleyos.services.picom.enable = mkEnableOption "picom";
config = mkIf (cfg.enable && hasXorg) {
services.picom = {
enable = true;
package = config.lib.nixGL.wrap pkgs.picom;
};
# The module config options are a nightmare.
xdg.configFile."picom/picom.conf".text = # conf
''
# Shadows - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
shadow = true;
shadow-radius = 20;
shadow-opacity = .30;
shadow-offset-x = -7;
shadow-offset-y = 7;
shadow-exclude = [
"name = 'Notification'",
"class_g = 'Conky'",
"class_g ?= 'Notify-osd'",
"class_g = 'Cairo-clock'"
];
# Fading - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
fading = true;
fade-in-step = 0.03;
fade-out-step = 0.03;
# Transparency / Opacity - - - - - - - - - - - - - - - - - - - - - - -
inactive-opacity = 0.7;
active-opacity = 0.9;
frame-opacity = 0.7;
inactive-opacity-override = false;
focus-exclude = [ "class_g = 'Cairo-clock'" ];
opacity-rule = [
"100:class_g = 'firefox'",
"60:class_g = 'dolphin'",
"50:class_g = 'cava'"
];
# Corners - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
corner-radius = 20;
rounded-corners-exclude = [
"window_type = 'dock'",
"window_type = 'desktop'",
"class_g = 'Dunst'"
];
# Background Blurring - - - - - - - - - - - - - - - - - - - - - - - - -
blur-method = "dual_kawase";
blur-size = 12;
blur-strength = 10;
blur-background = false;
blur-kern = "3x3box";
blur-background-exclude = [
"window_type = 'desktop'",
"name = 'firefox'",
"class_g = 'slop'"
];
# General - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
backend = "glx";
dithered-present = false;
vsync = true;
mark-wmwin-focused = true;
detect-rounded-corners = true;
detect-client-opacity = true;
detect-transient = true;
use-damage = false;
log-level = "warn";
wintypes:
{
tooltip = { fade = true; shadow = true; opacity = 0.75; focus = true; full-shadow = false; };
dock = { shadow = false; clip-shadow-above = true; }
dnd = { shadow = false; }
popup_menu = { opacity = 0.8; }
dropdown_menu = { opacity = 0.8; }
};
'';
};
}

View file

@ -5,38 +5,33 @@
...
}:
let
inherit (lib) mkEnableOption mkIf;
inherit (lib) mkEnableOption mkIf getExe;
cfg = config.marleyos.services.polybar;
hasXorg = config.xsession.enable;
xrandr = getExe pkgs.xorg.xrandr;
grep = getExe pkgs.gnugrep;
cut = "${pkgs.coreutils}/bin/cut";
in
{
options.marleyos.services.polybar.enable = mkEnableOption "polybar";
config = mkIf (cfg.enable && hasXorg) {
home.packages = with pkgs; [
xorg.xrandr
];
services.polybar = {
enable = true;
package = config.lib.nixGL.wrap pkgs.polybar;
script = # bash
''
if type "xrandr" &/dev/null; then
for m in $(xrandr --query | grep " connected" | cut -d" " -f1); do
bar="main"
for m in $(${xrandr} --query | ${grep} " connected" | ${cut} -d" " -f1); do
bar="main"
if [[ "$m" == "DP-0" ]]; then
bar="tray"
fi
if [[ "$m" == "DP-0" ]]; then
bar="tray"
fi
MONITOR="$m" polybar -q "$bar" &
done
else
polybar -q main &
fi
MONITOR="$m" polybar -q "$bar" &
done
'';
# colorblock theme from
@ -66,7 +61,7 @@ in
cfgHome = config.xdg.configHome;
in
{
### Global Settings ###
# Global Settings - - - - - - - - - - - - - - - - - - - - - - - - - -
"settings" = {
screenchange.reload = true;
compositing = {
@ -82,7 +77,7 @@ in
margin.bottom = 0;
};
### Bars ###
# Bars - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"bar/main" = {
monitor.text = "\${env:MONITOR:}";
monitor.strict = false;
@ -123,10 +118,10 @@ in
"bar/tray" = {
"inherit" = "bar/main";
modules.right = "color-switch tray sep updates sep cpu memory pulseaudio network date sep sysmenu";
modules.right = "tray filesystem sep cpu memory pulseaudio network date sep sysmenu";
};
### Modules ###
# Modules - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"module/sep" = {
type = "custom/text";
format = " ";
@ -343,6 +338,14 @@ in
background = color.shade2;
};
};
ramp.volume = {
text = [
""
""
""
];
font = 2;
};
};
"module/network" = {
@ -393,6 +396,19 @@ in
};
click.left = mkIf hasRofi "${cfgHome}/rofi/powermenu/type-1/powermenu.sh &";
};
"module/tray" = {
type = "internal/tray";
tray = {
size = 16;
background = color.shade2;
spacing = "5px";
};
format = {
background = color.shade2;
padding = 2;
};
};
};
};
};

View file

@ -15,8 +15,11 @@ in
config = mkIf cfg.enable {
marleyos = {
programs.rofi = enabled;
services.polybar = enabled;
services.dunst = enabled;
services = {
picom = enabled;
polybar = enabled;
dunst = enabled;
};
};
};
}