Skip to content

Commit

Permalink
Fix net-traffic i3block
Browse files Browse the repository at this point in the history
  • Loading branch information
gardotd426 committed Dec 20, 2020
1 parent 4df7540 commit 9fdef4b
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 1 deletion.
10 changes: 9 additions & 1 deletion PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@ source=("${url2}"/ayu-theme_0.2.0-1ubuntu1~ppa1_amd64.deb
"${url5}"/ubiquity-slideshow-regolith_138.5-ubuntu1~regolith1_all.deb
"${url5}"/xrescat_1.1-1ubuntu1ppa1_amd64.deb
flashback.patch
i3-config.patch)
i3-config.patch
regolith-look.patch
net-traffic.patch
)


sha256sums=(cf0d111e9bc12e163b930849105626e535550d066bac280052d83a0e4d458818
Expand Down Expand Up @@ -122,6 +125,8 @@ sha256sums=(cf0d111e9bc12e163b930849105626e535550d066bac280052d83a0e4d458818
9c641ad29504864ed08cd67f34583e72f67143a784ee058f37ec703e0b823ad0
63082efb191f31c3bc4be28f7118aa38e53b0d18b4366cbdc275a628b36876ce
06d1ff06149838a473191d71bd5d98f91e00ec60cdb4ee994d69f083a1233810
ad7d324de0652fa63ee6165113a1a6ce7699a79f2db7c61d9503803c9c8807f3
6e4c31bf1d7016cff0aa73effda3b579f674d5350c122cfa27c3aeeb19df2ae5
)


Expand Down Expand Up @@ -227,7 +232,9 @@ package_regolith-i3xrocks () {
extract_deb "${srcdir}"/i3xrocks-weather_3.2.6-1ubuntu2_amd64.deb
extract_deb "${srcdir}"/i3xrocks-wifi_3.2.6-1ubuntu2_amd64.deb

patch "${pkgdir}"/usr/share/i3xrocks/net-traffic -i "${srcdir}"/net-traffic.patch
move_copyright

}


Expand Down Expand Up @@ -256,6 +263,7 @@ package_regolith-styles () {
move_copyright
cp "${pkgdir}"/etc/regolith/styles/ayu/typeface "${pkgdir}"/etc/regolith/styles/lascaille/typeface
cp "${pkgdir}"/etc/regolith/styles/ayu/typeface "${pkgdir}"/etc/regolith/styles/cahuella/typeface
patch "${pkgdir}"/usr/bin/regolith-look -i "${srcdir}"/regolith-look.patch
}

package_regolith-desktop-config () {
Expand Down
44 changes: 44 additions & 0 deletions net-traffic.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
--- a/usr/share/i3xrocks/net-traffic 2020-12-20 04:42:27.110317704 -0500
+++ b/usr/share/i3xrocks/net-traffic 2020-12-20 04:42:14.934247793 -0500
@@ -30,17 +30,6 @@
BPS=false
ULEV=2

-# Handle button event
-if [ "x${BUTTON}" == "x1" ] ; then
- if [ "$INT_TYPE" == "W" ]; then
- ACTION=$(xrescat i3xrocks.action.net-traffic.left "/usr/bin/gnome-control-center --class=floating_window wifi")
- /usr/bin/i3-msg -q exec "$ACTION"
- else
- ACTION=$(xrescat i3xrocks.action.net-traffic.right "/usr/bin/gnome-control-center --class=floating_window network")
- /usr/bin/i3-msg -q exec "$ACTION"
- fi
-fi
-
# determine the net interface name
IF=$(ip route get 1.1.1.1 | grep -Po '(?<=dev\s)\w+' | cut -f1 -d ' ')
IF="${BLOCK_INSTANCE:-${IF}}"
@@ -59,6 +48,23 @@
;;
esac

+# Handle button event
+if [ "x${BUTTON}" == "x1" ] ; then
+ if [ "$INT_TYPE" == "W" ]; then
+ ACTION=$(xrescat i3xrocks.action.net-traffic.left "/usr/bin/gnome-control-center --class=floating_window wifi")
+ /usr/bin/i3-msg -q exec "$ACTION"
+ else
+ ACTION=$(xrescat i3xrocks.action.net-traffic.right "/usr/bin/gnome-control-center --class=floating_window network")
+ /usr/bin/i3-msg -q exec "$ACTION"
+ fi
+fi
+
+# determine the net interface name
+IF=$(ip route get 1.1.1.1 | grep -Po '(?<=dev\s)\w+' | cut -f1 -d ' ')
+ IF="${BLOCK_INSTANCE:-${IF}}"
+
+ [ "$IF" = "" ] && exit
+
# get arguments
while getopts i:a:u:e:t:U:D:lhvb option
do

0 comments on commit 9fdef4b

Please sign in to comment.