Jump to content

pbcopy does not properly work with PhpStorm


Recommended Posts

Posted

I have a simple workflow to generate a UNIX timestamp:

 

"ts" keyword -> to Run Script -> Post notification

 

Script is:

 

date +"%s" | xargs echo -n | pbcopy

 

Whenever I execute this workflow, a UNIX timestamp is properly copied to clipboard. However, whenever I'm in PhpStorm and I copy some code, then generate a timestamp, I see the notification but the clipboard content is not replaced with the timestamp, I still paste the copied code. If I run again the workflow, I finally get my timestamp.

 

- I copy code, generate, paste, I get the code

- I copy code, generate, switch to another app to paste, I get the timestamp, I go back to PhpStorm, paste, I get the timestamp

- I copy code, generate, paste, I get the code, switch to another app, I get the timestamp

- I copy code, generate, generate again, paste, I get the code

 

Seems related to PhpStorm though but wonder if you may have an idea how it is possible, moreover with the last behaviour when I invoke the workflow twice :)

 

Kind regards

Posted

I have a simple workflow to generate a UNIX timestamp:

 

"ts" keyword -> to Run Script -> Post notification

 

Script is:

 

date +"%s" | xargs echo -n | pbcopy

 

Whenever I execute this workflow, a UNIX timestamp is properly copied to clipboard. However, whenever I'm in PhpStorm and I copy some code, then generate a timestamp, I see the notification but the clipboard content is not replaced with the timestamp, I still paste the copied code. If I run again the workflow, I finally get my timestamp.

 

- I copy code, generate, paste, I get the code

- I copy code, generate, switch to another app to paste, I get the timestamp, I go back to PhpStorm, paste, I get the timestamp

- I copy code, generate, paste, I get the code, switch to another app, I get the timestamp

- I copy code, generate, generate again, paste, I get the code

 

Seems related to PhpStorm though but wonder if you may have an idea how it is possible, moreover with the last behaviour when I invoke the workflow twice :)

 

Kind regards

 

This is kind of weird. I don't use PHPStorm but, rather than using pbcopy, have you tried just echoing the output and the connecting that to a Copy To Clipboard output item?

Posted

This is a common problem with all Java apps (at least all the ones I've used).

 

My guess is that Java's own internal clipboard doesn't do a great job of shadowing the system pasteboard.

 

It makes using apps that fiddle with the pasteboard, e.g. TextExpander, a bit of a crapshoot in Java apps.

 

With such a short snippet, you might have more luck using AppleScript to "type" the timestamp for you instead of using the pasteboard.

  • 1 year later...
Posted

It looks like this bug was introduced in v2.7.2 and a fix was introduced in v2.7.3, but the fix is not automatically applied.

 

You can apply the fix in Alfred preferences: Appearance > Options > change 'Focusing' setting to "Compatibility Mode".

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...