Skip to content

Commit

Permalink
Merge pull request #10 from reagcz/develop
Browse files Browse the repository at this point in the history
New feature merge
  • Loading branch information
reagcz committed Apr 24, 2023
2 parents 7103402 + d4aa881 commit 199e3a1
Show file tree
Hide file tree
Showing 13 changed files with 81 additions and 14 deletions.
18 changes: 18 additions & 0 deletions IdeapadToolkit/IdeapadToolkit.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,29 @@

<ItemGroup>
<None Remove="Resources\admin.png" />
<None Remove="Resources\intelligent_conservation.ico" />
<None Remove="Resources\intelligent_normal.ico" />
<None Remove="Resources\intelligent_quick.ico" />
<None Remove="Resources\performance_conservation.ico" />
<None Remove="Resources\performance_normal.ico" />
<None Remove="Resources\performance_quick.ico" />
<None Remove="Resources\saving_conservation.ico" />
<None Remove="Resources\saving_normal.ico" />
<None Remove="Resources\saving_quick.ico" />
</ItemGroup>

<ItemGroup>
<Resource Include="Resources\admin.png" />
<Resource Include="Resources\icon.ico" />
<Resource Include="Resources\intelligent_conservation.ico" />
<Resource Include="Resources\intelligent_normal.ico" />
<Resource Include="Resources\intelligent_quick.ico" />
<Resource Include="Resources\performance_conservation.ico" />
<Resource Include="Resources\performance_normal.ico" />
<Resource Include="Resources\performance_quick.ico" />
<Resource Include="Resources\saving_conservation.ico" />
<Resource Include="Resources\saving_normal.ico" />
<Resource Include="Resources\saving_quick.ico" />
</ItemGroup>

