aboutsummaryrefslogtreecommitdiffstats
path: root/aerc.go
Commit message (Collapse)AuthorAgeFilesLines
* aercmsg: add AercFuncMsg and QueueFuncTim Culverhouse2022-10-181-0/+2
| | | | | | | | | | Introduce AercFuncMsg and QueueFunc. These are used in combination to queue a function to be run in the main goroutine. This can be used to prevent data races in delayed function calls (ie from debounce functions). Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* aerc: use single event loopTim Culverhouse2022-10-071-8/+12
| | | | | | | | | Combine tcell events with WorkerMessages to better synchronize state with IO and UI. Remove Tick loop for rendering. Use events to trigger renders. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* ui: cleanup internals and apiRobin Jarry2022-09-141-2/+2
| | | | | | | | | | | | | | | | Now that tcell events are handled in a goroutine, no need for a channel to buffer them. Rename ui.Tick() to ui.Render() and ui.Run() to ui.ProcessEvents() to better reflect what these functions do. Move screen.PollEvent() into ui.ProcessEvents(). Register the panic handler in ui.ProcessEvents(). Remove aerc.ui.Tick() from DecryptKeys(). What the hell was that? Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Tim Culverhouse <tim@timculverhouse.com>
* ui: process tcell events in a separate go routine from renderingTim Culverhouse2022-09-131-0/+1
| | | | | | | | | | | | | The UI runs off a 16 ms ticker. If no render is required, and no event is seen, aerc waits 16 ms before checking for new events or render requests. This severely limits handling of events from tcell, and is particularly noticeable on pasting of large quantities of text. Process tcell events in a separate go routine from the render loop. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Moritz Poldrack <moritz@poldrack.dev> Acked-by: Robin Jarry <robin@jarry.cc>
* main: change account order sortTobias Wölfel2022-09-101-1/+1
| | | | | | | Sort the accounts based on case insensitive names. Signed-off-by: Tobias Wölfel <tobias.woelfel@mailbox.org> Acked-by: Robin Jarry <robin@jarry.cc>
* aerc: fix build when GOFLAGS contains spacesRobin Jarry2022-08-241-1/+3
| | | | | | | | | | | | Due to multiple levels of nested quoting, it is not possible to escape spaces and/or quotes from GOFLAGS and pass the value to go build -ldflags to set a compile time variable. Encode main.Flags in base64 and decode it when reading it. Fixes: d7e6dc3649ea ("aerc: add build info to version string") Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
* main: add cli flag to load specified account(s)Tim Culverhouse2022-08-221-3/+7
| | | | | | | | | | Make it possible to specify which account(s) to load. Preserve listed order when creating account tabs. aerc -a <account-name[,account-name]> Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* aerc: add build info to version stringRobin Jarry2022-08-221-2/+16
| | | | | | | | | | | | | | | | Example: $ aerc -v aerc 0.11.0 +notmuch (go1.18.4 amd64 linux) Also include that version information in the debug and panic logs. debug.ReadBuildInfo() is only available in go 1.18+. Add a new variable set at build time to store $GOFLAGS. Suggested-by: Tim Culverhouse <tim@timculverhouse.com> Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
* lint: homogenize operations and minor fixes (gocritic)Moritz Poldrack2022-08-041-13/+14
| | | | | | | | | | | | | | | | | | Apply GoDoc comment policy (comments for humans should have a space after the //; machine-readable comments shouldn't) Use strings.ReplaceAll instead of strings.Replace when appropriate Remove if/else chains by replacing them with switches Use short assignment/increment notation Replace single case switches with if statements Combine else and if when appropriate Signed-off-by: Moritz Poldrack <moritz@poldrack.dev> Acked-by: Robin Jarry <robin@jarry.cc>
* lint: ensure errors are at least logged (errcheck)Moritz Poldrack2022-08-041-3/+12
| | | | | Signed-off-by: Moritz Poldrack <moritz@poldrack.dev> Acked-by: Robin Jarry <robin@jarry.cc>
* logging: print init procedure and config contentsRobin Jarry2022-07-231-0/+4
| | | | | | | This may help debugging issues. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
* logging: use level-based logger functionsRobin Jarry2022-07-231-24/+13
| | | | | | | | | | | | Do not pass logger objects around anymore. Shuffle some messages to make them consistent with the new logging API. Avoid using %v when a more specific verb exists for the argument types. The loggers are completely disabled (i.e. Sprintf is not even called) by default. They are only enabled when redirecting stdout to a file. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
* tabs: rename SelectedTab to SelectedTabContentRobin Jarry2022-07-231-2/+2
| | | | | | | | | This function returns an ui.Drawable. Use a more explicit name. This prepares for adding a new SelectedTab function which will return an ui.Tab. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Koni Marti <koni.marti@gmail.com>
* aerc: use aerc as an mbox viewerKoni Marti2022-07-141-0/+1
| | | | | | | | | | | | | | | | | Use Aerc as an mbox viewer. Open an mbox file from the command line in a new tab with the mbox backend. Provide a convenient and quick way to display emails from an mbox. Usage: aerc mbox://<path> where the path can either be a directory or an mbox file. If it is a directory, every file with an .mbox suffix will be loaded as a folder. The account config will be copied from the selected account. This allows the answer emails in the mbox account. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* refactor: refactor pgp implementationTim Culverhouse2022-04-271-5/+6
| | | | | | | | | This commit refactors the internal PGP implementation to make way for GPG integration. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* main: remove unnecessary pointer dereferenceConnor Kuehl2022-04-141-2/+2
| | | | | | | Calling a method on a pointer will dereference it automatically. Signed-off-by: Connor Kuehl <cipkuehl@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* logging: fix race condition in startupMoritz Poldrack2022-03-241-1/+4
| | | | | | | | | If a panic occurs in one of the workers, it can happen after the UI was initialised, but before the cleanup function has been registered. With this the start of the worker loops is deferred until the cleanup routine was registered. Signed-off-by: Moritz Poldrack <git@moritz.sh>
* logging: added a log on panicMoritz Poldrack2022-03-231-19/+5
| | | | | | | | | | | | | Since panics still regularly "destroy" the terminal, it is hard to get a stack trace for panics you do not anticipate. This commit adds a panic handler that automatically creates a logfile inside the current working directory. It has to be added to every goroutine that is started and will repair the terminal on a panic. Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc>
* main: use terminfo to set window titleRobin Jarry2022-02-201-11/+15
| | | | | | | | | | Parse the terminal capabilities from the TERM environment variable instead of using a hard coded list of terminals. tcell does not expose the status line capabilities. Use another library for this: github.com/xo/terminfo Signed-off-by: Robin Jarry <robin@jarry.cc>
* config: do not hardcode sharedirRobin Jarry2022-02-191-5/+3
| | | | | | | | | | | | Instead of using a static SHAREDIR at compile time, use a list of standard paths to use at runtime for templates, config files and stylesets. This implies removing all default filters in the default configuration. Replace them with basic commands. New users can configure the filters as they wish. Signed-off-by: Robin Jarry <robin@jarry.cc>
* aerc: shutdown if socket communication failsAdnan Maolood2022-01-241-10/+13
| | | | | | | | | When provided with a mailto argument, aerc tries to connect to an existing instance via a unix socket. If that fails, it starts up a new instance and tries again. However, if that fails again (e.g. if the unix server could not be started) then the new instance will remain open without any indication that an error occured. Instead, shutdown the new instance so the user can see the error message.
* binds: Warning on unexistent account bindingsinwit2022-01-241-1/+1
| | | | | | | | | After commit 175d0ef ("binds: add account specific bindings"), when bindings are defined for an account not defined in accounts.conf, aerc quits with an error. After this commit, a warning is logged and aerc ignores those bindings. Signed-off-by: inwit <inwit@sindominio.net>
* go.mod: change base git urlRobin Jarry2021-11-051-11/+11
| | | | | | | I'm not sure what are the implications but it seems required. Link: https://github.com/golang/go/issues/20883 Signed-off-by: Robin Jarry <robin@jarry.cc>
* main: set xterm titleRobin Jarry2021-11-021-0/+19
| | | | Signed-off-by: Robin Jarry <robin@jarry.cc>
* aerc: try to recover from a panicReto Brunner2021-02-111-0/+19
| | | | | | As of now we crash fairly often. The problem is that we didn't run the cleanup routine of the ui in this case, leaving the pty in a bad state. Instead, recover from a panic and at least try to run the ui deinit.
* Sort command completionsJeffas2020-06-131-0/+2
| | | | | | Previously the completions weren't sorted which led to a difficult to navigate list, especially for the command names as it would randomly jump through the alphabet.
* templates: add version funcReto Brunner2020-05-061-0/+4
| | | | Fixes #316
* Initial support for PGP decryption & signaturesDrew DeVault2020-03-031-0/+4
|
* Don't use current input as a possible completionBen Burwell2019-12-211-1/+0
| | | | | Now that completions are being shown in the popover, it doesn't make sense to show the unfinished command as a potential completion.
* Open mailto links in a new aerc instance if needed.Reto Brunner2019-09-291-2/+17
| | | | | | | | | | | | | Aerc tries to open mailto:// links via the socket of the already running aerc instance. If no socket exists this silently errored out. This commit starts up a new aerc instance if it can't connect to the socket (which I think is the most common error) and if not sets up a new aerc instance and retries to open the compositor. This fixes https://todo.sr.ht/~sircmpwn/aerc2/295 by implementing the desired behaviour.
* Add initial command to end of completionsJeffas2019-09-111-0/+1
| | | | | This means that if the user cycles through all completions then they will see the initial string they entered.
* aerc.go: simplify completionsDrew DeVault2019-09-041-9/+3
|
* aerc.go: remove unused variableDrew DeVault2019-09-041-1/+0
|
* Close backends prior to shutdownReto Brunner2019-08-081-0/+1
| | | | | | | We need some way to signal the backends that we are about to shutdown, allowing them to clean up (for example in notmuch committing the db changes). This commit implements a hook which gets called upon shutdown, providing backends implement the io.Closer interface.
* Remove aerc specific code from the uiNicolai Dagestad2019-08-031-1/+5
| | | | | Separatiing the ui code from aerc makes it usable as a library in other projects.
* Print errors from config load issues.Reto Brunner2019-07-291-1/+1
| | | | | | Currently we /dev/null stdout, if it is a tty. The checkConfigPerms function, as well as the error print were incorrectly writing to stdout and therefore weren't visible to most users.
* Add command history and cyclingGalen Abell2019-07-261-1/+1
| | | | | | Aerc will keep track of the previous 1000 commands, which the user can cycle through using the arrow keys while in the ex-line. Pressing up will move backwards in history while pressing down will move forward.
* Add new-email triggerJeffas2019-07-261-6/+6
| | | | | | | | | | | | | | | | | This patch sets up the trigger config section of aerc.conf. Each trigger has its own function which is called from the place where it is triggered. Currently only the new-email trigger is implemented. The triggers make use of format strings. For instance, in the new-email trigger this allows the user to select the trigger command and also the information extracted from the command and placed into their command. To actually execute the trigger commands the keypresses are simulated. Further triggers can be implemented in the future. Formatting of the command is moved to a new package.
* Discard stdout if not redirected to fileDaniel Bridges2019-07-231-0/+1
| | | | | Commit 97bee661 Printf statement at widgets/msgviewer.go#188 introduced bad formatting in the display if stdout was not being redirected.
* Forward mailto links to server via ./aerc <mailto>Drew DeVault2019-07-191-3/+8
|
* Add Unix socket for communicating with aercDrew DeVault2019-07-191-0/+10
|
* Show usage on getopt.Getopts errorAsger Hautop Drewsen2019-07-171-2/+7
|
* 71: Allow user to change config options at runtimePedro L. Ramos2019-07-151-1/+1
| | | | | | | | | There is a LoadConf and a LoadConfFromFile. LoadConfFromFile reads the iniFile into memory and and calls LoadConf, which executes the old parsing commands from LoadConf (old func). The remaining of the LoadConfFromFile is the same as the old OldConf.
* Implement basic tab completion supportGregory Mullen2019-06-291-20/+40
| | | | | Tab completion currently only works on commands. Contextual completion will be added in the future.
* Add aerc -v to print the installed versionDrew DeVault2019-06-181-0/+18
|
* widget: Add ProvidesMessage interfaceKevin Kuehler2019-06-021-0/+3
| | | | | | | | | | | Consists of 3 functions * Store: Access to MessageStore type * SelectedAccount: Access to Account widget that the target widget belongs to * SelectedMessage: Current message (selected in msglist or the one we are viewing) Signed-off-by: Kevin Kuehler <keur@ocf.berkeley.edu>
* Install default configs to XDG config if not foundDrew DeVault2019-05-221-1/+6
|
* Update internal state and draw from the same goroutineSimon Ser2019-05-191-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | This commit introduces a new Aerc.Tick function that should be called to refresh the internal state. This in turn makes each AccountView process worker events. The UI goroutine repeatedly refreshes the internal state before drawing a new frame. The reason for this is that many worker messages may need to be processed for a single frame, and drawing the UI is far slower than refreshing the internal state. This has been confirmed in my testing (calling Aerc.Tick only once per frame results in a slower display). Many synchronization code has been removed. We can now write widgets without having to care so much about races. The remaining sync users are: - widgets/spinner: the spinner value is updated from inside an internal goroutine - lib/ui/invalidatable: Invalidate may be called from any goroutine - lib/ui/grid: same - lib/ui/ui: an internal goroutine needs read access to UI.exit - worker/types/worker: Worker.callbacks is used for both worker and UI callbacks The exact goroutine requirements for Drawable have been documented.
* s/aerc2/aerc/gDrew DeVault2019-05-171-8/+8
|
* Abort if accounts.conf is world readableReto Brunner2019-05-161-3/+5
| | | | Fixes #32