mpris mostly works, still need to init the state though
This commit is contained in:
@@ -27,8 +27,8 @@ class Bar : public Gtk::Window {
|
||||
|
||||
Clock clock;
|
||||
Date date;
|
||||
WebWidget homeAssistant{"\ue88a", "Home Assistant", "https://home.rivercry.com"};
|
||||
ControlCenter controlCenter{"\ue88a", "Control Center"};
|
||||
WebWidget homeAssistant{"\uf024", "Home Assistant", "https://home.rivercry.com"};
|
||||
ControlCenter controlCenter{"\ue062", "Control Center"};
|
||||
|
||||
std::shared_ptr<TrayWidget> trayWidget = nullptr;
|
||||
std::shared_ptr<VolumeWidget> volumeWidget = nullptr;
|
||||
|
||||
@@ -16,6 +16,7 @@ struct MprisPlayer2Message {
|
||||
std::string title;
|
||||
std::vector<std::string> artist;
|
||||
std::string artwork_url;
|
||||
std::string track_id;
|
||||
int64_t length_ms;
|
||||
|
||||
std::function<void()> play_pause;
|
||||
|
||||
@@ -26,10 +26,13 @@ class MprisController {
|
||||
void next_song();
|
||||
void previous_song();
|
||||
void emit_seeked(int64_t position_us);
|
||||
void set_position(const std::string &track_id, int64_t position_us);
|
||||
|
||||
sigc::signal<void(const MprisPlayer2Message &)> &signal_mpris_updated();
|
||||
sigc::signal<void(PlaybackStatus)> &signal_playback_status_changed();
|
||||
sigc::signal<void(int64_t)> &signal_playback_position_changed();
|
||||
sigc::signal<void(const std::string &)> &signal_player_registered();
|
||||
sigc::signal<void(const std::string &)> &signal_player_deregistered();
|
||||
|
||||
private:
|
||||
MprisController();
|
||||
@@ -43,13 +46,22 @@ class MprisController {
|
||||
|
||||
Glib::RefPtr<Gio::DBus::Connection> m_connection;
|
||||
Glib::RefPtr<Gio::DBus::Proxy> m_proxy;
|
||||
Glib::RefPtr<Gio::DBus::Proxy> m_dbus_proxy;
|
||||
std::string m_player_bus_name = "org.mpris.MediaPlayer2.spotify";
|
||||
|
||||
sigc::signal<void(const MprisPlayer2Message &)> mprisUpdatedSignal;
|
||||
sigc::signal<void(PlaybackStatus)> playbackStatusChangedSignal;
|
||||
sigc::signal<void(int64_t)> playbackPositionChangedSignal;
|
||||
sigc::signal<void(const std::string &)> playerRegisteredSignal;
|
||||
sigc::signal<void(const std::string &)> playerDeregisteredSignal;
|
||||
|
||||
void on_bus_connected(const Glib::RefPtr<Gio::AsyncResult> &result);
|
||||
void signalNotification();
|
||||
void on_dbus_signal(const Glib::ustring &sender_name,
|
||||
const Glib::ustring &signal_name,
|
||||
const Glib::VariantContainerBase ¶meters);
|
||||
void handle_player_registered(const std::string &bus_name);
|
||||
void handle_player_deregistered(const std::string &bus_name);
|
||||
|
||||
// Called when the song changes
|
||||
void on_properties_changed(const Gio::DBus::Proxy::MapChangedProperties &changed_properties,
|
||||
|
||||
@@ -19,6 +19,8 @@ class MediaControlWidget : public Gtk::Box {
|
||||
int64_t currentPositionUs = 0;
|
||||
int64_t totalLengthUs = 0;
|
||||
sigc::connection seekTimerConnection;
|
||||
bool suppressSeekSignal = false;
|
||||
std::string currentTrackId;
|
||||
|
||||
void setCurrentPosition(int64_t position_us);
|
||||
void setTotalLength(int64_t length_us);
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "gdkmm/monitor.h"
|
||||
#include "gtkmm/window.h"
|
||||
|
||||
#define DEFAULT_NOTIFICATION_TIMEOUT 5000
|
||||
#define DEFAULT_NOTIFICATION_TIMEOUT 6700
|
||||
|
||||
|
||||
class BaseNotification : public Gtk::Window {
|
||||
|
||||
Reference in New Issue
Block a user