Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pactl volume-widget only updates on one screen #393

Open
janpeterd opened this issue Feb 10, 2023 · 5 comments
Open

Pactl volume-widget only updates on one screen #393

janpeterd opened this issue Feb 10, 2023 · 5 comments

Comments

@janpeterd
Copy link

The pactl-widget does not update the value when I change the volume.
I am using pipewire on Arch Linux.
All the operations (like click and scroll) on the icon work. The volume also gets changed correctly. Only the icon and value (or bar) do not update (except when restarting the entire WM).

This is what I have in my rc.lua, like mentioned in the README of the widget.

local volume_widget = require('awesome-wm-widgets.pactl-widget.volume')
...
     volume_widget(),
...
    awful.key({}, "XF86AudioRaiseVolume", function () volume_widget:inc(5) end),
    awful.key({}, "XF86AudioLowerVolume", function () volume_widget:dec(5) end),
    awful.key({}, "XF86AudioMute", function () volume_widget:toggle() end),
...

I just cloned the repo to my ~/.config/awesome directory, so I am using the most recent version of the widgets.

@janpeterd
Copy link
Author

I just noticed that it does update correctly on my secondary display (I am using a dual monitor setup). The displayed value in the statusbar on my primary display stays at the initial value.

@janpeterd janpeterd changed the title Pactl volume-widget doesn't update value Pactl volume-widget only updates on one screen Feb 10, 2023
@dyfrgi
Copy link

dyfrgi commented Apr 3, 2023

I think this is due to the pactl-widget storing the volume widget it's using in a single variable across all instances. volume at https://github.com/streetturtle/awesome-wm-widgets/blob/master/pactl-widget/volume.lua#L27 has its property widget set to a value returned by the volume-widget and later referenced in volume:toggle(). But this will have been overwritten by the later call of the module.

@schodet
Copy link

schodet commented Jun 13, 2023

One way to handle this is to instantiate the widget only once, out of awful.screen.connect_for_each_screen loop.

local myvolume = volume_widget()

@pivaldi
Copy link

pivaldi commented Jan 28, 2024

My solution is to place the widget only in the primary screen (in fact, all the widgets are in the primary screen) :

local weather_widget = require("awesome-wm-widgets.weather-widget.weather")
…
awful.screen.connect_for_each_screen(function(s)
…
    local weather_wdg = nil
    if s == screen.primary then
      audio_wdg = {
        layout = awful.widget.only_on_screen,
        screen = screen.primary, -- Only display on primary screen
        volume_widget{ }
      }
    end
…
    -- Add widgets to the wibox
    s.mywibox:setup {
      layout = wibox.layout.align.horizontal,
      { -- Left widgets
        …
      },
      s.mytasklist, -- Middle widget
      { -- Right widgets
        audio_wdg,
        …
        s.mylayoutbox,
      },
    }
end

@IIlllllII
Copy link

For people follows this default rc.lua file,
Any widgets defined within callback of screen.connect_signal("request::desktop_decoration") should be shared across screens, such as the textclock widget, while the promptbox is not.

-- Create a textclock widget
mytextclock = wibox.widget.textclock()

-- @DOC_FOR_EACH_SCREEN@
screen.connect_signal("request::desktop_decoration", function(s)
    -- Each screen has its own tag table.
    awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, s, awful.layout.layouts[1])

    -- Create a promptbox for each screen
    s.mypromptbox = awful.widget.prompt()

end)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants