From b808281674d6c09cea216d17caa690bda341dcb0 Mon Sep 17 00:00:00 2001 From: Anthony Rodriguez Date: Tue, 14 Jan 2025 19:33:31 +0100 Subject: [PATCH] treewide: config/home-manager -> modules/hm Started moving HM config to the new local modules system. Conditionally toggling based on profiles and modules. --- config/home-manager/default.nix | 1 - .../programs/browsers/default.nix | 4 - .../programs/browsers/firefox.nix | 172 ------------ config/home-manager/programs/default.nix | 45 ---- .../home-manager/programs/editors/helix.nix | 61 ----- .../home-manager/programs/editors/neovim.nix | 244 ----------------- .../home-manager/programs/games/default.nix | 10 - .../home-manager/programs/gnome/default.nix | 10 - config/home-manager/programs/hypr/idle.nix | 55 ---- .../home-manager/programs/hypr/land/binds.nix | 79 ------ .../programs/hypr/land/default.nix | 109 -------- config/home-manager/programs/hypr/lock.nix | 10 - config/home-manager/programs/hypr/paper.nix | 20 -- .../home-manager/programs/media/default.nix | 12 - .../home-manager/programs/media/zathura.nix | 17 -- config/home-manager/programs/niri/binds.nix | 168 ------------ config/home-manager/programs/niri/default.nix | 173 ------------ config/home-manager/programs/swaybg.nix | 19 -- config/home-manager/programs/swayidle.nix | 20 -- config/home-manager/programs/swaylock.nix | 24 -- config/home-manager/programs/walker.nix | 32 --- .../home-manager/programs/waybar/default.nix | 187 ------------- config/home-manager/programs/wlogout.nix | 66 ----- config/home-manager/programs/xdg.nix | 35 --- hosts/default.nix | 7 +- hosts/vamos/default.nix | 5 +- modules/hm/default.nix | 3 + modules/hm/programs/browsers/default.nix | 3 + modules/hm/programs/browsers/firefox.nix | 176 +++++++++++++ modules/hm/programs/default.nix | 16 ++ modules/hm/programs/editors/default.nix | 6 + modules/hm/programs/editors/helix.nix | 64 +++++ modules/hm/programs/editors/neovim.nix | 247 ++++++++++++++++++ modules/hm/programs/games.nix | 17 ++ modules/hm/programs/gnome.nix | 16 ++ .../hm}/programs/hypr/default.nix | 0 modules/hm/programs/hypr/idle.nix | 58 ++++ modules/hm/programs/hypr/land/binds.nix | 85 ++++++ modules/hm/programs/hypr/land/default.nix | 114 ++++++++ modules/hm/programs/hypr/lock.nix | 14 + modules/hm/programs/hypr/paper.nix | 22 ++ modules/hm/programs/media/default.nix | 20 ++ modules/hm/programs/media/zathura.nix | 23 ++ modules/hm/programs/misc.nix | 40 +++ modules/hm/programs/walker.nix | 35 +++ modules/hm/programs/waybar.nix | 190 ++++++++++++++ modules/hm/programs/wlogout.nix | 69 +++++ modules/hm/programs/xdg.nix | 42 +++ 48 files changed, 1265 insertions(+), 1580 deletions(-) delete mode 100644 config/home-manager/programs/browsers/default.nix delete mode 100644 config/home-manager/programs/browsers/firefox.nix delete mode 100644 config/home-manager/programs/default.nix delete mode 100644 config/home-manager/programs/editors/helix.nix delete mode 100644 config/home-manager/programs/editors/neovim.nix delete mode 100644 config/home-manager/programs/games/default.nix delete mode 100644 config/home-manager/programs/gnome/default.nix delete mode 100644 config/home-manager/programs/hypr/idle.nix delete mode 100644 config/home-manager/programs/hypr/land/binds.nix delete mode 100644 config/home-manager/programs/hypr/land/default.nix delete mode 100644 config/home-manager/programs/hypr/lock.nix delete mode 100644 config/home-manager/programs/hypr/paper.nix delete mode 100644 config/home-manager/programs/media/default.nix delete mode 100644 config/home-manager/programs/media/zathura.nix delete mode 100644 config/home-manager/programs/niri/binds.nix delete mode 100644 config/home-manager/programs/niri/default.nix delete mode 100644 config/home-manager/programs/swaybg.nix delete mode 100644 config/home-manager/programs/swayidle.nix delete mode 100644 config/home-manager/programs/swaylock.nix delete mode 100644 config/home-manager/programs/walker.nix delete mode 100644 config/home-manager/programs/waybar/default.nix delete mode 100644 config/home-manager/programs/wlogout.nix delete mode 100644 config/home-manager/programs/xdg.nix create mode 100644 modules/hm/default.nix create mode 100644 modules/hm/programs/browsers/default.nix create mode 100644 modules/hm/programs/browsers/firefox.nix create mode 100644 modules/hm/programs/default.nix create mode 100644 modules/hm/programs/editors/default.nix create mode 100644 modules/hm/programs/editors/helix.nix create mode 100644 modules/hm/programs/editors/neovim.nix create mode 100644 modules/hm/programs/games.nix create mode 100644 modules/hm/programs/gnome.nix rename {config/home-manager => modules/hm}/programs/hypr/default.nix (100%) create mode 100644 modules/hm/programs/hypr/idle.nix create mode 100644 modules/hm/programs/hypr/land/binds.nix create mode 100644 modules/hm/programs/hypr/land/default.nix create mode 100644 modules/hm/programs/hypr/lock.nix create mode 100644 modules/hm/programs/hypr/paper.nix create mode 100644 modules/hm/programs/media/default.nix create mode 100644 modules/hm/programs/media/zathura.nix create mode 100644 modules/hm/programs/misc.nix create mode 100644 modules/hm/programs/walker.nix create mode 100644 modules/hm/programs/waybar.nix create mode 100644 modules/hm/programs/wlogout.nix create mode 100644 modules/hm/programs/xdg.nix diff --git a/config/home-manager/default.nix b/config/home-manager/default.nix index 284a1aa..51a6f19 100644 --- a/config/home-manager/default.nix +++ b/config/home-manager/default.nix @@ -2,6 +2,5 @@ _: { imports = [ ./services/udiskie.nix ./terminal - ./programs ]; } diff --git a/config/home-manager/programs/browsers/default.nix b/config/home-manager/programs/browsers/default.nix deleted file mode 100644 index b3bcded..0000000 --- a/config/home-manager/programs/browsers/default.nix +++ /dev/null @@ -1,4 +0,0 @@ -{ - imports = [./firefox.nix]; - home.sessionVariables.BROWSER = "firefox"; -} diff --git a/config/home-manager/programs/browsers/firefox.nix b/config/home-manager/programs/browsers/firefox.nix deleted file mode 100644 index a2b2de9..0000000 --- a/config/home-manager/programs/browsers/firefox.nix +++ /dev/null @@ -1,172 +0,0 @@ -{ - inputs, - pkgs, - ... -}: let - betterfox = pkgs.fetchFromGitHub { - owner = "yokoffing"; - repo = "betterfox"; - rev = "e026ed7d3a763c5d3f96c2680d7bc3340831af4f"; - hash = "sha256-hpkEO5BhMVtINQG8HN4xqfas/R6q5pYPZiFK8bilIDs="; - }; -in { - programs.firefox = { - enable = true; - package = pkgs.wrapFirefox pkgs.firefox-unwrapped { - extraPolicies = { - DisableTelemetry = true; - DisablePocket = true; - DisableFeedbackCommands = true; - DisableFirefoxStudies = true; - OfferToSaveLogins = false; - OffertosaveloginsDefault = false; - PasswordManagerEnabled = false; - SearchSuggestEnabled = true; - - # https://github.com/Sly-Harvey/NixOS/blob/f9da2691ea46565256ad757959cfc26ec6cee10d/modules/programs/browser/firefox/default.nix#L58-L163 - "3rdparty".Extensions = { - "addon@darkreader.org" = { - permissions = ["internal:privateBrowsingAllowed"]; - enabled = true; - automation = { - enabled = true; - behavior = "OnOff"; - mode = "system"; - }; - detectDarkTheme = true; - enabledByDefault = true; - changeBrowserTheme = false; - enableForProtectedPages = true; - fetchNews = false; - previewNewDesign = true; - }; - "uBlock0@raymondhill.net" = { - permissions = ["internal:privateBrowsingAllowed"]; - advancedSettings = [ - [ - "userResourcesLocation" - "https://raw.githubusercontent.com/pixeltris/TwitchAdSolutions/master/video-swap-new/video-swap-new-ublock-origin.js" - ] - ]; - adminSettings = { - userSettings = { - uiTheme = "dark"; - advancedUserEnabled = true; - userFiltersTrusted = true; - importedLists = [ - "https://raw.githubusercontent.com/laylavish/uBlockOrigin-HUGE-AI-Blocklist/main/list.txt" - ]; - selectedFilterLists = [ - "FRA-0" - "adguard-cookies" - "adguard-mobile-app-banners" - "adguard-other-annoyances" - "adguard-popup-overlays" - "adguard-social" - "adguard-spyware-url" - "adguard-widgets" - "easylist" - "easylist-annoyances" - "easylist-chat" - "easylist-newsletters" - "easylist-notifications" - "easyprivacy" - "fanboy-cookiemonster" - "https://filters.adtidy.org/extension/ublock/filters/3.txt" - "https://github.com/DandelionSprout/adfilt/raw/master/LegitimateURLShortener.txt" - "plowe-0" - "ublock-annoyances" - "ublock-badware" - "ublock-cookies-adguard" - "ublock-cookies-easylist" - "ublock-filters" - "ublock-privacy" - "ublock-quick-fixes" - "ublock-unbreak" - "urlhaus-1" - "https://raw.githubusercontent.com/laylavish/uBlockOrigin-HUGE-AI-Blocklist/main/list.txt" - ]; - }; - }; - }; - }; - }; - }; - profiles = { - nezia = { - settings = { - "browser.search.suggest.enabled" = true; - "ui.key.menuAccessKeyFocuses" = false; - }; - - extensions = with inputs.firefox-addons.packages.${pkgs.system}; [ - darkreader - proton-pass - shinigami-eyes - stylus - ublock-origin - violentmonkey - ]; - # https://git.jacekpoz.pl/poz/niksos/src/commit/a48647a1c5bc6877a1100a65f4dc169b2fc11ed7/hosts/hape/firefox.nix - search = { - force = true; - default = "SearxNG"; - engines = { - "SearxNG" = { - urls = [ - { - rels = ["results"]; - template = "https://search.nezia.dev/search"; - params = [ - { - name = "q"; - value = "{searchTerms}"; - } - ]; - } - { - rels = ["suggestions"]; - template = "https://search.nezia.dev/autocompleter"; - params = [ - { - name = "q"; - value = "{searchTerms}"; - } - ]; - "type" = "application/x-suggestions+json"; - } - ]; - }; - "MyNixOS" = { - urls = [{template = "https://mynixos.com/search?q={searchTerms}";}]; - iconUpdateURL = "https://mynixos.com/favicon.ico"; - updateInterval = 24 * 60 * 60 * 1000; - definedAliases = ["@nx"]; - }; - "Noogle" = { - urls = [{template = "https://noogle.dev/q?term={searchTerms}";}]; - icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; - definedAliases = ["@ng"]; - }; - "GitHub Nix" = { - # https://github.com/search?q=language%3Anix+NOT+is%3Afork+programs.neovim&type=code - urls = [{template = "https://github.com/search?q=language:nix NOT is:fork {searchTerms}&type=code";}]; - iconUpdateURL = "https://github.com/favicon.ico"; - updateInterval = 24 * 60 * 60 * 1000; - definedAliases = ["@ghn"]; - }; - "Google".metaData.alias = "@g"; # builtin engines only support specifying one additional alias - }; - }; - # https://github.com/oddlama/nix-config/blob/main/users/myuser/graphical/firefox.nix#L53-L57 - extraConfig = builtins.concatStringsSep "\n" [ - (builtins.readFile "${betterfox}/user.js") - (builtins.readFile "${betterfox}/Securefox.js") - (builtins.readFile "${betterfox}/Fastfox.js") - (builtins.readFile "${betterfox}/Peskyfox.js") - (builtins.readFile "${betterfox}/Smoothfox.js") - ]; - }; - }; - }; -} diff --git a/config/home-manager/programs/default.nix b/config/home-manager/programs/default.nix deleted file mode 100644 index a502dc5..0000000 --- a/config/home-manager/programs/default.nix +++ /dev/null @@ -1,45 +0,0 @@ -{pkgs, ...}: { - imports = [ - ./browsers - ./gnome - ./media - ./xdg.nix - ./editors/helix.nix - ./editors/neovim.nix - ]; - - # idk where to put this - programs = { - fzf.enable = true; - fastfetch.enable = true; - hyfetch = { - enable = true; - settings = { - preset = "nonbinary"; - mode = "rgb"; - backend = "fastfetch"; - color_align.mode = "horizontal"; - }; - }; - }; - - # miscellaneous programs that do not need to be configured - home.packages = with pkgs; [ - cinny-desktop - entr - fractal - geary - gns3-gui - gns3-server - imhex - logisim-evolution - mission-center - nautilus - obsidian - playerctl - proton-pass - simple-scan - vesktop - wl-clipboard - ]; -} diff --git a/config/home-manager/programs/editors/helix.nix b/config/home-manager/programs/editors/helix.nix deleted file mode 100644 index b8f9887..0000000 --- a/config/home-manager/programs/editors/helix.nix +++ /dev/null @@ -1,61 +0,0 @@ -{ - lib, - pkgs, - ... -}: { - programs.helix = { - enable = true; - settings = { - theme = "catppuccin_macchiato"; - editor = { - line-number = "relative"; - lsp.display-messages = true; - auto-format = true; - auto-completion = true; - completion-timeout = 5; - color-modes = true; - completion-trigger-len = 1; - completion-replace = true; - cursorline = true; - cursor-shape = { - insert = "bar"; - normal = "block"; - select = "underline"; - }; - indent-guides.render = true; - lsp.display-inlay-hints = true; - statusline.center = ["position-percentage"]; - true-color = true; - whitespace.characters = { - newline = "↴"; - tab = "⇥"; - }; - }; - - keys.normal = { - space = { - space = "file_picker"; - w = ":w"; - q = ":q"; - }; - esc = ["collapse_selection" "keep_primary_selection"]; - }; - }; - - languages = { - language = [ - { - name = "nix"; - auto-format = true; - } - ]; - - language-server = { - nil = { - command = lib.getExe pkgs.nil; - config.nil.formatting.command = ["${lib.getExe pkgs.alejandra}" "-q"]; - }; - }; - }; - }; -} diff --git a/config/home-manager/programs/editors/neovim.nix b/config/home-manager/programs/editors/neovim.nix deleted file mode 100644 index e61a05d..0000000 --- a/config/home-manager/programs/editors/neovim.nix +++ /dev/null @@ -1,244 +0,0 @@ -{ - inputs, - lib, - pkgs, - ... -}: { - imports = [inputs.nvf.homeManagerModules.default]; - - programs.nvf = { - enable = true; - settings.vim = { - viAlias = true; - vimAlias = true; - enableLuaLoader = true; - preventJunkFiles = true; - useSystemClipboard = true; - options = { - tabstop = 4; - autoindent = false; - }; - - luaConfigPost = '' - vim.opt.formatoptions:remove('c') - vim.opt.formatoptions:remove('r') - vim.opt.formatoptions:remove('o') - ''; - - maps = { - normal = { - "m" = { - silent = true; - action = "make"; - }; # Same as nnoremap m make - "t" = { - silent = true; - action = "Neotree toggle"; - }; - }; - }; - - theme = lib.mkDefault { - enable = true; - name = "catppuccin"; - style = "macchiato"; - }; - - ui = { - noice.enable = true; - }; - notify.nvim-notify.enable = true; - - statusline = { - lualine = { - enable = true; - theme = "auto"; - componentSeparator = { - left = ""; - }; - sectionSeparator = { - left = ""; - right = ""; - }; - - activeSection = { - a = [ - '' - { - "mode", - separator = { right = "" }, - right_padding = 2 - } - '' - ]; - b = [ - '' - { - "branch", - icon = '', - separator = { right = "" } - } - '' - ]; - c = [ - '' - "filename" - '' - ]; - x = [ - '' - { - "diagnostics", - sources = {'nvim_lsp', 'nvim_diagnostic', 'nvim_diagnostic', 'vim_lsp', 'coc'}, - symbols = {error = '󰅙 ', warn = ' ', info = ' ', hint = '󰌵 '}, - colored = true, - update_in_insert = false, - always_visible = false, - diagnostics_color = { - color_error = { fg = 'red' }, - color_warn = { fg = 'yellow' }, - color_info = { fg = 'cyan' }, - }, - } - '' - '' - "filetype" - '' - ]; - y = [ - '' - { - "progress", - separator = { left = "" }, - } - '' - '' - '' - ]; - z = [ - '' - { - "location", - separator = { left = "" }, - left_padding = 2 - } - '' - '' - { - "fileformat", - color = {fg='black'}, - symbols = { - unix = '', -- e712 - dos = '', -- e70f - mac = '', -- e711 - }, - } - '' - ]; - }; - - inactiveSection = { - a = [ - '' - "filename" - '' - ]; - z = [ - '' - "location" - '' - ]; - }; - }; - }; - - git.enable = true; - - utility = { - vim-wakatime.enable = true; - surround.enable = true; - }; - - lsp = { - enable = true; - lspSignature.enable = true; - lspconfig.enable = true; - formatOnSave = true; - mappings = { - addWorkspaceFolder = "wa"; - codeAction = "a"; - goToDeclaration = "gD"; - goToDefinition = "gd"; - hover = "K"; - listImplementations = "gi"; - listReferences = "gr"; - listWorkspaceFolders = "wl"; - nextDiagnostic = "k"; - previousDiagnostic = "j"; - openDiagnosticFloat = "e"; - removeWorkspaceFolder = "wr"; - renameSymbol = "r"; - signatureHelp = ""; - }; - }; - - autocomplete.nvim-cmp = { - enable = true; - }; - - autopairs.nvim-autopairs.enable = true; - - languages = { - enableExtraDiagnostics = true; - enableFormat = true; - enableLSP = true; - enableTreesitter = true; - - nix.enable = true; - clang.enable = true; - python.enable = true; - ts.enable = true; - css.enable = true; - typst.enable = true; - }; - - treesitter = { - enable = true; - fold = true; - context.enable = true; - grammars = [ - pkgs.vimPlugins.nvim-treesitter.builtGrammars.nix - pkgs.vimPlugins.nvim-treesitter.builtGrammars.c - pkgs.vimPlugins.nvim-treesitter.builtGrammars.python - ]; - }; - - binds.whichKey.enable = true; - filetree.neo-tree.enable = true; - - telescope.enable = true; - }; - }; - - programs.neovide = { - enable = true; - settings = { - fork = false; - frame = "full"; - idle = true; - maximized = false; - no-multigrid = false; - srgb = false; - tabs = true; - theme = "auto"; - title-hidden = true; - vsync = true; - wsl = false; - - font = { - normal = []; - size = 14.0; - }; - }; - }; -} diff --git a/config/home-manager/programs/games/default.nix b/config/home-manager/programs/games/default.nix deleted file mode 100644 index 1217a85..0000000 --- a/config/home-manager/programs/games/default.nix +++ /dev/null @@ -1,10 +0,0 @@ -{pkgs, ...}: { - home.packages = [ - pkgs.mangohud - pkgs.bolt-launcher - pkgs.ankama-launcher - pkgs.lutris - pkgs.qbittorrent - pkgs.protonplus - ]; -} diff --git a/config/home-manager/programs/gnome/default.nix b/config/home-manager/programs/gnome/default.nix deleted file mode 100644 index 839da64..0000000 --- a/config/home-manager/programs/gnome/default.nix +++ /dev/null @@ -1,10 +0,0 @@ -_: { - dconf = { - enable = true; - settings = { - "org/gnome/desktop/wm/preferences" = { - button-layout = ""; - }; - }; - }; -} diff --git a/config/home-manager/programs/hypr/idle.nix b/config/home-manager/programs/hypr/idle.nix deleted file mode 100644 index 12e7ddb..0000000 --- a/config/home-manager/programs/hypr/idle.nix +++ /dev/null @@ -1,55 +0,0 @@ -{ - inputs, - pkgs, - lib, - config, - ... -}: { - services.hypridle = { - enable = true; - - package = inputs.hypridle.packages.${pkgs.system}.hypridle; - - settings = { - general = { - lock_cmd = "pidof hyprlock || hyprlock"; - unlock_cmd = "pkill --signal SIGUSR1 hyprlock"; - before_sleep_cmd = "loginctl lock-session"; - after_sleep_cmd = "hyprctl dispatch dpms on"; - }; - - listener = [ - { - timeout = 300; # 5m - on-timeout = "loginctl lock-session"; - } - { - timeout = 330; # 5.5m - on-timeout = "hyprctl dipsatch dpms off"; - on-resume = "hyprctl dispatch dpms on"; - } - { - timeout = 600; # 10m - on-timeout = "systemctl suspend"; - } - ]; - }; - }; - # needed when using uwsm as the session manager - systemd.user.services."hypridle" = lib.mkForce { - Unit = { - Description = "Hyprland's Idle Daemon"; - After = "graphical-session.target"; - X-Restart-Triggers = ["${config.xdg.configFile."hypr/hypridle.conf".source}"]; - }; - Service = { - Type = "exec"; - ExecStart = lib.getExe pkgs.hypridle; - Restart = "on-failure"; - Slice = "background-graphical.slice"; - }; - Install = { - WantedBy = ["graphical-session.target"]; - }; - }; -} diff --git a/config/home-manager/programs/hypr/land/binds.nix b/config/home-manager/programs/hypr/land/binds.nix deleted file mode 100644 index ec80972..0000000 --- a/config/home-manager/programs/hypr/land/binds.nix +++ /dev/null @@ -1,79 +0,0 @@ -{lib, ...}: let - # thanks https://github.com/fufexan/dotfiles/blob/c0b3c77d95ce1f574a87e7f7ead672ca0d951245/home/programs/wayland/hyprland/binds.nix#L16-L20 - toggle = program: uwsm: let - prog = builtins.substring 0 14 program; - in "pkill ${prog} || ${lib.optionalString uwsm "uwsm app --"} ${program}"; - runOnce = program: "pgrep ${program} || uwsm app -- ${program}"; - run = program: "uwsm app -- ${program}"; -in { - wayland.windowManager.hyprland.settings = { - "$mod" = "SUPER"; - bindr = [ - "$mod, SUPER_L, exec, walker" - ]; - bind = [ - "$mod, Return, exec, ${run "foot"}" - "$mod, n, exec, ${run "neovide"}" - "$mod, w, exec, ${run "firefox"}" - ", Print, exec, ${runOnce "grimblast"} --notify --cursor copysave output" - "$mod, q, killactive" - "$mod SHIFT, q, exec, loginctl terminate-user ''" - "$mod, period, exec, walker -m emojis" # not using uwsm as it already runs as a service - "CTRL, Print, exec, ${runOnce "grimblast"} --notify --cursor --freeze copysave area" - - "$mod, h, movefocus, l" - "$mod, j, movefocus, d" - "$mod, k, movefocus, u" - "$mod, l, movefocus, r" - - "$mod SHIFT, h, movewindow, l" - "$mod SHIFT, j, movewindow, d" - "$mod SHIFT, k, movewindow, u" - "$mod SHIFT, l, movewindow, r" - - "$mod, 1, workspace, 1" - "$mod, 2, workspace, 2" - "$mod, 3, workspace, 3" - "$mod, 4, workspace, 4" - "$mod, 5, workspace, 5" - "$mod, 6, workspace, 6" - "$mod, 7, workspace, 7" - "$mod, 8, workspace, 8" - "$mod, 9, workspace, 9" - "$mod, 0, workspace, 10" - - "$mod SHIFT, 1, movetoworkspacesilent, 1" - "$mod SHIFT, 2, movetoworkspacesilent, 2" - "$mod SHIFT, 3, movetoworkspacesilent, 3" - "$mod SHIFT, 4, movetoworkspacesilent, 4" - "$mod SHIFT, 5, movetoworkspacesilent, 5" - "$mod SHIFT, 6, movetoworkspacesilent, 6" - "$mod SHIFT, 7, movetoworkspacesilent, 7" - "$mod SHIFT, 8, movetoworkspacesilent, 8" - "$mod SHIFT, 9, movetoworkspacesilent, 9" - "$mod SHIFT, 0, movetoworkspacesilent, 10" - - "$mod, t, togglefloating" - ", F11, fullscreen, 0" - "$mod, f, fullscreen, 1" - - "$mod, e, togglespecialworkspace, file_manager_tui" - "$mod SHIFT, e, togglespecialworkspace, file_manager_gui" - - ", XF86PowerOff, exec, ${toggle "wlogout" true}" - ]; - - bindel = [ - ", XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+" - ", XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-" - ", XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle" - - ", XF86MonBrightnessUp, exec, brillo -q -u 300000 -A 5" - ", XF86MonBrightnessDown, exec, brillo -q -u 300000 -U 5" - ", XF86AudioMedia, exec, XDG_CURRENT_DESKTOP=gnome gnome-control-center" - ]; - binde = [ - "$mod Alt, l, exec, loginctl lock-session" - ]; - }; -} diff --git a/config/home-manager/programs/hypr/land/default.nix b/config/home-manager/programs/hypr/land/default.nix deleted file mode 100644 index 3bf39c7..0000000 --- a/config/home-manager/programs/hypr/land/default.nix +++ /dev/null @@ -1,109 +0,0 @@ -{ - inputs, - pkgs, - ... -}: { - imports = [./binds.nix]; - home.packages = [ - inputs.hyprwm-contrib.packages.${pkgs.system}.grimblast - # disable unused panels - https://github.com/maydayv7/dotfiles/blob/4de45008a6915753834aa7e1cbafbacfff8b7adc/modules/gui/desktop/hyprland/apps/utilities.nix#L42-L57 - (pkgs.gnome-control-center.overrideAttrs (old: { - postInstall = - old.postInstall - + '' - dir=$out/share/applications - for panel in $dir/* - do - [ "$panel" = "$dir/gnome-network-panel.desktop" ] && continue - [ "$panel" = "$dir/gnome-bluetooth-panel.desktop" ] && continue - [ "$panel" = "$dir/gnome-wifi-panel.desktop" ] && continue - [ "$panel" = "$dir/gnome-wwan-panel.desktop" ] && continue - [ "$panel" = "$dir/gnome-sharing-panel.desktop" ] && continue - [ "$panel" = "$dir/gnome-wacom-panel.desktop" ] && continue - rm "$panel" - done - ''; - })) - ]; - wayland.windowManager.hyprland = { - enable = true; - xwayland.enable = true; - - systemd.enable = false; - - settings = { - xwayland = { - force_zero_scaling = true; - }; - - env = [ - "GDK_SCALE,1" - ]; - monitor = [ - "eDP-1, preferred, auto, 1.33" - ]; - workspace = [ - "special:terminal, on-created-empty:foot" - "special:mixer_gui, on-created-empty:pavucontrol" - "special:file_manager_gui, on-created-empty:nautilus" - "special:file_manager_tui, on-created-empty:foot -- yazi" - ]; - - windowrulev2 = [ - # fixes fullscreen windows (mostly games) - "stayfocused, initialtitle:^()$, initialclass:^(steam)$" - "minsize 1 1, initialtitle:^()$, initialclass:^(steam)$" - "maximize, initialtitle:^(\S+)$, initialclass:^(steamwebhelper)$" - - "immediate, initialclass:^(steam_app_)(.*)$" - "fullscreen, initialclass:^(steam_app_)(.*)$" - - # inhibit idle on every fullscreen app except games - "idleinhibit always, fullscreen:1,!initialclass:^(steam_app_)(.*)$" - ]; - - render = { - explicit_sync = 1; - explicit_sync_kms = 1; - expand_undersized_textures = false; - }; - - animations = { - enabled = true; - bezier = "myBezier, 0.05, 0.9, 0.1, 1.1"; - animation = [ - "windows, 1, 5, myBezier" - "windowsOut, 1, 5, default, popin 80%" - "windowsMove, 1, 5, default, popin 80%" - "fade, 1, 5, default" - "border, 1, 5, default" - "borderangle, 0, 8, default" - "workspaces, 0" - "specialWorkspace, 0" - ]; - }; - - input = { - kb_options = "compose:ralt"; - touchpad = { - natural_scroll = true; - scroll_factor = 0.8; - tap-to-click = true; - clickfinger_behavior = true; - }; - }; - - gestures = { - workspace_swipe = true; - workspace_swipe_direction_lock = false; - workspace_swipe_cancel_ratio = 0.15; - }; - - misc = { - force_default_wallpaper = 0; - disable_hyprland_logo = true; - middle_click_paste = false; - }; - }; - }; -} diff --git a/config/home-manager/programs/hypr/lock.nix b/config/home-manager/programs/hypr/lock.nix deleted file mode 100644 index b839ba4..0000000 --- a/config/home-manager/programs/hypr/lock.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ - inputs, - pkgs, - ... -}: { - programs.hyprlock = { - enable = true; - package = inputs.hyprlock.packages.${pkgs.system}.hyprlock; - }; -} diff --git a/config/home-manager/programs/hypr/paper.nix b/config/home-manager/programs/hypr/paper.nix deleted file mode 100644 index 8ae67e3..0000000 --- a/config/home-manager/programs/hypr/paper.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ - lib, - osConfig, - inputs, - pkgs, - ... -}: { - services.hyprpaper = { - enable = true; - package = inputs.hyprpaper.packages.${pkgs.system}.default; - - settings = { - preload = ["${osConfig.local.style.wallpaper}"]; - wallpaper = [", ${osConfig.local.style.wallpaper}"]; - }; - }; - - systemd.user.services.hyprpaper.Unit.After = lib.mkForce "graphical-session.target"; - systemd.user.services.hyprpaper.Service.Slice = "background-graphical.slice"; -} diff --git a/config/home-manager/programs/media/default.nix b/config/home-manager/programs/media/default.nix deleted file mode 100644 index 773e7b0..0000000 --- a/config/home-manager/programs/media/default.nix +++ /dev/null @@ -1,12 +0,0 @@ -{pkgs, ...}: { - imports = [./zathura.nix]; - programs.mpv.enable = true; - home.packages = [ - pkgs.gnome-calculator - pkgs.gthumb - pkgs.spotify - pkgs.stremio - pkgs.tidal-hifi - pkgs.celluloid - ]; -} diff --git a/config/home-manager/programs/media/zathura.nix b/config/home-manager/programs/media/zathura.nix deleted file mode 100644 index 82bdf35..0000000 --- a/config/home-manager/programs/media/zathura.nix +++ /dev/null @@ -1,17 +0,0 @@ -_: { - programs.zathura = { - enable = true; - options = { - font = "Inter 12"; - selection-notification = true; - - selection-clipboard = "clipboard"; - adjust-open = "best-fit"; - pages-per-row = "1"; - scroll-page-aware = "true"; - scroll-full-overlap = "0.01"; - scroll-step = "100"; - zoom-min = "10"; - }; - }; -} diff --git a/config/home-manager/programs/niri/binds.nix b/config/home-manager/programs/niri/binds.nix deleted file mode 100644 index 98372c9..0000000 --- a/config/home-manager/programs/niri/binds.nix +++ /dev/null @@ -1,168 +0,0 @@ -{ - config, - pkgs, - lib, - ... -}: let - appLauncher = "fuzzel"; - terminal = "foot"; - browser = "firefox"; - prefix = "Mod"; - guiFileManager = "nautilus"; - cliFileManager = "yazi"; -in { - programs.niri.settings.binds = { - "${prefix}+D".action.spawn = appLauncher; - "${prefix}+Return".action.spawn = terminal; - "${prefix}+W".action.spawn = browser; - "${prefix}+E".action.spawn = guiFileManager; - "${prefix}+Shift+E".action.spawn = [terminal "-e" cliFileManager]; - - "${prefix}+Shift+Slash".action = config.lib.niri.actions.show-hotkey-overlay; - "${prefix}+Q".action = config.lib.niri.actions.close-window; - "${prefix}+Shift+Q".action.quit.skip-confirmation = true; - "${prefix}+F".action = config.lib.niri.actions.maximize-column; - "${prefix}+Shift+F".action = config.lib.niri.actions.fullscreen-window; - "${prefix}+C".action = config.lib.niri.actions.center-column; - - # Focus - "${prefix}+Left".action = config.lib.niri.actions.focus-column-left; - "${prefix}+Down".action = config.lib.niri.actions.focus-window-down; - "${prefix}+Up".action = config.lib.niri.actions.focus-window-up; - "${prefix}+Right".action = config.lib.niri.actions.focus-column-right; - "${prefix}+H".action = config.lib.niri.actions.focus-column-left; - "${prefix}+J".action = config.lib.niri.actions.focus-window-down; - "${prefix}+K".action = config.lib.niri.actions.focus-window-up; - "${prefix}+L".action = config.lib.niri.actions.focus-column-right; - "${prefix}+Home".action = config.lib.niri.actions.focus-column-first; - "${prefix}+End".action = config.lib.niri.actions.focus-column-last; - - # Move - "${prefix}+Ctrl+Left".action = config.lib.niri.actions.move-column-left; - "${prefix}+Ctrl+Down".action = config.lib.niri.actions.move-window-down; - "${prefix}+Ctrl+Up".action = config.lib.niri.actions.move-window-up; - "${prefix}+Ctrl+Right".action = config.lib.niri.actions.move-column-right; - "${prefix}+Ctrl+H".action = config.lib.niri.actions.move-column-left; - "${prefix}+Ctrl+J".action = config.lib.niri.actions.move-window-down; - "${prefix}+Ctrl+K".action = config.lib.niri.actions.move-window-up; - "${prefix}+Ctrl+L".action = config.lib.niri.actions.move-column-right; - "${prefix}+Ctrl+Home".action = config.lib.niri.actions.move-column-to-first; - "${prefix}+Ctrl+End".action = config.lib.niri.actions.move-column-to-last; - - # Monitor focus - "${prefix}+Shift+Left".action = config.lib.niri.actions.focus-monitor-left; - "${prefix}+Shift+Down".action = config.lib.niri.actions.focus-monitor-down; - "${prefix}+Shift+Up".action = config.lib.niri.actions.focus-monitor-up; - "${prefix}+Shift+Right".action = config.lib.niri.actions.focus-monitor-right; - "${prefix}+Shift+H".action = config.lib.niri.actions.focus-monitor-left; - "${prefix}+Shift+J".action = config.lib.niri.actions.focus-monitor-down; - "${prefix}+Shift+K".action = config.lib.niri.actions.focus-monitor-up; - "${prefix}+Shift+L".action = config.lib.niri.actions.focus-monitor-right; - - # Move to monitor - "${prefix}+Shift+Ctrl+Left".action = config.lib.niri.actions.move-column-to-monitor-left; - "${prefix}+Shift+Ctrl+Down".action = config.lib.niri.actions.move-column-to-monitor-down; - "${prefix}+Shift+Ctrl+Up".action = config.lib.niri.actions.move-column-to-monitor-up; - "${prefix}+Shift+Ctrl+Right".action = config.lib.niri.actions.move-column-to-monitor-right; - "${prefix}+Shift+Ctrl+H".action = config.lib.niri.actions.move-column-to-monitor-left; - "${prefix}+Shift+Ctrl+J".action = config.lib.niri.actions.move-column-to-monitor-down; - "${prefix}+Shift+Ctrl+K".action = config.lib.niri.actions.move-column-to-monitor-up; - "${prefix}+Shift+Ctrl+L".action = config.lib.niri.actions.move-column-to-monitor-right; - - # Workspace navigation - "${prefix}+Page_Down".action = config.lib.niri.actions.focus-workspace-down; - "${prefix}+Page_Up".action = config.lib.niri.actions.focus-workspace-up; - "${prefix}+U".action = config.lib.niri.actions.focus-workspace-down; - "${prefix}+I".action = config.lib.niri.actions.focus-workspace-up; - "${prefix}+Ctrl+Page_Down".action = config.lib.niri.actions.move-column-to-workspace-down; - "${prefix}+Ctrl+Page_Up".action = config.lib.niri.actions.move-column-to-workspace-up; - "${prefix}+Ctrl+U".action = config.lib.niri.actions.move-column-to-workspace-down; - "${prefix}+Ctrl+I".action = config.lib.niri.actions.move-column-to-workspace-up; - "${prefix}+Shift+Page_Down".action = config.lib.niri.actions.move-workspace-down; - "${prefix}+Shift+Page_Up".action = config.lib.niri.actions.move-workspace-up; - "${prefix}+Shift+U".action = config.lib.niri.actions.move-workspace-down; - - # Workspace focus - "${prefix}+1".action.focus-workspace = 1; - "${prefix}+2".action.focus-workspace = 2; - "${prefix}+3".action.focus-workspace = 3; - "${prefix}+4".action.focus-workspace = 4; - "${prefix}+5".action.focus-workspace = 5; - "${prefix}+6".action.focus-workspace = 6; - "${prefix}+7".action.focus-workspace = 7; - "${prefix}+8".action.focus-workspace = 8; - "${prefix}+9".action.focus-workspace = 9; - - # Move to workspace - "${prefix}+Ctrl+1".action.move-column-to-workspace = 1; - "${prefix}+Ctrl+2".action.move-column-to-workspace = 2; - "${prefix}+Ctrl+3".action.move-column-to-workspace = 3; - "${prefix}+Ctrl+4".action.move-column-to-workspace = 4; - "${prefix}+Ctrl+5".action.move-column-to-workspace = 5; - "${prefix}+Ctrl+6".action.move-column-to-workspace = 6; - "${prefix}+Ctrl+7".action.move-column-to-workspace = 7; - "${prefix}+Ctrl+8".action.move-column-to-workspace = 8; - "${prefix}+Ctrl+9".action.move-column-to-workspace = 9; - "${prefix}+Shift+I".action = config.lib.niri.actions.move-workspace-up; - - # Window management - "${prefix}+Comma".action = config.lib.niri.actions.consume-window-into-column; - "${prefix}+Period".action = config.lib.niri.actions.expel-window-from-column; - "${prefix}+BracketLeft".action = config.lib.niri.actions.consume-or-expel-window-left; - "${prefix}+BracketRight".action = config.lib.niri.actions.consume-or-expel-window-right; - - # Column management - "${prefix}+R".action = config.lib.niri.actions.switch-preset-column-width; - "${prefix}+Shift+R".action = config.lib.niri.actions.switch-preset-window-height; - "${prefix}+Ctrl+R".action = config.lib.niri.actions.reset-window-height; - "${prefix}+Minus".action = config.lib.niri.actions.set-column-width "-10%"; - "${prefix}+Equal".action = config.lib.niri.actions.set-column-width "+10%"; - "${prefix}+Shift+Minus".action = config.lib.niri.actions.set-window-height "-10%"; - "${prefix}+Shift+Equal".action = config.lib.niri.actions.set-window-height "+10%"; - - # Screenshots - "Print".action = config.lib.niri.actions.screenshot-screen; - "Ctrl+Print".action = config.lib.niri.actions.screenshot; - - # System - "${prefix}+Alt+L".action.spawn = [ - "${lib.getExe' pkgs.systemd "loginctl"}" - "lock-session" - ]; - - # Media keys - "XF86AudioRaiseVolume" = { - action.spawn = ["wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.1+"]; - allow-when-locked = true; - }; - "XF86AudioLowerVolume" = { - action.spawn = ["wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.1-"]; - allow-when-locked = true; - }; - "XF86AudioMute" = { - action.spawn = ["wpctl" "set-mute" "@DEFAULT_AUDIO_SINK@" "toggle"]; - allow-when-locked = true; - }; - "XF86AudioMicMute" = { - action.spawn = ["wpctl" "set-mute" "@DEFAULT_AUDIO_SOURCE@" "toggle"]; - allow-when-locked = true; - }; - "XF86AudioPlay" = { - action.spawn = ["playerctl" "play-pause"]; - }; - "XF86MonBrightnessUp" = { - action.spawn = ["brillo" "-q" "-u 300000" "-A 5"]; - allow-when-locked = true; - }; - "XF86MonBrightnessDown" = { - action.spawn = ["brillo" "-q" "-u 300000" "-U 5"]; - allow-when-locked = true; - }; - # set on media key since framework laptops have a gear as the button label - "XF86AudioMedia" = { - action.spawn = ["sh" "-c" "env XDG_CURRENT_DESKTOP=gnome gnome-control-center"]; - }; - - "XF86PowerOff".action.spawn = "wlogout"; - }; -} diff --git a/config/home-manager/programs/niri/default.nix b/config/home-manager/programs/niri/default.nix deleted file mode 100644 index 858a703..0000000 --- a/config/home-manager/programs/niri/default.nix +++ /dev/null @@ -1,173 +0,0 @@ -{ - lib, - pkgs, - config, - ... -}: { - imports = [./binds.nix]; - - xdg.portal = { - enable = true; - xdgOpenUsePortal = true; - extraPortals = [pkgs.xdg-desktop-portal-gtk pkgs.xdg-desktop-portal-gnome pkgs.gnome-keyring]; - config = { - common = { - default = ["gtk"]; - "org.freedesktop.impl.portal.ScreenCast" = ["gnome"]; - "org.freedesktop.impl.portal.Secret" = ["gnome-keyring"]; - }; - }; - }; - - programs.niri = { - settings = { - input = { - power-key-handling.enable = false; - keyboard.xkb = { - layout = "us"; - options = "compose:ralt"; - }; - }; - - prefer-no-csd = true; - hotkey-overlay.skip-at-startup = true; - - layout = { - focus-ring = { - enable = true; - }; - always-center-single-column = true; - }; - - # https://github.com/sodiboo/system/blob/2978f4d79c51a5bd7e38a9cd75e3ec9046aa7e75/niri.mod.nix#L418-L434 - outputs = let - cfg = config.programs.niri.settings.outputs; - in { - "HDMI-A-1" = { - mode = { - width = 1920; - height = 1080; - refresh = 60.0; - }; - position.x = -cfg."HDMI-A-1".mode.width; - position.y = 0; - }; - "DP-1" = { - mode = { - width = 2560; - height = 1440; - refresh = 144.0; - }; - position.x = 0; - position.y = 0; - }; - }; - - window-rules = [ - { - draw-border-with-background = false; - geometry-corner-radius = let - r = 8.0; - in { - top-left = r; - top-right = r; - bottom-left = r; - bottom-right = r; - }; - clip-to-geometry = true; - } - { - matches = [ - {app-id = "foot";} - ]; - default-column-width = {proportion = 0.5;}; - } - ]; - - environment = { - "NIXOS_OZONE_WL" = "1"; - "DISPLAY" = ":0"; - "_JAVA_AWT_WM_NONREPARENTING" = "1"; # https://wiki.archlinux.org/title/Sway#Java_applications - }; - }; - }; - - # copied from https://github.com/linyinfeng/dotfiles/blob/c00fe3b1562ad947672863a43e455bc2f01a56b6/home-manager/profiles/niri/default.nix#L594-L611 - systemd.user.services.xwayland-satellite = { - Unit = { - PartOf = ["graphical-session.target"]; - After = ["graphical-session.target"]; - Requisite = ["graphical-session.target"]; - }; - Install = { - WantedBy = ["niri.service"]; - }; - Service = { - Type = "simple"; - ExecStart = "${lib.getExe pkgs.xwayland-satellite} :0"; - NotifyAccess = "all"; - StandardOutput = "journal"; - Restart = "on-failure"; - }; - }; - - programs.wlogout = { - enable = true; - - layout = let - systemd = let - systemd = lib.getExe' pkgs.systemd; - in { - loginctl = systemd "loginctl"; - systemctl = systemd "systemctl"; - }; - in [ - { - action = "${systemd.loginctl} lock-session"; - keybind = "l"; - label = "lock"; - text = "Lock"; - } - - { - action = "${systemd.systemctl} hibernate"; - keybind = "h"; - label = "hibernate"; - text = "Hibernate"; - } - - { - action = "${ - systemd.loginctl - } terminate-user ${ - config.home.username - }"; - - keybind = "q"; - label = "logout"; - text = "Logout"; - } - - { - action = "${systemd.systemctl} poweroff"; - keybind = "p"; - label = "shutdown"; - text = "Shutdown"; - } - - { - action = "${systemd.systemctl} suspend"; - keybind = "s"; - label = "suspend"; - text = "Suspend"; - } - - { - action = "${systemd.systemctl} reboot"; - keybind = "r"; - label = "reboot"; - text = "Reboot"; - } - ]; - }; -} diff --git a/config/home-manager/programs/swaybg.nix b/config/home-manager/programs/swaybg.nix deleted file mode 100644 index f136e86..0000000 --- a/config/home-manager/programs/swaybg.nix +++ /dev/null @@ -1,19 +0,0 @@ -# stolen from https://raw.githubusercontent.com/carlsvelz/dotfiles/a7a109b2e19f73062b4961e7be75836e6d13408c/home/wayland/swaybg.nix -{ - pkgs, - lib, - osConfig, - ... -}: { - systemd.user.services.swaybg = { - Unit = { - Description = "Wayland wallpaper daemon"; - PartOf = ["graphical-session.target"]; - }; - Service = { - ExecStart = "${lib.getExe pkgs.swaybg} -i ${osConfig.local.style.wallpaper} -m fill"; - Restart = "on-failure"; - }; - Install.WantedBy = ["graphical-session.target"]; - }; -} diff --git a/config/home-manager/programs/swayidle.nix b/config/home-manager/programs/swayidle.nix deleted file mode 100644 index 2af615b..0000000 --- a/config/home-manager/programs/swayidle.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ - lib, - config, - ... -}: { - services.swayidle = { - enable = true; - events = [ - { - event = "lock"; - command = "${lib.getExe config.programs.swaylock.package} --daemonize"; - } - { - event = "before-sleep"; - command = "${lib.getExe config.programs.swaylock.package} --daemonize"; - } - ]; - }; - systemd.user.services.swayidle.Unit.After = lib.mkForce ["graphical-session.target"]; -} diff --git a/config/home-manager/programs/swaylock.nix b/config/home-manager/programs/swaylock.nix deleted file mode 100644 index d9c0d04..0000000 --- a/config/home-manager/programs/swaylock.nix +++ /dev/null @@ -1,24 +0,0 @@ -{pkgs, ...}: { - # requires `security.pam.services.swaylock = { };` at the system level or else - # unlock will not work. - programs.swaylock = { - enable = true; - package = pkgs.swaylock-effects; - - settings = { - clock = true; - timestr = "%H:%M"; - - indicator = true; - indicator-radius = 111; - indicator-thickness = 9; - - screenshots = true; - effect-blur = "7x5"; - effect-vignette = "0.75:0.75"; - effect-pixelate = 5; - - ignore-empty-password = false; # needed for PAM to work with fprintd / password - }; - }; -} diff --git a/config/home-manager/programs/walker.nix b/config/home-manager/programs/walker.nix deleted file mode 100644 index c9295ea..0000000 --- a/config/home-manager/programs/walker.nix +++ /dev/null @@ -1,32 +0,0 @@ -{ - lib, - inputs, - ... -}: { - imports = [ - inputs.walker.homeManagerModules.default - ]; - programs.walker = { - enable = true; - runAsService = true; - # All options from the config.json can be used here. - config = { - list = { - height = 200; - }; - app_launch_prefix = "uwsm app -- "; - websearch.prefix = "?"; - switcher.prefix = "/"; - }; - }; - - systemd.user.services.walker = { - Unit = { - PartOf = lib.mkForce []; - After = lib.mkForce ["graphical-session.target"]; - }; - Service = { - Slice = lib.mkForce "background-graphical.slice"; - }; - }; -} diff --git a/config/home-manager/programs/waybar/default.nix b/config/home-manager/programs/waybar/default.nix deleted file mode 100644 index d84656c..0000000 --- a/config/home-manager/programs/waybar/default.nix +++ /dev/null @@ -1,187 +0,0 @@ -{ - pkgs, - lib, - ... -}: { - programs.waybar = { - enable = true; - systemd.enable = true; - settings = { - mainBar = { - layer = "top"; - position = "top"; - - modules-left = [ - "hyprland/window" - "pulseaudio" - "cpu" - "memory" - "idle_inhibitor" - ]; - - modules-center = ["hyprland/workspaces"]; - modules-right = [ - "custom/swaync" - "custom/power" - "network" - "battery" - "tray" - "clock" - ]; - - tray = { - icon-size = 16; - spacing = 12; - }; - - battery = { - interval = 10; - states = { - warning = 30; - critical = 15; - }; - format = "{icon} {capacity}%"; - format-charging = " {capacity}% - {time}"; - format-full = " {capacity}% - Full"; - format-icons = [ - "" - "" - "" - "" - "" - ]; - max-length = 25; - }; - - "pulseaudio" = { - format = "{icon} {volume}%"; - format-bluetooth = "{icon} {volume}%"; - format-muted = ""; - format-icons = { - "alsa_output.pci-0000_00_1f.3.analog-stereo" = ""; - "alsa_output.pci-0000_00_1f.3.analog-stereo-muted" = ""; - headphone = ""; - hands-free = ""; - headset = ""; - phone = ""; - phone-muted = ""; - portable = ""; - car = ""; - default = [ - "" - "" - ]; - }; - scroll-step = 1; - on-click = "pavucontrol"; - ignored-sinks = [ - "Easy Effects Sink" - ]; - }; - - "power-profiles-daemon" = { - format-icons = { - default = ""; - performance = ""; - balanced = ""; - power-saver = ""; - }; - }; - - "custom/power" = { - format = ""; - tooltip = false; - on-click = lib.getExe pkgs.wlogout; - }; - - "memory" = { - interval = 5; - format = " {}%"; - tooltip = true; - }; - - "cpu" = { - interval = 5; - format = " {usage:2}%"; - tooltip = true; - }; - - "idle_inhibitor" = { - format = "{icon}"; - format-icons = { - activated = ""; - deactivated = ""; - }; - tooltip = "true"; - }; - - "clock" = { - format = " {:L%H:%M}"; - tooltip = true; - tooltip-format = "{:%A, %d.%B %Y }\n{calendar}"; - }; - - "network" = { - format-icons = [ - "󰤯" - "󰤟" - "󰤢" - "󰤥" - "󰤨" - ]; - format-ethernet = " {bandwidthDownOctets}"; - format-wifi = "{icon} {signalStrength}%"; - format-disconnected = "󰤮"; - tooltip = false; - on-click = "XDG_CURRENT_DESKTOP=gnome gnome-control-center"; - }; - - "hyprland/window" = { - max-length = 22; - separate-outputs = false; - }; - - "hyprland/workspaces" = { - format = "{name}"; - format-icons = { - default = " "; - active = " "; - urgent = " "; - }; - on-scroll-up = "hyprctl dispatch workspace e+1"; - on-scroll-down = "hyprctl dispatch workspace e-1"; - }; - - "custom/swaync" = { - tooltip = false; - format = "{icon}"; - format-icons = { - none = ""; - notification = ""; - dnd-notification = ""; - dnd-none = ""; - inhibited-notification = ""; - inhibited-none = ""; - dnd-inhibited-notification = ""; - dnd-inhibited-none = ""; - }; - return-type = "json"; - escape = true; - exec-if = "which ${pkgs.swaynotificationcenter}/bin/swaync-client"; - exec = "${pkgs.swaynotificationcenter}/bin/swaync-client --subscribe-waybar"; - on-click = "${pkgs.swaynotificationcenter}/bin/swaync-client --toggle-panel --skip-wait"; - on-click-middle = "${pkgs.swaynotificationcenter}/bin/swaync-client --toggle-dnd --skip-wait"; - }; - }; - }; - }; - - systemd.user.services.waybar = { - Unit.After = lib.mkForce "graphical-session.target"; - Service.Slice = "app-graphical.slice"; - }; - - home.packages = [ - pkgs.pavucontrol - ]; -} diff --git a/config/home-manager/programs/wlogout.nix b/config/home-manager/programs/wlogout.nix deleted file mode 100644 index 8423a8e..0000000 --- a/config/home-manager/programs/wlogout.nix +++ /dev/null @@ -1,66 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: { - programs.wlogout = { - enable = true; - - layout = let - systemd = let - systemd = lib.getExe' pkgs.systemd; - in { - loginctl = systemd "loginctl"; - systemctl = systemd "systemctl"; - }; - in [ - { - action = "${systemd.loginctl} lock-session"; - keybind = "l"; - label = "lock"; - text = "Lock"; - } - - { - action = "${systemd.systemctl} hibernate"; - keybind = "h"; - label = "hibernate"; - text = "Hibernate"; - } - - { - action = "${ - systemd.loginctl - } terminate-user ${ - config.home.username - }"; - - keybind = "q"; - label = "logout"; - text = "Logout"; - } - - { - action = "${systemd.systemctl} poweroff"; - keybind = "p"; - label = "shutdown"; - text = "Shutdown"; - } - - { - action = "${systemd.systemctl} suspend"; - keybind = "s"; - label = "suspend"; - text = "Suspend"; - } - - { - action = "${systemd.systemctl} reboot"; - keybind = "r"; - label = "reboot"; - text = "Reboot"; - } - ]; - }; -} diff --git a/config/home-manager/programs/xdg.nix b/config/home-manager/programs/xdg.nix deleted file mode 100644 index 315898e..0000000 --- a/config/home-manager/programs/xdg.nix +++ /dev/null @@ -1,35 +0,0 @@ -{config, ...}: { - xdg = { - enable = true; - cacheHome = config.home.homeDirectory + "/.local/cache"; - - mimeApps = { - enable = true; - defaultApplications = { - "default-web-browser" = ["firefox.desktop"]; - "text/html" = ["firefox.desktop"]; - "x-scheme-handler/http" = ["firefox.desktop"]; - "x-scheme-handler/https" = ["firefox.desktop"]; - "x-scheme-handler/about" = ["firefox.desktop"]; - "x-scheme-handler/unknown" = ["firefox.desktop"]; - "x-scheme-handler/chrome" = ["chromium-browser.desktop"]; - "inode/directory" = ["yazi.desktop"]; - "application/pdf" = ["org.pwmt.zathura-pdf-mupdf.desktop"]; - "image/png" = ["org.gnome.gThumb.desktop"]; - "image/svg" = [" org.gnome.gThumb.desktop"]; - "image/jpeg" = ["org.gnome.gThumb.desktop"]; - "image/gif" = [" org.gnome.gThumb.desktop"]; - "video/mp4" = ["io.github.celluloid_player.Celluloid.desktop"]; - "video/avi" = ["io.github.celluloid_player.Celluloid.desktop"]; - "video/mkv" = ["io.github.celluloid_player.Celluloid.desktop"]; - }; - }; - userDirs = { - enable = true; - createDirectories = true; - extraConfig = { - XDG_SCREENSHOTS_DIR = "${config.xdg.userDirs.pictures}/Screenshots"; - }; - }; - }; -} diff --git a/hosts/default.nix b/hosts/default.nix index 6bd07b3..e8d1de9 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -18,6 +18,7 @@ }: { home-manager = { users.${config.local.systemVars.username}.imports = [ + ../modules/hm "${self}/config/home-manager" "${self}/config/home-manager/services/udiskie.nix" @@ -32,11 +33,6 @@ graphical = [ ({config, ...}: { home-manager.users.${config.local.systemVars.username}.imports = [ - "${self}/config/home-manager/programs/waybar" - "${self}/config/home-manager/programs/walker.nix" - "${self}/config/home-manager/programs/hypr" - "${self}/config/home-manager/programs/wlogout.nix" - "${self}/config/home-manager/services/swaync" "${self}/config/home-manager/terminal/emulators/foot.nix" @@ -48,7 +44,6 @@ gaming = [ ({config, ...}: { home-manager.users.${config.local.systemVars.username}.imports = [ - "${self}/config/home-manager/programs/games" "${self}/config/home-manager/services/flatpak.nix" ]; }) diff --git a/hosts/vamos/default.nix b/hosts/vamos/default.nix index 350eb3e..026c044 100644 --- a/hosts/vamos/default.nix +++ b/hosts/vamos/default.nix @@ -1,5 +1,8 @@ _: { - imports = [./hardware-configuration.nix ./config/theme.nix]; + imports = [ + ./hardware-configuration.nix + ./config/theme.nix + ]; local = { systemVars = { diff --git a/modules/hm/default.nix b/modules/hm/default.nix new file mode 100644 index 0000000..62a4bf4 --- /dev/null +++ b/modules/hm/default.nix @@ -0,0 +1,3 @@ +{ + imports = [./programs]; +} diff --git a/modules/hm/programs/browsers/default.nix b/modules/hm/programs/browsers/default.nix new file mode 100644 index 0000000..dad3d2f --- /dev/null +++ b/modules/hm/programs/browsers/default.nix @@ -0,0 +1,3 @@ +{ + imports = [./firefox.nix]; +} diff --git a/modules/hm/programs/browsers/firefox.nix b/modules/hm/programs/browsers/firefox.nix new file mode 100644 index 0000000..0e5c3ac --- /dev/null +++ b/modules/hm/programs/browsers/firefox.nix @@ -0,0 +1,176 @@ +{ + lib, + inputs, + pkgs, + osConfig, + ... +}: let + betterfox = pkgs.fetchFromGitHub { + owner = "yokoffing"; + repo = "betterfox"; + rev = "e026ed7d3a763c5d3f96c2680d7bc3340831af4f"; + hash = "sha256-hpkEO5BhMVtINQG8HN4xqfas/R6q5pYPZiFK8bilIDs="; + }; +in { + config = lib.mkIf osConfig.local.profiles.desktop.enable { + programs.firefox = { + enable = true; + package = pkgs.wrapFirefox pkgs.firefox-unwrapped { + extraPolicies = { + DisableTelemetry = true; + DisablePocket = true; + DisableFeedbackCommands = true; + DisableFirefoxStudies = true; + OfferToSaveLogins = false; + OffertosaveloginsDefault = false; + PasswordManagerEnabled = false; + SearchSuggestEnabled = true; + + # https://github.com/Sly-Harvey/NixOS/blob/f9da2691ea46565256ad757959cfc26ec6cee10d/modules/programs/browser/firefox/default.nix#L58-L163 + "3rdparty".Extensions = { + "addon@darkreader.org" = { + permissions = ["internal:privateBrowsingAllowed"]; + enabled = true; + automation = { + enabled = true; + behavior = "OnOff"; + mode = "system"; + }; + detectDarkTheme = true; + enabledByDefault = true; + changeBrowserTheme = false; + enableForProtectedPages = true; + fetchNews = false; + previewNewDesign = true; + }; + "uBlock0@raymondhill.net" = { + permissions = ["internal:privateBrowsingAllowed"]; + advancedSettings = [ + [ + "userResourcesLocation" + "https://raw.githubusercontent.com/pixeltris/TwitchAdSolutions/master/video-swap-new/video-swap-new-ublock-origin.js" + ] + ]; + adminSettings = { + userSettings = { + uiTheme = "dark"; + advancedUserEnabled = true; + userFiltersTrusted = true; + importedLists = [ + "https://raw.githubusercontent.com/laylavish/uBlockOrigin-HUGE-AI-Blocklist/main/list.txt" + ]; + selectedFilterLists = [ + "FRA-0" + "adguard-cookies" + "adguard-mobile-app-banners" + "adguard-other-annoyances" + "adguard-popup-overlays" + "adguard-social" + "adguard-spyware-url" + "adguard-widgets" + "easylist" + "easylist-annoyances" + "easylist-chat" + "easylist-newsletters" + "easylist-notifications" + "easyprivacy" + "fanboy-cookiemonster" + "https://filters.adtidy.org/extension/ublock/filters/3.txt" + "https://github.com/DandelionSprout/adfilt/raw/master/LegitimateURLShortener.txt" + "plowe-0" + "ublock-annoyances" + "ublock-badware" + "ublock-cookies-adguard" + "ublock-cookies-easylist" + "ublock-filters" + "ublock-privacy" + "ublock-quick-fixes" + "ublock-unbreak" + "urlhaus-1" + "https://raw.githubusercontent.com/laylavish/uBlockOrigin-HUGE-AI-Blocklist/main/list.txt" + ]; + }; + }; + }; + }; + }; + }; + profiles = { + nezia = { + settings = { + "browser.search.suggest.enabled" = true; + "ui.key.menuAccessKeyFocuses" = false; + }; + + extensions = with inputs.firefox-addons.packages.${pkgs.system}; [ + darkreader + proton-pass + shinigami-eyes + stylus + ublock-origin + violentmonkey + ]; + # https://git.jacekpoz.pl/poz/niksos/src/commit/a48647a1c5bc6877a1100a65f4dc169b2fc11ed7/hosts/hape/firefox.nix + search = { + force = true; + default = "SearxNG"; + engines = { + "SearxNG" = { + urls = [ + { + rels = ["results"]; + template = "https://search.nezia.dev/search"; + params = [ + { + name = "q"; + value = "{searchTerms}"; + } + ]; + } + { + rels = ["suggestions"]; + template = "https://search.nezia.dev/autocompleter"; + params = [ + { + name = "q"; + value = "{searchTerms}"; + } + ]; + "type" = "application/x-suggestions+json"; + } + ]; + }; + "MyNixOS" = { + urls = [{template = "https://mynixos.com/search?q={searchTerms}";}]; + iconUpdateURL = "https://mynixos.com/favicon.ico"; + updateInterval = 24 * 60 * 60 * 1000; + definedAliases = ["@nx"]; + }; + "Noogle" = { + urls = [{template = "https://noogle.dev/q?term={searchTerms}";}]; + icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; + definedAliases = ["@ng"]; + }; + "GitHub Nix" = { + # https://github.com/search?q=language%3Anix+NOT+is%3Afork+programs.neovim&type=code + urls = [{template = "https://github.com/search?q=language:nix NOT is:fork {searchTerms}&type=code";}]; + iconUpdateURL = "https://github.com/favicon.ico"; + updateInterval = 24 * 60 * 60 * 1000; + definedAliases = ["@ghn"]; + }; + "Google".metaData.alias = "@g"; # builtin engines only support specifying one additional alias + }; + }; + # https://github.com/oddlama/nix-config/blob/main/users/myuser/graphical/firefox.nix#L53-L57 + extraConfig = builtins.concatStringsSep "\n" [ + (builtins.readFile "${betterfox}/user.js") + (builtins.readFile "${betterfox}/Securefox.js") + (builtins.readFile "${betterfox}/Fastfox.js") + (builtins.readFile "${betterfox}/Peskyfox.js") + (builtins.readFile "${betterfox}/Smoothfox.js") + ]; + }; + }; + }; + }; +} diff --git a/modules/hm/programs/default.nix b/modules/hm/programs/default.nix new file mode 100644 index 0000000..358daf8 --- /dev/null +++ b/modules/hm/programs/default.nix @@ -0,0 +1,16 @@ +{ + imports = [ + ./browsers + ./editors + ./hypr + ./media + + ./games.nix + ./gnome.nix + ./misc.nix + ./walker.nix + ./waybar.nix + ./wlogout.nix + ./xdg.nix + ]; +} diff --git a/modules/hm/programs/editors/default.nix b/modules/hm/programs/editors/default.nix new file mode 100644 index 0000000..6ab9a63 --- /dev/null +++ b/modules/hm/programs/editors/default.nix @@ -0,0 +1,6 @@ +{ + imports = [ + ./helix.nix + ./neovim.nix + ]; +} diff --git a/modules/hm/programs/editors/helix.nix b/modules/hm/programs/editors/helix.nix new file mode 100644 index 0000000..907aba1 --- /dev/null +++ b/modules/hm/programs/editors/helix.nix @@ -0,0 +1,64 @@ +{ + lib, + pkgs, + osConfig, + ... +}: { + config = lib.mkIf osConfig.local.profiles.desktop.enable { + programs.helix = { + enable = true; + settings = { + theme = "catppuccin_macchiato"; + editor = { + line-number = "relative"; + lsp.display-messages = true; + auto-format = true; + auto-completion = true; + completion-timeout = 5; + color-modes = true; + completion-trigger-len = 1; + completion-replace = true; + cursorline = true; + cursor-shape = { + insert = "bar"; + normal = "block"; + select = "underline"; + }; + indent-guides.render = true; + lsp.display-inlay-hints = true; + statusline.center = ["position-percentage"]; + true-color = true; + whitespace.characters = { + newline = "↴"; + tab = "⇥"; + }; + }; + + keys.normal = { + space = { + space = "file_picker"; + w = ":w"; + q = ":q"; + }; + esc = ["collapse_selection" "keep_primary_selection"]; + }; + }; + + languages = { + language = [ + { + name = "nix"; + auto-format = true; + } + ]; + + language-server = { + nil = { + command = lib.getExe pkgs.nil; + config.nil.formatting.command = ["${lib.getExe pkgs.alejandra}" "-q"]; + }; + }; + }; + }; + }; +} diff --git a/modules/hm/programs/editors/neovim.nix b/modules/hm/programs/editors/neovim.nix new file mode 100644 index 0000000..f596493 --- /dev/null +++ b/modules/hm/programs/editors/neovim.nix @@ -0,0 +1,247 @@ +{ + lib, + inputs, + pkgs, + osConfig, + ... +}: { + imports = [inputs.nvf.homeManagerModules.default]; + + config = lib.mkIf osConfig.local.profiles.desktop.enable { + programs.nvf = { + enable = true; + settings.vim = { + viAlias = true; + vimAlias = true; + enableLuaLoader = true; + preventJunkFiles = true; + useSystemClipboard = true; + options = { + tabstop = 4; + autoindent = false; + }; + + luaConfigPost = '' + vim.opt.formatoptions:remove('c') + vim.opt.formatoptions:remove('r') + vim.opt.formatoptions:remove('o') + ''; + + maps = { + normal = { + "m" = { + silent = true; + action = "make"; + }; # Same as nnoremap m make + "t" = { + silent = true; + action = "Neotree toggle"; + }; + }; + }; + + theme = lib.mkDefault { + enable = true; + name = "catppuccin"; + style = "macchiato"; + }; + + ui = { + noice.enable = true; + }; + notify.nvim-notify.enable = true; + + statusline = { + lualine = { + enable = true; + theme = "auto"; + componentSeparator = { + left = ""; + }; + sectionSeparator = { + left = ""; + right = ""; + }; + + activeSection = { + a = [ + '' + { + "mode", + separator = { right = "" }, + right_padding = 2 + } + '' + ]; + b = [ + '' + { + "branch", + icon = '', + separator = { right = "" } + } + '' + ]; + c = [ + '' + "filename" + '' + ]; + x = [ + '' + { + "diagnostics", + sources = {'nvim_lsp', 'nvim_diagnostic', 'nvim_diagnostic', 'vim_lsp', 'coc'}, + symbols = {error = '󰅙 ', warn = ' ', info = ' ', hint = '󰌵 '}, + colored = true, + update_in_insert = false, + always_visible = false, + diagnostics_color = { + color_error = { fg = 'red' }, + color_warn = { fg = 'yellow' }, + color_info = { fg = 'cyan' }, + }, + } + '' + '' + "filetype" + '' + ]; + y = [ + '' + { + "progress", + separator = { left = "" }, + } + '' + '' + '' + ]; + z = [ + '' + { + "location", + separator = { left = "" }, + left_padding = 2 + } + '' + '' + { + "fileformat", + color = {fg='black'}, + symbols = { + unix = '', -- e712 + dos = '', -- e70f + mac = '', -- e711 + }, + } + '' + ]; + }; + + inactiveSection = { + a = [ + '' + "filename" + '' + ]; + z = [ + '' + "location" + '' + ]; + }; + }; + }; + + git.enable = true; + + utility = { + vim-wakatime.enable = true; + surround.enable = true; + }; + + lsp = { + enable = true; + lspSignature.enable = true; + lspconfig.enable = true; + formatOnSave = true; + mappings = { + addWorkspaceFolder = "wa"; + codeAction = "a"; + goToDeclaration = "gD"; + goToDefinition = "gd"; + hover = "K"; + listImplementations = "gi"; + listReferences = "gr"; + listWorkspaceFolders = "wl"; + nextDiagnostic = "k"; + previousDiagnostic = "j"; + openDiagnosticFloat = "e"; + removeWorkspaceFolder = "wr"; + renameSymbol = "r"; + signatureHelp = ""; + }; + }; + + autocomplete.nvim-cmp = { + enable = true; + }; + + autopairs.nvim-autopairs.enable = true; + + languages = { + enableExtraDiagnostics = true; + enableFormat = true; + enableLSP = true; + enableTreesitter = true; + + nix.enable = true; + clang.enable = true; + python.enable = true; + ts.enable = true; + css.enable = true; + typst.enable = true; + }; + + treesitter = { + enable = true; + fold = true; + context.enable = true; + grammars = [ + pkgs.vimPlugins.nvim-treesitter.builtGrammars.nix + pkgs.vimPlugins.nvim-treesitter.builtGrammars.c + pkgs.vimPlugins.nvim-treesitter.builtGrammars.python + ]; + }; + + binds.whichKey.enable = true; + filetree.neo-tree.enable = true; + + telescope.enable = true; + }; + }; + + programs.neovide = { + enable = true; + settings = { + fork = false; + frame = "full"; + idle = true; + maximized = false; + no-multigrid = false; + srgb = false; + tabs = true; + theme = "auto"; + title-hidden = true; + vsync = true; + wsl = false; + + font = { + normal = []; + size = 14.0; + }; + }; + }; + }; +} diff --git a/modules/hm/programs/games.nix b/modules/hm/programs/games.nix new file mode 100644 index 0000000..6b23cdb --- /dev/null +++ b/modules/hm/programs/games.nix @@ -0,0 +1,17 @@ +{ + lib, + pkgs, + osConfig, + ... +}: { + config = lib.mkIf osConfig.local.profiles.gaming.enable { + home.packages = [ + pkgs.mangohud + pkgs.bolt-launcher + pkgs.ankama-launcher + pkgs.lutris + pkgs.qbittorrent + pkgs.protonplus + ]; + }; +} diff --git a/modules/hm/programs/gnome.nix b/modules/hm/programs/gnome.nix new file mode 100644 index 0000000..9ddd704 --- /dev/null +++ b/modules/hm/programs/gnome.nix @@ -0,0 +1,16 @@ +{ + lib, + osConfig, + ... +}: { + config = lib.mkIf osConfig.local.profiles.desktop.enable { + dconf = { + enable = true; + settings = { + "org/gnome/desktop/wm/preferences" = { + button-layout = ""; + }; + }; + }; + }; +} diff --git a/config/home-manager/programs/hypr/default.nix b/modules/hm/programs/hypr/default.nix similarity index 100% rename from config/home-manager/programs/hypr/default.nix rename to modules/hm/programs/hypr/default.nix diff --git a/modules/hm/programs/hypr/idle.nix b/modules/hm/programs/hypr/idle.nix new file mode 100644 index 0000000..5f44ae2 --- /dev/null +++ b/modules/hm/programs/hypr/idle.nix @@ -0,0 +1,58 @@ +{ + lib, + inputs, + pkgs, + config, + osConfig, + ... +}: { + config = lib.mkIf osConfig.local.modules.hyprland.enable { + services.hypridle = { + enable = true; + + package = inputs.hypridle.packages.${pkgs.system}.hypridle; + + settings = { + general = { + lock_cmd = "pidof hyprlock || hyprlock"; + unlock_cmd = "pkill --signal SIGUSR1 hyprlock"; + before_sleep_cmd = "loginctl lock-session"; + after_sleep_cmd = "hyprctl dispatch dpms on"; + }; + + listener = [ + { + timeout = 300; # 5m + on-timeout = "loginctl lock-session"; + } + { + timeout = 330; # 5.5m + on-timeout = "hyprctl dipsatch dpms off"; + on-resume = "hyprctl dispatch dpms on"; + } + { + timeout = 600; # 10m + on-timeout = "systemctl suspend"; + } + ]; + }; + }; + # needed when using uwsm as the session manager + systemd.user.services."hypridle" = lib.mkForce { + Unit = { + Description = "Hyprland's Idle Daemon"; + After = "graphical-session.target"; + X-Restart-Triggers = ["${config.xdg.configFile."hypr/hypridle.conf".source}"]; + }; + Service = { + Type = "exec"; + ExecStart = lib.getExe pkgs.hypridle; + Restart = "on-failure"; + Slice = "background-graphical.slice"; + }; + Install = { + WantedBy = ["graphical-session.target"]; + }; + }; + }; +} diff --git a/modules/hm/programs/hypr/land/binds.nix b/modules/hm/programs/hypr/land/binds.nix new file mode 100644 index 0000000..dddddcb --- /dev/null +++ b/modules/hm/programs/hypr/land/binds.nix @@ -0,0 +1,85 @@ +{ + lib, + osConfig, + ... +}: let + # thanks https://github.com/fufexan/dotfiles/blob/c0b3c77d95ce1f574a87e7f7ead672ca0d951245/home/programs/wayland/hyprland/binds.nix#L16-L20 + toggle = program: uwsm: let + prog = builtins.substring 0 14 program; + in "pkill ${prog} || ${lib.optionalString uwsm "uwsm app --"} ${program}"; + runOnce = program: "pgrep ${program} || uwsm app -- ${program}"; + run = program: "uwsm app -- ${program}"; +in { + config = lib.mkIf osConfig.local.modules.hyprland.enable { + wayland.windowManager.hyprland.settings = { + "$mod" = "SUPER"; + bindr = [ + "$mod, SUPER_L, exec, walker" + ]; + bind = [ + "$mod, Return, exec, ${run "foot"}" + "$mod, n, exec, ${run "neovide"}" + "$mod, w, exec, ${run "firefox"}" + ", Print, exec, ${runOnce "grimblast"} --notify --cursor copysave output" + "$mod, q, killactive" + "$mod SHIFT, q, exec, loginctl terminate-user ''" + "$mod, period, exec, walker -m emojis" # not using uwsm as it already runs as a service + "CTRL, Print, exec, ${runOnce "grimblast"} --notify --cursor --freeze copysave area" + + "$mod, h, movefocus, l" + "$mod, j, movefocus, d" + "$mod, k, movefocus, u" + "$mod, l, movefocus, r" + + "$mod SHIFT, h, movewindow, l" + "$mod SHIFT, j, movewindow, d" + "$mod SHIFT, k, movewindow, u" + "$mod SHIFT, l, movewindow, r" + + "$mod, 1, workspace, 1" + "$mod, 2, workspace, 2" + "$mod, 3, workspace, 3" + "$mod, 4, workspace, 4" + "$mod, 5, workspace, 5" + "$mod, 6, workspace, 6" + "$mod, 7, workspace, 7" + "$mod, 8, workspace, 8" + "$mod, 9, workspace, 9" + "$mod, 0, workspace, 10" + + "$mod SHIFT, 1, movetoworkspacesilent, 1" + "$mod SHIFT, 2, movetoworkspacesilent, 2" + "$mod SHIFT, 3, movetoworkspacesilent, 3" + "$mod SHIFT, 4, movetoworkspacesilent, 4" + "$mod SHIFT, 5, movetoworkspacesilent, 5" + "$mod SHIFT, 6, movetoworkspacesilent, 6" + "$mod SHIFT, 7, movetoworkspacesilent, 7" + "$mod SHIFT, 8, movetoworkspacesilent, 8" + "$mod SHIFT, 9, movetoworkspacesilent, 9" + "$mod SHIFT, 0, movetoworkspacesilent, 10" + + "$mod, t, togglefloating" + ", F11, fullscreen, 0" + "$mod, f, fullscreen, 1" + + "$mod, e, togglespecialworkspace, file_manager_tui" + "$mod SHIFT, e, togglespecialworkspace, file_manager_gui" + + ", XF86PowerOff, exec, ${toggle "wlogout" true}" + ]; + + bindel = [ + ", XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+" + ", XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-" + ", XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle" + + ", XF86MonBrightnessUp, exec, brillo -q -u 300000 -A 5" + ", XF86MonBrightnessDown, exec, brillo -q -u 300000 -U 5" + ", XF86AudioMedia, exec, XDG_CURRENT_DESKTOP=gnome gnome-control-center" + ]; + binde = [ + "$mod Alt, l, exec, loginctl lock-session" + ]; + }; + }; +} diff --git a/modules/hm/programs/hypr/land/default.nix b/modules/hm/programs/hypr/land/default.nix new file mode 100644 index 0000000..2eeb366 --- /dev/null +++ b/modules/hm/programs/hypr/land/default.nix @@ -0,0 +1,114 @@ +{ + lib, + inputs, + pkgs, + osConfig, + ... +}: { + imports = [./binds.nix]; + + config = lib.mkIf osConfig.local.modules.hyprland.enable { + home.packages = [ + inputs.hyprwm-contrib.packages.${pkgs.system}.grimblast + # disable unused panels - https://github.com/maydayv7/dotfiles/blob/4de45008a6915753834aa7e1cbafbacfff8b7adc/modules/gui/desktop/hyprland/apps/utilities.nix#L42-L57 + (pkgs.gnome-control-center.overrideAttrs (old: { + postInstall = + old.postInstall + + '' + dir=$out/share/applications + for panel in $dir/* + do + [ "$panel" = "$dir/gnome-network-panel.desktop" ] && continue + [ "$panel" = "$dir/gnome-bluetooth-panel.desktop" ] && continue + [ "$panel" = "$dir/gnome-wifi-panel.desktop" ] && continue + [ "$panel" = "$dir/gnome-wwan-panel.desktop" ] && continue + [ "$panel" = "$dir/gnome-sharing-panel.desktop" ] && continue + [ "$panel" = "$dir/gnome-wacom-panel.desktop" ] && continue + rm "$panel" + done + ''; + })) + ]; + wayland.windowManager.hyprland = { + enable = true; + xwayland.enable = true; + + systemd.enable = false; + + settings = { + xwayland = { + force_zero_scaling = true; + }; + + env = [ + "GDK_SCALE,1" + ]; + monitor = [ + "eDP-1, preferred, auto, 1.33" + ]; + workspace = [ + "special:terminal, on-created-empty:foot" + "special:mixer_gui, on-created-empty:pavucontrol" + "special:file_manager_gui, on-created-empty:nautilus" + "special:file_manager_tui, on-created-empty:foot -- yazi" + ]; + + windowrulev2 = [ + # fixes fullscreen windows (mostly games) + "stayfocused, initialtitle:^()$, initialclass:^(steam)$" + "minsize 1 1, initialtitle:^()$, initialclass:^(steam)$" + "maximize, initialtitle:^(\S+)$, initialclass:^(steamwebhelper)$" + + "immediate, initialclass:^(steam_app_)(.*)$" + "fullscreen, initialclass:^(steam_app_)(.*)$" + + # inhibit idle on every fullscreen app except games + "idleinhibit always, fullscreen:1,!initialclass:^(steam_app_)(.*)$" + ]; + + render = { + explicit_sync = 1; + explicit_sync_kms = 1; + expand_undersized_textures = false; + }; + + animations = { + enabled = true; + bezier = "myBezier, 0.05, 0.9, 0.1, 1.1"; + animation = [ + "windows, 1, 5, myBezier" + "windowsOut, 1, 5, default, popin 80%" + "windowsMove, 1, 5, default, popin 80%" + "fade, 1, 5, default" + "border, 1, 5, default" + "borderangle, 0, 8, default" + "workspaces, 0" + "specialWorkspace, 0" + ]; + }; + + input = { + kb_options = "compose:ralt"; + touchpad = { + natural_scroll = true; + scroll_factor = 0.8; + tap-to-click = true; + clickfinger_behavior = true; + }; + }; + + gestures = { + workspace_swipe = true; + workspace_swipe_direction_lock = false; + workspace_swipe_cancel_ratio = 0.15; + }; + + misc = { + force_default_wallpaper = 0; + disable_hyprland_logo = true; + middle_click_paste = false; + }; + }; + }; + }; +} diff --git a/modules/hm/programs/hypr/lock.nix b/modules/hm/programs/hypr/lock.nix new file mode 100644 index 0000000..477c7b0 --- /dev/null +++ b/modules/hm/programs/hypr/lock.nix @@ -0,0 +1,14 @@ +{ + lib, + inputs, + pkgs, + osConfig, + ... +}: { + config = lib.mkIf osConfig.local.modules.hyprland.enable { + programs.hyprlock = { + enable = true; + package = inputs.hyprlock.packages.${pkgs.system}.hyprlock; + }; + }; +} diff --git a/modules/hm/programs/hypr/paper.nix b/modules/hm/programs/hypr/paper.nix new file mode 100644 index 0000000..4fea20b --- /dev/null +++ b/modules/hm/programs/hypr/paper.nix @@ -0,0 +1,22 @@ +{ + lib, + osConfig, + inputs, + pkgs, + ... +}: { + config = lib.mkIf osConfig.local.modules.hyprland.enable { + services.hyprpaper = { + enable = true; + package = inputs.hyprpaper.packages.${pkgs.system}.default; + + settings = { + preload = ["${osConfig.local.style.wallpaper}"]; + wallpaper = [", ${osConfig.local.style.wallpaper}"]; + }; + }; + + systemd.user.services.hyprpaper.Unit.After = lib.mkForce "graphical-session.target"; + systemd.user.services.hyprpaper.Service.Slice = "background-graphical.slice"; + }; +} diff --git a/modules/hm/programs/media/default.nix b/modules/hm/programs/media/default.nix new file mode 100644 index 0000000..917a9d3 --- /dev/null +++ b/modules/hm/programs/media/default.nix @@ -0,0 +1,20 @@ +{ + lib, + pkgs, + osConfig, + ... +}: { + imports = [./zathura.nix]; + + config = lib.mkIf osConfig.local.profiles.desktop.enable { + programs.mpv.enable = true; + home.packages = [ + pkgs.gnome-calculator + pkgs.gthumb + pkgs.spotify + pkgs.stremio + pkgs.tidal-hifi + pkgs.celluloid + ]; + }; +} diff --git a/modules/hm/programs/media/zathura.nix b/modules/hm/programs/media/zathura.nix new file mode 100644 index 0000000..aef015e --- /dev/null +++ b/modules/hm/programs/media/zathura.nix @@ -0,0 +1,23 @@ +{ + lib, + osConfig, + ... +}: { + config = lib.mkIf osConfig.local.profiles.desktop.enable { + programs.zathura = { + enable = true; + options = { + font = "Inter 12"; + selection-notification = true; + + selection-clipboard = "clipboard"; + adjust-open = "best-fit"; + pages-per-row = "1"; + scroll-page-aware = "true"; + scroll-full-overlap = "0.01"; + scroll-step = "100"; + zoom-min = "10"; + }; + }; + }; +} diff --git a/modules/hm/programs/misc.nix b/modules/hm/programs/misc.nix new file mode 100644 index 0000000..d6dbbca --- /dev/null +++ b/modules/hm/programs/misc.nix @@ -0,0 +1,40 @@ +{ + lib, + pkgs, + osConfig, + ... +}: { + # miscellaneous programs that do not need to be configured + config = lib.mkIf osConfig.local.profiles.desktop.enable { + home.packages = with pkgs; [ + cinny-desktop + entr + fractal + geary + imhex + logisim-evolution + mission-center + nautilus + obsidian + playerctl + proton-pass + simple-scan + vesktop + wl-clipboard + ]; + + programs = { + fzf.enable = true; + fastfetch.enable = true; + hyfetch = { + enable = true; + settings = { + preset = "nonbinary"; + mode = "rgb"; + backend = "fastfetch"; + color_align.mode = "horizontal"; + }; + }; + }; + }; +} diff --git a/modules/hm/programs/walker.nix b/modules/hm/programs/walker.nix new file mode 100644 index 0000000..7a701da --- /dev/null +++ b/modules/hm/programs/walker.nix @@ -0,0 +1,35 @@ +{ + lib, + inputs, + osConfig, + ... +}: { + imports = [ + inputs.walker.homeManagerModules.default + ]; + config = lib.mkIf osConfig.local.modules.hyprland.enable { + programs.walker = { + enable = true; + runAsService = true; + # All options from the config.json can be used here. + config = { + list = { + height = 200; + }; + app_launch_prefix = "uwsm app -- "; + websearch.prefix = "?"; + switcher.prefix = "/"; + }; + }; + + systemd.user.services.walker = { + Unit = { + PartOf = lib.mkForce []; + After = lib.mkForce ["graphical-session.target"]; + }; + Service = { + Slice = lib.mkForce "background-graphical.slice"; + }; + }; + }; +} diff --git a/modules/hm/programs/waybar.nix b/modules/hm/programs/waybar.nix new file mode 100644 index 0000000..a7c201d --- /dev/null +++ b/modules/hm/programs/waybar.nix @@ -0,0 +1,190 @@ +{ + lib, + pkgs, + osConfig, + ... +}: { + config = lib.mkIf osConfig.local.modules.hyprland.enable { + programs.waybar = { + enable = true; + systemd.enable = true; + settings = { + mainBar = { + layer = "top"; + position = "top"; + + modules-left = [ + "hyprland/window" + "pulseaudio" + "cpu" + "memory" + "idle_inhibitor" + ]; + + modules-center = ["hyprland/workspaces"]; + modules-right = [ + "custom/swaync" + "custom/power" + "network" + "battery" + "tray" + "clock" + ]; + + tray = { + icon-size = 16; + spacing = 12; + }; + + battery = { + interval = 10; + states = { + warning = 30; + critical = 15; + }; + format = "{icon} {capacity}%"; + format-charging = " {capacity}% - {time}"; + format-full = " {capacity}% - Full"; + format-icons = [ + "" + "" + "" + "" + "" + ]; + max-length = 25; + }; + + "pulseaudio" = { + format = "{icon} {volume}%"; + format-bluetooth = "{icon} {volume}%"; + format-muted = ""; + format-icons = { + "alsa_output.pci-0000_00_1f.3.analog-stereo" = ""; + "alsa_output.pci-0000_00_1f.3.analog-stereo-muted" = ""; + headphone = ""; + hands-free = ""; + headset = ""; + phone = ""; + phone-muted = ""; + portable = ""; + car = ""; + default = [ + "" + "" + ]; + }; + scroll-step = 1; + on-click = "pavucontrol"; + ignored-sinks = [ + "Easy Effects Sink" + ]; + }; + + "power-profiles-daemon" = { + format-icons = { + default = ""; + performance = ""; + balanced = ""; + power-saver = ""; + }; + }; + + "custom/power" = { + format = ""; + tooltip = false; + on-click = lib.getExe pkgs.wlogout; + }; + + "memory" = { + interval = 5; + format = " {}%"; + tooltip = true; + }; + + "cpu" = { + interval = 5; + format = " {usage:2}%"; + tooltip = true; + }; + + "idle_inhibitor" = { + format = "{icon}"; + format-icons = { + activated = ""; + deactivated = ""; + }; + tooltip = "true"; + }; + + "clock" = { + format = " {:L%H:%M}"; + tooltip = true; + tooltip-format = "{:%A, %d.%B %Y }\n{calendar}"; + }; + + "network" = { + format-icons = [ + "󰤯" + "󰤟" + "󰤢" + "󰤥" + "󰤨" + ]; + format-ethernet = " {bandwidthDownOctets}"; + format-wifi = "{icon} {signalStrength}%"; + format-disconnected = "󰤮"; + tooltip = false; + on-click = "XDG_CURRENT_DESKTOP=gnome gnome-control-center"; + }; + + "hyprland/window" = { + max-length = 22; + separate-outputs = false; + }; + + "hyprland/workspaces" = { + format = "{name}"; + format-icons = { + default = " "; + active = " "; + urgent = " "; + }; + on-scroll-up = "hyprctl dispatch workspace e+1"; + on-scroll-down = "hyprctl dispatch workspace e-1"; + }; + + "custom/swaync" = { + tooltip = false; + format = "{icon}"; + format-icons = { + none = ""; + notification = ""; + dnd-notification = ""; + dnd-none = ""; + inhibited-notification = ""; + inhibited-none = ""; + dnd-inhibited-notification = ""; + dnd-inhibited-none = ""; + }; + return-type = "json"; + escape = true; + exec-if = "which ${pkgs.swaynotificationcenter}/bin/swaync-client"; + exec = "${pkgs.swaynotificationcenter}/bin/swaync-client --subscribe-waybar"; + on-click = "${pkgs.swaynotificationcenter}/bin/swaync-client --toggle-panel --skip-wait"; + on-click-middle = "${pkgs.swaynotificationcenter}/bin/swaync-client --toggle-dnd --skip-wait"; + }; + }; + }; + }; + + systemd.user.services.waybar = { + Unit.After = lib.mkForce "graphical-session.target"; + Service.Slice = "app-graphical.slice"; + }; + + home.packages = [ + pkgs.pavucontrol + ]; + }; +} diff --git a/modules/hm/programs/wlogout.nix b/modules/hm/programs/wlogout.nix new file mode 100644 index 0000000..b9938d9 --- /dev/null +++ b/modules/hm/programs/wlogout.nix @@ -0,0 +1,69 @@ +{ + lib, + pkgs, + config, + osConfig, + ... +}: { + config = lib.mkIf osConfig.local.modules.hyprland.enable { + programs.wlogout = { + enable = true; + + layout = let + systemd = let + systemd = lib.getExe' pkgs.systemd; + in { + loginctl = systemd "loginctl"; + systemctl = systemd "systemctl"; + }; + in [ + { + action = "${systemd.loginctl} lock-session"; + keybind = "l"; + label = "lock"; + text = "Lock"; + } + + { + action = "${systemd.systemctl} hibernate"; + keybind = "h"; + label = "hibernate"; + text = "Hibernate"; + } + + { + action = "${ + systemd.loginctl + } terminate-user ${ + config.home.username + }"; + + keybind = "q"; + label = "logout"; + text = "Logout"; + } + + { + action = "${systemd.systemctl} poweroff"; + keybind = "p"; + label = "shutdown"; + text = "Shutdown"; + } + + { + action = "${systemd.systemctl} suspend"; + keybind = "s"; + label = "suspend"; + text = "Suspend"; + } + + { + action = "${systemd.systemctl} reboot"; + keybind = "r"; + label = "reboot"; + text = "Reboot"; + } + ]; + }; + }; +} diff --git a/modules/hm/programs/xdg.nix b/modules/hm/programs/xdg.nix new file mode 100644 index 0000000..33ccf54 --- /dev/null +++ b/modules/hm/programs/xdg.nix @@ -0,0 +1,42 @@ +{ + lib, + config, + osConfig, + ... +}: { + config = lib.mkIf osConfig.local.profiles.desktop.enable { + xdg = { + enable = true; + cacheHome = config.home.homeDirectory + "/.local/cache"; + + mimeApps = { + enable = true; + defaultApplications = { + "default-web-browser" = ["firefox.desktop"]; + "text/html" = ["firefox.desktop"]; + "x-scheme-handler/http" = ["firefox.desktop"]; + "x-scheme-handler/https" = ["firefox.desktop"]; + "x-scheme-handler/about" = ["firefox.desktop"]; + "x-scheme-handler/unknown" = ["firefox.desktop"]; + "x-scheme-handler/chrome" = ["chromium-browser.desktop"]; + "inode/directory" = ["yazi.desktop"]; + "application/pdf" = ["org.pwmt.zathura-pdf-mupdf.desktop"]; + "image/png" = ["org.gnome.gThumb.desktop"]; + "image/svg" = [" org.gnome.gThumb.desktop"]; + "image/jpeg" = ["org.gnome.gThumb.desktop"]; + "image/gif" = [" org.gnome.gThumb.desktop"]; + "video/mp4" = ["io.github.celluloid_player.Celluloid.desktop"]; + "video/avi" = ["io.github.celluloid_player.Celluloid.desktop"]; + "video/mkv" = ["io.github.celluloid_player.Celluloid.desktop"]; + }; + }; + userDirs = { + enable = true; + createDirectories = true; + extraConfig = { + XDG_SCREENSHOTS_DIR = "${config.xdg.userDirs.pictures}/Screenshots"; + }; + }; + }; + }; +}