diff --git a/flake.nix b/flake.nix index 901c840..fbacf41 100644 --- a/flake.nix +++ b/flake.nix @@ -80,7 +80,6 @@ ]; } ./system/all.nix - ./system/browsers/firefox.nix ./system/shell/fish.nix ./system/tailscale/default.nix ./system/hosts/${hostname}/default.nix diff --git a/home/browsers/firefox/default.nix b/home/browsers/firefox/default.nix index c4870d7..9da1d6b 100644 --- a/home/browsers/firefox/default.nix +++ b/home/browsers/firefox/default.nix @@ -2,8 +2,17 @@ { pkgs, ... }: { + home.sessionVariables = rec { + MOZ_GMP_PATH = "${pkgs.widevine-firefox}/gmp-widevinecdm/system-installed"; + }; + programs.firefox = { enable = true; + package = pkgs.firefox.override { + nativeMessagingHosts = [ + pkgs.firefoxpwa + ]; + }; profiles = { default = { id = 0; @@ -21,10 +30,14 @@ privacy-badger sponsorblock pwas-for-firefox + control-panel-for-twitter ]; settings = { "{7a7a4a92-a2a0-41d1-9fd7-1e92480d612d}".settings = { - dbInChromeStorage = true; # required for Stylus + force = true; + settings = { + dbInChromeStorage = true; + }; }; }; }; @@ -35,6 +48,7 @@ "extensions.update.enabled" = false; "browser.search.defaultenginename" = "google"; "browser.search.order.1" = "google"; + "browser.toolbars.bookmarks.visibility" = "newtab"; "signon.rememberSignons" = false; "widget.use-xdg-desktop-portal.file-picker" = 1; @@ -43,15 +57,79 @@ "browser.cache.disk.enable" = true; # Set to false if you have a HDD "browser.warnOnQuitShortcut" = false; "toolkit.legacyUserProfileCustomizations.stylesheets" = true; - - # "mousewheel.default.delta_multiplier_x" = 100; - # "mousewheel.default.delta_multiplier_y" = 100; - # "mousewheel.default.delta_multiplier_z" = 100; - - # Firefox 75+ remembers the last workspace it was opened on as part of its session management. - # This is annoying, because I can have a blank workspace, click Firefox from the launcher, and - # then have Firefox open on some other workspace. "widget.disable-workspace-management" = true; + "browser.contentblocking.category" = { + Value = "strict"; + Status = "locked"; + }; + "widget.gtk.global-menu.enabled" = true; + "widget.gtk.global-menu.wayland.enabled" = true; + "browser.tabs.inTitlebar" = 0; + "extensions.pocket.enabled" = false; + "extensions.screenshots.disabled" = true; + "browser.topsites.contile.enabled" = false; + "browser.formfill.enable" = false; + "browser.search.suggest.enabled" = false; + "browser.search.suggest.enabled.private" = false; + "browser.urlbar.suggest.searches" = false; + "browser.urlbar.showSearchSuggestionsFirst" = false; + "browser.newtabpage.activity-stream.feeds.section.topstories" = false; + "browser.newtabpage.activity-stream.feeds.snippets" = false; + "browser.newtabpage.activity-stream.feeds.topsites" = false; + "browser.newtabpage.activity-stream.section.highlights.includePocket" = false; + "browser.newtabpage.activity-stream.section.highlights.includeBookmarks" = false; + "browser.newtabpage.activity-stream.section.highlights.includeDownloads" = false; + "browser.newtabpage.activity-stream.section.highlights.includeVisited" = false; + "browser.newtabpage.activity-stream.showSponsored" = false; + "browser.newtabpage.activity-stream.system.showSponsored" = false; + "browser.newtabpage.activity-stream.showSponsoredTopSites" = false; + "browser.newtabpage.activity-stream.showWeather" = false; + + "media.gmp-widevinecdm.version" = "system-installed"; + "media.gmp-widevinecdm.visible" = true; + "media.gmp-widevinecdm.enabled" = true; + "media.gmp-widevinecdm.autoupdate" = false; + + "media.eme.enabled" = true; + "media.eme.encrypted-media-encryption-scheme.enabled" = true; + + # Vertical tabs + "sidebar.verticalTabs" = true; + "sidebar.verticalTabs.dragToPinPromo.dismissed" = true; + "browser.uiCustomization.navBarWhenVerticalTabs" = [ + "back-button" + "forward-button" + "stop-reload-button" + "urlbar-container" + "downloads-button" + "fxa-toolbar-menu-button" + "unified-extensions-button" + ]; + }; + bookmarks = { + force = true; + settings = [ + { + name = "Nix sites"; + toolbar = true; + bookmarks = [ + { + name = "NixOS"; + url = "https://nixos.org/"; + } + ]; + } + { + name = "ovips.us.to"; + toolbar = true; + bookmarks = [ + { + name = "ovips.us.to"; + url = "https://ovips.us.to/"; + } + ]; + } + ]; }; search = { force = true; diff --git a/home/browsers/firefox/userChrome.css b/home/browsers/firefox/userChrome.css index 76b6b55..277cfa6 100644 --- a/home/browsers/firefox/userChrome.css +++ b/home/browsers/firefox/userChrome.css @@ -1,223 +1,105 @@ -@media (prefers-color-scheme: light) { - :root { - /* bookmark_text */ - --toolbar-color: #4c4f69ff !important; - - /* button_background_active */ - --toolbarbutton-active-background: rgba(156, 160, 176, 1) !important; - - /* button_background_hover */ - --toolbarbutton-hover-background: rgba(204, 208, 218, 1) !important; - - /* icons */ - --toolbarbutton-icon-fill: #4c4f69ff !important; - - /* icons_attention */ - --toolbarbutton-icon-fill-attention: #4c4f69ff !important; - - /* frame */ - --toolbox-non-lwt-bgcolor: #dce0e8ff !important; - - /* frame_inactive */ - &:where([tabsintitlebar]) { - --toolbox-non-lwt-bgcolor-inactive: #dce0e8ff !important; - } - - /* popup */ - --arrowpanel-background: #eff1f5ff !important; - - /* popup_border */ - --arrowpanel-border-color: #9ca0b0ff !important; - - /* popup_highlight */ - --urlbarView-highlight-background: #9ca0b0ff !important; - - /* popup_highlight_text */ - --urlbarView-highlight-color: #4c4f69ff !important; - - /* popup_text */ - --arrowpanel-color: #4c4f69ff !important; - - /* tab_background_text */ - --toolbox-non-lwt-textcolor: #4c4f69ff !important; - - /* tab_line */ - .tab-background[selected]:not([multiselected]) { - outline: 1px solid #9ca0b0ff; - outline-offset: -1px; - } - - .tab-background[multiselected] { - --focus-outline-color: #9ca0b0ff; - } - - /* tab_loading */ - #tabbrowser-tabs { - --tab-loading-fill: #9ca0b0ff !important; - } - - /* tab_selected */ - --tab-selected-bgcolor: #eff1f5ff !important; - - /* tab_text */ - --tab-selected-textcolor: #4c4f69ff !important; - - /* toolbar */ - --toolbar-bgcolor: #eff1f5ff !important; - - /* toolbar_bottom_separator */ - --chrome-content-separator-color: #eff1f5ff !important; - - /* toolbar_field */ - --input-bgcolor: #e6e9efff !important; - --toolbar-field-background-color: var(--input-bgcolor) !important; - - /* toolbar_field_border */ - --input-border-color: #eff1f5ff !important; - --toolbar-field-border-color: var(--input-border-color) !important; - - /* toolbar_field_border_focus */ - --toolbar-field-focus-border-color: #6c7086ff !important; - - /* toolbar_field_focus */ - --toolbar-field-focus-background-color: #eff1f5ff !important; - - /* toolbar_field_highlight */ - #urlbar-input, - .searchbar-textbox { - &:focus::selection { - background-color: #6c7086ff; - } - } - - /* toolbar_field_highlight_text */ - #urlbar-input, - .searchbar-textbox { - &:focus::selection { - color: #4c4f69ff; - } - } - - /* toolbar_field_text */ - --input-color: #4c4f69ff !important; - --toolbar-field-color: var(--input-color) !important; - - /* toolbar_field_text_focus */ - --toolbar-field-focus-color: #4c4f69ff !important; - - /* toolbar_vertical_separator */ - --toolbarseparator-color: #6c7086ff !important; - } -} - +/* Dark theme */ @media (prefers-color-scheme: dark) { :root { - /* bookmark_text */ - --toolbar-color: #cdd6f4ff !important; - - /* button_background_active */ - --toolbarbutton-active-background: rgba(108, 112, 134, 1) !important; - - /* button_background_hover */ - --toolbarbutton-hover-background: rgba(49, 50, 68, 1) !important; - - /* icons */ - --toolbarbutton-icon-fill: #cdd6f4ff !important; - - /* icons_attention */ - --toolbarbutton-icon-fill-attention: #cdd6f4ff !important; - - /* frame */ - --toolbox-non-lwt-bgcolor: #11111bff !important; - - /* frame_inactive */ - &:where([tabsintitlebar]) { - --toolbox-non-lwt-bgcolor-inactive: #11111bff !important; + .tabbrowser-tab[selected="true"] .tab-background { + border: 1px solid #313244 !important; } - - /* popup */ - --arrowpanel-background: #1e1e2eff !important; - - /* popup_border */ - --arrowpanel-border-color: #6c7086ff !important; - - /* popup_highlight */ - --urlbarView-highlight-background: #6c7086ff !important; - - /* popup_highlight_text */ - --urlbarView-highlight-color: #cdd6f4ff !important; - - /* popup_text */ - --arrowpanel-color: #cdd6f4ff !important; - - /* tab_background_text */ - --toolbox-non-lwt-textcolor: #cdd6f4ff !important; - - /* tab_line */ + --toolbar-bgcolor: rgb(30, 30, 46) !important; + --toolbox-non-lwt-bgcolor: rgb(17, 17, 27) !important; + --toolbox-non-lwt-textcolor: rgb(205, 214, 244) !important; + --input-bgcolor: rgb(24, 24, 37) !important; + --toolbar-field-background-color: var(--input-bgcolor) !important; + --input-color: rgb(205, 214, 244) !important; + --toolbar-field-color: var(--input-color) !important; .tab-background[selected]:not([multiselected]) { - outline: 1px solid #6c7086ff; + outline: 1px solid rgb(49, 50, 68); outline-offset: -1px; } - .tab-background[multiselected] { - --focus-outline-color: #6c7086ff; + --focus-outline-color: rgb(49, 50, 68); } - - /* tab_loading */ + --arrowpanel-background: rgb(30, 30, 46) !important; + --arrowpanel-color: rgb(205, 214, 244) !important; + --toolbarbutton-active-background: rgb(108, 112, 134) !important; + &:where([tabsintitlebar]) { + --toolbox-non-lwt-bgcolor-inactive: rgb(17, 17, 27) !important; + } + --toolbarbutton-icon-fill-attention: rgb(249, 226, 175) !important; + --toolbarbutton-icon-fill: rgb(205, 214, 244) !important; + --arrowpanel-border-color: rgb(49, 50, 68) !important; + --urlbarView-highlight-color: rgb(205, 214, 244) !important; + --urlbarView-highlight-background: rgb(108, 112, 134) !important; #tabbrowser-tabs { - --tab-loading-fill: #6c7086ff !important; + --tab-loading-fill: rgb(249, 226, 175) !important; } - - /* tab_selected */ - --tab-selected-bgcolor: #1e1e2eff !important; - - /* tab_text */ - --tab-selected-textcolor: #cdd6f4ff !important; - - /* toolbar */ - --toolbar-bgcolor: #1e1e2eff !important; - - /* toolbar_bottom_separator */ - --chrome-content-separator-color: #1e1e2eff !important; - - /* toolbar_field */ - --input-bgcolor: #181825ff !important; - --toolbar-field-background-color: var(--input-bgcolor) !important; - - /* toolbar_field_border */ - --input-border-color: #1e1e2eff !important; + --tab-selected-bgcolor: rgb(30, 30, 46) !important; + --tab-selected-textcolor: rgb(205, 214, 244) !important; + --chrome-content-separator-color: rgb(30, 30, 46) !important; + --toolbar-field-focus-border-color: rgb(49, 50, 68) !important; + --input-border-color: rgb(49, 50, 68) !important; --toolbar-field-border-color: var(--input-border-color) !important; - - /* toolbar_field_border_focus */ - --toolbar-field-focus-border-color: #6c7086ff !important; - - /* toolbar_field_focus */ - --toolbar-field-focus-background-color: #1e1e2eff !important; - - /* toolbar_field_highlight */ - #urlbar-input, - .searchbar-textbox { - &:focus::selection { - background-color: #6c7086ff; - } + --toolbar-field-focus-background-color: rgb(30, 30, 46) !important; + #urlbar-input:focus::selection, + .searchbar-textbox:focus::selection { + color: rgb(30, 30, 46); } - - /* toolbar_field_highlight_text */ - #urlbar-input, - .searchbar-textbox { - &:focus::selection { - color: #cdd6f4ff; - } + #urlbar-input:focus::selection, + .searchbar-textbox:focus::selection { + background-color: rgb(249, 226, 175); } - - /* toolbar_field_text */ - --input-color: #cdd6f4ff !important; - --toolbar-field-color: var(--input-color) !important; - - /* toolbar_field_text_focus */ - --toolbar-field-focus-color: #cdd6f4ff !important; - - /* toolbar_vertical_separator */ - --toolbarseparator-color: #6c7086ff !important; + --toolbarseparator-color: rgb(249, 226, 175) !important; + } +} + +/* Light theme */ +@media (prefers-color-scheme: light) { + :root { + .tabbrowser-tab[selected="true"] .tab-background { + border: 1px solid #ccd0da !important; + } + --toolbar-bgcolor: rgb(239, 241, 245) !important; + --toolbox-non-lwt-bgcolor: rgb(220, 224, 232) !important; + --toolbox-non-lwt-textcolor: rgb(76, 79, 105) !important; + --input-bgcolor: rgb(230, 233, 239) !important; + --toolbar-field-background-color: var(--input-bgcolor) !important; + --input-color: rgb(76, 79, 105) !important; + --toolbar-field-color: var(--input-color) !important; + .tab-background[selected]:not([multiselected]) { + outline: 1px solid rgb(223, 142, 29); + outline-offset: -1px; + } + .tab-background[multiselected] { + --focus-outline-color: rgb(223, 142, 29); + } + --arrowpanel-background: rgb(239, 241, 245) !important; + --arrowpanel-color: rgb(76, 79, 105) !important; + --toolbarbutton-active-background: rgb(156, 160, 176) !important; + &:where([tabsintitlebar]) { + --toolbox-non-lwt-bgcolor-inactive: rgb(220, 224, 232) !important; + } + --toolbarbutton-icon-fill-attention: rgb(223, 142, 29) !important; + --toolbarbutton-icon-fill: rgb(76, 79, 105) !important; + --arrowpanel-border-color: rgb(223, 142, 29) !important; + --urlbarView-highlight-color: rgb(76, 79, 105) !important; + --urlbarView-highlight-background: rgb(156, 160, 176) !important; + #tabbrowser-tabs { + --tab-loading-fill: rgb(223, 142, 29) !important; + } + --tab-selected-bgcolor: rgb(239, 241, 245) !important; + --tab-selected-textcolor: rgb(76, 79, 105) !important; + --chrome-content-separator-color: rgb(239, 241, 245) !important; + --toolbar-field-focus-border-color: rgb(223, 142, 29) !important; + --input-border-color: rgb(239, 241, 245) !important; + --toolbar-field-border-color: var(--input-border-color) !important; + --toolbar-field-focus-background-color: rgb(239, 241, 245) !important; + #urlbar-input:focus::selection, + .searchbar-textbox:focus::selection { + color: rgb(239, 241, 245); + } + #urlbar-input:focus::selection, + .searchbar-textbox:focus::selection { + background-color: rgb(223, 142, 29); + } + --toolbarseparator-color: rgb(223, 142, 29) !important; } } diff --git a/system/browsers/firefox.nix b/system/browsers/firefox.nix deleted file mode 100644 index c76789b..0000000 --- a/system/browsers/firefox.nix +++ /dev/null @@ -1,96 +0,0 @@ -# https://discourse.nixos.org/t/declare-firefox-extensions-and-settings/36265 -{ pkgs, ... }: - -let - lock-false = { - Value = false; - Status = "locked"; - }; - lock-true = { - Value = true; - Status = "locked"; - }; -in -{ - environment.variables = rec { - MOZ_GMP_PATH = "${pkgs.widevine-firefox}/gmp-widevinecdm/system-installed"; - }; - - programs = { - firefox = { - enable = true; - nativeMessagingHosts.packages = [ pkgs.firefoxpwa ]; - languagePacks = [ "en-US" ]; - - # ---- POLICIES ---- - # Check about:policies#documentation for options. - policies = { - DisableTelemetry = true; - DisableFirefoxStudies = true; - EnableTrackingProtection = { - Value = true; - Locked = true; - Cryptomining = true; - Fingerprinting = true; - }; - DisablePocket = true; - DisableFirefoxAccounts = true; - DisableAccounts = true; - DisableFirefoxScreenshots = true; - OverrideFirstRunPage = ""; - OverridePostUpdatePage = ""; - DontCheckDefaultBrowser = true; - DisplayBookmarksToolbar = "newtab"; # alternatives: "always" or "newtab" - DisplayMenuBar = "always"; # alternatives: "always", "never" or "default-on" - SearchBar = "unified"; # alternative: "separate" - - # ---- EXTENSIONS ---- - # Check about:support for extension/add-on ID strings. - # Valid strings for installation_mode are "allowed", "blocked", - # "force_installed" and "normal_installed". - # ExtensionSettings = { - # # blocks all addons except the ones specified below - # "*".installation_mode = "blocked"; - # }; - - # ---- PREFERENCES ---- - # Check about:config for options. - Preferences = { - "browser.contentblocking.category" = { - Value = "strict"; - Status = "locked"; - }; - "widget.use-xdg-desktop-portal.file-picker" = 1; - "widget.gtk.global-menu.enabled" = lock-true; - "widget.gtk.global-menu.wayland.enabled" = lock-true; - "browser.tabs.inTitlebar" = 0; - "extensions.pocket.enabled" = lock-false; - "extensions.screenshots.disabled" = lock-true; - "browser.topsites.contile.enabled" = lock-false; - "browser.formfill.enable" = lock-false; - "browser.search.suggest.enabled" = lock-false; - "browser.search.suggest.enabled.private" = lock-false; - "browser.urlbar.suggest.searches" = lock-false; - "browser.urlbar.showSearchSuggestionsFirst" = lock-false; - "browser.newtabpage.activity-stream.feeds.section.topstories" = lock-false; - "browser.newtabpage.activity-stream.feeds.snippets" = lock-false; - "browser.newtabpage.activity-stream.section.highlights.includePocket" = lock-false; - "browser.newtabpage.activity-stream.section.highlights.includeBookmarks" = lock-false; - "browser.newtabpage.activity-stream.section.highlights.includeDownloads" = lock-false; - "browser.newtabpage.activity-stream.section.highlights.includeVisited" = lock-false; - "browser.newtabpage.activity-stream.showSponsored" = lock-false; - "browser.newtabpage.activity-stream.system.showSponsored" = lock-false; - "browser.newtabpage.activity-stream.showSponsoredTopSites" = lock-false; - - "media.gmp-widevinecdm.version" = "system-installed"; - "media.gmp-widevinecdm.visible" = lock-true; - "media.gmp-widevinecdm.enabled" = lock-true; - "media.gmp-widevinecdm.autoupdate" = lock-false; - - "media.eme.enabled" = lock-true; - "media.eme.encrypted-media-encryption-scheme.enabled" = lock-true; - }; - }; - }; - }; -}