16

Is there an way of modding OSX so that it behaves a little more like Windows 7. Specifically I really want to be able to press BACKSPACE and for Finder to show the previous folder... just like Windows and Firefox both do.

I hope that's clear.

3 Answers 3

7

While the solution offered by barbaz is a decent one, there actually is a perfect one :), which removes the limitation that doesn't allow you to use Backspace in text fields in Finder (e.g. when renaming files, or typing in the search field).

  1. Install an awesome Karabiner app that allows you to remap almost anything you don't like to anything you like
  2. Find and edit private.xml file per instructions in the link (and read how to update Karabiner to include private.xml in the main list when you get to step 4)
  3. Insert the following code and save private.xml file:

    <item> <name>Backspace in Finder moves Up</name>⌥ <appendix> (except when editing text fields)</appendix> <identifier>private.Backspace_MoveUp</identifier> <only>FINDER</only> <uielementrole_not>AXTextArea, AXTextField</uielementrole_not> <autogen>__KeyToKey__ KeyCode::DELETE, ModifierFlag::NONE, KeyCode::CURSOR_UP, VK_COMMAND</autogen> </item>

    This does the following:

    • Assigns ⌥ Opt + ↑ to Backspace key.
      • Note: in my OS X Yosemite it is the shortcut for 'Go Up' command in Finder (e.g. it always goes to the folder one level above the one you're in). If you don't like the 'Go Up' command and would like to go to the previous folder - define your own shortcut as per babraz' answer, then paste the respective key combination instead of CURSOR_UP, VK_COMMAND code above
    • Limits this command to Finder only
    • Limits this command to non-text fields only
  4. Open Karabiner and click on "ReloadXML" button (see link in 2. for details on how to add custom private.xml)
  5. Select "Backspace in Finder moves up" command
  6. Enjoy :)
