mrichar1/clipster

the config file does not work

hematinik opened this issue · 4 comments

Hi, first of all I want to thank you for such a perfect and minimal tool.
I am not able to configure clipster and tried different ways. these are what I did in order to get the job done but no avail:

1- created $HOME/.config/clipster/clipster.ini with the following context

[clipster]
history_size = 2

but it did not work as expected

2- moved the clipster.ini to $HOME/clipster/clipster.ini and $HOME/clipster.ini and $HOME/clipster but none of them seems to be working

3- tried clipster -f $HOME/clipster/clipster.ini and clipster --config $HOME/clipster.ini but the command does not return anything and I have to intrupt it using CTRL+C

I am on Manjaro Gnome with i3 as the WM
can you please help me? I dont know what else to do..

Hi,

Thanks for trying out clipster!

To start with point 3 - the -f option should definitely work. The reason it 'hangs' is that you need to start it in daemon mode by also passing the -d option. This will then run in the background, collecting history.

Once it's running as a daemon, select a few things, then run clipster -o to output the clipboard history.

Hopefully points 1 and 2 will be solved by running it in dameon mode, where it will read the config - but if it is still not using he config, either when it is in $HOME/.config/clipster/clipster.ini or when using -f please let me know and I'll have a deeper look!

I did as you suggested and it made no difference. here's what I did:

1- running clipster at the i3 startup using command
exec --no-startup-id clipster -d -f ~/.config/clipster/clipster.ini

2- manually running clipster -d -f ~/.config/clipster/clipster.ini after the startup (with no previous daemon started)

the content of clipster.ini is the same I mentioned earlier. in both cases the command gets executed successfully (no "hangs") but the history ignores the limit of 2 selections (according to the clipster -s window)

btw thank you for the quick response, cheers

Hi,

OK I dug into it a bit more, and there are a few things going on here.

Firstly, -f specifies the directory which contains a file called clipster.ini - not the file itself. So you'd need to run clipster -f $HOME/clipster/ for it to find the file.

Secondly, history_size is the size of the history that is written to the history file, not the in-memory history. So if your in-memory history has 5 items, and history_size is 2, only the latest 2 items will be written to file. The history file is also only written every 60 secs by default, but you can tweak this by setting write_on_change = yes for immediate writes if you wan to look in the history file to compare (if you add -lDEBUG on the command-line it prints out the in-memory history on every change for comparison).

I can't remember what the design decisions were that led to the 2 above choices... I imagine there may be race conditions with trying to trim the in-memory history if new items are being written to it, but I wrote it a long time ago so can't remember. Happy to leave this open as an issue and/or accept PRs if this can be made to work though!

Let me know if that helps at all?

In terms of documentation the README is technically correct, but these things are not immediately obvious unless you read it carefully, so I'm happy to try to update it to make these clearer.

Finally I'm able to load the config file! thank you for the clarification. I think we can close this issue however maybe it is not a bad Idea to have a default config file after installation (for example in /etc/clipster/ or ~/.config/clipster). this could avoid a lot of confusion and extra effort to explain how things work.
I can't thank you enough for the clipster, i really like the design. good luck.

PS,
For the future reference or in case anyone may find it useful, this is how It worked for me:

# ~/.config/i3/config
exec --no-startup-id clipster -d -f ~/.config/clipster