The tree now compiles on macOS. Each Linux-only call gets a Darwin branch, and the Linux branch stays as it was: - io::fdatasync uses fcntl(F_FULLFSYNC): fsync alone only reaches the drive cache on APFS, and the store's crash atomicity relies on it. - Control socket: FD_CLOEXEC set after socket/accept/recvmsg (no SOCK_CLOEXEC, accept4 or MSG_CMSG_CLOEXEC), SO_NOSIGPIPE, peer credentials from LOCAL_PEERCRED + LOCAL_PEERPID, getgrouplist with int groups and a growing buffer. launchd has no RuntimeDirectory, so the socket directory is created (0750, access group) when missing. Default socket path is /var/run/strawberry/control.sock. - CRC32C detects ARMv8 CRC with hw.optional.armv8_crc32 (no auxv). - stat mtime via st_mtimespec; the BPF shared header uses stdint typedefs off Linux. - Background threads join the PRIO_DARWIN_BG band (lower CPU and I/O); crash safety zeroes RLIMIT_CORE in place of PR_SET_DUMPABLE. - The desktop app drops Qt DBus off Linux and shows notifications as tray messages (app/notifier_tray.cpp). - make setup passes Homebrew's keg-only libarchive to meson. Tests: behavior_live (Linux ptrace API) builds on Linux only, the control-server fd count reads /dev/fd, the crash test checks the core limit on macOS, and the runtime pipeline test no longer references a YARA-only helper when YARA is absent (that also broke Linux builds without libyara). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
48 lines
1.2 KiB
C++
48 lines
1.2 KiB
C++
#ifndef STRAWBERRY_APP_TRAY_HPP
|
|
#define STRAWBERRY_APP_TRAY_HPP
|
|
|
|
#include "tray_state.hpp"
|
|
|
|
#include <QIcon>
|
|
#include <QObject>
|
|
|
|
class QAction;
|
|
class QSystemTrayIcon;
|
|
|
|
namespace strawberry::app {
|
|
|
|
/// Tray indicator (StatusNotifierItem on sway/waybar) with a control menu.
|
|
class Tray : public QObject {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit Tray(QObject* parent = nullptr);
|
|
|
|
void show();
|
|
void apply(const TrayState& state);
|
|
void set_controls_enabled(bool enabled);
|
|
/// Reflect the autostart state in the menu (no signal emitted).
|
|
void set_autostart_checked(bool enabled);
|
|
|
|
static QIcon icon_for(TrayLevel level);
|
|
QSystemTrayIcon* system_icon() const { return icon_; }
|
|
|
|
signals:
|
|
void open_requested();
|
|
void command_requested(const QString& verb);
|
|
void mark_all_seen_requested();
|
|
void autostart_toggled(bool enable);
|
|
void quit_requested();
|
|
|
|
private:
|
|
QSystemTrayIcon* icon_ = nullptr;
|
|
QAction* reload_action_ = nullptr;
|
|
QAction* rescan_action_ = nullptr;
|
|
QAction* autostart_action_ = nullptr;
|
|
TrayLevel level_ = TrayLevel::unknown;
|
|
bool level_applied_ = false;
|
|
};
|
|
|
|
} // namespace strawberry::app
|
|
|
|
#endif // STRAWBERRY_APP_TRAY_HPP
|