adds rofi as styling
This commit is contained in:
parent
d03146f3a1
commit
1682bed87f
9 changed files with 124 additions and 8 deletions
43
.config/rofi/scripts/2fa.sh
Executable file
43
.config/rofi/scripts/2fa.sh
Executable file
|
|
@ -0,0 +1,43 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -o pipefail
|
||||
|
||||
source "$HOME/.config/rofi/scripts/_lib.sh"
|
||||
|
||||
KEYRING_NAME="2fauth"
|
||||
KEYRING_VALUE="token"
|
||||
DOMAIN="https://auth.iedsoftworks.com"
|
||||
|
||||
getApiToken() {
|
||||
token=$(secret-tool lookup "$KEYRING_NAME" "$KEYRING_VALUE")
|
||||
if [[ $? == 0 ]]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
token=$(zenity --forms --add-multiline-entry="API Key" --text="Provide a valid API key")
|
||||
if [[ $token == "" ]]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo "$token" | secret-tool store --label "2FAuth API Key" "$KEYRING_NAME" "$KEYRING_VALUE"
|
||||
}
|
||||
|
||||
getApiToken
|
||||
|
||||
setOption no-custom true
|
||||
case $ROFI_RETV in
|
||||
0)
|
||||
echo -en $(curl --oauth2-bearer "$token" "$DOMAIN/api/v1/twofaccounts" | jq -r '.[] | "\(.id)\\0display\\x1f\(.service) - \(.account)\\x1finfo\\x1f\(.)\\n"')
|
||||
;;
|
||||
1)
|
||||
id=$@
|
||||
|
||||
curl --oauth2-bearer "$token" "$DOMAIN/api/v1/twofaccounts/$id/otp" |
|
||||
jq ".password" -r |
|
||||
wl-copy
|
||||
|
||||
$(echo $ROFI_INFO | jq -r '"\(.service) - \(.account)"')
|
||||
|
||||
notify-send -i "lock" "2FA Code copied" "Copied code for '$(echo $ROFI_INFO | jq -r '"\(.service) - \(.account)"')'"
|
||||
;;
|
||||
esac
|
||||
5
.config/rofi/scripts/_lib.sh
Normal file
5
.config/rofi/scripts/_lib.sh
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
#!/bin/env sh
|
||||
|
||||
setOption() {
|
||||
echo -en "\0$1\x1f$2\n"
|
||||
}
|
||||
20
.config/rofi/scripts/calc.sh
Executable file
20
.config/rofi/scripts/calc.sh
Executable file
|
|
@ -0,0 +1,20 @@
|
|||
#!/bin/bash
|
||||
|
||||
case $ROFI_RETV in
|
||||
1)
|
||||
wl-copy "$@"
|
||||
;;
|
||||
2)
|
||||
|
||||
result=$(rink "$@" | grep -v '^>')
|
||||
NUMBERS=$(echo "$result "tr '\n' ' ' | sed -e 's/[^0-9]/ /g' -e 's/^ *//g' -e 's/ *$//g')
|
||||
|
||||
IFS=' '
|
||||
|
||||
for number in $NUMBERS; do
|
||||
echo $number
|
||||
done
|
||||
echo -en "$result\0non-selectable\x1ftrue\n"
|
||||
;;
|
||||
|
||||
esac
|
||||
15
.config/rofi/scripts/pactl.sh
Executable file
15
.config/rofi/scripts/pactl.sh
Executable file
|
|
@ -0,0 +1,15 @@
|
|||
#!/bin/bash
|
||||
|
||||
source "$HOME/.config/rofi/scripts/_lib.sh"
|
||||
|
||||
setOption no-custom true
|
||||
case $ROFI_RETV in
|
||||
0)
|
||||
defaultSink=$(pactl get-default-sink)
|
||||
echo -en $(pactl --format=json list sinks | jq --arg default "$defaultSink" -r 'map("\(.name)\\0display\\x1f\(.description)\\x1fmeta\\x1fsinks,output,\(.description)\\x1factive\\x1f\(.name == $default)\\n") | add')
|
||||
;;
|
||||
1)
|
||||
name=$@
|
||||
pactl set-default-sink "$name"
|
||||
;;
|
||||
esac
|
||||
25
.config/rofi/scripts/system.sh
Executable file
25
.config/rofi/scripts/system.sh
Executable file
|
|
@ -0,0 +1,25 @@
|
|||
#!/bin/bash
|
||||
|
||||
source "$HOME/.config/rofi/scripts/_lib.sh"
|
||||
|
||||
SCRIPTS_DIR="$HOME/.config/scripts"
|
||||
|
||||
declare -A scripts
|
||||
scripts["Shutdown"]="systemctl poweroff"
|
||||
scripts["Reboot"]="systemctl reboot"
|
||||
scripts["Logout"]="logout terminate-user $USER"
|
||||
scripts["Lock"]="$SCRIPTS_DIR/LockScreen.sh"
|
||||
scripts["Notification Center (SwayNC)"]="swaync-client -t -sw"
|
||||
|
||||
setOption no-custom true
|
||||
setOption use-hot-keys true
|
||||
case $ROFI_RETV in
|
||||
0)
|
||||
printf "%s\n" "${!scripts[@]}"
|
||||
;;
|
||||
1)
|
||||
command="${scripts[$@]}"
|
||||
coproc ($command >/dev/null 2>&1)
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
Loading…
Add table
Add a link
Reference in a new issue