non working custom/network waybar

This commit is contained in:
rileyrg 2021-05-28 17:11:25 +02:00
parent 9d21c7dd91
commit 56499342c1
4 changed files with 76 additions and 19 deletions

View file

@ -1182,7 +1182,7 @@ bindsym $mod+Control+t exec sway-notify "Opening NEW terminal instance" && alacr
"backlight",
"battery",
"custom/power-draw",
"network",
"custom/net",
"wlr/taskbar",
],
@ -1347,6 +1347,16 @@ bindsym $mod+Control+t exec sway-notify "Opening NEW terminal instance" && alacr
"tooltip": "false",
},
"custom/net": {
"return-type" : "json",
"format": "Interface:{}",
"exec": "waybar-ip-info-json wlp3s0",
"interval": 60,
"on-click-right": "sway-wifi",
"tooltip-format": "TT{}",
"tooltip": "true",
},
"wlr/taskbar": {
"format": "{icon}",
"icon-size": 14,
@ -1551,13 +1561,22 @@ bindsym $mod+Control+t exec sway-notify "Opening NEW terminal instance" && alacr
3. ~/bin/sway/waybar-ip-info-json
```bash
ifname="${1:-$(printf '%s' /sys/class/net/*/wireless | cut -d/ -f5)}"
[ -z "$ifname" ] && exit 1
pubip="$(curl -s -m 1 ipinfo.io/ip)"
pubip="$([ -z "$pubip" ] && echo "Offline" || echo "$pubip")"
lip=$(ip -j address | jq -r '.[] | select (.ifname=='\"$ifname\"').addr_info[] | select(.family=="inet").local')
lip="$([ -z "$lip" ] && echo "Offline" || echo "$lip")"
echo "{ \"text\" = \"$lip\", \"tooltip\" = \"$pubip\",\"ifname\" = \"$ifname\",\"public_ip\" = \"$pubip\",\"local_ip\" = \"$lip\"}"
ifname="${1:-$(printf '%s' /sys/class/net/*/wireless | cut -d/ -f5)}"
[ -z "$ifname" ] && exit 1
pubip="$(curl -s -m 1 ipinfo.io/ip)"
pubip="$([ -z "$pubip" ] && echo "Offline" || echo "$pubip")"
lip=$(ip -j address | jq -r '.[] | select (.ifname=='\"$ifname\"').addr_info[] | select(.family=="inet").local')
lip="$([ -z "$lip" ] && echo "Offline" || echo "$lip")"
ssid="Stan"
jq --unbuffered --compact-output -n \
--arg text "WIFI" \
--arg tooltip "TT" \
--arg ifname "$ifname" \
--arg ssid "$ssid" \
--arg public_ip "$pubip" \
--arg ippadr "$lip" \
'{text: $text, tooltip: $tooltip, ifname: $ifname, ssid: $ssid, public_ip: $public_ip, ipaddr: $ippadr}'
# jq --unbuffered --compact-output $JSON_STRING
```
4. ~/bin/sway/waybar-monitors
@ -1905,7 +1924,7 @@ notify-send -t 3000 "${@}"
```
<a id="orgc51c93b"></a>
<a id="orgfe03b0b"></a>
### ~/bin/sway/sway-screen
@ -1926,7 +1945,7 @@ swaymsg "output ${m} ${c}"
### ~/bin/sway/sway-screen-menu
Gui to select a display and enable/disable it. Calls down to [~/bin/sway/sway-screen](#orgc51c93b).
Gui to select a display and enable/disable it. Calls down to [~/bin/sway/sway-screen](#orgfe03b0b).
:ID: 82455cae-1c48-48b2-a8b3-cb5d44eeaee9

View file

@ -1,7 +1,16 @@
ifname="${1:-$(printf '%s' /sys/class/net/*/wireless | cut -d/ -f5)}"
[ -z "$ifname" ] && exit 1
pubip="$(curl -s -m 1 ipinfo.io/ip)"
pubip="$([ -z "$pubip" ] && echo "Offline" || echo "$pubip")"
lip=$(ip -j address | jq -r '.[] | select (.ifname=='\"$ifname\"').addr_info[] | select(.family=="inet").local')
lip="$([ -z "$lip" ] && echo "Offline" || echo "$lip")"
echo "{ \"text\" = \"$lip\", \"tooltip\" = \"$pubip\",\"ifname\" = \"$ifname\",\"public_ip\" = \"$pubip\",\"local_ip\" = \"$lip\"}"
[ -z "$ifname" ] && exit 1
pubip="$(curl -s -m 1 ipinfo.io/ip)"
pubip="$([ -z "$pubip" ] && echo "Offline" || echo "$pubip")"
lip=$(ip -j address | jq -r '.[] | select (.ifname=='\"$ifname\"').addr_info[] | select(.family=="inet").local')
lip="$([ -z "$lip" ] && echo "Offline" || echo "$lip")"
ssid="Stan"
jq --unbuffered --compact-output -n \
--arg text "WIFI" \
--arg tooltip "TT" \
--arg ifname "$ifname" \
--arg ssid "$ssid" \
--arg public_ip "$pubip" \
--arg ippadr "$lip" \
'{text: $text, tooltip: $tooltip, ifname: $ifname, ssid: $ssid, public_ip: $public_ip, ipaddr: $ippadr}'
# jq --unbuffered --compact-output $JSON_STRING

View file

@ -27,7 +27,7 @@
"backlight",
"battery",
"custom/power-draw",
"network",
"custom/net",
"wlr/taskbar",
],
@ -192,6 +192,16 @@
"tooltip": "false",
},
"custom/net": {
"return-type" : "json",
"format": "Interface:{}",
"exec": "waybar-ip-info-json wlp3s0",
"interval": 60,
"on-click-right": "sway-wifi",
"tooltip-format": "TT{}",
"tooltip": "true",
},
"wlr/taskbar": {
"format": "{icon}",
"icon-size": 14,

View file

@ -1848,7 +1848,7 @@ https://github.com/Alexays/Waybar/wiki/Configuration
"backlight",
"battery",
"custom/power-draw",
"network",
"custom/net",
"wlr/taskbar",
],
@ -2013,6 +2013,16 @@ https://github.com/Alexays/Waybar/wiki/Configuration
"tooltip": "false",
},
"custom/net": {
"return-type" : "json",
"format": "Interface:{}",
"exec": "waybar-ip-info-json wlp3s0",
"interval": 60,
"on-click-right": "sway-wifi",
"tooltip-format": "TT{}",
"tooltip": "true",
},
"wlr/taskbar": {
"format": "{icon}",
"icon-size": 14,
@ -2218,7 +2228,16 @@ Thank you https://github.com/deanproxy/dotfiles/blob/master/linux/i3/scripts/blu
pubip="$([ -z "$pubip" ] && echo "Offline" || echo "$pubip")"
lip=$(ip -j address | jq -r '.[] | select (.ifname=='\"$ifname\"').addr_info[] | select(.family=="inet").local')
lip="$([ -z "$lip" ] && echo "Offline" || echo "$lip")"
echo "{ \"text\" = \"$lip\", \"tooltip\" = \"$pubip\",\"ifname\" = \"$ifname\",\"public_ip\" = \"$pubip\",\"local_ip\" = \"$lip\"}"
ssid="Stan"
jq --unbuffered --compact-output -n \
--arg text "WIFI" \
--arg tooltip "TT" \
--arg ifname "$ifname" \
--arg ssid "$ssid" \
--arg public_ip "$pubip" \
--arg ippadr "$lip" \
'{text: $text, tooltip: $tooltip, ifname: $ifname, ssid: $ssid, public_ip: $public_ip, ipaddr: $ippadr}'
# jq --unbuffered --compact-output $JSON_STRING
#+end_src
******* ~/bin/sway/waybar-monitors
#+begin_src bash :tangle "~/bin/sway/waybar-monitors"