fix up firefox to be more declarative

This commit is contained in:
Anish Lakhwara 2022-09-21 01:32:23 +10:00
parent ada5e5ad6a
commit 96c329918d
4 changed files with 435 additions and 137 deletions

View file

@ -31,11 +31,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1657514455, "lastModified": 1663665682,
"narHash": "sha256-rYrofeCRgZyiZMuuwbwbM7ZLNTj04S0l4G/1ZeH0gqI=", "narHash": "sha256-YB+vmQB3N9RyeshHAO4GjIFebA7NPY2jlkdvGGZtM64=",
"ref": "main", "ref": "main",
"rev": "50f7ee786d9704ecfd67a9fe2eb8f338fc983dc1", "rev": "36bda6965ab2e1a206f8c2b7a74f3b022c873662",
"revCount": 64, "revCount": 65,
"type": "git", "type": "git",
"url": "ssh://gitea@git.sealight.xyz/aynish/basant" "url": "ssh://gitea@git.sealight.xyz/aynish/basant"
}, },
@ -663,33 +663,19 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_5": {
"locked": {
"lastModified": 1663489134,
"narHash": "sha256-YqM45LLzvgBNbvIK0QQa8cY8omKS0+bRUg4JWzEj14w=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "830e228898ac7a66eeafb169dd3df0dc427674d4",
"type": "github"
},
"original": {
"owner": "nixos",
"repo": "nixpkgs",
"type": "github"
}
},
"nur": { "nur": {
"locked": { "locked": {
"lastModified": 1663393873, "lastModified": 1663680695,
"narHash": "sha256-DtumXhmyA9gpu0+qa5fwvU93qKqtx0AtUFvfazPzz1Y=", "narHash": "sha256-sVdmg21MzIS0e+mCyIEInivIodJNYKVicZ3WJr907XI=",
"owner": "nix-community", "owner": "nix-community",
"repo": "NUR", "repo": "NUR",
"rev": "ecf7442437f53f0f689df6897c10a7f9a4f6b9ae", "rev": "a22f443201174496ce6edb237a2e9596591cd542",
"type": "github" "type": "github"
}, },
"original": { "original": {
"id": "nur", "owner": "nix-community",
"type": "indirect" "repo": "NUR",
"type": "github"
} }
}, },
"nvfetcher": { "nvfetcher": {
@ -885,7 +871,10 @@
}, },
"vimwiki-cli": { "vimwiki-cli": {
"inputs": { "inputs": {
"nixpkgs": "nixpkgs_5" "nixpkgs": [
"poonam",
"nixpkgs"
]
}, },
"locked": { "locked": {
"lastModified": 1662448409, "lastModified": 1662448409,

View file

@ -20,6 +20,7 @@
nvfetcher.inputs.nixpkgs.follows = "nixos"; nvfetcher.inputs.nixpkgs.follows = "nixos";
naersk.url = "github:nmattia/naersk"; naersk.url = "github:nmattia/naersk";
naersk.inputs.nixpkgs.follows = "nixos"; naersk.inputs.nixpkgs.follows = "nixos";
nur.url = "github:nix-community/NUR";
# Tools # Tools
agenix.url = "github:ryantm/agenix"; agenix.url = "github:ryantm/agenix";
agenix.inputs.nixpkgs.follows = "nixos"; agenix.inputs.nixpkgs.follows = "nixos";
@ -147,7 +148,7 @@
}; };
suites = with profiles; rec { suites = with profiles; rec {
base = [ core users.root users.anish ]; base = [ core users.root users.anish ];
sealight = [ base server metrics gitea sealight-website backup rss-bridge mount-mossnet matrix ]; # sealight = [ base server metrics gitea sealight-website backup rss-bridge mount-mossnet ]; # matrix
mossnet = [ base server taskd shaarli dns monitoring nfs rss-bridge gonic headphones radicale seafile syncthing dhyan calibre wallabag ]; # hpi sync.music mossnet = [ base server taskd shaarli dns monitoring nfs rss-bridge gonic headphones radicale seafile syncthing dhyan calibre wallabag ]; # hpi sync.music
cube = [ base site server ]; cube = [ base site server ];
graphical = [ base bluetooth music sync.kitaab sync.website sync.cal wifi desktop mimetypes ]; graphical = [ base bluetooth music sync.kitaab sync.website sync.cal wifi desktop mimetypes ];

View file

@ -1,120 +1,150 @@
{ pkgs, ... }: { pkgs, ... }:
{ {
# Imperative steps:
# - Enable & configure plugins
# - Run :colourscheme --url https://raw.githubusercontent.com/lonepie/dracula-tridactyl/main/dracula.css dracula for tridactyl theme
# - Import css for tree style tabs from treestyletabs.css
programs.browserpass.enable = true; programs.browserpass.enable = true;
programs.browserpass.browsers = [ "firefox" ]; programs.browserpass.browsers = [ "firefox" ];
#env.XDG_DEXSTOP_DIR = "$HOME/"; #env.XDG_DEXSTOP_DIR = "$HOME/";
programs.firefox.profiles.anish.userChrome = (builtins.readFile ./userChrome.css); programs.firefox = {
programs.firefox.profiles.anish.settings = { enable = true;
"devtools.theme" = "dark"; extensions = with pkgs.nur.repos.rycee.firefox-addons; [
# Enable userContent.css and userChrome.css for our theme modules ublock-origin
"toolkit.legacyUserProfileCustomizations.stylesheets" = true; wallabagger
# Stop creating ~/Downloads! tree-style-tab
"browser.download.dir" = "/home/anish/downloads"; # TODO Don't hardcode this! tridactyl
# Don't use the built-in password manager; a nixos user is more likely promnesia
# using an external one (you are using one, right?). (buildFirefoxXpiAddon {
#"signon.rememberSignons" = false; pname = "shaarli";
# Do not check if Firefox is the default browser version = "2.0.0";
"browser.shell.checkDefaultBrowser" = false; addonId = "{f59a7028-b71f-490d-844e-f781a11ffbc7}";
# Disable the "new tab page" feature and show a blank tab instead url = "https://addons.mozilla.org/firefox/downloads/file/815126/shaarli-2.0.0.xpi";
# https://wiki.mozilla.org/Privacy/Reviews/New_Tab sha256 = "W/OpvOfMclibP6LeG573/DlMs0p8fF0efyd+i8Sudgg=";
# https://support.mozilla.org/en-US/kb/new-tab-page-show-hide-and-customize-top-sites#w_how-do-i-turn-the-new-tab-page-off meta = { };
"browser.newtabpage.enabled" = false; })
"browser.newtab.url" = "about:blank"; (buildFirefoxXpiAddon {
# Disable Activity Stream pname = "grasp";
# https://wiki.mozilla.org/Firefox/Activity_Stream version = "0.6.6";
"browser.newtabpage.activity-stream.enabled" = false; addonId = "{37e42980-a7c9-473c-96d5-13f18e0efc74}";
# Disable new tab tile ads & preload url = "https://addons.mozilla.org/firefox/downloads/file/3502186/grasp-0.6.6.xpi";
# http://www.thewindowsclub.com/disable-remove-ad-tiles-from-firefox sha256 = "L4JhT29MeA34nHIlB8FtCU7hrpbWljZZBusx12uxblE=";
# http://forums.mozillazine.org/viewtopic.php?p=13876331#p13876331 meta = { };
# https://wiki.mozilla.org/Tiles/Technical_Documentation#Ping })
# https://gecko.readthedocs.org/en/latest/browser/browser/DirectoryLinksProvider.html#browser-newtabpage-directory-source ];
# https://gecko.readthedocs.org/en/latest/browser/browser/DirectoryLinksProvider.html#browser-newtabpage-directory-ping profiles.anish = {
"browser.newtabpage.enhanced" = false; id = 0;
"browser.newtab.preload" = false; isDefault = true;
"browser.newtabpage.directory.ping" = ""; name = "anish";
"browser.newtabpage.directory.source" = "data:text/plain,{}"; userChrome = (builtins.readFile ./userChrome.css);
# Disable some not so useful functionality. settings = {
"media.videocontrols.picture-in-picture.video-toggle.enabled" = false; "devtools.theme" = "dark";
"extensions.htmlaboutaddons.recommendations.enabled" = false; # Enable userContent.css and userChrome.css for our theme modules
"extensions.htmlaboutaddons.discover.enabled" = false; "toolkit.legacyUserProfileCustomizations.stylesheets" = true;
"extensions.pocket.enabled" = false; # Stop creating ~/Downloads!
"app.normandy.enabled" = false; "browser.download.dir" = "/home/anish/downloads"; # TODO Don't hardcode this!
"app.normandy.api_url" = ""; # Don't use the built-in password manager; a nixos user is more likely
"extensions.shield-recipe-client.enabled" = false; # using an external one (you are using one, right?).
"app.shield.optoutstudies.enabled" = false; #"signon.rememberSignons" = false;
# Disable battery API # Do not check if Firefox is the default browser
# https://developer.mozilla.org/en-US/docs/Web/API/BatteryManager "browser.shell.checkDefaultBrowser" = false;
# https://bugzilla.mozilla.org/show_bug.cgi?id=1313580 # Disable the "new tab page" feature and show a blank tab instead
"dom.battery.enabled" = false; # https://wiki.mozilla.org/Privacy/Reviews/New_Tab
# Disable "beacon" asynchronous HTTP transfers (used for analytics) # https://support.mozilla.org/en-US/kb/new-tab-page-show-hide-and-customize-top-sites#w_how-do-i-turn-the-new-tab-page-off
# https://developer.mozilla.org/en-US/docs/Web/API/navigator.sendBeacon "browser.newtabpage.enabled" = false;
"beacon.enabled" = false; "browser.newtab.url" = "about:blank";
# Disable pinging URIs specified in HTML <a> ping= attributes # Disable Activity Stream
# http://kb.mozillazine.org/Browser.send_pings # https://wiki.mozilla.org/Firefox/Activity_Stream
"browser.send_pings" = false; "browser.newtabpage.activity-stream.enabled" = false;
# Disable gamepad API to prevent USB device enumeration # Disable new tab tile ads & preload
# https://www.w3.org/TR/gamepad/ # http://www.thewindowsclub.com/disable-remove-ad-tiles-from-firefox
# https://trac.torproject.org/projects/tor/ticket/13023 # http://forums.mozillazine.org/viewtopic.php?p=13876331#p13876331
"dom.gamepad.enabled" = false; # https://wiki.mozilla.org/Tiles/Technical_Documentation#Ping
# Don't try to guess domain names when entering an invalid domain name in URL bar # https://gecko.readthedocs.org/en/latest/browser/browser/DirectoryLinksProvider.html#browser-newtabpage-directory-source
# http://www-archive.mozilla.org/docs/end-user/domain-guessing.html # https://gecko.readthedocs.org/en/latest/browser/browser/DirectoryLinksProvider.html#browser-newtabpage-directory-ping
"browser.fixup.alternate.enabled" = false; "browser.newtabpage.enhanced" = false;
# Disable telemetry "browser.newtab.preload" = false;
# https://wiki.mozilla.org/Platform/Features/Telemetry "browser.newtabpage.directory.ping" = "";
# https://wiki.mozilla.org/Privacy/Reviews/Telemetry "browser.newtabpage.directory.source" = "data:text/plain,{}";
# https://wiki.mozilla.org/Telemetry # Disable some not so useful functionality.
# https://www.mozilla.org/en-US/legal/privacy/firefox.html#telemetry "media.videocontrols.picture-in-picture.video-toggle.enabled" = false;
# https://support.mozilla.org/t5/Firefox-crashes/Mozilla-Crash-Reporter/ta-p/1715 "extensions.htmlaboutaddons.recommendations.enabled" = false;
# https://wiki.mozilla.org/Security/Reviews/Firefox6/ReviewNotes/telemetry "extensions.htmlaboutaddons.discover.enabled" = false;
# https://gecko.readthedocs.io/en/latest/browser/experiments/experiments/manifest.html "extensions.pocket.enabled" = false;
# https://wiki.mozilla.org/Telemetry/Experiments "browser.newtabpage.activity-stream.section.highlights.includePocket" = false;
# https://support.mozilla.org/en-US/questions/1197144 "extensions.pocket.api" = "";
# https://firefox-source-docs.mozilla.org/toolkit/components/telemetry/telemetry/internals/preferences.html#id1 "extensions.pocket.oAuthConsumerKey" = "";
"toolkit.telemetry.enabled" = false; "extensions.pocket.showHome" = false;
"toolkit.telemetry.unified" = false; "extensions.pocket.site" = "";
"toolkit.telemetry.archive.enabled" = false; "app.normandy.enabled" = false;
"experiments.supported" = false; "app.normandy.api_url" = "";
"experiments.enabled" = false; "extensions.shield-recipe-client.enabled" = false;
"experiments.manifest.uri" = ""; "app.shield.optoutstudies.enabled" = false;
# Disable health reports (basically more telemetry) # Disable battery API
# https://support.mozilla.org/en-US/kb/firefox-health-report-understand-your-browser-perf # https://developer.mozilla.org/en-US/docs/Web/API/BatteryManager
# https://gecko.readthedocs.org/en/latest/toolkit/components/telemetry/telemetry/preferences.html # https://bugzilla.mozilla.org/show_bug.cgi?id=1313580
"datareporting.healthreport.uploadEnabled" = false; "dom.battery.enabled" = false;
"datareporting.healthreport.service.enabled" = false; # Disable "beacon" asynchronous HTTP transfers (used for analytics)
"datareporting.policy.dataSubmissionEnabled" = false; # https://developer.mozilla.org/en-US/docs/Web/API/navigator.sendBeacon
# Pipewire optimizations "beacon.enabled" = false;
# https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/Performance-tuning#firefox # Disable pinging URIs specified in HTML <a> ping= attributes
"reader.parse-on-load.enabled" = false; # http://kb.mozillazine.org/Browser.send_pings
"media.webspeech.synth.enabled" = false; "browser.send_pings" = false;
}; # Disable gamepad API to prevent USB device enumeration
# https://www.w3.org/TR/gamepad/
# https://trac.torproject.org/projects/tor/ticket/13023
"dom.gamepad.enabled" = false;
# Don't try to guess domain names when entering an invalid domain name in URL bar
# http://www-archive.mozilla.org/docs/end-user/domain-guessing.html
"browser.fixup.alternate.enabled" = false;
# Disable telemetry
# https://wiki.mozilla.org/Platform/Features/Telemetry
# https://wiki.mozilla.org/Privacy/Reviews/Telemetry
# https://wiki.mozilla.org/Telemetry
# https://www.mozilla.org/en-US/legal/privacy/firefox.html#telemetry
# https://support.mozilla.org/t5/Firefox-crashes/Mozilla-Crash-Reporter/ta-p/1715
# https://wiki.mozilla.org/Security/Reviews/Firefox6/ReviewNotes/telemetry
# https://gecko.readthedocs.io/en/latest/browser/experiments/experiments/manifest.html
# https://wiki.mozilla.org/Telemetry/Experiments
# https://support.mozilla.org/en-US/questions/1197144
# https://firefox-source-docs.mozilla.org/toolkit/components/telemetry/telemetry/internals/preferences.html#id1
"toolkit.telemetry.enabled" = false;
"toolkit.telemetry.unified" = false;
"toolkit.telemetry.archive.enabled" = false;
"experiments.supported" = false;
"experiments.enabled" = false;
"experiments.manifest.uri" = "";
"privacy.donottrackheader.enabled" = true;
"privacy.trackingprotection.enabled" = true;
"privacy.trackingprotection.socialtracking.enabled" = true;
"privacy.partition.network_state.ocsp_cache" = true;
# Disable health reports (basically more telemetry)
# https://support.mozilla.org/en-US/kb/firefox-health-report-understand-your-browser-perf
# https://gecko.readthedocs.org/en/latest/toolkit/components/telemetry/telemetry/preferences.html
"browser.newtabpage.activity-stream.feeds.telemetry" = false;
"browser.newtabpage.activity-stream.telemetry" = false;
"browser.ping-centre.telemetry" = false;
"toolkit.telemetry.bhrPing.enabled" = false;
"toolkit.telemetry.firstShutdownPing.enabled" = false;
"toolkit.telemetry.hybridContent.enabled" = false;
"toolkit.telemetry.newProfilePing.enabled" = false;
"toolkit.telemetry.reportingpolicy.firstRun" = false;
"toolkit.telemetry.shutdownPingSender.enabled" = false;
"toolkit.telemetry.updatePing.enabled" = false;
# Override? # As well as Firefox 'experiments'
home.packages = with pkgs; [ "experiments.activeExperiment" = false;
firefox-bin "network.allow-experiments" = false;
# TODO something changed in 22.05, needs to be a list? "datareporting.healthreport.uploadEnabled" = false;
# (makeDesktopItem { "datareporting.healthreport.service.enabled" = false;
# name = "firefox-private"; "datareporting.policy.dataSubmissionEnabled" = false;
# desktopName = "Firefox (Private)"; # Pipewire optimizations
# genericName = "Open a private Firefox window"; # https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/Performance-tuning#firefox
# icon = "firefox"; "reader.parse-on-load.enabled" = false;
# exec = "${firefox-bin}/bin/firefox --private-window"; "media.webspeech.synth.enabled" = false;
# categories = "Network"; };
# })
];
home.file = let cfgPath = ".mozilla/firefox"; in
{
"${cfgPath}/profiles.ini".text = ''
[Profile0]
Name=default
IsRelative=1
Path=anish.default
Default=1
[General]
StartWithLastProfile=1
Version=2
'';
"${cfgPath}/anish.default/chrome/userChrome.css".source = ./userChrome.css;
}; };
};
} }

View file

@ -0,0 +1,278 @@
:root{
--dark-0: #1A1E28;
--dark-base: #1F2430;
--dark-1: #2A3141;
--dark-2: #323A4E;
--dark-3: #424D67;
--dark-4: #4A5673;
--light-0: #E8E7E3;
--light-base: #CCCAC2;
--light-1: #C3C0B7;
--light-2: #B9B7AC;
--light-3: #B0ADA0;
--light-4: #A7A395;
--accent: #FFCC66;
--yellow: #695380;
--green: #D5FF80;
--red: #f28779;
--extension-icon-mask: grayscale(85%) invert(30%) sepia(13%) saturate(1019%) hue-rotate(184deg) brightness(95%) contrast(96%);
}
:root.incognito{
--dark-0: #1C0E34;
--dark-base: #20103c;
--dark-1: #2F1D4E;
--dark-2: #38225D;
--dark-3: #4A2D7B;
--dark-4: #53338A;
--light-0: #CC6B9C;
--light-base: #B9407C;
--light-1: #AB3B73;
--light-2: #9C3569;
--light-3: #8D305E;
--light-4: #7D2B54;
--accent: #e9207e;
--yellow: #C9B336;
--green: #36C987;
--red: #C9365D;
--extension-icon-mask: grayscale(85%) invert(17%) sepia(33%) saturate(3632%) hue-rotate(245deg) brightness(92%) contrast(90%);
}
:root{
--tab-border-radius: 7px; /* border radius of tabs */
--animation-duration: 200ms; /* duration of different animations [0s: turn all animations off] */
--spacing: 14px; /* spacing between tabs. [<15px: compact tabs] */
--distance-from-edge: 10px; /* distance between tabs, and left-right edges of sidebar*/
--hover-text-spacing: 0.1; /* should be left alone. with hover sidebar, if text is visible in collapsed status, increase this */
--ease-in: cubic-bezier(0.32, 0, 0.67, 0);
--ease-out: cubic-bezier(0.22, 1, 0.36, 1);
--ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
--collapsed-width: 60px;
}
/************UNCUSTOMIZED CSS************/
#tabbar-container #tabbar{
margin-bottom: 15px !important;
}
:root, #background{
background: var(--dark-base) !important;
}
#all-tabs{
margin: 10px var(--distance-from-edge);
}
tab-item:not(.collapsed) {
margin-top: var(--spacing);
border-radius: var(--tab-border-radius);
border: none !important;
padding-top: 9px;
padding-bottom: 10px;
}
tab-item.collapsed{
height: 0;
margin: 0 !important;
padding: 0 !important;
}
tab-item:not([data-level="0"]):not(.pinned){
border-left: dashed 2px var(--light-4) !important;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
margin-top: calc(var(--spacing)/2);
}
tab-item tab-favicon{
left: 0;
filter: var(--extension-icon-mask);
transition: left calc(var(--animation-duration)*2) var(--ease-out);
}
.highlighter {
display: none !important;
}
tab-item .label {
color: var(--light-2) !important;
padding-bottom: 2px;
}
tab-item .twisty:before{
background: var(--light-3) !important;
}
tab-item.active .label {
color: var(--light-0) !important;
}
tab-item.active {
background: var(--dark-3) !important;
}
tab-item:not(.active).highlighted{
background: var(--dark-1) !important;
}
tab-item:not(active):hover {
background: var(--dark-1);
}
tab-item:hover tab-closebox {
right: 10px;
opacity: 1;
}
tab-item:not(pinned) tab-closebox {
position: absolute;
margin-top: 2px;
height: 20px;
width: 20px;
right: -30px;
border-radius: 50%;
padding-top: 2px;
padding-left: 2px;
background: var(--light-4);
transition : all var(--animation-duration) var(--ease-out);
}
.sound-button:after {
background: var(--light-3) !important;
margin-top: 2px;
}
.counter{
color: var(--light-4) !important;
background: var(--dark-2) !important;
border-radius: 7px;
margin: 2px 2px 0px 0px;
padding: 0 4px;
padding-bottom: 2px;
order: -2 !important;
}
.counter:before, .counter:after{ content: ""}
/********LEFT CONTENT TAB(static)*************/
:root.left tab-item{
padding-left: 0;
}
:root.left tab-item tab-favicon {
transform: scale(120%);
margin-right: 5px;
left: 80%;
}
:root.left tab-item .label {
transform: translateX(10px);
right: 28%;
}
:root.left tab-item[data-child-ids] .twisty{
margin-right: 5px;
}
/********RIGHT CONTENT TAB(hover)*************/
:root.right tab-item .label {
margin-left: 10px;
margin-right: calc(var(--collapsed-width)*0.3) !important;
}
:root.right tab-item:not(pinned):hover tab-closebox{
right: calc(var(--collapsed-width)*0.3);
}
:root.right tab-item:not([data-level="0"]):not(.pinned){
border: none !important;
border-right: dashed 2px var(--light-4) !important;
border-radius: var(--tab-border-radius);
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
:root.right tab-item.active:not([data-level="0"]):not(.pinned){
margin-right: 5px !important;
}
:root.right .sound-button{
order: -1 !important;
}
:root.right tab-item.active.pinned {
position: relative;
left: 190px !important;
}
:root.right tab-item.active.pinned tab-favicon {
transform: scale(130%) !important;
margin-left: 7px;
}
/***********************************/
.tab
.favicon
.favicon-default::before {
filter: var(--extension-icon-mask); // change for light theme
}
.tab[data-current-favicon-uri="undefined"]
.favicon
.favicon-default::before{
background: url("chrome://branding/content/identity-icons-brand.svg") no-repeat center !important;
mask: none !important;
}
/***********NEW TAB BUTTON**********/
.newtab-button-box {
border: none !important;
margin: 0 50px;
}
.newtab-button {
border: none !important;
border-radius: 8px;
padding: 8px 0 !important;
margin: 0 5px;
}
.newtab-button::before{
background: var(--light-3) !important;
}
.newtab-action-selector-anchor {
border: none !important;
margin-right: 10px;
margin-top: 3px;
}
.newtab-button:hover {
background: var(--dark-1);
}
/**********PINNED TAB***************/
tab-item.pinned {
margin: 5px !important;
padding: 5px !important;
transition : all 0.1s var(--ease-out);
}
/***********************************/
#all-tabs {
border: none !important;
}