! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
navigating with "left"/"right" keys in tree side pane
Status:
RESOLVED: FIXED
Severity:
enhancement

Comments

Description hellohello 2008-10-26 08:31:50 CET
it would be nice to be able to navigate the tree pane with the cursor keys alone.
up and down is already implemented, the problem is how to expand subdirectories/subtrees: they get expanded, when you hit enter but focus changes to the main view and you have to get back with shift+tab.
the other possibility is to use "+" to expand and "-" to collapse. this works as i want it... but those keys are a bit away from up/down...
left/right do not have any function in the tree view at the moment, so it would be no problem if the behaviour of +/- gets mapped to left/right and that would be ergonomically optimal imho.

(btw thats they way it works in windows explorer. dont hate me, but windows explorer from a gui (especially keyboard wise) perspective is much better than any other filemanager ive seen. but thunar looks very promising :)
Comment 1 Daniel Lopez 2010-08-12 23:46:17 CEST
I'd like this too. I agree with everything H M wrote. Generally I miss not being able to navigate the directory tree with one hand like on Windows.

I'll describe the behaviour in pseudo-program-like detail in case it helps and in case people don't have a Windows nearby. When the keyboard focus is in the tree pane:

 Cursor up/down: move highlight up or down (it does this already of course).

 Cursor right:
  - If highlight is on a directory that has child folders and is collapsed, expand it, leaving the highlight on the parent directory.
  - If highlight is on a directory that has child folders and is already expanded, move the highlight to the first child directory.
  - If highlight is on a directory that has no child folders, do nothing.

 Cursor left:
  - If highlight is on a directory that has child folders and is expanded, collapse it, leaving the highlight on the parent directory.
  - If highlight is on a directory that has child folders and is already collapsed, move the highlight to the parent directory.
  - If highlight is on a directory that has no child folders, move the highlight to the parent directory.

If this change is made, then there's another enhancement (also inspired by Windows) which would naturally complement this one - I'll open a seperate request for that and add a link here afterwards.
Comment 2 Daniel Lopez 2010-08-13 00:20:11 CEST
And, that other request which would go nicely with this one is bug 6635.
Comment 3 Daniel Lopez 2014-11-07 04:40:11 CET
Created attachment 5729 
Enable navigating with "left"/"right" keys in tree side pane

Well, after finally switching to Linux full time, I finally took it upon myself to implement this. Here's a patch!
Comment 4 Harald Judt 2015-01-31 11:34:55 CET
Created attachment 5887 
0001-Improve-keyboard-navigation-for-thunar-tree-view-bug.patch

Improved the original patch by Daniel Lopez:

* Fixed a compiler warning
* Added handling of space key
  - space shows the selected folder in the right pane
  - tree-view will keep focus so user can continue navigating with left/right

This patch applies to current git master.
Comment 5 Harald Judt editbugs 2015-01-31 20:37:11 CET
Created attachment 5888 
0001-Improve-keyboard-navigation-for-thunar-tree-view-bug.patch

Updated patch. Now left/right expand/collapse, up/down work as usual, and all actions force the right pane to show the selection in the tree view.
Comment 6 Harald Judt editbugs 2015-01-31 20:42:10 CET
Created attachment 5889 
0001-Improve-keyboard-navigation-for-thunar-tree-view-bug.patch

Another update. Refactoring and a small fix.
Comment 7 Harald Judt editbugs 2015-01-31 20:50:21 CET
There is still a problem with the "Desktop" item; It will cause the home/Desktop folder to expand and the tree view selection jumps to that (previous) entry.
Comment 8 Harald Judt editbugs 2015-01-31 22:48:51 CET
Created attachment 5890 
0001-Improve-keyboard-navigation-for-thunar-tree-view-bug.patch

Updated patch with further cleanup and a fix for the top-level Desktop item. I decided one has to open this manually, otherwise it breaks key navigation.

Actually this problem should be fixed in another place, as the same bad thing happens when you click on Desktop with the mouse. I wonder what use is the Desktop item, when it then opens in another subtree?
Comment 9 Harald Judt editbugs 2015-02-01 10:27:36 CET
Created attachment 5891 
0001-Improve-keyboard-navigation-for-thunar-tree-view-bug.patch

