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 :)
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.
And, that other request which would go nicely with this one is bug 6635.
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!
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.
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.
Created attachment 5889 0001-Improve-keyboard-navigation-for-thunar-tree-view-bug.patch Another update. Refactoring and a small fix.
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.
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?
Created attachment 5891 0001-Improve-keyboard-navigation-for-thunar-tree-view-bug.patch Another update; Fix "already mounting" error message when expanding device.
Harald, are you confident that the patch can be released?
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.
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.
(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?
Yeah this patch is a worthy addition by itself IMHO, and then it would be easier to talk about other things afterwards.
Pushed to master: http://git.xfce.org/xfce/thunar/commit/?id=63b935ca42cb583cd64da99560aa7fce8d85d77b