text stringlengths 14 100k | source stringclasses 1
value | repo stringclasses 810
values | language stringclasses 13
values |
|---|---|---|---|
<|fim_suffix|>TTON(gtk_button_new_with_label("click me !"));
g_signal_connect(inst->button, "clicked", G_CALLBACK(onclicked), NULL);
gtk_container_add(GTK_CONTAINER(inst->container), GTK_WIDGET(inst->button));
// Add a label
label = GTK_LABEL(gtk_label_new("]"));
gtk_container_add(GTK_CONTAINER(inst->contain... | fim | Alexays/Waybar | c |
<|fim_suffix|>ce);
/// Called when Waybar receives a POSIX signal and forwards it to each module
///
/// Optional CFFI function
///
/// @param instance Module instance data (as returned by `wbcffi_init`)
/// @param signal Signal ID
void wbcffi_refresh(void* instance, int signal);
/// Called on module action (see
/// ... | fim | Alexays/Waybar | c |
<|fim_prefix|>#!/usr/bin/env python3
import gi
gi.require_version("Playerctl", "2.0")
from gi.repository import Playerctl, GLib
from gi.repository.Playerctl import Player
import argparse
import logging
import sys
import signal
import gi
import json
import os
from typing import List
logger = logging.getLogger(__name__)... | fim | Alexays/Waybar | python |
<|fim_suffix|> try {
int scaled_icon_size = app_icon_size_ * image_.get_scale_factor();
auto pixbuf =
Gdk::Pixbuf::create_from_file(app_icon_name_, scaled_icon_size, scaled_icon_size);
auto surface = Gdk::Cairo::create_surface_from_pixbuf(pixbuf, image_.get_scale_factor(),
... | fim | Alexays/Waybar | cpp |
<|fim_suffix|>wap-icon-label"].isNull()) {
} else if (config_["swap-icon-label"].isBool()) {
swap_icon_label = config_["swap-icon-label"].asBool();
} else {
spdlog::warn("'swap-icon-label' must be a bool, found '{}'. Using default value (false).",
config_["swap-icon-label"].asString());
}... | fim | Alexays/Waybar | cpp |
<|fim_prefix|>#include "ALabel.hpp"
#include <fmt/format.h>
#include <fstream>
#include <iostream>
#include <util/command.hpp>
#include "config.hpp"
namespace waybar {
ALabel::ALabel(const Json::Value& config, const std::string& name, const std::string& id,
const std::string& format, uint16_t interv... | fim | Alexays/Waybar | cpp |
<|fim_prefix|>#include "AModule.hpp"
#include <fmt/format.h>
#include <spdlog/spdlog.h>
#include <util/command.hpp>
#include "gdk/gdk.h"
#include "gdkmm/cursor.h"
namespace waybar {
AModule::AModule(const Json::Value& config, const std::string& name, const std::string& id,
bool enable_click, bool ... | fim | Alexays/Waybar | cpp |
<|fim_suffix|>reate(curr_, min_, max_ + 1, 1, 1, 1));
}
void ASlider::onValueChanged() {}
} // namespace waybar<|fim_prefix|>#include "ASlider.hpp"
#include "gtkmm/adjustment.h"
#include "gtkmm/enums.h"
namespace waybar {
ASli<|fim_middle|>der::ASlider(const Json::Value& config, const std::string& name, const std... | fim | Alexays/Waybar | cpp |
<|fim_prefix|>#include "bar.hpp"
#include <gtk-layer-shell.h>
#include <spdlog/spdlog.h>
#include <type_traits>
#include "client.hpp"
#include "factory.hpp"
#include "group.hpp"
#include "util/enum.hpp"
#include "util/kill_signal.hpp"
#ifdef HAVE_SWAY
#include "modules/sway/bar.hpp"
#endif
namespace waybar {
stati... | fim | Alexays/Waybar | cpp |
<|fim_prefix|>#include "client.hpp"
#include <gtk-layer-shell.h>
#include <spdlog/spdlog.h>
#include <iostream>
#include <utility>
#include "gtkmm/icontheme.h"
#include "idle-inhibit-unstable-v1-client-protocol.h"
#include "util/clara.hpp"
#include "util/format.hpp"
#include "util/hex_checker.hpp"
waybar::Client* w... | fim | Alexays/Waybar | cpp |
<|fim_suffix|> auto config_output = output_conf.asString();
if (config_output.substr(0, 1) == "!") {
if (config_output.substr(1) == name || config_output.substr(1) == identifier) {
return false;
}
continue;
}
if (config_output == name || config_output =... | fim | Alexays/Waybar | cpp |
<|fim_suffix|>::modules::PulseaudioSlider(id, config_[name]);
}
#endif
#ifdef HAVE_LIBMPDCLIENT
if (ref == "mpd") {
return new waybar::modules::MPD(id, config_[name]);
}
#endif
#ifdef HAVE_LIBSNDIO
if (ref == "sndio") {
return new waybar::modules::Sndio(id, config_[name]);
}
#endif
#if d... | fim | Alexays/Waybar | cpp |
<|fim_suffix|> revealer_box) : box; }
void Group::addWidget(Gtk::Widget& widget) {
getBox().pack_start(widget, false, false);
if (is_drawer && !is_first_widget) {
widget.get_style_context()->add_class(add_class_to_drawer_children);
}
is_first_widget = false;
}
Group::operator Gtk::Widget&() { return eve... | fim | Alexays/Waybar | cpp |
<|fim_suffix|>(auto& bar : waybar::Client::inst()->bars) {
bar->handleSignal(signum);
}
return;
}
switch (signum) {
case SIGUSR1:
handleUserSignal(SIGUSR1, reload);
break;
case SIGUSR2:
handleUserSignal(SIGUSR2, reload);
break;
case SIGINT:
spdlog::info("Quit... | fim | Alexays/Waybar | cpp |
<|fim_suffix|>;
}
// Check scroll direction
auto dir = AModule::getScrollDir(e);
// No worries, it will always be set because of the switch below. This is purely to suppress a
// warning
util::ChangeType ct = util::ChangeType::Increase;
switch (dir) {
case SCROLL_DIR::UP:
[[fallthrough]];
... | fim | Alexays/Waybar | cpp |
<|fim_suffix|>tness = scale_.get_value();
backend.set_scaled_brightness(preferred_device_, brightness);
}
} // namespace waybar::modules<|fim_prefix|>#include "modules/backlight_slider.hpp"
#include "ASlider.hpp"
namespace waybar::modules {
BacklightSlider::BacklightSlider(const std::string& id, const Json::Valu... | fim | Alexays/Waybar | cpp |
<|fim_prefix|>#include "modules/battery.hpp"
#include <algorithm>
#include <cctype>
#include "util/command.hpp"
#if defined(__FreeBSD__)
#include <sys/sysctl.h>
#endif
#include <libudev.h>
#include <poll.h>
#include <spdlog/spdlog.h>
#include <sys/signalfd.h>
waybar::modules::Battery::Battery(const std::string& id, ... | fim | Alexays/Waybar | cpp |
<|fim_suffix|>) -> void {
std::string interface_name = g_dbus_proxy_get_interface_name(G_DBUS_PROXY(interface));
std::string object_path = g_dbus_proxy_get_object_path(G_DBUS_PROXY(interface));
if (interface_name == "org.bluez.Battery1") {
Bluetooth* bt = static_cast<Bluetooth*>(user_data);
if (bt->cur_co... | fim | Alexays/Waybar | cpp |
<|fim_suffix|>niform1i(uniform_gradient_count, prm_.gradient_count);
GLint uniform_gradient_colors{glGetUniformLocation(shaderProgram_, "gradient_colors")};
GLfloat gradient_colors[8][3];
for (int i{0}; i < prm_.gradient_count; ++i) {
parse_color(prm_.gradient_colors[i], &color);
gradient_colors[i][0] = (... | fim | Alexays/Waybar | cpp |
#include "modules/cava/cavaRaw.hpp"
#include <spdlog/spdlog.h>
waybar::modules::cava::Cava::Cava(const std::string& id, const Json::Value& config)
: ALabel(config, "cava", id, "{}", 60, false, false, false),
backend_{waybar::modules::cava::CavaBackend::inst(config)} {
if (config_["hide_on_silence"].isBool... | fim | Alexays/Waybar | cpp |
<|fim_prefix|>#include "modules/cava/cava_backend.hpp"
#include <spdlog/spdlog.h>
std::shared_ptr<waybar::modules::cava::CavaBackend> waybar::modules::cava::CavaBackend::inst(
const Json::Value& config) {
static auto* backend = new CavaBackend(config);
static std::shared_ptr<CavaBackend> backend_ptr{backend};... | fim | Alexays/Waybar | cpp |
<|fim_prefix|>#include "modules/cffi.hpp"
#include <dlfcn.h>
#include <json/value.h>
#include <algorithm>
#include <iostream>
#include <type_traits>
namespace waybar::modules {
CFFI::CFFI(const std::s<|fim_suffix|>.waybar_version = VERSION,
.get_root_widget =
[](ffi::wbcffi_module* obj) {
... | fim | Alexays/Waybar | cpp |
<|fim_suffix|>bar::modules::Clock::get_ordinal_date(const year_month_day& today) -> std::string {
auto day = static_cast<unsigned int>(today.day());
std::stringstream res;
res << day;
if (day >= 11 && day <= 13) {
res << "th";
return res.str();
}
switch (day % 10) {
case 1:
res << "st";
... | fim | Alexays/Waybar | cpp |
<|fim_suffix|>uency, min_frequency, avg_frequency] = CpuFrequency::getCpuFrequency();
auto format = format_;
auto total_usage = cpu_usage.empty() ? 0 : cpu_usage[0];
auto state = getState(total_usage);
if (!state.empty() && config_["format-" + state].isString()) {
format = config_["format-" + state].asStri... | fim | Alexays/Waybar | cpp |
<|fim_suffix|>&len, NULL, 0);
frequencies.push_back((float)freq);
#endif
if (frequencies.empty()) {
spdlog::warn("cpu/bsd: parseCpuFrequencies failed, not found in sysctl");
frequencies.push_back(NAN);
}
return frequencies;
}
<|fim_prefix|>#include <spdlog/spdlog.h>
#include <sys/sysctl.h>
#include "... | fim | Alexays/Waybar | cpp |
<|fim_suffix|>(tooltip, store));
} else {
tooltip = "Minimum frequency: {}\nAverage frequency: {}\nMaximum frequency: {}\n";
label_.set_tooltip_markup(
fmt::format(fmt::runtime(tooltip), min_frequency, avg_frequency, max_frequency));
}
}
}
// Call parent update
ALabel:... | fim | Alexays/Waybar | cpp |
<|fim_suffix|>_file_path = p.path().string() + freq_file;
std::string freq_value;
std::ifstream freq(freq_file_path);
if (freq.is_open()) {
getline(freq, freq_value);
float frequency = std::strtol(freq_value.c_str(), nullptr, 10);
frequencies.push_back(f... | fim | Alexays/Waybar | cpp |
<|fim_suffix|>}
pcp_time += CPUSTATES;
if (sysctlbyname("kern.cp_times", pcp_time, &sz, NULL, 0)) {
throw std::runtime_error("sysctl kern.cp_times failed");
}
#endif
std::vector<std::tuple<size_t, size_t>> cpuinfo;
for (int cpu = 0; cpu < ncpu + 1; cpu++) {
pcp_time_t total = 0, *single_cp_time = &cp_... | fim | Alexays/Waybar | cpp |
#include "modules/cpu_usage.hpp"
// In the 80000 version of fmt library authors decided to optimize imports
// and moved declarations required for fmt::dynamic_format_arg_store in new
// header fmt/args.h
#if (FMT_VERSION >= 80000)
#include <fmt/args.h>
#else
#include <fmt/core.h>
#endif
waybar::modules::CpuUsage::Cp... | fim | Alexays/Waybar | cpp |
<|fim_suffix|>em/cpu/present";
size_t cpu_present_last = 0;
std::ifstream cpu_present_file(sys_cpu_present_path);
std::string cpu_present_text;
if (cpu_present_file.is_open()) {
getline(cpu_present_file, cpu_present_text);
// This is a comma-separated list of ranges, eg. 0,2-4,7
size_t last_separato... | fim | Alexays/Waybar | cpp |
<|fim_prefix|>#include "modules/custom.hpp"
#include <spdlog/spdlog.h>
#include <utility>
#include "util/scope_guard.hpp"
waybar::modules::Custom::Custom(const std::string& name, const std::string& id,
const Json::Value& config, const std::string& output_name)
: ALabel(config, "c... | fim | Alexays/Waybar | cpp |
<|fim_suffix|>4.0;
} else if (divisor == "GB") {
return 1000.0 * 1000.0 * 1000.0;
} else if (divisor == "GiB") {
return 1024.0 * 1024.0 * 1024.0;
} else if (divisor == "TB") {
return 1000.0 * 1000.0 * 1000.0 * 1000.0;
} else if (divisor == "TiB") {
return 1024.0 * 1024.0 * 1024.0 * 1024.0;
} e... | fim | Alexays/Waybar | cpp |
<|fim_prefix|>#include "modules/dwl/tags.hpp"
#include <gtkmm/button.h>
#include <gtkmm/label.h>
#include <spdlog/spdlog.h>
#include <wayland-client.h>
#include <algorithm>
#include "client.hpp"
#include "dwl-ipc-unstable-v2-client-protocol.h"
#define TAG_INACTIVE 0
#define TAG_ACTIVE 1
#define TAG_URGENT 2
namesp... | fim | Alexays/Waybar | cpp |
<|fim_suffix|>;
if (status_manager_ == nullptr) {
spdlog::error("dwl_status_manager_v2 not advertised");
return;
}
struct wl_output* output = gdk_wayland_monitor_get_wl_output(bar_.output->monitor->gobj());
output_status_ = zdwl_ipc_manager_v2_get_output(status_manager_, output);
zdwl_ipc_output_v2_... | fim | Alexays/Waybar | cpp |
<|fim_suffix|>utton to bar
box_.pack_start(workspace->button(), false, false);
workspace->button().show_all();
}
workspace->update();
} else {
if (bar_contains_button) {
// remove button from bar
box_.remove(workspace->button());
}
}
}
}
// WorkspaceGro... | fim | Alexays/Waybar | cpp |
<|fim_prefix|>#include "modules/ext/workspace_manager_binding.hpp"
#include <spdlog/spdlog.h>
#include <cstdint>
#include "client.hpp"
#include "modules/ext/workspace_manager.hpp"
namespace waybar::modules::ext {
static void handle_global(void* data, wl_registry* registry, uint32_t name, const char* interface,
... | fim | Alexays/Waybar | cpp |
<|fim_prefix|>#include "modules/gamemode.hpp"
#include <fmt/core.h>
#include <spdlog/spdlog.h>
#include <cstdio>
#include <cstring>
#include <string>
#include "AModule.hpp"
#include "giomm/dbusconnection.h"
#include "giomm/dbusinterface.h"
#include "giomm/dbusproxy.h"
#include "giomm/dbuswatchname.h"
#include "glibm... | fim | Alexays/Waybar | cpp |
<|fim_suffix|>}
waybar::modules::Gps::~Gps() {
gps_stream(&gps_data_, WATCH_DISABLE, NULL);
gps_close(&gps_data_);
}
<|fim_prefix|>#include "modules/gps.hpp"
#include <gps.h>
#include <spdlog/spdlog.h>
#include <cmath>
#include <cstdio>
// In the 80000 version of fmt library authors decided to optimize imports
... | fim | Alexays/Waybar | cpp |
#include "modules/hyprland/backend.hpp"
#include <netdb.h>
#include <netinet/in.h>
#include <spdlog/spdlog.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/un.h>
#include <unistd.h>
#include <array>
#include <cerrno>
#include <cstring>
#include <filesystem>
#include <optional>
#in... | fim | Alexays/Waybar | cpp |
<|fim_suffix|>e.empty()
? inputDevices
: inputDevices.substr(inputDevices.find(kbName) + kbName.length());
searcher = searcher.substr(searcher.find("keymap:") + 8);
searcher = searcher.substr(0, searcher.find_first_of("\n\t"));
searcher = waybar::util::saniti... | fim | Alexays/Waybar | cpp |
<|fim_prefix|>#include "modules/hyprland/submap.hpp"
#include <spdlog/spdlog.h>
namespace waybar::modules::hyprland {
Submap::Submap(const std::string& id, const Bar& bar, const Json::Value& config)
: ALabel(config, "submap", id, "{}", 0, true), bar_(bar), m_ipc(IPC::inst()) {
parseConfig(config);
label_.hi... | fim | Alexays/Waybar | cpp |
<|fim_suffix|>lue["initialTitle"].asString(),
.fullscreen = value["fullscreen"].asBool(),
.grouped = !value["grouped"].empty()};
}
void Window::queryActiveWorkspace() {
if (separateOutputs_) {
workspace_ = getActiveWorkspace(this->bar_.output->name);
} else {
workspa... | fim | Alexays/Waybar | cpp |
<|fim_prefix|>#include "modules/hyprland/windowcount.hpp"
#include <glibmm/fileutils.h>
#include <glibmm/keyfile.h>
#include <glibmm/miscutils.h>
#include <spdlog/spdlog.h>
#include <algorithm>
#include <vector>
#include "modules/hyprland/backend.hpp"
namespace waybar::modules::hyprland {
WindowCount::WindowCount(... | fim | Alexays/Waybar | cpp |
<|fim_prefix|>#include "modules/hyprland/windowcreationpayload.hpp"
#include <json/value.h>
#include <spdlog/spdlog.h>
#include <string>
#include <utility>
#include <variant>
#include "modules/hyprland/workspaces.hpp"
namespace waybar::modules::hyprland {
WindowCreationPayload::WindowCreationPayload(Json::Value co... | fim | Alexays/Waybar | cpp |
<|fim_prefix|>#include <json/value.h>
#include <spdlog/spdlog.h>
#include <memory>
#include <string>
#include <utility>
#include "modules/hyprland/workspaces.hpp"
#include "util/command.hpp"
#include "util/icon_loader.hpp"
namespace waybar::modules::hyprland {
Workspace::Workspace(const Json::Value& workspace_data,... | fim | Alexays/Waybar | cpp |
<|fim_suffix|>bstr(0, separator);
const std::string part2 = payload.substr(part1.size() + 1);
return {part1, part2};
}
std::tuple<std::string, std::string, std::string> Workspaces::splitTriplePayload(
std::string const& payload) {
const size_t firstComma = payload.find(',');
const size_t secondComma = payl... | fim | Alexays/Waybar | cpp |
<|fim_suffix|>les::IdleInhibitor::modules.push_back(this);
dp.emit();
}
waybar::modules::IdleInhibitor::~IdleInhibitor() {
if (idle_inhibitor_ != nullptr) {
zwp_idle_inhibitor_v1_destroy(idle_inhibitor_);
idle_inhibitor_ = nullptr;
}
// Remove this from the modules list
waybar::modules::IdleInhibit... | fim | Alexays/Waybar | cpp |
<|fim_prefix|>#include "modules/image.hpp"
waybar::modules::Image::Image(const std::string& id, const Json::Value& config)
: AModule(config, "image", id), box_(Gtk::ORIENTATION_HORIZONTAL, 0) {
box_.pack_start(image_);
box_.set_name("image");
if (!id.empty()) {
box_.get_style_context()->add_class(id);
... | fim | Alexays/Waybar | cpp |
<|fim_suffix|>::mem_fun(*this, &Inhibitor::handleToggle));
dp.emit();
}
Inhibitor::~Inhibitor() {
if (handle_ != -1) {
::close(handle_);
}
}
auto Inhibitor::activated() -> bool { return handle_ != -1; }
auto Inhibitor::update() -> void {
std::string status_text = activated() ? "activated" : "deactivated"... | fim | Alexays/Waybar | cpp |
<|fim_suffix|>ack(jack_nframes_t size, void* obj) {
return static_cast<waybar::modules::JACK*>(obj)->bufSize(size);
}
int sampleRateCallback(jack_nframes_t rate, void* obj) {
return static_cast<waybar::modules::JACK*>(obj)->sampleRate(rate);
}
int xrunCallback(void* obj) { return static_cast<waybar::modules::JACK... | fim | Alexays/Waybar | cpp |
<|fim_suffix|>te : label_states) {
std::string text;
text = fmt::format(fmt::runtime(label_state.format),
fmt::arg("icon", label_state.state ? icon_locked_ : icon_unlocked_),
fmt::arg("name", label_state.name));
label_state.label.set_markup(text);
if (label_... | fim | Alexays/Waybar | cpp |
<|fim_prefix|>#include "modules/load.hpp"
// In the 80000 version of fmt library authors decided to optimize imports
// and moved declarations required for fmt::dynamic_format_arg_store in new
// header fmt/args.h
#if (FMT_VERSION >= 80000)
#include <fmt/args.h>
#else
#include <fmt/core.h>
#endif
waybar::modules::Loa... | fim | Alexays/Waybar | cpp |
<|fim_prefix|>// clang-format off
#include <sys/types.h>
#include <sys/sysctl.h>
// clang-format on
#include <unistd.h> // getpagesize
#include "modules/memory.hpp"
#if defined(__DragonFly__)
#include <sys/vmmeter.h> // struct vmstats
#elif defined(__NetBSD__)
#include <uvm/uvm_extern.h> // struct uvmexp_sysctl
#e... | fim | Alexays/Waybar | cpp |
<|fim_suffix|>p)));
}
if (tooltipEnabled()) {
if (config_["tooltip-format"].isString()) {
auto tooltip_format = config_["tooltip-format"].asString();
label_.set_tooltip_markup(fmt::format(
fmt::runtime(tooltip_format), used_ram_percentage,
fmt::arg("total", total_r... | fim | Alexays/Waybar | cpp |
<|fim_suffix|> return data / 1024; // convert to kB
}
}
}
return 0;
}
void waybar::modules::Memory::parseMeminfo() {
const std::string data_dir_ = "/proc/meminfo";
std::ifstream info(data_dir_);
if (!info.is_open()) {
throw std::runtime_error("Can't open " + data_dir_);
}
std::string... | fim | Alexays/Waybar | cpp |
<|fim_prefix|>#include "modules/mpd/mpd.hpp"
#include <fmt/chrono.h>
#include <glibmm/ustring.h>
#include <spdlog/spdlog.h>
#include <system_error>
#include <util/sanitize_str.hpp>
using namespace waybar::util;
#include "modules/mpd/state.hpp"
#if defined(MPD_NOINLINE)
namespace waybar::modules {
#include "modules/m... | fim | Alexays/Waybar | cpp |
<|fim_prefix|>#include "modules/mpd/state.hpp"
#include <fmt/chrono.h>
#include <spdlog/spdlog.h>
#include "modules/mpd/mpd.hpp"
#if defined(MPD_NOINLINE)
namespace waybar::modules {
#include "modules/mpd/state.inl.hpp"
} // namespace waybar::modules
#endif
#if FMT_VERSION >= 90000
/* Satisfy fmt 9.x deprecation of... | fim | Alexays/Waybar | cpp |
<|fim_prefix|>#include "modules/mpris/mpris.hpp"
#include <fmt/core.h>
#include <optional>
#include <sstream>
#include <string>
#include "util/scope_guard.hpp"
extern "C" {
#include <playerctl/playerctl.h>
}
#include <glib.h>
#include <spdlog/spdlog.h>
namespace waybar::modules::mpris {
const std::string DEFAULT_... | fim | Alexays/Waybar | cpp |
<|fim_suffix|>_TABLE_MAIN) {
return NL_OK;
}
/* Parse all the attributes for a single routing table entry. */
for (; RTA_OK(attr, attrlen); attr = RTA_NEXT(attr, attrlen)) {
/* Determine if this routing table entry corresponds to the default
* route by seeing if it has a gate... | fim | Alexays/Waybar | cpp |
<|fim_prefix|>#include "modules/niri/backend.hpp"
#include <netdb.h>
#include <netinet/in.h>
#include <spdlog/spdlog.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/un.h>
#include <unistd.h>
#include <iostream>
#include <string>
#include <thread>
#include "giomm/datainputstream.... | fim | Alexays/Waybar | cpp |
<|fim_prefix|>#include "modules/niri/language.hpp"
#include <spdlog/spdlog.h>
#include <xkbcommon/xkbcommon.h>
#include <xkbcommon/xkbregistry.h>
#include "util/string.hpp"
namespace waybar::modules::niri {
Language::Language(const std::string& id, const Bar& bar, const Json::Value& config)
: ALabel(config, "la... | fim | Alexays/Waybar | cpp |
<|fim_prefix|>#include "modules/niri/window.h<|fim_suffix|> workspaceId;
});
setClass("solo", isSolo);
if (!appId.empty()) setClass(appId, isSolo);
if (oldAppId_ != appId) {
if (!oldAppId_.empty()) setClass(oldAppId_, false);
oldAppId_ = appId;
}
} else {
label_.hide();
update... | fim | Alexays/Waybar | cpp |
<|fim_prefix|>#include "modules/niri/workspaces.hpp"
#include <gtkmm/button.h>
#include <gtkmm/label.h>
#include <spdlog/spdlog.h>
namespace waybar::modules::niri {
Workspaces::Workspaces(const std::string& id, const Bar& bar, const Json::Value& config)
: AModule(config, "workspaces", id, false, false), bar_(bar... | fim | Alexays/Waybar | cpp |
<|fim_suffix|>r = Glib::Variant<Glib::ustring>;
using SetPowerProfileVar = Glib::Variant<std::tuple<Glib::ustring, Glib::ustring, VarStr>>;
VarStr activeProfileVariant = VarStr::create(activeProfile_->name);
auto callArgs = SetPowerProfileVar::create(
std::make_tuple("net.hadess.PowerProfiles", "Act... | fim | Alexays/Waybar | cpp |
<|fim_prefix|>#include "modules/privacy/privacy.hpp"
#include <json/value.h>
#include <spdlog/spdlog.h>
#include <string>
#include "AModule.hpp"
#include "modules/privacy/privacy_item.hpp"
namespace waybar::modules::privacy {
using util::PipewireBackend::PRIVACY_NODE_TYPE_AUDIO_INPUT;
using util::PipewireBackend::... | fim | Alexays/Waybar | cpp |
<|fim_prefix|>#include "modules/privacy/privacy_item.hpp"
#include <spdlog/spdlog.h>
#include <string>
#include "glibmm/main.h"
#include "gtkmm/label.h"
#include "gtkmm/revealer.h"
#include "gtkmm/tooltip.h"
#include "util/pipewire/privacy_node_info.hpp"
namespace waybar::modules::privacy {
PrivacyItem::PrivacyIte... | fim | Alexays/Waybar | cpp |
<|fim_prefix|>#include "modules/pulseaudio.hpp"
waybar::modules::Pulseaudio::Pulseaudio(const std::string& id, const Json::Value& config)
: ALabel(config, "pulseaudio", id, "{volume}%") {
event_box_.add_events(Gdk::SCROLL_MASK | Gdk::SMOOTH_SCROLL_MASK);
event_box_.signal_scroll_event().connect(sigc::mem_fun(*... | fim | Alexays/Waybar | cpp |
<|fim_suffix|>
scale_.set_value(backend->getSourceVolume());
}
break;
}
}
void PulseaudioSlider::onValueChanged() {
bool is_mute = false;
switch (target) {
case PulseaudioSliderTarget::Sink:
if (backend->getSinkMuted()) {
is_mute = true;
}
break;
case Pulse... | fim | Alexays/Waybar | cpp |
<|fim_prefix|>#include "modules/river/layout.hpp"
#include <spdlog/spdlog.h>
#include <wayland-client.h>
#include "client.hpp"
namespace waybar::modules::river {
static void listen_focused_tags(void* data, struct zriver_output_status_v1* zriver_output_status_v1,
uint32_t tags) {
//... | fim | Alexays/Waybar | cpp |
<|fim_suffix|> == 0) {
version = std::min<uint32_t>(version, 1);
static_cast<Mode*>(data)->seat_ =
static_cast<struct wl_seat*>(wl_registry_bind(registry, name, &wl_seat_interface, version));
}
}
static void handle_global_remove(void* data, struct wl_registry* registry, uint32_t name) {
// Nobody c... | fim | Alexays/Waybar | cpp |
<|fim_prefix|>#include "modules/river/tags.hpp"
#include <gtkmm/button.h>
#include <gtkmm/label.h>
#include <spdlog/spdlog.h>
#include <wayland-client.h>
#include <algorithm>
#include "client.hpp"
#include "xdg-output-unstable-v1-client-protocol.h"
namespace waybar::modules::river {
static void listen_focused_tags... | fim | Alexays/Waybar | cpp |
<|fim_suffix|>output) { // if we unfocused the output this bar belongs to
label_.get_style_context()->remove_class("focused");
ALabel::update();
}
}
} /* namespace waybar::modules::river */
<|fim_prefix|>#include "modules/river/window.hpp"
#include <spdlog/spdlog.h>
#include <wayland-client.h>
#include <a... | fim | Alexays/Waybar | cpp |
<|fim_prefix|>#incl<|fim_suffix|>al_;
/* sleep until the next projected time */
thread_.sleep_for(interval_ - diff);
};
}
auto waybar::modules::Clock::update() -> void {
tzset(); // Update timezone information
auto now = std::chrono::system_clock::now();
auto localtime = fmt::localtime(std::chrono::sy... | fim | Alexays/Waybar | cpp |
<|fim_suffix|>nts are configured
if (config_["on-scroll-up"].isString() || config_["on-scroll-down"].isString()) {
return AModule::handleScroll(e);
}
// only try to talk to sndio if connected
if (hdl_ == nullptr) return true;
auto dir = AModule::getScrollDir(e);
if (dir == SCROLL_DIR::NONE) {
retu... | fim | Alexays/Waybar | cpp |
<|fim_prefix|>#include "modules/sni/host.hpp"
#include <spdlog/spdlog.h>
#include "util/scope_guard.hpp"
namespace waybar::modules::SNI {
Host::Host(const std::size_t id, const Json::Value& config, const Bar& bar,
const std::function<void(std::unique_ptr<Item>&)>& on_add,
const std::function<v... | fim | Alexays/Waybar | cpp |
<|fim_prefix|>#include "modules/sni/item.hpp"
#include <gdkmm/general.h>
#include <glibmm/main.h>
#include <gtkmm/tooltip.h>
#include <spdlog/spdlog.h>
#include <algorithm>
#include <filesystem>
#include <fstream>
#include <map>
#include "gdk/gdk.h"
#include "modules/sni/icon_manager.hpp"
#include "util/format.hpp"
... | fim | Alexays/Waybar | cpp |
<|fim_prefix|>#include "modules/sni/tray.hpp"
#include <spdlog/spdlog.h>
#include <alg<|fim_suffix|>te
AModule::update();
}
} // namespace waybar::modules::SNI
<|fim_middle|>orithm>
#include "modules/sni/icon_manager.hpp"
namespace waybar::modules::SNI {
Tray::Tray(const std::string& id, const Bar& bar, const ... | fim | Alexays/Waybar | cpp |
<|fim_prefix|>#include "modules/sni/watcher.hpp"
#include <spdlog/spdlog.h>
#include "util/scope_guard.hpp"
using namespace waybar::modules::SNI;
Watcher::Watcher()
: bus_name_id_(Gio::DBus::own_name(Gio::DBus::BusType::BUS_TYPE_SESSION,
"org.kde.StatusNotifierWatcher",
... | fim | Alexays/Waybar | cpp |
<|fim_suffix|>success = payload.get("success", true); !success.asBool()) {
auto err = payload.get("error", "Unknown error");
throw std::runtime_error(err.asString());
}
auto config = parseConfig(payload);
onConfigUpdate(config);
}
void BarIpcClient::onIpcEvent(const struct Ipc::ipc_response& res) {
try... | fim | Alexays/Waybar | cpp |
#include "modules/sway/ipc/client.hpp"
#include <fcntl.h>
#include <spdlog/spdlog.h>
#include <stdexcept>
namespace waybar::modules::sway {
Ipc::Ipc() {
const std::string& socketPath = getSocketPath();
fd_ = util::ScopedFd(open(socketPath));
fd_event_ = util::ScopedFd(open(socketPath));
}
Ipc::~Ipc() {
thr... | fim | Alexays/Waybar | cpp |
<|fim_prefix|>#include "modules/sway/language.hpp"
#include <fmt/core.h>
#include <json/json.h>
#include <spdlog/spdlog.h>
#include <xkbcommon/xkbregistry.h>
#include <cstring>
#include <string>
#include <vector>
#include "modules/sway/ipc/ipc.hpp"
#include "util/string.hpp"
namespace waybar::modules::sway {
const... | fim | Alexays/Waybar | cpp |
<|fim_suffix|>e& res) {
try {
std::lock_guard<std::mutex> lock(mutex_);
auto payload = parser_.parse(res.payload);
if (payload["change"] != "default") {
if (payload["pango_markup"].asBool()) {
mode_ = payload["change"].asString();
} else {
mode_ = Glib::Markup::escape_text(payl... | fim | Alexays/Waybar | cpp |
<|fim_suffix|>][0]["floating_nodes"]) {
tooltip_text_.append(fmt::format(fmt::runtime(tooltip_format_ + '\n'),
fmt::arg("app", window["app_id"].asString()),
fmt::arg("title", window["name"].asString())));
}
if (!toolti... | fim | Alexays/Waybar | cpp |
<|fim_prefix|>#include "modules/sway/window.hpp"
#include <gdkmm/pixbuf.h>
#include <glibmm/fileutils.h>
#include <glibmm/keyfile.h>
#include <glibmm/miscutils.h>
#include <gtkmm/enums.h>
#include <spdlog/spdlog.h>
#include <filesystem>
#include <regex>
#include <string>
#include "util/gtk_icon.hpp"
#include "util/r... | fim | Alexays/Waybar | cpp |
<|fim_prefix|>#include "modules/sway/workspaces.hpp"
#include <spdlog/spdlog.h>
#include <algorithm>
#include <cctype>
#include <string>
namespace waybar::modules::sway {
// Helper function to assign a number to a workspace, just like sway. In fact
// this is taken quite verbatim from `sway/ipc-json.c`.
int Workspa... | fim | Alexays/Waybar | cpp |
<|fim_prefix|>#include "modules/systemd_failed_units.hpp"
#include <fmt/format.h>
#include <giomm/dbusproxy.h>
#include <glibmm/markup.h>
#include <glibmm/variant.h>
#include <spdlog/spdlog.h>
#include <cstdint>
#include <exception>
#include <stdexcept>
#include <tuple>
static const unsigned UPDATE_DEBOUNCE_TIME_MS ... | fim | Alexays/Waybar | cpp |
<|fim_suffix|>ure_c;
}
throw std::runtime_error(fmt::format(
"sysctl hw.acpi.thermal.tz{}.temperature and dev.cpu.{}.temperature failed", zone, zone));
#else // Linux
std::ifstream temp(file_path_);
if (!temp.is_open()) {
throw std::runtime_error("Can't open " + file_path_);
}
std::string line;... | fim | Alexays/Waybar | cpp |
<|fim_suffix|>uto ds{std::chrono::duration_cast<std::chrono::days>(sec)};
const auto hrs{std::chrono::duration_cast<std::chrono::hours>(sec - ds)};
const auto min{std::chrono::duration_cast<std::chrono::minutes>(sec - ds - hrs)};
std::string_view strRet{(ds.count() > 0) ? "{D}d {H}h {M}min"
... | fim | Alexays/Waybar | cpp |
#include "modules/user.hpp"
#include <fmt/chrono.h>
#include <glibmm/miscutils.h>
#include <unistd.h>
#include <algorithm>
#include <chrono>
#include "gdkmm/cursor.h"
#include "gdkmm/event.h"
#include "gdkmm/types.h"
#include "glibmm/fileutils.h"
#include "sigc++/functors/mem_fun.h"
#include "sigc++/functors/ptr_fun... | fim | Alexays/Waybar | cpp |
<|fim_prefix|>#include "modules/wayfire/backend.hpp"
#include <json/json.h>
#include <spdlog/spdlog.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <algorithm>
#include <bit>
#include <cstdint>
#include <cstdlib>
#include <cstring>
#include <exception>
#include <ranges>
#include <thread>
namespace waybar::mo... | fim | Alexays/Waybar | cpp |
<|fim_prefix|>#include "modules/wayfire/window.hpp"
#include <gtkmm/button.h>
#include <gtkmm/label.h>
#include <spdlog/spdlog.h>
#include "util/rewrite_string.hpp"
#include "util/sanitize_str.hpp"
namespace waybar::modules::wayfire {
Window::Window(const std::string& id, const Bar& bar, const Json::Value& config)
... | fim | Alexays/Waybar | cpp |
<|fim_prefix|>#include "modules/wayfire/workspaces.hpp"
#include <gtkmm/button.h>
#include <gtkmm/label.h>
#include <spdlog/spdlog.h>
#include <string>
#include <utility>
#include "modules/wayfire/backend.hpp"
namespace waybar::modules::wayfire {
Workspaces::Workspaces(const std::string& id, const Bar& bar, const ... | fim | Alexays/Waybar | cpp |
#include "modules/wireplumber.hpp"
#include <spdlog/spdlog.h>
bool isValidNodeId(uint32_t id) { return id > 0 && id < G_MAXUINT32; }
std::list<waybar::modules::Wireplumber*> waybar::modules::Wireplumber::modules;
waybar::modules::Wireplumber::Wireplumber(const std::string& id, const Json::Value& config)
: ALabe... | fim | Alexays/Waybar | cpp |
<|fim_suffix|>"Foreign toplevel manager server does not support for set/unset fullscreen.");
return;
}
if (set)
zwlr_foreign_toplevel_handle_v1_set_fullscreen(handle_, nullptr);
else
zwlr_foreign_toplevel_handle_v1_unset_fullscreen(handle_);
}
void Task::close() { zwlr_foreign_toplevel_handle_v1_clo... | fim | Alexays/Waybar | cpp |
#include "util/audio_backend.hpp"
#include <fmt/core.h>
#include <pulse/def.h>
#include <pulse/error.h>
#include <pulse/introspect.h>
#include <pulse/subscribe.h>
#include <pulse/volume.h>
#include <spdlog/spdlog.h>
#include <algorithm>
#include <cmath>
#include <stdexcept>
#include <utility>
namespace waybar::util ... | fim | Alexays/Waybar | cpp |
#include "util/backlight_backend.hpp"
#include <fmt/core.h>
#include <spdlog/spdlog.h>
#include <sys/epoll.h>
#include <cmath>
#include <optional>
#include <utility>
#include "util/udev_deleter.hpp"
namespace {
class FileDescriptor {
public:
explicit FileDescriptor(int fd) : fd_(fd) {}
FileDescriptor(const Fil... | fim | Alexays/Waybar | cpp |
<|fim_prefix|>#include "util/css_reload_helper.hpp"
#include <poll.h>
#include <spdlog/spdlog.h>
#ifndef __OpenBSD__
#include <sys/inotify.h>
#else
#include <sys/event.h>
#include <sys/time.h>
#include <sys/types.h>
#endif
#include <filesystem>
#include <fstream>
#include <regex>
#include <unordered_map>
#include "c... | fim | Alexays/Waybar | cpp |
<|fim_prefix|>#include "util/enum.hpp"
#include <algorithm> // for std::transform
#include <cctype> // for std::toupper
#include <iostream>
#include <map>
#include <stdexcept>
#include <string>
#include "modules/hyprland/workspa<|fim_suffix|>f it doesn't return
throw std::invalid_argument("Invalid string repre... | fim | Alexays/Waybar | cpp |
<|fim_prefix|>#include "util/gtk_icon.hpp"
/* We need a global mutex for accessing the object returned by Gtk::IconTheme::get_default()
* because it always returns the<|fim_suffix|>tex);
return Gtk::IconTheme::get_default()->has_icon(value);
}
Glib::RefPtr<Gdk::Pixbuf> DefaultGtkIconThemeWrapper::load_icon(
c... | fim | Alexays/Waybar | cpp |
<|fim_suffix|>fo_ = get_desktop_app_info(app_name);
if (app_info_) {
return app_info_;
}
start = app_id.find("-");
app_name = app_id.substr(0, start);
app_info_ = get_desktop_app_info(app_name);
}
return app_info_;
}
<|fim_prefix|>#include "util/icon_loader.hpp"
#include "util/string.hpp... | fim | Alexays/Waybar | cpp |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.