From c98869240a4c5b9064d7b9c9f9ee8082a8f5e24b Mon Sep 17 00:00:00 2001 From: punkfairie Date: Fri, 22 Nov 2024 22:40:54 -0800 Subject: [PATCH] feat(home): Picom --- modules/home/services/picom/default.nix | 96 +++++++++++++++++++++++++ modules/home/xorg/i3/default.nix | 7 +- 2 files changed, 101 insertions(+), 2 deletions(-) create mode 100644 modules/home/services/picom/default.nix diff --git a/modules/home/services/picom/default.nix b/modules/home/services/picom/default.nix new file mode 100644 index 0000000..3fc60c0 --- /dev/null +++ b/modules/home/services/picom/default.nix @@ -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; } + }; + ''; + }; +} diff --git a/modules/home/xorg/i3/default.nix b/modules/home/xorg/i3/default.nix index e1e89d1..b62e3f1 100644 --- a/modules/home/xorg/i3/default.nix +++ b/modules/home/xorg/i3/default.nix @@ -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; + }; }; }; }