You are not logged in.
I found a pretty neat sound volume executor here: https://lecorbeausvault.wordpress.com/2 … executors/
It works very well except for one problem. When scrolling up on the executor, there is no limit to the volume.
200%?, no problem, except for I think it would fry something, as it certainly gets louder after 100%
Anyhow, in the executor portion of tint2,
# Executor 1
execp = new
execp_command = ~/bin/volume
execp_interval = 2
execp_has_icon = 1
execp_cache_icon = 1
execp_continuous = 0
execp_markup = 0
execp_lclick_command = pactl set-sink-mute 0 toggle
execp_rclick_command =
execp_mclick_command = pactl set-sink-mute 0 toggle
execp_uwheel_command = pactl set-sink-volume 0 +2%
execp_dwheel_command = pactl set-sink-volume 0 -5%
execp_font = Sans 10
execp_font_color = #ffffff 100
execp_padding = 5 0
execp_background_id = 1
execp_centered = 0
execp_icon_w = 24
execp_icon_h = 24
Where the problem probably resides. Man pactl almost teases a solution, but I think they were just showing the possibilities, as:pactl set-sink-volume 0 +2%, 100% certainly didn't work:)
The script is:
#!/bin/bash
muted=$(pacmd list-sinks | awk '/muted/ { print $2 }')
vol=$(pactl list sinks | awk '/Volume:/ {printf "%s ",$5}' | cut -f1 -d ' ' | cut -f1 -d '%')
if [[ $muted = "no" ]]; then
if [[ $vol -ge 65 ]]; then
echo /usr/share/volumeicon/icons/Blue Bar/8.png
echo "$vol%"
elif [[ $vol -ge 40 ]]; then
echo /usr/share/volumeicon/icons/Blue Bar/5.png
echo "$vol%"
elif
[[ $vol -ge 0 ]]; then
echo /usr/share/volumeicon/icons/Blue Bar/3.png
echo "$vol%"
fi
else
echo /usr/share/volumeicon/icons/Blue Bar/1.png
echo "muted"
fi
And I rather like the effect:) seems low on ram too. In any event, is there a solution to restrict the volume to 100% somewhere somehow?
Maybe inside the script?
Or maybe an addition to the end of the tint2 portion?:
pactl set-sink-volume 0 +2%
Last edited by sleekmason (2020-10-26 22:00:04)
Offline
Why not put the question in his wiki, at https://github.com/I-LeCorbeau/tint2-executors/issues?
// Regards rbh
Please read before requesting help: Guide to getting help,
Introduction to the Bunsenlabs Lithium Desktop and other help topics under "Help Resources" on the BunsenLabs menu
Offline
It works very well except for one problem. When scrolling up on the executor, there is no limit to the volume.
200%?, no problem, except for I think it would fry something, as it certainly gets louder after 100%
That functionality is in the tint2 config only. All the script does is show an icon and the current volume.
is there a solution to restrict the volume to 100% somewhere somehow?
Yes, it's with pulseaudio itself.
https://duckduckgo.com/?q=pulseaudio+re … me+to+100%
Offline
sleekmason wrote:It works very well except for one problem. When scrolling up on the executor, there is no limit to the volume.
200%?, no problem, except for I think it would fry something, as it certainly gets louder after 100%That functionality is in the tint2 config only. All the script does is show an icon and the current volume.
sleekmason wrote:is there a solution to restrict the volume to 100% somewhere somehow?
Yes, it's with pulseaudio itself.
https://duckduckgo.com/?q=pulseaudio+re … me+to+100%
Thank you! The question I thought would be too broad takes the day. Two seconds. I really need to learn to search better.
amixer -q set Master 5%- unmute
For the win!
Why not put the question in his wiki, at https://github.com/I-LeCorbeau/tint2-executors/issues?
Is this not an acceptable place to ask these types of questions? Kinda seems like the reason we are all here. What kind of atmosphere would you like?
Offline
You could edit the script accordingly, I'am guessing first if would be a proper place
if [[ $vol -gt 100 ]]; then
vol=100
echo ~/.config/tint2/executors/icons/audio-volume-high.svg
echo "$vol%"
elif # other stuff
Last edited by brontosaurusrex (2020-10-26 12:29:53)
Offline
You could edit the script accordingly, I'am guessing first if would be a proper place
if [[ $vol -gt 100 ]]; then vol=100 echo ~/.config/tint2/executors/icons/audio-volume-high.svg echo "$vol%" elif # other stuff
You are a wizard! This works, mostly.
When you scroll to 100, the number stops, but keep scrolling and it still raises the volume.
The other bit using amixer instead of pactl works fine though:)
Changed the script to run through all eight iterations of the icon instead of four, and it really is a neat little bit:)
Offline
Right, I missed the fact that this is a pure reader,
if [[ $vol -gt 100 ]]; then
vol=100
echo ~/.config/tint2/executors/icons/audio-volume-high.svg
echo "$vol%"
amixer set Master "$vol%" # untested
elif # other stuff
^completely untested
Last edited by brontosaurusrex (2020-10-26 17:42:23)
Offline
Right, I missed the fact that this is a pure reader,
if [[ $vol -gt 100 ]]; then vol=100 echo ~/.config/tint2/executors/icons/audio-volume-high.svg echo "$vol%" amixer set Master "$vol%" # untested elif # other stuff
^completely untested
This works! Still one small issue, When you get to 100% the icon disappears from view. Strange that. The volume cap at 100% however is corrected.
Really, no need to sweat this as the amixer line does work. The fact that you can write any of this off the top of your head is amazing to me:) Copy and paste Frankenstein for me.
Offline
When you get to 100% the icon disappears from view. Strange that.
I'am thinking there is unhandled value somewhere (probably 100%), but not sure. Can you post your current-latest-greatest version?
The fact that you can write any of this off the top of your head
Edit: Not at the top of my head, I'am cheating, looking at my old script, but can't see any amixer writing there and I forgot what the limiter logic is (probably amixer refuses to go over 100% by default...).
Last edited by brontosaurusrex (2020-10-26 18:33:27)
Offline
Of course!
#!/bin/bash
muted=$(pacmd list-sinks | awk '/muted/ { print $2 }')
vol=$(pactl list sinks | awk '/Volume:/ {printf "%s ",$5}' | cut -f1 -d ' ' | cut -f1 -d '%')
if [[ $muted = "no" ]]; then
if [[ $vol -ge 80 ]]; then
echo /usr/share/volumeicon/icons/Blue Bar/8.png
echo "$vol%"
elif [[ $vol -ge 70 ]]; then
echo /usr/share/volumeicon/icons/Blue Bar/7.png
echo "$vol%"
elif [[ $vol -ge 60 ]]; then
echo /usr/share/volumeicon/icons/Blue Bar/6.png
echo "$vol%"
elif [[ $vol -ge 50 ]]; then
echo /usr/share/volumeicon/icons/Blue Bar/5.png
echo "$vol%"
elif [[ $vol -ge 30 ]]; then
echo /usr/share/volumeicon/icons/Blue Bar/4.png
echo "$vol%"
elif [[ $vol -ge 10 ]]; then
echo /usr/share/volumeicon/icons/Blue Bar/3.png
echo "$vol%"
elif [[ $vol -ge 0 ]]; then
echo /usr/share/volumeicon/icons/Blue Bar/2.png
echo "$vol%"
fi
else
echo /usr/share/volumeicon/icons/Blue Bar/1.png
echo "muted"
fi
And here is the Executor code:
# Executor 1
execp = new
execp_command = /usr/local/bin/volume
execp_interval = 0
execp_has_icon = 1
execp_cache_icon = 1
execp_continuous = 0
execp_markup = 0
execp_tooltip = Scroll Up or Down for volume - Right-click for Alsamixer
execp_lclick_command = pactl set-sink-mute 0 toggle
execp_rclick_command = urxvt -e alsamixer
execp_mclick_command = pactl set-sink-mute 0 toggle
execp_uwheel_command = amixer -q set Master 2%+ unmute
execp_dwheel_command = amixer -q set Master 5%- unmute
execp_font = Sans 11
execp_font_color = #cefaf9 100
execp_padding = 5 0
execp_background_id = 1
execp_centered = 0
execp_icon_w = 24
execp_icon_h = 24
And the original lines in the executor that allowed the overrun:
execp_uwheel_command = pactl set-sink-volume 0 +2%
execp_dwheel_command = pactl set-sink-volume 0 -5%
Last edited by sleekmason (2020-10-26 21:12:50)
Offline
Ok, cool, so I guess this is working as expected (no overruns)?
btw, amixer can also toggle mute (if you wanna get rid of pactl)
amixer set -q Master toggle
Last edited by brontosaurusrex (2020-10-26 19:48:36)
Offline
Ok, cool, so I guess this is working as expected (no overruns)?
btw, amixer can also toggle mute (if you wanna get rid of pactl)
amixer set -q Master toggle
yes, everything is groovy:) Thank you for the amixer line, that was bugging me a bit. Lol.
I did find a cpu use problem, but corrected it (and will above).
execp_interval = 2
Needs to be:
execp_interval = 0
Or else it polls every two seconds causing a 1% cpu spike average. Setting it to zero allows it to only poll when used. And it works!
Thanks for the rest of the code too. Cool to see how that would work.
Offline
Hello anyone can fix the muted to this script? So far, png+volume indicator percentages to high, medium, low works just fine, only i can't find a way to make muted shown icon and a text to say off or muted.
I only use alsa-utils on my system, so Master -M i care, Originaly script from PPC @antiX, even him has issued a note about muted.
#!/bin/bash
vol=$(amixer get Master -M | awk '$0~/%/{print $4}' | tr -d '[]')
high=65
medium=40
low=0
if [ "${vol::-1}" -ge 65 ]; then
echo ~/.scripts/tint2/executor/volume/vhigh.png
echo "$vol"
elif [ "${vol::-1}" -ge 40 ]; then
echo ~/.scripts/tint2/executor/volume/vmedium.png
echo "$vol"
elif
[ "${vol::-1}" -ge 0 ]; then
echo ~/.scripts/tint2/executor/volume/vlow.png
echo "$vol"
elif
[ "${vol::-1}" -eq 0 ]; then
echo ~/.scripts/tint2/executor/volume/vmuted.png
echo "$vol"
fi
Although I see that it is not very difficult, but i am not succeeding with my effort.
This looks good to use, only if it can be made for amixer instead of pulseaudio.
muted=$(pacmd list-sinks | awk '/muted/ { print $2 }')
Thank you
Fedora GNOME / Devuan XFCE
Roots heritage #!
Offline
^I think this is something (looking at my script)
mute=$(awk -F"[][]" '/dB/ { print $6 }' <(amixer sget Master))
mute=$(awk '{print $1; exit}' <(echo "$mute")) # just the first value
Last edited by brontosaurusrex (2022-05-09 15:59:21)
Offline
Thanks bro, saw your script yesterday, It took me very much time to made it, but at the end could not bring anything to light
Also, same codes you posted didn't show anything.
Something that can be approximated is mixing with Addy's script I managed to pull something out like all together. Left tint2/executor right alsamixer.
But mute icon doesn't show also i can't hide percentages when mute is actived.
Damn, this thing is very hard even if doesn't looks so, no wonder author PPC from antiX have gived up.
If you have any other variant please write it, also if you can see anything from addy's code as it is the only that i found somehow approximated.
Thanks for watching out.
Fedora GNOME / Devuan XFCE
Roots heritage #!
Offline
Let me refraze;
This piece
awk -F"[][]" '/dB/ { print $6 }' <(amixer sget Master) | head -1
should return either 'on' or 'off' and you can script on from there.
Related: My entire script in tint2 is supposed to behave like this
https://www.youtube.com/watch?v=qrhhUL2FxNo
Last edited by brontosaurusrex (2022-05-09 19:21:35)
Offline
All three commands running from console as you did with Youtube demostration works just fine, Thank you for showing, Also i get on / off from terminal too with all three commands.
I just don't get anything when i put em on the script, or am I not setting it properly, or is that script not exactly correct for show muted feature.
Fedora GNOME / Devuan XFCE
Roots heritage #!
Offline
VLC media player allows volume to be boosted above 100% to help with things that were recorded at too low a volume but limits it to 125% to prevent speaker damage.
So maybe allowing something similar would be good.
Offline
Installed pulseaudio and used sleekmason's code that works just fine. It was difficult for me to made support for muted in Alsa, almost achieved something early, however I can not completed it.
So, i threw it away Alsa and passed to Pulseaudio that made it Solved for me.
Thanks brontosaurusrex for your help and sleekmason/PPC for the code.
Fedora GNOME / Devuan XFCE
Roots heritage #!
Offline