2018-12-02 23:43:08 +00:00
|
|
|
#!/bin/bash
|
2018-12-03 14:22:12 +00:00
|
|
|
set -euo pipefail
|
2018-12-02 23:43:08 +00:00
|
|
|
|
|
|
|
interface=$(ip a | grep 'wlp.*:' | sed -E 's/^[0-9]*: ([^:]+):.*/\1/')
|
|
|
|
|
|
|
|
# We found no wlp* interface: Get out here
|
|
|
|
[ -z "${interface}" ] && exit
|
|
|
|
|
|
|
|
ip=$(ip a show ${interface} | awk '/inet .* scope global/{ print $2 }' | cut -d '/' -f1)
|
|
|
|
|
|
|
|
# We found no ip: Get out here
|
|
|
|
[ -z "${ip}" ] && exit
|
|
|
|
|
|
|
|
network=$(iwgetid -r)
|
|
|
|
|
|
|
|
# We found no network: Get out here
|
|
|
|
[ -z "${network}" ] && exit
|
|
|
|
|
2019-09-16 08:30:16 +00:00
|
|
|
printf "\uf9a1 <span color=\"#8FAAFC\">%s</span> <span color=\"#50fa7b\">(%s)</span>\n" ${network} ${ip}
|
2019-01-19 14:00:35 +00:00
|
|
|
|
|
|
|
# On click copy IP
|
2019-03-05 17:18:35 +00:00
|
|
|
[ -n "${BLOCK_BUTTON:-}" ] && echo -n "${ip}" | tr -d '\n' | xclip -selection c || true
|