This config loads if Picom is available – OK.
Test (x picom) Read $[USER_DIR]/SimpleButton/simpleB.sys
Without Picom, how to test it — ???
Test (None picom) Read $[USER_DIR]/SimpleButton/simpleB-nop.sys
This config loads if Picom is available – OK.
Test (x picom) Read $[USER_DIR]/SimpleButton/simpleB.sys
Without Picom, how to test it — ???
Test (None picom) Read $[USER_DIR]/SimpleButton/simpleB-nop.sys
Multiple ways, first is just negate the test with !
:
Test (!x picom) DoStuff
If you happen to be inside a function and you want both of these possibilities you could use TestRc
to test if the previous test worked or not.
AddToFunc MyFunction
+ I Test (x picom) DoStuff
+ I TestRc (NoMatch) DoOtherStuff
I got it to work with None (Picom)
, but (!x picom)
is better. Thanks.
None (Picom)
and Test (!x picom)
do different things, so use the one that does what you want. The first, None (Picom)
tests if no window is running with that name/class/resource, while the second tests if that binary exists.
This test if editor is available
AddToFunc Editor
+ I Test (x featherpad) Exec exec featherpad
+ I Test (x mousepad) Exec exec mousepad
+ I Test (x gedit) Exec exec gedit
as well as opens a file
+ I Test (x featherpad) Exec exec featherpad $[USER_DIR]/WorkButtons/web.conf
How to combine function with different files? This loads the editor but doesn’t open a file.
Editor $[USER_DIR]/WorkButtons/web.conf
Editor $[USER_DIR]/WorkButtons/email.conf
Editor $[USER_DIR]/WorkButtons/office.conf"
Fvwm-Kise WorkButtons use featherpad editor. To improve it with different editors by testing which app is available.
I don’t think it is possible to combine. I tried using Piperead.
DestroyFunc EditorFP
AddToFunc EditorFP
+ I Exec exec featherpad
Piperead 'echo EditorFP /home/amlug/.fvwm/user/WorkButtons/web.conf'
Starts featherpad but not open the file.
Functions accept arguments just fine, you just have to configure them to use the arguments. As per the manual page.
$0 to $9
The positional parameters given to a complex function (a function
that has been defined with the AddToFunc command). "$0" is replaced
with the first parameter, "$1" with the second parameter and so on.
If the corresponding parameter is undefined, the "$..." is deleted
from the command line.
$*
All positional parameters given to a complex function. This
includes parameters that follow after "$9".
$[n]
The n:th positional parameter given to a complex function, counting
from 0. If the corresponding parameter is undefined, the "$[n]" is
deleted from the command line. The parameter is expanded unquoted.
$[n-m]
The positional parameters given to a complex function, starting
with parameter n and ending with parameter m. If all the
corresponding parameters are undefined, the "$[...]" is deleted
from the command line. If only some of the parameters are defined,
all defined parameters are expanded, and the remaining silently
ignored. All parameters are expanded unquoted.
$[n-]
All the positional parameters given to a complex function, starting
with parameter n. If all the corresponding parameters are
undefined, the "$[...]" is deleted from the command line. All
parameters are expanded unquoted.
$[*]
All the positional parameters given to a complex function. This is
equivalent of $[0-].
Thanks @somiaj, reminds me of InfoStoreAdd
, which works.
Test (x featherpad) InfoStoreAdd EDT "Exec exec featherpad"
Test (x mousepad) InfoStoreAdd EDT "Exec exec mousepad"
Test (x gedit) InfoStoreAdd EDT "Exec exec gedit"
$[infostore.EDT] $[USER_DIR]/WorkButtons/web.conf