How to assign a keyboard shortcut to kdotool script in a file?
There are --shortcut and --name options but there is no option to pass file with the script.
Having a script in a file how to assign a keyboard shortcut for it using --shortcut option?
I'm unclear with the use case. Where is the script file from? If you manually write a script, you can put a registerShortcut(...); at the end, no need to use kdotool to load it.
I have the following bash script (see https://discuss.kde.org/t/keyboard-shortcut-to-minimize-all-windows-but-the-active-focused-one-so-called-shake-it-action/32061/3?u=piotr_dobrogost)
#!/bin/bash
# Minimize all but focused window (so called "shake it" action)
active_window_id=$(kdotool getactivewindow)
for window_id in $(kdotool search ".*")
do
if [ $window_id != $active_window_id ]; then
kdotool windowminimize $window_id
fi
done
and I thought I could pass it to kdotool with the --shortcut option to register KWin's keyboard shortcut for it.
Could you please give some example (better yet add it the README at https://github.com/jinliu/kdotool) showing how to use --shortcut option?
Maybe I should not be using bash for this? Basically it's unclear to me how to write a script that uses different kdotool commands and have it being registered using --shortcut option.
Please note that I do know how to register a shortcut in System Settings for a script and I have registered one for the above bash script but I'm curious if using kdotool's --shortcut option I could automate this and maybe even get rid of bash to avoid having it run each time I use the shortcut?