make nyxt sleeker

This commit is contained in:
Chris Cochrun 2021-09-25 06:59:26 -05:00
parent 72b6c49e94
commit c5d884ccb5
10 changed files with 247 additions and 109 deletions

View file

@ -1,7 +1,7 @@
#!/bin/sh
#!/bin/bash
# Check to see if nyxt is running
if [ -n $(pgrep -c nyxt) ]; then
if pgrep -x nyxt > /dev/null; then
echo running
if [ $XDG_SESSION_TYPE = "x11" ]; then

71
scripts/plasma-rofi-rbw.sh Executable file
View file

@ -0,0 +1,71 @@
#!/usr/bin/env bash
# Very basic interface for rbw using rofi
if [ $(hostname) = "syl" ]; then
style="laptop-rbw"
#echo "this is hidpi"
else
style="desktop-rbw"
#echo "this is not hidpi"
fi
# Get all password files and create an array
root=~/.password-store
CACHE=~/.local/tmp/pass_rofi
seat=seat0
rbw sync
rbw list
list_passwords() {
rbw list
}
passwords=$(rbw list)
prompt='search for passwords...'
SECRET=$(list_passwords | rofi -i -p="${prompt}" -dmenu -theme ~/.config/rofi/launchers-git/$style.rasi)
# Ask whether pass, user or both are required
options=("Password" \
"User" \
"User and password" \
"QR-Code" \
"OTP")
option=$(printf '%s\n' "${options[@]%}" | rofi -i -dmenu -width 400 -lines 4 -prompt="..." -theme ~/.config/rofi/launchers-git/$style.rasi)
echo $option
case ${option} in
Password )
echo "${SECRET}"
ydotool type $(rbw get "${SECRET}")
;;
User )
ydotool type $(rbw get --full "${SECRET}" | rg Username: | awk '{$1 = ""; print $0}')
;;
"User and password" )
ydotool type $(rbw get --full "${SECRET}" | rg Username: | awk '{$1 = ""; print $0}')
ydotool key Tab
ydotool 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" )
ydotool type $(rbw code ${SECRET})
;;
esac
# wl-copy -o -s ${seat} ${PASSWD_PASS}

32
scripts/swayprop Executable file
View file

@ -0,0 +1,32 @@
#!/bin/bash
ALL_NODES='recurse(.nodes[]?, .floating_nodes[]?) | select(.pid and .visible)'
WINDOW_NAME='(.app_id // .window_properties.class)'
ID_PREFIX='"\(.id):"'
WINDOW_PROTOCOL='(if .shell == "xwayland" then "X11" else "wayland" end)'
WINDOW_GEOMETRY='(.rect | "\(.x),\(.y) \(.width)x\(.height) ")'
WINDOW_PID='(.pid | tostring)'
# Output format, e.g. "1234 - 12:firefox (wayland)" or "5678 - 17:discord (X11)"
FORMAT="$WINDOW_PID + \" - \" + $ID_PREFIX + $WINDOW_NAME + \" (\" + $WINDOW_PROTOCOL + \")\""
FILT="$ALL_NODES | $WINDOW_GEOMETRY + $FORMAT"
function getprop() {
typeset -A views
local selected
while read POS GEOM INFO; do
views["$POS $GEOM"]="$INFO"
done
selected="$(printf "%s\n" "${!views[@]}" | slurp)"
if [[ -n "$selected" ]]; then
printf '%s\n' "${views[${selected}]}"
fi
}
if [[ "$1" == "wait" ]]; then
swaymsg -t subscribe '["workspace"]' | jq -r ".current | $FILT" | getprop
else
swaymsg -t get_tree | jq -r "$FILT" | getprop
fi