gabm / Satty

Satty - Modern Screenshot Annotation. A tool inspired by Swappy and Flameshot.
Mozilla Public License 2.0
388 stars 18 forks source link

[FEAT] add flag to remember the latest used editor configuration #34

Open marcosnils opened 6 months ago

marcosnils commented 6 months ago

I generally find myself changing the default color and size very often and I really wish if satty could just remember the latest setting used. I guess the most straight forward approach to do this would be to persist the editor config somewhere and then read it every time satty is called.

For backwards compatibility purposes I was thinking about adding a new flag for this like --persist-editor-cfg.

WDYT? would a PR be useful?

gabm commented 6 months ago

great idea! have you seen #30? We should add default colour and default size there!

would this already solve your use case?

Currently there is no such notion as "state". Satty is basically stateless as all config is passed to it at startup. The configuration file in #30 would be a way to not only describe the initial state but - when writable - also to persist state. Imho that might be the best approach.

We should avoid unpredictable options, i.e. specifying A but getting B...

marcosnils commented 6 months ago

would this already solve your use case?

not entirely since what I'd really like is for the editor to remember the last setting used. This is something that other tools like flameshot do.

Having a config file to set the color and size would partially help, but it won't be a nice UX since it'd be very painful having to go to that file each time I want to change them.

gabm commented 6 months ago

I think the way forward will be to implement the configuration file as a way of persisting state and then use one of the toml editor crates to edit that file when the remember last state option is set

marcosnils commented 6 months ago

I think the way forward will be to implement the configuration file as a way of persisting state and then use one of the toml editor crates to edit that file when the remember last state option is set

yes sure, this makes sense. How do you prefer to move forward about this? Can I help #30 to move forward somehow?

gabm commented 6 months ago

I thought about this again and had some specific doubts about us touching the users config file and also systems where the configuration file is immutable. So I asked the NixOS community over at Reddit [0] and the answers are very useful .. let me summarise

For us that boils down to:

marcosnils commented 6 months ago

Awesome, great. I can start with a draft PR and we can continue iterating there.

gabm commented 6 months ago

I would prefer the following behaviour/spec

gabm commented 6 months ago

Awesome, great. I can start with a draft PR and we can continue iterating there.

great, looking forward!

gabm commented 6 months ago

I implemented config file handling in #38. It pushes the config into a global variable called APP_STATE that is a relm4 SHARED_STATE. I do think that this might also be a good approach for tracking the app state (selected tools, colors, sizes etc)