Open Chaphasilor opened 2 years ago
For the v1.0.0 rewrite, maybe it would be possible to support loading themes as CSS files. That would allow themes to define light and dark color schemes and switch between them automatically. It would also allow overwriting only part of the default theme. However, the downside would be that this is a less configurable approach. It wouldn't be possible to mix&match different dark and light themes.
Using styled-components, I slacked on tagging all the DOM elements with ids and classnames, but with the rewrite I'll most likely do this to allow for alternative methods of theming. I'm thinking of using css variables for the theme's color scheme, and then allowing a s(css) file to be attached to the theme as well.
As an alternative, there could be two theme selectors, and a color-scheme selector. The two theme selectors would allow you to pick one theme as a dark theme (e.g. Default Dark) and one as a light theme (e.g. Default Light), and the color-scheme selector would allow you to choose between Light Theme, Dark Theme and System/Auto Theme, where the latter would switch between the two themes depending on the OS setting.
This is a good idea. We definitely want it configurable since there's more than just the default light/dark themes.
This feature would probably require two new dropdowns in the Look&Feel panel and ~10 additional LoC (for the alternative approach), so I believe it wouldn't be too much effort to slip it into the planned features for v1.0.0.
If you want me to, and still accept PRs for v0.x.x, I'd be happy do try and make a PR for this :)
PRs are still appreciated for v0.x.x! Most of my time is spent working on the rewrite, so new features from me for the current version are on hold.
Okay, so I've been trying to get a development setup going for sonixd, but I've never used electron. Trying to set this up on GitHub Codespaces or Docker results in build errors for node-gyp
/gyp
during electron-rebuild
, which is executed automatically after running yarn install
. There are also warnings about unmet dependencies.
I'm using a docker image based on Debian Buster and Node 14.20 and the main
branch.
Is there anything I'm doing wrong? Could you maybe try and see if you can recreate my problem, or package your dev environment as a Docker container? I would like to make a PR, but without testing the changes beforehand there really is no point, and I can't seem to get this working...
I've noticed you have a docker-based setup for the rewrite, so maybe I could add the feature there, once you get to that point.
Are these the errors you're getting?
Exit code: 1
Command: node-gyp rebuild
Arguments:
Directory: /code/sonixd/node_modules/register-scheme
Output:
gyp info it worked if it ends with ok
gyp info using node-gyp@5.1.0
gyp info using node@14.20.0 | linux | x64
gyp ERR! find Python
gyp ERR! find Python Python is not set from command line or npm configuration
gyp ERR! find Python Python is not set from environment variable PYTHON
gyp ERR! find Python checking if \"python\" can be used
gyp ERR! find Python - \"python\" is not in PATH or produced an error
gyp ERR! find Python checking if \"python2\" can be used
gyp ERR! find Python - \"python2\" is not in PATH or produced an error
gyp ERR! find Python checking if \"python3\" can be used
gyp ERR! find Python - \"python3\" is not in PATH or produced an error
gyp ERR! find Python
gyp ERR! find Python **********************************************************
gyp ERR! find Python You need to install the latest version of Python.
gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
gyp ERR! find Python you can try one of the following options:
gyp ERR! find Python - Use the switch --python=\"/path/to/pythonexecutable\"
gyp ERR! find Python (accepted by both node-gyp and npm)
gyp ERR! find Python - Set the environment variable PYTHON
gyp ERR! find Python - Set the npm configuration variable python:
gyp ERR! find Python npm config set python \"/path/to/pythonexecutable\"
gyp ERR! find Python For more information consult the documentation at:
gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
gyp ERR! find Python **********************************************************
gyp ERR! find Python
gyp ERR! configure error
gyp ERR! stack Error: Could not find any Python installation to use
gyp ERR! stack at PythonFinder.fail
You'll need to install python in the container with apt install python3
since it's required by node-gyp. I just tested on a debian buster container.
Nope, python3
is found
Weird, it's trying to build the Windows native dependencies.
If you go into the src/package.json
file, you can temporarily remove those dependencies.
Check this comment for detailed instructions: https://github.com/jeffvli/sonixd/issues/232#issuecomment-1038148918
Have you tried using a node-specific container?
Very simple Dockerfile that you can add the the repo root and build:
FROM node:14-buster
WORKDIR /sonixd
COPY . .
RUN yarn
Okay, tried that as well. Had to install some additional packages (apt install libxshmfence1 libglu1 libnss3-dev libgdk-pixbuf2.0-dev libgtk-3-dev libxss-dev libasound2
) to get yarn install
to complete (as root), but I still can't run yarn start
because chromium wants the --no-sandbox
flag when running as root and I can't add that (as I'm not running the command myself).
So I tried adding a new user and running yarn start
as it, but there are still errors:
Failed to move to new namespace: PID namespaces supported, Network namespace supported, but failed: errno = Operation not permitted
/sonixd/node_modules/electron/dist/electron exited with signal SIGTRAP
Maybe v0.x.x simply isn't docker-compatible? I'm afraid I don't have any vanilla linux available, only docker and WSL. I'll give it another try on Windows now...
So Windows doesn't work either for me. Problem being that https://github.com/MarshallOfSound/electron-devtools-installer doesn't seem to support password-protected ssh keys, nor https-based git access.
$ yarn install
yarn install v1.22.19
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/4] Resolving packages...
[2/4] Fetching packages...
error Command failed.
Exit code: 128
Command: git
Arguments: ls-remote --tags --heads ssh://git@github.com/MarshallOfSound/electron-devtools-installer.git
Directory: D:\Code\misc\sonixd
Output:
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
If I run ssh -vT git@github.com
or git ls-remote --tags --heads ssh://git@github.com/MarshallOfSound/electron-devtools-installer.git
it prompts me for the password for the key and everything works.
I'm sorry, but I think I'll wait until the v1.0 release before contribution this feature, if it's necessary at that point :)
I just don't have the time or motivation to figure this out...
You might get a PR with a few themes though :)
Yeah unfortunately I've never used nor tested docker for my dev environment. Probably better to push any new features to the next version anyways!
Is your feature request related to a problem? Please describe.
I love to have applications set up in a way that they use light mode during the day and dark mode at night. Windows will automatically change the theme at sunset/sunrise, and most web or electron applications use the
prefers-color-scheme
media query to change the theme appropriately. Sonixd currently only has a single theme that can be configured, and the theming API doesn't support using pure CSS / media queries at the moment, so this is not possible.Describe the solution you'd like
For the v1.0.0 rewrite, maybe it would be possible to support loading themes as CSS files. That would allow themes to define light and dark color schemes and switch between them automatically. It would also allow overwriting only part of the default theme.
However, the downside would be that this is a less configurable approach. It wouldn't be possible to mix&match different dark and light themes.
As an alternative, there could be two theme selectors, and a color-scheme selector. The two theme selectors would allow you to pick one theme as a dark theme (e.g.
Default Dark
) and one as a light theme (e.g.Default Light
), and the color-scheme selector would allow you to choose betweenLight Theme
,Dark Theme
andSystem/Auto Theme
, where the latter would switch between the two themes depending on the OS setting.Describe alternatives you've considered
Given that the themes are currently defined in JSON, I don't think there's a way to implement this functionality without any code changes.
Additional context
For automatically changing the theme (
System/Auto Theme
setting), this code snippet could be used:This feature would probably require two new dropdowns in the Look&Feel panel and ~10 additional LoC (for the alternative approach), so I believe it wouldn't be too much effort to slip it into the planned features for v1.0.0.
If you want me to, and still accept PRs for v0.x.x, I'd be happy do try and make a PR for this :)