keyboard shortcut to position tab How can I set up keyboard shortcuts to put a tab into a position?

⌘1 for example selects the first tab, can I make a keyboard shortcut like ⌘⌥1 to make my current tab the first tab in the tab bar?
If you are using Chrome, the Rearrange Tabs extension works perfectly.



For Safari, you can setup an Automator service to run this Applescript and bind it to a key combination:



tell application "Safari"
    activate
    tell front window
        move current tab to before first tab
        -- for some reason it just creates a new tab with the same URL,
        -- so we need to do this:
        close current tab
        set current tab to tab 1
    end tell
end tell


To set up an Automator service and assign a keyboard shortcut to it:

Edit: On macOS Mojave in Automator, services might be named "Quick Action" or "Contextual Workflow".


Open Automator and choose "New Document"
Select service as the type of document
At the top, set it to "Sevice receives no input in Safari" like this:

Search for and drag in a "Run Applescript" action
Replace the (* Your script goes here *) text with the code from earlier
Test the script to make sure it works with the Run button
Save the service with whatever name you want
Close Automator and now go to System Preferences > Keyboard > Shortcuts > Services
Find the service that you just created(it should be in the "General" section) and use the "Add Shortcut" button to add a keyboard shortcut for it.

Now you should be able to use the keyboard shortcut.


Here's a GIF of it in action:


Unfortunately, there is no way to prevent the reloading of the tab when moving it. It is impossible to get the same effect as actually dragging the tab to move it.