vivien / i3blocks

The hacker-friendly status_command for Sway and i3
https://vivien.github.io/i3blocks/
GNU General Public License v3.0
2.3k stars 182 forks source link

Volume Blocket #136

Closed bambusdani closed 7 years ago

bambusdani commented 9 years ago

Hi, I've got a problem I can't fix with the volume blocket. What does work is to mute the sound. Unmute and increase/decrease volume doens't work for me. I just installed Ubuntu 14.04 and I read that alsa and pulseaudio both are installed by default and needed for Ubuntu?! I use the default volume script from vivien. My mixer is set on default (alsa). If I put the code in the command line for example: amixer -q set Master 2dB- it works amixer -q set Master toggle however mutes the sound but doens't unmute it.

So is there any problem with having alsa and pulseaudio installed at the same time? Do I have to set a default system? Maybe you got some ideas.

Mahadras

kb100 commented 9 years ago

Try

amixer -q -D pulse sset Master toggle
amixer -q -D pulse sset Master 5%+
amixer -q -D pulse sset Master 5%-
bambusdani commented 9 years ago

Thanks, commands work fine. I can toggle the sound now expect scrolling doens't work. Is that problem related with the volume script or i3blocks in general?

kb100 commented 9 years ago

Does it say the volume is changing but you don't perceive any change? Or does the block not even update? Do any of the blocks work when you scroll? What audio device are you using to play back?

bambusdani commented 9 years ago

The block does not update and there are no volume changes. I just found out that none of my blocks are working with scrolling when I add a simple script.

case $BLOCK_BUTTON in
  4) echo "up" ;;
  5) echo "down ;;
esac

audio device:

card 0: PCH [HDA Intel PCH], device 0: ALC887-VD Analog [ALC887-VD Analog]
kb100 commented 9 years ago

Can you use xev and show me the output for an up scroll and down scroll?

bambusdani commented 9 years ago

Up

ButtonPress event, serial 32, synthetic NO, window 0x1a00001,
    root 0x2a6, subw 0x0, time 3915465, (-2,364), root:(961,387),
    state 0x10, button 4, same_screen YES

ButtonRelease event, serial 32, synthetic NO, window 0x1a00001,
    root 0x2a6, subw 0x0, time 3915465, (-2,364), root:(961,387),
    state 0x810, button 4, same_screen YES

Down

ButtonPress event, serial 32, synthetic NO, window 0x1a00001,
    root 0x2a6, subw 0x0, time 3984135, (5,145), root:(968,168),
    state 0x10, button 5, same_screen YES

ButtonRelease event, serial 32, synthetic NO, window 0x1a00001,
    root 0x2a6, subw 0x0, time 3984135, (5,145), root:(968,168),
    state 0x1010, button 5, same_screen YES

EDIT: corrected down

kb100 commented 9 years ago

That's odd. Mouse scroll events should only be ButtonRelease events, and your down event says "Button 4" which corresponds to up, not down. Are you sure that is the output that down gives?

bambusdani commented 9 years ago

I edited down. It was a cop&paste fail. Down is button 5

ButtonPress event, serial 32, synthetic NO, window 0x1a00001,
    root 0x2a6, subw 0x0, time 3984135, (5,145), root:(968,168),
    state 0x10, button 5, same_screen YES

ButtonRelease event, serial 32, synthetic NO, window 0x1a00001,
    root 0x2a6, subw 0x0, time 3984135, (5,145), root:(968,168),
    state 0x1010, button 5, same_screen YES
kb100 commented 9 years ago

In your i3 config where you put something like

bar {
    status_command i3blocks
}

can you make it

bar {
    status_command i3blocks 2>~/i3blocks.err
}

then restart i3 in place with i3-msg restart and try scrolling over your blocklets. Then post any interesting contents of i3blocks.err.

bambusdani commented 9 years ago

There is no output at all. Should there be any regardless of errors?

kb100 commented 9 years ago

There would only be content if there was an error. No content means the script is completing without errors. Just to clarify, when you execute the mixer command from the command line, it works, but when you scroll with i3blocks it doesn't work?

bambusdani commented 9 years ago

Correct

EDIT: If I use the exact same setup on my laptop is the same problem.

kb100 commented 9 years ago

Try the following in order to troubleshoot:

Make a blocklet that executes the command that doesn't work on scrolling on a click instead

Add print statements to the script that print to a file, letting you know exactly what statements are actually executed.

kb100 commented 9 years ago

Actually, since none of your scripts work when scrolling, echo the value of "$BLOCK_BUTTON" and see if it corresponds to the correct value on execution.

bambusdani commented 9 years ago

I did echo the valeu of $BLOCK_BUTTON and it worked for every button except the scrolling part. Also, yes I can control the volume with for example left, middle and right mouseclick.

Did I already mention that the button 4 and 5 (up and down) are not recognized by i3blocks at all. Meaning when I scroll on the volume block for example I switch workspaces (maybe this is important to know).

kb100 commented 9 years ago

When you echo $BLOCK_BUTTON for a scroll, does it give you the wrong answer, or no (a blank) answer?

When you scroll over the volume blocklet it switches workspaces? Or when you try to scroll over the workspaces it doesn't switch?

bambusdani commented 9 years ago

1) It gives me no answer (blank) when i echo $BLOCK_BUTTON for a scroll. 2) When I scroll over the volume blocket it switches workspaces

kb100 commented 9 years ago

Hmm, this may not be a simple issue like I initially suspected. I'm not familiar with all the click handling code. Perhaps @vivien would be able to tell if this is an i3blocks problem or an i3wm problem.

bambusdani commented 9 years ago

Okay. Well thank you anyway for your help. At least I know a little bit now whats going on. I think I will try to purge everything and reinstall it just because I can maybe it works.

vivien commented 9 years ago

Hi @Mahadras

2) When I scroll over the volume blocket it switches workspaces

Can you try to disable the scroll wheel action in your bar block as mentioned in the pointer below?

http://i3wm.org/docs/userguide.html#_mouse_button_commands

bambusdani commented 9 years ago

Hi, it works now. What it did was kind of bizarre. First I tried to disable the scroll wheel action then I got error because the syntax 'bindsym button4 nop' wsa not supported so I had to reinstall i3 and then it worked. @vivien Thanks, you kinda solved my problem :+1: Also thanks for your help @kb100 and for staying patient.

Cram

Airblader commented 9 years ago

My guess is that you had an old version of i3. We had that click detection bug (multiple, actually) which has been fixed in the meantime. The fact that the new bindsym syntax didn't work confirms that as well. The reinstall of i3 helped because you updated it by doing so.

danfolkes commented 8 years ago

I have a similar issue with the volume blocklet. When I mute the volume, it will mute the speaker output device. Then, when I unmute, it will unmute the PCM and master but it will not unmute the speaker output.

I have to manually go into the puvucontrol and unmute the device under "Output Devices" > Port: Speaker.

sgtpepper113 commented 8 years ago

I have this or a very similar problem with the volume blocklet on gentoo, with just ALSA involved (haven't even got pulse installed.) Scrolling down immediately mutes the audio (more accurately it sets the volume to 0% rather than mute) and scrolling up immediately sets the audio output to 100%. No steps between. If i use amixer commands or alsamixer I can change volume in normal increments. Setting volume through alsamixer and then left clicking the blocklet causes it to update and display the correct value.