diff --git a/home-modules/firefox.nix b/home-modules/firefox.nix index 363e78a..9335de7 100644 --- a/home-modules/firefox.nix +++ b/home-modules/firefox.nix @@ -9,272 +9,9 @@ packages = with pkgs; [ firefox ]; - file = with rice.color; let - blur = builtins.toString 20; - in { - ".mozilla/firefox/${hyper.user}/chrome/userChrome.css".text = /* css */ '' - :root{ - /* Popup panels */ - --arrowpanel-background : rgba(${rice.lib.hex-to-rgb-comma-string background}, ${builtins.toString rice.transparency}) !important; - --arrowpanel-border-color : ${border} !important; - --arrowpanel-color : ${secondary.base} !important; - --arrowpanel-dimmed : rgba(${rice.lib.hex-to-rgb-comma-string background},0.4) !important; - --arrowpanel-dimmed-further : rgba(${rice.lib.hex-to-rgb-comma-string background},0.6) !important; - --arrowpanel-dimmed-even-further : rgba(${rice.lib.hex-to-rgb-comma-string background},0.8) !important; - - /* Autocomplete */ - --autocomplete-popup-background : rgba(${rice.lib.hex-to-rgb-comma-string background}, ${builtins.toString rice.transparency}) !important; - --autocomplete-popup-color : ${foreground} !important; - --autocomplete-popup-highlight-background: ${accent.base} !important; - --autocomplete-popup-highlight-color : ${foreground} !important; - - /* Toolbar background */ - --toolbar-bgcolor : rgba(${rice.lib.hex-to-rgb-comma-string background},0.4) !important; - --toolbar-non-lwt-bgcolor : rgba(${rice.lib.hex-to-rgb-comma-string background}, ${builtins.toString rice.transparency}) !important; - --toolbar-non-lwt-bgimage : none !important; - --toolbar-color : ${foreground} !important; - - /* Tabs */ - --tab-selected-bgcolor : ${accent.base} !important; - --tabs-border-color : ${border} !important; - --tab-line-color : ${accent.base} !important; - --tab-loader-size : 16px !important; - - /* Sidebar */ - --lwt-sidebar-background-color : rgba(${rice.lib.hex-to-rgb-comma-string background}, ${builtins.toString rice.transparency}) !important; - --lwt-sidebar-text-color : ${foreground} !important; - --sidebar-background-color : rgba(${rice.lib.hex-to-rgb-comma-string background}, ${builtins.toString rice.transparency}) !important; - --sidebar-text-color : ${foreground} !important; - --sidebar-border-color : ${border} !important; - - /* URL bar */ - --urlbar-popup-url-color : ${foreground} !important; - --urlbar-popup-action-color : ${secondary.base} !important; - --toolbar-field-background-color : rgba(${rice.lib.hex-to-rgb-comma-string background}, ${builtins.toString rice.transparency}) !important; - --toolbar-field-focus-background-color : rgba(${rice.lib.hex-to-rgb-comma-string background}, ${builtins.toString rice.transparency}) !important; - --toolbar-field-color : ${accent.base} !important; - --toolbar-field-focus-color : ${foreground} !important; - --toolbar-field-focus-border-color : ${accent.base} !important; - - /* Buttons */ - --toolbarbutton-icon-fill : ${foreground} !important; - --toolbarbutton-hover-background : rgba(${rice.lib.hex-to-rgb-comma-string accent.base}, 0.2) !important; - --toolbarbutton-active-background : rgba(${rice.lib.hex-to-rgb-comma-string accent.base}, 0.4) !important; - - /* Notification and panel */ - --panel-disabled-color : rgba(${rice.lib.hex-to-rgb-comma-string foreground},0.3) !important; - --panel-separator-color : ${border} !important; - - /* New tab page */ - --newtab-background-color : ${background} !important; - --newtab-background-color-secondary : ${secondary.dark} !important; - --newtab-text-primary-color : ${foreground} !important; - --newtab-text-secondary-color : ${secondary.base} !important; - --newtab-search-icon-color : ${accent.base} !important; - - --tabpanel-background-color : transparent !important; - background : linear-gradient(180deg,rgba(${rice.lib.hex-to-rgb-comma-string secondary.dark}, ${builtins.toString rice.transparency}) 0%, rgba(${rice.lib.hex-to-rgb-comma-string background}, ${builtins.toString rice.transparency}) 100%) !important; - } - .tabbrowser-tab[selected="true"] { - color: ${background} !important; - } - - #appcontent { - background: transparent !important; - } - #navigator-toolbox { - --tabs-border-color: transparent !important; - } - #toolbar-menubar, #TabsToolbar, #PersonalToolbar, #navigator-toolbox, #sidebar-box { - background-color: transparent !important; - -moz-appearance: none !important; - background-image: none !important; - } - - window, #nav-bar{ - background-color: transparent !important; - -moz-appearance: none !important; - background-image: none !important; - } - ''; - - ".mozilla/firefox/${hyper.user}/chrome/userContent.css".text = /* css */ '' - /* Removes the white loading page */ - /* url(about:newtab), url(about:home) */ - @-moz-document url(about:blank) { - html:not(#ublock0-epicker), html:not(#ublock0-epicker) body, #newtab-customize-overlay { - background: ${background} !important; - } - } - - /* Sets up minimal incognito scrollbar */ - @-moz-document url(about:privatebrowsing) { - :root{ - scrollbar-width: thin !important; - scrollbar-color: rgb(161, 161, 161) transparent !important; - } - } - - /* new-tab */ - @-moz-document url-prefix(about:home), url-prefix(about:newtab) { - :root{ - --newtab-background-color-secondary: ${background} !important; - } - body, html { - background: transparent !important; - } - .tile, .search-handoff-button { - border: ${builtins.toString rice.border-width}px solid ${border} !important; - } - } - - @-moz-document domain(reddit.com) { - header { - background-color: rgba(${rice.lib.hex-to-rgb-comma-string background},${builtins.toString rice.transparency}) !important; - backdrop-filter: blur(${blur}px); - } - body, html, .bg-neutral-background, .threadline, reddit-sidebar-nav, shreddit-post, aside, .reddit-search-bar, comment-body-header, shreddit-comment-tree{ - background-color: transparent !important; - } - } - - @-moz-document domain(reddit.com) { - header { - background-color: rgba(${rice.lib.hex-to-rgb-comma-string background},${builtins.toString rice.transparency}) !important; - } - body, html, reddit-sidebar-nav, shreddit-post, aside, .reddit-search-bar{ - background-color: transparent !important; - } - } - - @-moz-document domain(google.com) { - .sfbg { - background-color: rgba(${rice.lib.hex-to-rgb-comma-string background},${builtins.toString rice.transparency}) !important; - backdrop-filter: blur(${blur}px); - } - body, html, div#search > * { - background-color: transparent !important; - border: ${builtins.toString rice.border-width} solid ${border}; - } - .g, .appbar { - background-color: transparent !important; - border: ${builtins.toString rice.border-width} solid ${border}; - } - div#rso { - * { - background-color: transparent !important; - border: ${builtins.toString rice.border-width} solid ${border}; - } - } - div#cnt > div { - - } - } - - @media (prefers-color-scheme: dark) { - :root .theme-system { - --color-bg: transtparent !important; - --color-text: ${rice.color.foreground} - } - } - - @-moz-document domain(developer.mozilla.org) { - html, body { - background-color: transparent !important; - } - .top-navigation, .article-actions-container { - background-color: rgba(0,0,0,1) !important; - backdrop-filter: blur(100px); - border-radius: ${builtins.toString rice.rounding}px; - } - } - - @-moz-document domain(github.com) { - body, html, header, #repository-container-header, .bgColor-muted, section { - background-color: transparent !important; - } - } - @-moz-document domain(youtube.com) { - body, html, div#content, ytd-app, #frosted-glass.with-chipbar.ytd-app, ytd-shorts[is-dark] #cinematic-shorts-scrim.ytd-shorts { - background-color: transparent !important; - } - #background.ytd-masthead, div#background { - background-color: rgba(${rice.lib.hex-to-rgb-comma-string background}, ${builtins.toString rice.transparency}) !important; - backdrop-filter: blur(100px); - } - * { - --yt-spec-base-background: transparent; - --yt-spec-raised-background: rgba(${rice.lib.hex-to-rgb-comma-string background}, ${builtins.toString rice.transparency}) !important; - --yt-spec-menu-background: rgba(${rice.lib.hex-to-rgb-comma-string accent.dark}, ${builtins.toString rice.transparency}) !important; - --yt-spec-inverted-background: rgba(${rice.lib.hex-to-rgb-comma-string secondary.dark}, ${builtins.toString rice.transparency}) !important; - } - } - - @-moz-document domain(mynixos.com) { - body, html { - background-color: transparent !important; - } - header, footer { - background-color: rgba(0,0,0,1) !important; - backdrop-filter: blur(100px); - border-radius: ${builtins.toString rice.rounding}px; - } - } - - @-moz-document domain(moodle.informatik.tu-darmstadt.de) { - body, html , .main-inner, .main-inner * { - background-color: transparent !important; - } - .bg-primary { - background-color: rgba(${rice.lib.hex-to-rgb-comma-string accent.base},0.5) !important; - } - } - - @-moz-document url-prefix("https://nx2.site/") { - html { - background: radial-gradient(rgba(255, 255, 255, 0.8) 5%, transparent 5%) !important; - background-repeat: repeat !important; - background-size: 2vmin 2vmin !important; - } - } - - @-moz-document url-prefix("pw.nx2.site") { - html { - background: black; - } - } - - @-moz-document url-prefix("pw.nx2.site") { - html { - background: radial-gradient(rgba(255, 255, 255, 0.8) 5%, transparent 5%) !important; - background-repeat: repeat !important; - background-size: 2vmin 2vmin !important; - } - body, .tw-bg-background-alt3, main, .card-header, .card-body, .modal-body { - background-color: transparent !important; - } - .modal-open, .modal-header, form.modal-content, .modal-footer { - background-color: rgba(0,0,0,0.8) !important; - backdrop-filter: blur(5px); - } - .cdk-virtual-scroll-content-wrapper, .card, .tw-bg-background, .modal-content { - background-color: rgba(0,0,0,0.8) !important; - border-radius: 10px !important; - border: ${toString rice.border-width}px solid ${border} !important; - } - } - - ''; - # @-moz-document domain(chatgpt.com) { - # body, html , .bg-token-sidebar-surface-primary { - # background-color: transparent !important; - # } - # .bg-token-main-surface-primary { - # background-color: rgba(0,0,0,1) !important; - # backdrop-filter: blur(100px) !important; - # border-radius: ${builtins.toString rice.rounding}px !important; - # } - # } + file = { + ".mozilla/firefox/${hyper.user}/chrome/userChrome.css".text = import ./userChrome.nix rice; + ".mozilla/firefox/${hyper.user}/chrome/userContent.css".text = import ./userContent.nix rice; }; }; } diff --git a/home-modules/firefox/firefox.nix b/home-modules/firefox/firefox.nix new file mode 100644 index 0000000..211cce0 --- /dev/null +++ b/home-modules/firefox/firefox.nix @@ -0,0 +1,19 @@ +{ pkgs, ... }@all: with all; +# browser.tabs.allow_transparent_browser +# https://www.reddit.com/r/FirefoxCSS/comments/1dqws4b/firefox_128_will_allow_the_main_browser_content/ +{ + programs.firefox.profiles."{hyper.user}".settings = { + "widget.use-xdg-desktop-portal.file-picker" = 1; + }; + home = { + packages = with pkgs; [ + firefox + ]; + file = with rice.color; let + blur = builtins.toString 20; + f = rice.lib.hex-to-rgb-comma-string; + in { + ".mozilla/firefox/${hyper.user}/chrome/userChrome.css".text = import ./userChrome.nix rice; + ".mozilla/firefox/${hyper.user}/chrome/userContent.css".text = import ./userContent.nix rice; }; + }; +} diff --git a/home.nix b/home.nix index 194c3dc..0bb59d3 100644 --- a/home.nix +++ b/home.nix @@ -12,7 +12,7 @@ ./home-modules/discord.nix ./home-modules/email.nix ./home-modules/figlet.nix - ./home-modules/firefox.nix + ./home-modules/firefox/firefox.nix ./home-modules/fish.nix ./home-modules/games.nix ./home-modules/gestures.nix