Commit Graph

45 Commits

Author SHA1 Message Date
Robin Jarry 726969833b main: use terminfo to set window title
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>
2022-02-20 21:29:20 +01:00
Robin Jarry bb0f180140 config: do not hardcode sharedir
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>
2022-02-19 15:24:55 +01:00
Adnan Maolood 6be78781a1 aerc: shutdown if socket communication fails
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.
2022-01-24 12:06:41 +01:00
inwit d922d7325c binds: Warning on unexistent account bindings
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>
2022-01-24 11:48:51 +01:00
Robin Jarry 0d645bcebd go.mod: change base git url
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>
2021-11-05 10:21:45 +01:00
Robin Jarry 138977b2ce main: set xterm title
Signed-off-by: Robin Jarry <robin@jarry.cc>
2021-11-02 11:24:33 +01:00
Reto Brunner c06a2e61fc aerc: try to recover from a panic
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.
2021-02-11 21:02:46 +01:00
Jeffas 24c9509619 Sort command completions
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.
2020-06-13 10:12:53 +02:00
Reto Brunner 6bd6690d80 templates: add version func
Fixes #316
2020-05-06 10:00:59 -04:00
Drew DeVault f3158b36f1 Initial support for PGP decryption & signatures 2020-03-03 16:49:52 -05:00
Ben Burwell 4d00a2b4d6 Don't use current input as a possible completion
Now that completions are being shown in the popover, it doesn't make
sense to show the unfinished command as a potential completion.
2019-12-21 09:23:22 -05:00
Reto Brunner f15811a737 Open mailto links in a new aerc instance if needed.
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.
2019-09-29 12:36:35 -04:00
Jeffas a441e3b3a5 Add initial command to end of completions
This means that if the user cycles through all completions then they
will see the initial string they entered.
2019-09-11 11:26:27 -04:00
Drew DeVault c6b776adbf aerc.go: simplify completions 2019-09-04 16:30:49 -10:00
Drew DeVault 5f7809d825 aerc.go: remove unused variable 2019-09-04 16:30:34 -10:00
Reto Brunner 072b5f453c Close backends prior to shutdown
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.
2019-08-08 10:24:03 +09:00
Nicolai Dagestad 0847464da1 Remove aerc specific code from the ui
Separatiing the ui code from aerc makes it usable as a library in
other projects.
2019-08-03 16:50:49 -04:00
Reto Brunner b812257ba9 Print errors from config load issues.
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.
2019-07-29 14:51:16 -04:00
Galen Abell 8635c70fda Add command history and cycling
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.
2019-07-26 14:29:34 -04:00
Jeffas dc4c36adbf Add new-email trigger
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.
2019-07-26 14:00:24 -04:00
Daniel Bridges ec0e0f9d75 Discard stdout if not redirected to file
Commit 97bee661 Printf statement at widgets/msgviewer.go#188 introduced
bad formatting in the display if stdout was not being redirected.
2019-07-23 10:41:13 -04:00
Drew DeVault 66a9052f0f Forward mailto links to server via ./aerc <mailto> 2019-07-19 14:34:13 -04:00
Drew DeVault 7a489cb001 Add Unix socket for communicating with aerc 2019-07-19 14:15:48 -04:00
Asger Hautop Drewsen d43684cd90 Show usage on getopt.Getopts error 2019-07-17 15:59:41 -04:00
Pedro L. Ramos d85f671bdf 71: Allow user to change config options at runtime
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.
2019-07-15 09:42:03 -04:00
Gregory Mullen 2a0961701c Implement basic tab completion support
Tab completion currently only works on commands. Contextual completion
will be added in the future.
2019-06-29 14:24:19 -04:00
Drew DeVault 74af57b6c6 Add aerc -v to print the installed version 2019-06-18 09:50:06 -04:00
Kevin Kuehler 753adb9069 widget: Add ProvidesMessage interface
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>
2019-06-02 10:16:29 -04:00
Drew DeVault f42724caf3 Install default configs to XDG config if not found 2019-05-22 12:35:44 -04:00
Simon Ser a15ea01cfb Update internal state and draw from the same goroutine
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.
2019-05-19 11:51:16 -04:00
Drew DeVault 98da4c9509 s/aerc2/aerc/g 2019-05-17 20:57:10 -04:00
Reto Brunner b275a394e2 Abort if accounts.conf is world readable
Fixes #32
2019-05-16 17:26:35 -04:00
Drew DeVault fb3826cee5 Revert "Abort if accounts.conf is world readable"
This reverts commit a755608ef9.
2019-05-16 16:40:29 -04:00
Reto Brunner a755608ef9 Abort if accounts.conf is world readable
Fixes #32
2019-05-16 15:02:13 -04:00
Drew DeVault f37508a539 Implement :{next,prev}-field in compose view 2019-05-12 11:21:28 -04:00
Drew DeVault 577248f5e1 Add initial compose widget 2019-05-12 00:06:09 -04:00
Simon Ser de122b16ee lib/ui: fix UI.Exit race condition
UI.Exit can be accessed from goroutines drawing, goroutines executing
commands and goroutines waiting for events.

    Write at 0x00c0002b2040 by main goroutine:
      main.main.func1()
          /home/simon/src/aerc2/aerc.go:76 +0x33d
      git.sr.ht/~sircmpwn/aerc2/widgets.(*Aerc).BeginExCommand.func1()
          /home/simon/src/aerc2/widgets/aerc.go:245 +0x89
      git.sr.ht/~sircmpwn/aerc2/widgets.(*ExLine).Event()
          /home/simon/src/aerc2/widgets/exline.go:131 +0x442
      git.sr.ht/~sircmpwn/aerc2/widgets.(*Aerc).Event()
          /home/simon/src/aerc2/widgets/aerc.go:116 +0x83c
      git.sr.ht/~sircmpwn/aerc2/widgets.(*Aerc).simulate()
          /home/simon/src/aerc2/widgets/aerc.go:109 +0x12a
      git.sr.ht/~sircmpwn/aerc2/widgets.(*Aerc).Event()
          /home/simon/src/aerc2/widgets/aerc.go:142 +0x722
      git.sr.ht/~sircmpwn/aerc2/lib/ui.(*UI).Tick()
          /home/simon/src/aerc2/lib/ui/ui.go:75 +0x33f
      main.main()
          /home/simon/src/aerc2/aerc.go:94 +0x497

    Previous read at 0x00c0002b2040 by goroutine 19:
      git.sr.ht/~sircmpwn/aerc2/lib/ui.Initialize.func1()
          /home/simon/src/aerc2/lib/ui/ui.go:45 +0x97

    Goroutine 19 (running) created at:
      git.sr.ht/~sircmpwn/aerc2/lib/ui.Initialize()
          /home/simon/src/aerc2/lib/ui/ui.go:44 +0x372
      main.main()
          /home/simon/src/aerc2/aerc.go:87 +0x3a9
2019-05-05 01:07:44 -04:00
Drew DeVault 5d0402aeea Add message view commands, :close 2019-03-30 21:45:41 -04:00
Drew DeVault fa04a1e036 Add basic message viewer mockup 2019-03-30 14:12:04 -04:00
Drew DeVault 10dd23f05d Add terminal command context 2019-03-21 16:32:22 -04:00
Drew DeVault 8126d82956 Add context-specific commands 2019-03-21 16:30:23 -04:00
Drew DeVault f406bf5a3b Add :quit command 2019-03-15 20:32:09 -04:00
Drew DeVault b60999c39e Start building out command subsystem 2019-03-10 21:15:24 -04:00
Drew DeVault 648ca983f6 Add basic account widget, populate real acct views 2019-01-13 12:39:06 -05:00
Drew DeVault 3836d240c9 Switch to vgo 2018-03-02 09:27:44 -05:00
Renamed from cmd/aerc/main.go (Browse further)