Another update; Fix "already mounting" error message when expanding device.
Comment 10 Steve Dodier-Lazaro editbugs 2015-02-08 19:15:20 CET
Harald, are you confident that the patch can be released?
Comment 11 Harald Judt editbugs 2015-02-08 19:18:25 CET
I uploaded it here for review. Someone *should* review/test it before releasing it. That said, I did some tests and do not know of any problems it could cause.
Comment 12 Daniel Lopez 2015-02-13 03:01:26 CET
I've given it a quick spin and it seems good to me. Pleased to see the right pane automatically updating as well (I had a less concise implementation of this in my own build but was saving it for a seperate bug).

Don't get me wrong, Harald's newest patch is a big improvement from the current behaviour and I would be happy to see it in the main release as is - only, the rest of this comment will be nit picking and a seperate idea which I might better raise as a different bug later.

The Return/Enter/Space keys previously toggled the highlighted folder between expanded and collapsed, but now they don't do anything except in the case of that awkward top-level Desktop item, where pressing one of these keys causes the highlight to move to the 'real' Desktop folder in your home directory.

I agree with this workaround for the disorienting Desktop jump, and I'm not bothered by the loss of a key to toggle expanded/collapsed (since there is now the left and right arrow keys). However I reckon it would be now useful if the Return and Enter keys moved the keyboard focus to the right pane (should it also expand the folder in the left pane at the same time? I'm in two minds about that). It is possible to move the focus by pressing Tab but that's all the way over the other side of the keyboard from the arrow keys.

In the case of the top-level Desktop item, I'm not sure, but I think the best thing might be for one press of Return/Enter to move the highlight to the 'real' Desktop folder but leave the keyboard focus in the left pane, and then another press of Return/Enter with the highlight on the 'real' Desktop to then move the keyboard focus to the right pane.

I tried to code this just now but I can't figure out what to write to explicitly set the focus to the right pane. I think the function I need to call might be thunar_standard_view_grab_focus but I don't know how to get a pointer to the ThunarStandardView widget (is this widget the right pane?) that it needs as a parameter.
Comment 13 Harald Judt editbugs 2015-02-13 14:16:15 CET
(In reply to Daniel Lopez from comment #12)
> The Return/Enter/Space keys previously toggled the highlighted folder
> between expanded and collapsed, but now they don't do anything except in the
> case of that awkward top-level Desktop item, where pressing one of these
> keys causes the highlight to move to the 'real' Desktop folder in your home
> directory.

Restoring collapsing/expanding for space and return would be trivial.

> I agree with this workaround for the disorienting Desktop jump, and I'm not
> bothered by the loss of a key to toggle expanded/collapsed (since there is
> now the left and right arrow keys). However I reckon it would be now useful
> if the Return and Enter keys moved the keyboard focus to the right pane
> (should it also expand the folder in the left pane at the same time? I'm in
> two minds about that). It is possible to move the focus by pressing Tab but
> that's all the way over the other side of the keyboard from the arrow keys.

At first, I did not want focus to change, but that was before I implemented the auto-update of the standard view. But read on...

> In the case of the top-level Desktop item, I'm not sure, but I think the
> best thing might be for one press of Return/Enter to move the highlight to
> the 'real' Desktop folder but leave the keyboard focus in the left pane, and
> then another press of Return/Enter with the highlight on the 'real' Desktop
> to then move the keyboard focus to the right pane.
> 
> I tried to code this just now but I can't figure out what to write to
> explicitly set the focus to the right pane. I think the function I need to
> call might be thunar_standard_view_grab_focus but I don't know how to get a
> pointer to the ThunarStandardView widget (is this widget the right pane?)
> that it needs as a parameter.

I only gave it a _quick_ glance, but I believe thunar is missing code that allows this kind of interaction. One would need to write code to make the views accessible to each other. Then, it would be easier to implement a consistent behaviour for the return/space key too; Because even when applying a trivial change like I mentioned the resulting behaviour is different whether a node or a leaf of the view is selected etc. I prefer consistent behaviour to this solution.

So maybe we push this version of the patch first, then try to improve the tree view gradually?
Comment 14 Daniel Lopez 2015-02-13 22:03:24 CET
Yeah this patch is a worthy addition by itself IMHO, and then it would be easier to talk about other things afterwards.

Bug #4519

Reported by:
hellohello
Reported on: 2008-10-26
Last modified on: 2015-02-19

People

Assignee:
Harald Judt
CC List:
5 users

Version

Version:
unspecified

Attachments

Additional information