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

2 messages from 2016-03-29 to 2016-03-31. Participants: Harish K, David Aguilar.
Thread: https://gitlist.dev/t/41859

## Harish K, 2016-03-29 11:29

Subject: [PATCH] Feature: custom guitool commands can now have custom keyboard shortcuts
Message-ID: <01020153c222ebc0-a691d562-ece3-4b35-908a-a0487e912879-000000@eu-west-1.amazonses.com>
URL: https://gitlist.dev/e/01020153c222ebc0-a691d562-ece3-4b35-908a-a0487e912879-000000%40eu-west-1.amazonses.com

```
---
 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

```

## David Aguilar, 2016-03-31 16:49

Subject: Re: [PATCH] Feature: custom guitool commands can now have custom keyboard shortcuts
Message-ID: <20160331164944.GB11150@gmail.com>
URL: https://gitlist.dev/e/20160331164944.GB11150%40gmail.com
In-Reply-To: <01020153c222ebc0-a691d562-ece3-4b35-908a-a0487e912879-000000@eu-west-1.amazonses.com>

```
On Tue, Mar 29, 2016 at 11:29:41AM +0000, Harish K wrote:
> ---
>  git-gui/lib/tools.tcl | 16 +++++++++++++---
>  1 file changed, 13 insertions(+), 3 deletions(-)


I forgot to mention that git-gui has its own repository.
The git project merges the upstream repo as a subtree into its
git-gui directory.

You should probably clone the git-gui repository and create a
patch there so that it can be applied to the upstream repo:

http://repo.or.cz/w/git-gui.git
-- 
David

```
