Created
April 6, 2019 11:23
-
-
Save shmidtelson/18112efbd1c10e3e76ef77b1b77c8f9d to your computer and use it in GitHub Desktop.
Asus xonar DGX force switch FRONT and BACK output [manjaro KDE]
This file contains 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 | |
import os | |
import re | |
import subprocess | |
# 0 - sub | |
# 1 - headphones | |
status =0 | |
regex = r": values=(.+)" | |
get_status = os.popen("amixer -c 0 cset name='Analog Output Playback Enum'").read() | |
matches = re.finditer(regex, str(get_status), re.MULTILINE) | |
for matchNum, match in enumerate(matches, start=1): | |
for groupNum in range(0, len(match.groups())): | |
groupNum = groupNum + 1 | |
current_result = match.group(groupNum) | |
if(int(current_result) == 0): | |
os.system(f"amixer -c 0 cset name='Analog Output Playback Enum' 1") | |
subprocess.call(['notify-send', 'Наушники подключены']) # Headphones connected | |
else: | |
os.system(f"amixer -c 0 cset name='Analog Output Playback Enum' 0") | |
subprocess.call(['notify-send', 'Колонки подключены']) # Sub connected |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment