i3-quickterm icon indicating copy to clipboard operation
i3-quickterm copied to clipboard

could create a default config on first run

Open RafalSkolasinski opened this issue 4 years ago • 2 comments

Just found your project, looks pretty cool! Though, when trying to run it for the first time it complains about lack of json config.

invalid config file: [Errno 2] No such file or directory: '/home/rskolasinski/.config/i3/i3-quickterm.json'
Traceback (most recent call last):
  File "./i3-quickterm", line 243, in <module>
    toggle_quickterm_select(conf)
  File "./i3-quickterm", line 188, in toggle_quickterm_select
    toggle_quickterm(conf, shell)
  File "./i3-quickterm", line 212, in toggle_quickterm
    os.execvp(term_cmd[0], term_cmd)
  File "/usr/lib/python3.7/os.py", line 572, in execvp
    _execvpe(file, args)
  File "/usr/lib/python3.7/os.py", line 614, in _execvpe
    raise last_exc
  File "/usr/lib/python3.7/os.py", line 605, in _execvpe
    exec_func(fullname, *argrest)
FileNotFoundError: [Errno 2] No such file or directory

maybe it would be a good idea to create that with default value?

RafalSkolasinski avatar Mar 29 '20 15:03 RafalSkolasinski

Okay, lack of default config is not the root of error above, that was because default term is urxvt and that one I do not have installed : - )...

Still could consider writing a default config file if it does not exist.

RafalSkolasinski avatar Mar 29 '20 15:03 RafalSkolasinski

Thanks for your feedback!

The first step could be a clearer error message when the currently configured terminal emulator is not in $PATH. It should not be too hard to do.

Concerning the configuration, the defaults are taken from the program itself and then merged with the keys redefined by the user. Maybe that hurts discoverability (hence your issue), but one of the advantage is that defaults can be changed without having to update the local configurations in most cases.

Another common pattern is to supply a configuration file with all the default values commented-out, ready to be customized. But as json doesn't officially have comments, we would probably have to change the format and break existing configs.

lbonn avatar Mar 30 '20 09:03 lbonn