mirror of
https://github.com/alrayyes/dotfiles/
synced 2023-11-14 15:56:30 +00:00
feat(polybar): new arch config
This commit is contained in:
parent
3a13c57afd
commit
173bf78d1b
@ -1,90 +1,90 @@
|
||||
#!/bin/sh
|
||||
|
||||
usb_print() {
|
||||
devices=$(lsblk -Jplno NAME,TYPE,RM,SIZE,MOUNTPOINT,VENDOR)
|
||||
output=""
|
||||
counter=0
|
||||
devices=$(lsblk -Jplno NAME,TYPE,RM,SIZE,MOUNTPOINT,VENDOR)
|
||||
output=""
|
||||
counter=0
|
||||
|
||||
for unmounted in $(echo "$devices" | jq -r '.blockdevices[] | select(.type == "part") | select(.rm == true) | select(.mountpoint == null) | .name'); do
|
||||
unmounted=$(echo "$unmounted" | tr -d "[:digit:]")
|
||||
unmounted=$(echo "$devices" | jq -r '.blockdevices[] | select(.name == "'"$unmounted"'") | .vendor')
|
||||
unmounted=$(echo "$unmounted" | tr -d ' ')
|
||||
for unmounted in $(echo "$devices" | jq -r '.blockdevices[] | select(.type == "part") | select(.rm == true) | select(.mountpoint == null) | .name'); do
|
||||
unmounted=$(echo "$unmounted" | tr -d "[:digit:]")
|
||||
unmounted=$(echo "$devices" | jq -r '.blockdevices[] | select(.name == "'"$unmounted"'") | .vendor')
|
||||
unmounted=$(echo "$unmounted" | tr -d ' ')
|
||||
|
||||
if [ $counter -eq 0 ]; then
|
||||
space=""
|
||||
else
|
||||
space=" "
|
||||
fi
|
||||
counter=$((counter + 1))
|
||||
if [ $counter -eq 0 ]; then
|
||||
space=""
|
||||
else
|
||||
space=" "
|
||||
fi
|
||||
counter=$((counter + 1))
|
||||
|
||||
output="$output$space $unmounted"
|
||||
done
|
||||
output="$output$space $unmounted"
|
||||
done
|
||||
|
||||
for mounted in $(echo "$devices" | jq -r '.blockdevices[] | select(.type == "part") | select(.rm == true) | select(.mountpoint != null) | .size'); do
|
||||
if [ $counter -eq 0 ]; then
|
||||
space=""
|
||||
else
|
||||
space=" "
|
||||
fi
|
||||
counter=$((counter + 1))
|
||||
for mounted in $(echo "$devices" | jq -r '.blockdevices[] | select(.type == "part") | select(.rm == true) | select(.mountpoint != null) | .size'); do
|
||||
if [ $counter -eq 0 ]; then
|
||||
space=""
|
||||
else
|
||||
space=" "
|
||||
fi
|
||||
counter=$((counter + 1))
|
||||
|
||||
output="$output$space $mounted"
|
||||
done
|
||||
output="$output$space $mounted"
|
||||
done
|
||||
|
||||
if [ "$output" ]; then
|
||||
notify-send.py "USB" "$output" \
|
||||
-i drive-removable-media-usb \
|
||||
--replaces-process "usb-mount" &
|
||||
fi
|
||||
echo "$output"
|
||||
if [ "$output" ]; then
|
||||
notify-send.py "USB" "$output" \
|
||||
-i drive-removable-media-usb \
|
||||
--replaces-process "usb-mount" &
|
||||
fi
|
||||
echo "$output"
|
||||
}
|
||||
|
||||
usb_update() {
|
||||
pid=$(cat "$path_pid")
|
||||
pid=$(cat "$path_pid")
|
||||
|
||||
if [ "$pid" != "" ]; then
|
||||
kill -10 "$pid"
|
||||
fi
|
||||
if [ "$pid" != "" ]; then
|
||||
kill -10 "$pid"
|
||||
fi
|
||||
}
|
||||
|
||||
path_pid="/tmp/polybar-system-usb-udev.pid"
|
||||
|
||||
case "$1" in
|
||||
--update)
|
||||
usb_update
|
||||
;;
|
||||
usb_update
|
||||
;;
|
||||
--mount)
|
||||
devices=$(lsblk -Jplno NAME,TYPE,RM,MOUNTPOINT)
|
||||
devices=$(lsblk -Jplno NAME,TYPE,RM,MOUNTPOINT)
|
||||
|
||||
for mount in $(echo "$devices" | jq -r '.blockdevices[] | select(.type == "part") | select(.rm == true) | select(.mountpoint == null) | .name'); do
|
||||
mountpoint=$(udisksctl mount --no-user-interaction -b "$mount")
|
||||
mountpoint=$(echo "$mountpoint" | cut -d " " -f 4 | tr -d ".")
|
||||
alacritty --class lf,lf -e lf "$mountpoint" &
|
||||
done
|
||||
for mount in $(echo "$devices" | jq -r '.blockdevices[] | select(.type == "part") | select(.rm == true) | select(.mountpoint == null) | .name'); do
|
||||
mountpoint=$(udisksctl mount --no-user-interaction -b "$mount")
|
||||
mountpoint=$(echo "$mountpoint" | cut -d " " -f 4 | tr -d ".")
|
||||
alacritty --class lf,lf -e lf "$mountpoint" &
|
||||
done
|
||||
|
||||
usb_update
|
||||
;;
|
||||
usb_update
|
||||
;;
|
||||
--unmount)
|
||||
devices=$(lsblk -Jplno NAME,TYPE,RM,MOUNTPOINT)
|
||||
devices=$(lsblk -Jplno NAME,TYPE,RM,MOUNTPOINT)
|
||||
|
||||
for unmount in $(echo "$devices" | jq -r '.blockdevices[] | select(.type == "part") | select(.rm == true) | select(.mountpoint != null) | .name'); do
|
||||
udisksctl unmount --no-user-interaction -b "$unmount"
|
||||
udisksctl power-off --no-user-interaction -b "$unmount"
|
||||
done
|
||||
for unmount in $(echo "$devices" | jq -r '.blockdevices[] | select(.type == "part") | select(.rm == true) | select(.mountpoint != null) | .name'); do
|
||||
udisksctl unmount --no-user-interaction -b "$unmount"
|
||||
udisksctl power-off --no-user-interaction -b "$unmount"
|
||||
done
|
||||
|
||||
usb_update
|
||||
;;
|
||||
usb_update
|
||||
;;
|
||||
*)
|
||||
echo $$ >$path_pid
|
||||
echo $$ >$path_pid
|
||||
|
||||
trap exit INT
|
||||
trap "echo" USR1
|
||||
trap exit INT
|
||||
trap "echo" USR1
|
||||
|
||||
while true; do
|
||||
usb_print
|
||||
while true; do
|
||||
usb_print
|
||||
|
||||
sleep 60 &
|
||||
wait
|
||||
done
|
||||
;;
|
||||
sleep 60 &
|
||||
wait
|
||||
done
|
||||
;;
|
||||
esac
|
||||
|
@ -57,7 +57,7 @@ inherit = bar/base-laptop
|
||||
bottom = true
|
||||
monitor = ${env:MONITOR:eDP1}
|
||||
|
||||
modules-right = system-usb-udev corona
|
||||
#modules-right = system-usb-udev corona
|
||||
modules-left = mpd player-mpris-tail
|
||||
|
||||
[bar/laptop-top]
|
||||
@ -72,17 +72,18 @@ tray-position = right
|
||||
|
||||
[bar/monitor1]
|
||||
inherit = bar/base-desktop
|
||||
monitor = ${env:MONITOR:DP-1}
|
||||
monitor = ${env:MONITOR:DP-3}
|
||||
|
||||
modules-left = bspwm
|
||||
modules-center = mpd player-mpris-tail
|
||||
modules-right = seperator corona seperator eth bluetooth seperator volume seperator docker memory cpu temperature seperator system-usb-udev filesystem-root filesystem-home seperator updates-arch-combined mail reddit github rss seperator weather seperator date seperator
|
||||
#modules-right = seperator corona seperator eth bluetooth seperator volume seperator docker memory cpu temperature seperator system-usb-udev filesystem-root filesystem-home seperator updates-arch-combined mail reddit github rss seperator weather seperator date seperator
|
||||
modules-right = seperator corona seperator eth bluetooth seperator volume seperator docker memory cpu temperature seperator filesystem-root seperator updates-arch-combined mail reddit github rss seperator weather seperator date seperator
|
||||
|
||||
tray-position = right
|
||||
|
||||
[bar/monitor2]
|
||||
inherit = bar/base-desktop
|
||||
monitor = ${env:MONITOR:HDMI-2}
|
||||
monitor = ${env:MONITOR:DP-2}
|
||||
modules-left = bspwm
|
||||
|
||||
;== Modules ========================================================
|
||||
@ -180,6 +181,7 @@ ramp-load-4 = ▅
|
||||
ramp-load-5 = ▆
|
||||
ramp-load-6 = ▇
|
||||
ramp-load-7 = █
|
||||
|
||||
[module/cpu]
|
||||
type = internal/cpu
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user