adding a lot of script changes

This commit is contained in:
Chris Cochrun 2021-08-17 20:39:50 -05:00
parent 161abbf381
commit d25a75a078
15 changed files with 237 additions and 406 deletions

View file

@ -1,7 +0,0 @@
#!/bin/sh
# awk '{u=$2+$4; t=$2+$4+$5; if (NR==1){u1=u; t1=t;} else print ($2+$4-u1) * 100 / (t-t1) "%"; }' \
# <(rg 'cpu ' /proc/stat) <(sleep 1;rg 'cpu ' /proc/stat)
# echo 100 - $(mpstat | rg all | cut -d \ -f43) | bc
cpu="$(mpstat 1 1 | rg Average | awk '{print $3+$4+$5}' | sed 's/\(.*\)/\1%/g')"
echo "$cpu | color=#ff0000"

View file

@ -1,8 +1,12 @@
#!/bin/sh
if [ $(hostname) = "syl" ]; then
style="laptop"
#echo "this is hidpi"
if [ $WAYLAND_DISPLAY = "wayland-0" ]; then
style="desktop"
else
style="laptop"
#echo "this is hidpi"
fi
else
style="desktop"
#echo "this is not hidpi"

View file

@ -44,11 +44,13 @@ sub get_de {
my $de = $ENV{XDG_CURRENT_DESKTOP};
unless ($de) { $de = $ENV{XDG_SESSION_DESKTOP} };
unless ($de) { $de = $ENV{DESKTOP_SESSION} };
return $de;
# return $de;
return "river";
}
sub shell {
return (split '/', $ENV{SHELL})[-1];
# return (split '/', $ENV{SHELL})[-1];
return "fish";
}
sub kernel {

View file

@ -1,5 +0,0 @@
#!/bin/bash
set -eu
set -o pipefail
rbw ls --fields folder,name,user | sed 's/\t/\//g' | sort | rofi -dmenu | sed 's/^[^\/]*\///' | sed 's/\// /' | xargs -r rbw get | xclip -l 1

View file

@ -11,48 +11,48 @@ list_passwords() {
}
prompt='search for passwords...'
SECRET=$(list_passwords | rofi -i -p="${prompt}" -dmenu)
SECRET=$(list_passwords | rofi -i -p="${prompt}" -dmenu --no-lazy-grab)
# Ask whether pass, user or both are required
options=("Password" \
"User" \
"User and password" \
"QR-Code" \
"OTP")
# options=("Password" \
# "User" \
# "User and password" \
# "QR-Code" \
# "OTP")
option=$(printf '%s\n' "${options[@]%}" | rofi -i -dmenu -width 400 -lines 4 -prompt="...")
# option=$(printf '%s\n' "${options[@]%}" | rofi -i -dmenu -width 400 -lines 4 -prompt="...")
echo $option
# echo $option
case ${option} in
Password )
echo "${SECRET}"
xdotool type $(rbw get "${SECRET}")
;;
User )
xdotool type $(rbw get --full "${SECRET}" | rg Username: | awk '{$1 = ""; print $0}')
;;
"User and password" )
xdotool type $(rbw get --full "${SECRET}" | rg Username: | awk '{$1 = ""; print $0}')
xdotool key Tab
xdotool type $(rbw get "${SECRET}")
;;
"QR-Code" )
if [[ $SECRET =~ wifi$ ]]; then
# Produce a valid wifi QR-code
WIFISSID=$(pass get_user ${SECRET})
WIFIPASS=$(pass get_pass ${SECRET})
WIFIQR="WIFI:T:WPA;S:${WIFISSID};P:${WIFIPASS};;"
qrencode -s 8 -o - $WIFIQR | feh --title "pass: QR-WIFI" -
else
# Only password
pass show -q1 ${SECRET}
fi
;;
"OTP" )
xdotool type $(rbw code ${SECRET})
;;
esac
# case ${option} in
# Password )
# echo "${SECRET}"
# xdotool type $(rbw get "${SECRET}")
# ;;
# User )
# xdotool type $(rbw get --full "${SECRET}" | rg Username: | awk '{$1 = ""; print $0}')
# ;;
# "User and password" )
# xdotool type $(rbw get --full "${SECRET}" | rg Username: | awk '{$1 = ""; print $0}')
# xdotool key Tab
# xdotool type $(rbw get "${SECRET}")
# ;;
# "QR-Code" )
# if [[ $SECRET =~ wifi$ ]]; then
# # Produce a valid wifi QR-code
# WIFISSID=$(pass get_user ${SECRET})
# WIFIPASS=$(pass get_pass ${SECRET})
# WIFIQR="WIFI:T:WPA;S:${WIFISSID};P:${WIFIPASS};;"
# qrencode -s 8 -o - $WIFIQR | feh --title "pass: QR-WIFI" -
# else
# # Only password
# pass show -q1 ${SECRET}
# fi
# ;;
# "OTP" )
# xdotool type $(rbw code ${SECRET})
# ;;
# esac
# wl-copy -o -s ${seat} ${PASSWD_PASS}
# # wl-copy -o -s ${seat} ${PASSWD_PASS}