Compare commits
4 Commits
dffd283d4c
...
f814325966
Author | SHA1 | Date | |
---|---|---|---|
f814325966 | |||
5b02adfa88 | |||
2e93b1a285 | |||
964916722c |
1
.config/scripts/bin/link-virtual-mic
Symbolic link
1
.config/scripts/bin/link-virtual-mic
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../pipewire/link-virtual-mic
|
1
.config/scripts/bin/lockscreen
Symbolic link
1
.config/scripts/bin/lockscreen
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../sway/lockscreen
|
78
.config/scripts/pipewire/link-virtual-mic
Executable file
78
.config/scripts/pipewire/link-virtual-mic
Executable file
@ -0,0 +1,78 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
import argparse
|
||||||
|
import subprocess
|
||||||
|
import time
|
||||||
|
|
||||||
|
mappingMic = {
|
||||||
|
"output\\.rnnoise_source:capture_1": "mixed-mic:input_FL",
|
||||||
|
"output\\.rnnoise_source:capture_2": "mixed-mic:input_FR"
|
||||||
|
}
|
||||||
|
|
||||||
|
mappingLoopback = {
|
||||||
|
"loopback:monitor_FL": "mixed-mic:input_FL",
|
||||||
|
"loopback:monitor_FR": "mixed-mic:input_FR"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
parser = argparse.ArgumentParser(
|
||||||
|
prog="link-virtual-mic",
|
||||||
|
description="link pipewire virtual mics.")
|
||||||
|
|
||||||
|
parser.add_argument("-a", "--all", action="store_true")
|
||||||
|
parser.add_argument("-d", "--disconnect", action="store_true")
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
connectAll = args.all and not args.disconnect
|
||||||
|
disconnectAll = args.all and args.disconnect
|
||||||
|
|
||||||
|
disconnectMic = args.all and args.disconnect
|
||||||
|
disconnectLoopback = args.disconnect
|
||||||
|
|
||||||
|
tries = -1
|
||||||
|
while tries < 20:
|
||||||
|
tries += 1
|
||||||
|
|
||||||
|
micSuccess = True
|
||||||
|
loopbackSuccess = True
|
||||||
|
if disconnectAll or not args.disconnect:
|
||||||
|
micSuccess = manageLinks(mappingMic, disconnectMic)
|
||||||
|
if connectAll or disconnectLoopback:
|
||||||
|
loopbackSuccess = manageLinks(mappingLoopback, disconnectLoopback)
|
||||||
|
|
||||||
|
if not micSuccess or not loopbackSuccess:
|
||||||
|
time.sleep(1)
|
||||||
|
continue
|
||||||
|
break
|
||||||
|
|
||||||
|
|
||||||
|
def manageLinks(mapping, disconnect=False):
|
||||||
|
for key, value in mapping.items():
|
||||||
|
cmdOpts = {"shell": True, "capture_output": True, "text": True}
|
||||||
|
|
||||||
|
cmd = "pw-link -o | grep -e '{}'".format(key)
|
||||||
|
completedProcess = subprocess.run(cmd, **cmdOpts)
|
||||||
|
if completedProcess.returncode == 1:
|
||||||
|
return False
|
||||||
|
output = completedProcess.stdout.split('\n')[0]
|
||||||
|
|
||||||
|
cmd = "pw-link -i | grep -e '{}'".format(value)
|
||||||
|
completedProcess = subprocess.run(cmd, **cmdOpts)
|
||||||
|
if completedProcess.returncode == 1:
|
||||||
|
return False
|
||||||
|
input = completedProcess.stdout.split('\n')[0]
|
||||||
|
|
||||||
|
if disconnect:
|
||||||
|
cmd = ["pw-link", "-d", output, input]
|
||||||
|
else:
|
||||||
|
cmd = ["pw-link", output, input]
|
||||||
|
print(' '.join(cmd))
|
||||||
|
subprocess.run(cmd, capture_output=True)
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
9
.config/scripts/sway/lockscreen
Executable file
9
.config/scripts/sway/lockscreen
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Times the screen off and puts it to background
|
||||||
|
swayidle \
|
||||||
|
timeout 1 'swaymsg "output * dpms off"' \
|
||||||
|
resume 'swaymsg "output * dpms on"' &
|
||||||
|
# Locks the screen immediately
|
||||||
|
swaylock -c 000000
|
||||||
|
# Kills last background task so idle timer doesn't keep running
|
||||||
|
kill %%
|
Loading…
Reference in New Issue
Block a user