feat: Add support for side buttons mouse navigation in handleToggle

mapped buttons config on-click-backward and on-click-forward on mpris module to previous/next handle
GTK codes are 9 and 8
This commit is contained in:
belcaik
2025-05-19 22:52:01 -04:00
parent 0332d2ebf8
commit cdf3ca910d

View File

@ -14,7 +14,7 @@ extern "C" {
#include <glib.h>
#include <spdlog/spdlog.h>
#include <fstream> // <-- agrega esta línea
namespace waybar::modules::mpris {
const std::string DEFAULT_FORMAT = "{player} ({status}): {dynamic}";
@ -614,6 +614,18 @@ bool Mpris::handleToggle(GdkEventButton* const& e) {
}
playerctl_player_next(player, &error);
break;
case 8: // side button mouse back on browser
if (config_["on-click-backward"].isString()) {
return ALabel::handleToggle(e);
}
playerctl_player_previous(player, &error);
break;
case 9: // side button mouse forward on browser
if (config_["on-click-forward"].isString()) {
return ALabel::handleToggle(e);
}
playerctl_player_next(player, &error);
break;
}
}
if (error) {