power menu, redshift, polybar

This commit is contained in:
azpsen
2024-01-28 16:37:10 -06:00
parent 89516a6ce1
commit 319b44ecbd
307 changed files with 7642 additions and 5 deletions

View File

@@ -0,0 +1,4 @@
ACTION=="add", SUBSYSTEM=="tty"
RUN+="/home/user/.config/polybar/info-usbtoserial.sh --update"
ACTION=="remove", SUBSYSTEM=="tty"
RUN+="/home/user/.config/polybar/info-usbtoserial.sh --update"

View File

@@ -0,0 +1,20 @@
# Script: info-usbtoserial
A small script which shows the USB-to-Serial converters that are connected.
This script is able to display device changes in real time. For this udev is being used.
## Configuration
Copy `95-usbtoserial.rules` to `/etc/udev/rules.d/95-usbtoserial.rules`. Make sure that the paths in the file have been modified properly.
## Module
```ini
[module/info-usbtoserial]
type = custom/script
exec = ~/polybar-scripts/info-usbtoserial.sh
tail = true
```

View File

@@ -0,0 +1,44 @@
#!/bin/sh
usbtoserial_print() {
devices=$(find /dev/ -name "ttyUSB*")
counter=0
for device in $devices; do
device_name=$(udevadm info --query=property --export --name "$device" | grep ID_MODEL_FROM_DATABASE | cut -d "'" -f 2 | cut -d ' ' -f 1)
if [ $counter -gt 0 ]; then
printf ", %s" "$device_name"
else
printf "#1 %s" "$device_name"
fi
counter=$((counter + 1))
done
printf '\n'
}
path_pid="/tmp/polybar-usbtoserial.pid"
case "$1" in
--update)
pid=$(cat $path_pid)
if [ "$pid" != "" ]; then
kill -10 "$pid"
fi
;;
*)
echo $$ > $path_pid
trap exit INT
trap "echo" USR1
while true; do
usbtoserial_print
sleep 30 &
wait
done
;;
esac