qutebrowser: remove config, not used anymore
This commit is contained in:
		
							parent
							
								
									bf7bf80c93
								
							
						
					
					
						commit
						8d47083127
					
				
					 8 changed files with 1 additions and 10848 deletions
				
			
		| 
						 | 
				
			
			@ -19,7 +19,6 @@
 | 
			
		|||
    ./alacritty.nix
 | 
			
		||||
    ./git.nix
 | 
			
		||||
    ./ssh.nix
 | 
			
		||||
    ./qutebrowser
 | 
			
		||||
    ./gpg.nix
 | 
			
		||||
    ./rofi.nix
 | 
			
		||||
    ./mpv.nix
 | 
			
		||||
| 
						 | 
				
			
			@ -157,13 +156,7 @@
 | 
			
		|||
    text-editor = lib.mkDefault "kak.desktop";
 | 
			
		||||
    image-viewer = lib.mkDefault "pqiv.desktop";
 | 
			
		||||
    video-player = lib.mkDefault "mpv.desktop";
 | 
			
		||||
    web-browser = lib.mkDefault (
 | 
			
		||||
      {
 | 
			
		||||
        firefox = lib.mkDefault "firefox.desktop";
 | 
			
		||||
        qutebrowser = lib.mkDefault "org.qutebrowser.qutebrowser.desktop";
 | 
			
		||||
      }
 | 
			
		||||
      .${pkgs.uservars.browser}
 | 
			
		||||
    );
 | 
			
		||||
    web-browser = lib.mkDefault "firefox.desktop";
 | 
			
		||||
    document-viewer = lib.mkDefault "org.pwmt.zathura.desktop";
 | 
			
		||||
    file-manager = lib.mkDefault "thunar.desktop";
 | 
			
		||||
    archive-manager = "engrampa.desktop";
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,261 +0,0 @@
 | 
			
		|||
{
 | 
			
		||||
  config,
 | 
			
		||||
  pkgs,
 | 
			
		||||
  lib,
 | 
			
		||||
  font,
 | 
			
		||||
  ...
 | 
			
		||||
}:
 | 
			
		||||
let
 | 
			
		||||
  inherit (pkgs.uservars)
 | 
			
		||||
    key
 | 
			
		||||
    theme
 | 
			
		||||
    accent
 | 
			
		||||
    font
 | 
			
		||||
    browser
 | 
			
		||||
    ;
 | 
			
		||||
  inherit (theme) color;
 | 
			
		||||
