Compare commits

..

No commits in common. "a9d7f96ad2b0596f59b37e762216a01060a3f1f7" and "17dbb6a5aba29b75667a8a12b74b84fbb1e6d9c3" have entirely different histories.

27 changed files with 35710 additions and 399 deletions

2
.gitignore vendored
View file

@ -27,8 +27,6 @@ sponsorblock.txt
/qutebrowser/.config/qutebrowser/stylesheets
# ignore the generated readability file for webpages
readability.html
# ignore the adblock file generated by qutebrowser
blocked-hosts
# ignore vifm & ueberzug utility files
vifm-help.txt

View file

@ -17,7 +17,6 @@ aspell-de German dictionary for aspell R
aspell-en English dictionary for aspell R
atool A script for managing file archives of various types R
aubio A tool for extracting annotations from audio signals R
autofs A kernel-based automounter for Linux A
barrier Open-source KVM software based on Synergy (GUI) R
base Minimal package set to define a basic Arch Linux installation R
base-devel Basic tools to build Arch Linux packages R
@ -28,7 +27,7 @@ bat Cat clone with syntax highlighting and git integration R
bc An arbitrary precision calculator language R
beancount A personal double entry accounting and budgeting software P git+https://github.com/bratekarate/beancount-categorizer.git,beancount-dkb,fava,python-magic,smart-importer
bearssl Implementation of the SSL/TLS protocol (RFC 5246) written in C R
beets Organize your music collection from the command line P beetcamp,deets-describe,beets-ydl,pyacoustid,pylast
beets Organize your music collection from the command line P beetcamp
bemoji-git Emoji picker that remembers your favorites. A
bibclean BibTeX and Scribe bibliography prettyprinter and syntax checker A
biber A Unicode-capable BibTeX replacement for biblatex users R
@ -159,6 +158,7 @@ masterpdfeditor-free A complete solution for creation and editing PDF files - Fr
mbsync-git free (GPL) mailbox synchronization program A
mediainfo Supplies technical and tag information about a video or audio file (CLI interface) R
mermaid-cli Generation of diagram and flowchart from text in a similar manner as markdown (CLI) A
micro Modern and intuitive terminal-based text editor R
mimeo Open files by MIME-type or file name using regular expressions. A
minidlna A DLNA/UPnP-AV Media server (aka ReadyDLNA) R
minio-client Replacement for ls, cp, mkdir, diff and rsync commands for filesystems and object storage R
@ -219,7 +219,6 @@ perl-authen-sasl Perl/CPAN Module Authen::SASL : SASL authentication framework R
piavpn-bin Private Internet Access client A
pigz Parallel implementation of the gzip file compressor R
pipewire-alsa Low-latency audio/video router and processor - ALSA configuration R
pipewire-roc Low-latency audio/video router and processor - ROC streaming support R
playerctl mpris media player controller and lib for spotify, vlc, audacious, bmp, xmms2, and others. R
podman Tool and library for running OCI-based containers in pods R
powertop A tool to diagnose issues with power consumption and power management R
@ -291,7 +290,6 @@ task-spooler Queue up tasks from the shell for batch execution A
taskopen Script for taking notes and open urls with taskwarrior A
tasksh A shell command that wraps Taskwarrior commands A
tea A command line tool to interact with Gitea servers R
tectonic Modernized, complete, self-contained TeX/LaTeX engine, powered by XeTeX and TeXLive R
tex-gyre-fonts Substitute PostScript fonts in OpenType format R
texlab A cross-platform implementation of the Language Server Protocol for LaTeX. R
thermald The Linux Thermal Daemon program from 01.org R
@ -321,6 +319,7 @@ urlview-xdg-git A curses URL parser for text files. Git version, adds support fo
usql A universal command-line interface for SQL databases A
v4l2loopback-dkms v4l2-loopback device module sources R
vagrant Build and distribute virtualized development environments R
vale-bin A customizable, syntax-aware linter for prose A
vdirsyncer Synchronize CalDAV and CardDAV. R
viddy A modern watch command A
vifm A file manager with curses interface, which provides Vi[m]-like environment R

Can't render this file because it has a wrong number of fields in line 28.

View file

@ -79,9 +79,6 @@ riverctl map normal $mod+Shift P spawn "pass-pick"
# File upload
riverctl map normal $mod+Shift U spawn "$term -e --class float sharefile | xargs notify-send"
# Open recent downloads
riverctl map normal $mod+Shift D spawn "recently-downloaded"
# # Screenshot
riverctl map normal None Print spawn "screenshot"
riverctl map normal Shift Print spawn "screenshot | sharefile -"

View file

@ -1,3 +0,0 @@
-- help out mini.comment since the treesitter implementation does not have
-- comment functionality so far afaik
vim.bo.commentstring = "// %s"

View file

