scripts: battery-notify and view-md-in-browser

This commit is contained in:
Joseph Ferano 2025-10-13 10:44:00 +07:00
parent 8213453bce
commit ba998e252c
2 changed files with 26 additions and 0 deletions

View File

@ -0,0 +1,11 @@
#!/bin/bash
BATTERY_LEVEL=$(upower -i $(upower -e | grep 'BAT') | grep -E "percentage" | awk '{print $2}' | sed 's/%//')
if [ $BATTERY_LEVEL -le 5 ]; then
notify-send "Low Battery" "Battery level is ${BATTERY_LEVEL}%" -u critical
exit
fi
if [ $BATTERY_LEVEL -le 10 ]; then
notify-send "Low Battery" "Battery level is ${BATTERY_LEVEL}%" -u normal
fi

View File

@ -0,0 +1,15 @@
#!/bin/sh
set -e
if [ $# -eq 0 ]; then
echo "Error: Please provide a path to the markdown file"
exit 1
fi
basename="${1##*/}"
basename="${basename%.*}"
echo $basename
TMPFILE=$(mktemp /tmp/XXXXXXXXXX-${basename}.html)
pandoc -f markdown -t html -o "$TMPFILE" "$1" --embed-resources --standalone --css="https://cdn.jsdelivr.net/npm/sakura.css/css/sakura.css"
xdg-open $TMPFILE