-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathethinfo
executable file
·20 lines (16 loc) · 1.04 KB
/
ethinfo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env bash
# Also see the `wifail` script. This is mostly the same thing for Ethernet.
# Check if a workspace named "ethinfo" exists.
workspace_exists=$(i3-msg -t get_workspaces | jq 'any (.name == "ethinfo")')
# Switch to the workspace named "ethinfo". Create it if necessary.
i3-msg 'workspace ethinfo'
# Exit if the "ethinfo" workspace already existed.
[[ $workspace_exists == 'true' ]] && exit
# Create an i3 workspace with 5 placeholder windows that swallow xterms.
i3-msg -q 'append_layout ~/.config/i3/ethinfo-workspace.json'
# Start the xterms.
xterm -title dhcpcd -e 'journalctl -fu dhcpcd@eth0 -n $(($(tput lines)-1)) -b -o cat' &
xterm -title 'ping gateway' -e 'while true; do a=$(ip r | awk '\''/^default via .* eth/{print $3}'\''); [[ $a ]] && ping -c 8 "$a" && sleep 10 && clear || sleep 1; done' &
xterm -title 'ip address show eth0' -e 'watch -d -n 1 ip address show eth0' &
xterm -title route -e 'watch -d -n 1 route -n' &
xterm -title 'ping google.com' -e 'while true; do ping -c 8 google.com && sleep 10 && clear || sleep 1; done' &