Merge branch 'master' into list_of_times

This commit is contained in:
Alex
2022-03-08 09:59:22 +01:00
committed by GitHub
55 changed files with 1062 additions and 286 deletions

View File

@ -1,21 +1,14 @@
#pragma once
#include <fmt/format.h>
#if FMT_VERSION < 60000
#include <fmt/time.h>
#else
#include <fmt/chrono.h>
#endif
#include <date/tz.h>
#include "ALabel.hpp"
#include "util/sleeper_thread.hpp"
namespace waybar::modules {
namespace waybar {
struct waybar_time {
std::locale locale;
date::zoned_seconds ztime;
};
struct waybar_time;
namespace modules {
const std::string kCalendarPlaceholder = "calendar";
const std::string KTimezonedTimeListPlaceholder = "timezoned_time_list";
@ -46,4 +39,5 @@ class Clock : public ALabel {
auto timezones_text(std::chrono::_V2::system_clock::time_point *now) -> std::string;
};
} // namespace waybar::modules
} // namespace modules
} // namespace waybar

View File

@ -0,0 +1,27 @@
#pragma once
#include <memory>
#include <gio/gio.h>
#include "ALabel.hpp"
#include "bar.hpp"
namespace waybar::modules {
class Inhibitor : public ALabel {
public:
Inhibitor(const std::string&, const waybar::Bar&, const Json::Value&);
~Inhibitor() override;
auto update() -> void;
auto activated() -> bool;
private:
auto handleToggle(::GdkEventButton* const& e) -> bool;
const std::unique_ptr<::GDBusConnection, void(*)(::GDBusConnection*)> dbus_;
const std::string inhibitors_;
int handle_ = -1;
};
} // namespace waybar::modules

View File

@ -24,8 +24,6 @@ class KeyboardState : public AModule {
auto update() -> void;
private:
static auto openDevice(const std::string&) -> std::pair<int, libevdev*>;
Gtk::Box box_;
Gtk::Label numlock_label_;
Gtk::Label capslock_label_;

View File

@ -73,7 +73,8 @@ class Network : public ALabel {
int cidr_;
int32_t signal_strength_dbm_;
uint8_t signal_strength_;
uint32_t frequency_;
std::string signal_strength_app_;
float frequency_;
uint32_t route_priority;
util::SleeperThread thread_;

View File

@ -2,7 +2,8 @@
#include <fmt/format.h>
#include <tuple>
#include "ALabel.hpp"
#include "AIconLabel.hpp"
#include "bar.hpp"
#include "client.hpp"
#include "modules/sway/ipc/client.hpp"
@ -10,7 +11,7 @@
namespace waybar::modules::sway {
class Window : public ALabel, public sigc::trackable {
class Window : public AIconLabel, public sigc::trackable {
public:
Window(const std::string&, const waybar::Bar&, const Json::Value&);
~Window() = default;
@ -23,6 +24,7 @@ class Window : public ALabel, public sigc::trackable {
std::string& output);
void getTree();
std::string rewriteTitle(const std::string& title);
void updateAppIcon();
const Bar& bar_;
std::string window_;

View File

@ -3,11 +3,13 @@
#include "AModule.hpp"
#include "bar.hpp"
#include "client.hpp"
#include "giomm/desktopappinfo.h"
#include "util/json.hpp"
#include <memory>
#include <string>
#include <vector>
#include <map>
#include <unordered_set>
#include <gdk/gdk.h>
@ -61,15 +63,18 @@ class Task
Gtk::Image icon_;
Gtk::Label text_before_;
Gtk::Label text_after_;
Glib::RefPtr<Gio::DesktopAppInfo> app_info_;
bool button_visible_ = false;
bool ignored_ = false;
bool with_icon_;
bool with_icon_ = false;
bool with_name_ = false;
std::string format_before_;
std::string format_after_;
std::string format_tooltip_;
std::string name_;
std::string title_;
std::string app_id_;
uint32_t state_ = 0;
@ -77,6 +82,8 @@ class Task
private:
std::string repr() const;
std::string state_string(bool = false) const;
void set_app_info_from_app_id_list(const std::string& app_id_list);
bool image_load_icon(Gtk::Image& image, const Glib::RefPtr<Gtk::IconTheme>& icon_theme, Glib::RefPtr<Gio::DesktopAppInfo> app_info, int size);
void hide_if_ignored();
public:
@ -136,6 +143,7 @@ class Taskbar : public waybar::AModule
std::vector<Glib::RefPtr<Gtk::IconTheme>> icon_themes_;
std::unordered_set<std::string> ignore_list_;
std::map<std::string, std::string> app_ids_replace_map_;
struct zwlr_foreign_toplevel_manager_v1 *manager_;
struct wl_seat *seat_;
@ -158,8 +166,9 @@ class Taskbar : public waybar::AModule
bool show_output(struct wl_output *) const;
bool all_outputs() const;
std::vector<Glib::RefPtr<Gtk::IconTheme>> icon_themes() const;
const std::vector<Glib::RefPtr<Gtk::IconTheme>>& icon_themes() const;
const std::unordered_set<std::string>& ignore_list() const;
const std::map<std::string, std::string>& app_ids_replace_map() const;
};
} /* namespace waybar::modules::wlr */