Merge branch 'master' into feat/image-module
This commit is contained in:
commit
41dea6e46c
|
@ -11,7 +11,7 @@ jobs:
|
|||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Test in FreeBSD VM
|
||||
uses: vmactions/freebsd-vm@v0.1.5 # aka FreeBSD 13.0
|
||||
uses: vmactions/freebsd-vm@v0.1.6 # aka FreeBSD 13.0
|
||||
with:
|
||||
mem: 2048
|
||||
usesh: true
|
||||
|
@ -21,7 +21,7 @@ jobs:
|
|||
pkg install -y git # subprojects/date
|
||||
pkg install -y catch evdev-proto gtk-layer-shell gtkmm30 jsoncpp \
|
||||
libdbusmenu libevdev libfmt libmpdclient libudev-devd meson \
|
||||
pkgconf pulseaudio scdoc sndio spdlog
|
||||
pkgconf pulseaudio scdoc sndio spdlog wayland-protocols
|
||||
run: |
|
||||
meson build -Dman-pages=enabled
|
||||
ninja -C build
|
||||
|
|
|
@ -68,7 +68,10 @@ inline int close(FILE* fp, pid_t pid) {
|
|||
inline FILE* open(const std::string& cmd, int& pid) {
|
||||
if (cmd == "") return nullptr;
|
||||
int fd[2];
|
||||
pipe(fd);
|
||||
if (pipe(fd) != 0){
|
||||
spdlog::error("Unable to pipe fd");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
pid_t child_pid = fork();
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <fmt/format.h>
|
||||
#include <glibmm/ustring.h>
|
||||
|
||||
class pow_format {
|
||||
public:
|
||||
|
@ -84,5 +85,15 @@ namespace fmt {
|
|||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Glib ustirng support
|
||||
template <>
|
||||
struct formatter<Glib::ustring> : formatter<std::string> {
|
||||
template <typename FormatContext>
|
||||
auto format(const Glib::ustring& value, FormatContext& ctx) {
|
||||
return formatter<std::string>::format(value, ctx);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -86,6 +86,11 @@ The *clock* module displays the current date and time.
|
|||
typeof: double ++
|
||||
Threshold to be used when scrolling.
|
||||
|
||||
*tooltip*: ++
|
||||
typeof: bool ++
|
||||
default: true ++
|
||||
Option to disable tooltip on hover.
|
||||
|
||||
View all valid format options in *strftime(3)*.
|
||||
|
||||
# FORMAT REPLACEMENTS
|
||||
|
|
|
@ -151,7 +151,8 @@ $text\\n$tooltip\\n$class*
|
|||
"max-length": 40,
|
||||
"interval": 30, // Remove this if your script is endless and write in loop
|
||||
"exec": "$HOME/.config/waybar/mediaplayer.sh 2> /dev/null", // Script in resources folder
|
||||
"exec-if": "pgrep spotify"
|
||||
"exec-if": "pgrep spotify",
|
||||
"return-type": "json"
|
||||
}
|
||||
```
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ Addressed by *sway/mode*
|
|||
# EXAMPLES
|
||||
|
||||
```
|
||||
"sway/window": {
|
||||
"sway/mode": {
|
||||
"format": " {}",
|
||||
"max-length": 50
|
||||
}
|
||||
|
|
|
@ -29,6 +29,10 @@ Addressed by *tray*
|
|||
typeof: integer ++
|
||||
Defines the spacing between the tray icons.
|
||||
|
||||
*reverse-direction*: ++
|
||||
typeof: bool ++
|
||||
Defines if new app icons should be added in a reverse order
|
||||
|
||||
*on-update*: ++
|
||||
typeof: string ++
|
||||
Command to execute when the module is updated.
|
||||
|
|
|
@ -6,7 +6,9 @@ namespace waybar {
|
|||
|
||||
AModule::AModule(const Json::Value& config, const std::string& name, const std::string& id,
|
||||
bool enable_click, bool enable_scroll)
|
||||
: name_(std::move(name)), config_(std::move(config)) {
|
||||
: name_(std::move(name)), config_(std::move(config))
|
||||
, distance_scrolled_y_(0.0)
|
||||
, distance_scrolled_x_(0.0) {
|
||||
// configure events' user commands
|
||||
if (config_["on-click"].isString() || config_["on-click-middle"].isString() ||
|
||||
config_["on-click-backward"].isString() || config_["on-click-forward"].isString() ||
|
||||
|
|
|
@ -161,7 +161,7 @@ const std::tuple<uint8_t, float, std::string, float> waybar::modules::Battery::g
|
|||
uint32_t energy_now;
|
||||
uint32_t energy_full_design;
|
||||
std::string _status;
|
||||
std::ifstream(bat / "status") >> _status;
|
||||
std::getline(std::ifstream(bat / "status"), _status);
|
||||
|
||||
// Some battery will report current and charge in μA/μAh.
|
||||
// Scale these by the voltage to get μW/μWh.
|
||||
|
|
|
@ -99,7 +99,7 @@ auto waybar::modules::Clock::update() -> void {
|
|||
// As date dep is not fully compatible, prefer fmt
|
||||
tzset();
|
||||
auto localtime = fmt::localtime(std::chrono::system_clock::to_time_t(now));
|
||||
text = fmt::format(format_, localtime);
|
||||
text = fmt::format(locale_, format_, localtime);
|
||||
} else {
|
||||
text = fmt::format(format_, wtime);
|
||||
}
|
||||
|
@ -113,10 +113,10 @@ auto waybar::modules::Clock::update() -> void {
|
|||
}
|
||||
auto tooltip_format = config_["tooltip-format"].asString();
|
||||
text = fmt::format(tooltip_format, wtime, fmt::arg(kCalendarPlaceholder.c_str(), calendar_lines));
|
||||
label_.set_tooltip_markup(text);
|
||||
}
|
||||
}
|
||||
|
||||
label_.set_tooltip_markup(text);
|
||||
// Call parent update
|
||||
ALabel::update();
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ waybar::modules::Network::Network(const std::string &id, const Json::Value &conf
|
|||
family_(config["family"] == "ipv6" ? AF_INET6 : AF_INET),
|
||||
efd_(-1),
|
||||
ev_fd_(-1),
|
||||
want_route_dump_(false),
|
||||
want_route_dump_(true),
|
||||
want_link_dump_(false),
|
||||
want_addr_dump_(false),
|
||||
dump_in_progress_(false),
|
||||
|
@ -106,7 +106,7 @@ waybar::modules::Network::Network(const std::string &id, const Json::Value &conf
|
|||
}
|
||||
|
||||
if (!config_["interface"].isString()) {
|
||||
// "interface" isn't configure, then try to guess the external
|
||||
// "interface" isn't configured, then try to guess the external
|
||||
// interface currently used for internet.
|
||||
want_route_dump_ = true;
|
||||
} else {
|
||||
|
|
|
@ -54,7 +54,9 @@ void waybar::modules::Pulseaudio::contextStateCb(pa_context *c, void *data) {
|
|||
c,
|
||||
static_cast<enum pa_subscription_mask>(static_cast<int>(PA_SUBSCRIPTION_MASK_SERVER) |
|
||||
static_cast<int>(PA_SUBSCRIPTION_MASK_SINK) |
|
||||
static_cast<int>(PA_SUBSCRIPTION_MASK_SOURCE)),
|
||||
static_cast<int>(PA_SUBSCRIPTION_MASK_SINK_INPUT) |
|
||||
static_cast<int>(PA_SUBSCRIPTION_MASK_SOURCE) |
|
||||
static_cast<int>(PA_SUBSCRIPTION_MASK_SOURCE_OUTPUT)),
|
||||
nullptr,
|
||||
nullptr);
|
||||
break;
|
||||
|
@ -121,8 +123,12 @@ void waybar::modules::Pulseaudio::subscribeCb(pa_context * conte
|
|||
pa_context_get_server_info(context, serverInfoCb, data);
|
||||
} else if (facility == PA_SUBSCRIPTION_EVENT_SINK) {
|
||||
pa_context_get_sink_info_by_index(context, idx, sinkInfoCb, data);
|
||||
} else if (facility == PA_SUBSCRIPTION_EVENT_SINK_INPUT) {
|
||||
pa_context_get_sink_info_list(context, sinkInfoCb, data);
|
||||
} else if (facility == PA_SUBSCRIPTION_EVENT_SOURCE) {
|
||||
pa_context_get_source_info_by_index(context, idx, sourceInfoCb, data);
|
||||
} else if (facility == PA_SUBSCRIPTION_EVENT_SOURCE_OUTPUT) {
|
||||
pa_context_get_source_info_list(context, sourceInfoCb, data);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -279,7 +285,7 @@ auto waybar::modules::Pulseaudio::update() -> void {
|
|||
fmt::arg("source_desc", source_desc_),
|
||||
fmt::arg("icon", getIcon(volume_, getPulseIcon()))));
|
||||
getState(volume_);
|
||||
|
||||
|
||||
if (tooltipEnabled()) {
|
||||
if (tooltip_format.empty() && config_["tooltip-format"].isString()) {
|
||||
tooltip_format = config_["tooltip-format"].asString();
|
||||
|
|
|
@ -8,13 +8,7 @@
|
|||
#include <fstream>
|
||||
#include <map>
|
||||
|
||||
template <>
|
||||
struct fmt::formatter<Glib::ustring> : formatter<std::string> {
|
||||
template <typename FormatContext>
|
||||
auto format(const Glib::ustring& value, FormatContext& ctx) {
|
||||
return formatter<std::string>::format(value, ctx);
|
||||
}
|
||||
};
|
||||
#include "util/format.hpp"
|
||||
|
||||
template <>
|
||||
struct fmt::formatter<Glib::VariantBase> : formatter<std::string> {
|
||||
|
|
|
@ -25,7 +25,11 @@ Tray::Tray(const std::string& id, const Bar& bar, const Json::Value& config)
|
|||
}
|
||||
|
||||
void Tray::onAdd(std::unique_ptr<Item>& item) {
|
||||
box_.pack_start(item->event_box);
|
||||
if (config_["reverse-direction"].isBool() && config_["reverse-direction"].asBool()) {
|
||||
box_.pack_end(item->event_box);
|
||||
} else {
|
||||
box_.pack_start(item->event_box);
|
||||
}
|
||||
dp.emit();
|
||||
}
|
||||
|
||||
|
|
|
@ -154,7 +154,10 @@ auto Language::init_layouts_map(const std::vector<std::string>& used_layouts) ->
|
|||
|
||||
std::map<std::string, int> short_name_to_number_map;
|
||||
for (const auto& used_layout_name : used_layouts) {
|
||||
auto used_layout = &layouts_map_.find(used_layout_name)->second;
|
||||
auto found = layouts_map_.find(used_layout_name);
|
||||
if (found == layouts_map_.end())
|
||||
continue;
|
||||
auto used_layout = &found->second;
|
||||
auto layouts_with_same_name_list = found_by_short_names[used_layout->short_name];
|
||||
if (layouts_with_same_name_list.size() < 2) {
|
||||
continue;
|
||||
|
|
Loading…
Reference in New Issue