diff --git a/modules/profiles/desktop/default.nix b/modules/profiles/desktop/default.nix index 4d8ab68..a4d2a41 100644 --- a/modules/profiles/desktop/default.nix +++ b/modules/profiles/desktop/default.nix @@ -150,7 +150,12 @@ }) ]; - home-manager.users.motiejus = {pkgs, ...}: { + home-manager.users.motiejus = { + pkgs, + config, + ... + }: { + imports = [./plasma.nix]; xdg.configFile."awesome/rc.lua".source = ./rc.lua; # TODO @@ -182,7 +187,12 @@ }; }; - services.syncthing.tray.enable = true; + services.cbatticon.enable = true; + + services.syncthing.tray = { + enable = true; + #extraOptions = ["--wait"]; + }; services.pasystray = { enable = true; @@ -199,6 +209,60 @@ xautolock.enable = false; lockCmd = ''${pkgs.bash}/bin/bash -c "${pkgs.coreutils}/bin/sleep 0.2; ${pkgs.xorg.xset}/bin/xset dpms force off; /run/wrappers/bin/slock"''; }; + + # thanks K900 + gtk = { + enable = true; + theme = { + package = pkgs.plasma5Packages.breeze-gtk; + name = "Breeze"; + }; + cursorTheme = { + package = pkgs.plasma5Packages.breeze-icons; + name = "Breeze_Snow"; + }; + iconTheme = { + package = pkgs.papirus-icon-theme; + name = "Papirus-Dark"; + }; + gtk2 = { + configLocation = "${config.xdg.configHome}/gtk-2.0/gtkrc"; + extraConfig = '' + gtk-alternative-button-order = 1 + ''; + }; + gtk3.extraConfig = { + gtk-application-prefer-dark-theme = true; + gtk-decoration-layout = "icon:minimize,maximize,close"; + }; + gtk4.extraConfig = { + gtk-application-prefer-dark-theme = true; + gtk-decoration-layout = "icon:minimize,maximize,close"; + }; + }; + + mj.plasma.kconfig = { + kdeglobals = { + General.ColorScheme = "ArcDark"; + Icons.Theme = "Papirus-Dark"; + KDE.widgetStyle = "Breeze"; + }; + plasmarc.Theme.name = "Arc-Dark"; + kscreenlockerrc.Greeter = { + Theme = "com.github.varlesh.arc-dark"; + }; + ksplashrc.KSplash = { + Engine = "KSplashQML"; + Theme = "com.github.varlesh.arc-dark"; + }; + kwinrc."org.kde.kdecoration2" = { + library = "org.kde.kwin.aurorae"; + theme = "__aurorae__svg__Arc-Dark"; + }; + kcminputrc.Mouse.cursorTheme = "Breeze_Snow"; + # don't mess with GTK settings + kded5rc."Module-gtkconfig".autoload = false; + }; }; }; } diff --git a/modules/profiles/desktop/plasma.nix b/modules/profiles/desktop/plasma.nix new file mode 100644 index 0000000..8243a9d --- /dev/null +++ b/modules/profiles/desktop/plasma.nix @@ -0,0 +1,78 @@ +# thanks k900 +{ + config, + lib, + pkgs, + ... +}: let + cfg = config.mj.plasma; + + setValue = v: let + setValueArgs = ty: vs: "--type ${ty} ${lib.escapeShellArg vs}"; + in + if builtins.isBool v + then + setValueArgs "bool" ( + if v + then "true" + else "false" + ) + else setValueArgs "str" (builtins.toString v); + + pathToArgs = path: let + groupArg = item: "--group ${lib.escapeShellArg item}"; + groupArgs = builtins.map groupArg path; + in + groupArgs; + + entryToArgs = { + path, + value, + }: let + file = builtins.head path; + subpath = builtins.tail path; + groups = lib.lists.init subpath; + name = lib.lists.last subpath; + + fileArg = "--file ${lib.escapeShellArg file}"; + pathArgs = pathToArgs groups; + keyArg = "--key ${lib.escapeShellArg name}"; + valueArg = setValue value; + allArgs = pathArgs ++ [fileArg keyArg valueArg]; + in + lib.strings.concatStringsSep " " allArgs; + + flattenAttrs = attrs: pathSoFar: + lib.lists.flatten (lib.attrsets.mapAttrsToList ( + name: value: + if builtins.isAttrs value + then flattenAttrs value (pathSoFar ++ [name]) + else { + path = pathSoFar ++ [name]; + inherit value; + } + ) + attrs); + + configToArgs = attrs: builtins.map entryToArgs (flattenAttrs attrs []); + + configToScript = attrs: let + args = configToArgs attrs; + argToCommand = arg: "${pkgs.plasma5Packages.kconfig}/bin/kwriteconfig5 ${arg}"; + commands = builtins.map argToCommand args; + in + lib.strings.concatStringsSep "\n" commands; + + writeConfig = attrs: pkgs.writeScript "kconfig-setup" (configToScript attrs); +in { + options.mj.plasma = { + kconfig = lib.mkOption { + type = lib.types.attrs; + default = {}; + }; + }; + + config = lib.mkIf (cfg.kconfig != {}) { + home.activation.kconfig-setup = "$DRY_RUN_CMD ${writeConfig cfg.kconfig}"; + }; +}