From 34cc847ff5e4ed75b5f31f00e609c5eebd06474c Mon Sep 17 00:00:00 2001 From: Dmitriy Date: Mon, 27 Nov 2023 17:59:46 +0300 Subject: [PATCH 1/2] Add information about functional keycodes to readme of volume widget --- volume-widget/README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/volume-widget/README.md b/volume-widget/README.md index a1df845..82d88e7 100644 --- a/volume-widget/README.md +++ b/volume-widget/README.md @@ -56,6 +56,15 @@ awful.key({ modkey }, "[", function() volume_widget:dec(5) end), awful.key({ modkey }, "\\", function() volume_widget:toggle() end), ``` +You also can use Functional keycodes instead of symbols, e.g. `XF86AudioRaiseVolume` instead of `"]"`. + +```lua +awful.key({}, "XF86AudioRaiseVolume", function() volume_widget.inc() end), +awful.key({}, "XF86AudioLowerVolume", function() volume_widget.dec() end), +awful.key({}, "XF86AudioMute", function() volume_widget.toggle() end), +``` +If you don't know the name of the key, you can use `xev` to find it out. + ## Customization It is possible to customize the widget by providing a table with all or some of the following config parameters: From bae3f4f806911cf3b43a964275d7fdae9af7e7ac Mon Sep 17 00:00:00 2001 From: Dmitriy Date: Tue, 28 Nov 2023 10:49:46 +0300 Subject: [PATCH 2/2] add information about amixer and playerctl to readme of volume widget --- volume-widget/README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/volume-widget/README.md b/volume-widget/README.md index 82d88e7..7a5c94d 100644 --- a/volume-widget/README.md +++ b/volume-widget/README.md @@ -64,6 +64,23 @@ awful.key({}, "XF86AudioLowerVolume", function() volume_widget.dec() end), awful.key({}, "XF86AudioMute", function() volume_widget.toggle() end), ``` If you don't know the name of the key, you can use `xev` to find it out. +Or you can use `amixer` and `playerctl` to control the volume and media players. + +```lua +awful.key({}, "XF86AudioLowerVolume", function () + awful.util.spawn("amixer -q -D pulse sset Master 5%-", false) end), +awful.key({}, "XF86AudioRaiseVolume", function () + awful.util.spawn("amixer -q -D pulse sset Master 5%+", false) end), +awful.key({}, "XF86AudioMute", function () + awful.util.spawn("amixer -D pulse set Master 1+ toggle", false) end), +-- Media Keys +awful.key({}, "XF86AudioPlay", function() + awful.util.spawn("playerctl play-pause", false) end), +awful.key({}, "XF86AudioNext", function() + awful.util.spawn("playerctl next", false) end), +awful.key({}, "XF86AudioPrev", function() + awful.util.spawn("playerctl previous", false) end), +``` ## Customization