From 0a6aa76587d1cb38d2626036b693bedebcd0943d Mon Sep 17 00:00:00 2001
From: Matei Adriel <rafaeladriel11@gmail.com>
Date: Wed, 15 Nov 2023 17:43:12 +0100
Subject: [PATCH] Configure firefox further

---
 dotfiles/neovim/lua/my/neovide.lua           |  8 +--
 home/features/desktop/firefox/default.nix    | 73 ++++++++++++++++++--
 home/features/desktop/wezterm/wezterm.lua    |  2 +-
 home/features/wayland/hyprland/hyprland.conf |  4 +-
 4 files changed, 73 insertions(+), 14 deletions(-)

diff --git a/dotfiles/neovim/lua/my/neovide.lua b/dotfiles/neovim/lua/my/neovide.lua
index 7f286d4..b560dd3 100644
--- a/dotfiles/neovim/lua/my/neovide.lua
+++ b/dotfiles/neovim/lua/my/neovide.lua
@@ -2,11 +2,11 @@ local M = {}
 
 function M.setup()
   local default_length = 0.04
-  vim.g.neovide_floating_blur_amount_x = 10.0
-  vim.g.neovide_floating_blur_amount_y = 10.0
-  vim.g.neovide_transparency = 0.6
+  -- vim.g.neovide_floating_blur_amount_x = 10.0
+  -- vim.g.neovide_floating_blur_amount_y = 10.0
+  vim.g.neovide_transparency = 0.5
   -- vim.g.transparency = 0.6
-  vim.g.pumblend = 100
+  -- vim.g.pumblend = 0
   vim.g.neovide_cursor_animation_length = default_length
   vim.g.neovide_cursor_animate_in_insert_mode = false
 end
diff --git a/home/features/desktop/firefox/default.nix b/home/features/desktop/firefox/default.nix
index d167b61..48f536d 100644
--- a/home/features/desktop/firefox/default.nix
+++ b/home/features/desktop/firefox/default.nix
@@ -179,7 +179,7 @@ in
         # Required for figma to be able to export to svg
         "dom.events.asyncClipboard.clipboardItem" = true;
 
-        # Customize css
+        # Allow custom css
         "toolkit.legacyUserProfileCustomizations.stylesheets" = true;
 
         # Set language to english
@@ -188,12 +188,71 @@ in
         # Do not restore sessions after what looks like a "crash"
         "browser.sessionstore.resume_from_crash" = false;
 
-        # Tell firefox to make multiple requests at once
-        # See [this random page](https://doorsanchar.com/how-to-make-mozilla-firefox-30-times-faster/)
-        # "network.http.pipelining" = true;
-        # "network.http.proxy.pipelining" = true;
-        # "network.http.pipelining.maxrequests" = 30; # Allow 30 requests at once
-        # "nglayout.initialpaint.delay" = 0;
+        # Inspired by https://github.com/TLATER/dotfiles/blob/b39af91fbd13d338559a05d69f56c5a97f8c905d/home-config/config/graphical-applications/firefox.nix
+        # {{{ Performance settings
+        "gfx.webrender.all" = true; # Force enable GPU acceleration
+        "media.ffmpeg.vaapi.enabled" = true;
+        "widget.dmabuf.force-enabled" = true; # Required in recent Firefoxes
+        # }}}
+        # {{{ New tab page 
+        "browser.newtabpage.activity-stream.asrouter.userprefs.cfr.addons" =
+          false;
+        "browser.newtabpage.activity-stream.asrouter.userprefs.cfr.features" =
+          false;
+        "browser.newtabpage.activity-stream.feeds.snippets" = false;
+        "browser.newtabpage.activity-stream.improvesearch.topSiteSearchShortcuts.havePinned" = "";
+        "browser.newtabpage.activity-stream.improvesearch.topSiteSearchShortcuts.searchEngines" = "";
+        "browser.newtabpage.activity-stream.section.highlights.includePocket" =
+          false;
+        "browser.newtabpage.activity-stream.showSponsored" = false;
+        "browser.newtabpage.activity-stream.showSponsoredTopSites" = false;
+        "browser.newtabpage.pinned" = false;
+        # }}}
+        # {{{ Privacy
+        "browser.contentblocking.category" = "strict";
+        "app.shield.optoutstudies.enabled" = false;
+        "dom.security.https_only_mode" = true;
+        "dom.security.https_only_mode_ever_enabled" = true;
+        "datareporting.policy.dataSubmissionEnable" = false;
+        "datareporting.policy.dataSubmissionPolicyAcceptedVersion" = 2;
+        "privacy.trackingprotection.enabled" = true;
+        "privacy.trackingprotection.socialtracking.enabled" = true;
+        "browser.discovery.enabled" = false;
+        # }}}
+
+        # Keep the reader button enabled at all times; really don't
+        # care if it doesn't work 20% of the time, most websites are
+        # crap and unreadable without this
+        "reader.parse-on-load.force-enabled" = true;
+
+        # Hide the "sharing indicator", it's especially annoying
+        # with tiling WMs on wayland
+        "privacy.webrtc.legacyGlobalIndicator" = false;
+
+        # Disable auto update checks
+        "app.update.auto" = false;
+
+        # Do not include "switch to [tab]" in search results
+        "browser.urlbar.suggest.openpage" = false;
+
+        # Hide random popup: https://forums.linuxmint.com/viewtopic.php?t=379164
+        "browser.protections_panel.infoMessage.seen" = true;
+
+        # Disable shortcut for quitting :)
+        "browser.quitShortcut.disabled" = true;
+
+        # Do not show dialog for getting panes in the addons menu (?)
+        # http://kb.mozillazine.org/Extensions.getAddons.showPane
+        "extensions.getAddons.showPane" = false;
+
+        # Do not recommend addons
+        "extensions.htmlaboutaddons.recommendations.enabled" = false;
+
+        # Link saving thingy (?)
+        "extensions.pocket.enabled" = false;
+
+        # Disable firefox accounts (?)
+        "identity.fxaccounts.enabled" = false;
       };
       # }}}
     };
diff --git a/home/features/desktop/wezterm/wezterm.lua b/home/features/desktop/wezterm/wezterm.lua
index 04d95a6..a8a1a87 100644
--- a/home/features/desktop/wezterm/wezterm.lua
+++ b/home/features/desktop/wezterm/wezterm.lua
@@ -52,7 +52,7 @@ config.colors.tab_bar = {
 }
 -- }}}
 -- {{{ Other visual things
-config.window_background_opacity = 0.6 -- TODO: load from nix!
+config.window_background_opacity = colorscheme.transparency.value
 -- }}}
 -- }}}
 -- {{{ Main config options
diff --git a/home/features/wayland/hyprland/hyprland.conf b/home/features/wayland/hyprland/hyprland.conf
index 0550cce..df26446 100644
--- a/home/features/wayland/hyprland/hyprland.conf
+++ b/home/features/wayland/hyprland/hyprland.conf
@@ -104,8 +104,8 @@ bind = $mod CONTROL, S, exec, grimblast --notify copysave screen
 # }}}
 # {{{ Grouping
 bind = $mod, G, togglegroup,
-bind = $mod SHIFT, D, changegroupactive, f
-bind = $mod SHIFT, S, changegroupactive, b
+bind = $mod SHIFT, L, changegroupactive, f
+bind = $mod SHIFT, H, changegroupactive, b
 # }}}
 # {{{ Mouse move/resize
 # Move/resize windows with mod + LMB/RMB and dragging