aboutsummaryrefslogtreecommitdiff
path: root/home-manager/homeModules/attachments/hypr-scripts/switch-sink.py
diff options
context:
space:
mode:
authorspl3g <notspl3g@duck.com>2026-03-18 18:01:41 +0300
committerspl3g <notspl3g@duck.com>2026-03-18 18:01:59 +0300
commit03648b3d9f177227df40129bed22558f6924b91c (patch)
tree8a22eda142beeafd9002a8d5901ba9428a77ad52 /home-manager/homeModules/attachments/hypr-scripts/switch-sink.py
parentdc19a2b583b3ab50d8e36ff0a90ca633495f675f (diff)
so.. v2 i guess
Diffstat (limited to 'home-manager/homeModules/attachments/hypr-scripts/switch-sink.py')
-rwxr-xr-xhome-manager/homeModules/attachments/hypr-scripts/switch-sink.py49
1 files changed, 0 insertions, 49 deletions
diff --git a/home-manager/homeModules/attachments/hypr-scripts/switch-sink.py b/home-manager/homeModules/attachments/hypr-scripts/switch-sink.py
deleted file mode 100755
index aa7eec1..0000000
--- a/home-manager/homeModules/attachments/hypr-scripts/switch-sink.py
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/usr/bin/env python3
-
-import subprocess
-
-status = subprocess.run(["wpctl", "status"], stdout=subprocess.PIPE).stdout.decode('utf-8')
-status_lines = status.split('\n')
-sink_line = 0
-sinks = []
-sink_names = []
-
-# Get sink line
-for i in range(len(status_lines) - 1):
- if 'Sinks:' in status_lines[i]:
- sink_line = i + 1
- break
-
-# Find unused sinks
-for line in status_lines[sink_line:]:
- if line == ' │ ':
- break
- line = line.split('.')
- nums = line[0]
- name = line[1]
- end_name = line[1].index('[')
- sink = nums[2:].strip()
- if nums[4] == '*':
- continue
-
- sinks.append(sink)
- sink_names.append(name[:end_name].strip())
-
-if (len(sinks) == 0):
- subprocess.run(["notify-send", "Pipewire sink", "No sinks to switch to"])
- exit(0)
-
-selected_sink = subprocess.run(["rofi", "-dmenu"], input="\n".join(sink_names), capture_output=True, text=True).stdout[:-1]
-
-if len(selected_sink) == 0:
- exit(0)
-
-try:
- next_sink = sink_names.index(selected_sink)
-except Exception:
- subprocess.run(["notify-send", "Pipewire sink", "Sink not found"])
- exit(1)
-
-subprocess.run(["wpctl", "set-default", sinks[next_sink]])
-
-subprocess.run(["notify-send", "Pipewire sink", "Selected " + selected_sink])