Skip to content

Instantly share code, notes, and snippets.

@SebastianMusic
Created February 13, 2026 18:45
Show Gist options
  • Select an option

  • Save SebastianMusic/69ad8a13a467abb045c0f22b81afeb9a to your computer and use it in GitHub Desktop.

Select an option

Save SebastianMusic/69ad8a13a467abb045c0f22b81afeb9a to your computer and use it in GitHub Desktop.
Solve a simple challange before launching an application
#!/usr/bin/env bash
# usage: passwordlauncher.sh <name of app>
# example passwordlauncher.sh discord
#
# I use this script to wrap the executable in the .desktop file for apps which
# i sometimes open mindlessly and reflexively.
#
# The goal of this script is to give you a large enough cognitive challenge
# such that you can make the decision if you actually want to use the
# application you just tried to open or if it was just a reflex, without being
# so annoying that you stop using it
APP="$1"
PASSWORD_LENGTH=5
PASSWORD=$(tr -dc 'a-z-A-Z0-9' </dev/urandom | head -c $PASSWORD_LENGTH)
which "$APP" || {
echo "app not found"
exit 1
}
USER_INPUT=$(zenity --entry --title="Input" --text="Enter: $PASSWORD")
# USER_INPUT=$(echo "" | bemenu --prompt "Enter: $PASSWORD:") # if you want to use bemenu instead
if [[ $PASSWORD = "$USER_INPUT" ]]; then
"$APP"
else
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment