- doas en vez de sudo (sistema/etc/doas.conf; xbps.d permite quitar sudo). - pinentry-dmenu en X y pinentry-curses en una tty (pinentry-menu); fuera GTK 2 (.gtkrc-2.0 y el arreglo de colores del tema). - bluetooth: menú de dmenu con bluetoothctl en vez de blueman. - pantallas: xrandr a pelo en vez de autorandr, también desde udev. - luz: sct cada minuto en vez de gammastep. - xwallpaper para el fondo y nsxiv para las imágenes de st, en vez de feh. - volumen salida en vez de pavucontrol; menu reúne los colores de dmenu. - mpv en vez de vlc; fuera btop. - install.sh: paso quitar para desinstalar lo sustituido. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01C5v1qWDwgkaVM5kjVHGGh8
70 lines
2 KiB
Bash
Executable file
70 lines
2 KiB
Bash
Executable file
#!/bin/sh
|
|
# Menú de bluetooth con dmenu (clic izquierdo en BT de la barra): conectar o
|
|
# desconectar los dispositivos emparejados ( = conectado), buscar y
|
|
# emparejar uno nuevo y apagar el adaptador. Si está apagado, ofrece
|
|
# encenderlo.
|
|
|
|
avisar() {
|
|
notify-send -h string:x-dunst-stack-tag:bluetooth -i bluetooth "Bluetooth" "$1"
|
|
}
|
|
|
|
# "Device AA:BB:CC:DD:EE:FF Nombre" -> "Nombre (AA:BB:CC:DD:EE:FF)"
|
|
lista() { sed -n 's/^Device \([^ ]*\) \(.*\)/\2 (\1)/p'; }
|
|
mac() { printf '%s\n' "$1" | sed 's/.*(\([^)]*\))$/\1/'; }
|
|
|
|
if ! bluetoothctl show | grep -q 'Powered: yes'; then
|
|
[ "$(echo Encender | menu -p Bluetooth:)" = Encender ] || exit 0
|
|
bluetoothctl power on >/dev/null
|
|
pkill -USR1 -x slstatus
|
|
fi
|
|
|
|
conectados=$(bluetoothctl devices Connected | lista)
|
|
emparejados=$(bluetoothctl devices Paired | lista)
|
|
|
|
opcion=$(
|
|
printf '%s\n' "$emparejados" | while IFS= read -r d; do
|
|
[ -n "$d" ] || continue
|
|
if printf '%s\n' "$conectados" | grep -qxF "$d"; then
|
|
echo " $d"
|
|
else
|
|
echo " $d"
|
|
fi
|
|
done
|
|
echo " Buscar dispositivos"
|
|
echo " Apagar"
|
|
)
|
|
opcion=$(printf '%s\n' "$opcion" | menu -p Bluetooth:)
|
|
|
|
case $opcion in
|
|
'') exit 0 ;;
|
|
*" Apagar")
|
|
bluetoothctl power off >/dev/null
|
|
;;
|
|
*" Buscar dispositivos")
|
|
avisar "Buscando dispositivos durante 10 s..."
|
|
bluetoothctl --timeout 10 scan on >/dev/null
|
|
nuevo=$(bluetoothctl devices | lista | awk -v e="$emparejados" '
|
|
BEGIN { n = split(e, a, "\n"); for (i = 1; i <= n; i++) visto[a[i]] }
|
|
!($0 in visto)' | menu -p Emparejar:)
|
|
[ -n "$nuevo" ] || exit 0
|
|
m=$(mac "$nuevo")
|
|
if bluetoothctl pair "$m" >/dev/null && bluetoothctl trust "$m" >/dev/null &&
|
|
bluetoothctl connect "$m" >/dev/null; then
|
|
avisar "Conectado: $nuevo"
|
|
else
|
|
avisar "No se pudo emparejar: $nuevo"
|
|
fi
|
|
;;
|
|
" "*)
|
|
bluetoothctl disconnect "$(mac "$opcion")" >/dev/null &&
|
|
avisar "Desconectado: ${opcion#" "}"
|
|
;;
|
|
*)
|
|
if bluetoothctl connect "$(mac "$opcion")" >/dev/null; then
|
|
avisar "Conectado: ${opcion#" "}"
|
|
else
|
|
avisar "No se pudo conectar: ${opcion#" "}"
|
|
fi
|
|
;;
|
|
esac
|
|
pkill -USR1 -x slstatus
|