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

Why am i getting all the issues #51

Open
aaryamanm128 opened this issue Feb 23, 2022 · 7 comments
Open

Why am i getting all the issues #51

aaryamanm128 opened this issue Feb 23, 2022 · 7 comments

Comments

@aaryamanm128
Copy link

Welp its me again (Im sorry)

Here is the issue straight

When i try to Change the volume to anything It shows me this

Screenshot from 2022-02-23 15-27-32

what is happening ? It just aint working , I used the dependencies you had told

@WillPower3309
Copy link
Owner

WillPower3309 commented Feb 25, 2022

Check out #46, and let me know if installing alsa / pulseaudio doesn't resolve the issue

@aaryamanm128
Copy link
Author

So it turns out i can change the volume ,that works complely fine i have those modules pre installed in linux mint , It does change the volume , but it cannot show me the thing

@RedstonerCKZ
Copy link

2022-10-26-212509_1920x1080_scrot
I have the same error, and I have pulseaudio installed. Volume does not change, and there is no slider when the volume bar appears.

@RedstonerCKZ
Copy link

RedstonerCKZ commented Oct 27, 2022

It seems like I have fixed it. In volume-adjust.lua:

--      ██╗   ██╗ ██████╗ ██╗     ██╗   ██╗███╗   ███╗███████╗
--      ██║   ██║██╔═══██╗██║     ██║   ██║████╗ ████║██╔════╝
--      ██║   ██║██║   ██║██║     ██║   ██║██╔████╔██║█████╗
--      ╚██╗ ██╔╝██║   ██║██║     ██║   ██║██║╚██╔╝██║██╔══╝
--       ╚████╔╝ ╚██████╔╝███████╗╚██████╔╝██║ ╚═╝ ██║███████╗
--        ╚═══╝   ╚═════╝ ╚══════╝ ╚═════╝ ╚═╝     ╚═╝╚══════╝


-- ===================================================================
-- Initialization
-- ===================================================================


local wibox = require("wibox")
local awful = require("awful")
local gears = require("gears")
local beautiful = require("beautiful")
local dpi = beautiful.xresources.apply_dpi

local offsetx = dpi(56)
local offsety = dpi(300)
local screen = awful.screen.focused()
local icon_dir = gears.filesystem.get_configuration_dir() .. "/icons/volume/" .. beautiful.name .. "/"


-- ===================================================================
-- Appearance & Functionality
-- ===================================================================


local volume_icon = wibox.widget {
   widget = wibox.widget.imagebox
}

-- create the volume_adjust component
local volume_adjust = wibox({
   screen = awful.screen.focused(),
   x = screen.geometry.width - offsetx,
   y = (screen.geometry.height / 2) - (offsety / 2),
   width = dpi(48),
   height = offsety,
   shape = gears.shape.rounded_rect,
   visible = false,
   ontop = true
})

local volume_bar = wibox.widget{
   widget = wibox.widget.progressbar,
   shape = gears.shape.rounded_bar,
   color = "#efefef",
   background_color = beautiful.bg_focus,
   max_value = 100,
   value = 0
}

volume_adjust:setup {
   layout = wibox.layout.align.vertical,
   {
      wibox.container.margin(
         volume_bar, dpi(14), dpi(20), dpi(20), dpi(20)
      ),
      forced_height = offsety * 0.75,
      direction = "east",
      layout = wibox.container.rotate
   },
   wibox.container.margin(
      volume_icon
   )
}

-- create a 4 second timer to hide the volume adjust
-- component whenever the timer is started
local hide_volume_adjust = gears.timer {
   timeout = 4,
   autostart = true,
   callback = function()
      volume_adjust.visible = false
   end
}

-- show volume-adjust when "volume_change" signal is emitted
awesome.connect_signal("volume_change",
   function()
      -- set new volume value
      awful.spawn.easy_async_with_shell(
         "amixer get Master | grep -E -o '[0-9]{1,3}%' | tr -d '%'",
         function(stdout)
            local volume_level = tonumber(stdout)
            volume_bar.value = volume_level
            if (volume_level > 40) then
               volume_icon:set_image(icon_dir .. "volume.png")
            elseif (volume_level > 0) then
               volume_icon:set_image(icon_dir .. "volume-low.png")
            else
               volume_icon:set_image(icon_dir .. "volume-off.png")
            end
         end,
         false
      )

      -- make volume_adjust component visible
      if volume_adjust.visible then
         hide_volume_adjust:again()
      else
         volume_adjust.visible = true
         hide_volume_adjust:start()
      end
   end
)

I have changed the way it gets the volume percentage, and it functions. I have also changed keys.lua:

-- ALSA volume control
   awful.key({}, "XF86AudioRaiseVolume",
      function()
         awful.spawn("amixer set Master 5%+", false)
         awesome.emit_signal("volume_change")
      end,
      {description = "volume up", group = "hotkeys"}
   ),
   awful.key({}, "XF86AudioLowerVolume",
      function()
         awful.spawn("amixer set Master 5%-", false)
         awesome.emit_signal("volume_change")
      end,
      {description = "volume down", group = "hotkeys"}
   ),
   awful.key({}, "XF86AudioMute",
      function()
         awful.spawn("amixer set Master toggle", false)
         awesome.emit_signal("volume_change")
      end,
      {description = "toggle mute", group = "hotkeys"}
   ),

this should work for any new versions of alsa/linux.

@WillPower3309
Copy link
Owner

Awesome! I'll take a look at it. Would you be open to submitting a PR with the changes?

@RedstonerCKZ
Copy link

Sure, no problem. Let me know when you are ready.

@RedstonerCKZ
Copy link

Pull request should be up by now.

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

3 participants