adde latex lsp and language
This commit is contained in:
@@ -1,7 +0,0 @@
|
||||
hydroxide serve &
|
||||
|
||||
kanata --cfg ~/.config/kanata/config.kbd &
|
||||
|
||||
sudo mount -a &
|
||||
|
||||
syncthing &
|
||||
3
scripts/scripts/latex.sh
Executable file
3
scripts/scripts/latex.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
pdflatex "$1" && zathura "${1%.tex}.pdf" &
|
||||
|
||||
|
||||
23
scripts/scripts/move-trash.sh
Executable file
23
scripts/scripts/move-trash.sh
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Get the current message's notmuch ID from aerc's environment
|
||||
# We'll use notmuch to find and move the file
|
||||
|
||||
maildir="$HOME/.local/share/mail"
|
||||
|
||||
# Find files for messages in current thread that aren't already in Trash
|
||||
notmuch search --output=files thread:{} 2>/dev/null | while read filepath; do
|
||||
# Skip if already in Trash
|
||||
if [[ "$filepath" == *"/Trash/"* ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
if [[ -f "$filepath" ]]; then
|
||||
filename=$(basename "$filepath")
|
||||
mkdir -p "$maildir/Trash/cur"
|
||||
mv "$filepath" "$maildir/Trash/cur/$filename"
|
||||
fi
|
||||
done
|
||||
|
||||
# Re-index
|
||||
notmuch new >/dev/null 2>&1
|
||||
35
scripts/scripts/new-sync.sh
Executable file
35
scripts/scripts/new-sync.sh
Executable file
@@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
MBSYNC=$(pgrep mbsync)
|
||||
NOTMUCH=$(pgrep notmuch)
|
||||
if [ -n "$MBSYNC" -o -n "$NOTMUCH" ]; then
|
||||
echo "Already running one instance of mbsync or notmuch. Exiting..."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
maildir="$HOME/.local/share/mail"
|
||||
|
||||
echo "Moving messages tagged as *deleted* to Trash"
|
||||
notmuch search --format=text0 --output=files tag:deleted | while IFS= read -r -d '' filepath; do
|
||||
# Skip if already in Trash
|
||||
case "$filepath" in
|
||||
*/Trash/*)
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
|
||||
# Move to Trash if file exists
|
||||
if [ -f "$filepath" ]; then
|
||||
filename=$(basename "$filepath")
|
||||
mkdir -p "$maildir/Trash/cur"
|
||||
mv -v "$filepath" "$maildir/Trash/cur/$filename"
|
||||
fi
|
||||
done
|
||||
|
||||
mbsync -Va
|
||||
notmuch new
|
||||
PYTHONWARNINGS="ignore::UserWarning" afew --tag --new
|
||||
|
||||
# Auto-tag and cleanup
|
||||
notmuch tag +sent -- folder:Sent and not tag:sent
|
||||
notmuch tag +trash -- folder:Trash and not tag:trash
|
||||
notmuch tag -deleted -- folder:Trash
|
||||
15
scripts/scripts/new-sync_1.sh
Executable file
15
scripts/scripts/new-sync_1.sh
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
|
||||
MBSYNC=$(pgrep mbsync)
|
||||
NOTMUCH=$(pgrep notmuch)
|
||||
|
||||
if [ -n "$MBSYNC" -o -n "$NOTMUCH" ]; then
|
||||
echo "Already running one instance of mbsync or notmuch. Exiting..."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "Deleting messages tagged as *deleted*"
|
||||
notmuch search --format=text0 --output=files tag:deleted | xargs -0 --no-run-if-empty rm -v
|
||||
|
||||
mbsync -Va
|
||||
notmuch new
|
||||
@@ -1,89 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Configuration variables - change this for your setup
|
||||
gluetun_container_name="gluetun"
|
||||
qbittorrent_container_name="qbittorrent"
|
||||
gluetun_origin="http://100.120.152.94:8888"
|
||||
qb_origin="http://100.120.152.94:8099"
|
||||
####################################################################
|
||||
|
||||
# Arrays for URLs
|
||||
declare -A gluetun_urls=(
|
||||
["pub_ip"]="$gluetun_origin/v1/publicip/ip"
|
||||
["portforwarded"]="$gluetun_origin/v1/openvpn/portforwarded"
|
||||
)
|
||||
|
||||
declare -A qbittorrent_urls=(
|
||||
#used for getting and setting listen_port
|
||||
["prefs"]="$qb_origin/api/v2/app/preferences"
|
||||
["setPrefs"]="$qb_origin/api/v2/app/setPreferences"
|
||||
)
|
||||
|
||||
|
||||
# Function to check if a Docker container is running
|
||||
is_container_running() {
|
||||
local container_name="$1"
|
||||
docker inspect -f '{{.State.Running}}' "$container_name" 2>/dev/null
|
||||
# echo "Container $container_name status: $status"
|
||||
}
|
||||
|
||||
get_vpn_external_ip() {
|
||||
local url="$1"
|
||||
curl -s "$url" | -r .'public_ip'
|
||||
}
|
||||
|
||||
# Function to send a GET request and extract the port from the response
|
||||
get_port_from_url() {
|
||||
local url="$1"
|
||||
local port_key
|
||||
|
||||
# Try 'port' key first
|
||||
port_key=$(curl -s "$url" | jq -r '.port')
|
||||
|
||||
if [ "$port_key" == "null" ]; then
|
||||
# If 'port' key is null, try 'listen_port' key
|
||||
port_key=$(curl -s "$url" | jq -r '.listen_port')
|
||||
fi
|
||||
|
||||
echo "$port_key"
|
||||
}
|
||||
|
||||
# Function to send a POST request with JSON data
|
||||
send_post_request() {
|
||||
local url="$1"
|
||||
local port="$2"
|
||||
curl -s -X POST -d json={\"listen_port\":$port} "$url"
|
||||
}
|
||||
|
||||
# Outputs container names
|
||||
echo "Gluetun container name: $gluetun_container_name - Gluetun Origin URL: $gluetun_origin"
|
||||
echo "qBittorrent container name: $qbittorrent_container_name - qBittorrent Origin URL: $qb_origin"
|
||||
|
||||
# Check if both containers are running
|
||||
if [[ $(is_container_running "$gluetun_container_name") == $(is_container_running "$qbittorrent_container_name") ]]; then
|
||||
echo "Both Gluetun and qBittorrent containers are running. Continuing."
|
||||
|
||||
external_ip=$(get_vpn_external_ip "${gluetun_urls["pub_ip"]}")
|
||||
if [ -z "$external_ip" ]; then
|
||||
echo "External IP is empty. Exiting script due to potential VPN or internet connection issue."
|
||||
exit 1
|
||||
else
|
||||
echo "External IP is $external_ip therefore VPN is up"
|
||||
fi
|
||||
|
||||
gluetun_port=$(get_port_from_url "${gluetun_urls["portforwarded"]}")
|
||||
qbittorrent_port=$(get_port_from_url "${qbittorrent_urls["prefs"]}")
|
||||
|
||||
echo "Gluetun forwarded port is $gluetun_port"
|
||||
echo "qBittorrent listen port is $qbittorrent_port"
|
||||
if [ "$gluetun_port" -eq "$qbittorrent_port" ]; then
|
||||
echo "qBittorrent listen port is already set to $qbittorrent_port. No need to change. Exiting script."
|
||||
else
|
||||
echo "Updating qBittorrent listen port to Gluetun forwarded port $gluetun_port."
|
||||
send_post_request "${qbittorrent_urls["setPrefs"]}" "$gluetun_port"
|
||||
qbittorrent_port=$(get_port_from_url "${qbittorrent_urls["prefs"]}")
|
||||
echo "qBittorrent listen port updated to $qbittorrent_port. Exiting script."
|
||||
fi
|
||||
else
|
||||
echo "Either Gluetun or qBittorrent container is not running. Exiting script."
|
||||
fi
|
||||
25
scripts/scripts/sig-picker.sh
Executable file
25
scripts/scripts/sig-picker.sh
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
read input
|
||||
|
||||
case "$input" in
|
||||
"liiph@proton.me")
|
||||
cat ~/.config/aerc/sigs/liph.txt
|
||||
;;
|
||||
"liiph@protonmail.com")
|
||||
cat ~/.config/aerc/sigs/liph.txt
|
||||
;;
|
||||
"liiph@pm.me")
|
||||
cat ~/.config/aerc/sigs/liph.txt
|
||||
;;
|
||||
"ph.waibel@proton.me")
|
||||
cat ~/.config/aerc/sigs/formal.txt
|
||||
;;
|
||||
"ph.waibel@pm.me")
|
||||
cat ~/.config/aerc/sigs/phil.txt
|
||||
;;
|
||||
*)
|
||||
# Default signature if no match
|
||||
cat ~/.config/aerc/sigs/default.txt
|
||||
;;
|
||||
esac
|
||||
41
scripts/scripts/sync-mail.sh
Executable file
41
scripts/scripts/sync-mail.sh
Executable file
@@ -0,0 +1,41 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Sync mail from ProtonMail Bridge (suppress CLOSE error)
|
||||
echo "Syncing mail from ProtonMail..."
|
||||
mbsync -a 2>&1 | grep -v "CLOSE"
|
||||
|
||||
# Index new mail (this automatically runs post-new hook)
|
||||
echo "Indexing new messages..."
|
||||
notmuch new
|
||||
|
||||
# Move all deleted messages to Trash folder
|
||||
echo "Cleaning up deleted messages..."
|
||||
DELETED_COUNT=0
|
||||
notmuch search --output=files tag:deleted 2>/dev/null | while read filepath; do
|
||||
if [ -f "$filepath" ]; then
|
||||
TRASH_DIR="$HOME/.local/share/mail/Trash/cur"
|
||||
mkdir -p "$TRASH_DIR"
|
||||
|
||||
FILENAME=$(basename "$filepath")
|
||||
mv "$filepath" "$TRASH_DIR/$FILENAME"
|
||||
((DELETED_COUNT++))
|
||||
fi
|
||||
done
|
||||
|
||||
# Update notmuch after moving files
|
||||
if [ $DELETED_COUNT -gt 0 ]; then
|
||||
echo "Moved $DELETED_COUNT message(s) to Trash"
|
||||
notmuch new --no-hooks >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
# Sync moved messages back to ProtonMail
|
||||
echo "Syncing changes to ProtonMail..."
|
||||
mbsync -a 2>&1 | grep -v "CLOSE" >/dev/null
|
||||
|
||||
# Notify if new mail
|
||||
NEW=$(notmuch count tag:unread)
|
||||
if [ $NEW -gt 0 ]; then
|
||||
notify-send "📬 Mail" "$NEW unread message(s)"
|
||||
fi
|
||||
|
||||
echo "Sync complete: $(date)"
|
||||
47
scripts/scripts/trash-message.sh
Executable file
47
scripts/scripts/trash-message.sh
Executable file
@@ -0,0 +1,47 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Save the piped message to temp file
|
||||
TEMP_MSG=$(mktemp)
|
||||
cat > "$TEMP_MSG"
|
||||
|
||||
# Extract Message-ID more robustly
|
||||
MESSAGE_ID=$(grep -i "^Message-ID:" "$TEMP_MSG" | head -1 | sed 's/^[Mm]essage-[Ii][Dd]: *//; s/^<//; s/>$//' | tr -d '\r\n ')
|
||||
|
||||
# Cleanup temp file
|
||||
rm "$TEMP_MSG"
|
||||
|
||||
if [ -z "$MESSAGE_ID" ]; then
|
||||
notify-send "Error" "Could not find Message-ID"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Get file path from notmuch
|
||||
FILEPATH=$(notmuch search --output=files "id:$MESSAGE_ID" 2>/dev/null | head -1)
|
||||
|
||||
if [ -z "$FILEPATH" ] || [ ! -f "$FILEPATH" ]; then
|
||||
# Try alternative search
|
||||
FILEPATH=$(notmuch search --output=files --exclude=false "*" 2>/dev/null | xargs grep -l "Message-ID.*$MESSAGE_ID" 2>/dev/null | head -1)
|
||||
fi
|
||||
|
||||
if [ -z "$FILEPATH" ] || [ ! -f "$FILEPATH" ]; then
|
||||
notify-send "Error" "File not found for Message-ID: $MESSAGE_ID"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Move to Trash folder
|
||||
TRASH_DIR="$HOME/.local/share/mail/Trash/cur"
|
||||
mkdir -p "$TRASH_DIR"
|
||||
|
||||
FILENAME=$(basename "$FILEPATH")
|
||||
mv "$FILEPATH" "$TRASH_DIR/$FILENAME"
|
||||
|
||||
# Update notmuch database
|
||||
notmuch new --no-hooks >/dev/null 2>&1
|
||||
|
||||
# Tag as deleted
|
||||
notmuch tag +deleted +trash -inbox -unread -- "id:$MESSAGE_ID" >/dev/null 2>&1
|
||||
|
||||
# Trigger sync in background
|
||||
(sleep 2 && mbsync -a 2>&1 | grep -v CLOSE >/dev/null) &
|
||||
|
||||
notify-send "📧 Aerc" "Moved to Trash"
|
||||
Reference in New Issue
Block a user