mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
e9b6380c18 | |||
43beefb00d | |||
12f869ccba | |||
7e9207d75c | |||
7a2dee7377 | |||
21a89ac46d | |||
bb99e6cf5b |
@ -1,10 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <glibmm/refptr.h>
|
#include <glibmm/refptr.h>
|
||||||
|
#include <gtkmm/box.h>
|
||||||
#include <gtkmm/cssprovider.h>
|
#include <gtkmm/cssprovider.h>
|
||||||
#include <gtkmm/main.h>
|
#include <gtkmm/main.h>
|
||||||
#include <gtkmm/window.h>
|
#include <gtkmm/window.h>
|
||||||
#include <gtkmm/box.h>
|
|
||||||
#include <json/json.h>
|
#include <json/json.h>
|
||||||
#include "AModule.hpp"
|
#include "AModule.hpp"
|
||||||
#include "idle-inhibit-unstable-v1-client-protocol.h"
|
#include "idle-inhibit-unstable-v1-client-protocol.h"
|
||||||
@ -15,10 +15,10 @@ namespace waybar {
|
|||||||
|
|
||||||
class Factory;
|
class Factory;
|
||||||
struct waybar_output {
|
struct waybar_output {
|
||||||
struct wl_output * output;
|
struct wl_output * output = nullptr;
|
||||||
std::string name;
|
std::string name;
|
||||||
uint32_t wl_name;
|
uint32_t wl_name;
|
||||||
struct zxdg_output_v1 *xdg_output;
|
struct zxdg_output_v1 *xdg_output = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Bar {
|
class Bar {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
project(
|
project(
|
||||||
'waybar', 'cpp', 'c',
|
'waybar', 'cpp', 'c',
|
||||||
version: '0.7.1',
|
version: '0.7.2',
|
||||||
license: 'MIT',
|
license: 'MIT',
|
||||||
default_options : [
|
default_options : [
|
||||||
'cpp_std=c++17',
|
'cpp_std=c++17',
|
||||||
|
@ -140,5 +140,6 @@
|
|||||||
},
|
},
|
||||||
"escape": true,
|
"escape": true,
|
||||||
"exec": "$HOME/.config/waybar/mediaplayer.py 2> /dev/null" // Script in resources folder
|
"exec": "$HOME/.config/waybar/mediaplayer.py 2> /dev/null" // Script in resources folder
|
||||||
|
// "exec": "$HOME/.config/waybar/mediaplayer.py --player spotify 2> /dev/null" // Filter player based on name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ def on_metadata(player, metadata, manager):
|
|||||||
|
|
||||||
|
|
||||||
def on_player_appeared(manager, player, selected_player=None):
|
def on_player_appeared(manager, player, selected_player=None):
|
||||||
if player is not None and player.name == selected_player:
|
if player is not None and (selected_player is None or player.name == selected_player):
|
||||||
init_player(manager, player)
|
init_player(manager, player)
|
||||||
else:
|
else:
|
||||||
logger.debug("New player appeared, but it's not the selected player, skipping")
|
logger.debug("New player appeared, but it's not the selected player, skipping")
|
||||||
|
@ -65,8 +65,14 @@ void waybar::Client::handleGlobalRemove(void * data, struct wl_registry * /*re
|
|||||||
client->outputs_.end(),
|
client->outputs_.end(),
|
||||||
[&name](const auto &output) { return output->wl_name == name; });
|
[&name](const auto &output) { return output->wl_name == name; });
|
||||||
if (it != client->outputs_.end()) {
|
if (it != client->outputs_.end()) {
|
||||||
zxdg_output_v1_destroy((*it)->xdg_output);
|
if ((*it)->xdg_output != nullptr) {
|
||||||
wl_output_destroy((*it)->output);
|
zxdg_output_v1_destroy((*it)->xdg_output);
|
||||||
|
(*it)->xdg_output = nullptr;
|
||||||
|
}
|
||||||
|
if ((*it)->output != nullptr) {
|
||||||
|
wl_output_destroy((*it)->output);
|
||||||
|
(*it)->output = nullptr;
|
||||||
|
}
|
||||||
client->outputs_.erase(it);
|
client->outputs_.erase(it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -151,8 +157,14 @@ void waybar::Client::handleName(void * data, struct zxdg_output_v1 * /*xdg_
|
|||||||
output->name = name;
|
output->name = name;
|
||||||
auto configs = client->getOutputConfigs(output);
|
auto configs = client->getOutputConfigs(output);
|
||||||
if (configs.empty()) {
|
if (configs.empty()) {
|
||||||
wl_output_destroy(output->output);
|
if (output->output != nullptr) {
|
||||||
zxdg_output_v1_destroy(output->xdg_output);
|
wl_output_destroy(output->output);
|
||||||
|
output->output = nullptr;
|
||||||
|
}
|
||||||
|
if (output->xdg_output != nullptr) {
|
||||||
|
zxdg_output_v1_destroy(output->xdg_output);
|
||||||
|
output->xdg_output = nullptr;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
wl_display_roundtrip(client->wl_display);
|
wl_display_roundtrip(client->wl_display);
|
||||||
for (const auto &config : configs) {
|
for (const auto &config : configs) {
|
||||||
|
@ -10,7 +10,7 @@ Tray::Tray(const std::string& id, const Bar& bar, const Json::Value& config)
|
|||||||
host_(nb_hosts_, config, std::bind(&Tray::onAdd, this, std::placeholders::_1),
|
host_(nb_hosts_, config, std::bind(&Tray::onAdd, this, std::placeholders::_1),
|
||||||
std::bind(&Tray::onRemove, this, std::placeholders::_1)) {
|
std::bind(&Tray::onRemove, this, std::placeholders::_1)) {
|
||||||
spdlog::warn(
|
spdlog::warn(
|
||||||
"For a functionnal tray you must have libappindicator-* installed and export "
|
"For a functional tray you must have libappindicator-* installed and export "
|
||||||
"XDG_CURRENT_DESKTOP=Unity");
|
"XDG_CURRENT_DESKTOP=Unity");
|
||||||
box_.set_name("tray");
|
box_.set_name("tray");
|
||||||
event_box_.add(box_);
|
event_box_.add(box_);
|
||||||
|
Reference in New Issue
Block a user