mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
Initial implementation
This commit is contained in:
@ -42,6 +42,9 @@
|
||||
#ifdef HAVE_LIBEVDEV
|
||||
#include "modules/keyboard_state.hpp"
|
||||
#endif
|
||||
#ifdef HAVE_GAMEMODE
|
||||
#include "modules/gamemode.hpp"
|
||||
#endif
|
||||
#ifdef HAVE_UPOWER
|
||||
#include "modules/upower/upower.hpp"
|
||||
#endif
|
||||
|
75
include/modules/gamemode.hpp
Normal file
75
include/modules/gamemode.hpp
Normal file
@ -0,0 +1,75 @@
|
||||
#pragma once
|
||||
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
#include "ALabel.hpp"
|
||||
#include "giomm/dbusconnection.h"
|
||||
#include "giomm/dbusproxy.h"
|
||||
#include "glibconfig.h"
|
||||
#include "gtkmm/box.h"
|
||||
#include "gtkmm/image.h"
|
||||
#include "gtkmm/label.h"
|
||||
#include "gtkmm/overlay.h"
|
||||
|
||||
namespace waybar::modules {
|
||||
|
||||
class Gamemode : public AModule {
|
||||
public:
|
||||
Gamemode(const std::string &, const Json::Value &);
|
||||
~Gamemode();
|
||||
auto update() -> void;
|
||||
|
||||
private:
|
||||
const std::string DEFAULT_ICON_NAME = "input-gaming-symbolic";
|
||||
const std::string DEFAULT_FORMAT = "{glyph}";
|
||||
const std::string DEFAULT_FORMAT_ALT = "{glyph} {count}";
|
||||
const std::string DEFAULT_GLYPH = "";
|
||||
|
||||
void appear(const Glib::RefPtr<Gio::DBus::Connection> &connection, const Glib::ustring &name,
|
||||
const Glib::ustring &name_owner);
|
||||
void disappear(const Glib::RefPtr<Gio::DBus::Connection> &connection, const Glib::ustring &name);
|
||||
void prepareForSleep_cb(const Glib::RefPtr<Gio::DBus::Connection> &connection,
|
||||
const Glib::ustring &sender_name, const Glib::ustring &object_path,
|
||||
const Glib::ustring &interface_name, const Glib::ustring &signal_name,
|
||||
const Glib::VariantContainerBase ¶meters);
|
||||
void notify_cb(const Glib::ustring &sender_name, const Glib::ustring &signal_name,
|
||||
const Glib::VariantContainerBase &arguments);
|
||||
|
||||
void getData();
|
||||
bool handleToggle(GdkEventButton *const &);
|
||||
|
||||
// Config
|
||||
std::string format = DEFAULT_FORMAT;
|
||||
std::string format_alt = DEFAULT_FORMAT_ALT;
|
||||
std::string glyph = DEFAULT_GLYPH;
|
||||
bool tooltip = true;
|
||||
bool notRunningHide = true;
|
||||
bool useIcon = true;
|
||||
uint iconSize = 20;
|
||||
uint iconSpacing = 4;
|
||||
std::string iconName = DEFAULT_ICON_NAME;
|
||||
|
||||
Gtk::Box box_;
|
||||
Gtk::Image icon_;
|
||||
Gtk::Label label_;
|
||||
|
||||
const std::string dbus_name = "com.feralinteractive.GameMode";
|
||||
const std::string dbus_obj_path = "/com/feralinteractive/GameMode";
|
||||
const std::string dbus_interface = "org.freedesktop.DBus.Properties";
|
||||
const std::string dbus_get_interface = "com.feralinteractive.GameMode";
|
||||
|
||||
uint gameCount = 0;
|
||||
|
||||
std::string lastStatus;
|
||||
bool showAltText = false;
|
||||
|
||||
guint login1_id;
|
||||
Glib::RefPtr<Gio::DBus::Proxy> gamemode_proxy;
|
||||
Glib::RefPtr<Gio::DBus::Connection> system_connection;
|
||||
bool gamemodeRunning;
|
||||
guint gamemodeWatcher_id;
|
||||
};
|
||||
|
||||
} // namespace waybar::modules
|
Reference in New Issue
Block a user