Jump to content

Live Text Actions: Transform Text/JSON with Python/JavaScript/Shell/jq As-You-Type


Recommended Posts

https://github.com/mr-pennyworth/alfred-live-text-actions/blob/main/README.md

 

This post could get stale over time. I'll keep the link above updated.

Text Actions

  • Process Text with
    • Python
    • Shell Commands
  • Process JSON with
    • Python
    • JavaScript
    • jq

Text Actions

Live Preview

Each text action, once triggered, shows a two-pane UI where the left pane shows the input text and the right pane shows the output text. The output text is updated as you type in Alfred.

 
354720143-3f7f7d1c-0d45-4665-a903-c1dcb6

 

The Python and Shell commands support live documentation. Just type ? after the command to see the documentation.

Python Docs

Python documentation

Shell Command Docs

Shell command man page

Edited by Mr Pennyworth
Add GIF
Link to comment

Thanks @Mr Pennyworth for creating, AlfredPane. I started using it for web and AI searches, and it's so good and saves so much time. I have two questions:

 

1.1 When the URL opens in the pane, is there a way to make it hover visible all the time except when I press esc key? Right now, when I click away from the pane, it disappears. 

1.2 Even the Alfred window disappears, so any way to keep Alfred window visible?

 

2. I tried understanding this live text action workflow and how it splits the pane into 2 cols but failed to do it. Can you please briefly explain how do it, or if you can create a toy example like this one

Link to comment
Quote

I tried understanding this live text action workflow and how it splits the pane into 2 cols but failed to do it. Can you please briefly explain how do it, or if you can create a toy example like this one

Sorry, I won't be able to write a tutorial anytime soon. I'm afraid understanding of HTML CSS is required to be able to build custom things with AlfredExtraPane. If you are a programmer, take a look at https://github.com/mr-pennyworth/alfred-live-text-actions/blob/7d8f179dde305ada9b3ad788f2894647ae0adf38/process-text.py#L244-L262 for code that generates the HTML displayed in the pane. This is the corresponding CSS file: https://github.com/mr-pennyworth/alfred-live-text-actions/blob/7d8f179dde305ada9b3ad788f2894647ae0adf38/process-text.css

 

Quote

1.1 When the URL opens in the pane, is there a way to make it hover visible all the time except when I press esc key? Right now, when I click away from the pane, it disappears. 

1.2 Even the Alfred window disappears, so any way to keep Alfred window visible?

I'm not sure whether there's a config / setting where you can "pin" alfred to the screen such that it disappears only after pressing escape and nothing else. Discussion here seems to suggest that there isn't a way

About the extra pane, right now, the behavior is that it'll hide when alfred hides. However, if you click the pane, then alfred hides, but the pane remains, and hides later when esc is pressed, or the user clicks outside / switches another app. I see that being able to further "pin" the extra pane (so that it stays on even after losing focus) could be valuable. I'll consider it for a future release 😇

Link to comment
  • 2 weeks later...

@Mr Pennyworth I'm noticing a bug in AlfredPane. When I search using AlfredPane, for some reason, it's also showing me the pane from the previous search I had done from a different pane. See screenshot below. I have ChatGPT configured to open in a pane, so I used it (it opens on the right side). Then I used google (which open below alfred) but both showed up. `g` keyword is only configured for google. I've posted all my configs below. 

 

Restarting AlfredPane didn't work. I had to restart Alfred, and then it worked. didn't do any changes to any workflow.

 

 

 

 

image.thumb.png.ae1295500998385065781bb78536cf5b.png

 

 

image.thumb.png.1f7f5d83aad4f0baa09b3c2ac11be073.png

 

 

```

[
  {
    "alignment": {
      "vertical": { "placement": "bottom", "height": 700, "width": 1000 }
    },
    "customUserAgent": "Mozilla/5.0 (Linux; Android 13; Pixel 2 Build/TP1A.220905.004) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.5790.171 Mobile Safari/537.36",
    "customCSSFilename": "style.css"
  }
]
 

```

 

```

body {
    zoom: 125%;
}

```

Edited by andy4222
Link to comment

@Mr Pennyworth I've been using AlfredPane more and more 😄.

 

Another weird thing I found was anything with width >=1200 breaks the rendering for some reason. Zoom level is 125%. As you can see, content on the left is trimmed off and I can scroll left. Same settings as my previous message (except width)

 

 

image.thumb.png.914b31fa0b1a2e8272745d1497f69ff0.png

 

 

 

 

Link to comment

Sorry @andy4222 I tried with the following settings and it worked showed the non-clipped view.

[
  {
    "alignment": {
      "vertical": { "placement": "bottom", "height": 700, "width": 1200 }
    },
    "customUserAgent": "Mozilla/5.0 (Linux; Android 13; Pixel 2 Build/TP1A.220905.004) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.5790.171 Mobile Safari/537.36",
    "customCSSFilename": "style.css"
  }
]

In your screenshot, I see that somehow Google is showing the desktop version instead of the mobile version.

At this point, the only thing worth checking again is whether the customUserAgent is correct (I'm using same one as you provided).

 

I'm not sure what's going wrong with your setup :(

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...