-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
51e7501
commit aebd386
Showing
16 changed files
with
194 additions
and
102 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
|
@@ -38,4 +38,4 @@ SPEC CHECKSUMS: | |
|
||
PODFILE CHECKSUM: 16208599a12443d53889ba2270a4985981cfb204 | ||
|
||
COCOAPODS: 1.12.1 | ||
COCOAPODS: 1.11.3 |
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,70 @@ | ||
package system | ||
|
||
import ( | ||
"context" | ||
"github.com/samber/lo" | ||
"wox/plugin" | ||
"wox/share" | ||
) | ||
|
||
var themeIcon = plugin.NewWoxImageBase64(`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAAFnUlEQVR4nO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p2oiKc7ycWB/XDQnwAcngND5HdoTg7GHV3Vf/9G6BCm2Ikxl7x6lGeZkLYJ2VWl3PW7SIJRfEZ1CHyo03mHmcSBf3PrbwDPs+MuuFdwDrerafhlHwW/cXtjpTKcC1AzNOZT4VhNHWuU1iS+/HfngQZwRM7FraJMXLujxVT5NosBjqkSnLmVg0pSp03VFa98afFXEaA+64WjuZe5v2yUOsWi/OT0rYZtRTFxSiX6f9ZbI+DZb4vw5YFlmHBkHTQ0QQWphYtiXzfxsam+WKEMpwMLYia9UvGXDYiJ9YE4zJkjUM4esXXcJ++4NF+j/IKsoLZthbEbRdYcZUEhhGAa8PDkaoz4ZbEx4JNff0B+hYaL8FYdxVT5djifOYXhnvEQe6dCLJEb4Y/gb4vbesSlpFW/u7xJ+JGam6+CEIwBkXPhedzdKM+z4nwQJ7bjnBIjN12E2CsJYkm6mbxYQACLa0mr8N9ic5T5EAIfUHrWq5s8y4KYLVCpSyH2TITYp7u4uB8BLIIDFLl5EAIb8CzaGZMP/mgmPvrQSszbswc3b1egnCK9ioutFZCdkwtT1vsHwMM/0OwxFjbgzOmujftRuCvmHQzAaFcp7J2CjWKvPSBLkQNTPPwDsN4/0OwxlpqopcaNOz3KFxPXSmG/cC8cFoXCYVHYmwvIzFZACG6H1mDs4bWYvUMG+++lcHAO4cR53lhARmYWhDBHthWfOu+Bg3OwmfgbD8hS5OivZGTCEhcupWDk/EDjcrF2gGt/jlHV1etBmdkKvfxKBnoiISkdCz0iYO+0r1f5VxngWtKqD9I07RYcMDiDMziit2L+Af+A5zjc04biAAAAAElFTkSuQmCC`) | ||
|
||
func init() { | ||
plugin.AllSystemPlugin = append(plugin.AllSystemPlugin, &ThemePlugin{}) | ||
} | ||
|
||
type ThemePlugin struct { | ||
api plugin.API | ||
} | ||
|
||
func (c *ThemePlugin) GetMetadata() plugin.Metadata { | ||
return plugin.Metadata{ | ||
Id: "58a59382-8b3a-48c2-89ac-0a9a0e12e03f", | ||
Name: "Theme manager", | ||
Author: "Wox Launcher", | ||
Website: "https://github.com/Wox-launcher/Wox", | ||
Version: "1.0.0", | ||
MinWoxVersion: "2.0.0", | ||
Runtime: "Nodejs", | ||
Description: "Theme manager", | ||
Icon: themeIcon.String(), | ||
Entry: "", | ||
TriggerKeywords: []string{ | ||
"theme", | ||
}, | ||
Commands: []plugin.MetadataCommand{}, | ||
SupportedOS: []string{ | ||
"Windows", | ||
"Macos", | ||
"Linux", | ||
}, | ||
} | ||
} | ||
|
||
func (c *ThemePlugin) Init(ctx context.Context, initParams plugin.InitParams) { | ||
c.api = initParams.API | ||
} | ||
|
||
func (c *ThemePlugin) Query(ctx context.Context, query plugin.Query) []plugin.QueryResult { | ||
ui := plugin.GetPluginManager().GetUI() | ||
return lo.FilterMap(ui.GetAllThemes(ctx), func(theme share.Theme, _ int) (plugin.QueryResult, bool) { | ||
match, _ := IsStringMatchScore(ctx, theme.ThemeName, query.Search) | ||
if match { | ||
return plugin.QueryResult{ | ||
Title: theme.ThemeName, | ||
Icon: themeIcon, | ||
Actions: []plugin.QueryResultAction{ | ||
{ | ||
Name: "Change theme", | ||
PreventHideAfterAction: true, | ||
Action: func(actionContext plugin.ActionContext) { | ||
ui.ChangeTheme(ctx, theme) | ||
}, | ||
}, | ||
}, | ||
}, true | ||
} else { | ||
return plugin.QueryResult{}, false | ||
} | ||
}) | ||
} |
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
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
Oops, something went wrong.