Jump to content

Timothy Harrell

Member
  • Posts

    7
  • Joined

  • Last visited

Reputation Activity

  1. Thanks
    Timothy Harrell reacted to vitor in Accessing clipboard history inside a Workflow   
    On a Workflow with multiple manual steps, you may find it useful to access recent clipboard history in order to pass along previously copied data to the next stage.

    But if you switch context to the Clipboard History Viewer, you lose your place in the Workflow. To avoid that, you can load your history into a Script Filter and place it between the relevant steps of your Workflow. This post provides working code to do just that.

    Things to note:
    This works by directly accessing Alfred’s clipboard history SQLite database, so it can be considered a hacky solution. Use at your own risk. That said, it only reads data. By default it shows the 40 most recent items from the clipboard history. Look for LIMIT 40 in the script to change that value. Only text entries are considered. Everything else is ignored. The code does not limit you to the clipboard contents. If you type something, that will be used instead. Paste the code in a Script Filter without a Keyword, Argument Optional, and Language set to /usr/bin/zsh --no-rcs.
     
    if [[ -n "${1}" ]] then /usr/bin/osascript -l JavaScript -e 'function run(argv) { return JSON.stringify({ items: [{ title: argv[0], arg: argv[0] }] }) }' "${1}" exit 0 fi /usr/bin/sqlite3 \ "${HOME}/Library/Application Support/Alfred/Databases/clipboard.alfdb" \ "SELECT JSON_OBJECT('items', JSON_GROUP_ARRAY(JSON_OBJECT( 'title', item, 'arg', item))) AS JSON_RESULT FROM ( SELECT item FROM clipboard WHERE dataType IS 0 ORDER BY ts DESC LIMIT 40)"  
  2. Like
    Timothy Harrell reacted to Andrew in Alfred uses incorrect layouts for keys with 3rd party keyboard tool   
    You're right, keyboard mapping and key discovery is not simple. Alfred isn't doing any switching or anything magical, he's just asking for the keycode, then dispatching that to macOS as it's provided, so any mapping or switching is happening automatically by macOS with the default layouts.
     
    If you ping me after Alfred 5 is out (I'm currently working flat out), I can take a bit of a deeper look at what macOS is providing differently with the 3 different layouts of QWERTY, DVORAK and DVORAK+QWERTY to hopefully provide you with a bit more insight into why your custom keyboard is operating differently.
  3. Like
    Timothy Harrell reacted to Andrew in Alfred uses incorrect layouts for keys with 3rd party keyboard tool   
    Alfred requests the keycode of the v key from macOS, then posts ⌘v into the macOS event stream.
     
    It's the keycode which is coming back incorrectly in your case.
  4. Like
    Timothy Harrell reacted to Andrew in Alfred uses incorrect layouts for keys with 3rd party keyboard tool   
    Alfred uses official [public] macOS APIs for key code discovery and dispatching. Alfred has no knowledge of the underlying keyboard setup, the macOS APIs take care of this, which is why both Dvorak and Dvorak + QWERTY ⌘ work as expected. It's unlikely that Alfred will deviate from using the macOS Public APIs for this, as this can lead to unforeseen incompatibility problems.
     
    I haven't heard of Ukelele before your post, so it's not possible for me to comment on why Alfred asking macOS to discover and dispatch ⌘V for automatic pasting works differently to the default macOS keyboard implementations. Having said that, Alfred 5 has a few things in store which will make adding a pairing of Copy to Clipboard and Dispatch Key Combo less laborious.
     
    Note that by design, in the dispatch key combo object, Alfred shows the raw character by design (e.g. ⌘J for Dvorak + QWERTY ⌘'s position for ⌘C).
×
×
  • Create New...