From 57fb2a78647715994fc0cd279aea582ba6f8c204 Mon Sep 17 00:00:00 2001 From: Yuma Miyazaki Date: Wed, 25 Oct 2023 15:28:34 +0900 Subject: [PATCH 1/2] feat: Add comparison traits to MicDevice and Volume structs --- src/mic_device.rs | 2 +- src/volume.rs | 8 +------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/mic_device.rs b/src/mic_device.rs index 80b7ecc..8dad641 100644 --- a/src/mic_device.rs +++ b/src/mic_device.rs @@ -9,7 +9,7 @@ use std::ptr::null; use crate::volume::Volume; -#[derive(Debug)] +#[derive(Debug, PartialEq, Eq)] pub struct MicDevice { device_id: u32, } diff --git a/src/volume.rs b/src/volume.rs index 7f18824..c589ec7 100644 --- a/src/volume.rs +++ b/src/volume.rs @@ -1,4 +1,4 @@ -#[derive(Debug)] +#[derive(Debug, PartialEq, PartialOrd)] pub struct Volume(f32); impl Volume { @@ -20,12 +20,6 @@ impl Volume { } } -impl PartialEq for Volume { - fn eq(&self, other: &Self) -> bool { - self.0 == other.0 - } -} - #[cfg(test)] mod tests { use super::*; From d3e3cd0c0a42b89f6f5bf6a3c1ca682bab3ab48b Mon Sep 17 00:00:00 2001 From: Yuma Miyazaki Date: Wed, 25 Oct 2023 16:26:53 +0900 Subject: [PATCH 2/2] docs: update installation instructions --- README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index cef24d6..a63828d 100644 --- a/README.md +++ b/README.md @@ -12,8 +12,10 @@ A simple CLI tool to set the microphone volume to the maximum in MacOS. ```bash sudo mv max-mic-volume /usr/local/bin/ +sudo chmod 755 /usr/local/bin/max-mic-volume -sudo curl -o /Library/LaunchDaemons/com.github.amiyzku.max-mic-volume.plist https://raw.githubusercontent.com/amiyzku/max-mic-volume/master/com.github.amiyzku.max-mic-volume.plist -sudo chown root:wheel /Library/LaunchDaemons/com.github.amiyzku.max-mic-volume.plist -sudo chmod 644 /Library/LaunchDaemons/com.github.amiyzku.max-mic-volume.plist +sudo curl -o /Library/LaunchAgents/com.github.amiyzku.max-mic-volume.plist https://raw.githubusercontent.com/amiyzku/max-mic-volume/master/com.github.amiyzku.max-mic-volume.plist +sudo chmod 644 /Library/LaunchAgents/com.github.amiyzku.max-mic-volume.plist + +launchctl load /Library/LaunchAgents/com.github.amiyzku.max-mic-volume.plist ```