Compare commits
1 Commits
master
...
2024-08-11
Author | SHA1 | Date | |
---|---|---|---|
9b12bd24c0 |
6
TODO.md
6
TODO.md
@@ -9,6 +9,7 @@
|
||||
- trust-dns can't resolve `social.kernel.org`
|
||||
- trust-dns can't resolve `pe.usps.com`
|
||||
- trust-dns can't resolve `social.seattle.wa.us`
|
||||
- trust-dns can't resolve `support.mozilla.org`
|
||||
- sandbox: link cache means that if i update ~/.config/... files inline, sandboxed programs still see the old version
|
||||
- mpv: continues to play past the end of some audio files
|
||||
- mpv: audiocast has mpv sending its output to the builtin speakers unless manually changed
|
||||
@@ -61,6 +62,11 @@
|
||||
- safer (rust? actively maintained? sandboxable?)
|
||||
- handles spaces/symbols in filenames
|
||||
- has better multi-stream perf (e.g. `sane-sync-music` should be able to copy N items in parallel)
|
||||
- firefox: open *all* links (http, https, ...) with system handler
|
||||
- removes the need for open-in-mpv, firefox-xdg-open, etc.
|
||||
- matrix room links *just work*.
|
||||
- `network.protocol-handler.external.https = true` in about:config *seems* to do this,
|
||||
but breaks some webpages (e.g. Pleroma)
|
||||
|
||||
### security/resilience
|
||||
- enable `snapper` btrfs snapshots (`services.snapper`)
|
||||
|
@@ -46,6 +46,7 @@
|
||||
./fcitx5.nix
|
||||
./feedbackd.nix
|
||||
./firefox.nix
|
||||
./firefox-xdg-open.nix
|
||||
./flare-signal.nix
|
||||
./foliate.nix
|
||||
./fontconfig.nix
|
||||
|
13
hosts/common/programs/firefox-xdg-open.nix
Normal file
13
hosts/common/programs/firefox-xdg-open.nix
Normal file
@@ -0,0 +1,13 @@
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
sane.programs.firefox-xdg-open = {
|
||||
packageUnwrapped = pkgs.firefox-extensions.firefox-xdg-open.systemComponent;
|
||||
|
||||
sandbox.method = "bwrap";
|
||||
sandbox.whitelistDbus = [ "user" ]; # for xdg-open/portals
|
||||
|
||||
mime.associations."x-scheme-handler/xdg-open" = "xdg-open.desktop";
|
||||
|
||||
suggestedPrograms = [ "xdg-utils" ];
|
||||
};
|
||||
}
|
@@ -231,6 +231,10 @@ in
|
||||
package = pkgs.firefox-extensions.ether-metamask;
|
||||
enable = lib.mkDefault false; # until i can disable the first-run notification
|
||||
};
|
||||
firefox-xdg-open = {
|
||||
package = pkgs.firefox-extensions.firefox-xdg-open;
|
||||
enable = lib.mkDefault true;
|
||||
};
|
||||
i2p-in-private-browsing = {
|
||||
package = pkgs.firefox-extensions.i2p-in-private-browsing;
|
||||
enable = lib.mkDefault config.services.i2p.enable;
|
||||
@@ -298,6 +302,7 @@ in
|
||||
fs.".config/sops".dir = lib.mkIf cfg.addons.browserpass-extension.enable {}; #< needs to be created, not *just* added to the sandbox
|
||||
|
||||
suggestedPrograms = [
|
||||
"firefox-xdg-open"
|
||||
"open-in-mpv"
|
||||
];
|
||||
|
||||
|
@@ -34,10 +34,7 @@ let
|
||||
extid = addon.passthru.extid;
|
||||
# merge our requirements into the derivation args
|
||||
args' = args // {
|
||||
passthru = {
|
||||
inherit extid;
|
||||
original = addon;
|
||||
} // (args.passthru or {});
|
||||
passthru = addon.passthru // (args.passthru or {});
|
||||
nativeBuildInputs = [
|
||||
jq
|
||||
strip-nondeterminism
|
||||
@@ -137,6 +134,7 @@ in (lib.makeScope newScope (self: with self; {
|
||||
browserpass-extension = callPackage ./browserpass-extension { };
|
||||
bypass-paywalls-clean = callPackage ./bypass-paywalls-clean { };
|
||||
ctrl-shift-c-should-copy = callPackage ./ctrl-shift-c-should-copy { };
|
||||
firefox-xdg-open = callPackage ./firefox-xdg-open { };
|
||||
i-still-dont-care-about-cookies = callPackage ./i-still-dont-care-about-cookies { };
|
||||
open-in-mpv = callPackage ./open-in-mpv { };
|
||||
sidebery = callPackage ./sidebery { };
|
||||
|
@@ -0,0 +1,16 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title>Document</title>
|
||||
<script src="background.js" type="module"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
@@ -0,0 +1,22 @@
|
||||
//! largely copied from OpenInMPV browser extension
|
||||
|
||||
function xdgOpen(tabId, url) {
|
||||
const code = `
|
||||
var link = document.createElement('a')
|
||||
link.href='xdg-open:${url}'
|
||||
document.body.appendChild(link)
|
||||
link.click()`
|
||||
console.log(code)
|
||||
chrome.tabs.executeScript(tabId, { code })
|
||||
}
|
||||
|
||||
[["page", "pageUrl"], ["link", "linkUrl"], ["video", "srcUrl"], ["audio", "srcUrl"]].forEach(([item, linkType]) => {
|
||||
chrome.contextMenus.create({
|
||||
title: "xdg-open",
|
||||
id: `open${item}inmpv`,
|
||||
contexts: [item],
|
||||
onclick: (info, tab) => {
|
||||
xdgOpen(tab.id, info[linkType]);
|
||||
},
|
||||
});
|
||||
});
|
@@ -0,0 +1,47 @@
|
||||
{
|
||||
copyDesktopItems,
|
||||
makeDesktopItem,
|
||||
static-nix-shell,
|
||||
stdenvNoCC,
|
||||
zip,
|
||||
}:
|
||||
stdenvNoCC.mkDerivation {
|
||||
pname = "firefox-xdg-open";
|
||||
version = "0.1";
|
||||
src = ./.;
|
||||
|
||||
nativeBuildInputs = [ zip ];
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
zip -j firefox.zip \
|
||||
background.html background.js manifest.json
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
install firefox.zip $out
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
passthru.extid = "@firefox-xdg-open";
|
||||
passthru.systemComponent = static-nix-shell.mkBash {
|
||||
pname = "xdg-open-scheme-handler";
|
||||
src = ./.;
|
||||
pkgs = [ "xdg-utils" ];
|
||||
|
||||
nativeBuildInputs = [
|
||||
copyDesktopItems
|
||||
];
|
||||
desktopItems = [
|
||||
(makeDesktopItem {
|
||||
name = "xdg-open";
|
||||
exec = "xdg-open-scheme-handler %U";
|
||||
desktopName = "xdg-open";
|
||||
comment = "Decodes xdg-open:... URIs, used to force applications to open links via the system handler";
|
||||
noDisplay = true;
|
||||
})
|
||||
];
|
||||
};
|
||||
}
|
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"manifest_version": 2,
|
||||
"browser_specific_settings": {
|
||||
"gecko": {
|
||||
"id": "@firefox-xdg-open"
|
||||
}
|
||||
},
|
||||
"name": "Firefox XDG Open",
|
||||
"description": "Open URIs with the system handler.",
|
||||
"version": "0.1.0",
|
||||
"options_ui": {},
|
||||
"background": {
|
||||
"page": "background.html"
|
||||
},
|
||||
"browser_action": {
|
||||
"default_title": "xdg-open"
|
||||
},
|
||||
"permissions": [
|
||||
"tabs",
|
||||
"activeTab",
|
||||
"contextMenus"
|
||||
]
|
||||
}
|
||||
|
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i bash -p bash -p xdg-utils
|
||||
|
||||
uris=()
|
||||
for u in "$@"; do
|
||||
uris+=("${u/xdg-open:/}")
|
||||
done
|
||||
|
||||
xdg-open "${uris[@]}"
|
Reference in New Issue
Block a user