generated from SteamDeckHomebrew/Plugin-Template
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #91 from suchmememanyskill/dev
Release v1.8.0
- Loading branch information
Showing
37 changed files
with
961 additions
and
495 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
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,69 @@ | ||
import pystray, css_theme, css_utils, os, webbrowser, subprocess | ||
from PIL import Image, ImageDraw | ||
|
||
ICON = None | ||
MAIN = None | ||
LOOP = None | ||
DEV_MODE_STATE = False | ||
|
||
def reset(): | ||
LOOP.create_task(MAIN.reset(MAIN)) | ||
|
||
def open_theme_dir(): | ||
theme_dir = css_utils.get_theme_path() | ||
os.startfile(theme_dir) | ||
|
||
def exit(): | ||
LOOP.create_task(MAIN.exit(MAIN)) | ||
|
||
def get_dev_mode_state(x) -> bool: | ||
return DEV_MODE_STATE | ||
|
||
def toggle_dev_mode_state(): | ||
global DEV_MODE_STATE | ||
DEV_MODE_STATE = not DEV_MODE_STATE | ||
LOOP.create_task(MAIN.toggle_watch_state(MAIN, get_dev_mode_state(None))) | ||
|
||
def check_if_symlink_exists(): | ||
return os.path.exists(os.path.join(css_utils.get_steam_path(), "steamui", "themes_custom")) | ||
|
||
def open_install_docs(): | ||
webbrowser.open_new_tab("https://docs.deckthemes.com/CSSLoader/Install/#windows") | ||
|
||
def get_desktop_install_path() -> str|None: | ||
if os.path.exists("C:/Program Files/CSSLoader Desktop/CSSLoader Desktop.exe"): | ||
return "C:/Program Files/CSSLoader Desktop/CSSLoader Desktop.exe" | ||
|
||
return None | ||
|
||
def open_desktop(): | ||
path = get_desktop_install_path() | ||
if path != None: | ||
subprocess.Popen([path]) | ||
|
||
def start_icon(main, loop): | ||
global ICON, MAIN, LOOP, DEV_MODE_STATE | ||
MAIN = main | ||
LOOP = loop | ||
DEV_MODE_STATE = MAIN.observer != None | ||
symlink = check_if_symlink_exists() | ||
|
||
ICON = pystray.Icon( | ||
'CSS Loader', | ||
title='CSS Loader', | ||
icon=Image.open(os.path.join(os.path.dirname(__file__), "assets", "paint-roller-solid.png")), | ||
menu=pystray.Menu( | ||
pystray.MenuItem(f"CSS Loader v{css_theme.CSS_LOADER_VER}", action=None, enabled=False), | ||
pystray.MenuItem("Local Images/Fonts: Enabled" if symlink else "Local Images/Fonts: Disabled", action=None, enabled=None), | ||
pystray.MenuItem("Please enable Windows Developer Mode", action=open_install_docs, visible=not symlink), | ||
pystray.MenuItem("Open Desktop App", action=open_desktop, enabled=get_desktop_install_path() != None, default=True), | ||
pystray.MenuItem("Live CSS Editing", toggle_dev_mode_state, checked=get_dev_mode_state), | ||
pystray.MenuItem("Open Themes Folder", open_theme_dir), | ||
pystray.MenuItem("Reload Themes", reset), | ||
pystray.MenuItem("Exit", exit) | ||
)) | ||
ICON.run_detached() | ||
|
||
def stop_icon(): | ||
if ICON != None: | ||
ICON.stop() |
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
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
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.