Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

various fixes before new release #177

Merged
merged 5 commits into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,182 changes: 546 additions & 636 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ _The configuration files will be in [`~/.var/app/io.github.wiiznokes.fan-control
For Fedora-based systems, run: `sudo dnf install lm_sensors`
2. Run `sudo sensors-detect` to detect available sensors

## Troubleshooting

See [this file](./TROUBLESHOOTING.md).

## Repo structure

- [hardware](./hardware/README.md): define an abstraction around the hardware.
Expand All @@ -55,4 +59,4 @@ See instructions [here](./BUILD.md).

## Contributing

See [CONTRIBUTING.md](./CONTRIBUTING.md)
See [this file](./CONTRIBUTING.md).
9 changes: 9 additions & 0 deletions TROUBLESHOOTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Windows

The hardware part is provided by [LibreHardwareMonitor](https://github.com/LibreHardwareMonitor/LibreHardwareMonitor). If your hardware isn't detected, you likely need to check if there is an issue open for it in this repo.
The other [FanControl](https://github.com/Rem0o/FanControl.Releases) application also use this library, so you should have the same result with both.

# Linux

You can test the `sensors` program to see detected pwm sensors on your machine. If it is not present here, then it will also not show in the app. You can open an issue in [this repo](https://github.com/lm-sensors/lm-sensors) if this is the case.
In my experience, a lot of laptop fans will not be detected, and NVIDIA is not supported (we need root access for it so no compatible with flatpak).
2 changes: 1 addition & 1 deletion data/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ hardware.workspace = true
serde.workspace = true
serde_json.workspace = true
toml.workspace = true
directories = "5"
directories = "6"
light_enum = "0.2"
log.workspace = true
i18n-embed.workspace = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="LibreHardwareMonitorLib" Version="0.9.4-pre353" />
<PackageReference Include="Microsoft.Win32.SystemEvents" Version="8.0.0" />
<PackageReference Include="LibreHardwareMonitorLib" Version="0.9.5-pre380" />
<PackageReference Include="Microsoft.Win32.SystemEvents" Version="9.0.1" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion ui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ features = [
"multi-window",
"single-instance",
"markdown",
"desktop"
"about"
# todo: re enable when it works on Flatpak
# "dbus-config",
#"a11y",
Expand Down
5 changes: 5 additions & 0 deletions ui/src/settings_drawer.rs → ui/src/drawer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ use crate::{
message::{AppMsg, SettingsMsg, ToogleMsg},
};

pub enum Drawer {
Settings,
About,
}

pub fn settings_drawer(dir_manager: &DirManager) -> Element<'_, AppMsg> {
widget::settings::view_column(vec![widget::settings::section()
.add(
Expand Down
66 changes: 42 additions & 24 deletions ui/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,20 @@ use data::{
AppState,
};
use dialogs::Dialog;
use drawer::{about, Drawer};
use graph::GraphWindow;
use hardware::{HardwareBridge, Mode};
use item::items_view;
use message::{ConfigMsg, ModifNodeMsg, SettingsMsg, ToogleMsg};
use node_cache::{NodeC, NodesC};

use crate::{graph::graph_window_view, settings_drawer::settings_drawer};
use crate::{drawer::settings_drawer, graph::graph_window_view};

use cosmic::{
app::{Core, CosmicFlags, Task},
app::{
context_drawer::{context_drawer, ContextDrawer},
Core, CosmicFlags, Task,
},
executor,
iced::{self, time, window},
iced_core::Length,
Expand All @@ -42,6 +46,7 @@ pub mod localize;

mod add_node;
mod dialogs;
mod drawer;
mod graph;
mod headers;
mod icon;
Expand All @@ -51,7 +56,6 @@ mod message;
mod my_widgets;
mod node_cache;
mod pick_list_utils;
mod settings_drawer;

impl<H: HardwareBridge> CosmicFlags for Flags<H> {
type SubCommand = String;
Expand Down Expand Up @@ -86,7 +90,7 @@ struct Ui<H: HardwareBridge> {
graph_window: Option<GraphWindow>,
toasts: Toasts<AppMsg>,
dialog: Option<Dialog>,
about: bool,
drawer: Option<Drawer>,
}

impl<H: HardwareBridge + 'static> cosmic::Application for Ui<H> {
Expand Down Expand Up @@ -132,7 +136,7 @@ impl<H: HardwareBridge + 'static> cosmic::Application for Ui<H> {
graph_window: None,
toasts: Toasts::new(AppMsg::RemoveToast),
dialog,
about: false,
drawer: None,
};

let commands = Task::batch([cosmic::app::command::message(cosmic::app::message::app(
Expand Down Expand Up @@ -368,11 +372,22 @@ impl<H: HardwareBridge + 'static> cosmic::Application for Ui<H> {
}
AppMsg::Toggle(ui_msg) => match ui_msg {
ToogleMsg::CreateButton(expanded) => self.create_button_expanded = expanded,
ToogleMsg::Settings => {
self.core.window.show_context = !self.core.window.show_context;
self.about = false;
self.set_context_title(fl!("settings"));
}
ToogleMsg::Settings => match &self.drawer {
Some(drawer) => match drawer {
Drawer::Settings => {
self.drawer = None;
self.set_show_context(false);
}
Drawer::About => {
self.drawer = Some(Drawer::Settings);
self.set_show_context(true);
}
},
None => {
self.drawer = Some(Drawer::Settings);
self.set_show_context(true);
}
},
ToogleMsg::ChooseConfig(expanded) => {
self.choose_config_expanded = expanded;
}
Expand All @@ -381,9 +396,12 @@ impl<H: HardwareBridge + 'static> cosmic::Application for Ui<H> {
node_c.context_menu_expanded = expanded;
}
ToogleMsg::About => {
self.set_context_title(fl!("about"));
self.core.window.show_context = true;
self.about = true;
self.drawer = Some(Drawer::About);
self.set_show_context(true)
}
ToogleMsg::CloseDrawer => {
self.set_show_context(false);
self.drawer = None;
}
},
AppMsg::Config(config_msg) => match config_msg {
Expand Down Expand Up @@ -589,17 +607,17 @@ impl<H: HardwareBridge + 'static> cosmic::Application for Ui<H> {
headers::header_end()
}

fn context_drawer(&self) -> Option<Element<Self::Message>> {
if self.core.window.show_context {
let drawer = if self.about {
settings_drawer::about()
} else {
settings_drawer(&self.app_state.dir_manager)
};
Some(drawer)
} else {
None
}
fn context_drawer(&self) -> Option<ContextDrawer<Self::Message>> {
self.drawer.as_ref().map(|drawer| match drawer {
Drawer::Settings => context_drawer(
settings_drawer(&self.app_state.dir_manager),
AppMsg::Toggle(ToogleMsg::CloseDrawer),
)
.title(fl!("settings")),
Drawer::About => {
context_drawer(about(), AppMsg::Toggle(ToogleMsg::CloseDrawer)).title(fl!("about"))
}
})
}

fn subscription(&self) -> iced::Subscription<Self::Message> {
Expand Down
3 changes: 2 additions & 1 deletion ui/src/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,11 @@ pub enum SettingsMsg {
#[derive(Debug, Clone)]
pub enum ToogleMsg {
CreateButton(bool),
Settings,
ChooseConfig(bool),
NodeContextMenu(Id, bool),
Settings,
About,
CloseDrawer,
}

#[derive(Debug, Clone)]
Expand Down
6 changes: 3 additions & 3 deletions ui/src/my_widgets/drop_down/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ where
}
}

impl<'a, Message, Theme, Renderer> DropDown<'a, Message, Theme, Renderer>
impl<Message, Theme, Renderer> DropDown<'_, Message, Theme, Renderer>
where
Message: Clone,
Renderer: core::Renderer,
Expand Down Expand Up @@ -265,8 +265,8 @@ where
}
}

impl<'a, 'b, Message, Theme, Renderer> core::Overlay<Message, Theme, Renderer>
for DropDownOverlay<'a, 'b, Message, Theme, Renderer>
impl<Message, Theme, Renderer> core::Overlay<Message, Theme, Renderer>
for DropDownOverlay<'_, '_, Message, Theme, Renderer>
where
Message: Clone,
Renderer: core::Renderer,
Expand Down
Loading