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

Configuration #30

Closed
gabm opened this issue Dec 6, 2023 · 6 comments
Closed

Configuration #30

gabm opened this issue Dec 6, 2023 · 6 comments

Comments

@gabm
Copy link
Owner

gabm commented Dec 6, 2023

Description

There are more and more requests for more configuration options. Currently we allow configuration exclusively through the commandline. That is okay but a) becomes confusing and b) has to be specified on each call - so it is not available when launched from the file browser for instance.

I want to introduce a config file which should reside in the XDG_CONFIG_DIR/satty/config.{ending}. Every configuration option shall have a sane default, a configuration entry and a commandline option. The hierarchy shall be as mentioned where the command line has the highest priority and overrides previous settings.

I did not decide on a format yet, I like yaml for its accessibility but I feel that toml is more type safe - although I dislike some of its design choices.

Existing Configuration options

  • early exit: Directly exit after copy/save action
  • fullscreen: start in fullscreen mode
  • copy command: specify the command to be used for the copy action
  • output-filename: specify the output folder and filename (if we want to handle this as a config option, then we need to allow patterns here..)
  • initial-tool: the tool that is selected by default on start-up

Requested Configuration Options

Possible Other Options

  • font: Font for text rendering
  • ...
@gabm gabm mentioned this issue Dec 6, 2023
@wangyc-pers
Copy link

I'm thrilled about this feature! Regarding the configuration file format, I'm a big fan of TOML over YAML. YAML's rigid indentation requirements often give me a headache.

Moreover, I have another suggestion. How about introducing a separate configuration option for the file name format that supports formatting? For instance, something like "satty-%Y-%m-%d %H:%M:%S.png." This would enable us to specify the save folder when using a command, without repeating the file name. I believe this would add a delightful touch of flexibility to our setup! What do you think?

@gabm
Copy link
Owner Author

gabm commented Dec 8, 2023

thank you for your warm words and your suggestion. It's what i meant with "patterns" up there.. i plan to do exactly like you suggest!

i would be happy about contributions

@gabm
Copy link
Owner Author

gabm commented Dec 28, 2023

CALL FOR TESTERS

I implemented configuration file handling in #38 . The file is supposed to reside in ~/.config/satty/config.toml. The (currently) exhaustive list of options is:

[general]
fullscreen = true
early-exit = true
initial-tool = "brush"
copy-command = "wl-copy"
annotation-size-factor = 2
output-filename = "/tmp/test-%Y-%m-%d_%H:%M:%S.png"

[color-palette]
first= "#00ffff"
second= "#a52a2a"
third= "#dc143c"
fourth= "#ff1493"
fifth= "#ffd700"
custom= "#008000"

Please checkout the code, build it, try it and give feedback. I am specially interested in

  • general feeling aobut the solution
  • naming of the options
  • interaction with the commandline, that can override the config options
  • new introduced options: size-factor and color handling

@wangyc-pers
Copy link

wangyc-pers commented Jan 25, 2024 via email

@gabm
Copy link
Owner Author

gabm commented Jan 30, 2024

thanks for your valuable feedback. I agree with any point made! Currently my time is limited, so lets see what is the ETA on this..

@gabm
Copy link
Owner Author

gabm commented Feb 13, 2024

The configuration file update has been merged and released as v0.9.0. Please test and report any issues.

I decided against the following ideas for now

  • automatic file generation: I use nixos nowadays and we wouldn't really want the programs to write automatically. We do have a sane set of defaults, so a config file is not necessary imho
  • persistent settings: as a result of previous thoughts on this and as outlined in [FEAT] add flag to remember the latest used editor configuration #34, config and state should be separated and we would never want to touch the users config. Therefore we might introduce an "autosave settings" config that will cause satty to write a state file... the config will then only describe the initial state of things

Thank you for your help on getting this done and testing!

@gabm gabm closed this as completed Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants