Skip to content

Commit

Permalink
Fix the auto switch to wlan when wire is unpluged
Browse files Browse the repository at this point in the history
  • Loading branch information
ericbsd committed Sep 4, 2021
1 parent 6b77a8a commit 1995bdd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/auto-switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@
if openrc:
os.system(f'service dhcpcd.{nic} stop')
else:
os.system(f'service dhclient stop {nic}')
if 'wlan' in nic:
os.system(f'service dhclient stop {nic}')
else:
os.system(f'service netif stop {nic}')
os.system('service routing restart')

nics = Popen(
['ifconfig', '-l', 'ether'],
Expand Down
2 changes: 1 addition & 1 deletion src/trayicon.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def nm_menu(self):
disconnected = Gtk.MenuItem("Wired %s Unplug" % cardnum)
disconnected.set_sensitive(False)
self.menu.append(disconnected)
cardnum += 1
cardnum += 1
self.menu.append(Gtk.SeparatorMenuItem())
elif "wlan" in netcard:
if connection_state == "Disabled":
Expand Down

0 comments on commit 1995bdd

Please sign in to comment.