quick commit
This commit is contained in:
@@ -17,6 +17,7 @@ class MprisController : public DbusConnection {
|
|||||||
std::string artwork_url;
|
std::string artwork_url;
|
||||||
int64_t length_ms;
|
int64_t length_ms;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class PlaybackStatus {
|
enum class PlaybackStatus {
|
||||||
Playing,
|
Playing,
|
||||||
Paused,
|
Paused,
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <nlohmann/json.hpp>
|
#include <nlohmann/json.hpp>
|
||||||
#include <span>
|
#include <span>
|
||||||
|
#include <spdlog/spdlog.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <sys/un.h>
|
#include <sys/un.h>
|
||||||
@@ -127,7 +128,7 @@ class HyprctlHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void dispatchWorkspace(int workspaceNumber) {
|
static void dispatchWorkspace(int workspaceNumber) {
|
||||||
std::string command = "dispatch workspace " + std::to_string(workspaceNumber);
|
std::string command = "dispatch hl.dsp.focus({ workspace = \"" + std::to_string(workspaceNumber) + "\" })";
|
||||||
sendCommand(command);
|
sendCommand(command);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -349,9 +349,11 @@ void MprisController::on_properties_changed(const Gio::DBus::Proxy::MapChangedPr
|
|||||||
|
|
||||||
if (changed_properties.find("PlaybackStatus") != changed_properties.end()) {
|
if (changed_properties.find("PlaybackStatus") != changed_properties.end()) {
|
||||||
auto status_var = changed_properties.at("PlaybackStatus");
|
auto status_var = changed_properties.at("PlaybackStatus");
|
||||||
|
|
||||||
if (status_var.is_of_type(Glib::VariantType("s"))) {
|
if (status_var.is_of_type(Glib::VariantType("s"))) {
|
||||||
auto status = Glib::VariantBase::cast_dynamic<Glib::Variant<Glib::ustring>>(status_var).get();
|
auto status = Glib::VariantBase::cast_dynamic<Glib::Variant<Glib::ustring>>(status_var).get();
|
||||||
spdlog::info("Playback Status changed to: {}", status.raw());
|
spdlog::debug("Playback Status changed to: {}", status.raw());
|
||||||
|
|
||||||
auto parsedStatusIt = playbackStatusMap.find(static_cast<std::string>(status));
|
auto parsedStatusIt = playbackStatusMap.find(static_cast<std::string>(status));
|
||||||
|
|
||||||
if (parsedStatusIt != playbackStatusMap.end()) {
|
if (parsedStatusIt != playbackStatusMap.end()) {
|
||||||
@@ -367,7 +369,7 @@ void MprisController::on_properties_changed(const Gio::DBus::Proxy::MapChangedPr
|
|||||||
auto position_var = changed_properties.at("Position");
|
auto position_var = changed_properties.at("Position");
|
||||||
if (position_var.is_of_type(Glib::VariantType("x"))) {
|
if (position_var.is_of_type(Glib::VariantType("x"))) {
|
||||||
auto position = Glib::VariantBase::cast_dynamic<Glib::Variant<gint64>>(position_var).get();
|
auto position = Glib::VariantBase::cast_dynamic<Glib::Variant<gint64>>(position_var).get();
|
||||||
spdlog::info("Position changed to: {}", position);
|
spdlog::debug("Position changed to: {}", position);
|
||||||
playbackPositionChangedSignal.emit(static_cast<int64_t>(position));
|
playbackPositionChangedSignal.emit(static_cast<int64_t>(position));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,6 @@ WeatherWidget::WeatherWidget() : Gtk::Box(Gtk::Orientation::VERTICAL) {
|
|||||||
dailyScroll.set_valign(Gtk::Align::START);
|
dailyScroll.set_valign(Gtk::Align::START);
|
||||||
dailyScroll.set_halign(Gtk::Align::FILL);
|
dailyScroll.set_halign(Gtk::Align::FILL);
|
||||||
|
|
||||||
|
|
||||||
this->append(currentScroll);
|
this->append(currentScroll);
|
||||||
this->append(hourlyScroll);
|
this->append(hourlyScroll);
|
||||||
this->append(dailyScroll);
|
this->append(dailyScroll);
|
||||||
@@ -158,9 +157,9 @@ void WeatherWidget::fetchWeather() {
|
|||||||
|
|
||||||
auto hourly = json["hourly"];
|
auto hourly = json["hourly"];
|
||||||
auto current_time = std::time(nullptr);
|
auto current_time = std::time(nullptr);
|
||||||
auto nextHour = std::localtime(¤t_time)->tm_hour + 1;
|
auto currentHour = std::localtime(¤t_time)->tm_hour;
|
||||||
|
|
||||||
for (int i = nextHour; i < nextHour + 24; i ++) {
|
for (int i = currentHour; i < currentHour + 24; i++) {
|
||||||
HourlyWeather hw{};
|
HourlyWeather hw{};
|
||||||
hw.temperature_2m = hourly["temperature_2m"][i].get<double>();
|
hw.temperature_2m = hourly["temperature_2m"][i].get<double>();
|
||||||
hw.apparent_temperature = hourly["apparent_temperature"][i].get<double>();
|
hw.apparent_temperature = hourly["apparent_temperature"][i].get<double>();
|
||||||
@@ -169,7 +168,7 @@ void WeatherWidget::fetchWeather() {
|
|||||||
hw.precipitation = hourly["precipitation"][i].get<double>();
|
hw.precipitation = hourly["precipitation"][i].get<double>();
|
||||||
hw.time = hourly["time"][i].get<std::string>().substr(11, 5);
|
hw.time = hourly["time"][i].get<std::string>().substr(11, 5);
|
||||||
|
|
||||||
this->hourly_weather[i - nextHour] = hw;
|
this->hourly_weather[i - currentHour] = hw;
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (const std::exception &ex) {
|
} catch (const std::exception &ex) {
|
||||||
|
|||||||
Reference in New Issue
Block a user