-
-
Notifications
You must be signed in to change notification settings - Fork 397
New API Function from Theme & Improve Theme Model #3420
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
Merged
Merged
Changes from 17 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
358b1fd
Move theme data and functions into api
Jack251970 9b9704e
Improve settings panel theme page & theme selector
Jack251970 1611ad3
Fix ThemeData hashcode issue
Jack251970 514fa00
Improve documents
Jack251970 28d92c7
Improve documents
Jack251970 2e885ea
Remove useless variable
Jack251970 0c0461d
Merge branch 'dev' into theme_change_api
Jack251970 ecd019d
Move ThemeData class to SharedModels
Jack251970 91b6427
Merge branch 'dev' into theme_change_api
Jack251970 6c45882
Fix possible NullReferenceException
Jack251970 9052f7b
Merge branch 'theme_change_api' of https://github.com/Jack251970/Flow…
Jack251970 537c03f
Fix null check issue
Jack251970 b3aa897
Use == for != operator
Jack251970 a2d9957
Log warning if cannot find matched theme
Jack251970 bac14fa
Merge branch 'dev' into theme_change_api
Jack251970 dd210ad
Remove RefreshFrameAsync since ChangeTheme calls this function
Jack251970 a3c7be9
Handle results from SetCurrentTheme
Jack251970 a4c8343
Merge branch 'dev' into theme_change_api
Jack251970 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,77 @@ | ||
using System; | ||
|
||
namespace Flow.Launcher.Plugin.SharedModels; | ||
|
||
/// <summary> | ||
/// Theme data model | ||
/// </summary> | ||
public class ThemeData | ||
{ | ||
/// <summary> | ||
/// Theme file name without extension | ||
/// </summary> | ||
public string FileNameWithoutExtension { get; private init; } | ||
|
||
/// <summary> | ||
/// Theme name | ||
/// </summary> | ||
public string Name { get; private init; } | ||
|
||
/// <summary> | ||
/// Indicates whether the theme supports dark mode | ||
/// </summary> | ||
public bool? IsDark { get; private init; } | ||
|
||
/// <summary> | ||
/// Indicates whether the theme supports blur effects | ||
/// </summary> | ||
public bool? HasBlur { get; private init; } | ||
|
||
/// <summary> | ||
/// Theme data constructor | ||
/// </summary> | ||
public ThemeData(string fileNameWithoutExtension, string name, bool? isDark = null, bool? hasBlur = null) | ||
{ | ||
FileNameWithoutExtension = fileNameWithoutExtension; | ||
Name = name; | ||
IsDark = isDark; | ||
HasBlur = hasBlur; | ||
} | ||
|
||
/// <inheritdoc /> | ||
public static bool operator ==(ThemeData left, ThemeData right) | ||
{ | ||
if (left is null && right is null) | ||
return true; | ||
if (left is null || right is null) | ||
return false; | ||
return left.Equals(right); | ||
} | ||
|
||
/// <inheritdoc /> | ||
public static bool operator !=(ThemeData left, ThemeData right) | ||
{ | ||
return !(left == right); | ||
} | ||
|
||
/// <inheritdoc /> | ||
public override bool Equals(object obj) | ||
{ | ||
if (obj is not ThemeData other) | ||
return false; | ||
return FileNameWithoutExtension == other.FileNameWithoutExtension && | ||
Name == other.Name; | ||
} | ||
|
||
/// <inheritdoc /> | ||
public override int GetHashCode() | ||
{ | ||
return HashCode.Combine(FileNameWithoutExtension, Name); | ||
} | ||
|
||
/// <inheritdoc /> | ||
public override string ToString() | ||
{ | ||
return Name; | ||
} | ||
} |
This file contains hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.