From fac2bb74f3028b2a67aa0bde0579218df2b2424f Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 6 Apr 2020 15:38:02 -0400 Subject: [PATCH] Add firefox userChrome.css for fluorescence theme --- modules/desktop/browsers/firefox.nix | 22 ++++ modules/themes/fluorescence/default.nix | 124 +++++++++++------- .../fluorescence/firefox/userChrome.css | 100 ++++++++++++++ 3 files changed, 195 insertions(+), 51 deletions(-) create mode 100644 modules/themes/fluorescence/firefox/userChrome.css diff --git a/modules/desktop/browsers/firefox.nix b/modules/desktop/browsers/firefox.nix index 54a850a9..91df917c 100644 --- a/modules/desktop/browsers/firefox.nix +++ b/modules/desktop/browsers/firefox.nix @@ -11,6 +11,10 @@ with lib; type = types.bool; default = false; }; + profileName = mkOption { + type = types.str; + default = config.my.username; + }; }; config = mkIf config.modules.desktop.browsers.firefox.enable { @@ -25,6 +29,24 @@ with lib; categories = "Network"; }) ]; + my.env.XDG_DESKTOP_DIR = "$HOME"; # (try to) prevent ~/Desktop + + # Use a stable profile name so we can target it in themes + my.home.home.file = + let cfg = config.modules.desktop.browsers.firefox; in + { + ".mozilla/firefox/profiles.ini".text = '' + [Profile0] + Name=default + IsRelative=1 + Path=${cfg.profileName}.default + Default=1 + + [General] + StartWithLastProfile=1 + Version=2 + ''; + }; }; } diff --git a/modules/themes/fluorescence/default.nix b/modules/themes/fluorescence/default.nix index 527fb15c..45495e40 100644 --- a/modules/themes/fluorescence/default.nix +++ b/modules/themes/fluorescence/default.nix @@ -2,6 +2,7 @@ { config, options, lib, pkgs, ... }: with lib; +let cfg = config.modules; in { options.modules.themes.fluorescence = { enable = mkOption { @@ -10,7 +11,7 @@ with lib; }; }; - config = mkIf config.modules.themes.fluorescence.enable { + config = mkIf cfg.themes.fluorescence.enable { modules.theme = { name = "fluorescence"; version = "0.0.1"; @@ -55,57 +56,78 @@ with lib; paper-icon-theme # for rofi ]; my.zsh.rc = lib.readFile ./zsh/prompt.zsh; - my.home.xdg = { - configFile = { - "bspwm/rc.d/polybar".source = ./polybar/run.sh; - "bspwm/rc.d/theme".source = ./bspwmrc; - "dunst/dunstrc".source = ./dunstrc; - "polybar" = { source = ./polybar; recursive = true; }; - "rofi/theme" = { source = ./rofi; recursive = true; }; - "tmux/theme".source = ./tmux.conf; - "xtheme/90-theme".source = ./Xresources; - # GTK - "gtk-3.0/settings.ini".text = '' - [Settings] - gtk-theme-name=Ant-Dracula - gtk-icon-theme-name=Paper - gtk-fallback-icon-theme=gnome - gtk-application-prefer-dark-theme=true - gtk-cursor-theme-name=Paper - gtk-xft-hinting=1 - gtk-xft-hintstyle=hintfull - gtk-xft-rgba=none - ''; - # GTK2 global theme (widget and icon theme) - "gtk-2.0/gtkrc".text = '' - gtk-theme-name="Ant-Dracula" - gtk-icon-theme-name="Paper-Mono-Dark" - gtk-font-name="Sans 10" - ''; - # QT4/5 global theme - "Trolltech.conf".text = '' - [Qt] - style=Ant-Dracula - ''; - }; - dataFile = mkIf config.modules.desktop.browsers.qutebrowser.enable { - "qutebrowser/userstyles.css".source = - let compiledStyles = - with pkgs; runCommand "compileUserStyles" - { buildInputs = [ sass ]; } '' - mkdir "$out" - for file in ${./userstyles/qutebrowser}/*.scss; do - scss --sourcemap=none \ - --no-cache \ - --style compressed \ - --default-encoding utf-8 \ - "$file" \ - >>"$out/userstyles.css" - done - ''; - in "${compiledStyles}/userstyles.css"; - }; + my.home = { + home.file = mkMerge [ + (mkIf cfg.desktop.browsers.firefox.enable { + ".mozilla/firefox/${cfg.desktop.browsers.firefox.profileName}.default/chrome/userChrome.css" = { + source = ./firefox/userChrome.css; + }; + }) + ]; + + xdg.configFile = mkMerge [ + (mkIf config.services.xserver.enable { + "xtheme/90-theme".source = ./Xresources; + # GTK + "gtk-3.0/settings.ini".text = '' + [Settings] + gtk-theme-name=Ant-Dracula + gtk-icon-theme-name=Paper + gtk-fallback-icon-theme=gnome + gtk-application-prefer-dark-theme=true + gtk-cursor-theme-name=Paper + gtk-xft-hinting=1 + gtk-xft-hintstyle=hintfull + gtk-xft-rgba=none + ''; + # GTK2 global theme (widget and icon theme) + "gtk-2.0/gtkrc".text = '' + gtk-theme-name="Ant-Dracula" + gtk-icon-theme-name="Paper-Mono-Dark" + gtk-font-name="Sans 10" + ''; + # QT4/5 global theme + "Trolltech.conf".text = '' + [Qt] + style=Ant-Dracula + ''; + }) + (mkIf cfg.desktop.bspwm.enable { + "bspwm/rc.d/polybar".source = ./polybar/run.sh; + "bspwm/rc.d/theme".source = ./bspwmrc; + }) + (mkIf cfg.desktop.apps.rofi.enable { + "rofi/theme" = { source = ./rofi; recursive = true; }; + }) + (mkIf (cfg.desktop.bspwm.enable || cfg.desktop.stumpwm.enable) { + "polybar" = { source = ./polybar; recursive = true; }; + "dunst/dunstrc".source = ./dunstrc; + }) + (mkIf cfg.shell.tmux.enable { + "tmux/theme".source = ./tmux.conf; + }) + ]; + + xdg.dataFile = mkMerge [ + (mkIf cfg.desktop.browsers.qutebrowser.enable { + "qutebrowser/userstyles.css".source = + let compiledStyles = + with pkgs; runCommand "compileUserStyles" + { buildInputs = [ sass ]; } '' + mkdir "$out" + for file in ${./userstyles/qutebrowser}/*.scss; do + scss --sourcemap=none \ + --no-cache \ + --style compressed \ + --default-encoding utf-8 \ + "$file" \ + >>"$out/userstyles.css" + done + ''; + in "${compiledStyles}/userstyles.css"; + }) + ]; }; }; } diff --git a/modules/themes/fluorescence/firefox/userChrome.css b/modules/themes/fluorescence/firefox/userChrome.css new file mode 100644 index 00000000..dce8cd12 --- /dev/null +++ b/modules/themes/fluorescence/firefox/userChrome.css @@ -0,0 +1,100 @@ +@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); + +@-moz-document url(chrome://browser/content/browser.xul), + url(chrome://browser/content/browser.xhtml) +{ + /*** TAB BAR ***/ + /* Tabs below the address bar */ + #nav-bar { -moz-box-ordinal-group: 1 !important; } + #PersonalToolbar { -moz-box-ordinal-group: 2 !important; } + #titlebar { -moz-box-ordinal-group: 3 !important; } + + /* Tabs at bottom of window */ + /* #TabsToolbar { */ + /* transform: translateY(100vh) !important; */ + /* z-index: 999999 !important; */ + /* } */ + /* #navigator-toolbox { */ + /* margin-top: calc(0px - var(--tab-min-height)) !important; */ + /* } */ + /* #browser-panel { */ + /* padding-bottom: var(--tab-min-height) !important; */ + /* } */ + + /* :root:not([tabsintitlebar]) #TabsToolbar { -moz-box-ordinal-group: 0 !important; } */ + /* :root:not([tabsintitlebar]) #toolbar-menubar { -moz-box-ordinal-group: 1 !important; } */ + /* :root:not([tabsintitlebar]) #nav-bar { -moz-box-ordinal-group: 2 !important; } */ + /* :root:not([tabsintitlebar]) #PersonalToolbar { -moz-box-ordinal-group: 3 !important; } */ + /* :root:not([tabsintitlebar]) #navigator-toolbox::after { -moz-box-ordinal-group: 4 !important; } */ + + /* Hide tabbar if only one tab */ + @import url(./css/tabs-hide-if-only-one.css); + + /* Replace favicon on tabs with close button on hover */ + .tabbrowser-tab:not(:hover) .tab-close-button, + .tabbrowser-tab:not([pinned]):hover .tab-icon-image { display: none !important; } + .tabbrowser-tab:not([pinned]):hover .tab-close-button { display:block !important; } + + .tabbrowser-tab:hover .tab-throbber, + .tabbrowser-tab:hover .tab-icon-image, + .tabbrowser-tab:hover .tab-sharing-icon-overlay, + .tabbrowser-tab:hover .tab-icon-overlay, + .tabbrowser-tab:hover .tab-label-container, + .tabbrowser-tab:hover .tab-icon-sound { + -moz-box-ordinal-group: 2 !important; + } + + .tabbrowser-tab .tab-close-button { + margin-left: -2px !important; + margin-right: 4px !important; + } + + .tab-close-button:hover { + fill-opacity: 0 !important; + } + + .tabbrowser-tab::after, + .tabbrowser-tab::before { + border-left: none !important; + border-right: none !important; + } + + .scrollbutton-up[orient="horizontal"]~spacer { border-width: 0px; opacity: 0 } + + + /*** NAV BAR ***/ + /* Hide urlbar */ + #nav-bar { + position: relative !important; + z-index: 1 !important; + height: 2px !important; + min-height: 2px !important; + margin-bottom: -2px !important; + opacity: 0 !important; + overflow: hidden !important; + border: none !important; + } + + #nav-bar:hover { + height: auto !important; + margin-bottom: 0px !important; + opacity: 1 !important; + overflow: hidden !important; + } + + #nav-bar:focus-within { + height: auto !important; + margin-bottom: 0px !important; + opacity: 1 !important; + overflow: show !important; + } + + #content-deck{ + position: relative !important; + z-index: 0 !important; + } + + + /*** Load local overrides ***/ + @import url(./userChrome.local.css); +}