diff options
Diffstat (limited to 'install')
-rwxr-xr-x | install | 39 |
1 files changed, 39 insertions, 0 deletions
@@ -16,6 +16,7 @@ gToolsConfig=( "Xresources:xterm:xtermConfigInstaller" "i3config:i3:i3ConfigInstaller" "i3status:i3status:i3statusConfigInstaller" +"i3blocks:i3blocks:i3blocksConfigInstaller" ) gMagicNumber=e2718281 @@ -153,6 +154,44 @@ function i3statusConfigInstaller() { return 1 fi cp i3status.conf $i3_status_conf + + local nif=$(ip link show | grep ^[1-9] | grep -v LOOPBACK | sed 's/ //g' | cut -d ':' -f 2) + + local num_wlanif=$(echo -e $nif | tr ' ' '\n' | grep wl | wc -l) + local wlanif=$(echo -e $nif | tr ' ' '\n' | grep wl) + if [[ $num_wlanif != 1 || -z $wlanif ]]; then + echo "[Warning]: i3statusConfigInstaller couldn't find name of WIFI IF!" + sed -i '/__DEF__WIFI_START__/,/__DEF__WIFI_END__/d' $i3_status_conf + else + sed -i "s/__NIF_WIFI__/$wlanif/g" $i3_status_conf + fi + + local num_ethif=$(echo -e $nif | tr ' ' '\n' | grep en | wc -l) + local ethif=$(echo -e $nif | tr ' ' '\n' | grep en) + if [[ $num_ethif != 1 || -z $ethif ]]; then + echo "[Warning]: i3statusConfigInstaller couldn't find name of ETH IF!" + sed -i '/__DEF__ETH_START__/,/__DEF__ETH_END__/d' $i3_status_conf + else + sed -i "s/__NIF_ETH__/$ethif/g" $i3_status_conf + fi + + sed -i '/__DEF__.*__/d' $i3_status_conf + + return 0 +} + +#}}} +#{{{ i3blocksConfigInstaller + +function i3blocksConfigInstaller() { + local i3_home=~/.i3 + local i3_blocks_conf=$i3_home/i3blocks.conf + mkdir $i3_home 2> /dev/null + if [ -f $i3_blocks_conf ]; then + return 1 + fi + cp i3blocks.conf $i3_blocks_conf + return 0 } |