added waybar, waypaper and custom bin scripts
This commit is contained in:
54
bin/cycle_sinks.py
Executable file
54
bin/cycle_sinks.py
Executable file
@@ -0,0 +1,54 @@
|
||||
import pulsectl
|
||||
|
||||
pulse = pulsectl.Pulse('my-client-name')
|
||||
|
||||
|
||||
class my_sink:
|
||||
name = "Here goes the name of the sink"
|
||||
index = -1
|
||||
desc = "Here goes a description"
|
||||
sink = ""
|
||||
|
||||
def __init__(self, sink):
|
||||
self.name = sink.name
|
||||
self.index = sink.index
|
||||
self.desc = sink.description
|
||||
self.sink = sink
|
||||
|
||||
def __str__(self):
|
||||
return f"\"{self.name}\" with index {self.index} and description: \"{self.desc}\""
|
||||
|
||||
|
||||
def get_sinks():
|
||||
output_sinks = []
|
||||
print(pulse.sink_list())
|
||||
for s in pulse.sink_list():
|
||||
m = my_sink(s)
|
||||
output_sinks.append(m)
|
||||
|
||||
print(output_sinks)
|
||||
return output_sinks
|
||||
|
||||
|
||||
def next_sink(output_sinks):
|
||||
current_sink = pulse.server_info().default_sink_name
|
||||
position = 0
|
||||
for s in output_sinks:
|
||||
if s.name == current_sink:
|
||||
break
|
||||
else:
|
||||
position += 1
|
||||
|
||||
if position == len(output_sinks) - 1:
|
||||
new_output = output_sinks[0]
|
||||
else:
|
||||
new_output = output_sinks[position+1]
|
||||
|
||||
print(current_sink + " will be switched to " + new_output.name)
|
||||
|
||||
pulse.default_set(new_output.sink)
|
||||
|
||||
|
||||
# Press the green button in the gutter to run the script.
|
||||
if __name__ == '__main__':
|
||||
next_sink(get_sinks())
|
||||
Reference in New Issue
Block a user