mirror of
https://github.com/jpochyla/psst.git
synced 2026-04-27 07:25:52 +03:00
[PR #150] Detect light/dark OS theme #443
Labels
No labels
api
bug
build
documentation
duplicate
enhancement
good first issue
help wanted
idea
invalid
linux
lowprio
macos
pull-request
upstream
windows
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/psst#443
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/jpochyla/psst/pull/150
Author: @KeKsBoTer
Created: 8/26/2021
Status: 🔄 Open
Base:
main← Head:master📝 Commits (2)
b4df3adread system theme as default theme value on macos295370fremove unused import📊 Changes
3 files changed (+38 additions, -1 deletions)
View changed files
📝
Cargo.lock(+2 -0)📝
psst-gui/Cargo.toml(+5 -0)📝
psst-gui/src/data/config.rs(+31 -1)📄 Description
Hey,
I implemented basic light/dark theme detection for macOS.
I am new to the project and would appreciate your input.
Location in Code
At this point in time I am just reading the OS theme as the default value for the Theme Enum.
This seems a bit sketchy to me but I am not sure where else to put it.
Reactive Implementation
My approach only reads the OS theme once (at the application start) and does not react to theme changes during runtime.
This project could serve as a basic implementation for a reactive implementation.
Since a reactive implementation is much more complicated I would strive for a basic approach at this point in time.
Error Handling
I was unable to find a suitable error handling approach for my implementation.
Neither
panic::catch_unwindnor reading the OS value in a separate thread prevents the program from crashing when reading the OS theme fails ("rust cannot catch foreign exceptions").This is not optimal since an theme reading error should not result in the program crashing.
Do you have any idea how to fix this problem?
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.