Using Forward/Back keys for expanding/collapsing folders in specific view

Hello,
I like to use the arrow keys on my keyboard (left/right) to expand/collapse the folders in detail-view BUT, if switched to thumbnail-view for going left/right to the next file.
I figured out, that I can use the arrow keys for expand/collapse by connecting them in customize/keyboard-dialog (add to ALT+ left/right) but then they don't work in thumbnail view for wandering left/right .
I guess I have to write some If-condition into the command like:
Go EXPANDBRANCH=collapse if view =detail else go left/right
but I don't know howto (I had an idea in Basic :wink: but this isn't basic, and that's all I know...)
I tried the following:
@disableif:Set VIEW=thumbnails
go expandbranch=collapse
but the keys still don't work in thumbnail-view for going left/right.
Thanks for any help!

Try

=return IsChecked("Set VIEW=Details") ? "Go EXPANDBRANCH=collapse" : "Select NEXT"

I have been tinkering as well to find a solution to this "if view =detail else go left/right"-problem.

@lxp does your solution work reliably?
Does it handle shift - selection? I guess it does not, hu? Being able to still hold shift and move the cursor around to get multiple thumbnails selected was were I reverted all of my changes, because I couldn't get this to work.

I settled with SHIFT+CTRL+left/right for now to be able to expand/collapse more easily, if I ever feel like it.

No, not at all. That's up to the hotkey :wink:

I wouldn't reassign a cursor key without a modifier, but that's personal preference.

Well, if you have a naive moment, you try! o) But after some tinkering you quickly realize, it's not that easy. If at all possible (I don't think it is). You would have to re-implement all the logic where the cursor keys are part of. It's not possible with the scripting API and I don't blame it, because this is important native event handling, not necessarily something you like to interfere with.

I used a single modifier CTRL or SHIFT + left/right afterwards, but realized that even though I can select next/previous thumbnails now again, I cannot shift select things anymore or keep the selection and just move the focus. I have both modifiers set now, since this does not seem to get in the way navigating or selecting things, I'm not totally sure yet though, maybe I will add ALT as well at some point! o))

I modified it to:
=return IsChecked("Set VIEW=Details") ? "Go EXPANDBRANCH" : "Select NEXT"
and
=return IsChecked("Set VIEW=Details") ? "Go EXPANDBRANCH=collapse" : "Select PREV"

Works perfect for me, thanks very much!