Skip to content

Commit

Permalink
Merge pull request #3032 from leiserfg/ppd-right-click
Browse files Browse the repository at this point in the history
Make right-click to circle down ppd
  • Loading branch information
Alexays authored Mar 20, 2024
2 parents cbe42a8 + 67218d5 commit b9688eb
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/modules/power_profiles_daemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ PowerProfilesDaemon::PowerProfilesDaemon(const std::string& id, const Json::Valu
// adresses for compatibility sake.
//
// Revisit this in 2026, systems should be updated by then.

Gio::DBus::Proxy::create_for_bus(Gio::DBus::BusType::BUS_TYPE_SYSTEM, "net.hadess.PowerProfiles",
"/net/hadess/PowerProfiles", "net.hadess.PowerProfiles",
sigc::mem_fun(*this, &PowerProfilesDaemon::busConnectedCb));
Expand Down Expand Up @@ -175,9 +176,16 @@ auto PowerProfilesDaemon::update() -> void {

bool PowerProfilesDaemon::handleToggle(GdkEventButton* const& e) {
if (e->type == GdkEventType::GDK_BUTTON_PRESS && connected_) {
activeProfile_++;
if (activeProfile_ == availableProfiles_.end()) {
activeProfile_ = availableProfiles_.begin();
if (e->button == 1) /* left click */ {
activeProfile_++;
if (activeProfile_ == availableProfiles_.end()) {
activeProfile_ = availableProfiles_.begin();
}
} else {
if (activeProfile_ == availableProfiles_.begin()) {
activeProfile_ = availableProfiles_.end();
}
activeProfile_--;
}

using VarStr = Glib::Variant<Glib::ustring>;
Expand Down

0 comments on commit b9688eb

Please sign in to comment.