From 5f6627e7e7affaffcac1abd211001ef26e442063 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Sun, 16 Mar 2025 10:01:14 +0100 Subject: [PATCH 1/8] qutebrowser: Add hypothesis annotation function Can be activated through the command alias ':hypothesis' or just the shortcut `+a`, so `,a`. --- qutebrowser/config/alias.py | 3 +++ qutebrowser/config/maps.py | 1 + 2 files changed, 4 insertions(+) diff --git a/qutebrowser/config/alias.py b/qutebrowser/config/alias.py index 671718b..f87d6b1 100644 --- a/qutebrowser/config/alias.py +++ b/qutebrowser/config/alias.py @@ -40,3 +40,6 @@ c.aliases["cookie-block"] = "spawn --userscript qute-cookie-block" # open last downloads in dmenu-like c.aliases["recent-downloads"] = "spawn --userscript recently-downloaded" + +# annotate with hypothesis +c.aliases["hypothesis"] = "jseval (function(){window.hypothesisConfig=function(){return{showHighlights:true,appType:'bookmarklet'};};var d=document,s=d.createElement('script');s.setAttribute('src','https://hypothes.is/embed.js');d.body.appendChild(s)})();'hypothesis enabled'" diff --git a/qutebrowser/config/maps.py b/qutebrowser/config/maps.py index 648181b..ccc757a 100644 --- a/qutebrowser/config/maps.py +++ b/qutebrowser/config/maps.py @@ -86,6 +86,7 @@ config.bind('"p', "send-to-scihub", mode="normal") # view current page doi on s config.bind(";p", "hint links run send-to-scihub") # view linked doi on scihub config.bind(lleader + "r", "readable", mode="normal") +config.bind(lleader + "a", "hypothesis", mode="normal") # set stylesheets for the browser to use config.bind( From 2e9701ea26102f6ea8cfedf104daf89ec26e312d Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Wed, 26 Feb 2025 15:37:28 +0100 Subject: [PATCH 2/8] services: Fix missing environment variables for user services We add an additional 'core' user service (i.e. one that gets loaded before all others by turnstile) which populates the TURNSTILE_ENV_DIR with all manner of custom set env vars that are important for other applications. Most importantly, this sets up the XDG directory compliance for applications either managed by turnstile or applications started through turnstile on my system. So, for example `pass` knows to search for its database in `XDG_DATA_HOME` and river knows to search for binaries in a PATH which has been prefixed with my custom user binary location. --- desktop/.config/river/init | 6 ------ services/sv/loadenv/log/run | 3 +++ services/sv/loadenv/run | 29 +++++++++++++++++++++++++++++ services/sv/river/run | 4 ---- services/sv/turnstile-ready/conf | 2 +- terminal/.config/nushell/config.nu | 4 +++- 6 files changed, 36 insertions(+), 12 deletions(-) create mode 100755 services/sv/loadenv/log/run create mode 100755 services/sv/loadenv/run diff --git a/desktop/.config/river/init b/desktop/.config/river/init index 21dd169..1f142af 100755 --- a/desktop/.config/river/init +++ b/desktop/.config/river/init @@ -4,12 +4,6 @@ if [ -d "$TURNSTILE_ENV_DIR" ]; then echo "$DISPLAY" >"$TURNSTILE_ENV_DIR/DISPLAY" echo "$WAYLAND_DISPLAY" >"$TURNSTILE_ENV_DIR/WAYLAND_DISPLAY" - echo "ADDING KEYCHAIN TO ENV" - keychain --eval --quiet --agents ssh,gpg C414FF88A557F29AFEF76C7E73BA40D5AFAF49C9 - echo "$SSH_AUTH_SOCK">"$TURNSTILE_ENV_DIR/SSH_AUTH_SOCK" - echo "$SSH_AGENT_PID">"$TURNSTILE_ENV_DIR/SSH_AGENT_PID" - echo "$GPG_AGENT_INFO">"$TURNSTILE_ENV_DIR/GPG_AGENT_INFO" - echo "DONE ADDING KEYCHAIN TO ENV" fi mod="Mod4" diff --git a/services/sv/loadenv/log/run b/services/sv/loadenv/log/run new file mode 100755 index 0000000..e9f8c5c --- /dev/null +++ b/services/sv/loadenv/log/run @@ -0,0 +1,3 @@ +#!/usr/bin/env sh + +exec vlogger -t loadenv -p daemon diff --git a/services/sv/loadenv/run b/services/sv/loadenv/run new file mode 100755 index 0000000..4e45759 --- /dev/null +++ b/services/sv/loadenv/run @@ -0,0 +1,29 @@ +#!/bin/sh +# Loadenv service ensures turstile environment gets populated with all +# profile-loaded environment variables. +# +# To use this service with other turnstile user services, ensure it gets +# started before anything else is started by putting it into `turnstile-ready` +# service conf as a core service. +# +# Will also load the profile file from a custom XDG-compliant +# ~/.config/sh/profile directory before falling back to the home directory +# ~/.profile file. +# This location can be manually overriden by putting the following into the +# service conf file: +# XDG_PROFILE=/my/location/somewhere/profile + +[ -r ./conf ] && . ./conf + +if [ -e "$HOME/.config/sh/profile" ]; then + XDG_PROFILE="${XDG_PROFILE:-HOME/.config/sh/profile}" +fi + +ENV=${XDG_PROFILE:-$HOME/.profile} sh -i -c env | while IFS= read -r line; do + value=${line#*=} + name=${line%%=*} + echo "$value" > "$TURNSTILE_ENV_DIR/$name" +done + +exec 2>&1 +exec pause diff --git a/services/sv/river/run b/services/sv/river/run index 0bc4d0b..cb6ab26 100755 --- a/services/sv/river/run +++ b/services/sv/river/run @@ -2,9 +2,5 @@ [ -r ./conf ] && . ./conf -if [ -d "$TURNSTILE_ENV_DIR" ]; then - echo "$HOME/.local/bin:$PATH" > "$TURNSTILE_ENV_DIR/PATH" -fi - exec 2>&1 exec chpst -e "$TURNSTILE_ENV_DIR" river -log-level warning diff --git a/services/sv/turnstile-ready/conf b/services/sv/turnstile-ready/conf index 68063d2..97b5c92 100644 --- a/services/sv/turnstile-ready/conf +++ b/services/sv/turnstile-ready/conf @@ -1 +1 @@ -core_services="dbus" +core_services="loadenv dbus" diff --git a/terminal/.config/nushell/config.nu b/terminal/.config/nushell/config.nu index 72e382c..ccb2053 100644 --- a/terminal/.config/nushell/config.nu +++ b/terminal/.config/nushell/config.nu @@ -63,7 +63,9 @@ alias l = ls alias cl = clear alias md = mkdir -def --env mcd [path: one_of(string glob)] { +def --env mcd [path: path] { mkdir $path cd $path } + +alias v = nvim From 3bb2e672754f11314cfc1f907b585832dcd732cb Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Sun, 16 Mar 2025 21:57:32 +0100 Subject: [PATCH 3/8] services: Remove example user service it does not serve any appreciable function anymore now that I have created a sufficient amount of custom user services. --- services/sv/_example/log/run | 3 --- services/sv/_example/run | 4 ---- 2 files changed, 7 deletions(-) delete mode 100755 services/sv/_example/log/run delete mode 100755 services/sv/_example/run diff --git a/services/sv/_example/log/run b/services/sv/_example/log/run deleted file mode 100755 index aca60e4..0000000 --- a/services/sv/_example/log/run +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env sh - -exec svlogd -ttt /home/marty/myservice/logs diff --git a/services/sv/_example/run b/services/sv/_example/run deleted file mode 100755 index 962758c..0000000 --- a/services/sv/_example/run +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -e - -exec 2>&1 -exec /home/marty/myservice/example-service.sh From 0942a9bc9f68a250c0ed4bcd00278e4698444340 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Fri, 7 Feb 2025 16:48:33 +0100 Subject: [PATCH 4/8] repo: Fix linking quarto snippets symlink Dotter recognized it as a jinja template and so we explicitly need to tell it that it's a symlink instead. --- .dotter/global.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/.dotter/global.toml b/.dotter/global.toml index d2e309e..6c2ae8c 100644 --- a/.dotter/global.toml +++ b/.dotter/global.toml @@ -24,6 +24,7 @@ vcs = "~" [nvim.files] "nvim/.config/nvim/spell/de.utf-8.add.spl" = { target = "~/.config/nvim/spell/de.utf-8.add.spl", type = "symbolic" } "nvim/.config/nvim/spell/en.utf-8.add.spl" = { target = "~/.config/nvim/spell/en.utf-8.add.spl", type = "symbolic" } +"nvim/.config/nvim/snippets/quarto.snippets" = { target = "~/.config/nvim/snippets/quarto.snippets", type = "symbolic" } nvim = "~" [scripts.files] From caae3513a95cb62bd4efe6bec85c58a570b5d80d Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Fri, 7 Feb 2025 16:48:33 +0100 Subject: [PATCH 5/8] bootstrap: Add argument passing to dotlink Dotlink now takes arbitrary arguments which it all simply passes through to dotter underneath. Also made the directory changing a little more flexible. --- bootstrap/dotlink.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/bootstrap/dotlink.sh b/bootstrap/dotlink.sh index 9cf3d69..ba7f148 100644 --- a/bootstrap/dotlink.sh +++ b/bootstrap/dotlink.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env sh +#!/usr/bin/env bash # relink all stowed files from anywhere # grepping is to remove meaningless stderr lines until this bug is fixed: # https://github.com/aspiers/stow/issues/65 @@ -10,6 +10,8 @@ # to customize this to your own needs, change the `push folder` to the # location of your dotfiles (stow) repository -alias dotlink="pushd ~/.dotfiles;\ - dotter deploy;\ - popd" +dotlink() { + cd ~/.dotfiles || return + dotter "${@:-deploy}" + cd "$OLDPWD" || return +} From 2f618d65d58f63e2e26b907f19b568601bebb451 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Tue, 18 Mar 2025 11:15:56 +0100 Subject: [PATCH 6/8] qutebrowser: Remove xdg-utils dependency from recently-downloaded First uses the 'open' command if there is one, then the 'mimeo' command and only then falls back to 'xdg-open'. --- qutebrowser/scripts/recently-downloaded | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/qutebrowser/scripts/recently-downloaded b/qutebrowser/scripts/recently-downloaded index 19dd925..5e87be9 100755 --- a/qutebrowser/scripts/recently-downloaded +++ b/qutebrowser/scripts/recently-downloaded @@ -100,19 +100,14 @@ if [ -z "$line" ]; then exit 0 fi -msg info "file is $line" path="$DOWNLOAD_DIR/$line" -filetype=$(xdg-mime query filetype "$path") -application=$(xdg-mime query default "$filetype") -if [ -z "$application" ]; then - die "Do not know how to open »$line« of type $filetype" -fi +msg info "Opening »$line«." -msg info "Opening »$line« (of type $filetype) with ${application%.desktop}" - -if type open >/dev/null 2>&1; then +if command -v open >/dev/null 2>&1; then open "$path" & +elif command -v mimeo >/dev/null 2>&1; then + mimeo "$path" & else xdg-open "$path" & fi From ff2ae79878765e9981d5467af717d4c285210566 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Tue, 18 Mar 2025 11:15:56 +0100 Subject: [PATCH 7/8] nvim: Move to image.nvim fork which works with typst Though ostensibly compatible with typst, there is a show-stopping issue with the main image.nvim fork which means an error message whenever there is more than one typst buffer open (e.g. two side-by-side, or opening a fzf-lua windows with typst previews, and so on). Until that is fixed, use this fork. Issue here: https://github.com/3rd/image.nvim/pull/280 --- nvim/.config/nvim/lazy-lock.json | 2 +- nvim/.config/nvim/lua/core/languages.lua | 7 +++++-- nvim/.config/nvim/lua/plugins/data_analysis.lua | 14 ++++++-------- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/nvim/.config/nvim/lazy-lock.json b/nvim/.config/nvim/lazy-lock.json index a9d1cc3..2e6e902 100644 --- a/nvim/.config/nvim/lazy-lock.json +++ b/nvim/.config/nvim/lazy-lock.json @@ -24,7 +24,7 @@ "grug-far.nvim": { "branch": "main", "commit": "3e72486d0123d08f5b253847ab6e00ca12353242" }, "helpview.nvim": { "branch": "main", "commit": "49e8d4782ae73274a35d606fde2844b6e958a0c7" }, "hunk.nvim": { "branch": "master", "commit": "b475ba0011e4b8ef7d7ddecd9764ee1a5f41366d" }, - "image.nvim": { "branch": "master", "commit": "6ffafab2e98b5bda46bf227055aa84b90add8cdc" }, + "image.nvim": { "branch": "master", "commit": "a4638ec549c6aa56264cb0371255192ff37a8a90" }, "img-clip.nvim": { "branch": "main", "commit": "0bb8b5ced45c2672c70184c87d014194b0705815" }, "jupytext.nvim": { "branch": "main", "commit": "c8baf3ad344c59b3abd461ecc17fc16ec44d0f7b" }, "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, diff --git a/nvim/.config/nvim/lua/core/languages.lua b/nvim/.config/nvim/lua/core/languages.lua index ad2b5bb..755fb8c 100644 --- a/nvim/.config/nvim/lua/core/languages.lua +++ b/nvim/.config/nvim/lua/core/languages.lua @@ -9,7 +9,7 @@ local nushell = { lsp = { nushell = {} }, ts = { "nu" } } if vim.fn.executable("nufmt") == 1 then - nushell.format = {nu = {"nufmt"}} + nushell.format = { nu = { "nufmt" } } end local languages = { @@ -103,7 +103,10 @@ local languages = { lint = { typescript = { "eslint_d" }, typescriptreact = { "eslint_d" } }, format = { typescript = { "prettier" }, typescriptreact = { "prettier" } }, }, - typst = { lsp = { tinymist = { settings = { formatterMode = "typstyle" } } }, ts = { "typst" } }, + typst = { + lsp = { tinymist = { settings = { formatterMode = "typstyle" } } }, + ts = { "typst" }, + }, vue = { format = { vue = { "prettier", "rustywind" } } }, yaml = { lsp = { yamlls = {}, ansiblels = {} }, ts = { "yaml" }, format = { yaml = { "prettier" } } }, zsh = { format = { zsh = { "shfmt" } } }, diff --git a/nvim/.config/nvim/lua/plugins/data_analysis.lua b/nvim/.config/nvim/lua/plugins/data_analysis.lua index b4d7fc8..96e8823 100644 --- a/nvim/.config/nvim/lua/plugins/data_analysis.lua +++ b/nvim/.config/nvim/lua/plugins/data_analysis.lua @@ -55,7 +55,9 @@ return { -- image display { - "3rd/image.nvim", + -- "3rd/image.nvim", -- using Fork until https://github.com/3rd/image.nvim/pull/280 is merged + "UnaTried/image.nvim", + name = "image.nvim", version = false, dependencies = { { "leafo/magick" }, -- luarock, ensure global luarock51 dependency @@ -71,12 +73,8 @@ return { only_render_image_at_cursor = true, filetypes = { "markdown", "vimwiki", "quarto" }, }, - neorg = { - only_render_image_at_cursor = true, - }, - typst = { - only_render_image_at_cursor = true, - }, + neorg = { only_render_image_at_cursor = true }, + typst = { only_render_image_at_cursor = true }, }, }, config = function(_, opts) @@ -106,7 +104,7 @@ return { "benlubas/molten-nvim", dependencies = { { "willothy/wezterm.nvim", config = true }, - { "3rd/image.nvim", optional = true }, + { "image.nvim", optional = true }, }, build = ":UpdateRemotePlugins", init = function() From d69a0f40e163a10b0e36eb8a3fa387cf30be49f1 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Wed, 19 Mar 2025 21:28:56 +0100 Subject: [PATCH 8/8] qutebrowser: Make xdg-utils optional Replace all hard-coded instances of using xdg-open with at least one non-xdg alternative. Mostly falling back to either mimeo or a custom open script. --- qutebrowser/data/userscripts/linkding_add.sh | 15 ++++++++++++--- qutebrowser/data/userscripts/qute-gemini | 6 +++++- qutebrowser/data/userscripts/shaarli_add.sh | 12 +++++++++++- qutebrowser/data/userscripts/wallabag_add.sh | 12 +++++++++++- social/.config/tut/config.ini | 4 ++-- 5 files changed, 41 insertions(+), 8 deletions(-) diff --git a/qutebrowser/data/userscripts/linkding_add.sh b/qutebrowser/data/userscripts/linkding_add.sh index 40768fa..4deb17e 100755 --- a/qutebrowser/data/userscripts/linkding_add.sh +++ b/qutebrowser/data/userscripts/linkding_add.sh @@ -12,6 +12,16 @@ # Configure your shaarli instance with this: INSTANCE="https://links.martyoeh.me" +_open() { + if command -v open >/dev/null 2>&1; then + open "$1" & + elif command -v mimeo >/dev/null 2>&1; then + mimeo "$1" & + else + xdg-open "$1" & + fi +} + # send page to shaarli instance and open the 'post' page to edit it if [ "$#" -gt 0 ]; then BM="$INSTANCE/bookmarks/new?url=$*&auto_close" @@ -19,9 +29,8 @@ else BM="$INSTANCE/bookmarks/new?url=$QUTE_URL&auto_close" fi -if [ -n "$QUTE_FIFO" ]; then +if [ "$QUTE_FIFO" != "" ]; then echo "open -t -r $BM" >>"$QUTE_FIFO" else - xdg-open "$BM" + _open "$BM" fi - diff --git a/qutebrowser/data/userscripts/qute-gemini b/qutebrowser/data/userscripts/qute-gemini index e5ffa7a..56ae668 100755 --- a/qutebrowser/data/userscripts/qute-gemini +++ b/qutebrowser/data/userscripts/qute-gemini @@ -21,6 +21,7 @@ # continue surfing like normal, only that you can now also access # any gemini pages as if they were part of the normal http protocol. +import shutil import cgi import html import os @@ -379,7 +380,10 @@ def open_url(url: str, open_args: str) -> None: with open(fifo, "w") as qfifo: qfifo.write(f"open {open_args} {to_open}") return - os.system(f"xdg-open {to_open}") + if shutil.which("mimeo"): + _ = os.system(f"mimeo {to_open}") + elif shutil.which("xdg-open"): + _ = os.system(f"xdg-open {to_open}") if __name__ == "__main__": diff --git a/qutebrowser/data/userscripts/shaarli_add.sh b/qutebrowser/data/userscripts/shaarli_add.sh index 2d3e289..20c9175 100755 --- a/qutebrowser/data/userscripts/shaarli_add.sh +++ b/qutebrowser/data/userscripts/shaarli_add.sh @@ -12,6 +12,16 @@ # Configure your shaarli instance with this: SHAARLI_INSTANCE="https://links.martyoeh.me" +_open() { + if command -v open >/dev/null 2>&1; then + open "$1" & + elif command -v mimeo >/dev/null 2>&1; then + mimeo "$1" & + else + xdg-open "$1" & + fi +} + # send page to shaarli instance and open the 'post' page to edit it if [ "$#" -gt 0 ]; then BM="$SHAARLI_INSTANCE/?post=$*" @@ -22,6 +32,6 @@ fi if [ -n "$QUTE_FIFO" ]; then echo "open -t -r $BM" >>"$QUTE_FIFO" else - xdg-open "$BM" + _open "$BM" fi diff --git a/qutebrowser/data/userscripts/wallabag_add.sh b/qutebrowser/data/userscripts/wallabag_add.sh index 3d3eedf..4b982e3 100755 --- a/qutebrowser/data/userscripts/wallabag_add.sh +++ b/qutebrowser/data/userscripts/wallabag_add.sh @@ -12,6 +12,16 @@ # Configure your wallabag instance with this: WALLABAG_INSTANCE="https://read.martyoeh.me" +_open() { + if command -v open >/dev/null 2>&1; then + open "$1" & + elif command -v mimeo >/dev/null 2>&1; then + mimeo "$1" & + else + xdg-open "$1" & + fi +} + # only works for wallabag v2.* if [ "$#" -gt 0 ]; then BM="$WALLABAG_INSTANCE/bookmarklet?url=$*" @@ -22,5 +32,5 @@ fi if [ -n "$QUTE_FIFO" ]; then echo "open -b -r $BM" >>"$QUTE_FIFO" else - xdg-open "$BM" + _open "$BM" fi diff --git a/social/.config/tut/config.ini b/social/.config/tut/config.ini index c6b7031..16efe8a 100644 --- a/social/.config/tut/config.ini +++ b/social/.config/tut/config.ini @@ -243,7 +243,7 @@ video-reverse=false # Your audio viewer. # default=xdg-open -audio-viewer=xdg-open +audio-viewer=mimeo # Open the audio viewer in the same terminal as toot. Only for terminal based # viewers. @@ -261,7 +261,7 @@ audio-reverse=false # Your web browser. # default=xdg-open -link-viewer=xdg-open +link-viewer=mimeo # Open the browser in the same terminal as toot. Only for terminal based # browsers.