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
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%
Please use CODE tags for code.
Search youtube without a browser: repo | thread
BL quote proposals to this thread please.
my repos / my repos
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