Spyke

Posts

A pure wireplumber way to switch audio devices, no pactl

$sinkswitch = wpctl set-default $(pw-dump | jaq -r '.[]|select(.type=="PipeWire:Interface:Node" and .info.props["media.class"]=="Audio/Sink")|[.id,.info.props["node.name"],.info.props["node.description"]]|@tsv' | awk -F'\t' -v d="$(wpctl inspect @DEFAULT_AUDIO_SINK@|awk -F'"' '/node.name/{print $2;exit}')" '$2!=d&&$2!="easyeffects_sink"{a[$3]=$1;n[++devs]=$3}END{if(devs>1){c="walker -d -p \"Audio Device: \"";for(i=1;i<=devs;i++)print n[i]|&c;close(c,"to");c|&getline p;if(p!=""){print a[p];system("notify-send --urgency=low --icon=/run/current-system/sw/share/icons/Flat-Remix-Red-Dark/panel/audio-volume-high-symbolic.svg \""p"\" -h string:x-canonical-private-synchronous:sink-state")}}else if(devs==1){for(k in a){print a[k];system("notify-send --urgency=low --icon=/run/current-system/sw/share/icons/Flat-Remix-Red-Dark/panel/audio-volume-high-symbolic.svg \""k"\" -h string:x-canonical-private-synchronous:sink-state")}}}') >/dev/null && pw-play --volume=0.2 /run/current-system/sw/share/sounds/freedesktop/stereo/audio-volume-change.oga >/dev/null &!


or, escaped for waybar:

"wpctl set-default $(pw-dump | jaq -r '.[]|select(.type==\"PipeWire:Interface:Node\" and .info.props[\"media.class\"]==\"Audio/Sink\")|[.id,.info.props[\"node.name\"],.info.props[\"node.description\"]]|@tsv' | awk -F'\\t' -v d=\"$(wpctl inspect @DEFAULT_AUDIO_SINK@|awk -F'\\\"' '/node.name/{print $2;exit}')\" '$2!=d&&$2!=\"easyeffects_sink\"{a[$3]=$1;n[++devs]=$3}END{if(devs>1){c=\"walker -d -p \\\"Audio Device: \\\"\";for(i=1;i<=devs;i++)print n[i]|&c;close(c,\"to\");c|&getline p;if(p!=\"\"){print a[p];system(\"notify-send --urgency=low --icon=/run/current-system/sw/share/icons/Flat-Remix-Red-Dark/panel/audio-volume-high-symbolic.svg \\\"\"p\"\\\" -h string:x-canonical-private-synchronous:sink-state\")}}else if(devs==1){for(k in a){print a[k];system(\"notify-send --urgency=low --icon=/run/current-system/sw/share/icons/Flat-Remix-Red-Dark/panel/audio-volume-high-symbolic.svg \\\"\"k\"\\\" -h string:x-canonical-private-synchronous:sink-state\")}}}') >/dev/null && pw-play --volume=0.2 /run/current-system/sw/share/sounds/freedesktop/stereo/audio-volume-change.oga >/dev/null &!"

there's probably a lot to improve here, took forever to get this working, did not do a cleanup pass, jfc this took forever, replace tofi with your menu of choice, thought people should have this.

wishlist: change the icon based on volume level

View original on lemmy.frozeninferno.xyz
linuxquestions·Linux QuestionsbyCommunist

Make waybar stable and reliable

So, i'm on hyprland and right now i've setup

exec-once = zsh -c 'sleep 1' && ps aux | rg ' [w]aybar' || while pgrep -f Hyprland > /dev/null ; do (waybar); done

what i need is to add a clause that terminates the "while true; do (waybar); done" that way when the compositor is restarted it kills the previous instance of while true do waybar

Just to break down the reasoning for my current command,

sleep 1 is to prevent certain stupid bugs from occurring that might be fixed now but weren't in the early days

ps aux part is to make sure waybar isn't already running

while pgrep -f Hyprland is SUPPOSED to end the loop when Hyprland ends, but it does not. I don't know why.

The reason for the while loop is to restart waybar if it crashes, but right now, when i restart hyprland (I use wl-restart) the previous while loop doesn't actually close, and waybar binds to the previous hyprlands IPC and I end up with no workspace icons or window names. Any ideas for making this work?

edit: old solution was needlessly complex,

exec-once = pidof waybar > /dev/null || while true ; do (waybar > /dev/null); done

works perfectly!

View original on lemmy.frozeninferno.xyz

Range extending of wifi over powerline network adapter

Right now I have the modem/router in the attic, where most of the computers are, but i also have a computer in the basement, to get to that computer i have a powerline network adapter with two ethernet ports.

However, there is now a laptop that needs to be connected down there and doesn't have ethernet, wifi range down there is terrible, i'd like to plug something into the additional ethernet that just outputs the same wifi as upstairs (that way i don't even have to change wifi connections, and it connects automatically to the best one), what would be the best way to do that?

View original on lemmy.frozeninferno.xyz
ergomechkeyboards·ErgoMechKeyboardsbyCommunist

Looking for a recommendation of a glove80 like

I like the glove80, but I don't want my keyboard to have any lights on it, and I want blank keycaps

I feel like I could find it for much cheaper without these things, but I also want it to have that instant actuation/deactuation found in certain gaming keyboards that makes the latency effectively tiny

Is there anything like this on the market? I can't find anything.

edit: went with a charachorder, infinitely better than any normal keyboard.

View original on lemmy.frozeninferno.xyz

You reached the end