git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
harish k <harish2704@gmail.com>
Date
Apr 1, 2016, 06:32 UTC
Message-ID
<CACV9s2MFiikZWq=s8kYQ+qwidQ=oO-SHyKWAs4MUkNcgDhJzeg@mail.gmail.com>
In-Reply-To
<20160331164137.GA11150@gmail.com>
Hi David,

Actually Im a TCL primer. This is the first time Im dealing with. That is why I kept it simple ( ie both accel-key and accel-label need to be defined in config ).

I think, git-cola is using Qt style representation accel-key in the config file.
Is git-cola is an official tool from git ? like git-gui?
if not ,
My suggesion is, it is better to seperate config fields according to
application-domain
like, "git-gui-accel = <Ctrl-l>" etc..
Other vise there is good chance for conflicts. ( Eg: consider the case
 that, <Ctrl-p> was assined to a custom tool by git-cola )

Currently this patch will not handle any conflicting shortcuts. I think custom shortcuts will overwrite the other.

On Thu, Mar 31, 2016 at 10:11 PM, David Aguilar <davvid@gmail.com> wrote:
Show 70 quoted lines
> Hello,
>
> On Tue, Mar 29, 2016 at 11:38:10AM +0000, Harish K wrote:
>> ---
>>  git-gui/lib/tools.tcl | 16 +++++++++++++---
>>  1 file changed, 13 insertions(+), 3 deletions(-)
>>
>> diff --git a/git-gui/lib/tools.tcl b/git-gui/lib/tools.tcl
>> index 6ec9411..749bc67 100644
>> --- a/git-gui/lib/tools.tcl
>> +++ b/git-gui/lib/tools.tcl
>> @@ -38,7 +38,7 @@ proc tools_create_item {parent args} {
>>  }
>>
>>  proc tools_populate_one {fullname} {
>> -     global tools_menubar tools_menutbl tools_id
>> +     global tools_menubar tools_menutbl tools_id repo_config
>>
>>       if {![info exists tools_id]} {
>>               set tools_id 0
>> @@ -61,9 +61,19 @@ proc tools_populate_one {fullname} {
>>               }
>>       }
>>
>> -     tools_create_item $parent command \
>> +     if {[info exists repo_config(guitool.$fullname.accelerator)] && [info exists repo_config(guitool.$fullname.accelerator-label)]} {
>> +             set accele_key $repo_config(guitool.$fullname.accelerator)
>> +             set accel_label $repo_config(guitool.$fullname.accelerator-label)
>> +             tools_create_item $parent command \
>>               -label [lindex $names end] \
>> -             -command [list tools_exec $fullname]
>> +             -command [list tools_exec $fullname] \
>> +             -accelerator $accel_label
>> +             bind . $accele_key [list tools_exec $fullname]
>> +     } else {
>> +             tools_create_item $parent command \
>> +                     -label [lindex $names end] \
>> +                     -command [list tools_exec $fullname]
>> +     }
>>  }
>>
>>  proc tools_exec {fullname} {
>>
>> --
>> https://github.com/git/git/pull/220
>
> We also support "custom guitools" in git-cola using this same
> mechanism.  If this gets accepted then we'll want to make
> similar change there.
>
> There's always a small risk that user-defined tools can conflict
> with builtin shortcuts, but otherwise this seems like a pretty
> nice feature.  Curious, what is the behavior in the event of a
> conflict?  Do the builtins win?  IIRC, Qt handles this by
> disabling the shortcut and warning that it's ambiguous.
>
> Please documentation guitool.<name>.accellerator[-label] in
> Documentation/config.txt otherwise users will not know that it
> exists.
>
> It would also be good for the docs to clarify what the
> accelerators look like in case we need to munge them when making
> it work in cola via Qt, which has its own mechanism for
> associating actions with shortcuts.  Documented examples with
> one and two modifier keys would be helpful.
>
>
> cheers,
> --
> David
-- 
-Regards
Harish.K
Previous: David AguilarNext: harish k
Message 3 of 27 in “Feature: custom guitool commands can now have custom keyboard shortcuts”
  1. Feature: custom guitool commands can now have custom keyboard shortcutsHarish K, Mar 29, 2016
  2. David AguilarMar 31, 2016
  3. harish kApr 1, 2016
  4. harish kOct 3, 2019
  5. Pratyush YadavOct 3, 2019
  6. Johannes SchindelinOct 4, 2019
  7. Pratyush YadavOct 4, 2019
  8. Harish KarumuthilOct 5, 2019
  9. Pratyush YadavOct 5, 2019
  10. Johannes SchindelinOct 6, 2019
  11. Pratyush YadavOct 6, 2019
  12. Philip OakleyOct 6, 2019
  13. Johannes SchindelinOct 6, 2019
  14. Pratyush YadavOct 6, 2019
  15. GitGUIGadget, was Re: [PATCH] Feature: custom guitool commands can now have custom keyboard shortcutsJohannes Schindelin, Oct 7, 2019
  16. Birger Skogeng PedersenOct 7, 2019
  17. Alban GruinOct 7, 2019
  18. Making GitGitGadget's list -> PR comment mirroring bidirectional, was Re: [PATCH] Feature: custom guitool commands can now have custom keyboard shortcutsJohannes Schindelin, Nov 19, 2019
  19. Pratyush YadavNov 20, 2019
  20. Philip OakleyOct 6, 2019
  21. Harish KarumuthilOct 7, 2019
  22. Johannes SchindelinOct 7, 2019
  23. Harish KarumuthilOct 8, 2019
  24. Johannes SchindelinOct 9, 2019
  25. Pratyush YadavOct 13, 2019
  26. Harish KarumuthilOct 7, 2019
  27. Pratyush YadavOct 13, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.