in
 | 
			
		||||
{
 | 
			
		||||
  programs.qutebrowser.settings = {
 | 
			
		||||
    hints.border = "2px solid ${accent.color}";
 | 
			
		||||
 | 
			
		||||
    content.user_stylesheets = "style.css";
 | 
			
		||||
    colors = {
 | 
			
		||||
 | 
			
		||||
      ########################################################
 | 
			
		||||
      # Tabs
 | 
			
		||||
      ########################################################
 | 
			
		||||
 | 
			
		||||
      tabs =
 | 
			
		||||
        let
 | 
			
		||||
          tabs_defaults = {
 | 
			
		||||
            odd = {
 | 
			
		||||
              fg = color.txt;
 | 
			
		||||
              bg = color.bg;
 | 
			
		||||
            };
 | 
			
		||||
            even = {
 | 
			
		||||
              fg = color.txt;
 | 
			
		||||
              bg = color.bg_dark;
 | 
			
		||||
            };
 | 
			
		||||
            selected = {
 | 
			
		||||
              odd = {
 | 
			
		||||
                fg = accent.fg;
 | 
			
		||||
                bg = accent.color;
 | 
			
		||||
              };
 | 
			
		||||
              even = {
 | 
			
		||||
                fg = accent.fg;
 | 
			
		||||
                bg = accent.color;
 | 
			
		||||
              };
 | 
			
		||||
            };
 | 
			
		||||
          };
 | 
			
		||||
        in
 | 
			
		||||
        {
 | 
			
		||||
          bar = {
 | 
			
		||||
            bg = color.bg;
 | 
			
		||||
          };
 | 
			
		||||
          pinned = tabs_defaults;
 | 
			
		||||
        }
 | 
			
		||||
        // tabs_defaults;
 | 
			
		||||
 | 
			
		||||
      ########################################################
 | 
			
		||||
      # Completion for urls and commands
 | 
			
		||||
      ########################################################
 | 
			
		||||
 | 
			
		||||
      completion = {
 | 
			
		||||
        fg = color.txt;
 | 
			
		||||
        even = {
 | 
			
		||||
          bg = color.bg;
 | 
			
		||||
        };
 | 
			
		||||
        odd = {
 | 
			
		||||
          bg = color.bg;
 | 
			
		||||
        };
 | 
			
		||||
        scrollbar = {
 | 
			
		||||
          bg = color.bg_dark;
 | 
			
		||||
        };
 | 
			
		||||
        match = {
 | 
			
		||||
          fg = accent.color;
 | 
			
		||||
        };
 | 
			
		||||
        category = {
 | 
			
		||||
          fg = color.txt;
 | 
			
		||||
          bg = color.bg_dark;
 | 
			
		||||
          border = {
 | 
			
		||||
            top = color.bg_dark;
 | 
			
		||||
            bottom = color.bg_dark;
 | 
			
		||||
          };
 | 
			
		||||
        };
 | 
			
		||||
        item = {
 | 
			
		||||
          selected = {
 | 
			
		||||
            fg = accent.fg;
 | 
			
		||||
            bg = accent.color;
 | 
			
		||||
            border = {
 | 
			
		||||
              top = color.bg_dark;
 | 
			
		||||
              bottom = color.bg_dark;
 | 
			
		||||
            };
 | 
			
		||||
            match = {
 | 
			
		||||
              fg = color.txt;
 | 
			
		||||
            };
 | 
			
		||||
          };
 | 
			
		||||
        };
 | 
			
		||||
      };
 | 
			
		||||
 | 
			
		||||
      ########################################################
 | 
			
		||||
      # Statusbar
 | 
			
		||||
      ########################################################
 | 
			
		||||
 | 
			
		||||
      statusbar = {
 | 
			
		||||
        normal = {
 | 
			
		||||
          fg = color.txt;
 | 
			
		||||
          bg = color.bg;
 | 
			
		||||
        };
 | 
			
		||||
        insert = {
 | 
			
		||||
          fg = color.normal.green;
 | 
			
		||||
          bg = color.bg;
 | 
			
		||||
        };
 | 
			
		||||
        passthrough = {
 | 
			
		||||
          fg = color.normal.blue;
 | 
			
		||||
          bg = color.bg;
 | 
			
		||||
        };
 | 
			
		||||
        command = {
 | 
			
		||||
          fg = color.txt;
 | 
			
		||||
          bg = color.bg;
 | 
			
		||||
        };
 | 
			
		||||
        caret = {
 | 
			
		||||
          selection = {
 | 
			
		||||
            fg = accent.fg;
 | 
			
		||||
            bg = accent.color;
 | 
			
		||||
          };
 | 
			
		||||
        };
 | 
			
		||||
        url = {
 | 
			
		||||
          success = {
 | 
			
		||||
            https = {
 | 
			
		||||
              fg = color.txt;
 | 
			
		||||
            };
 | 
			
		||||
            http = {
 | 
			
		||||
              fg = color.normal.red;
 | 
			
		||||
            };
 | 
			
		||||
          };
 | 
			
		||||
          hover = {
 | 
			
		||||
            fg = color.normal.cyan;
 | 
			
		||||
          };
 | 
			
		||||
        };
 | 
			
		||||
      };
 | 
			
		||||
      ########################################################
 | 
			
		||||
      # Downloads
 | 
			
		||||
      ########################################################
 | 
			
		||||
 | 
			
		||||
      downloads = {
 | 
			
		||||
        start = {
 | 
			
		||||
          bg = color.normal.blue;
 | 
			
		||||
        };
 | 
			
		||||
        stop = {
 | 
			
		||||
          bg = color.normal.green;
 | 
			
		||||
        };
 | 
			
		||||
        bar = {
 | 
			
		||||
          bg = color.bg;
 | 
			
		||||
        };
 | 
			
		||||
      };
 | 
			
		||||
 | 
			
		||||
      ########################################################
 | 
			
		||||
      # Choice of what element should be clicked
 | 
			
		||||
      ########################################################
 | 
			
		||||
 | 
			
		||||
      hints = {
 | 
			
		||||
        fg = color.txt;
 | 
			
		||||
        bg = color.bg;
 | 
			
		||||
        match = {
 | 
			
		||||
          fg = accent.color;
 | 
			
		||||
        };
 | 
			
		||||
      };
 | 
			
		||||
 | 
			
		||||
      ########################################################
 | 
			
		||||
      # List of what each keybinding does
 | 
			
		||||
      ########################################################
 | 
			
		||||
 | 
			
		||||
      keyhint = {
 | 
			
		||||
        fg = color.txt;
 | 
			
		||||
        bg = color.bg;
 | 
			
		||||
        suffix = {
 | 
			
		||||
          fg = accent.color;
 | 
			
		||||
        };
 | 
			
		||||
      };
 | 
			
		||||
 | 
			
		||||
      ########################################################
 | 
			
		||||
      # Right click menu
 | 
			
		||||
      ########################################################
 | 
			
		||||
 | 
			
		||||
      contextmenu = {
 | 
			
		||||
        menu = {
 | 
			
		||||
          fg = color.txt;
 | 
			
		||||
          bg = color.bg;
 | 
			
		||||
        };
 | 
			
		||||
        selected = {
 | 
			
		||||
          fg = accent.fg;
 | 
			
		||||
          bg = accent.color;
 | 
			
		||||
        };
 | 
			
		||||
        disabled = {
 | 
			
		||||
          fg = color.bg_light;
 | 
			
		||||
        };
 | 
			
		||||
      };
 | 
			
		||||
 | 
			
		||||
      ########################################################
 | 
			
		||||
      # Dark theme
 | 
			
		||||
      ########################################################
 | 
			
		||||
 | 
			
		||||
      # webpage = lib.mkIf (color.type == "dark") {
 | 
			
		||||
      #   bg = color.bg;
 | 
			
		||||
      #   preferred_color_scheme = "dark";
 | 
			
		||||
      #   darkmode = {
 | 
			
		||||
      #     enabled = false;
 | 
			
		||||
      #     threshold = {
 | 
			
		||||
      #       text = 150;
 | 
			
		||||
      #       background = 205;
 | 
			
		||||
      #     };
 | 
			
		||||
      #   };
 | 
			
		||||
      # };
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
  home.file = {
 | 
			
		||||
    ".config/qutebrowser/style.css".text = ''
 | 
			
		||||
      ${lib.optionalString (color.type == "dark") ''
 | 
			
		||||
        button,
 | 
			
		||||
        input[type="button"] {
 | 
			
		||||
            color: unset;
 | 
			
		||||
            background-color: unset;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        .bg-gradient-to-b,
 | 
			
		||||
        body {
 | 
			
		||||
            background-image: none !important;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /***************************
 | 
			
		||||
         * Remove borked ellements *
 | 
			
		||||
         ***************************/
 | 
			
		||||
 | 
			
		||||
        .search-filters-wrap:before, .search-filters-wrap:after {
 | 
			
		||||
 | 
			
		||||
            display: none;
 | 
			
		||||
        }
 | 
			
		||||
      ''}
 | 
			
		||||
 | 
			
		||||
      /*****************
 | 
			
		||||
       * Hide some ads *
 | 
			
		||||
       *****************/
 | 
			
		||||
 | 
			
		||||
      /*Reddit*/
 | 
			
		||||
      #sr-header-area .redesign-beta-optin,
 | 
			
		||||
      .link.promotedlink.promoted,
 | 
			
		||||
      .spacer:empty,
 | 
			
		||||
      .spacer .premium-banner-outer,
 | 
			
		||||
      .ad-container,
 | 
			
		||||
 | 
			
		||||
      /*Youtube*/
 | 
			
		||||
      div#masthead-ad ,
 | 
			
		||||
      .video-ads,
 | 
			
		||||
      #player-ads,
 | 
			
		||||
      ytd-popup-container {
 | 
			
		||||
          display: none !important;
 | 
			
		||||
      }
 | 
			
		||||
    '';
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,97 +0,0 @@
 | 
			
		|||
{
 | 
			
		||||
  config,
 | 
			
		||||
  pkgs,
 | 
			
		||||
  lib,
 | 
			
		||||
  font,
 | 
			
		||||
  ...
 | 
			
		||||
}:
 | 
			
		||||
let
 | 
			
		||||
  inherit (pkgs.uservars) theme;
 | 
			
		||||
  inherit (theme) color;
 | 
			
		||||
 | 
			
		||||
  # ".config/qutebrowser/greasemonkey/darkreader.js".text =
 | 
			
		||||
  darkThemeUserscript =
 | 
			
		||||
    enabled:
 | 
			
		||||
    pkgs.writeText "darkreader.js" ''
 | 
			
		||||
      // ==UserScript==
 | 
			
		||||
      // @name          Dark Reader (Unofficial)
 | 
			
		||||
      // @icon          https://darkreader.org/images/darkreader-icon-256x256.png
 | 
			
		||||
      // @namespace     DarkReader
 | 
			
		||||
      // @description	  Inverts the brightness of pages to reduce eye strain
 | 
			
		||||
      // @version       4.7.15
 | 
			
		||||
      // @author        https://github.com/darkreader/darkreader#contributors
 | 
			
		||||
      // @homepageURL   https://darkreader.org/ | https://github.com/darkreader/darkreader
 | 
			
		||||
      // @run-at        document-end
 | 
			
		||||
      // @grant         none
 | 
			
		||||
      // @include       http*
 | 
			
		||||
      // @require       https://cdn.jsdelivr.net/npm/darkreader/darkreader.min.js
 | 
			
		||||
      // @noframes
 | 
			
		||||
      // ==/UserScript==
 | 
			
		||||
 | 
			
		||||
      DarkReader.setFetchMethod(window.fetch)
 | 
			
		||||
 | 
			
		||||
      if (${if enabled then "false" else "true"}) {
 | 
			
		||||
        DarkReader.disable();
 | 
			
		||||
        return;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      const ignore_list = [
 | 
			
		||||
        "askubuntu.com",
 | 
			
		||||
        "mathoverflow.com",
 | 
			
		||||
        "mathoverflow.net",
 | 
			
		||||
        "serverfault.com",
 | 
			
		||||
        "stackapps.com",
 | 
			
		||||
        "stackexchange.com",
 | 
			
		||||
        "stackoverflow.com",
 | 
			
		||||
        "superuser.com",
 | 
			
		||||
        "hub.docker.com",
 | 
			
		||||
      ];
 | 
			
		||||
 | 
			
		||||
      for (let item of ignore_list) {
 | 
			
		||||
          if (window.location.origin.indexOf(item) >= 0) {
 | 
			
		||||
              console.log("URL matched dark-mode ignore list");
 | 
			
		||||
              return;
 | 
			
		||||
          }
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      DarkReader.enable({
 | 
			
		||||
        brightness: 100,
 | 
			
		||||
        contrast: 100,
 | 
			
		||||
        sepia: 0,
 | 
			
		||||
 | 
			
		||||
        darkSchemeBackgroundColor: "${color.bg}",
 | 
			
		||||
        darkSchemeTextColor: "${color.txt}",
 | 
			
		||||
 | 
			
		||||
        lightSchemeBackgroundColor: "${color.bg}",
 | 
			
		||||
        lightSchemeTextColor: "${color.txt}",
 | 
			
		||||
      });
 | 
			
		||||
    '';
 | 
			
		||||
in
 | 
			
		||||
{
 | 
			
		||||
  programs.qutebrowser.keyBindings = {
 | 
			
		||||
    normal = {
 | 
			
		||||
      "K" = "spawn --userscript toggle-dark-theme";
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
  home.file = {
 | 
			
		||||
    ".local/share/qutebrowser/userscripts/toggle-dark-theme".executable = true;
 | 
			
		||||
    ".local/share/qutebrowser/userscripts/toggle-dark-theme".text = ''
 | 
			
		||||
      #!/bin/sh
 | 
			
		||||
      DARK_READER_SCRIPT="$HOME/.config/qutebrowser/greasemonkey/darkreader.js"
 | 
			
		||||
      MARKER="$HOME/.config/qutebrowser/is-dark-mode"
 | 
			
		||||
      if test -f "$MARKER"
 | 
			
		||||
      then
 | 
			
		||||
        rm -f "$MARKER"
 | 
			
		||||
        cp -f ${darkThemeUserscript false} "$DARK_READER_SCRIPT"
 | 
			
		||||
        echo "jseval --world main DarkReader.disable()" >> "$QUTE_FIFO"
 | 
			
		||||
      else
 | 
			
		||||
        touch "$MARKER"
 | 
			
		||||
        cp -f ${darkThemeUserscript true} "$DARK_READER_SCRIPT"
 | 
			
		||||
        echo "jseval --world main DarkReader.enable()" >> "$QUTE_FIFO"
 | 
			
		||||
      fi
 | 
			
		||||
      if test -n "$QUTE_FIFO"; then
 | 
			
		||||
          echo "greasemonkey-reload --quiet" >> "$QUTE_FIFO"
 | 
			
		||||
      fi
 | 
			
		||||
    '';
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,159 +0,0 @@
 | 
			
		|||
{
 | 
			
		||||
  config,
 | 
			
		||||
  pkgs,
 | 
			
		||||
  lib,
 | 
			
		||||
  font,
 | 
			
		||||
  ...
 | 
			
		||||
}:
 | 
			
		||||
let
 | 
			
		||||
  inherit (pkgs.uservars) key browser editor;
 | 
			
		||||
in
 | 
			
		||||
{
 | 
			
		||||
  imports = [
 | 
			
		||||
    ./colors.nix
 | 
			
		||||
    ./dark-theme.nix
 | 
			
		||||
    ./fonts.nix
 | 
			
		||||
  ];
 | 
			
		||||
 | 
			
		||||
  config = {
 | 
			
		||||
    programs.qutebrowser = lib.mkIf (browser == "qutebrowser") {
 | 
			
		||||
      enable = true;
 | 
			
		||||
      # enableDefaultBindings = false;
 | 
			
		||||
      keyBindings = {
 | 
			
		||||
        normal = {
 | 
			
		||||
          # basic movent
 | 
			
		||||
          "${key.left}" = "scroll left";
 | 
			
		||||
          "${key.down}" = "scroll down";
 | 
			
		||||
          "${key.up}" = "scroll up";
 | 
			
		||||
          "${key.right}" = "scroll right";
 | 
			
		||||
 | 
			
		||||
          "${lib.toUpper key.up}" = "scroll-px 0 -100";
 | 
			
		||||
          "${lib.toUpper key.down}" = "scroll-px 0  100";
 | 
			
		||||
          "${lib.toUpper key.left}" = "back";
 | 
			
		||||
          "${lib.toUpper key.right}" = "forward";
 | 
			
		||||
          "${lib.toUpper key.tabL}" = "tab-prev";
 | 
			
		||||
          "${lib.toUpper key.tabR}" = "tab-next";
 | 
			
		||||
 | 
			
		||||
          "${key.next}" = "search-next";
 | 
			
		||||
          "${lib.toUpper key.next}" = "search-prev";
 | 
			
		||||
 | 
			
		||||
          "${key.insertMode}" = "mode-enter insert";
 | 
			
		||||
          # ":" = "mode-enter command";
 | 
			
		||||
 | 
			
		||||
          "t" = "hint all";
 | 
			
		||||
          "h" = "set-cmd-text -s :open";
 | 
			
		||||
          "T" = "hint all tab";
 | 
			
		||||
          "H" = "set-cmd-text -s :open -t";
 | 
			
		||||
 | 
			
		||||
          "<Ctrl-${lib.toLower key.tabL}>" = "tree-tab-promote";
 | 
			
		||||
          "<Ctrl-${lib.toLower key.tabR}>" = "tree-tab-demote";
 | 
			
		||||
 | 
			
		||||
          "co" = "tab-only --pinned keep";
 | 
			
		||||
 | 
			
		||||
          # "K" = "jseval --world main if (DarkReader.isEnabled()) {DarkReader.disable()} else {DarkReader.enable()}";
 | 
			
		||||
        };
 | 
			
		||||
        insert = {
 | 
			
		||||
          # quit insert mode
 | 
			
		||||
          "<Alt-k>" = "mode-enter normal";
 | 
			
		||||
        };
 | 
			
		||||
        caret = {
 | 
			
		||||
          # basic movent
 | 
			
		||||
          "${key.left}" = "move-to-prev-char";
 | 
			
		||||
          "${key.down}" = "move-to-next-line";
 | 
			
		||||
          "${key.up}" = "move-to-prev-line";
 | 
			
		||||
          "${key.right}" = "move-to-next-char";
 | 
			
		||||
 | 
			
		||||
          "${key.insertMode}" = "mode-enter insert";
 | 
			
		||||
        };
 | 
			
		||||
      };
 | 
			
		||||
      settings = {
 | 
			
		||||
        tabs.tree_tabs = true;
 | 
			
		||||
        tabs.position = "right";
 | 
			
		||||
        tabs.pinned.shrink = false;
 | 
			
		||||
        tabs.title.format = "{tree}{collapsed}{audio}{index}: {current_title}";
 | 
			
		||||
        tabs.title.format_pinned = "{tree}{collapsed}{audio}{index} 🔒: {current_title}";
 | 
			
		||||
 | 
			
		||||
        session.lazy_restore = true;
 | 
			
		||||
        auto_save.session = true;
 | 
			
		||||
 | 
			
		||||
        hints.chars = key.hints;
 | 
			
		||||
        editor.command = [
 | 
			
		||||
          "terminal"
 | 
			
		||||
          "-e"
 | 
			
		||||
          {
 | 
			
		||||
            kakoune = "kak";
 | 
			
		||||
            helix = "hx";
 | 
			
		||||
          }
 | 
			
		||||
          .${editor}
 | 
			
		||||
          "{file}"
 | 
			
		||||
          "+{line}"
 | 
			
		||||
        ];
 | 
			
		||||
 | 
			
		||||
        input.insert_mode.auto_leave = false;
 | 
			
		||||
 | 
			
		||||
        content.autoplay = false;
 | 
			
		||||
        content.blocking.adblock.lists = [
 | 
			
		||||
          "https://easylist.to/easylist/easylist.txt"
 | 
			
		||||
          "https://easylist.to/easylist/easyprivacy.txt"
 | 
			
		||||
          "https://easylist-downloads.adblockplus.org/easylistdutch.txt"
 | 
			
		||||
          "https://easylist-downloads.adblockplus.org/abp-filters-anti-cv.txt"
 | 
			
		||||
          "https://www.i-dont-care-about-cookies.eu/abp/"
 | 
			
		||||
          "https://secure.fanboy.co.nz/fanboy-cookiemonster.txt"
 | 
			
		||||
        ];
 | 
			
		||||
      };
 | 
			
		||||
      extraConfig = ''
 | 
			
		||||
        config.load_autoconfig()
 | 
			
		||||
        config.set("content.notifications.enabled", True, "https://web.whatsapp.com")
 | 
			
		||||
      '';
 | 
			
		||||
    };
 | 
			
		||||
    systemd.user.services = lib.mkIf (browser == "qutebrowser") {
 | 
			
		||||
      qutebrowser = {
 | 
			
		||||
        Unit = {
 | 
			
		||||
          Description = "Qutebrowser Web client";
 | 
			
		||||
          PartOf = [ "graphical-session.target" ];
 | 
			
		||||
          After = [ "graphical-session.target" ];
 | 
			
		||||
        };
 | 
			
		||||
        Service = {
 | 
			
		||||
          ExecStartPre = "/usr/bin/env sleep 10s";
 | 
			
		||||
          ExecStart = "${pkgs.qutebrowser}/bin/qutebrowser";
 | 
			
		||||
          Restart = "on-failure";
 | 
			
		||||
        };
 | 
			
		||||
        Install = {
 | 
			
		||||
          WantedBy = [ "sway-session.target" ];
 | 
			
		||||
        };
 | 
			
		||||
      };
 | 
			
		||||
    };
 | 
			
		||||
    home.file = {
 | 
			
		||||
      # For some stupid reason qutebrowser crashes if this dir does not exist
 | 
			
		||||
      ".local/share/qutebrowser/greasemonkey/.keep".text = "";
 | 
			
		||||
      ".config/qutebrowser/greasemonkey/youtube.js".text = ''
 | 
			
		||||
        // ==UserScript==
 | 
			
		||||
        // @name         Auto Skip YouTube Ads
 | 
			
		||||
        // @version      1.0.2
 | 
			
		||||
        // @description  Speed up and skip YouTube ads automatically
 | 
			
		||||
        // @author       codiac-killer
 | 
			
		||||
        // @match        *://*.youtube.com/*
 | 
			
		||||
        // @exclude      *://*.youtube.com/subscribe_embed?*
 | 
			
		||||
        // ==/UserScript==
 | 
			
		||||
 | 
			
		||||
        let main = new MutationObserver(() => {
 | 
			
		||||
        	// Get skip button and click it
 | 
			
		||||
        	let btn = document.getElementsByClassName("ytp-ad-skip-button ytp-button").item(0)
 | 
			
		||||
        	if (btn) {
 | 
			
		||||
        		btn.click()
 | 
			
		||||
        	}
 | 
			
		||||
 | 
			
		||||
        	// (unskipable ads) If skip button didn't exist / was not clicked speed up video
 | 
			
		||||
        	const ad = [...document.querySelectorAll('.ad-showing')][0];
 | 
			
		||||
        	if (ad) {
 | 
			
		||||
        		// Speed up and mute
 | 
			
		||||
        		document.querySelector('video').playbackRate = 16;
 | 
			
		||||
        		document.querySelector('video').muted = true;
 | 
			
		||||
        	}
 | 
			
		||||
        })
 | 
			
		||||
 | 
			
		||||
        main.observe(document.getElementsByClassName("video-ads ytp-ad-module").item(0), {attributes: true, characterData: true, childList: true})
 | 
			
		||||
      '';
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,35 +0,0 @@
 | 
			
		|||
{ pkgs, ... }:
 | 
			
		||||
let
 | 
			
		||||
  inherit (pkgs.uservars) font;
 | 
			
		||||
in
 | 
			
		||||
{
 | 
			
		||||
  programs.qutebrowser.settings.fonts =
 | 
			
		||||
    let
 | 
			
		||||
      mkFont = name: size: "${toString size}px ${name}";
 | 
			
		||||
      DEF_MONO = mkFont font.mono font.size.medium;
 | 
			
		||||
      BIG_MONO = mkFont font.mono font.size.big;
 | 
			
		||||
      DEF_INTER = mkFont font.interface font.size.medium;
 | 
			
		||||
      BIG_INTER = mkFont font.interface font.size.big;
 | 
			
		||||
    in
 | 
			
		||||
    {
 | 
			
		||||
      debug_console = BIG_INTER;
 | 
			
		||||
      downloads = BIG_INTER;
 | 
			
		||||
      hints = "bold " + BIG_MONO;
 | 
			
		||||
      keyhint = BIG_INTER;
 | 
			
		||||
      prompts = BIG_INTER;
 | 
			
		||||
      statusbar = DEF_MONO;
 | 
			
		||||
      completion = {
 | 
			
		||||
        entry = BIG_INTER;
 | 
			
		||||
        category = BIG_INTER;
 | 
			
		||||
      };
 | 
			
		||||
      messages = {
 | 
			
		||||
        error = DEF_INTER;
 | 
			
		||||
        info = DEF_INTER;
 | 
			
		||||
        warning = DEF_INTER;
 | 
			
		||||
      };
 | 
			
		||||
      tabs = {
 | 
			
		||||
        selected = BIG_INTER;
 | 
			
		||||
        unselected = BIG_INTER;
 | 
			
		||||
      };
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -17,8 +17,6 @@ in
 | 
			
		|||
  wayland.windowManager.sway.config = {
 | 
			
		||||
    assigns = {
 | 
			
		||||
      "2" = [
 | 
			
		||||
        { class = "qutebrowser"; }
 | 
			
		||||
        { app_id = "qutebrowser"; }
 | 
			
		||||
        { class = "firefox"; }
 | 
			
		||||
        { app_id = "firefox"; }
 | 
			
		||||
        { class = "Chromium"; }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue