Compare commits

..

6 Commits

Author SHA1 Message Date
37f69e099a Update .bin 2025-11-09 15:24:22 -06:00
2c120d8e85 Commit changes to bin 2025-11-09 13:54:32 -06:00
9fad8fe3cb Update bin 2025-11-09 13:53:59 -06:00
8e4256befa Fix not launching swww 2025-10-21 16:25:04 -05:00
1226e4cf44 Add script for swapping audio outs 2025-10-19 15:00:26 -05:00
e7f930b2e2 Automatically run black and isort on shit 2025-10-19 13:57:16 -05:00
6 changed files with 162 additions and 3 deletions

View File

@@ -28,6 +28,14 @@ set foldmethod=syntax
"nnoremap <space> za "nnoremap <space> za
set nofoldenable " Fuck autofolding set nofoldenable " Fuck autofolding
" ALE
let g:ale_fixers = {
\ '*': ['remove_trailing_lines', 'trim_whitespace'],
\ 'python': ['black', 'isort'],
\}
let g:ale_python_isort_options = '--profile black'
let g:ale_fix_on_save = 1
" Lightline " Lightline
set noshowmode set noshowmode
let g:lightline = { let g:lightline = {

View File

@@ -1,2 +1,2 @@
# vim: set ft=hyprlang: # vim: set ft=hyprlang:
exec-once = pgrep -U $USER swww-daemon || { rm /run/user/$UID/swww-wayland-1.sock; swww-daemon --format xrgb; } exec-once = pgrep -U $USER swww-daemon || { rm /run/user/$UID/wayland-1-swww-daemon..sock; swww-daemon --format xrgb; }

View File

@@ -40,7 +40,7 @@
"margin-right": 16, "margin-right": 16,
"modules-left": ["gamemode", "battery", "temperature", "cpu", "memory", "network"], "modules-left": ["gamemode", "battery", "temperature", "cpu", "memory", "network"],
"modules-center": [], "modules-center": [],
"modules-right": ["mpris", "pulseaudio", "backlight", "idle_inhibitor", "clock"], "modules-right": ["mpris", "pulseaudio", "custom/output-device", "backlight", "idle_inhibitor", "clock"],
"clock": { "clock": {
"format": "{:%a %b %d %I:%M %p}", "format": "{:%a %b %d %I:%M %p}",
"tooltip": false "tooltip": false
@@ -143,5 +143,14 @@
"format": "", "format": "",
"tooltip-format": "An rpm-ostree deployment is pending and will be applied upon the next reboot", "tooltip-format": "An rpm-ostree deployment is pending and will be applied upon the next reboot",
"exec": "rpm-ostree status --json | jq -e '.deployments[0].staged'" "exec": "rpm-ostree status --json | jq -e '.deployments[0].staged'"
},
"custom/output-device": {
"interval": 60,
"format": "{}",
"tooltip-format": "Click to switch between output devices",
"exec-on-event": true,
"exec": "$HOME/.config/waybar/scripts/output-devices.py --iconify",
"on-click": "$HOME/.config/waybar/scripts/output-devices.py --next --iconify",
"on-click-right": "$HOME/.config/waybar/scripts/output-devices.py --previous --iconify"
} }
}] }]

View File

@@ -0,0 +1,138 @@
#! /usr/bin/env python3
import argparse
import json
import pprint
import subprocess
def get_sinks():
"""
Consult pactl and get a sorted list of all sinks as dicts
"""
sinks = json.loads(
subprocess.run(
["pactl", "-f", "json", "list", "sinks"],
capture_output=True,
text=True,
check=True,
).stdout
)
return sorted(sinks, key=lambda s: s["index"])
def get_status():
status = json.loads(
subprocess.run(
["pactl", "-f", "json", "info"],
capture_output=True,
text=True,
check=True,
).stdout
)
return status
def change_sink(sink):
"""
Provided a sink object, use pactl to change over to it
"""
assert sink.get("name")
return subprocess.run(["pactl", "set-default-sink", sink.get("name")], check=True)
def get_current_sink(sinks, status):
"""
Given a list of all sinks and the status of the system, return the dict
for the sink that's currently the default output device
"""
return next(
(
sink
for sink in sinks
if sink.get("name", "") == status.get("default_sink_name", "")
),
None,
)
def get_offset_sink(sinks, currentsink, offset=1):
def find_sink_by_index(sinks, index):
for sink in sinks:
if sink["index"] == index:
return sink
return None
"""
Given a list of sinks and the current default sink, get some offset in the
list of all sinks away from it. Useful for getting next/previous sinks
"""
indexes = [s["index"] for s in sinks]
i = indexes.index(currentsink.get("index", 0))
next_index = indexes[(i + offset) % len(indexes)]
return find_sink_by_index(sinks, next_index)
def get_sink_icon(sinks, currentsink):
"""
Given the list of all sinks and the current one, figure out how we should
display that as a small icon
"""
icon = {
"hdmi": "\uf26c", # fa-tv
"analog": "\uf028", # fa-volume-up
"headphones": "\uf025", # fa-headphones
"bluetooth": "\uf294", # fa-bluetooth-b
}
def classify(sink):
name = sink.get("name", "").lower()
port = sink.get("active_port", "")
desc = sink.get("description", "").lower()
if "hdmi" in name or "hdmi" in desc:
return "hdmi"
if "headphones" in port or "headset" in desc:
return "headphones"
if "analog" in name or "lineout" in port:
return "analog"
if "bluez" in name or "bluetooth" in desc:
return "bluetooth"
return "analog"
return icon[classify(currentsink)]
def main():
parser = argparse.ArgumentParser(
description="Display and cycle through PulseAudio and PipeWire sinks"
)
parser.add_argument(
"-i",
"--iconify",
action="store_true",
help="Print an icon instead of the full name of the sink",
)
parser.add_argument(
"-n", "--next", action="store_true", help="Advance to the next sink"
)
parser.add_argument(
"-p", "--previous", action="store_true", help="Advance to the previous sink"
)
args = parser.parse_args()
# Get pactl's status
sinks = get_sinks()
status = get_status()
currentsink = get_current_sink(sinks, status)
# Figure out our offset into the list
offset = 1 if args.next else -1 if args.previous else 0
# Figure out where we wanna go
newsink = get_offset_sink(sinks, currentsink, offset)
change_sink(newsink)
if args.iconify:
print(get_sink_icon(sinks, newsink))
else:
print(newsink.get("description"))
if __name__ == "__main__":
main()

View File

@@ -222,3 +222,7 @@ window#waybar.fullscreen #window {
color: rgba(235, 219, 178, 0.2); color: rgba(235, 219, 178, 0.2);
padding: 0 1em; padding: 0 1em;
} }
#custom-output-device {
color: #ebdbb2;
padding: 0 1em;
}