Re: test shell env in .muttrc

2022-12-07 Thread Jon LaBadie

On Mon, Dec 05, 2022 at 06:18:05PM -0800, Will Yardley wrote:

On Mon, Dec 05, 2022 at 08:26:16PM -0500, Jon LaBadie wrote:


Perhaps I've overlooked the facility.  Is there a way to test the
shell environment in .muttrc?  Basically an "if" statement.

I enter mutt in several ways (direct, aliases, shell scripts,
functions, etc) and from several devices.  My smart phone needs a
different color scheme than the other devices.


I think there may be an internal way as well, but one option would be to
set an env var (e.g., TYPE) depending on the type of session, and then
do something like (untested):

source ~/.mutt/colors.${TYPE:-default}


Nice suggestion Will, tnx.

I chose XDG_SESSION_TYPE (automatically set: so far to either x11 or 
tty) and it seems to be doing what I was looking for.


--
Jon H. LaBadie j...@labadie.us
 154 Milkweed Dr (540) 868-8052 (H)
 Lake Frederick, VA 22630(703) 935-6720 (M)



Re: test shell env in .muttrc

2022-12-05 Thread Kevin J. McCarthy

On Mon, Dec 05, 2022 at 06:18:05PM -0800, Will Yardley wrote:

I think there may be an internal way as well, but one option would be to
set an env var (e.g., TYPE) depending on the type of session, and then
do something like (untested):

source ~/.mutt/colors.${TYPE:-default}


See also  for some examples of 
MuttLisp.  For example:


source (concat "~/.mutt/colors." (or $TYPE default))

--
Kevin J. McCarthy
GPG Fingerprint: 8975 A9B3 3AA3 7910 385C  5308 ADEF 7684 8031 6BDA


signature.asc
Description: PGP signature


Re: test shell env in .muttrc

2022-12-05 Thread Will Yardley
On Mon, Dec 05, 2022 at 08:26:16PM -0500, Jon LaBadie wrote:

> Perhaps I've overlooked the facility.  Is there a way to test the
> shell environment in .muttrc?  Basically an "if" statement.
> 
> I enter mutt in several ways (direct, aliases, shell scripts,
> functions, etc) and from several devices.  My smart phone needs a
> different color scheme than the other devices.

I think there may be an internal way as well, but one option would be to
set an env var (e.g., TYPE) depending on the type of session, and then
do something like (untested):

source ~/.mutt/colors.${TYPE:-default}

Or you could key it on hostname, similar to this example:
https://lwn.net/Articles/587348/

You can also source a shell script to do some stuff
https://mutt-users.mutt.narkive.com/WovuIH31/conditionally-include-a-file-in-the-configuration

there may be some patches to support more within the config itself.
neomutt (which I don't use personally) has some support via this hook:
https://neomutt.org/feature/ifdef




test shell env in .muttrc

2022-12-05 Thread Jon LaBadie

Perhaps I've overlooked the facility.  Is there a way to
test the shell environment in .muttrc?  Basically an "if"
statement.

I enter mutt in several ways (direct, aliases, shell scripts,
functions, etc) and from several devices.  My smart phone
needs a different color scheme than the other devices.

It is easy enough to use a macro I have to rotate among
several color schemes, but I would prefer to automate it
on entry if possible.

Jon

--
Jon H. LaBadie j...@labadie.us
 154 Milkweed Dr (540) 868-8052 (H)
 Lake Frederick, VA 22630(703) 935-6720 (M)