Patch for "Open Terminal Here" keyboard shortcut

Jannis Pohlmann jannis at xfce.org
Tue Nov 8 14:46:44 CET 2011


On Mon, 7 Nov 2011 11:53:13 +0100
Nick Schermer <nickschermer at gmail.com> wrote:

> On Mon, Nov 7, 2011 at 11:37 AM, Yves-Alexis Perez
> <corsac at debian.org> wrote:
> > On lun., 2011-11-07 at 03:34 +0100, Jannis Pohlmann wrote:
> >> I've pushed this to the jannis/file-menu-custom-actions branch:
> >>
> >>
> >> http://git.xfce.org/xfce/thunar/commit/?h=jannis/file-menu-custom-actions&id=36dea6078ac20c1285342ff1d7d09a212e183f5b
> >>
> >> The keyboard shortcut part of this change turns out to be more
> >> complicated than I first thought. It's working but as soon as the
> >> order of menu items provided by plugins changes, shortcuts may be
> >> switched (e.g. F4 assigned to "open in terminal" may suddenly be
> >> assigned to "open in ristretto"). I'll see if I can find a way to
> >> fix that.
> >
> > Can't people just set a gtk accelerator for that?
> 
> I'd store an id in the xml file that is set during creation and use
> that GtkAction's name. Possible id's are printf("%ld%d", timenow(),
> staticcounter++) or max_id + 1.

Yep, that's what I thought too. It's not exactly easy to guarantee 100%
persistent IDs because existing custom actions and future
(possibly user-created) custom actions both need to be handled in
different ways.

I've come up with a solution in the jannis/file-menu-custom-actions
branch:

  http://git.xfce.org/xfce/thunar/log/?h=jannis/file-menu-custom-actions

In particular, this commit is relevant (for explanations see the commit
message):

  http://git.xfce.org/xfce/thunar/commit/?h=jannis/file-menu-custom-actions&id=d99e85d67d27ece202c0a79a0c916d21558a9e61

Can anyone look over this and try to spot possible issues with this
approach?

> This needs to be made clear to other menu providers as well (like vcs
> plugin), but that's the cleanest solution imho.

Yes, other plugins need to yield unique and persistent action names as
well. I wonder how to best achieve this... leave it to plugin authors?
It is not a requirement for plugins to return all actions and always
return them the same order. That makes it complicate as we cannot
simply enumerate the actions we receive. So I guess uniqueness needs to
be provided by plugins as part of the action names.

  - Jannis


More information about the Xfce4-dev mailing list