]> git.madduck.net Git - etc/tridactyl.git/commitdiff

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

initial checkin main
authormartin f. krafft <madduck@madduck.net>
Sat, 24 May 2025 04:46:55 +0000 (06:46 +0200)
committermartin f. krafft <madduck@madduck.net>
Sat, 24 May 2025 04:46:55 +0000 (06:46 +0200)
.config/tridactyl/edit-and-backup [new file with mode: 0755]
.config/tridactyl/tridactylrc [new file with mode: 0644]
.gitignore.d/tridactyl [new file with mode: 0644]

diff --git a/.config/tridactyl/edit-and-backup b/.config/tridactyl/edit-and-backup
new file mode 100755 (executable)
index 0000000..c1244df
--- /dev/null
@@ -0,0 +1,53 @@
+#!/bin/sh
+#
+# edit-and-backup
+#
+# Wrapper for Tridactyl's $editorcmd, which saves a backup before returning
+# to Tridactyl.
+#
+# © 2021–5 martin f. krafft <madduck@madduck.net>
+# Released under the Apache Licence 2.0.
+#
+set -eu
+
+BACKUPDIR=${TMPDIR:-/tmp}/tridactyl-backups
+mkdir --parent $BACKUPDIR
+
+FILENAME="$1"
+EDITOR="${2:-editor}"
+
+URL="${FILENAME#*_}"
+URL="${URL%%_*}"
+
+if [ -t 0 ]; then
+  echo -n "\033]0;Tridactyl: editing input field on $URL using ${EDITOR%% *}\007"
+fi
+
+set -x
+eval "$EDITOR" "$FILENAME"
+
+notify() {
+  local summary
+  summary="$1"
+  shift
+  if command -v notify-send >/dev/null; then
+    notify-send "$summary" "$@"
+  else
+    echo >&2 "$summary" "$@"
+  fi
+}
+
+if [ -s "$FILENAME" ]; then
+
+  BACKUPFILE="$(mktemp --tmpdir="$BACKUPDIR" $URL-$(date +%F-%H%M.%N)-XXXXXXXX.txt)"
+  cat "$FILENAME" >"$BACKUPFILE"
+
+  notify "Tridactyl backup saved" "Saved a backup of your edits to $BACKUPFILE"
+
+else
+
+  notify "Nothing to be saved"
+
+fi
+
+exit 0
diff --git a/.config/tridactyl/tridactylrc b/.config/tridactyl/tridactylrc
new file mode 100644 (file)
index 0000000..055ab81
--- /dev/null
@@ -0,0 +1,21 @@
+sanitize tridactylsync tridactyllocal
+
+set editorcmd x-terminal-emulator -name tridactyl-edit -e ~/.config/tridactyl/edit-and-backup
+
+set searchengine brave
+set searchurls.pad https://pad.riseup.net/p/%s
+set searchurls.tunes https://tunes.madduck.net/artists/%s/
+
+set theme dark
+
+set modeindicator false
+
+bind <C-1> tabnext_gt 1
+bind <C-2> tabnext_gt 2
+bind <C-3> tabnext_gt 3
+bind <C-4> tabnext_gt 4
+bind <C-5> tabnext_gt 5
+bind <C-6> tabnext_gt 6
+bind <C-7> tabnext_gt 7
+bind <C-8> tabnext_gt 8
+bind <C-9> tabnext_gt 9
diff --git a/.gitignore.d/tridactyl b/.gitignore.d/tridactyl
new file mode 100644 (file)
index 0000000..2f817e8
--- /dev/null
@@ -0,0 +1,3 @@
+*
+!/.config/tridactyl/edit-and-backup
+!/.config/tridactyl/tridactylrc