I think the example was silly, but think about finding the epoch in, say, a log file. With this system you could just click and see the human readable. With the date command you'd have to switch to terminal, type "date -r", paste, enter.
Yes! I was doing that for a while with a command-line tool. I couldn't make up my mind which way was faster. They were both required some sort of motor skill (e.g. switch to terminal, paste, enter) to perform the flows quickly.
Looks somewhat similar to Popclip[0], but is less intrusive(user needs to be explicit) and more visual(result is shown below).
Very interesting solution for text manipulation. (A bit off topic but...) Seeing these tools which primary interaction happens with the clipboard make me think that the GUI equivalent of UNIX pipes is the clipboard — it allows programs to interoperate in an unstructured fashion.
Tip is less intrusive and targets programmers (because your provide the script). PopClip is more out-of-the-box and more automatic (I assume PopClip monitors mouse events, but not sure).
I wanted to build Tip for Ubuntu as well but I couldnt find a good mechanism. Mac OS's system-wide service is such a beautiful mechanism. Slick and offer the right level of privacy.
Quick note on text manipulation. Mac's system-wide service can modify text as well!... But sadly I couldn't make it work in a slick way. I might need to attempt at it again
> I wanted to build Tip for Ubuntu as well but I couldnt find a good mechanism.
The selected text would already be on the 'PRIMARY' uh.. clipboard (I hesitate because that's not the 'CLIPBOARD' one and I'm not sure of the genetic term). I would then use dmenu (or equivalent, e.g. rofi) to show the options generated by the script running on the selection.
That wouldn't be a tooltip, (unless there are dmenu-like programs that can be configured to appear at the pointer, I'm not sure) but is probably how most Linux users would expect/want it to appear.
To be honest though, since the target user is already supplying the script to generate it, I think you've given the value you can in the idea, and they're best placed to know how to integrate it into their existing tools most effectively.
If the user's writing the script anyway, they can write that, and the details vary according to the window manager (or other tool used to bind keys) and the dmenu-like used to display them. Some may also prefer a different/better integration with their clipboard manager.
My basic point is that Linux systems are too 'fragmented' and this is too easy for you to a better job once for everybody than they can each do once for themselves.
It's a great idea though, I'm certainly going to bear it in mind and see what I do that could benefit from it, thanks!
Ah, yes, now I remember the clipboard on Ubuntu. A selected text is immediately copied to clipboard, and we can use the middle mouse button to paste
The idea is very interesting. Basically, I only build the part where Tip takes the text and invokes a script. User then renders the tooltip themselves.
One of them! Internally, the structure is called "pasteboard", and the clipboard is the "general" one. The OS uses this same data structure for transferring drag-and-drop data, which is the other common GUI mechanism for ad-hoc interoperability.
You can do similar stuff with Alfred, which happens to already be quite useful for frequent tasks. At least with Alfred 2, dunno about new versions. Create a workflow, put in a single hotkey trigger block and choose for it to pop up Alfred's window with the selection and the cursor in the beginning. I'm using alt-shift-space as the key. Now you can select text, mash the hotkey and run any of the other workflows that have a ‘keyword’ assigned, plus have ‘script filters’ populate the result/tip list before anything is run. I'm using this to invoke search engines or to add notes in Org-mode, without bothering with the clipboard.
While I'm on this topic, let me add that Lua is way faster than Python or even JS, so it enhances the responsiveness if used for workflow scripts or ‘script filters’.
I'm also using the Automate app on Android to very similar ends: it can have your workflows invoked via the text selection menu or through sharing (no addons with more payment and embedded ads code necessary, like with Tasker).
However, I just checked—Alfred does pollute the clipboard with the selection when invoked like that. I guess OSX doesn't have an API to fetch the selection, other than via the services or the clipboard (maybe it's for the better, in terms of security).
IIRC some version of Keepass cleared passwords from the clipboard in such a way that even clipboard-history apps obeyed—but can't remember if this was in OSX or Linux. I wonder if this method could be used to pop the previous content back on the clipboard and leave no trace of the selection in the history.
This looks like it might help me do something I do multiple times a day. I work with multiple AWS accounts and have to sign in to several different ones each day.
Currently, I have to:
- sign in to AWS SSO
- choose an account
- copy the ENV VARs to my clipboard
- select an iTerm2 tab
- paste ENV VARs into the tab
Using 'tip' I think I could automated the last 3 steps. It's a small win, but when you do it multiple times a day it adds up.
You can automate this, even if you have MFAs enabled. I do that through 1Password CLI (for the MFA token) and a script to interact with the idp. We use temp credentials, so after X hours you to generate a new session.
I'm just typing the 1Password password on the terminal, I could automate that part too but then essentially I'm removing all auth from my workflow which is dangerous especially on laptops.
I'm not sure if iTerm2 supports executing stuff through URL. (For example, we can open intellij using idea://.)
If not possible, please open a GitHub issue or reply here. We can figure it out together. We might be able to get Tip to support triggering iTerm2 somehow natively.
To me this is one of the great mysteries of computers: Why don't people use these features more? I have tons of Services that I use all day, for me they're one of the most important features of the OS (archiving text, opening all selected URLs, and converting the selection to title case are some examples). Yet Services don't seem popular, why is that? People seem to customize their shells (e.g., write Bash scripts, make aliases, and customize their prompts), and even non-programmers seem to be able to accomplish complex automation in Excel, or with a tool like Zapier. So why don't people customize their OS similarly? I find the gains to be greater, because if I customize at the OS-level, my customizations are useful in any app, and forever, instead of being tied to a particular app or project.
Btw, if you want to be even lazier and not involve the other hand—services can be run from the context menu (which is a bit busy but at least it's available).
Also, regarding Swift, the language is pretty simple: I did't know either ObjC or Swift but was able to make a small program in it. The most annoying thing is that Swift's APIs and types constantly change between versions, so you have to translate between the docs and your version of OSX.
> Btw, if you want to be even lazier and not involve the other hand—services can be run from the context menu (which is a bit busy but at least it's available).
Yes, Right clicking and selecting the menu manually works as well. Thank you for mentioning it.
My setting is that my mouse has an extra button, so I configure the extra mouse button to emit Cmd+F3 (which triggers Tip). It's a one-hand one-click operation!
1. Did you decide against including any script in the app bundle for more privacy? It looks like it.
2. So all scripts must be appended in that same file? Have you thought about a behavior like a ".d" directory in the recent "Unix world", where each file can add configuration options? That would enable using different scripts and different languages.
> 1. Did you decide against including any script in the app bundle for more privacy? It looks like it.
Sorta.
My initial use case didn't need a bundled script. My current script involves heavily my local env (e.g. credentials, searching local file). Some use cases are very specific to company's internals (e.g. lookup user id).
I might consider embed a script. But I haven't given it much thought yet, and, because of App Sandbox, the script wouldn't be able to do much.
> 2. So all scripts must be appended in that same file? Have you thought about a behavior like a ".d" directory in the recent "Unix world", where each file can add configuration options? That would enable using different scripts and different languages.
Yes, that's some what in a roadmap. For now, you can workaround by having the main script calls out to the other script
Thank you for the questions. Please don't hesitate to let me know how it works for you!
For a lot of my personal productivity tools, I've been using Alfred, but for some of them a tooltip would be a lot more natural. Looking forward to using it!
I use PopClip[0] (recommended above). One of the extensions you can download sends whatever you've selected to Google Translate. Don't need it often, but it's fantastic when I do.
I use the builtin `date` utility for this specific task, instead of querying another webpage to translate it.