Commit 836351fd authored by Guilherme Semente's avatar Guilherme Semente 🌱

Minor improvement

parent 2484f9fa
......@@ -11,14 +11,13 @@ function pidlock() {
local progname rundir pidfile
progname="$1"
rundir="${XDG_RUNTIME_DIR:-$HOME/.local/run}"
pidfile="${rundir}/pidlock/${progname}.pid"
mkdir -p "$rundir"
rundir="${XDG_RUNTIME_DIR:-$HOME/.local/run}/pidlock"
pidfile="${rundir}/${progname}.pid"
if [ -f "$pidfile" ] && kill -0 "$(cat "$pidfile")" 2>/dev/null; then
return 1
else
mkdir -p "$rundir"
echo $$ > "$pidfile"
fi
}
......@@ -32,9 +31,10 @@ function main() {
while true; do
# 240000 milliseconds / 4 minutes
if [ "$(xprintidle)" -gt 240000 ]; then
xclip -selection "primary" /dev/null
xclip -selection "secondary" /dev/null
xclip -selection "clipboard" /dev/null
echo "--OBFUSCATED--" \
| xclip -in -filter -sel "primary" \
| xclip -in -filter -sel "secondary" \
| xclip -in -filter -sel "clipboard"
fi
sleep 60 && echo Plop!
done
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment