media widget fix

This commit is contained in:
2026-02-03 22:12:45 +01:00
parent a048d7ae7a
commit cddcc96aa9
12 changed files with 369 additions and 48 deletions

View File

@@ -21,11 +21,13 @@ class MediaControlWidget : public Gtk::Box {
sigc::connection seekTimerConnection;
bool suppressSeekSignal = false;
std::string currentTrackId;
MprisController::PlaybackStatus playbackStatus = MprisController::PlaybackStatus::Stopped;
void setCurrentPosition(int64_t position_us);
void setTotalLength(int64_t length_us);
void resetSeekTimer(int64_t start_position_us);
bool onSeekTick();
void schedulePauseAfterSeek();
Gtk::Box spotifyContainer;

View File

@@ -1,20 +1,19 @@
#pragma once
#include <chrono>
#include <csignal>
#include <cstdint>
#include <chrono>
#include <sigc++/connection.h>
#include "gdkmm/monitor.h"
#include "gtkmm/scrolledwindow.h"
#include "gtkmm/window.h"
#define DEFAULT_NOTIFICATION_TIMEOUT 6700
class BaseNotification : public Gtk::Window {
public:
BaseNotification( uint64_t notificationId, std::shared_ptr<Gdk::Monitor> monitor);
BaseNotification(uint64_t notificationId, std::shared_ptr<Gdk::Monitor> monitor);
void pauseAutoClose();
void resumeAutoClose();
@@ -28,6 +27,7 @@ class BaseNotification : public Gtk::Window {
uint64_t getNotificationId() const {
return this->notificationId;
}
private:
void ensure_notification_css_loaded();
@@ -38,7 +38,7 @@ class BaseNotification : public Gtk::Window {
protected:
uint64_t notificationId;
bool autoClosePaused = false;
bool autoClosePaused = false;
int autoCloseRemainingMs = 0;
std::chrono::steady_clock::time_point autoCloseDeadline;
sigc::connection autoCloseConnection;

View File

@@ -0,0 +1,34 @@
#pragma once
#include <spdlog/spdlog.h>
#include "services/dbus/messages.hpp"
#include "widgets/notification/baseNotification.hpp"
#include "gtkmm/box.h"
class CopyNotification : public BaseNotification {
enum class CopyType {
TEXT,
IMAGE
};
public:
CopyNotification(uint64_t id,
std::shared_ptr<Gdk::Monitor> monitor,
NotifyMessage notify);
virtual ~CopyNotification() = default;
protected:
private:
CopyType type;
std::string copiedText;
Glib::RefPtr<Gdk::Pixbuf> copiedImage;
Gtk::Box mainBox;
std::string title;
void createImageNotification(NotifyMessage notify);
void createTextNotification(NotifyMessage notify);
void setupTitle(std::string title);
};