diff --git a/modules/home/programs/gui/librewolf/default.nix b/modules/home/programs/gui/librewolf/default.nix index 11a0ef0a..67863716 100644 --- a/modules/home/programs/gui/librewolf/default.nix +++ b/modules/home/programs/gui/librewolf/default.nix @@ -4,37 +4,24 @@ programs.firefox = { enable = true; package = pkgs.librewolf; - profiles = let - # FireFox css, based on https://github.com/Dook97/firefox-qutebrowser-userchrome - themeFont = '' - --tab-font: '${config.look.fonts.main}'; - --urlbar-font: '${config.look.fonts.main}'; - ''; - themeMain = '' - :root { - --tab-active-bg-color: #${config.look.colors.prime}; - --tab-hover-bg-color: #${config.look.colors.accent}; - --tab-inactive-bg-color: #${config.look.colors.dark}; - --tab-active-fg-fallback-color: #FFFFFF; - --tab-inactive-fg-fallback-color: #${config.look.colors.text}; - --urlbar-focused-bg-color: #${config.look.colors.dark}; - --urlbar-not-focused-bg-color: #${config.look.colors.dark}; - --toolbar-bgcolor: #${config.look.colors.dark} !important; - ''; - themeAlt = '' - :root { - --tab-active-bg-color: #${config.look.colors.dark}; - --tab-hover-bg-color: #${config.look.colors.accent}; - --tab-inactive-bg-color: #${config.look.colors.prime}; - --tab-active-fg-fallback-color: #${config.look.colors.text}; - --tab-inactive-fg-fallback-color: #FFFFFF; - --urlbar-focused-bg-color: #${config.look.colors.prime}; - --urlbar-not-focused-bg-color: #${config.look.colors.prime}; - --toolbar-bgcolor: #${config.look.colors.prime} !important; - ''; + profiles.default = { + isDefault = true; + containersForce = true; - # Profile settings - commonExtensions = with pkgs.nur.repos.rycee.firefox-addons; [ + containers = { + home = { + color = "purple"; + icon = "fruit"; + id = 0; + }; + school = { + color = "red"; + icon = "briefcase"; + id = 1; + }; + }; + + extensions = with pkgs.nur.repos.rycee.firefox-addons; [ bitwarden darkreader return-youtube-dislikes @@ -43,7 +30,8 @@ ublock-origin violentmonkey ]; - commonSearch = { + + search = { force = true; default = "Ecosia"; order = [ @@ -64,6 +52,7 @@ }]; definedAliases = [ "@e" ]; }; + "NixPKGs" = { urls = [{ template = "https://search.nixos.org/packages"; @@ -80,6 +69,7 @@ }]; definedAliases = [ "@p" ]; }; + "MyNixOS" = { urls = [{ template = "https://mynixos.com/search"; @@ -90,6 +80,7 @@ }]; definedAliases = [ "@my" ]; }; + "YouTube" = { urls = [{ template = "https://www.youtube.com/results"; @@ -100,13 +91,17 @@ }]; definedAliases = [ "@y" ]; }; + "Spotify" = { urls = [{ template = "https://open.spotify.com/search/{searchTerms}"; }]; definedAliases = [ "@s" ]; }; }; }; - commonSettings = { + + settings = { + force = true; + # Generic "browser.download.useDownloadDir" = true; "browser.shell.checkDefaultBrowser" = false; @@ -121,9 +116,9 @@ "webgl.disabled" = false; # Fonts - "font.name.serif.x-western" = config.look.fonts.main; - "font.name.sans-serif.x-western" = config.look.fonts.main; "font.name.monospace.x-western" = config.look.fonts.mono; + "font.name.sans-serif.x-western" = config.look.fonts.main; + "font.name.serif.x-western" = config.look.fonts.main; # Theming and visibility "browser.aboutConfig.showWarning" = false; @@ -143,47 +138,46 @@ "browser.newtabpage.enabled" = false; # Safe browsing + "browser.safebrowsing.blockedURIs.enabled" = false; "browser.safebrowsing.downloads.enabled" = false; - "browser.safebrowsing.downloads.remote.enabled" = false; - "browser.safebrowsing.downloads.remote.block_uncommon" = false; "browser.safebrowsing.downloads.remote.block_potentially_unwanted" = false; + "browser.safebrowsing.downloads.remote.block_uncommon" = false; + "browser.safebrowsing.downloads.remote.enabled" = false; "browser.safebrowsing.malware.enabled" = false; "browser.safebrowsing.phishing.enabled" = false; - "browser.safebrowsing.blockedURIs.enabled" = false; - "browser.safebrowsing.provider.google4.gethashURL" = false; - "browser.safebrowsing.provider.google4.updateURL" = false; "browser.safebrowsing.provider.google.gethashURL" = false; "browser.safebrowsing.provider.google.updateURL" = false; + "browser.safebrowsing.provider.google4.gethashURL" = false; + "browser.safebrowsing.provider.google4.updateURL" = false; # Extensions - "extensions.pocket.enabled" = false; "extensions.formautofill.addresses.enabled" = false; "extensions.formautofill.creditCards.enabled" = false; "extensions.getAddons.showPane" = false; "extensions.htmlaboutaddons.discover.enabled" = false; "extensions.htmlaboutaddons.recommendations.enabled" = false; + "extensions.pocket.enabled" = false; # Force extensions to work "extensions.autoDisableScopes" = 0; "extensions.enabledScopes" = 15; # Privacy - "privacy.resistFingerprinting" = true; - "privacy.firstparty.isolate" = true; - "privacy.fingerprintingProtection" = true; - "privacy.globalprivacycontrol.enabled" = true; - "privacy.globalprivacycontrol.functionality.enabled" = true; "privacy.clearOnShutdown.cookies" = false; "privacy.clearOnShutdown_v2.cookiesAndStorage" = false; + "privacy.fingerprintingProtection" = true; + "privacy.firstparty.isolate" = true; + "privacy.globalprivacycontrol.enabled" = true; + "privacy.globalprivacycontrol.functionality.enabled" = true; + "privacy.resistFingerprinting" = true; # Tracking URL blocking - "urlclassifier.trackingSkipURLs" = "*.reddit.com, *.twitter.com, *.twimg.com, *.tiktok.com"; "urlclassifier.features.socialtracking.skipURLs" = "*.instagram.com, *.twitter.com, *.twimg.com"; + "urlclassifier.trackingSkipURLs" = "*.reddit.com, *.twitter.com, *.twimg.com, *.tiktok.com"; # Network tracking "browser.contentblocking.category" = "strict"; "network.cookie.cookieBehavior" = 1; - "network.cookie.sameSite.noneRequiresSecure" = true; "network.http.referer.XOriginPolicy" = 2; "network.http.referer.XOriginTrimmingPolicy" = 2; "network.http.referer.trimmingPolicy" = 2; @@ -209,40 +203,28 @@ "services.sync.engine.addresses.available" = false; "svg.context-properties.content.enabled" = true; }; - in { - Main = { - id = 0; - isDefault = true; - extensions = commonExtensions; - search = commonSearch; - settings = commonSettings; - userChrome = '' - ${themeMain} - ${themeFont} + + userChrome = '' + :root { + --tab-active-bg-color: #${config.look.colors.prime}; + --tab-hover-bg-color: #${config.look.colors.accent}; + --tab-inactive-bg-color: #${config.look.colors.dark}; + --tab-active-fg-fallback-color: #FFFFFF; + --tab-inactive-fg-fallback-color: #${config.look.colors.text}; + --urlbar-focused-bg-color: #${config.look.colors.dark}; + --urlbar-not-focused-bg-color: #${config.look.colors.dark}; + --toolbar-bgcolor: #${config.look.colors.dark} !important; + --tab-font: '${config.look.fonts.main}'; + --urlbar-font: '${config.look.fonts.main}'; ${builtins.readFile ./quteFox.css} - ''; - }; - Alt = { - id = 1; - extensions = commonExtensions; - search = commonSearch; - settings = commonSettings; - userChrome = '' - ${themeAlt} - ${themeFont} - ${builtins.readFile ./quteFox.css} - ''; - }; + ''; }; }; # Symlinks to Librewolf home = { - file = { - ".librewolf".source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/.mozilla/firefox"; - ".mozilla/librewolf".source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/.mozilla/firefox"; - }; - persistence."${config.xdg.userDirs.extraConfig.XDG_PERSIST_DIR}".directories = [ "browser/.mozilla" ]; + file.".librewolf".source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/.mozilla/firefox"; + persistence."${config.xdg.userDirs.extraConfig.XDG_PERSIST_DIR}".directories = [ "browser/.mozilla/firefox/default" ]; }; }; } diff --git a/modules/home/programs/misc/gaming/launchers/default.nix b/modules/home/programs/misc/gaming/launchers/default.nix index f937135e..bf58d51f 100644 --- a/modules/home/programs/misc/gaming/launchers/default.nix +++ b/modules/home/programs/misc/gaming/launchers/default.nix @@ -8,10 +8,10 @@ steam steam-run-free ]; - persistence."${config.xdg.userDirs.extraConfig.XDG_PERSIST_DIR}".directories = [ - "games/.config/heroic" - "games/.local/share/PrismLauncher" - "games/.local/share/Steam" + persistence."${config.xdg.userDirs.extraConfig.XDG_PERSIST_DIR}".directories = with lib; with config.home; with config.xdg; [ + "games/${removePrefix "${homeDirectory}/" configHome}/heroic" + "games/${removePrefix "${homeDirectory}/" dataHome}/PrismLauncher" + "games/${removePrefix "${homeDirectory}/" dataHome}/Steam" ]; }; diff --git a/modules/home/programs/misc/general/default.nix b/modules/home/programs/misc/general/default.nix index 7419dde3..473872c5 100644 --- a/modules/home/programs/misc/general/default.nix +++ b/modules/home/programs/misc/general/default.nix @@ -6,9 +6,9 @@ qbittorrent vesktop ]; - persistence."${config.xdg.userDirs.extraConfig.XDG_PERSIST_DIR}".directories = [ - "data/.config/qBittorrent" - "data/.config/vesktop" + persistence."${config.xdg.userDirs.extraConfig.XDG_PERSIST_DIR}".directories = with lib; with config.home; with config.xdg; [ + "data/${removePrefix "${homeDirectory}/" configHome}/qBittorrent" + "data/${removePrefix "${homeDirectory}/" configHome}/vesktop" ]; }; } diff --git a/modules/home/programs/misc/production/default.nix b/modules/home/programs/misc/production/default.nix index a9fea8b9..f00142e9 100644 --- a/modules/home/programs/misc/production/default.nix +++ b/modules/home/programs/misc/production/default.nix @@ -8,10 +8,10 @@ blender_4_4 krita ]; - persistence."${config.xdg.userDirs.extraConfig.XDG_PERSIST_DIR}".directories = [ - "data/.config/audacity" - "data/.config/blender" - "data/.local/share/krita" + persistence."${config.xdg.userDirs.extraConfig.XDG_PERSIST_DIR}".directories = with lib; with config.home; with config.xdg; [ + "data/${removePrefix "${homeDirectory}/" configHome}/audacity" + "data/${removePrefix "${homeDirectory}/" configHome}/blender" + "data/${removePrefix "${homeDirectory}/" dataHome}/krita" ]; }; } diff --git a/modules/home/programs/misc/school/default.nix b/modules/home/programs/misc/school/default.nix index 2e1388bf..1bf20c7a 100644 --- a/modules/home/programs/misc/school/default.nix +++ b/modules/home/programs/misc/school/default.nix @@ -11,13 +11,12 @@ shellAliases.seneca = "ssh jhampton1@matrix.senecapolytechnic.ca"; - persistence."${config.xdg.userDirs.extraConfig.XDG_PERSIST_DIR}".directories = [ - "school/.cache/gpclient" - "school/.config/com.yuezk.qt" - "school/.config/remmina" - "school/.config/teams-for-linux" + persistence."${config.xdg.userDirs.extraConfig.XDG_PERSIST_DIR}".directories = with lib; with config.home; with config.xdg; [ + "school/${removePrefix "${homeDirectory}/" cacheHome}/gpclient" + "school/${removePrefix "${homeDirectory}/" configHome}/com.yuezk.qt" + "school/${removePrefix "${homeDirectory}/" configHome}/remmina" + "school/${removePrefix "${homeDirectory}/" configHome}/teams-for-linux" "school/.vmware" - "school/vmware" ]; }; } diff --git a/modules/home/programs/terminal/fastfetch/configs/config.jsonc b/modules/home/programs/terminal/fastfetch/configs/config.jsonc deleted file mode 100644 index cae0ed27..00000000 --- a/modules/home/programs/terminal/fastfetch/configs/config.jsonc +++ /dev/null @@ -1,97 +0,0 @@ -{ - "$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json", - "logo": { - "source": "xenia", - "color": { - "1": "1;97", - "2": "red", - "3": "yellow" - } - }, - "display": { - "separator": " \u001b[33m ", - "color": "red" - }, - "modules": [ - { - "type": "custom", - "format": "\u001b[1m—————————————————————————————————————" - }, - { - "type": "host", - "key": "󰌢 " - }, - { - "type": "cpu", - "key": " " - }, - { - "type": "gpu", - "key": "󰢮 " - }, - { - "type": "disk", - "folders": "/", - "key": " " - }, - { - "type": "memory", - "format": "{/1}{-}{/}{/2}{-}{/}{} / {}", - "key": " " - }, - { - "type": "display", - "compactType": "original", - "key": "󰍹 " - }, - - { - "type": "custom", - "format": "\u001b[1m—————————————————————————————————————" - }, - { - "type": "os", - "format": "{3} {12}", - "key": "󰍛 " - }, - { - "type": "kernel", - "format": "{1} {2}", - "key": " " - }, - { - "type": "wm", - "key": " " - }, - { - "type": "shell", - "key": " " - }, - { - "type": "terminal", - "key": " " - }, - { - "type": "packages", - "key": "󰆧 " - }, - { - "type": "uptime", - "key": "󰅐 " - }, - { - "type": "command", - "text": "date -d @$(stat -c %W /persist) '+%a %b %d %r %Y'", - "key": "󰶡 " - }, - - { - "type": "custom", - "format": "\u001b[1m—————————————————————————————————————" - }, - { - "type": "custom", - "format": "\u001b[90m󰮯 \u001b[31m󰊠 \u001b[32m󰊠 \u001b[33m󰊠 \u001b[34m󰊠 \u001b[35m󰊠 \u001b[36m󰊠 \u001b[37m󰊠" - } - ] -} diff --git a/modules/home/programs/terminal/fastfetch/default.nix b/modules/home/programs/terminal/fastfetch/default.nix index a89c46fa..7ac645b5 100644 --- a/modules/home/programs/terminal/fastfetch/default.nix +++ b/modules/home/programs/terminal/fastfetch/default.nix @@ -1,11 +1,108 @@ -{ pkgs, ... }: +{ ... }: { - programs.fastfetch.enable = true; + imports = [ ./smallfetch ]; - home = { - shellAliases.ff = "clear && fastfetch"; - packages = with pkgs; [ (writeScriptBin "smallfetch" "fastfetch --config ~/.config/fastfetch/small.jsonc") ]; + programs.fastfetch = { + enable = true; + settings = { + logo = { + source = "xenia"; + color = { + "1" = "1;97"; + "2" = "red"; + "3" = "yellow"; + }; + }; + + display = { + separator = '' \u001b[33m ''; + color = "red"; + }; + + modules = [ + { + type = "custom"; + format = ''\u001b[1m—————————————————————————————————————''; + } + { + type = "host"; + key = "󰌢 "; + } + { + type = "cpu"; + key = " "; + } + { + type = "gpu"; + key = "󰢮 "; + } + { + type = "disk"; + folders = "/"; + key = " "; + } + { + type = "memory"; + format = "{/1};-}{/}{/2}{-}{/}{} / {}"; + key = " "; + } + { + type = "display"; + compactType = "original"; + key = "󰍹 "; + } + + { + type = "custom"; + format = ''\u001b[1m—————————————————————————————————————''; + } + { + type = "os"; + format = "{3} {12}"; + key = "󰍛 "; + } + { + type = "kernel"; + format = "{1} {2}"; + key = " "; + } + { + type = "wm"; + key = " "; + } + { + type = "shell"; + key = " "; + } + { + type = "terminal"; + key = " "; + } + { + type = "packages"; + key = "󰆧 "; + } + { + type = "uptime"; + key = "󰅐 "; + } + { + type = "command"; + text = "date -d @$(stat -c %W /persist) '+%a %b %d %r %Y'"; + key = "󰶡 "; + } + + { + type = "custom"; + format = ''\u001b[1m—————————————————————————————————————''; + } + { + type = "custom"; + format = ''\u001b[90m󰮯 \u001b[31m󰊠 \u001b[32m󰊠 \u001b[33m󰊠 \u001b[34m󰊠 \u001b[35m󰊠 \u001b[36m󰊠 \u001b[37m󰊠''; + } + ]; + }; }; - xdg.configFile."fastfetch".source = ./configs; + home.shellAliases.ff = "clear && fastfetch"; } diff --git a/modules/home/programs/terminal/fastfetch/configs/small.jsonc b/modules/home/programs/terminal/fastfetch/smallfetch/config.jsonc similarity index 100% rename from modules/home/programs/terminal/fastfetch/configs/small.jsonc rename to modules/home/programs/terminal/fastfetch/smallfetch/config.jsonc diff --git a/modules/home/programs/terminal/fastfetch/smallfetch/default.nix b/modules/home/programs/terminal/fastfetch/smallfetch/default.nix new file mode 100644 index 00000000..8b03d77f --- /dev/null +++ b/modules/home/programs/terminal/fastfetch/smallfetch/default.nix @@ -0,0 +1,9 @@ +{ pkgs, ... }: +{ + home.packages = with pkgs; [ + (writeScriptBin "smallfetch" '' + #!/bin/sh + fastfetch --config ${builtins.toString ./config.jsonc} + '') + ]; +} diff --git a/modules/home/programs/terminal/nix-index/default.nix b/modules/home/programs/terminal/nix-index/default.nix index e82e0dd3..448d8677 100644 --- a/modules/home/programs/terminal/nix-index/default.nix +++ b/modules/home/programs/terminal/nix-index/default.nix @@ -2,5 +2,5 @@ { programs.nix-index.enable = true; - home.persistence."${config.xdg.userDirs.extraConfig.XDG_PERSIST_DIR}".directories = [ "nix/.cache/nix-index" ]; + home.persistence."${config.xdg.userDirs.extraConfig.XDG_PERSIST_DIR}".directories = [ "state/.cache/nix-index" ]; } diff --git a/modules/home/programs/terminal/zsh/default.nix b/modules/home/programs/terminal/zsh/default.nix index b81f3851..1353018a 100644 --- a/modules/home/programs/terminal/zsh/default.nix +++ b/modules/home/programs/terminal/zsh/default.nix @@ -1,4 +1,4 @@ -{ config, pkgs, ... }: +{ config, lib, pkgs, ... }: { programs.zsh = { enable = true; @@ -16,6 +16,7 @@ }; history = { append = true; + expireDuplicatesFirst = true; ignoreAllDups = true; ignoreSpace = true; path = "$ZDOTDIR/.zsh_history"; @@ -26,5 +27,6 @@ ''; }; - home.persistence."${config.xdg.userDirs.extraConfig.XDG_PERSIST_DIR}".directories = [ "state/.config/zsh" ]; + home.persistence."${config.xdg.userDirs.extraConfig.XDG_PERSIST_DIR}".directories = with lib; with config.home; with config.xdg; + [ "state/${removePrefix "${homeDirectory}/" configHome}/zsh" ]; } diff --git a/modules/home/services/gpg/default.nix b/modules/home/services/gpg/default.nix index 72dcbe1b..dfd108be 100644 --- a/modules/home/services/gpg/default.nix +++ b/modules/home/services/gpg/default.nix @@ -5,5 +5,7 @@ enableSshSupport = true; }; + programs.gpg.enable = true; + home.persistence."${config.xdg.userDirs.extraConfig.XDG_PERSIST_DIR}".directories = [ "secure/.gnupg" ]; } diff --git a/modules/home/settings/impermanence/default.nix b/modules/home/settings/impermanence/default.nix index 04e50743..7a8e4642 100644 --- a/modules/home/settings/impermanence/default.nix +++ b/modules/home/settings/impermanence/default.nix @@ -3,22 +3,23 @@ imports = [ impermanence.homeManagerModules.default ]; home.persistence."${config.xdg.userDirs.extraConfig.XDG_PERSIST_DIR}" = { + enable = true; allowOther = false; removePrefixDirectory = true; - directories = [ - "dirs/Keepers" - "dirs/Projects" - - "nix/.local/state/nix/profiles" + directories = let + home = config.home.homeDirectory; + strip = path: lib.removePrefix "${home}/" path; + in with config.xdg.userDirs; [ + "dirs/${strip extraConfig.XDG_KEEPERS_DIR}" + "dirs/${strip extraConfig.XDG_PROJECTS_DIR}" "secure/.ssh" ] ++ (if config.home.desktop.enable then [ - "dirs/Documents" - "dirs/Games" - "dirs/Photos" - "dirs/Videos" + "dirs/${strip documents}" + "dirs/${strip extraConfig.XDG_GAMES_DIR}" + "dirs/${strip pictures}" + "dirs/${strip videos}" - "secure/.pki" - "state/.local/state/wireplumber" + "state/${strip config.xdg.stateHome}/wireplumber" ] else []); }; } diff --git a/modules/home/settings/xdg/default.nix b/modules/home/settings/xdg/default.nix index 25fda81c..f489ee0e 100644 --- a/modules/home/settings/xdg/default.nix +++ b/modules/home/settings/xdg/default.nix @@ -1,9 +1,11 @@ -{ ... }: +{ config, ... }: { imports = [ ./defaults ./folders ]; + xdg.enable = config.home.desktop.enable; + home.preferXdgDirectories = true; } diff --git a/modules/home/settings/xdg/defaults/default.nix b/modules/home/settings/xdg/defaults/default.nix index 1646ea18..8a1f04d4 100644 --- a/modules/home/settings/xdg/defaults/default.nix +++ b/modules/home/settings/xdg/defaults/default.nix @@ -1,18 +1,21 @@ -{ ... }: +{ config, ... }: { - xdg.mimeApps.defaultApplications = { - # Media - "image/*" = [ "imv.desktop" ]; - "image/gif" = [ "mpv.desktop" ]; - "video/*" = [ "mpv.desktop" ]; + xdg.mimeApps = { + enable = config.xdg.enable; + defaultApplications = { + # Media + "image/*" = [ "imv.desktop" ]; + "image/gif" = [ "mpv.desktop" ]; + "video/*" = [ "mpv.desktop" ]; - # Apps - "inode/directory" = [ "pcmanfm-qt.desktop" ]; - "text/plain" = [ "nvim.desktop" ]; + # Apps + "inode/directory" = [ "pcmanfm-qt.desktop" ]; + "text/plain" = [ "nvim.desktop" ]; - # Browser - "application/x-mswinurl" = [ "librewolf.desktop" ]; - "x-scheme-handler/http" = [ "librewolf.desktop" ]; - "x-scheme-handler/https" = [ "librewolf.desktop" ]; + # Browser + "application/x-mswinurl" = [ "librewolf.desktop" ]; + "x-scheme-handler/http" = [ "librewolf.desktop" ]; + "x-scheme-handler/https" = [ "librewolf.desktop" ]; + }; }; } diff --git a/modules/home/settings/xdg/folders/default.nix b/modules/home/settings/xdg/folders/default.nix index 72486278..289e0094 100644 --- a/modules/home/settings/xdg/folders/default.nix +++ b/modules/home/settings/xdg/folders/default.nix @@ -1,17 +1,20 @@ { config, ... }: { - xdg.userDirs = { - enable = config.home.desktop.enable; + xdg.userDirs = with config.home; { + enable = config.xdg.enable; createDirectories = true; desktop = null; - pictures = "${config.home.homeDirectory}/Photos"; music = null; + pictures = "${homeDirectory}/Photos"; publicShare = null; templates = null; extraConfig = { - XDG_PERSIST_DIR = if !config.targets.genericLinux.enable then "/persist${config.home.homeDirectory}" else "${config.home.homeDirectory}/.stow"; + XDG_GAMES_DIR = "${homeDirectory}/Games"; + XDG_KEEPERS_DIR = "${homeDirectory}/Keepers"; + XDG_PERSIST_DIR = if !config.targets.genericLinux.enable then "/persist${homeDirectory}" else "${homeDirectory}/.stow"; + XDG_PROJECTS_DIR = "${homeDirectory}/Projects"; XDG_SCREENSHOTS_DIR = "${config.xdg.userDirs.pictures}/Screenshots"; }; }; diff --git a/modules/home/variables/look/border/default.nix b/modules/home/variables/look/border/default.nix index 8ffa16e4..1c81d9c5 100644 --- a/modules/home/variables/look/border/default.nix +++ b/modules/home/variables/look/border/default.nix @@ -1,10 +1,6 @@ -{ config, lib, ... }: +{ ... }: { - options.look.border = lib.mkOption { - type = lib.types.attrs; - }; - - config.look.border = rec { + look.border = rec { int = 3; string = toString int; }; diff --git a/modules/home/variables/look/colors/default.nix b/modules/home/variables/look/colors/default.nix index e75d1e6a..1376a541 100644 --- a/modules/home/variables/look/colors/default.nix +++ b/modules/home/variables/look/colors/default.nix @@ -1,10 +1,6 @@ -{ config, lib, ... }: +{ ... }: { - options.look.colors = lib.mkOption { - type = lib.types.attrs; - }; - - config.look.colors = { + look.colors = { prime = "3823C4"; #3823C4 accent = "1B1F59"; #1B1F59 split = "555B9E"; #555B9E diff --git a/modules/home/variables/look/default.nix b/modules/home/variables/look/default.nix index a5930b9c..82be4f01 100644 --- a/modules/home/variables/look/default.nix +++ b/modules/home/variables/look/default.nix @@ -1,8 +1,12 @@ -{ ... }: +{ config, lib, ... }: { imports = [ ./border ./colors ./fonts ]; + + options.look = lib.mkOption { + type = lib.types.attrs; + }; } diff --git a/modules/home/variables/look/fonts/default.nix b/modules/home/variables/look/fonts/default.nix index b8cc234c..9e3921e8 100644 --- a/modules/home/variables/look/fonts/default.nix +++ b/modules/home/variables/look/fonts/default.nix @@ -1,10 +1,6 @@ -{ config, lib, ... }: +{ ... }: { - options.look.fonts = lib.mkOption { - type = lib.types.attrs; - }; - - config.look.fonts = { + look.fonts = { main = "Ubuntu"; mono = "UbuntuMono Nerd Font"; }; diff --git a/modules/home/wms/programs/waybar/default.nix b/modules/home/wms/programs/waybar/default.nix index 35aadb64..6ab1fee1 100644 --- a/modules/home/wms/programs/waybar/default.nix +++ b/modules/home/wms/programs/waybar/default.nix @@ -1,245 +1,237 @@ { config, lib, pkgs, ... }: { programs.waybar = let - workspaceModule = { - format = "{name}"; - enable-bar-scroll = true; - disable-scroll-wraparound = true; - numeric-first = true; - warp-on-scroll = false; - }; - - windowModule = { - icon = true; - icon-size = 15; - all-outputs = true; - tooltip = false; - rewrite = { - "(.*) — LibreWolf" = " $1"; - "LibreWolf" = " Firefox"; - "(.*) - LibreWolf — Firefox" = "󰗃 $1"; + commonModules = { + "sway/workspaces" = { + format = "{name}"; + enable-bar-scroll = true; + disable-scroll-wraparound = true; + numeric-first = true; + warp-on-scroll = false; }; - }; - pulseModule = with pkgs; { - format = "{icon} {volume}%"; - format-bluetooth = "{icon} {volume}%"; - format-muted = " muted"; - format-icons = { - headphone = "󰋋 "; - headset = "󰋋 "; - default = [ - " " - " " + "sway/window" = { + icon = true; + icon-size = 15; + all-outputs = true; + tooltip = false; + }; + + "pulseaudio" = with pkgs; { + format = "{icon} {volume}%"; + format-bluetooth = "{icon} {volume}%"; + format-muted = " muted"; + format-icons = { + headphone = "󰋋 "; + headset = "󰋋 "; + default = [ + " " + " " + ]; + }; + on-click = "${wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"; + on-click-middle = "${wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 100%"; + on-click-right = "${wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 60%"; + ignored-sinks = [ "Easy Effects Sink" ]; + }; + + "mpris" = { + player = "mpd"; + format = " {title}"; + format-paused = " {artist}"; + format-stopped = ""; + tooltip-format = lib.concatStrings [ + "{title} - {artist} - {album}\n" + "{position}/{length}" + ]; + interval = 2; + max-length = 30; + }; + + "custom/notifs" = with pkgs; { + exec = pkgs.writeScript "notificationScript.sh" '' + #!/bin/sh + + SED="${gnused}/bin/sed" + MAKOCTL="${mako}/bin/makoctl" + + # Extract the second line after "default" + mode=$(echo "$($MAKOCTL mode)" | $SED -n '/default/{n;p}') + + # Print the notification status with the tooltip + if [[ "$mode" == "do-not-disturb" ]]; then + printf '{"text":"󱆥 Off","class":"disabled","tooltip":"Notifications Disabled."}' + else + printf '{"text":" On","tooltip":"Notifications Enabled."}'; + fi + ''; + format = "{}"; + return-type = "json"; + interval = 2; + on-click = "${mako}/bin/makoctl mode -t do-not-disturb"; + }; + + "idle_inhibitor" = { + format = "{icon}"; + format-icons = { + activated = " On"; + deactivated = "󰾫 Off"; + tooltip-format-activated = "Sleep inhibited."; + tooltip-format-deactivated = "Sleep uninhibited."; + }; + }; + + "custom/weather" = { + exec = "${pkgs.wttrbar}/bin/wttrbar --ampm"; + format = "{}°"; + tooltip = true; + return-type = "json"; + interval = 3600; + }; + + "cpu" = { + format = " {usage}%"; + interval = 3; + }; + + "memory" = { + format = " {used}G"; + tooltip = false; + interval = 3; + }; + + "custom/vram" = { + exec = with pkgs; pkgs.writeScript "vramScript.sh" '' + #!/bin/sh + + LSPCI="${pciutils}/bin/lspci" + GREP="${gnugrep}/bin/grep" + AWK="${gawk}/bin/awk" + BC="${bc}/bin/bc" + HEAD="${uutils-coreutils-noprefix}/bin/head" + CAT="${uutils-coreutils-noprefix}/bin/cat" + NVIDIA="/run/current-system/sw/bin/nvidia-smi" + + # Detect the active GPU driver + gpu_driver="$($LSPCI -k | $GREP -Eo 'in use: (nvidia|amdgpu)' | $AWK '{print $3}')" + + # Exit if no supported GPU driver is in use + if [[ -z "$gpu_driver" ]]; then + exit 0 + fi + + # Get VRAM usage in MB + if [[ "$gpu_driver" == "nvidia" ]]; then + vram_usage_mb="$($NVIDIA --query-gpu=memory.used --format=csv,noheader,nounits | $HEAD -n1)" + elif [[ "$gpu_driver" == "amdgpu" ]]; then + vram_bytes="$($CAT /sys/class/drm/card*/device/mem_info_vram_used 2>/dev/null | $HEAD -n1)" + vram_usage_mb="$($BC <<< "$vram_bytes / 1024 / 1024")" + fi + + # Format VRAM usage for display + if [[ "$vram_usage_mb" -lt 1024 ]]; then + vram_usage_display="''${vram_usage_mb}M" + else + vram_usage_gib="$($BC <<< "scale=2; $vram_usage_mb / 1024")" + vram_usage_display="''${vram_usage_gib}G" + fi + + # Output the VRAM usage + echo "{\"text\": \"󰢮 ''${vram_usage_display}\"}" + ''; + format = "{}"; + return-type = "json"; + interval = 3; + }; + + "backlight" = { + format = "{icon} {percent}%"; + format-icons = [ + "" + "󰖨" + ]; + tooltip = false; + }; + + "battery" = { + interval = 60; + states = { + warning = 30; + critical = 15; + }; + format = "{icon} {capacity}%"; + format-icons = [ + "" + "" + "" + "" + "" ]; }; - on-click = "${wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"; - on-click-middle = "${wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 100%"; - on-click-right = "${wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 60%"; - ignored-sinks = [ "Easy Effects Sink" ]; - }; - # Monitoring - cpuModule = { - format = " {usage}%"; - interval = 3; - }; - - ramModule = { - format = " {used}G"; - tooltip = false; - interval = 3; - }; - - vramModule = { - exec = with pkgs; pkgs.writeScript "vramScript.sh" '' - #!/bin/sh - - LSPCI="${pciutils}/bin/lspci" - GREP="${gnugrep}/bin/grep" - AWK="${gawk}/bin/awk" - BC="${bc}/bin/bc" - HEAD="${uutils-coreutils-noprefix}/bin/head" - CAT="${uutils-coreutils-noprefix}/bin/cat" - NVIDIA="/run/current-system/sw/bin/nvidia-smi" - - # Detect the active GPU driver - gpu_driver="$($LSPCI -k | $GREP -Eo 'in use: (nvidia|amdgpu)' | $AWK '{print $3}')" - - # Exit if no supported GPU driver is in use - if [[ -z "$gpu_driver" ]]; then - exit 0 - fi - - # Get VRAM usage in MB - if [[ "$gpu_driver" == "nvidia" ]]; then - vram_usage_mb="$($NVIDIA --query-gpu=memory.used --format=csv,noheader,nounits | $HEAD -n1)" - elif [[ "$gpu_driver" == "amdgpu" ]]; then - vram_bytes="$($CAT /sys/class/drm/card*/device/mem_info_vram_used 2>/dev/null | $HEAD -n1)" - vram_usage_mb="$($BC <<< "$vram_bytes / 1024 / 1024")" - fi - - # Format VRAM usage for display - if [[ "$vram_usage_mb" -lt 1024 ]]; then - vram_usage_display="''${vram_usage_mb}M" - else - vram_usage_gib="$($BC <<< "scale=2; $vram_usage_mb / 1024")" - vram_usage_display="''${vram_usage_gib}G" - fi - - # Output the VRAM usage - echo "{\"text\": \"󰢮 ''${vram_usage_display}\"}" - ''; - format = "{}"; - return-type = "json"; - interval = 3; - }; - - # Clocks - clockModule = { - interval = 1; - format = "{:%a %b %d %I:%M:%S%p}"; - tooltip-format = "{calendar}"; - }; - - # Misc - trayModule.spacing = 5; - - # Wireless - networkModule = { - format-ethernet = "󰈀"; - format-wifi = ""; - format-disconnected = "󰖪"; - format-linked = ""; - tooltip-format-ethernet = lib.concatStrings [ - "{ipaddr}\n" - "{ifname} " - ]; - tooltip-format-wifi = lib.concatStrings [ - "{ipaddr}\n" - "{essid} ({signalStrength}%)" - ]; - tooltip-format-disconnected = "Disconnected"; - }; - - bluetoothModule = { - format = ""; - format-disabled = ""; - format-no-controller = ""; - tooltip-format-on = "No devices connected."; - tooltip-format-connected = lib.concatStrings [ - "{num_connections} connected\n" - "{device_enumerate}" - ]; - tooltip-format-enumerate-connected = "{device_alias}"; - tooltip-format-enumerate-connected-battery = "{device_alias} {device_battery_percentage}%"; - }; - - scratchpadModule = { - format = " {count}"; - show-empty = false; - tooltip = true; - tooltip-format = "{title}"; - }; - - gamemodeModule = { - format = "{glyph}"; - hide-not-running = true; - use-icon = true; - icon-size = 19; - icon-spacing = 0; - tooltip = true; - }; - - privacyModule = { - icon-spacing = 5; - icon-size = 15; - }; - - mprisModule = { - player = "mpd"; - format = " {title}"; - format-paused = " {artist}"; - format-stopped = ""; - tooltip-format = lib.concatStrings [ - "{title} - {artist} - {album}\n" - "{position}/{length}" - ]; - interval = 2; - max-length = 30; - }; - - notificationModule = with pkgs; { - exec = pkgs.writeScript "notificationScript.sh" '' - #!/bin/sh - - SED="${gnused}/bin/sed" - MAKOCTL="${mako}/bin/makoctl" - - # Extract the second line after "default" - mode=$(echo "$($MAKOCTL mode)" | $SED -n '/default/{n;p}') - - # Print the notification status with the tooltip - if [[ "$mode" == "do-not-disturb" ]]; then - printf '{"text":"󱆥 Off","class":"disabled","tooltip":"Notifications Disabled."}' - else - printf '{"text":" On","tooltip":"Notifications Enabled."}'; - fi - ''; - format = "{}"; - return-type = "json"; - interval = 2; - on-click = "${mako}/bin/makoctl mode -t do-not-disturb"; - }; - - idleModule = { - format = "{icon}"; - format-icons = { - activated = " On"; - deactivated = "󰾫 Off"; - tooltip-format-activated = "Sleep inhibited."; - tooltip-format-deactivated = "Sleep uninhibited."; + "clock" = { + interval = 1; + format = "{:%a %b %d %I:%M:%S%p}"; + tooltip-format = "{calendar}"; }; - }; - weatherModule = { - exec = "${pkgs.wttrbar}/bin/wttrbar --ampm"; - format = "{}°"; - tooltip = true; - return-type = "json"; - interval = 3600; - }; - - # Laptop modules - backlightModule = { - format = "{icon} {percent}%"; - format-icons = [ - "" - "󰖨" - ]; - tooltip = false; - }; - - batteryModule = { - interval = 60; - states = { - warning = 30; - critical = 15; + "sway/scratchpad" = { + format = " {count}"; + show-empty = false; + tooltip = true; + tooltip-format = "{title}"; + }; + + "privacy" = { + icon-spacing = 5; + icon-size = 15; + }; + + "gamemode" = { + format = "{glyph}"; + hide-not-running = true; + use-icon = true; + icon-size = 19; + icon-spacing = 0; + tooltip = true; + }; + + "tray".spacing = 5; + + "bluetooth" = { + format = ""; + format-disabled = ""; + format-no-controller = ""; + tooltip-format-on = "No devices connected."; + tooltip-format-connected = lib.concatStrings [ + "{num_connections} connected\n" + "{device_enumerate}" + ]; + tooltip-format-enumerate-connected = "{device_alias}"; + tooltip-format-enumerate-connected-battery = "{device_alias} {device_battery_percentage}%"; + }; + + "network" = { + format-ethernet = "󰈀"; + format-wifi = ""; + format-disconnected = "󰖪"; + format-linked = ""; + tooltip-format-ethernet = lib.concatStrings [ + "{ipaddr}\n" + "{ifname} " + ]; + tooltip-format-wifi = lib.concatStrings [ + "{ipaddr}\n" + "{essid} ({signalStrength}%)" + ]; + tooltip-format-disconnected = "Disconnected"; }; - format = "{icon} {capacity}%"; - format-icons = [ - "" - "" - "" - "" - "" - ]; }; in { enable = config.home.desktop.enable; systemd.enable = true; settings = { - displayPrimary = { + displayPrimary = commonModules // { name = "bar1"; position = "top"; layer = "top"; @@ -272,27 +264,9 @@ "bluetooth" "network" ]; - "sway/workspaces" = workspaceModule; - "sway/window" = windowModule; - "pulseaudio" = pulseModule; - "mpris" = mprisModule; - "custom/notifs" = notificationModule; - "idle_inhibitor" = idleModule; - "custom/weather" = weatherModule; - "cpu" = cpuModule; - "memory" = ramModule; - "custom/vram" = vramModule; - "backlight" = backlightModule; - "battery" = batteryModule; - "clock" = clockModule; - "sway/scratchpad" = scratchpadModule; - "privacy" = privacyModule; - "tray" = trayModule; - "bluetooth" = bluetoothModule; - "network" = networkModule; }; - displaySecondary = { + displaySecondary = commonModules // { name = "bar2"; position = "top"; layer = "top"; @@ -312,13 +286,6 @@ "custom/vram" "clock" ]; - "sway/workspaces" = workspaceModule; - "sway/window" = windowModule; - "pulseaudio" = pulseModule; - "cpu" = cpuModule; - "memory" = ramModule; - "custom/vram" = vramModule; - "clock" = clockModule; }; }; @@ -331,38 +298,21 @@ font-size: 15.5px; color: #${config.look.colors.text}; } - #waybar { - background: #${config.look.colors.dark}; - } - #workspaces { - padding: 0 6px 0 0; - } - #tray { - padding: 0 2px 0 5px; - } - #network { - padding: 0 10px 0 4px; - } - #bluetooth { - margin: 0 6px 0 4px; - font-size: 13.4px; - } + + #waybar { background: #${config.look.colors.dark}; } + #tray { padding: 0 2px 0 5px; } + #network { padding: 0 10px 0 4px; } + #scratchpad, #privacy { margin-left: 4px; } + #pulseaudio { margin-right: 5px; } + #mpris, #custom-notifs, #idle_inhibitor, #custom-weather, #cpu, #memory, #custom-vram, #backlight, #battery { margin: 0 5px 0 2px; } + + #workspaces { padding: 0 6px; } #workspaces button { padding: 0 3px; color: white; border-bottom: 3px solid transparent; min-width: 20px; } - #scratchpad, #privacy { - margin-left: 4px; - } - #mpris, #custom-notifs, #idle_inhibitor, #custom-weather, #cpu, #memory, #custom-vram, #backlight, #battery { - margin: 0 5px 0 2px; - } - #pulseaudio { - margin-right: 5px; - } - #workspaces button.visible, #workspaces button.active { border-bottom: 3px solid #${config.look.colors.prime}; background: #${config.look.colors.mid}; @@ -374,44 +324,25 @@ box-shadow: none; background: #${config.look.colors.light}; } - #mpris { - border-bottom: 3px solid #ffb066; - } - #custom-notifs { - border-bottom: 3px solid #3823C4; - } - #idle_inhibitor { - border-bottom: 3px solid #941efc; - } - #custom-weather { - border-bottom: 3px solid #ea60e3; - } - #cpu { - border-bottom: 3px solid #f90000; - } - #memory { - border-bottom: 3px solid #4bffdc; - } - #custom-vram { - border-bottom: 3px solid #33FF00; - } - #backlight { - border-bottom: 3px solid #5ffca3; - } - #battery { - border-bottom: 3px solid #fcfc16; - } - #clock { - border-bottom: 3px solid #0a6cf5; - margin: 0 2px 0 2px; + + #bluetooth { + margin: 0 6px 0 4px; + font-size: 13.4px; } - #mpris.paused, #custom-notifs.disabled, #idle_inhibitor.deactivated { - color: #888; - } - #pulseaudio.muted, #network.disconnected, #bluetooth.off { - color: #424242; - } + #mpris { border-bottom: 3px solid #ffb066; } + #custom-notifs { border-bottom: 3px solid #3823C4; } + #idle_inhibitor { border-bottom: 3px solid #941efc; } + #custom-weather { border-bottom: 3px solid #ea60e3; } + #cpu { border-bottom: 3px solid #f90000; } + #memory { border-bottom: 3px solid #4bffdc; } + #custom-vram { border-bottom: 3px solid #33FF00; } + #backlight { border-bottom: 3px solid #5ffca3; } + #battery { border-bottom: 3px solid #fcfc16; } + #clock { border-bottom: 3px solid #0a6cf5; } + + #mpris.paused, #custom-notifs.disabled, #idle_inhibitor.deactivated { color: #888; } + #pulseaudio.muted, #network.disconnected, #bluetooth.off { color: #424242; } ''; }; } diff --git a/modules/home/wms/sway/hotkeys/default.nix b/modules/home/wms/sway/hotkeys/default.nix index f8bd83b4..c14d1a90 100644 --- a/modules/home/wms/sway/hotkeys/default.nix +++ b/modules/home/wms/sway/hotkeys/default.nix @@ -11,9 +11,8 @@ keybindings = { ## Launchers - # Browser profiles - "${primeMod}+F1" = ''exec librewolf -p Main --name MainBrowser | notify-send "Main Browser"''; - "${primeMod}+F2" = ''exec librewolf -p Alt --name AltBrowser | notify-send "Alternate Browser"''; + # Browser + "${primeMod}+F1" = ''exec librewolf | notify-send "Browser"''; # Virtual machines "${primeMod}+F4" = ''exec virt-manager | notify-send "Virtual Machines"''; @@ -148,6 +147,7 @@ # Change layout "${primeMod}+f" = ''fullscreen toggle''; + "${primeMod}+${secMod}+f" = ''fullscreen toggle global''; "${primeMod}+w" = ''layout toggle split''; "${primeMod}+v" = ''split v''; "${primeMod}+e" = ''layout toggle tabbed stacking''; diff --git a/modules/home/wms/sway/rules/default.nix b/modules/home/wms/sway/rules/default.nix index 7eab9375..d50a4e73 100644 --- a/modules/home/wms/sway/rules/default.nix +++ b/modules/home/wms/sway/rules/default.nix @@ -55,9 +55,8 @@ ]; }; assigns = { - # Browsers - "1:${config.ws.w1}" = [{ app_id = "MainBrowser"; }]; - "11:${config.ws.w1a}" = [{ app_id = "AltBrowser"; }]; + # Browser + "1:${config.ws.w1}" = [{ app_id = "librewolf"; }]; # Communication "7:${config.ws.w7}" = [