mirror of
https://github.com/shokinn/.files.git
synced 2025-06-29 08:10:42 +00:00
Initial dotfiles
This commit is contained in:
parent
492e07f40a
commit
8ca52fb1e6
26 changed files with 1255 additions and 0 deletions
40
dotfiles/config/polybar/refresh_bar_usb_nic.sh
Executable file
40
dotfiles/config/polybar/refresh_bar_usb_nic.sh
Executable file
|
@ -0,0 +1,40 @@
|
|||
#!/bin/bash
|
||||
|
||||
######################
|
||||
#
|
||||
# This script detects if an USB NIC was connected and reloads the bar
|
||||
#
|
||||
|
||||
while true; do
|
||||
# Get PID of the bottom bar
|
||||
pid_bottom_bar=$(ps -x | awk '!/awk/ && /9560-bottom/ {print $1}')
|
||||
# 1st USB port (right)
|
||||
if [[ -z $USB_NIC1 ]]; then
|
||||
USB_NIC1=$(ip link | awk '!/awk/ && /enp0s20f0u1/ {print $2}' | cut -d":" -f1)
|
||||
if [[ -n $USB_NIC1 ]]; then
|
||||
polybar-msg -p $pid_bottom_bar cmd restart
|
||||
fi
|
||||
elif [[ -n $USB_NIC1 ]]; then
|
||||
USB_NIC1_CHECK=$(ip link | awk '!/awk/ && /enp0s20f0u1/ {print $2}' | cut -d":" -f1)
|
||||
if [[ -z $USB_NIC1_CHECK ]]; then
|
||||
unset USB_NIC1
|
||||
polybar-msg -p $pid_bottom_bar cmd restart
|
||||
fi
|
||||
fi
|
||||
|
||||
# 2nd USB port (left)
|
||||
if [[ -z $USB_NIC2 ]]; then
|
||||
USB_NIC2=$(ip link | awk '!/awk/ && /enp0s20f0u2/ {print $2}' | cut -d":" -f1)
|
||||
if [[ -n $USB_NIC2 ]]; then
|
||||
polybar-msg -p $pid_bottom_bar cmd restart
|
||||
fi
|
||||
elif [[ -n $USB_NIC2 ]]; then
|
||||
USB_NIC2_CHECK=$(ip link | awk '!/awk/ && /enp0s20f0u2/ {print $2}' | cut -d":" -f1)
|
||||
if [[ -z $USB_NIC2_CHECK ]]; then
|
||||
unset USB_NIC2
|
||||
polybar-msg -p $pid_bottom_bar cmd restart
|
||||
fi
|
||||
fi
|
||||
|
||||
sleep 5
|
||||
done
|
Loading…
Add table
Add a link
Reference in a new issue