Skip to content

Commit

Permalink
Add device '5'-Monitor to the 'Switch' menu
Browse files Browse the repository at this point in the history
  • Loading branch information
centic9 committed Jul 15, 2022
1 parent da30a45 commit 2b63a00
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ You can optionally supply a path to the `headsetcontrol` binary.

If you provide a commandline argument `--switch-command`, an additional "Switch" menu will be added with
options to switch between Soundcard and some Headsets and USB devices. The provided application or script will be
invoked with "1" for soundcard, "2" for headset, "3" for an USB headset and "4" for a chat-device
invoked with "1" for soundcard, "2" for headset, "3" for an USB headset, "4" for a chat-device and "5" for Monitor Audio
(it should be easy to adjust this for your devices).

A script can for example use pactl and/or pacmd to send audio output to the correct endpoint
Expand Down
18 changes: 13 additions & 5 deletions headset-charge-indicator.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,12 @@ def change_icon():
elif e.returncode == 3:
ind.set_icon_full("audio-headphones", "USB")
prevSwitch = 3
else:
elif e.returncode == 4:
ind.set_icon_full("audio-input-microphone", "Speakerphone")
prevSwitch = 4
else:
ind.set_icon_full("monitor", "Monitor")
prevSwitch = 5

def fetch_capabilities():
try:
Expand Down Expand Up @@ -296,10 +299,15 @@ def switch_menu():
switchmenu.append(usb)
usb.show_all()

usb = Gtk.MenuItem(label="Chat Device")
usb.connect("activate", switch_sound, 4)
switchmenu.append(usb)
usb.show_all()
chat = Gtk.MenuItem(label="Chat Device")
chat.connect("activate", switch_sound, 4)
switchmenu.append(chat)
chat.show_all()

monitor = Gtk.MenuItem(label="Monintor")
monitor.connect("activate", switch_sound, 5)
switchmenu.append(monitor)
monitor.show_all()

return switchmenu

Expand Down

0 comments on commit 2b63a00

Please sign in to comment.