Compare commits
4 commits
1fafe02965
...
8f9aeb27a5
Author | SHA1 | Date | |
---|---|---|---|
8f9aeb27a5 | |||
80a209ece5 | |||
1a5a1f1db0 | |||
cbf62f5bfb |
7 changed files with 112 additions and 2 deletions
|
@ -28,6 +28,9 @@
|
|||
ipinfo # IP geolocation
|
||||
ranger # TUI file manager
|
||||
protonup-rs
|
||||
trickle # cli network limiter
|
||||
du-dust # disk usage visualizer
|
||||
rofi-audio-switcher
|
||||
|
||||
mpv # Video player
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
{pkgs, ...}: {
|
||||
# services.easyeffects.enable = true;
|
||||
xdg.configFile."easyeffects/output/Beyerdynamic_DT990_Oratory.json" = {
|
||||
source = ../../../../rsc/config/easyeffects/Beyerdynamic_DT990_Oratory.json;
|
||||
};
|
||||
home.packages = with pkgs; [easyeffects];
|
||||
}
|
||||
|
|
|
@ -41,6 +41,10 @@
|
|||
../common/optional/udisks.nix
|
||||
];
|
||||
|
||||
nix.extraOptions = ''
|
||||
download-speed = 4000
|
||||
'';
|
||||
|
||||
nixpkgs = {
|
||||
# You can add overlays here
|
||||
overlays = [
|
||||
|
|
|
@ -5,4 +5,5 @@
|
|||
alvr = pkgs.callPackage ./alvr {};
|
||||
feishin-appimage = pkgs.callPackage ./feishin {};
|
||||
protonup-rs = pkgs.callPackage ./protonup-rs {};
|
||||
rofi-audio-switcher = pkgs.callPackage ./rofi-audio-switcher {};
|
||||
}
|
||||
|
|
14
pkgs/rofi-audio-switcher/default.nix
Normal file
14
pkgs/rofi-audio-switcher/default.nix
Normal file
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
lib,
|
||||
pkgs,
|
||||
fetchFromGitHub,
|
||||
...
|
||||
}:
|
||||
pkgs.stdenv.mkDerivation rec {
|
||||
name = "rofi-audio-switcher";
|
||||
propagatedBuildInputs = [
|
||||
pkgs.python311
|
||||
];
|
||||
dontUnpack = true;
|
||||
installPhase = "install -Dm755 ${./wireplumber_audio_switcher.py} $out/bin/rofi-audio-switcher";
|
||||
}
|
87
pkgs/rofi-audio-switcher/wireplumber_audio_switcher.py
Normal file
87
pkgs/rofi-audio-switcher/wireplumber_audio_switcher.py
Normal file
|
@ -0,0 +1,87 @@
|
|||
#!/usr/bin/python3
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
"""
|
||||
Wireplumber sink/source switcher
|
||||
|
||||
It lets you pass your sinks/sources into a dmenu dropdown
|
||||
for ease of access
|
||||
|
||||
Usage:
|
||||
./wireplumber_audio_switcher.py <Sinks|Sources>
|
||||
"""
|
||||
|
||||
GROUP_DELIMITER = " ├─"
|
||||
ITEM_DELIMITER = " │ "
|
||||
ACCEPTED_GROUPS = set(["Sinks:", "Sources:"])
|
||||
|
||||
|
||||
def clean_line(line: str):
|
||||
line = (
|
||||
line.replace(GROUP_DELIMITER, "").replace(ITEM_DELIMITER, "").replace(":", "")
|
||||
)
|
||||
vol_index = line.find("[")
|
||||
if vol_index > 0:
|
||||
line = line[:vol_index]
|
||||
if "*" in line:
|
||||
line = line.replace("*", "")
|
||||
splitted = line.split(".")
|
||||
splitted[1] = f"<b>{splitted[1].strip()} *</b>"
|
||||
line = ". ".join(splitted)
|
||||
return line.strip()
|
||||
|
||||
|
||||
def parse_wpctl_status():
|
||||
found_audio_tab = False
|
||||
current_subgroup = None
|
||||
processed_data = {}
|
||||
output = subprocess.run(
|
||||
"wpctl status -k",
|
||||
shell=True,
|
||||
encoding="utf-8",
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
)
|
||||
|
||||
for line in output.stdout.split("\n"):
|
||||
if not found_audio_tab and line == "Audio":
|
||||
found_audio_tab = True
|
||||
|
||||
elif found_audio_tab:
|
||||
if line == "":
|
||||
found_audio_tab = False
|
||||
break
|
||||
elif line == ITEM_DELIMITER:
|
||||
current_subgroup = None
|
||||
continue
|
||||
elif line.startswith(GROUP_DELIMITER):
|
||||
current_subgroup = clean_line(line)
|
||||
processed_data[current_subgroup] = []
|
||||
continue
|
||||
elif current_subgroup and line.startswith(ITEM_DELIMITER):
|
||||
processed_data[current_subgroup].append(clean_line(line))
|
||||
continue
|
||||
return processed_data
|
||||
|
||||
|
||||
def pipe_into_dmenu(output):
|
||||
output = subprocess.run(
|
||||
f"echo '{output}' | rofi -dmenu -markup-rows",
|
||||
shell=True,
|
||||
encoding="utf-8",
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
)
|
||||
|
||||
if output.returncode != 0:
|
||||
return None
|
||||
return output.stdout
|
||||
|
||||
|
||||
output = parse_wpctl_status()
|
||||
sink = pipe_into_dmenu("\n".join(output[sys.argv[1]]))
|
||||
|
||||
if sink:
|
||||
sink_id = sink.split(".")[0]
|
||||
subprocess.run(f"wpctl set-default {sink_id}", shell=True)
|
|
@ -8,7 +8,7 @@ function autostart.exec(awful)
|
|||
awful.spawn.with_shell("webcord --start-minimized --force-audio-share-support")
|
||||
-- awful.spawn.with_shell("playerctld daemon")
|
||||
-- awful.spawn.with_shell("xbindkeys")
|
||||
-- awful.spawn.with_shell("easyeffects --gapplication-service")
|
||||
awful.spawn.with_shell("easyeffects --gapplication-service")
|
||||
-- awful.spawn.with_shell("$HOME/.config/nanoKontroller/initSink.sh")
|
||||
-- awful.spawn.with_shell("$HOME/.config/nanoKontroller/audio1.sh")
|
||||
-- awful.spawn.with_shell(
|
||||
|
|
Loading…
Reference in a new issue