houmain / keymapper

A cross-platform context-aware key remapper.
GNU General Public License v3.0
257 stars 21 forks source link

Passing arguments to commands. #102

Closed hewhocannotbetamed closed 5 months ago

hewhocannotbetamed commented 5 months ago

switch_systeminformer >> $(start wscript.exe C:\lazysys\scripts\powershell\utilities\window-management\switch.vbs 'System Informer')

This should, in my opinion just-work™. Alas, it does not. I've written powershell and batch scripts, but 2slow. wscript.exe + Windows API shenanigans seems to be the fastest means of "activating" a window per its title.

If you have another solution you use, feel free to let me know. I'm also curious if/how I can just feed whatever command I want to invoke arguments. On Windows.

hewhocannotbetamed commented 5 months ago

lol screw it wrote a binary in C. thank you for this rather inspiring codebase.

houmain commented 5 months ago

It should definitely work. Maybe you can give me your script so I can try it out myself?

ristomatti commented 5 months ago

I think this should be reopened. I've been thinking about making a feature request about this. My current workaround is to define part of the command as an alias but it's somewhat of an ugly hack. E.g. I do this:

notify = notify-send -t 5000 keymapper

Control{A} >> $(notify 'some notification')

# or
Control{B} >> do_something
do_something >> $(notify 'did something')

It would be nicer to be able to do something like this but AFAIK the config is not valid.

Control{B} >> do_something 'did something'
ristomatti commented 5 months ago

This is a "nice to have" kind of thing and I'm not sure if Keymapper should support this. Hence, no feature request so far. Features I'd love to see more than this:

I don't wish to flood with feature requests though, just throwing them out in case they'd spark interest in @houmain. 😬

houmain commented 5 months ago

Thank you for the feature requests! They all sound good. I think the discussions area would have been the right place for this list. Maybe you could create a topic there.

ristomatti commented 5 months ago

Good point, I've replied here https://github.com/houmain/keymapper/discussions/103.

houmain commented 5 months ago

Maybe you can give me your script so I can try it out myself?

No longer needed. I found the problem and fixed it in 3.5.2.