[GH-ISSUE #253] Right-click actions #136

Open
opened 2026-03-03 01:10:21 +03:00 by kerem · 3 comments
Owner

Originally created by @emilv on GitHub (Feb 22, 2018).
Original GitHub issue: https://github.com/Clipy/Clipy/issues/253

ClipMenu v0.4 had support for "actions" when you right-click an item in history. I use this all the time and would love a similar feature in Clipy. You could customize this yourself, and even add your own actions with Javascript.

Right-click menu:

skarmdump 2018-02-22t13 27 36

Action configuration:

skarmdump 2018-02-22t13 29 01

Originally created by @emilv on GitHub (Feb 22, 2018). Original GitHub issue: https://github.com/Clipy/Clipy/issues/253 ClipMenu v0.4 had support for "actions" when you right-click an item in history. I use this all the time and would love a similar feature in Clipy. You could customize this yourself, and even add your own actions with Javascript. Right-click menu: ![skarmdump 2018-02-22t13 27 36](https://user-images.githubusercontent.com/1684914/36538543-34834c62-17d4-11e8-9817-6f2877e98746.png) Action configuration: ![skarmdump 2018-02-22t13 29 01](https://user-images.githubusercontent.com/1684914/36538580-5c7933d0-17d4-11e8-9dc0-aff9a24d0313.png)
Author
Owner

@sbenders-c3iot commented on GitHub (Dec 3, 2018):

I was just looking for this feature as well - to modify the text in my clipboard upon pasting.
Upvoted. :)

<!-- gh-comment-id:443804370 --> @sbenders-c3iot commented on GitHub (Dec 3, 2018): I was just looking for this feature as well - to modify the text in my clipboard upon pasting. Upvoted. :)
Author
Owner

@Xtremefaith commented on GitHub (Sep 22, 2023):

This is a great idea, for now I would even take something less complex to begin. For example, I just need to generate an ID based on today's date, something like YYYYMMDDHHmm to output "202309220920." This is a simple example but I would love some basic JS abilities to transform the thing I'm pasting. Currently using BetterTouch Tool (BTT) to accomplish things like this.

<!-- gh-comment-id:1731700507 --> @Xtremefaith commented on GitHub (Sep 22, 2023): This is a great idea, for now I would even take something less complex to begin. For example, I just need to generate an ID based on today's date, something like `YYYYMMDDHHmm` to output "202309220920." This is a simple example but I would love some basic JS abilities to transform the thing I'm pasting. Currently using [BetterTouch Tool (BTT)](https://folivora.ai/) to accomplish things like this.
Author
Owner

@devinemke commented on GitHub (Apr 15, 2024):

I too am still waiting for this feature to be implemented in Clipy. In the meantime I came up with a kludgy fix that gets me most of the way there. My most frequently used right click actions from ClipMenu were:

  • UPPER CASE
  • lower case
  • Title Case

So I wrote a simple AppleScript macro to grab the current clipboard contents, change the case, then switch back to the previous app, and paste. Here it is:

on ChangeCase(str, CaseSwitch)
	if CaseSwitch is equal to "lower" then
		return do shell script "echo " & quoted form of str & " | tr '[:upper:]' '[:lower:]'"
	end if
	if CaseSwitch is equal to "UPPER" then
		return do shell script "echo " & quoted form of str & " | tr '[:lower:]' '[:upper:]'"
	end if
	if CaseSwitch is equal to "Title" then
		return do shell script "echo " & quoted form of str & " | python3 -c 'import sys; print(sys.stdin.read().strip().title())'"
	end if
end ChangeCase

set userResponse to the button returned of (display dialog "Change case of clipboard text?" buttons {"lower", "UPPER", "Title"})
set the clipboard to ChangeCase(the clipboard as text, userResponse)
tell application "System Events" to keystroke tab using command down
delay 0.5
tell application "System Events" to keystroke (the clipboard as text)

I then bind this to a keyboard shortcut (Control+Option+Command+V) via the macOS Shortcuts app.

This obviously could be easily expanded to do other right click actions, such as Trim, Ltrim, Rtrim, base64, SHA1, MD5, etc...

Hope this helps.

<!-- gh-comment-id:2057426564 --> @devinemke commented on GitHub (Apr 15, 2024): I too am still waiting for this feature to be implemented in **Clipy**. In the meantime I came up with a kludgy fix that gets me most of the way there. My most frequently used right click actions from [**ClipMenu**](https://github.com/naotaka/ClipMenu) were: - UPPER CASE - lower case - Title Case So I wrote a simple **AppleScript** macro to grab the current clipboard contents, change the case, then switch back to the previous app, and paste. Here it is: ``` on ChangeCase(str, CaseSwitch) if CaseSwitch is equal to "lower" then return do shell script "echo " & quoted form of str & " | tr '[:upper:]' '[:lower:]'" end if if CaseSwitch is equal to "UPPER" then return do shell script "echo " & quoted form of str & " | tr '[:lower:]' '[:upper:]'" end if if CaseSwitch is equal to "Title" then return do shell script "echo " & quoted form of str & " | python3 -c 'import sys; print(sys.stdin.read().strip().title())'" end if end ChangeCase set userResponse to the button returned of (display dialog "Change case of clipboard text?" buttons {"lower", "UPPER", "Title"}) set the clipboard to ChangeCase(the clipboard as text, userResponse) tell application "System Events" to keystroke tab using command down delay 0.5 tell application "System Events" to keystroke (the clipboard as text) ``` I then bind this to a keyboard shortcut (<kbd>Control</kbd>+<kbd>Option</kbd>+<kbd>Command</kbd>+<kbd>V</kbd>) via the macOS [**Shortcuts**](https://support.apple.com/en-ca/guide/shortcuts-mac/apdf22b0444c/mac) app. This obviously could be easily expanded to do other right click actions, such as Trim, Ltrim, Rtrim, base64, SHA1, MD5, etc... Hope this helps.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/Clipy#136
No description provided.