-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a501d21
commit 6d62d65
Showing
18 changed files
with
94 additions
and
110 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,28 @@ | ||
[workspace] | ||
resolver = "2" | ||
members = ["crates/*"] | ||
[package] | ||
name = "dark-mode-daemon" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[dependencies] | ||
xdg = "2.5.2" | ||
clap = { version = "4.5.16", features = ["derive"] } | ||
|
||
[target.'cfg(target_os = "macos")'.dependencies] | ||
block2 = "0.5.1" | ||
objc2 = { version = "0.5.2" } | ||
objc2-app-kit = { version = "0.2.2", features = [ | ||
"NSApplication", | ||
"NSResponder", | ||
] } | ||
objc2-foundation = { version = "0.2.2", features = [ | ||
"NSNotification", | ||
"NSDistributedNotificationCenter", | ||
"NSOperation", | ||
"NSString", | ||
"NSThread", | ||
"NSUserDefaults", | ||
"block2", | ||
] } | ||
|
||
[target.'cfg(target_os = "linux")'.dependencies] | ||
gio = "0.20.1" |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
use std::fmt::Display; | ||
|
||
pub mod cli; | ||
pub mod discovery; | ||
pub mod execution; | ||
pub mod platform; | ||
pub mod platform_specifics; | ||
|
||
use clap::ValueEnum; | ||
|
||
#[cfg(target_os = "macos")] | ||
use crate::platform::macos::MacOSNativeAdapter; | ||
|
||
#[cfg(target_os = "linux")] | ||
use gsettings::{ | ||
freedesktop::FreeDesktopSettingsProvider, gnome::GnomeDesktopSettingsProvider, | ||
GSettingsAdapter, SettingsProviderImplementation, | ||
}; | ||
|
||
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, ValueEnum)] | ||
pub enum ColorMode { | ||
Light, | ||
Dark, | ||
} | ||
|
||
impl Display for ColorMode { | ||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
match self { | ||
ColorMode::Light => write!(f, "light"), | ||
ColorMode::Dark => write!(f, "dark"), | ||
} | ||
} | ||
} | ||
|
||
#[cfg(target_os = "macos")] | ||
fn main() { | ||
crate::cli::run(MacOSNativeAdapter::default()); | ||
} | ||
|
||
#[cfg(target_os = "linux")] | ||
fn main() { | ||
let implementation = SettingsProviderImplementation::Gnome; | ||
|
||
match implementation { | ||
SettingsProviderImplementation::Gnome => { | ||
dark_mode_daemon::cli::run(GSettingsAdapter::<GnomeDesktopSettingsProvider>::new()); | ||
} | ||
SettingsProviderImplementation::Freedesktop => { | ||
dark_mode_daemon::cli::run(GSettingsAdapter::<FreeDesktopSettingsProvider>::new()); | ||
} | ||
}; | ||
} |
2 changes: 1 addition & 1 deletion
2
...daemon-linux/src/gsettings/freedesktop.rs → src/platform/linux/gsettings/freedesktop.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...-mode-daemon-linux/src/gsettings/gnome.rs → src/platform/linux/gsettings/gnome.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pub mod gsettings; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#[cfg(target_os = "macos")] | ||
pub mod macos; | ||
|
||
#[cfg(target_os = "linux")] | ||
pub mod linux; |
File renamed without changes.