elenapan / dotfiles

There is no place like ~/
GNU General Public License v2.0
3.51k stars 175 forks source link

Volume-control not working? #82

Closed hrqmonteiro closed 4 years ago

hrqmonteiro commented 4 years ago

Hi, any reason for the volume.control.sh not be working?

I have all it takes to be installed. All other notificationss work (screenshot, telegram, etc.), just the volume dont

How do i test this on terminal, i type on the terminal and it gives this back

2020 05 11-19 05 10 screenshot (Option -R unknown, in english)

Which argument should i use? I tried volume-control.sh -up and stuff and it don't.

Any help will be appreciated.

elenapan commented 4 years ago

That is because in volume-control.sh I am using notify-send.sh instead of the original notify-send. It has some extra options like -R which allows replacing a notification text instead of creating a new one (useful for spammy notifications like volume, brightness etc).

However, volume control is now built into the AwesomeWM config, so you do not need to use volume-control.sh anymore. Your volume keys should work out of the box, as well as the volume slider in the sidebar. Notifications should work out of the box as well.

hrqmonteiro commented 4 years ago

Well, my volume keys run out of the box, but the notifications for volume change is still not working. Any tips?

I even removed the volume-control.sh from my bin, now my vol keys adjust volume but i still got no notifications..

hrqmonteiro commented 4 years ago

Even with notify-send.sh and volume-control.sh or without, i simply can't get ANY notifications for volume, and i don't know why, is becoming frustrating lol

I'm new to awesome, i was using openbox, and even my script i used on openbox for controlling volume and sending notifications is not working here..

Edit: in my other laptop, which i use void instead of arch, i installed awesome and the config to test and notifications are not working too. I know i'm bothering too much, sorry lol, is just that i'm not an expert. In yours the notifications are okay?

elenapan commented 4 years ago

Yeah the notifications work for me. Keep in mind I have made it so that notifications are not sent if the sidebar is visible or Pavucontrol (volume manager) is focused. https://github.com/elenapan/dotfiles/blob/06458c76a299a5e1dad85241a0c5a5891f5ee9ae/config/awesome/notifications/volume.lua#L10-L17

If that is not the problem, let's test if the volume daemon actually works.

Can you try running this in your terminal? It will make AwesomeWM send a notification every time your volume changes (until the next restart of AwesomeWM).

awesome-client '
local naughty = require("naughty")
awesome.connect_signal("evil::volume", function()
    naughty.notification({ title = "volume changed" })
end)
'

Adjust your volume and let me know if a notification pops up.

hrqmonteiro commented 4 years ago

Yes, i know that it doesnt work with pavu or bar.

But i ran this on the terminal, it shows no notification whatsoever..

elenapan commented 4 years ago

Ok. Can you run pactl subscribe in a terminal and then try changing your volume?

It should print a bunch of events every time you change your volume, like so:

Event 'new' on client #5333
Event 'change' on client #5333
Event 'change' on sink #1
...

Let me know if it prints anything or not.

hrqmonteiro commented 4 years ago

2020 05 13-10 49 11 screenshot

Legend: Evento = event Alterar = change Novo = new Remover = remove

elenapan commented 4 years ago

Ok thank you, I figured it out. So the volume daemon is looking for the word sink in order to trigger an update (and notification), but since your output is in a different language, it cannot find sink and thinks there is no update. https://github.com/elenapan/dotfiles/blob/06458c76a299a5e1dad85241a0c5a5891f5ee9ae/config/awesome/evil/volume.lua#L50-L53

You can replace sink with destino in the snippet above, but I am afraid it is not the only place that needs changes. You might also have issues with the microphone daemon that looks for source, and other daemons whose output differs depending on system language.

I will try to find language agnostic way to fix this.

Related: https://github.com/elenapan/dotfiles/issues/44#issuecomment-527229170

elenapan commented 4 years ago

Do any of these 2 commands print events in English?

LC_ALL=C sh -c 'pactl subscribe'
LANG=en_US.UTF-8 sh -c 'pactl subscribe'
hrqmonteiro commented 4 years ago

Well, i don't think the language is a problem, actually, because:

In my laptop with Void, the language is english, and no notifications Also, i changed "sink" to "destino", and no change happened

And right now, i changed my language to english (and reversed the change in sink), and no notifications still. I think the problem is another, don't you think?

2020 05 13-11 36 41 screenshot

hrqmonteiro commented 4 years ago

Do any of these 2 commands print events in English?

LC_ALL=C sh -c 'pactl subscribe'
LANG=en_US.UTF-8 sh -c 'pactl subscribe'

2020 05 13-11 37 29 screenshot 2020 05 13-11 37 39 screenshot

elenapan commented 4 years ago

And right now, i changed my language to english (and reversed the change in sink), and no notifications still. I think the problem is another, don't you think?

Hmm, in that case can you try if this whole command prints anything at all when changing volume?

LC_ALL=C sh -c 'pactl subscribe 2> /dev/null | grep --line-buffered "sink"'

Also could you post the output of these 2 commands?

LC_ALL=C sh -c 'pactl list sinks | grep "%"'
LC_ALL=C sh -c 'pactl list sinks | grep Mute'
hrqmonteiro commented 4 years ago

And right now, i changed my language to english (and reversed the change in sink), and no notifications still. I think the problem is another, don't you think?

Hmm, in that case can you try if this whole command prints anything at all when changing volume?

LC_ALL=C sh -c 'pactl subscribe 2> /dev/null | grep --line-buffered "sink"'

Also could you post the output of these 2 commands?

LC_ALL=C sh -c 'pactl list sinks | grep "%"'
LC_ALL=C sh -c 'pactl list sinks | grep Mute'

The first one: (First print when i hitted vol 1 time, and then when i kept hitting)

2020 05 13-11 55 57 screenshot 2020 05 13-11 56 02 screenshot

The second and third one:

2020 05 13-11 56 22 screenshot

hrqmonteiro commented 4 years ago

Update, for some reason now it is showing on the laptop built-in sound device

2020 05 13-14 20 28 screenshot

But if i switch to my hdmi sound it disappears

elenapan commented 4 years ago

I see. Then it is related to this https://github.com/elenapan/dotfiles/issues/61.

I will push a fix for this in the next few days, but for now you can make these changes:

diff --git a/config/awesome/evil/volume.lua b/config/awesome/evil/volume.lua
index 6f0a98e..a8ac236 100644
--- a/config/awesome/evil/volume.lua
+++ b/config/awesome/evil/volume.lua
@@ -10,9 +10,9 @@ local volume_old = -1
 local muted_old = -1
 local function emit_volume_info()
     -- Get volume info
-    awful.spawn.easy_async("pactl list sinks", function(stdout)
+    awful.spawn.easy_async_with_shell("pacmd list-sinks | awk '/\\* index: /{nr[NR+7];nr[NR+11]}; NR in nr'", function(stdout)
         local volume = stdout:match('(%d+)%% /')
-        local muted = stdout:match('Mute:(%s+)[yes]')
+        local muted = stdout:match('muted:(%s+)[yes]')
         local muted_int = muted and 1 or 0
         local volume_int = tonumber(volume)
         -- Only send signal if there was a change
hrqmonteiro commented 4 years ago

Thanks! Is working all fine. I appreciate very much, and thanks for the patience with a newbie haha, glad you could help me