Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
#! /usr/bin/python
#improvement of Weslley S Pereira's script by Jacob Trock
# 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')
os.system('pacmd set-card-profile bluez_card.' + v + ' a2dp_sink')
t_btn.config(text='Switch Mic On')
root = tk.Tk()
e = tk.Entry(textvariable=v)
e.insert(0, v)
t_btn = tk.Button(text='Switch Mic On', width=15, command=toggle)

This comment has been minimized.

Copy link

@tomas-herman tomas-herman commented Jan 28, 2021

Thank you, this works beautifully, just modified v = "88_D0_39_6C_6E_AC" to my version of bluez_card and it works like a charm.


This comment has been minimized.

Copy link
Owner Author

@JakeTrock JakeTrock commented Jan 28, 2021

glad you liked it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment