aboutsummaryrefslogtreecommitdiffstats
path: root/config/general.go
Commit message (Collapse)AuthorAgeFilesLines
* aerc: support terminal-based pinentry programsKoni Marti2024-10-121-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Support terminal-based pinentry programs. Suspend vaxis before running the command that can trigger a pinentry call. Provide the proper tty in the GPG_TTY environment variable (and set a TERM variable if not provided; this is necessary for pinentry-curses). Finally, resume vaxis. To enable terminal-based pinentry support, you have to set [general] use-terminal-pinentry = true in your aerc.conf. Any GUI-based pinentry programs will work the same as before if this option is not set to true. To test pinentry-tty, add the following to your ~/.gnupg/gpg-agent.conf: pinentry-program /usr/bin/pinentry-tty and kill all running gpg-agents: $ killall gpg-agent Fixes: https://todo.sr.ht/~rjarry/aerc/202 Changelog-fixed: Terminal-based pinentry programs (e.g. `pinentry-curses`) now work properly. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* aerc: add quake-mode terminalKoni Marti2024-10-081-0/+1
| | | | | | | | | | | | | | | | | | Add a drop-down (quake-mode) terminal which is a persistent terminal session that overlays aerc at the top and can be toggled on or off. Enable quake mode by setting [General].enable-quake-mode=true. The height of the drop-down terminal can be set with [ui].quake-terminal-height (default: 20). Toggling is hardcoded to the F1 key. Note that this key should not be used in your key bindings when you enable Quake mode. Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc>
* log: handle config reloadKoni Marti2024-08-201-2/+11
| | | | | | | | | | | | Prepare the logging system for a config file reload. Make sure that we never close os.Stdout but only log file descriptors. Note that if you started aerc by redirecting its output into a specific file, this cannot be changed by a config reload. Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc>
* log: create directories if necessaryJens Grassel2024-07-151-0/+5
| | | | | | | | | | | | | | If a log file is configured via `log-file` and the parent directory does not exist then aerc exits with an error message on startup. Check if the directory for the log file exists and create it if necessary using sensible permissions (0700). Errors occurring while creating the directory structure are returned and printed out. Changelog-fixed: Startup error if `log-file` directory does not exist. Signed-off-by: Jens Grassel <jens@wegtam.com> Reviewed-by: Moritz Poldrack <moritz@poldrack.dev> Acked-by: Robin Jarry <robin@jarry.cc>
* ipc: add more fine-grained options to disable IPCJason Cox2024-04-131-0/+2
| | | | | | | | | | | | Add disable-ipc-mailto and disable-ipc-mbox to make mailto:... and mbox:... commands always run in a new instance, while still allowing aerc-internal commands (i.e., aerc :<command...>) to run over IPC. Changelog-added: Add config options `disable-ipc-mailto` and `disable-ipc-mbox` to make `mailto:...` and `mbox:...` commands always run in a new aerc instance. Signed-off-by: Jason Cox <me@jasoncarloscox.com> Acked-by: Robin Jarry <robin@jarry.cc>
* log: move package to libRobin Jarry2024-02-141-1/+1
| | | | | | | This has nothing to do at the root of the source tree. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Bence Ferdinandy <bence@ferdinandy.com>
* commands: add menuRobin Jarry2024-01-201-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a new :menu command that can be used to spawn a shell command in an interactive dialog and execute aerc commands for each of the lines printed on its standard output like xargs(1) would do in a shell. The shell command can be configured in aerc.conf under [general].default-menu-cmd and overridden via the :menu -c <cmd> option. There are two flags to provide input text to the shell command which can be useful in combination with other aerc commands: -a: All account names, one per line: '<account>' LF -d: All current account directory names, one per line: '<directory>' LF -ad: All directories of all accounts, one per line: '<account>' '<directory>' LF Here are some examples: :menu -adc fzf :cf -a :menu -c 'fzf --multi' :attach :menu -dc 'fzf --multi' :cp And also for key bindings: <C-p> = :menu -adc fzf :cf -a<Enter> Changelog-added: New `:menu` command to invoke other aerc commands based on a shell command output. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com> Tested-by: Johannes Thyssen Tishman <johannes@thyssentishman.com>
* xdg: get rid of deprecated dependenciesRobin Jarry2023-08-271-5/+3
| | | | | | | | | | | github.com/mitchellh/go-homedir has not received any update since 2019. The last release of github.com/kyoh86/xdg was in 2020 and it has been marked as deprecated by its author. Replace these with internal functions. Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Moritz Poldrack <moritz@poldrack.dev>
* term: add config options for TERM and osc8Tim Culverhouse2023-04-241-0/+2
| | | | | | | | Add config options for setting the TERM environment variable used in tcell-term and for enabling or disabling OSC8 escape sequence output. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry<robin@jarry.cc>
* ipc: allow triggering internal commands via IPCMoritz Poldrack2023-03-071-0/+1
| | | | | | | | | | | | | | | | | | | | | In order to make automation easier, it's useful to be able to send commands to aerc via IPC. This can be done by calling the aerc binary followed by a colon and the command to run. For example: aerc :read && aerc :remark && aerc :archive month Security to ensure no malicious commands are run is deferred to the user. By default the socket is only writable by the user. This is considered sufficient as the potential harm an attacker gaining write-access to a user's session can cause is significantly greater than "can delete some emails". To ensure users with an according threat model, it is possible to disable command IPC. mailto-handling is unaffected even though it works over IPC as it is absolutely non-destructive. Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc>
* config: use reflection to map ini keys to struct fieldsRobin Jarry2023-03-021-34/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The default ini.Section.MapTo() function only handles basic types. Implement a more complete mapping solution that allows: * parsing templates, regexps, email addresses * defining a custom parsing method via the `parse:"MethodName"` tag * defining default values via the `default:"value"` tag * parsing rune values with the `type:"rune"` tag The field name must be specified in the `ini:"field-name"` tag as it was before. It is no longer optional. The `delim:"<separator>"` tag remains but can only be used to parse string arrays. It is now possible to override default values with "zero" values. For example: [ui] dirlist-delay = 0 Will override the default "200ms" value. Also: [statusline] status-columns = Will override the default "left<*,center>=,right>*" value. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Tim Culverhouse <tim@timculverhouse.com>
* config: make various sections accessible via global varsRobin Jarry2022-12-141-11/+13
| | | | | | | | | | | | | | | | | | | | There is only one instance of AercConfig which is associated to the Aerc widget. Everywhere we need to access configuration options, we need somehow to get a reference either to the Aerc widget or to a pointer to the AercConfig instance. This makes the code cluttered. Remove the AercConfig structure and every place where it is referenced. Instead, declare global variables for every configuration section and access them directly from the `config` module. Since bindings and ui sections can be "contextual" (i.e. per account, per folder or per subject), leave most local references intact. Replacing them with config.{Ui,Binds}.For{Account,Folder,Subject} would make this patch even more unreadable. This is something that may be addressed in the future. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* log: force trace level when using shell redirectionRobin Jarry2022-12-071-2/+2
| | | | | | | | | When using aerc > log, print all messages as it was before the logging system cleanup. Requested-by: Tim Culverhouse <tim@timculverhouse.com> Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
* pgp-provider: set default value to autoRobin Jarry2022-12-061-3/+3
| | | | | | | | | | | Change the default provider to gpg unless the internal keyring is initialized and contains one key. This should be more user friendly. Link: https://lists.sr.ht/~rjarry/aerc-discuss/%3CCO783CI3IU9F.184DBQTPMIPBS%40paul%3E Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
* logging: rename package to logRobin Jarry2022-12-021-11/+11
| | | | | | | | | | Use the same name than the builtin "log" package. That way, we do not risk logging in the wrong place. Suggested-by: Tim Culverhouse <tim@timculverhouse.com> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* config: add log-file and log-level settingsRobin Jarry2022-11-211-5/+36
| | | | | | | | | | | Allow configuring persistent logging to file with a log level. When redirecting the output of aerc to a file these two settings are ignored and all messages are printed to stdout. Suggested-by: Moritz Poldrack <moritz@poldrack.dev> Suggested-by: Tim Culverhouse <tim@timculverhouse.com> Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* config: move [general] parsing in separate fileRobin Jarry2022-11-161-0/+48
The config.go file is getting too big. Move the aerc.conf [general] section parsing logic into a dedicated general.go file. No functional change. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Moritz Poldrack <moritz@poldrack.dev>