@ -22,48 +22,47 @@
"cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" },
"completion-vcard": { "branch": "master", "commit": "2220fd517a985ececed1adcf0e5be8f2815564c7" },
"dial.nvim": { "branch": "master", "commit": "54b503f906bc9e5ab85288414840a1b86d40769f" },
"dressing.nvim": { "branch": "master", "commit": "c0b67f3e2950adc07b555d3e73e38275b4a585ce" },
"dressing.nvim": { "branch": "master", "commit": "e6eff7a5a950a853c3903d906dbcea03f778db5f" },
"easyread.nvim": { "branch": "main", "commit": "0b07e315a4cd7d700c4a794bdddbec79fdc2628b" },
"fidget.nvim": { "branch": "main", "commit": "0ba1e16d07627532b6cae915cc992ecac249fb97" },
"friendly-snippets": { "branch": "main", "commit": "377d45475b49e37460a902d6d569d2093d4037d0" },
"friendly-snippets": { "branch": "main", "commit": "ea84a710262cb2c286d439070bad37d36fd3db25" },
"fwatch.nvim": { "branch": "main", "commit": "a691f7349dc66285cd75a1a698dd28bca45f2bf8" },
"git-conflict.nvim": { "branch": "main", "commit": "8d962d83cae924a314965f738ed1e05a4000d682" },
"gitsigns.nvim": { "branch": "main", "commit": "bb808fc7376ed7bac0fbe8f47b83d4bf01738167" },
"headlines.nvim": { "branch": "master", "commit": "74a083a3c32a08be24f7dfcc6f448ecf47857f46" },
"headlines.nvim": { "branch": "master", "commit": "ddef41b2664f0ce25fe76520d708e2dc9dfebd70" },
"jupyter-kernel.nvim": { "branch": "main", "commit": "5b409598033884a3d819e2a3bcd1fe340bc8d783" },
"lazy.nvim": { "branch": "main", "commit": "3ad55ae678876516156cca2f361c51f7952a924b" },
"lazy.nvim": { "branch": "main", "commit": "b7303a68309296fb4809c51ce0bf66722e5dc4f7" },
"lightspeed.nvim": { "branch": "main", "commit": "299eefa6a9e2d881f1194587c573dad619fdb96f" },
"lsp-setup.nvim": { "branch": "main", "commit": "64542fb0da06414cdfaa0c5236b743679bb7ba7f" },
"lsp_signature.nvim": { "branch": "master", "commit": "4665921ff8e30601c7c1328625b3abc1427a6143" },
"lualine.nvim": { "branch": "master", "commit": "45e27ca739c7be6c49e5496d14fcf45a303c3a63" },
"lualine.nvim": { "branch": "master", "commit": "05d78e9fd0cdfb4545974a5aa14b1be95a86e9c9" },
"magma-nvim-goose": { "branch": "main", "commit": "9a626aab63361d027541d023707f82e28d7f872c" },
"markdown-preview.nvim": { "branch": "master", "commit": "9becceee5740b7db6914da87358a183ad11b2049" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "e86a4c84ff35240639643ffed56ee1c4d55f538e" },
"mason-null-ls.nvim": { "branch": "main", "commit": "ae0c5fa57468ac65617f1bf821ba0c3a1e251f0c" },
"mason.nvim": { "branch": "main", "commit": "74eac861b013786bf231b204b4ba9a7d380f4bd9" },
"mason.nvim": { "branch": "main", "commit": "3f6b544c75c01549f7a2a9e395e0f1cea42b25dd" },
"mini.nvim": { "branch": "main", "commit": "296ebbbd3e5ba5e43f5125efe18ad76fe3b632cc" },
"null-ls.nvim": { "branch": "main", "commit": "0010ea927ab7c09ef0ce9bf28c2b573fc302f5a7" },
"nvim-base16": { "branch": "master", "commit": "6247ca9aa9f34644dfa290a6df3f6feefb73eb97" },
"nvim-cmp": { "branch": "main", "commit": "51f1e11a89ec701221877532ee1a23557d291dd5" },
"null-ls.nvim": { "branch": "main", "commit": "db09b6c691def0038c456551e4e2772186449f35" },
"nvim-base16": { "branch": "master", "commit": "4f3aa29f49b38edb6db1c52cea57e64ce3de2373" },
"nvim-cmp": { "branch": "main", "commit": "c4e491a87eeacf0408902c32f031d802c7eafce8" },
"nvim-colorizer.lua": { "branch": "master", "commit": "dde3084106a70b9a79d48f426f6d6fec6fd203f7" },
"nvim-lspconfig": { "branch": "master", "commit": "0d29cad8de3b2c654315203fc1fe12fde722a18a" },
"nvim-lspconfig": { "branch": "master", "commit": "dd11ba7b3c8f82d51b6d4dd7d68fce2d78bf78a0" },
"nvim-notify": { "branch": "master", "commit": "ea9c8ce7a37f2238f934e087c255758659948e0f" },
"nvim-surround": { "branch": "main", "commit": "0d6882635817a2677749a330127d12ac30a4f3c8" },
"nvim-surround": { "branch": "main", "commit": "211eaad7c6d01ef4ac02cba9052b3082ec232101" },
"nvim-toggleterm.lua": { "branch": "main", "commit": "b90a1381e9b5b8596f49070ee86c71db267ac868" },
"nvim-tree.lua": { "branch": "master", "commit": "18c7a3119839adc4599d838726deae662859c8b2" },
"nvim-treesitter": { "branch": "master", "commit": "63260da18bf273c76b8e2ea0db84eb901cab49ce" },
"nvim-treesitter-context": { "branch": "master", "commit": "d8fd71428e02190d8f75ff915b6cca9e3063992c" },
"nvim-treesitter-textsubjects": { "branch": "master", "commit": "df75fcec548014f158cda6498ac38c4622c221e1" },
"nvim-tree.lua": { "branch": "master", "commit": "3b62c6bf2c3f2973036aed609d02fd0ca9c3af35" },
"nvim-treesitter": { "branch": "master", "commit": "cc360a9beb1b30d172438f640e2c3450358c4086" },
"nvim-treesitter-context": { "branch": "master", "commit": "6f8f788738b968f24a108ee599c5be0031f94f06" },
"nvim-treesitter-textsubjects": { "branch": "master", "commit": "b913508f503527ff540f7fe2dcf1bf1d1f259887" },
"nvim-ts-autotag": { "branch": "main", "commit": "6be1192965df35f94b8ea6d323354f7dc7a557e4" },
"nvim-ts-context-commentstring": { "branch": "main", "commit": "e9062e2dfb9854e6a927370f2d720de354c88524" },
"nvim-ts-context-commentstring": { "branch": "main", "commit": "7f625207f225eea97ef7a6abe7611e556c396d2f" },
"nvim-ts-rainbow2": { "branch": "master", "commit": "b3120cd5ae9ca524af9cb602f41e12e301fa985f" },
"nvim-web-devicons": { "branch": "master", "commit": "ab899311f8ae00a47eae8e0879506cead8eb1561" },
"otter.nvim": { "branch": "main", "commit": "dda3359750a2f9c0d6ae073d967296f57fe99d8b" },
"nvim-web-devicons": { "branch": "master", "commit": "efbfed0567ef4bfac3ce630524a0f6c8451c5534" },
"otter.nvim": { "branch": "main", "commit": "0a32dbdd75730361a0a2d9746c48d9bdfcdf2cad" },
"playground": { "branch": "master", "commit": "2b81a018a49f8e476341dfcb228b7b808baba68b" },
"plenary.nvim": { "branch": "master", "commit": "253d34830709d690f013daf2853a9d21ad7accab" },
"popup.nvim": { "branch": "master", "commit": "b7404d35d5d3548a82149238289fa71f7f6de4ac" },
"quarto-nvim": { "branch": "main", "commit": "35f86035e7b3846dbf168267ffe0021c3d312259" },
"smartcolumn.nvim": { "branch": "main", "commit": "c2441d4490b7485844ac9ff2d44d882ff7536979" },
"smartcolumn.nvim": { "branch": "main", "commit": "0c572e3eae48874f25b74394a486f38cadb5c958" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "9bc8237565ded606e6c366a71c64c0af25cd7a50" },
"telescope.nvim": { "branch": "master", "commit": "776b509f80dd49d8205b9b0d94485568236d1192" },
"twilight.nvim": { "branch": "main", "commit": "8bb7fa7b918baab1ca81b977102ddb54afa63512" },