5
  • I've not tried this, but it looks great. Thanks for the answer, and thanks for letting me know about "Go Up", too. I didn't even know that was a possibility. Commented Nov 10, 2014 at 22:09
  • Glad you liked it, but don't just look at it - do try it out ;) It's a great utility for any Windows user working on Mac as it allows you not to strain muscle memory too much or get the regular Windows functions on Mac (I've remapped Shift-Backspace to Delete this way, F2 to file rename, Enter to open file instead of rename, made Alt-Tab possible as in Windows, made Capslock a regular Shift key, etc.) By the way, re. the "Go Up" - in case you didn't know, it's possible to make Backspace "go up" instead of "go back" in Windows 7/8 as well - in case you prefer this old XP style.
    – Evgeny
    Commented Nov 10, 2014 at 22:56
  • I don't belive the file private.xml still exists...
    – Sharcoux
    Commented Dec 12, 2017 at 14:43
  • I couldn't find private.xml - OS: Mojave. Karabiner: 12.2.0 Commented Mar 21, 2019 at 16:03
  • @LucasBustamante Apple broke Karabiner in newer OS versions :(, what you're using is Karabiner-Elements, which doesn't allow this type of customization
    – Evgeny
    Commented Mar 29, 2019 at 20:28
7

You can press CMD-[ (as shown in the "Go" menu). Using the regular way from there (Keyboard Preferences -> Keyboard Shortcuts and assign a new shortcut for the "Back" entry) doesn't work since the "Keyboard Shortcut" field does not accept the backspace character. But you can:

  • Go to System Preferences, Keyboard, Keyboard shortcuts
  • Create a new keyboard shortcut for Finder with the Menu Title "Back" enter image description here
  • Use any arbitrary keyboard shortcut

Then edit the file $HOME/Library/Preferences/com.apple.finder.plist and change the keyboard shortcut to "⌫" for example using XCode:

enter image description here

Now, if you restart Finder (using killall Finder or the Force Quit Applications dialog) you will be able to use the shortcut:

enter image description here

However, as pointed out in the comments, the backspace key is probably not usable in the keyboard dialog for a reason, since using it as a shortcut will trigger the action when you have the cursor in an edit box, where you'd want backspace to remove characters.

8
  • This looks very helpful indeed, but I don't have the file $HOME/Library/Preferences/com.apple.finder.plist :-/ ? Commented Jul 6, 2011 at 15:06
  • 1
    Whats your OS X version? I only have a 10.6 at hand, and here the Finder preferences are definitely stored in that file. $HOME is your homefolder (/Users/<username>).
    – barbaz
    Commented Jul 6, 2011 at 15:24
  • 2
    Or defaults write com.apple.finder NSUserKeyEquivalents -dict-add "Back" "\U232B"; killall Finder. This isn't a practical solution though, it overrides the function of ⌫ (deleteBackward:) in text fields.
    – Lri
    Commented Jul 6, 2011 at 15:52
  • 1
    @Johnny skip all that with XCode and the plist editor, just use the command that Lri suggested. However, as already pointed out by him, using backspace for going back in Finder is not a good idea, since it will also be triggered when you actually want to use backspace (for example when you rename a file and want to hit backspace to erase a character). I guess the best solution is simply to get used to CMD-[ as this is the native keyboard shortcut.
    – barbaz
    Commented Jul 6, 2011 at 17:25
  • 1
    @barbaz, Thanks for the clarifying. Shame it can't be done. I guess I'll have to adapt. Commented Jul 7, 2011 at 20:51
5

Althouhg the most voted answer, with the "uielementrole_not", was perfect back in the day, it doesn't work in the lastest versions of Karabiner, as uielementrole_not is not an option available.

Being unable to add that specific condition had very bad side effects like the one the original poster says and others.

Well, I have found a way to avoid that in newer versions, using Karabiner variables. The idea is detecting when you are in edit mode. It's far from being perfect (see notes at the bottom) but it's far better than nothing.

This is the list of keystrokes and how they should work:

  • F2 ----> Rename file
  • Enter -> Open file
  • Backspace --> Upper folder

This is what I do:

  • When someone presses F2 on Finder I replace with enter (default key for "rename") and set "onedit" variable to 1
  • When someone presses Enter or Esc on Finder, if onedit=1 then I keep same key code and set onedit to 0.
  • When someone presses enter and onedit=0, then I send the keystrokes for "open"
  • When someone presses backspace and onedit=0, then I send the keystrokes for "folder up"
  • When someone presses backspace and onedit=1, then I keep the backspace key

These are all the rules to perform that:

{
    "description": "Use F2 as Rename and enter edit mode",
    "manipulators": [
        {
            "conditions": [
                {
                    "bundle_identifiers": [
                        "^com.apple.finder"
                    ],
                    "type": "frontmost_application_if"
                }
            ],
            "from": {
                "key_code": "f2"
            },
            "to": [
                    {"key_code": "return_or_enter"},
                    {"set_variable": 
                        {
                        "name": "onedit",
                        "value": 1
                        }
                    }
            ],
            "type": "basic"
        }
    ]
}
,
{
    "description": "Use Backspace as Go to Previous Folder in Finder if not editing",
    "manipulators": [
        {
            "conditions": [
                {
                    "bundle_identifiers": [
                        "^com.apple.finder"
                    ],
                    "type": "frontmost_application_if"
                }
                ,
                {
                    "type": "variable_unless",
                    "name": "onedit",
                    "value": 1
                }
            ],
            "from": {
                "key_code": "delete_or_backspace"
            },
            "to": [
                {
                    "key_code": "open_bracket",
                    "modifiers": [
                        "left_command",
                        "left_option"
                    ]
                }
            ],
            "type": "basic"
        }
    ]
},
{
    "description": "Use Return as Open if not renaming file",
    "manipulators": [
        {
            "conditions": [
                {
                    "bundle_identifiers": [
                        "^com.apple.finder"
                    ],
                    "type": "frontmost_application_if"
                }
                ,
                {
                    "type": "variable_unless",
                    "name": "onedit",
                    "value": 1
                }
            ],
            "from": {
                "key_code": "return_or_enter",
                "modifiers": {
                    "optional": [
                        "any"
                    ]
                }
            },
            "to": [
                {
                    "key_code": "o",
                    "modifiers": [
                        "right_command"
                    ]
                }
            ],
            "type": "basic"
        }
    ]
},
{
    "description": "Use Return to finish renaming when onedit=1",
    "manipulators": [
        {
            "conditions": [
                {
                    "bundle_identifiers": [
                        "^com.apple.finder"
                    ],
                    "type": "frontmost_application_if"
                },
                {
                    "name": "onedit",
                    "type": "variable_if",
                    "value": 1
                }
            ],
            "from": {
                "key_code": "return_or_enter",
                "modifiers": {
                    "optional": [
                        "any"
                    ]
                }
            },
            "to": [
                {"key_code": "return_or_enter"},
                {"set_variable": 
                    {
                    "name": "onedit",
                    "value": 0
                    }
                }
            ],
            "type": "basic"
        }
    ]
},
{
    "description": "Use Esc to finish renaming when onedit=1",
    "manipulators": [
        {
            "conditions": [
                {
                    "bundle_identifiers": [
                        "^com.apple.finder"
                    ],
                    "type": "frontmost_application_if"
                },
                {
                    "name": "onedit",
                    "type": "variable_if",
                    "value": 1
                }
            ],
            "from": {
                "key_code": "escape",
                "modifiers": {
                    "optional": [
                        "any"
                    ]
                }
            },
            "to": [
                {"key_code": "escape"},
                {"set_variable": 
                    {
                    "name": "onedit",
                    "value": 0
                    }
                }
            ],
            "type": "basic"
        }
    ]
}

Notes:

  • Any press of F2 on Finder will make Karabiner enter in rename mode, so if you press F2 on anything that is not a file, backspace and other Windows-like shortcuts will stop working until you press Esc or Enter.
  • Make sure you don't have any other rules for F2, Enter, Backspace, as they may trigger before this rules and mess it all up.
2
  • 1
    Thx, adjusted your definition and it is a solution for now. open "karabiner://karabiner/assets/complex_modifications/import?url=https://gist.githubusercontent.com/honsa/f8396f9f0d33609ebac1a48a43ef835f/raw/26f5f2071e7dd133f3bfa47490711214ada12ceb/finder-navigation-karabiner.json" Commented Dec 1, 2021 at 21:23
  • Thanks! That was it. F2 problem was driving me crazy
    – Vladan
    Commented Aug 17, 2023 at 13:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .