From e611c1cd20e4904b3e9b4e4ceb93cac27798577c Mon Sep 17 00:00:00 2001 From: "Adam T. Carpenter" Date: Fri, 22 May 2020 11:14:52 -0400 Subject: updated net block and porter, added innernet for post-login networking setup; added compositor toggle --- abraham-porter.sh | 24 +++--------------------- i3blocks-net.sh | 15 ++++++++++----- innernet.sh | 20 ++++++++++++++++++++ toggle-compositing.sh | 3 +++ 4 files changed, 36 insertions(+), 26 deletions(-) create mode 100755 innernet.sh create mode 100755 toggle-compositing.sh diff --git a/abraham-porter.sh b/abraham-porter.sh index 02a6b90..23be09a 100755 --- a/abraham-porter.sh +++ b/abraham-porter.sh @@ -16,8 +16,7 @@ OK=0 NO_ACTION_PROVIDED=3 NO_PORT_PROVIDED=4 NO_PKG_DESCR_FOUND=5 -NO_WANT_TERM_PROVIDED=6 -NO_WANT_ANOTHER_PROVIDED=7 +NO_WANT_ANOTHER_PROVIDED=6 ## Gets a port name from the user with dmenu @@ -29,15 +28,6 @@ get_port() { } -## Prompt user if they want to run command in a new term -wants_term() { - choice=$(printf "no\nyes\n" | dmenu -p "Do you want to do this in a new terminal?") - [ $choice = "no" ] && return 1 - [ $choice = "yes" ] && return 0 - exit $NO_WANT_TERM_PROVIDED -} - - ## Gets an action from the user with dmenu get_action() { action=$(dmenu -p "Abraham Porter" << EOF @@ -89,11 +79,7 @@ handle_poudriere_options_single() { handle_poudriere_bulk_single() { port="$1" notify-send "Poudriere bulk started" "$port" - if wants_term; then - $terminal -e $doas poudriere bulk -j "$jail" $port - else - $doas poudriere bulk -j "$jail" $port - fi + $terminal -e $doas poudriere bulk -j "$jail" $port notify-send "Poudriere bulk finished" "$port" } @@ -107,11 +93,7 @@ handle_poudriere_options_pkglist() { ## Handle running poudriere bulk on pkglist handle_poudriere_bulk_pkglist() { notify-send "Poudriere bulk started" "(pkglist)" - if wants_term; then - $terminal -e $doas poudriere bulk -j "$jail" -f "$pkglist" - else - $doas poudriere bulk -j "$jail" -f "$pkglist" - fi + $terminal -e $doas poudriere bulk -j "$jail" -f "$pkglist" notify-send "Poudriere bulk finished" "(pkglist)" } diff --git a/i3blocks-net.sh b/i3blocks-net.sh index 3d65ddb..b3d7239 100755 --- a/i3blocks-net.sh +++ b/i3blocks-net.sh @@ -1,12 +1,17 @@ #!/bin/sh -icon_ethernet=󰈀 +icon_ethernet=󰈁 +icon_down=󰈂 icon_wireless=󰖩 -is_ethernet=$(ifconfig em0 | grep status | cut -d':' -f2) +is_ethernet=$(ifconfig em0 | grep status | cut -d\: -f2) if [ "$is_ethernet" = " active" ]; then inet=$(ifconfig lagg0 | grep inet\ | cut -w -f3) - printf "$icon_ethernet%s\n" $inet + printf "%s%s\n" $icon_ethernet $inet +elif [ "$(ifconfig wlan0 | grep status | cut -d\: -f2)" = " associated" ]; then + ssid=$(ifconfig wlan0 | grep ssid\ | cut -w -f3) + [ -n "$ssid" ] && printf "%s%s" $icon_wireless "$ssid" else - ssid=$(ifconfig wlan0 | grep ssid | cut -d'"' -f2) - printf "$icon_wireless%s\n" "$ssid" + printf "%sNo connection" $icon_down fi + +printf "\n" diff --git a/innernet.sh b/innernet.sh new file mode 100755 index 0000000..786505b --- /dev/null +++ b/innernet.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +# Ethernet up +ifconfig em0 up + +# Wireless create, up +# Note: use your ethernet device's MAC addr +ifconfig wlan0 create wlandev iwn0 wlanaddr 5c:26:0a:06:c1:d6 +ifconfig wlan0 up + +# Link aggregate create, up +# Creates a failover lagg that prefers em0 but uses wlan0 if em0 is unavailable +ifconfig lagg0 create laggproto failover laggport em0 laggport wlan0 +ifconfig lagg0 up + +# Use WPA supplicant to handle SSID/password wireless connection +wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant.conf + +# Grab an IP for lagg device +dhclient lagg0 diff --git a/toggle-compositing.sh b/toggle-compositing.sh new file mode 100755 index 0000000..b183284 --- /dev/null +++ b/toggle-compositing.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +killall picom || exec picom & -- cgit v1.2.3