scripts: battery-notify and view-md-in-browser
This commit is contained in:
parent
8213453bce
commit
ba998e252c
11
.local/scripts/battery-notify.sh
Executable file
11
.local/scripts/battery-notify.sh
Executable 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
|
||||
15
.local/scripts/view-md-in-browser.sh
Executable file
15
.local/scripts/view-md-in-browser.sh
Executable 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
|
||||
Loading…
x
Reference in New Issue
Block a user