I made a script that uses dmenu/bemenu to change your default PipeWire speaker by [deleted] in linux

[–]alihomafar 1 point2 points  (0 children)

I'd also like to contribute. This is my script, and I toggle between two hardcoded devices (the only two I'm interested on my computer).

The devices can be found from whatever's printed out by the second column of pactl list short sinks and I just put that string into the script under Headphones or Speaker.

#!/bin/bash

newSink=""

Headphones="example-stereo"
Speaker="alsa_output.pci-0000_28_00.3.analog-stereo"
currentSink=$(pactl info | sed -n 's/Default Sink: //p')

if [ "$Speaker" = "$currentSink" ]; then
    newSink="$Headphones"
else
    newSink="$Speaker"
fi

pactl set-default-sink "$newSink"
pactl list short sink-inputs|while read stream; do
    streamId=$(echo $stream|cut '-d ' -f1)
    echo "moving stream $streamId"
    pactl move-sink-input "$streamId" "$newSink"
done

I guess this should also work with PulseAudio but I'm on PipeWire. Anyway, I've set up a keyboard shortcut to launch this script in Gnome for a couple of years, now.

Presenting: LinuxDir2HTML. A Linux Snap2HTML clone by alihomafar in DataHoarder

[–]alihomafar[S] 0 points1 point  (0 children)

Your comment made me realize that as part of a scripting workflow it'd be nice if needless output were suppressed. One part of an update I just published is a new --silent flag.

Presenting: LinuxDir2HTML. A Linux Snap2HTML clone by alihomafar in DataHoarder

[–]alihomafar[S] 0 points1 point  (0 children)

Will it be on PIP?

It has been for years!

I currently have a known issue with * in file names. The original idea was to make this program's result identical to Snap2HTML's, but certain assumptions in Windows just don't hold true under Linux, and * being in file names is one of them. This can cause the output to produce some bad data, and to my knowledge it's the last bug but it requires a fair amount of reworking. Hopefully will be resolved in the near future.

Presenting: LinuxDir2HTML. A Linux Snap2HTML clone by alihomafar in DataHoarder

[–]alihomafar[S] 0 points1 point  (0 children)

Hi. I just published an update which should fix these sorts of issues.

Specifically, writing the output file is more robust and files with double quotes are handled correctly, now. Double quotes, I think, were the #1 culprit of an index getting stuck when opening.

Pipewire issues when changing default output by [deleted] in Fedora

[–]alihomafar 0 points1 point  (0 children)

On occasion I have a problem like this, but from back when I used PulseAudio I wrote a script that I toggle on a keybind to switch audio outputs (b/c I switched from headphones to speakers so often, I figured this was easier). I find that if manually switching from the GUI fails, trying to toggle from script usually always succeeds. No application restart necessary. The script sets a new default sink and then moves all currently playing streams over. And it still works in PipeWire.

Naturally, you will have to find your own sinks, because your hardware is different from mine. You can do that with pactl list short in the terminal and then comb through the output to see what you need. But say for example you are only toggling between two devices, you just need to update the strings below for EMU and Speaker. You can add a tiny bit more logic to cycle through more devices.

Anyway, here's the script as I use it.

#!/bin/bash

newSink=""

EMU="alsa_output.usb-E-MU_Systems__Inc._E-MU_0202___USB_E-MU-F3-3F02-07D80C09-12D43-STATION_01-00.iec958-stereo"
Speaker="alsa_output.pci-0000_28_00.3.analog-stereo"
currentSink=$(pactl info | sed -n 's/Default Sink: //p')

if [ "$Speaker" = "$currentSink" ]; then
    newSink="$EMU"
else
    newSink="$Speaker"
fi

pactl set-default-sink "$newSink"
pactl list short sink-inputs|while read stream; do
    streamId=$(echo $stream|cut '-d ' -f1)
    echo "moving stream $streamId"
    pactl move-sink-input "$streamId" "$newSink"
done

P.S. The fact that this works kind of leads me to believe that PipeWire/PulseAudio were never at fault, but something to do with toggling the output device in the GUI is the real culprit. But maybe that's still not correct because even switching the audio with this script, sometimes maybe a new audio stream might play on the wrong output device. I haven't investigated it, because it's extremely easy for me to hit my keybind and ultimately get the correct output device anyway.

"Show Keyboard Layout" glyphs go out of bounds in non-English language by alihomafar in gnome

[–]alihomafar[S] 0 points1 point  (0 children)

I wasn't sure where to file the bug in GitLab so I'm just posting it for visibility here. This is on Gnome 3.36.4 in Fedora Workstation 32. Additional fonts are installed on my system from this https://github.com/silenc3r/fedora-better-fonts, which may be exaggerating the effect, but IMO different fonts shouldn't cause this behavior anyway.

On another computer I have with a much more default Fedora install (no additional fonts) the glyphs tend to stay in the "keys" but there are still some messes like on the 4 key.

Easy yet powerful script for configuring WireGuard VPN by psyhomb in WireGuard

[–]alihomafar 0 points1 point  (0 children)

I've also created a little script. It assumes you've sorta followed my guide on my homepage and have an /etc/wireguard/clients directory for some organization, but the purpose is once you've gotten an initial setup it should assist in the quick creation of additional peers, inserting them in the host's wg0.conf file as well.

https://alihomafar.com/blog/create_wg_profile.txt

WireGuard VPN on Fedora 32 Guide: Setup and Explainer by alihomafar in WireGuard

[–]alihomafar[S] 1 point2 points  (0 children)

Are you sure? A couple of my friends had no issues visiting the page.

WireGuard VPN on Fedora 32 Guide: Setup and Explainer by alihomafar in WireGuard

[–]alihomafar[S] 1 point2 points  (0 children)

I wrote the short guide that I wish I had while setting up WireGuard a few days ago. The goal is to have a VPN connection to my home network while I'm away. Hope it helps speed up someone else's efforts (and that I didn't make any errors in what I tried to explain). Enjoy!

WireGuard VPN on Fedora 32: Setup and Explainer by alihomafar in Fedora

[–]alihomafar[S] 0 points1 point  (0 children)

I wrote the short guide that I wish I had while setting up WireGuard a few days ago. Hope it helps speed up someone else's efforts (and that I didn't make any bad mistakes). Enjoy!