<ItemGroup>
Expand Down
Binary file not shown.
Binary file added IdeapadToolkit/Resources/intelligent_normal.ico
Binary file not shown.
Binary file added IdeapadToolkit/Resources/intelligent_quick.ico
Binary file not shown.
Binary file not shown.
Binary file added IdeapadToolkit/Resources/performance_normal.ico
Binary file not shown.
Binary file added IdeapadToolkit/Resources/performance_quick.ico
Binary file not shown.
Binary file added IdeapadToolkit/Resources/saving_conservation.ico
Binary file not shown.
Binary file added IdeapadToolkit/Resources/saving_normal.ico
Binary file not shown.
Binary file added IdeapadToolkit/Resources/saving_quick.ico
Binary file not shown.
29 changes: 25 additions & 4 deletions IdeapadToolkit/ViewModels/LenovoSettingsViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using IdeapadToolkit.Models;
using IdeapadToolkit.Services;
Expand Down Expand Up @@ -29,10 +29,10 @@ public LenovoSettingsViewModel(ILenovoPowerSettingsService lenovoPowerSettingsSe
private readonly ILogger _logger;

[ObservableProperty]
[NotifyPropertyChangedFor(nameof(IsEfficientChecked), nameof(IsIntelligentCoolingChecked), nameof(IsExtremePerformanceChecked))]
[NotifyPropertyChangedFor(nameof(IsEfficientChecked), nameof(IsIntelligentCoolingChecked), nameof(IsExtremePerformanceChecked), nameof(IconSource))]
private PowerPlan _plan;
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(IsConservationModeEnabled), nameof(IsNormalModeEnabled), nameof(IsRapidModeEnabled))]
[NotifyPropertyChangedFor(nameof(IsConservationModeEnabled), nameof(IsNormalModeEnabled), nameof(IsRapidModeEnabled), nameof(IconSource))]
private ChargingMode _mode;
public void Refresh()
{
Expand Down Expand Up @@ -86,7 +86,7 @@ public bool IsFlipToBootEnabled
bool res = false;
try
{
_uEFISettingsService.GetFlipToBootStatus();
res = _uEFISettingsService.GetFlipToBootStatus();
}
catch (Exception ex)
{
Expand Down Expand Up @@ -203,6 +203,27 @@ public bool IsRapidModeEnabled
}

#endregion

public Uri IconSource
{
get
{
string path = (_plan, _mode) switch
{
(PowerPlan.IntelligentCooling, ChargingMode.Normal) => "/Resources/intelligent_normal.ico",
(PowerPlan.IntelligentCooling, ChargingMode.Conservation) => "/Resources/intelligent_conservation.ico",
(PowerPlan.IntelligentCooling, ChargingMode.Rapid) => "/Resources/intelligent_quick.ico",
(PowerPlan.EfficiencyMode, ChargingMode.Normal) => "/Resources/saving_normal.ico",
(PowerPlan.EfficiencyMode, ChargingMode.Conservation) => "/Resources/saving_conservation.ico",
(PowerPlan.EfficiencyMode, ChargingMode.Rapid) => "/Resources/saving_quick.ico",
(PowerPlan.ExtremePerformance, ChargingMode.Normal) => "/Resources/performance_normal.ico",
(PowerPlan.ExtremePerformance, ChargingMode.Conservation) => "/Resources/performance_conservation.ico",
(PowerPlan.ExtremePerformance, ChargingMode.Rapid) => "/Resources/performance_quick.ico",
_ => "/Resources/intelligent_normal.ico"
};
return new Uri(path, UriKind.Relative);
}
}
public bool IsAdministrator => _administratorPermissionService.IsAdministrator;

[RelayCommand]
Expand Down
30 changes: 29 additions & 1 deletion IdeapadToolkit/Views/TrayIconView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,40 @@
<Grid>
<tb:TaskbarIcon
x:Name="TrayIcon"
IconSource="\Resources\icon.ico"
IconSource="{Binding IconSource}"
ToolTipText="Ideapad Toolkit"
TrayMouseDoubleClick="TrayIcon_TrayMouseDoubleClick"
Visibility="Collapsed">
<FrameworkElement.ContextMenu>
<ContextMenu Loaded="ContextMenu_Loaded">
<ui:RadioMenuItem
Command="{Binding SetChargingModeCommand}"
GroupName="ChargingMode"
Header="Conservation"
IsChecked="{Binding IsConservationModeEnabled}">
<ui:RadioMenuItem.CommandParameter>
<system:Int32>1</system:Int32>
</ui:RadioMenuItem.CommandParameter>
</ui:RadioMenuItem>
<ui:RadioMenuItem
Command="{Binding SetChargingModeCommand}"
GroupName="ChargingMode"
Header="Normal"
IsChecked="{Binding IsNormalModeEnabled}">
<ui:RadioMenuItem.CommandParameter>
<system:Int32>0</system:Int32>
</ui:RadioMenuItem.CommandParameter>
</ui:RadioMenuItem>
<ui:RadioMenuItem
Command="{Binding SetChargingModeCommand}"
GroupName="ChargingMode"
Header="Rapid"
IsChecked="{Binding IsRapidModeEnabled}">
<ui:RadioMenuItem.CommandParameter>
<system:Int32>2</system:Int32>
</ui:RadioMenuItem.CommandParameter>
</ui:RadioMenuItem>
<Separator />
<ui:RadioMenuItem
Command="{Binding SetPlanCommand}"
GroupName="PowerPlan"
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# Ideapad Toolkit

**Ideapad Toolkit is a utility that allows you adjust the power setting from Lenovo Vantage, without having to use the slow official app**
**Ideapad Toolkit is a utility that allows you to adjust your Ideapad's power settings without installing Lenovo Vantage**

![image](https://user-images.githubusercontent.com/62750643/193948650-76596fe5-fab3-44aa-b656-fe15a2d93f46.png)
![Screenshot 2023-04-24 174110](https://user-images.githubusercontent.com/62750643/234048210-32a98b8a-7e24-4ba3-8990-a25ecdd8a2f9.png)

**Power and charging profiles can be quickly adjusted from the tray icon**

**Power profiles can be quickly adjusted from the tray icon**

![image](https://user-images.githubusercontent.com/62750643/193938407-4f96a444-4c29-44be-90e0-f6c4e182dbce.png)
![Screenshot 2023-04-24 174631](https://user-images.githubusercontent.com/62750643/234049214-1324dc57-b3fd-4f8f-9fb0-8a419e2e9d32.png)

**After running, the app windows can be accessed by double clicking the tray icon**
## Supported laptops
- Lenovo Flex 5 14ALC05 (Windows 11)
## Tested laptops
- Ideapad Flex 5 14ALC05 (Windows 11)
- Ideapad 5 Pro 16ACH6 - 82L5 (Windows 10 22H2)

If your model is similar enough, chances are it will work.
If you find your model is compatible and not on the list, please sumbit an issue

To test, try changing the settings and verify the changes in Lenovo Vantage
To test, try changing the settings and verify if the settings change accordingly in Lenovo Vantage or the UEFI

## Prerequisites
- [.NET 6 Runtime](https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/runtime-6.0.9-windows-x64-installer)
Expand Down

0 comments on commit 199e3a1

Please sign in to comment.