Skip to content
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

Consider using include syntax #177

Open
shmup opened this issue Aug 19, 2022 · 14 comments
Open

Consider using include syntax #177

shmup opened this issue Aug 19, 2022 · 14 comments
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@shmup
Copy link

shmup commented Aug 19, 2022

Instead of adding many configurations to the user's alacritty.yml, you could simply append (or replace) an include:

import:
  - /home/jtm/.config/alacritty/themes/dracula.yml

Making a 1 line change seems pretty solid. Maybe you've considered and want the current solution to be standalone (not requiring other files).

@shmup
Copy link
Author

shmup commented Aug 20, 2022

Whoa, I didn't even know about the scheme syntax! I am learning so much :3 (I only recently learned about imports heh)

https://gist.githubusercontent.com/sainnhe/ad5cbc4f05c4ced83f80e54d9a75d22f/raw/939021739051393ceff88d3df014fb5e4e90e7aa/gruvbox-material-alacritty.yml

@JuanVqz
Copy link
Collaborator

JuanVqz commented Aug 21, 2022

this sounds good, have a question.

do you know if you can use more than one import? if so, how will we know which one is the theme we want to add/remove?

Ex.

# alacritty.yml

import:
  - /path/to/some/config.yml
  - /path/to/colorscheme.yml

@JuanVqz JuanVqz added help wanted Extra attention is needed good first issue Good for newcomers labels Aug 21, 2022
@shmup
Copy link
Author

shmup commented Aug 23, 2022

do you know if you can use more than one import?

You can use more than one import, and in a quick test I believe it works by merging, so:

import:
 - file_containing_foreground1_and_background1.yml
 - file_containing_foreground2.yml

Would result in using background1 and foreground2

how will we know which one is the theme we want to add/remove?

Hm. Well, a first quick idea (and note: I haven't explored how this project is currently functioning nor have I given my idea much thought):

  1. A user selects a theme with the tool
  2. We replace the contents of alacritty/selected_theme.yml with the content of the selected theme
  3. We either add that yml line to an import block or..
  4. If it exists (is already imported) we do nothing else

I just did a test where I modified a property in an imported file and when saving, alacritty doesn't detect this. It only detects changes to alacritty.yml, so in the case of #4 we'd have to solve this. I did however follow that change up with a touch alacritty.yml and that triggered the update. Just 1 technique

@JuanVqz
Copy link
Collaborator

JuanVqz commented Aug 24, 2022

Yep, i like the idea of having a file and change the content.

Could you please verify if applying your changes the preview works as currently is working?

@shmup
Copy link
Author

shmup commented Aug 24, 2022

What is it you'd like me to verify exactly?

I've minimally verified this concept, using a touch, but I'm not sure what you'd like me to verify for y'all. Might be happy to, just word it again if you could

alacritty_example.mp4

@shmup
Copy link
Author

shmup commented Aug 24, 2022

Unless you meant "applying your changes" as in make the functional changes to this project, I don't think I'd have time for that currently. Maybe in time though, it's good we're talking about it and making notes

@JuanVqz
Copy link
Collaborator

JuanVqz commented Aug 24, 2022

no, I didn't mean applying the changes, hahaha, it could take time, yes, I wanted to see how it could work as you demonstrated it in the video record.

the touch alacritty.yml action makes me think if that will work or not. 🤔

@shmup
Copy link
Author

shmup commented Aug 24, 2022

We can still do it. The project is already using fs (obviously), and all touch is doing when I did that example is updating the file's timestamp.

fs has that too!

Little example from this video:

#!/usr/bin/env node

const config = "/home/jtm/.config/alacritty/alacritty.yml";

const fs = require('fs');
const fd = fs.openSync(config);

console.log('before', fs.statSync(config).mtime);
fs.futimesSync(fd, new Date(), new Date());
console.log('after', fs.statSync(config).mtime);

So in the case of the $USER already having the alacritty_theme.yml imported, we'd just run a fs.futimesSync(...), otherwise the modified time would be updated when we add that line to their config.

alacritty_toucher.mp4

@shmup
Copy link
Author

shmup commented Aug 24, 2022

no, I didn't mean applying the changes, hahaha, it could take time, yes, I wanted to see how it could work as you demonstrated it in the video record.

the touch alacritty.yml action makes me think if that will work or not. thinking

hehe yeah I didn't really think you'd have meant that, but also, it might not take much time! Not if we iron out a definitive plan forward :P

@JuanVqz
Copy link
Collaborator

JuanVqz commented Aug 26, 2022

Something that makes me be worried about it's when the user is picking another theme, since it's an async process it could cause issues, it will be great if you can verify that as well. After that we can ask the creator of the package for his point of view.

@shmup
Copy link
Author

shmup commented Aug 26, 2022

I see, yeah I can investigate that and possibly even change the implementation idea around.

@JuanVqz
Copy link
Collaborator

JuanVqz commented Aug 26, 2022

btw, I may say this before but from my side, I like the idea, it seems to be secure because that way we won't need to touch the alacrity.yml a lot. and may not cause issues there, also we can add comments in the alacritty-theme.yml to indicate the previous theme and the current one, and also add links to the theme's source.

@JuanVqz JuanVqz added the hacktoberfest open source is changing the world label Oct 6, 2022
@rajasegar rajasegar removed the hacktoberfest open source is changing the world label Nov 30, 2022
@tahir-hassan
Copy link

I'll be honest, this is what I thought this utility would do as it is a lot easier to manage for the user. I use Nerd Fonts for instance, which I saw disappear because of the color change.

I can work on this and submit a pull request if you guys want?

@JuanVqz
Copy link
Collaborator

JuanVqz commented Dec 1, 2022

guys want?

hey, @tahir-hassan sure thing! please do we appreciate it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants