KHotkeys: Action should not repeat

Philip Rodrigues philip.rodrigues at chch.ox.ac.uk
Fri Jan 5 22:13:56 GMT 2007


Florian Lindner wrote:

> Hello,
> I have some KHotkeys action that are activated by a keystroke that repeats
> when it's pressed for a longer time. But I don't want these actions to
> repeat. Just one keystrok, one execution of the action.
> How can I do that?

I don't think you can do it directly, since a "repeat" keystroke is the same
as an "initial" keystroke. Maybe make the keystroke run a script that looks
something like:

#!/bin/sh
if [ ! -e /tmp/somefile ]; then
        run_command
        exit
fi
else
        oldtime=`cat /tmp/somefile`
        newtime=`date "+%s"`
        if $(expr $newtime - $oldtime '>' 1); then
                run_command
                date "+%s" > /tmp/somefile
        fi
fi

ie, just test whether the command has already been run recently, and if so,
do nothing. Not ideal (and I haven't tested, so it probably doesn't work),
but might be enough for what you want.

Regards,
Philip
-- 
KDE Documentation Team: http://i18n.kde.org/doc
KDE Documentation Online: http://docs.kde.org

___________________________________________________
This message is from the kde mailing list.
Account management:  https://mail.kde.org/mailman/listinfo/kde.
Archives: http://lists.kde.org/.
More info: http://www.kde.org/faq.html.




More information about the kde mailing list