Re: [PATCH] Feature: custom guitool commands can now have custom keyboard shortcuts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Harish,

On Mon, 7 Oct 2019, Harish Karumuthil wrote:

> > However, it might not even need to put in _such_ a lot of work: in my
> > tests, `Control-,` worked just as well as `Control-comma`. To test this
> > for yourself, use this snippet (that is slightly modified from the
> > example at the bottom of https://www.tcl.tk/man/tcl/TkCmd/bind.htm so
> > that it reacts _only_ to Control+comma instead of all keys):
> >
> > -- snip --
> > set keysym "Press any key"
> > pack [label .l -textvariable keysym -padx 2m -pady 1m]
> > #bind . <Key> {
> > bind . <Control-,> {
> >     set keysym "You pressed %K"
> > }
> > -- snap --
>
> I tried this, but unfortunatly, it didn't worked for me. My tclsh version is
> "8.6".  The script crashed with following error message
>
> ---
> bad event type or keysym ","
>     while executing
> "bind . <Control-,> {
>     set keysym "You pressed %K"
> }"
>     (file "./test.tcl" line 6)
> ---

That's too bad! I tested this on Windows, and I imagine it just does not
work on Linux/macOS...

> The complete ( or modified ) script which I used is given below
>
> ---
> package require Tk
>
> set keysym "Press any key"
> pack [label .l -textvariable keysym -padx 2m -pady 1m]
> #bind . <Key> {
> bind . <Control-,> {
>     set keysym "You pressed %K"
> }
>
> ---
>
> From the error messages, I understand that, "<Control-,>" will not work
> instead of "<Control-comma>" .
>
> >
> > So I could imagine that something like this could serve as an initial
> > draft for a function that you can turn into a "good enough" version:
> >
> > -- snip --
> > proc QKeySequence2keysym {keystroke} {
> > 	regsub -all {(?i)Ctrl\+} $keystroke "Control-" keystroke
> > 	regsub -all {(?i)Alt\+} $keystroke "Alt-" keystroke
> > 	regsub -all {(?i)Shift\+} $keystroke "Shift-" keystroke
> > 	return $keystroke
> > }
> > -- snap --
> >
> > That way, you don't have to introduce settings separate from
> > `git-cola`'s, and you can reuse the short-and-sweet variable name.
>
> If my previous observation is correct, then we may have to translate a list
> of key names ( in addition to atl,ctrl & shirt ) to get it working .

I fear you're right. Hopefully we can get away with a relatively short
list...

Ciao,
Johannes




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux