On Wed, Jan 10, 2024 at 11:41:01AM +0000, Ioan Samarul wrote:
> I am trying to define mappings in cwmrc for some of my scripts. If I
> use the full path (/home/user/bin/someScript) they work as expected,
> but if I use something like $HOME/bin/someScript cwm does not
> recognize the mapping.
> 
> Is there something else I should do or it is just not possible to use
> environment variables?

You can't use $HOME in cwmrc as part of the path to a script.

However, if you specify a path without a leading / then cwm will search the
current path for an executable with that name.

So if your users' paths are set to include $HOME/bin, and each user has their
own $HOME/bin/my_script, then a line like this in cwmrc:

bind-key KP_Right "my_script"

will run each user's own version of the script.

Obviously you need to make sure that they don't have a global directory such
as /bin listed in their path before $HOME/bin, which has a file with the same
name in it, otherwise that would be run instead.

If a global directory is listed afterwards, and contains a file with that name
then you could have a global 'default' action for a key, which can be
over-ridden with a custom script by each user.  Although if it is actually a
multi-user system, rather than just you using different accounts, then
consider that such behaviour could be abused if a user can be tricked in to
creating a file in $HOME/bin/my_script that didn't already exist.

Reply via email to