|
| 1 | +# Linux Support Status |
| 2 | + |
| 3 | +This document outlines the current status of Linux support in the Hyprnote application, highlighting areas that are missing or incomplete. |
| 4 | + |
| 5 | +## 1. Speaker Audio Capture |
| 6 | + |
| 7 | +**This is the most critical missing feature for full Linux support.** |
| 8 | + |
| 9 | +The current implementation for speaker audio capture on Linux is a mock that only generates silence. The file `crates/audio/src/speaker/linux.rs` needs to be implemented to capture system audio using a native Linux audio backend. |
| 10 | + |
| 11 | +**Recommended solutions:** |
| 12 | + |
| 13 | +* **PipeWire:** The modern and preferred audio server on Linux. |
| 14 | +* **PulseAudio:** A widely used and still relevant audio server. |
| 15 | +* **ALSA:** The underlying audio API, which can be used for broader compatibility. |
| 16 | + |
| 17 | +## 2. Notifications |
| 18 | + |
| 19 | +The `hypr_notification2` crate, which is responsible for handling desktop notifications, has incomplete support for Linux. |
| 20 | + |
| 21 | +* **Basic Notifications:** Basic notifications may work if the underlying `wezterm` crate has Linux support. |
| 22 | +* **Missing Features:** |
| 23 | + * **Permission Handling:** The ability to request notification permissions from the user is not implemented for Linux. |
| 24 | + * **Settings Integration:** The functionality to open the system's notification settings is not implemented for Linux. |
| 25 | + |
| 26 | +## 3. Desktop Integration |
| 27 | + |
| 28 | +### 3.1. Application Menu |
| 29 | + |
| 30 | +The main application menu is customized for macOS to provide a more native look and feel. This includes adding "About Hyprnote" and "New Note" items to the application menu. This level of integration is missing for Linux. |
| 31 | + |
| 32 | +### 3.2. Window Decorations |
| 33 | + |
| 34 | +The `plugins/windows` crate contains platform-specific code for window decorations on macOS and Windows. |
| 35 | + |
| 36 | +* **macOS:** Uses a title bar with an overlay style and a hidden title. |
| 37 | +* **Windows:** Uses borderless windows. |
| 38 | +* **Linux:** Lacks specific window decoration configurations, which may result in an inconsistent and less polished user experience. The application will use the default window decorations provided by the user's window manager. |
| 39 | + |
| 40 | +## 4. Build and Packaging |
| 41 | + |
| 42 | +While not explicitly investigated, it's important to ensure that the application can be easily built and packaged for various Linux distributions. This includes: |
| 43 | + |
| 44 | +* **Dependencies:** Ensuring that all required dependencies are available on common Linux distributions. |
| 45 | +* **Packaging Formats:** Providing packages in common formats like `.deb` (for Debian/Ubuntu), `.rpm` (for Fedora/CentOS), and `AppImage` (for distribution-agnostic use). |
| 46 | + |
| 47 | +## 5. macOS-Specific Features and Implementations |
| 48 | + |
| 49 | +Several features and implementations in the Hyprnote application are specific to macOS. These features will not work on Linux, and in some cases, the application may not behave as expected. |
| 50 | + |
| 51 | +### 5.1. Apple Calendar Integration |
| 52 | + |
| 53 | +The `tauri-plugin-apple-calendar` is **macOS-specific** and cannot be used on Linux. This is because it relies on macOS-specific technologies to interact with the Calendar and Contacts applications. |
| 54 | + |
| 55 | +The reasons for this include: |
| 56 | + |
| 57 | +* **`osascript`:** The plugin uses `osascript` to execute AppleScript for interacting with the Calendar application. |
| 58 | +* **`open x-apple.systempreferences`:** The plugin uses macOS-specific URL schemes to open the System Preferences to the correct privacy settings. |
| 59 | +* **`hypr_calendar_apple` crate:** The plugin uses the `hypr_calendar_apple` crate, which is a wrapper around Apple's native frameworks for accessing calendar and contact data. |
| 60 | +* **`tccutil`:** The plugin uses the `tccutil` command-line tool to manage calendar and contacts permissions, which is specific to macOS. |
| 61 | + |
| 62 | +### 5.2. AI/ML Acceleration |
| 63 | + |
| 64 | +The application uses Apple's **Metal** and **Core ML** frameworks for hardware-accelerated AI/ML tasks on macOS. This is enabled through the `llm-metal`, `stt-metal`, and `stt-coreml` features. While the application may fall back to CPU-based processing on Linux, it will not have the same level of performance as on Apple hardware. |
| 65 | + |
| 66 | +### 5.3. Autostart |
| 67 | + |
| 68 | +The autostart feature is implemented using `launchd` on macOS. For the application to autostart on Linux, a different implementation is required, such as creating a `.desktop` file in the `~/.config/autostart/` directory. |
| 69 | + |
| 70 | +### 5.4. Microphone and System Audio Permissions |
| 71 | + |
| 72 | +The permission handling for microphone and system audio access is heavily reliant on macOS-specific APIs and command-line tools. |
| 73 | + |
| 74 | +* **`check_microphone_access`:** On Linux, this function is a workaround that tries to open the microphone to see if it's available, which is not a reliable permission check. |
| 75 | +* **`request_microphone_access`:** On Linux, this function also tries to open the microphone, which may or may not trigger a system-level permission prompt. |
| 76 | +* **`open_microphone_access_settings` and `open_system_audio_access_settings`:** These functions will not work on Linux as they use macOS-specific URLs. |
| 77 | +* **`check_system_audio_access`:** This function relies on the `hypr_tcc` crate, which is entirely macOS-specific and always returns `true` on Linux. |
| 78 | + |
| 79 | +### 5.5. TCC (Transparency, Consent, and Control) |
| 80 | + |
| 81 | +The `hypr_tcc` crate, which is used for managing permissions, is entirely macOS-specific and has no functionality on Linux. |
| 82 | + |
| 83 | +### 5.6. Email Integration |
| 84 | + |
| 85 | +The application uses the native macOS email client to send emails. This is implemented in the `crates/email` crate, which uses the `NSSharingService` class. This functionality will be missing on Linux. To provide a similar feature on Linux, a different approach would be needed, such as opening a `mailto:` URL or using a library that can communicate with common Linux email clients. |
| 86 | + |
| 87 | +### 5.7. Application and Browser Detection |
| 88 | + |
| 89 | +The application uses macOS-specific APIs to detect running applications and the frontmost browser window. This is used for features like automatically detecting meetings. |
| 90 | + |
| 91 | +* **`crates/detect/src/app/macos.rs`:** Uses `ns::RunningApp` and `ns::Workspace` to detect running applications. |
| 92 | +* **`crates/detect/src/browser/macos.rs`:** Uses `objc2_foundation::NSURL` and `objc2_app_kit::NSWorkspace` to get the URL of the frontmost browser window. |
| 93 | + |
| 94 | +A Linux-specific implementation would be needed to provide similar functionality. This could involve using the `/proc` filesystem or a library like `libprocps`. |
| 95 | + |
| 96 | +## 6. Conclusion |
| 97 | + |
| 98 | +To achieve full Linux support, the following tasks need to be prioritized: |
| 99 | + |
| 100 | +1. **Implement speaker audio capture** in `crates/audio/src/speaker/linux.rs`. |
| 101 | +2. **Add full notification support** for Linux in the `hypr_notification2` crate, including permission handling and settings integration. |
| 102 | +3. **Improve desktop integration** by customizing the application menu and window decorations for a more native Linux experience. |
| 103 | +4. **Ensure robust build and packaging** for various Linux distributions. |
0 commit comments