View file

@ -290,8 +290,6 @@ map(
{ silent = true, desc = "colorize background" }
)
map("n", "<leader>sa", "<cmd>FormatOnSave<cr>", { silent = true, desc = "toggle format on save" })
-- PLUGIN: undotree
if is_available("undotree") then
map("n", "<leader>su", function()

View file

@ -84,7 +84,7 @@ local globals = {
maplocalleader = ",",
tex_flavor = "latex",
format_on_save = false, -- from personal toggle function
format_on_save = true, -- from personal toggle function
}
for o, v in pairs(globals) do

View file

@ -32,7 +32,6 @@ local servers = {
marksman = {},
pyright = {},
ruff_lsp = {},
serve_d = {},
tailwindcss = {},
taplo = {},
texlab = {},

View file

@ -36,22 +36,3 @@ starter.setup({
})
vim.api.nvim_set_hl(0, "MiniCursorword", { bold = true })
require("mini.bracketed").setup({
{
buffer = { suffix = "b", options = {} },
comment = { suffix = "c", options = {} },
conflict = { suffix = "", options = {} },
diagnostic = { suffix = "d", options = {} },
file = { suffix = "f", options = {} },
indent = { suffix = "", options = {} }, -- disable since we use indentscope above
jump = { suffix = "j", options = {} },
location = { suffix = "l", options = {} },
oldfile = { suffix = "o", options = {} },
quickfix = { suffix = "q", options = {} },
treesitter = { suffix = "t", options = {} },
undo = { suffix = "", options = {} }, -- disable since I don't need it
window = { suffix = "w", options = {} },
yank = { suffix = "y", options = {} },
},
})

View file

@ -1,21 +1,4 @@
return {
{
"akinsho/git-conflict.nvim",
event = "VeryLazy",
config = function()
require("git-conflict").setup({
default_mappings = false,
disable_diagnostics = true,
})
vim.keymap.set("n", "<localleader>ho", "<Plug>(git-conflict-ours)", { desc = "Conflict use ours" })
vim.keymap.set("n", "<localleader>hO", "<Plug>(git-conflict-theirs)", { desc = "Conflict use theirs" })
vim.keymap.set("n", "<localleader>hm", "<Plug>(git-conflict-both)", { desc = "Conflict use both" })
vim.keymap.set("n", "<localleader>hM", "<Plug>(git-conflict-none)", { desc = "Conflict use none" })
vim.keymap.set("n", "[x", "<Plug>(git-conflict-prev-conflict)", { desc = "Prev git conflict" })
vim.keymap.set("n", "]x", "<Plug>(git-conflict-next-conflict)", { desc = "Next git conflict" })
end,
lazy = false, -- TODO needs to be force refreshed in lazy loaded mode unfortunately
},
{
"lewis6991/gitsigns.nvim", -- show vcs changes on left-hand gutter
event = "VeryLazy",
@ -41,7 +24,7 @@ return {
gs.next_hunk()
end)
return "<Ignore>"
end, { expr = true, desc = "Next git hunk" })
end, { expr = true })
map("n", "[h", function()
if vim.wo.diff then
@ -51,7 +34,7 @@ return {
gs.prev_hunk()
end)
return "<Ignore>"
end, { expr = true, desc = "Previous git hunk" })
end, { expr = true })
-- Actions
require("which-key").register({ ["<localleader>h"] = { name = "+git" } })

View file

@ -183,5 +183,3 @@ endogeneity
outliers
GitLab
Gitea
caramelization
Maillard

View file

@ -1,4 +1,4 @@
c.aliases["gem"] = "spawn --userscript qute-gemini "
c.aliases["gem"] = "hint links userscript qute-gemini"
# Use q for quitting a tab (mimicks vim buffer) - qa is used for exiting
c.aliases["q"] = "tab-close"
@ -38,4 +38,4 @@ c.aliases["taskadd"] = "spawn --userscript taskadd"
c.aliases["cookie-block"] = "spawn --userscript qute-cookie-block"
# open last downloads in dmenu-like
c.aliases["recent-downloads"] = "spawn --userscript recently-downloaded"
c.aliases["recent-downloads"] = "spawn --userscript open_download"

View file

@ -1,12 +1,15 @@
c.content.blocking.enabled = True
c.content.blocking.method = "both"
c.content.blocking.adblock.lists = [
"https://easylist.to/easylist/easylist.txt",
"https://easylist.to/easylist/easyprivacy.txt",
"https://www.malwaredomainlist.com/hostslist/hosts.txt",
"https://someonewhocares.org/hosts/hosts",
"https://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&mimetype=plaintext",
"https://secure.fanboy.co.nz/fanboy-cookiemonster.txt",
]
c.content.blocking.hosts.lists = [
"https://winhelp2002.mvps.org/hosts.zip",
"https://malwaredomains.lehigh.edu/files/justdomains.zip",
]
c.content.blocking.whitelist = ["piwik.org"]
c.content.autoplay = False
c.content.prefers_reduced_motion = True

View file

@ -6,7 +6,6 @@ lleader = ","
## CHANGED DEFAULTS
# rebind moving tabs to free for download
config.bind("gG", "tab-give")
# switch binds for scroll-marks and quick-/book-marks
@ -54,11 +53,6 @@ config.bind(lleader + "I", "spawn uoeia -v imv {url}")
config.bind(lleader + "i", "hint links spawn uoeia -v imv {hint-url}")
config.bind(lleader + "<Ctrl-i>", "hint images spawn uoeia -v imv {hint-url}")
# [G]emini shortcuts
# the full power of qutebrowser at your fingertips for any gemini page!
config.bind(f"{lleader}g", "hint all userscript qute-gemini")
config.bind(f"{lleader}G", "hint all userscript qute-gemini-tab")
# bind youtube-dl to download the current page/links
config.bind(lleader + "dM", "spawn vidl {url}")
config.bind(
@ -73,14 +67,13 @@ config.bind(lleader + "dp", "save-to-pdf", mode="normal")
config.bind("gD", "recent-downloads", mode="normal")
config.bind('"w', "add-wallabag", mode="normal") # add current page to wallabag
config.bind(';w', "hint links userscript wallabag_add.sh") # add link to wallabag
config.bind(";w", "hint links run add-wallabag") # add link to wallabag
config.bind('"s', "add-shaarli", mode="normal")
config.bind(';s', "hint links userscript shaarli_add.sh")
config.bind('"a', "send-to-archive", mode="normal")
config.bind('"t', "translate-page-google", mode="normal")
config.bind('"t', "translate-selection-google", mode="caret")
config.bind('"T', "translate-selection-google", mode="normal")
config.bind('"q', "show-qr")

File diff suppressed because it is too large Load diff

View file

@ -14,16 +14,15 @@ else:
PYPERCLIP = True
def parse_text_content(element) -> str:
def parse_text_content(element):
root = ET.fromstring(element)
text = ET.tostring(root, encoding="unicode", method="text")
text = html.unescape(text)
return text
def send_command_to_qute(command) -> None:
if fifo := os.environ.get("QUTE_FIFO"):
with open(fifo, "w") as f:
def send_command_to_qute(command):
with open(os.environ.get("QUTE_FIFO"), "w") as f:
f.write(command)
@ -33,7 +32,7 @@ def main():
# https://github.com/qutebrowser/qutebrowser/blob/master/doc/userscripts.asciidoc
element = os.environ.get("QUTE_SELECTED_HTML")
code_text = parse_text_content(element)
if pyperclip and PYPERCLIP:
if PYPERCLIP:
pyperclip.copy(code_text)
send_command_to_qute(
"message-info 'copied to clipboard: {info}{suffix}'".format(

View file

@ -42,7 +42,7 @@ elif command -v rofi >/dev/null 2>&1; then
)}
elif command -v bemenu >/dev/null 2>&1; then
ROFI_CMD="bemenu"
ROFI_ARGS="${ROFI_ARGS:--il 20}"
ROFI_ARGS="${ROFI_ARGS:--il 10}"
fi
msg() {

View file

@ -6,20 +6,6 @@
# SPDX-FileCopyrightText: 2020 petedussin
# SPDX-FileCopyrightText: 2020-2021 Sotiris Papatheodorou
# SPDX-License-Identifier: GPL-3.0-or-later
# 2022-2023 Marty Oehme (added stand-alone script capability)
# Use it as a qutebrowser userscript to open gemini pages:
# Put this file in qutebrowser userscript folder and call command
# `:spawn --userscript qute-gemini "gemini://my-gemini-url.org"`
# or
# `:hint links userscript qute-gemini` to open from selected link
# Rename file to `qute-gemini-tab` (or create symlink) to open
# any gemini url as a new tab.
# Since the script also opens normal URLs you can even replace your
# normal link hint mapping with it (usually f or F for tabbed) and
# 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 cgi
import html
@ -55,8 +41,7 @@ CSS
_status_code_desc = {
"1": "Gemini status code 1 Input. This is not implemented in qute-gemini.",
"10": "Gemini status code 10 Input. This is not implemented in qute-gemini.",
"11": """Gemini status code 11 Sensitive Input. This is not implemented
in qute-gemini.""",
"11": "Gemini status code 11 Sensitive Input. This is not implemented in qute-gemini.",
"3": "Gemini status code 3 Redirect. Stopped after "
+ str(_max_redirects)
+ " redirects.",
@ -68,41 +53,28 @@ _status_code_desc = {
+ " redirects.",
"4": "Gemini status code 4 Temporary Failure. Server message: META",
"40": "Gemini status code 40 Temporary Failure. Server message: META",
"41": """Gemini status code 41 Server Unavailable.
The server is unavailable due to overload or maintenance. Server message: META""",
"42": """Gemini status code 42 CGI Error.
A CGI process, or similar system for generating dynamic content,
died unexpectedly or timed out. Server message: META""",
"43": """Gemini status code 43 Proxy Error.
A proxy request failed because the server was unable to successfully
complete a transaction with the remote host. Server message: META""",
"44": """Gemini status code 44 Slow Down. Rate limiting is in effect.
Please wait META seconds before making another request to this server.""",
"41": "Gemini status code 41 Server Unavailable. The server is unavailable due to overload or maintenance. Server message: META",
"42": "Gemini status code 42 CGI Error. A CGI process, or similar system for generating dynamic content, died unexpectedly or timed out. Server message: META",
"43": "Gemini status code 43 Proxy Error. A proxy request failed because the server was unable to successfully complete a transaction with the remote host. Server message: META",
"44": "Gemini status code 44 Slow Down. Rate limiting is in effect. Please wait META seconds before making another request to this server.",
"5": "Gemini status code 5 Permanent Failure. Server message: META",
"50": "Gemini status code 50 Permanent Failure. Server message: META",
"51": """Gemini status code 51 Not Found. The requested resource could
not be found but may be available in the future. Server message: META""",
"52": """Gemini status code 52 Gone. The resource requested is no longer
available and will not be available again. Server message: META""",
"53": """Gemini status code 53 Proxy Request Refused. The request was for
a resource at a domain not served by the server and the server does
not accept proxy requests. Server message: META""",
"59": """Gemini status code 59 Bad Request. The server was unable to
parse the client's request, presumably due to a malformed request.
Server message: META""",
"6": """Gemini status code 6 Client Certificate Required.
This is not implemented in qute-gemini.""",
"51": "Gemini status code 51 Not Found. he requested resource could not be found but may be available in the future. Server message: META",
"52": "Gemini status code 52 Gone. The resource requested is no longer available and will not be available again. Server message: META",
"53": "Gemini status code 53 Proxy Request Refused. The request was for a resource at a domain not served by the server and the server does not accept proxy requests. Server message: META",
"59": "Gemini status code 59 Bad Request. The server was unable to parse the client's request, presumably due to a malformed request. Server message: META",
"6": "Gemini status code 6 Client Certificate Required. This is not implemented in qute-gemini.",
}
def qute_url() -> str:
"""Get the URL passed to the script by qutebrowser."""
return os.environ.get("QUTE_URL", "")
return os.environ["QUTE_URL"]
def qute_fifo() -> str:
"""Get the FIFO or file to write qutebrowser commands to."""
return os.environ.get("QUTE_FIFO", "")
return os.environ["QUTE_FIFO"]
def html_href(url: str, description: str) -> str:
@ -146,7 +118,7 @@ def gemini_fetch_url(url: str) -> Tuple[str, str, str, str, str]:
url = "gemini://" + url
parsed_url = urllib.parse.urlparse(url)
if parsed_url.scheme != "gemini":
return "", "Received non-gemini:// URL: " + url, "59", "", "Non-gemini URL"
return "", "Received non-gemini:// URL: " + url
if parsed_url.port is not None:
useport = parsed_url.port
else:
@ -242,15 +214,15 @@ def gemtext_to_html(
pass
# Link
elif line.startswith("=>"):
ln = line[2:].split(None, 1)
l = line[2:].split(None, 1)
# Use the URL itself as the description if there is none
if len(ln) == 1:
ln.append(ln[0])
if len(l) == 1:
l.append(l[0])
# Encode the link description
ln[1] = html.escape(ln[1])
l[1] = html.escape(l[1])
# Resolve relative URLs
ln[0] = gemini_absolutise_url(url, ln[0])
lines.append("\t\t<p>" + html_href(ln[0], ln[1]) + "</p>")
l[0] = gemini_absolutise_url(url, l[0])
lines.append("\t\t<p>" + html_href(l[0], l[1]) + "</p>")
# Preformated toggle
elif line.startswith("```"):
if in_pre:
@ -344,7 +316,7 @@ def qute_error_page(url: str, description: str) -> str:
return "data:text/html;charset=UTF-8," + urllib.parse.quote(html_page)
def open_gemini(url: str) -> str:
def open_gemini(url: str, open_args: str) -> None:
"""Open Gemini URL in qutebrowser."""
# Get the Gemini content
content, content_url, status, meta, error_msg = gemini_fetch_url(url)
@ -356,43 +328,30 @@ def open_gemini(url: str) -> str:
tmpf = tempfile.NamedTemporaryFile("w", suffix=".html", delete=False)
tmp_filename = tmpf.name
tmpf.close()
if not tmp_filename:
return ""
with open(tmp_filename, "w") as f:
f.write(gemtext_to_html(content, content_url, url, status, meta))
open_url = " file://" + tmp_filename
# Open the HTML file in qutebrowser
return open_url
with open(qute_fifo(), "w") as qfifo:
qfifo.write("open " + open_args + open_url)
def open_url(url: str, open_args: str) -> None:
parsed_url = urllib.parse.urlparse(url)
if parsed_url.scheme == "gemini":
to_open = open_gemini(url)
else:
to_open = url
if not to_open:
return
fifo = qute_fifo()
if fifo and fifo != "":
with open(fifo, "w") as qfifo:
qfifo.write(f"open {open_args} {to_open}")
return
os.system(f"xdg-open {to_open}")
def open_other(url: str, open_args: str) -> None:
"""Open non-Gemini URL in qutebrowser."""
with open(qute_fifo(), "w") as qfifo:
qfifo.write("open " + open_args + " " + url)
if __name__ == "__main__":
# Open in the current or a new tab depending on the script name
if sys.argv[0].endswith("-tab"):
open_args = "-b -r"
open_args = "-t"
else:
open_args = ""
# Take url to open as argument or from qutebrowser url
if len(sys.argv) > 1:
url = sys.argv[1]
else:
url = qute_url()
# Select how to open the URL depending on its scheme
open_url(url, open_args)
url = qute_url()
parsed_url = urllib.parse.urlparse(url)
if parsed_url.scheme == "gemini":
open_gemini(url, open_args)
else:
open_other(url, open_args)

View file

@ -1 +0,0 @@
../../../bin/recently-downloaded

View file

@ -1,27 +1,4 @@
#! /usr/bin/env bash
#
# Send current page/link to a shaarli instance.
#
# Can be used for sending the current page via:
# :spawn --userscript shaarli_add.sh
# for sending an arbitrary page passed as argument:
# :spawn --userscript shaarli_add.sh https://myinterestingpage.com
# or for sending a hinted link:
# :hint links userscript shaarli_add.sh
#
# Configure your shaarli instance with this:
SHAARLI_INSTANCE="https://links.martyoeh.me"
# send page to shaarli instance and open the 'post' page to edit it
if [ "$#" -gt 0 ]; then
BM="$SHAARLI_INSTANCE/?post=$*"
else
BM="$SHAARLI_INSTANCE/?post=$QUTE_URL"
fi
if [ -n "$QUTE_FIFO" ]; then
echo "open -t -r $BM" >>"$QUTE_FIFO"
else
xdg-open "$BM"
fi
#! /usr/bin/bash
# send current page to my personal shaarli instance and open the 'post' page to edit it
echo "open https://links.martyoeh.me/?post=$QUTE_URL" >>"$QUTE_FIFO"

View file

@ -3,7 +3,6 @@
# Translate the page, or if `--text` argument is given the current selection, with google translate.
#
# Adapted code from https://github.com/AckslD/Qute-Translate, with much gratitude.
PAGE="https://lingva.garudalinux.org/SOURCELANGUAGE/TARGETLANGUAGE/TRANSLATETEXT"
while [ $# -gt 0 ]; do
case $1 in
@ -39,13 +38,14 @@ fi
if [ "$QUTE_TRANS_URL" = "false" ]; then
# Translate selected text
PAGE=$(echo "$PAGE" | sed -e "s/SOURCELANGUAGE/$QUTE_TRANS_SOURCE/" -e "s/TARGETLANGUAGE/$QUTE_TRANS_TARGET/" -e "s/TRANSLATETEXT/$QUTE_SELECTED_TEXT/")
echo "open -t ${PAGE}" >>"$QUTE_FIFO"
PAGE="https://translate.google.com/#view=home&op=translate&"
CONT_KEY="text"
CONTENT=$QUTE_SELECTED_TEXT
else
# Default translate URL
PAGE="https://translate.google.com/translate?"
CONT_KEY="u"
CONTENT="$QUTE_URL"
echo "open -t ${PAGE}sl=${QUTE_TRANS_SOURCE}&tl=${QUTE_TRANS_TARGET}&${CONT_KEY}=\"${CONTENT}\"" >>"$QUTE_FIFO"
CONTENT=$QUTE_URL
fi
echo "open -t ${PAGE}sl=$QUTE_TRANS_SOURCE&tl=$QUTE_TRANS_TARGET&$CONT_KEY=$CONTENT" >>"$QUTE_FIFO"

View file

@ -1,4 +1,4 @@
#! /usr/bin/env bash
#! /usr/bin/bash
#
# Send current page/link to a wallabag instance.
#
@ -14,13 +14,7 @@ WALLABAG_INSTANCE="https://read.martyoeh.me"
# only works for wallabag v2.*
if [ "$#" -gt 0 ]; then
BM="$WALLABAG_INSTANCE/bookmarklet?url=$*"
echo "open -b -r $WALLABAG_INSTANCE/bookmarklet?url=$*" >>"$QUTE_FIFO"
else
BM="$WALLABAG_INSTANCE/bookmarklet?url=$QUTE_URL"
fi
if [ -n "$QUTE_FIFO" ]; then
echo "open -b -r $BM" >>"$QUTE_FIFO"
else
xdg-open "$BM"
echo "open -b -r $WALLABAG_INSTANCE/bookmarklet?url=$QUTE_URL" >>"$QUTE_FIFO"
fi

View file

@ -37,6 +37,41 @@ test "$XDG_BIN_HOME" || export XDG_BIN_HOME="$HOME/.local/bin"
# anything on BIN_HOME should be executable form anywhere
export PATH="$PATH:$XDG_BIN_HOME"
xdg_isThere() {
if [ -e "$1" ] || [ -h "$1" ]; then
true
else
false
fi
}
xdg_makeForUser() {
mkdir -p "$1"
chmod 0700 "$1"
}
if [ -h "$XDG_MEDIA_DIR" ] && [ ! -e "$XDG_MEDIA_DIR" ]; then
rm "$XDG_MEDIA_DIR"
xdg_makeForUser "$XDG_MEDIA_DIR"
fi
## ensure directories exist
xdg_isThere "$XDG_BIN_HOME" || xdg_makeForUser "$XDG_BIN_HOME"
xdg_isThere "$XDG_CACHE_HOME" || xdg_makeForUser "$XDG_CACHE_HOME"
xdg_isThere "$XDG_CONFIG_HOME" || xdg_makeForUser "$XDG_CONFIG_HOME"
xdg_isThere "$XDG_DATA_HOME" || xdg_makeForUser "$XDG_DATA_HOME"
# create xdg-user-dirs if necessary
xdg_isThere "$XDG_DESKTOP_DIR" || xdg_makeForUser "$XDG_DESKTOP_DIR"
xdg_isThere "$XDG_DOCUMENTS_DIR" || xdg_makeForUser "$XDG_DOCUMENTS_DIR"
xdg_isThere "$XDG_DOWNLOAD_DIR" || xdg_makeForUser "$XDG_DOWNLOAD_DIR"
xdg_isThere "$XDG_MUSIC_DIR" || xdg_makeForUser "$XDG_MUSIC_DIR"
xdg_isThere "$XDG_PICTURES_DIR" || xdg_makeForUser "$XDG_PICTURES_DIR"
xdg_isThere "$XDG_VIDEOS_DIR" || xdg_makeForUser "$XDG_VIDEOS_DIR"
xdg_isThere "$XDG_PROJECTS_DIR" || xdg_makeForUser "$XDG_PROJECTS_DIR"
unset -f xdg_isThere xdg_makeForUser
## Applications that can be set through environment variables
export ANDROID_HOME="$XDG_DATA_HOME/android"
export ATOM_HOME="$XDG_DATA_HOME/atom"

View file

@ -25,37 +25,18 @@ documentlist:
rowstyle: white_bg
separator: " \u2502 "
keymappings:
' ': mark_down
' ': mark_selected
/: search_mode
<key_down>: scroll_down
<key_up>: scroll_up
<ctrl-f>: page_down
<ctrl-b>: page_up
'?': help
G: jump_to_bottom
e: edit
gg: jump_to_top
j: scroll_down
k: scroll_up
o: open
e: edit
n: papis edit -n papis_id:{doc['papis_id']}
q: quit
t: tag
ii:
- info_toggle
- "Toggle info window"
ij:
- info_cycle
- "Cycle info windows"
infowindow:
default_on: False
views:
apa:
content: "{format_reference(doc)}"
abstract:
content: "{doc['abstract']}"
linewrap: True
height: 8
statusbar:
left:
default: <black_white> {info["mode_upper"]} <black_white>

View file

@ -3,25 +3,13 @@
#
# This tiny script updates all libraries by rebuilding their caches.
# Useful to invoke after manual edits in one of your library folders
# if you have many 'sub-libraries' (one library location with sub-
# directories).
# You don't have to think about which library you changed stuff in
# so you don't have to think about which library you changed stuff in
# and just get everything updated. Might take a little time but
# should generally be a quick process ().
# should generally be a quick process (even with 1000s of entries).
import papis.api
from argparse import ArgumentParser
parser = ArgumentParser()
parser.add_argument(
"--all", "-a", help="reload all libraries not just current", action="store_true"
)
args = parser.parse_args()
if args.all:
libs = papis.api.get_libraries()
else:
libs = [papis.api.get_lib_name()]
for lib in libs:
papis.api.clear_lib_cache(lib)

View file

@ -1,116 +1,6 @@
#!/usr/bin/env python
#!/usr/bin/env bash
# papis-short-help: Display pretty human-readable document overview
#
# Takes a query and displays the metadata of the results. Uses
# python-rich to display pretty panels if it exists in the environment,
# otherwise displays regular text.
# Can be invoked with -s to display single-line results better for
# pasting into other documents.
# TODO strip {} from bibtex entries to really pretty print
import argparse
from importlib.util import find_spec
from papis import database
from papis.database.base import Database
from papis.document import Document
from dataclasses import dataclass, field
parser = argparse.ArgumentParser()
parser.add_argument(
"--short", "-s", help="only display single-line quick info", action="store_true"
)
parser.add_argument(
"--url",
dest="identifier",
help="display identifier (doi, isbn, url) or not",
action=argparse.BooleanOptionalAction,
default=True,
)
parser.add_argument("query", nargs="*", help="the query to search for")
args = parser.parse_args()
@dataclass
class DocInfo:
author: str = ""
title: str = ""
year: str = ""
journal: str = ""
volume: str = ""
issue: str = ""
pages: str = ""
publisher: str = ""
tags: list = field(default_factory=lambda: [])
dtype: str = ""
identifier: str = ""
doi: str = ""
@staticmethod
def from_Document(doc: Document):
t: list[str] | str = doc.get("tags", "")
tags = (
t.replace(";", ",").replace(" ", "").split(",") if isinstance(t, str) else t
)
return DocInfo(
author=doc.get("author", ""),
title=doc.get("title", ""),
year=doc.get("year", ""),
journal=doc.get("journal", ""),
volume=doc.get("volume", ""),
issue=doc.get("issue", ""),
pages=doc.get("pages", ""),
publisher=doc.get("publisher", ""),
tags=tags,
dtype=doc.get("type", ""),
identifier=doc.get("doi", doc.get("isbn", doc.get("url", ""))),
)
def main(db: Database, args) -> None:
query = " ".join(args.query)
docs: list[Document] = db.query(query)
for doc in docs:
info = DocInfo.from_Document(doc)
if args.short:
print_short(info, with_identifier=args.identifier)
else:
print_info(info, with_identifier=args.identifier)
def print_short(doc: DocInfo, with_identifier: bool = True) -> None:
print(
f"{doc.author} ({doc.year}). {doc.title}. "
f"{doc.identifier if with_identifier else ''}\n"
)
def print_info(doc: DocInfo, with_identifier: bool = True) -> None:
if find_spec("rich"):
from rich import print as richprint
from rich.panel import Panel
info: str = (
f"[red]{doc.author}[/red] ({doc.year}) "
f"[steel_blue]\\[{doc.dtype}][/steel_blue]\n"
f"[bold]{doc.title}[/bold]\n"
f"{doc.journal} ({doc.volume}/{doc.issue}){doc.pages} - {doc.publisher}\n"
f"[grey69]{[tag for tag in doc.tags]} "
)
if with_identifier:
info += f"[link={doc.identifier}]{doc.identifier}[/link][/grey69]"
richprint(Panel(info, expand=False))
else:
info: str = (
f"{doc.author} ({doc.year}) "
f"[{doc.dtype}]\n"
f"{doc.title}\n"
f"{doc.journal} ({doc.volume}/{doc.issue}){doc.pages} - {doc.publisher}\n"
f"{[tag for tag in doc.tags]} "
f"{doc.identifier}"
if with_identifier
else ""
)
print(f"{info}\n---")
if __name__ == "__main__":
main(database.get(), args)
papis -l "${PAPIS_LIB}" list --format "{doc[author]} ({doc[year]}). {doc[title]}." "$@"

View file

@ -1,39 +0,0 @@
#!/usr/bin/env python
# papis-short-help: List all tags occuring in query items
#
# Takes a query and spits out a sorted list of all tags contained therein,
# nothing more.
# Can be very useful for things like picking a tag or two and listing all
# items that contain it:
# $ papis tags "*" | fzf | xargs papis show "tags:{}"
import argparse
from papis import database
from papis.database.base import Database
from papis.document import Document
parser = argparse.ArgumentParser()
parser.add_argument("query", nargs="*", help="the query to search for")
args = parser.parse_args()
def main(db: Database, args) -> None:
query = " ".join(args.query)
docs: list[Document] = db.query(query)
all_tags: set[str] = set()
for doc in docs:
t: list[str] | str = doc.get("tags", "")
tags = (
t.replace(";", ",").replace(" ", "").split(",") if isinstance(t, str) else t
)
for tag in tags:
all_tags.add(tag)
for tag in sorted(all_tags):
print(tag)
if __name__ == "__main__":
main(database.get(), args)