[Linux] Use segment control for setting noise control mode (#92)

* [Linux] Enhance GUI with icons

* Improve visibility

* Smarter hiding of battery values

* Add simple opacity based ear detection indication

* Hide disconnected devices

* Add airpods 3 icon

* Support more devices

* Better icons

* Add documentation

* Add segmented control

* Support keyboard navigation

* Fix ear detection when primary pod changes

* Support up to 9 modes with the keyboard

* Redisign

* Use id

* Use correct images

* Remove duplicates

* Use correct image

* Remove more merge conflicts

* Remove unused code

* Remove unused code

* Make all text readbale
This commit is contained in:
Tim Gromeyer
2025-04-04 09:40:32 +02:00
committed by GitHub
parent fb3f948250
commit e0624ce084
5 changed files with 137 additions and 17 deletions

View File

@@ -25,8 +25,8 @@ class AirPodsTrayApp : public QObject {
Q_PROPERTY(bool oneOrMorePodsInCase READ oneOrMorePodsInCase NOTIFY earDetectionStatusChanged)
Q_PROPERTY(QString podIcon READ podIcon NOTIFY modelChanged)
Q_PROPERTY(QString caseIcon READ caseIcon NOTIFY modelChanged)
Q_PROPERTY(bool isLeftPodInEar READ isLeftPodInEar NOTIFY earDetectionStatusChanged)
Q_PROPERTY(bool isRightPodInEar READ isRightPodInEar NOTIFY earDetectionStatusChanged)
Q_PROPERTY(bool leftPodInEar READ isLeftPodInEar NOTIFY primaryChanged)
Q_PROPERTY(bool rightPodInEar READ isRightPodInEar NOTIFY primaryChanged)
public:
AirPodsTrayApp(bool debugMode)
@@ -55,6 +55,8 @@ public:
mediaController->initializeMprisInterface();
mediaController->followMediaChanges();
connect(m_battery, &Battery::primaryChanged, this, &AirPodsTrayApp::primaryChanged);
// load conversational awareness state
setConversationalAwareness(loadConversationalAwarenessState());
@@ -476,6 +478,9 @@ private slots:
m_model = parseModelNumber(modelNumber);
emit modelChanged();
m_model = parseModelNumber(modelNumber);
emit modelChanged();
emit deviceNameChanged(m_deviceName);
@@ -598,10 +603,13 @@ private slots:
char secondary = data[7];
m_primaryInEar = primary == 0x00;
m_secoundaryInEar = secondary == 0x00;
m_primaryInEar = primary == 0x00;
m_secoundaryInEar = secondary == 0x00;
m_earDetectionStatus = QString("Primary: %1, Secondary: %2")
.arg(getEarStatus(primary), getEarStatus(secondary));
LOG_INFO("Ear detection status: " << m_earDetectionStatus);
emit earDetectionStatusChanged(m_earDetectionStatus);
emit primaryChanged();
}
// Battery Status
else if (data.size() == 22 && data.startsWith(AirPodsPackets::Parse::BATTERY_STATUS))
@@ -854,6 +862,7 @@ signals:
void adaptiveNoiseLevelChanged(int level);
void deviceNameChanged(const QString &name);
void modelChanged();
void primaryChanged();
private:
QSystemTrayIcon *trayIcon;