Created
November 23, 2020 15:23
-
-
Save JakeTrock/6158cb81117605d75603fa637e72fd66 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/python | |
#improvement of Weslley S Pereira's script by Jacob Trock | |
try: | |
# Python2 | |
import Tkinter as tk | |
except ImportError: | |
# Python3 | |
import tkinter as tk | |
import os | |
v = "88_D0_39_6C_6E_AC" | |
def toggle(tog=[0]): | |
tog[0] = not tog[0] | |
if tog[0]: | |
os.system('pacmd set-card-profile bluez_card.' + v + ' headset_head_unit') | |
t_btn.config(text='Switch Mic Off') | |
else: | |
os.system('pacmd set-card-profile bluez_card.' + v + ' a2dp_sink') | |
t_btn.config(text='Switch Mic On') | |
root = tk.Tk() | |
root.title('Toggler') | |
e = tk.Entry(textvariable=v) | |
e.insert(0, v) | |
e.pack() | |
t_btn = tk.Button(text='Switch Mic On', width=15, command=toggle) | |
t_btn.pack(pady=5) | |
root.mainloop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks, just for reference, use
pacmd list-cards
when the bluetooth headset is connected to find the value forv