From 0d45744904eee382fade0ac84af03374f6704870 Mon Sep 17 00:00:00 2001 From: foglar Date: Wed, 25 Dec 2024 19:16:22 +0100 Subject: [PATCH] if else options added to config --- config/dolphinrc | 41 ------ flake.nix | 8 +- nixos/home/packages/applications/firefox.nix | 138 +++++++++++++++++- nixos/home/packages/packages.nix | 29 ++-- .../system/settings/default-applications.nix | 34 +++-- zenith/home.nix | 16 +- 6 files changed, 192 insertions(+), 74 deletions(-) delete mode 100644 config/dolphinrc diff --git a/config/dolphinrc b/config/dolphinrc deleted file mode 100644 index 169fcb8..0000000 --- a/config/dolphinrc +++ /dev/null @@ -1,41 +0,0 @@ -MenuBar=Disabled - -[$Version] -update_info=dolphin_detailsmodesettings.upd:rename-leading-padding - -[General] -ShowSelectionToggle=false -ShowStatusBar=false -Version=202 -ViewPropsTimestamp=2023,4,26,16,58,48.324 - -[IconsMode] -MaximumTextLines=1 -PreviewSize=112 - -[InformationPanel] -dateFormat=ShortFormat - -[KFileDialog Settings] -Places Icons Auto-resize=false -Places Icons Static Size=16 - -[KPropertiesDialog] -1920x1080 screen: Window-Maximized=true - -[MainWindow] -MenuBar=Disabled -ToolBarsMovable=Disabled - -[MainWindow][Toolbar mainToolBar] -IconSize=16 -ToolButtonStyle=IconOnly - -[PlacesPanel] -IconSize=16 - -[PreviewSettings] -Plugins=appimagethumbnail,audiothumbnail,comicbookthumbnail,cursorthumbnail,djvuthumbnail,ebookthumbnail,exrthumbnail,imagethumbnail,jpegthumbnail,kraorathumbnail,windowsexethumbnail,windowsimagethumbnail,opendocumentthumbnail,svgthumbnail,ffmpegthumbs - -[Toolbar mainToolBar] -ToolButtonStyle=IconOnly diff --git a/flake.nix b/flake.nix index b2c98f0..b73a694 100644 --- a/flake.nix +++ b/flake.nix @@ -54,13 +54,13 @@ ... } @ inputs: let userSettings = { - username = "foglar"; + username = "foglar"; # konsta or foglar (else defaulting to foglar or none) hostname = "laptop"; shell = "bash"; # bash, zsh - terminal = "kitty"; - browser = "librewolf"; - editor = "neovim"; + terminal = "kitty"; # kitty, alacritty + browser = "librewolf"; # firefox, librewolf, qutebrowser + editor = "neovim"; # neovim, vscode # List all themes: $ nix build nixpkgs#base16-schemes && ls result/share/themes theme = "catppuccin-mocha"; #tokyo-night-dark, one-dark diff --git a/nixos/home/packages/applications/firefox.nix b/nixos/home/packages/applications/firefox.nix index bb20d24..265f91f 100644 --- a/nixos/home/packages/applications/firefox.nix +++ b/nixos/home/packages/applications/firefox.nix @@ -2,6 +2,8 @@ config, lib, inputs, + pkgs, + userSettings, ... }: { options = { @@ -13,15 +15,137 @@ enable = true; profiles.default = { + search.engines = { + "Nix Packages" = { + urls = [ + { + template = "https://search.nixos.org/packages"; + params = [ + { + name = "type"; + value = "packages"; + } + { + name = "query"; + value = "{searchTerms}"; + } + ]; + } + ]; - extensions = with inputs.firefox-addons.packages."x86_64-linux"; [ - #enhancer-for-youtube - ublock-origin - simple-translate - duckduckgo-privacy-essentials - return-youtube-dislikes - user-agent-string-switcher + icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; + definedAliases = ["@np"]; + }; + "Phind" = { + urls = [ + { + template = "https://www.phind.com/search"; + params = [ + { + name = "q"; + value = "{searchTerms}"; + } + { + name = "searchMode"; + value = "always"; + } + { + name = "allowMultiSearch"; + value = "false"; + } + ]; + } + ]; + + icon = "https://www.phind.com/favicon.ico"; + definedAliases = ["@phind"]; + }; + }; + search.force = true; + + settings = { + "dom.security.https_only_mode" = true; + "privacy.clearOnShutdown.history" = true; + #"identity.fxaccounts.enabled" = false; + #"signon.rememberSignons" = false; + }; + + bookmarks = [ + { + name = "Toolbar"; + toolbar = true; + bookmarks = [ + { + name = "Server"; + bookmarks = [ + { + name = "AudioBookshelf"; + tags = ["audiobookshelf"]; + keyword = "audio"; + url = "http://foglar.local:8080"; + } + { + name = "Photos"; + tags = ["photoprism"]; + keyword = "photos"; + url = "http://foglar.local:2342"; + } + { + name = "E-books"; + tags = ["Kavita"]; + keyword = "kavita"; + url = "http://foglar.local:5000"; + } + { + name = "Films"; + tags = ["jellyfin"]; + keyword = "films"; + url = "http://foglar.local:8097"; + } + { + name = "CasaOS"; + tags = ["casaos"]; + keyword = "casa"; + url = "http://foglar.local:7788"; + } + { + name = "Torrent"; + tags = ["qbittorrent"]; + keyword = "torrent"; + url = "http://foglar.local:8181/"; + } + { + name = "Syncthing"; + tags = ["syncthing"]; + keyword = "sync"; + url = "https://foglar.local:8384/"; + } + { + name = "Git"; + tags = ["gitea"]; + keyword = "git"; + url = "https://git.foglar.tech"; + } + ]; + } + ]; + } ]; + + extensions = with inputs.firefox-addons.packages."x86_64-linux"; + [ + ublock-origin + ] + ++ ( + if (userSettings.username == "foglar") + then [ + inputs.firefox-addons.packages."x86_64-linux".simple-translate + inputs.firefox-addons.packages."x86_64-linux".duckduckgo-privacy-essentials + inputs.firefox-addons.packages."x86_64-linux".return-youtube-dislikes + inputs.firefox-addons.packages."x86_64-linux".user-agent-string-switcher + ] + else [] + ); }; }; }; diff --git a/nixos/home/packages/packages.nix b/nixos/home/packages/packages.nix index ff2dc5d..9407a40 100644 --- a/nixos/home/packages/packages.nix +++ b/nixos/home/packages/packages.nix @@ -1,6 +1,7 @@ { pkgs, lib, + userSettings, ... }: { imports = [ @@ -30,27 +31,33 @@ }; program = { - kitty.enable = lib.mkDefault true; + kitty.enable = + if userSettings.terminal == "kitty" + then lib.mkDefault true + else lib.mkDefault false; tmux.enable = lib.mkDefault true; zoxide.enable = lib.mkDefault true; - firefox.enable = lib.mkDefault true; + firefox.enable = + if userSettings.browser == "firefox" + then lib.mkDefault true + else lib.mkDefault false; spotify.enable = lib.mkDefault true; vscode = { enable = lib.mkDefault true; ide = { - python.enable = lib.mkDefault true; - go.enable = lib.mkDefault true; - csharp.enable = lib.mkDefault true; + python.enable = lib.mkDefault false; + go.enable = lib.mkDefault false; + csharp.enable = lib.mkDefault false; cpp.enable = lib.mkDefault false; - web.enable = lib.mkDefault true; + web.enable = lib.mkDefault false; }; - nix.enable = lib.mkDefault true; - markdown.enable = lib.mkDefault true; - ai.enable = lib.mkDefault true; - git.enable = lib.mkDefault true; - + nix.enable = lib.mkDefault false; + markdown.enable = lib.mkDefault false; + ai.enable = lib.mkDefault false; + git.enable = lib.mkDefault false; + themes.enable = lib.mkDefault false; }; git.enable = lib.mkDefault true; diff --git a/nixos/system/settings/default-applications.nix b/nixos/system/settings/default-applications.nix index aaae708..336b7cf 100644 --- a/nixos/system/settings/default-applications.nix +++ b/nixos/system/settings/default-applications.nix @@ -6,10 +6,15 @@ ... }: { options = { - default-applications.enable = lib.mkEnableOption "Enable default applications"; + sys.default-applications.enable = lib.mkEnableOption "Enable default applications"; + xdg.da.browser = lib.mkOption { + type = lib.types.str; + default = "firefox"; + description = "Default browser"; + }; }; - config = lib.mkIf config.default-applications.enable { + config = lib.mkIf config.sys.default-applications.enable { environment.sessionVariables = { DEFAULT_BROWSER = "${pkgs."${userSettings.browser}"}/bin/${userSettings.browser}"; TERMINAL = "${pkgs."${userSettings.terminal}"}/bin/${userSettings.terminal}"; @@ -18,14 +23,25 @@ # Default applications configuration xdg.mime.enable = true; + + xdg.da.browser = + if userSettings.browser == "qutebrowser" + then "org.qutebrowser.qutebrowser" + else + ( + if userSettings.browser == "librewolf" + then "librewolf" + else "firefox" + ); + xdg.mime.defaultApplications = { - "text/html" = "librewolf.desktop"; - "x-scheme-handler/http" = "librewolf.desktop"; - "x-scheme-handler/https" = "librewolf.desktop"; - "x-scheme-handler/about" = "librewolf.desktop"; - "x-scheme-handler/unknown" = "librewolf.desktop"; - "text/plain" = "nvim.desktop"; - "application/pdf" = "evince"; + "text/html" = "${config.xdg.da.browser}.desktop"; + "x-scheme-handler/http" = "${config.xdg.da.browser}.desktop"; + "x-scheme-handler/https" = "${config.xdg.da.browser}.desktop"; + "x-scheme-handler/about" = "${config.xdg.da.browser}.desktop"; + "x-scheme-handler/unknown" = "${config.xdg.da.browser}.desktop"; + "text/plain" = "${userSettings.editor}.desktop"; + "application/pdf" = "org.gnome.Evince.desktop"; }; }; } diff --git a/zenith/home.nix b/zenith/home.nix index 99ba7e5..419664a 100644 --- a/zenith/home.nix +++ b/zenith/home.nix @@ -34,11 +34,24 @@ kitty.enable = true; tmux.enable = true; zoxide.enable = true; - + vscode = { enable = true; + ide = { + python.enable = true; + go.enable = true; + csharp.enable = true; + cpp.enable = false; + web.enable = true; + }; nix.enable = true; + markdown.enable = true; + ai.enable = true; + git.enable = true; + + themes.enable = false; }; + git.enable = true; neovim.enable = true; @@ -57,7 +70,6 @@ ".config/hypr/hyprlock.conf".source = ../config/hyprlock.conf; ".config/hypr/mocha.conf".source = ../config/mocha.conf; ".config/hypr/hypridle.conf".source = ../config/hypridle.conf; - #".config/dolphinrc".source = ../config/dolphinrc; ".prettierrc".text = '' { "tabWidth": 4,