nickvdp / RecentTabList

A Safari extension to list and filter recently closed tabs
51 stars 6 forks source link

Open with keyboard shortcut (AppleScript workaround inside!!) #13

Open bjartek opened 6 years ago

bjartek commented 6 years ago

Hello,

Is it possible to add a keyboard shortcut to open the dialog?

gingerbeardman commented 6 years ago

It is possible to do this yourself using AppleScript and other tools. I chose Alfred.app

Requirement: System Preferences > Security & Privacy > Accessibility to be checked on for Alfred 3.

tell application "System Events" to tell process "Safari"

    with timeout of 0 seconds
        set allElements to entire contents of toolbar 1 of window 1
    end timeout

    repeat with uiElement in allElements
        if class of uiElement is button and description of uiElement is "Recent Tab List" then click uiElement
    end repeat

end tell

I use Alfred to trigger the AppleScript using a hotkey or keyword.

screen shot 2018-06-06 at 16 38 04

Here's my workflow: https://0x0.st/s_jz.zip