consolidate and templeate my to files

in order to stop maintainung different files for each operationg system
This commit is contained in:
Philip Henning 2021-09-11 23:45:56 +02:00
parent 7a1e8fda4b
commit c377eb276a
40 changed files with 246 additions and 454 deletions

View file

@ -1,8 +1,7 @@
#!/bin/bash
#!/usr/bin/env bash
######################
#
# {{@@ env['dotdrop_warning'] @@}}
# {{@@ header() @@}}
#
# This script detects if an USB NIC was connected and reloads the bar
#
@ -11,30 +10,30 @@ 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
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
if [[ -n ${USB_NIC1} ]]; then
polybar-msg -p ${pid_bottom_bar} cmd restart
fi
elif [[ -n $USB_NIC1 ]]; then
elif [[ -n ${USB_NIC1} ]]; then
USB_NIC1_CHECK=$(ip link | awk '!/awk/ && /enp0s20f0u1/ {print $2}' | cut -d":" -f1)
if [[ -z $USB_NIC1_CHECK ]]; then
if [[ -z ${USB_NIC1_CHECK} ]]; then
unset USB_NIC1
polybar-msg -p $pid_bottom_bar cmd restart
polybar-msg -p ${pid_bottom_bar} cmd restart
fi
fi
# 2nd USB port (left)
if [[ -z $USB_NIC2 ]]; then
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
if [[ -n ${USB_NIC2} ]]; then
polybar-msg -p ${pid_bottom_bar} cmd restart
fi
elif [[ -n $USB_NIC2 ]]; then
elif [[ -n ${USB_NIC2} ]]; then
USB_NIC2_CHECK=$(ip link | awk '!/awk/ && /enp0s20f0u2/ {print $2}' | cut -d":" -f1)
if [[ -z $USB_NIC2_CHECK ]]; then
if [[ -z ${USB_NIC2_CHECK} ]]; then
unset USB_NIC2
polybar-msg -p $pid_bottom_bar cmd restart
polybar-msg -p ${pid_bottom_bar} cmd restart
fi
fi