Coder Social home page Coder Social logo

copyq-commands's People

Contributors

ajorpheus avatar alexjulien avatar alistairkeiller avatar beefeater7 avatar drmdshahid avatar garulovilla avatar greg4b avatar gufderald avatar hluk avatar keschercode avatar ldap avatar lxyan2333 avatar m4r71n avatar mbakstars avatar metafaniel avatar morganrivers avatar moritzdietz avatar niun avatar pbodnar avatar philhosoft avatar simon-pearson-lmk avatar ventormo avatar zw963 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

copyq-commands's Issues

errors running to-title-case.ini

i've cut-and-paste the command text into Copyq, all seemed good. i get the following error every time:
screenshot from 2018-05-20 21-22-01

(apologies for using a screengrab, "insert code" didn't seem to work as expected.)

How to paste or write text/html data?

I'm creating an action to perform some transformations on text/html clips. I want to paste the transformed HTML, or create a new clip from it.

I am able to get the original HTML data with str(input()) and then transform it, but I am not able to paste the result as text/html, nor to create a new clip of type text/html from the transformed text.

Proposal: Paste formatted Json

Web developers often handle unformatted Json data, all in one line. Often hard to read, when the amount of data increases. In the past, I wrote a Lua script for SciTE to format Json. With CopyQ, the task is trivial.
Code:

[Command]
Name=Paste formatted Json
Command="
    copyq:
    var text = str(input())
    try {
      var json = JSON.parse(text)
      // Remplace '\\t' with a number to indent
      // with this amount of spaces
      text = JSON.stringify(json, null, '\\t')
    } catch (e) {
    }
    copy(text)
    paste()
    "
Input=text/plain
InMenu=true
HideWindow=true
Icon=\xf121

Description:
Pastes selected Json text as a formatted Json text.
If not Json, just pastes the text as is.

Global/snippets.ini Doesn't Work With Index 0

Found a bug on snippets.ini where when you select the first snippet it doesn't pastes and throws no error.

Looking into the source it's the "|| abort()" on line 64, it activates the abort because the zero index evaluates to false.

Since dialog() returns "undefined" when cancelling the dialog, the snippet var should be evaluated as:

if (typeof snippet === "undefined")
abort()

wayland-support.ini does not work with menu

wayland-support.ini does not work with menu
its working if i select "paste as plain text"

for testing i add serverLog in sendShortcut
it does not log when im selecting but it log when i do "paste as plain text"

i think global.paste does not run when we do direct paste from menu

Remove trailing space

Hi,

CopyQ is now working perfect for me; it's the best tool!
I just have one issue:

Is there any way to auto remove trailing space when copy/pasting:
For example, "copyq " would be pasted as "copyq" (without the ending space)

Would really appreciate it!

Blacklisting passwords when Copy Clipboard to Window Tabs is enabled

Hi, I am very much a layperson when it comes to programming, so apologies for my ignorance/inability to help myself. I started using the command Copy Clipboard to Window Tabs, but then I wanted to blacklist passwords copied in my password manager. I found this approach, but one issue intersecting with the Window Tabs command is that it deletes the pw only from &clipboard -- not also "Windows/Mozilla Firefox" or "Windows/Bitwarden". I realize it's probably just a matter of duplicating the code and replacing "Clipboard" with the names of the two windows I'm also trying to delete copy's from, but I'm not sure which instances I need to replace and which I need to keep. Could you please advise?

Notification for Copied Commands grabbing incorrect Content/Windows Match rules

This is about https://github.com/hluk/copyq-commands/blob/master/Automatic/import-commands-after-copied.ini

When importing a command by manually copy-pasting - everything works.
When importing a command via the (awesome) utility script (link above), the Advanced / Match Items / Content and Window fields are populated with the values below:

/\/(?:)\//

This causes (most) commands to not function properly until properly removing the bad content.

If the script includes matching, then the escaping is off, and for any \ a \\ is populated.

How to use the scripts?

Hi,

The README doesn't explain how to use or install the provided scripts.
Can you please add this information to the README?
Thank you.

clear all tabs and clipboard

I just wanted a simple clipboard manager, how did I end up with an IDE called CopyQ??? πŸ˜‚

I am really not able to figure out whether the syntax of copyq is pearl, js or something custom. Unfortunately I'm not good at either.

Well anywas, could you please paste a code snippet here, as a reply, for clearning (deleting or removing) all tabs, items and contents with in-menu button and global shortcut.

Thank you.

Play sound when pasting to Windows

Greetings, I've been trying to come up with a global command to play a sound when pasting to windows. I can't get it to work, exceptions keep getting thrown at me. Is it allowed to ask for guidance here?

This is my "Play Sound on Copy" command, which plays a sound and copies the selected text to the clipboard and copyq ...

[Command]
Name=Play Sound on Copy
Command="
     powershell:
    $mydocuments=[environment]::getfolderpath(\"mydocuments\");(New-Object Media.SoundPlayer \"$mydocuments\\MMT\\CopyQ\\sounds\\WoodClickUp.wav\").PlaySync()"
Automatic=true
Icon=\xf028

Log says: CopyQ Note [2021-10-22 12:53:19.713] <Client-23948>: Command "Play Sound on Copy": Finished in 1424 ms

And this is my "Play Sound on Paste" command, which doesn't work. No sound is produced, and nothing is pasted.

[Command]
Name=Play Sound on Paste
Command="
     powershell:
    $mydocuments=[environment]::getfolderpath(\"mydocuments\");(New-Object Media.SoundPlayer \"$mydocuments\\MMT\\CopyQ\\sounds\\WoodClickDown.wav\").PlaySync()
     copyq: paste()"
IsGlobalShortcut=true
Icon=\xf028
GlobalShortcut=ctrl+v

Log says: 
CopyQ Note [2021-10-22 12:53:29.908] <Server-31728>: Command β€œPlay Sound on Paste”
CopyQ Note [2021-10-22 12:53:29.908] <Server-31728>:    Exit code: 1
CopyQ Note [2021-10-22 12:53:29.908] <Server-31728>:    1. powershell $mydocuments=[environment]::getfolderpath("mydocuments");(New-Object Media.SoundPlayer "$mydocuments\MMT\CopyQ\sounds\WoodClickDown.wav").PlaySync()
CopyQ Note [2021-10-22 12:53:29.908] <Server-31728>:    2.  copyq: paste()

Please tell me what I'm doing wrong - and thank you so much.

wayland-support.ini nedd help to find out why it's not working

Hello hluk
Hello all

I would love to have the wayland-support.ini script working. It's not pasting automatically to the front most application.
Love this app so much, and if this would work I would be the happiest man on earth.

Ydotool is up and running:

$ ydotool type 123
123⏎
$ 123

I tried the following terminal commands to troubleshoot:

$ copyq currentWindowTitle
copyq currentWindowT ~
$ copyq paste
Could it be⏎
$ Could it be
$ copyq copy
^CScriptError: Failed to start ydotool

--- backtrace ---
eval(arguments[0])()
--- end backtrace ---

After I execute copyq copy my keyboard is messed up, all the keys are on the wrong place. After entering copyq copy again everything goes to normal again

Could it be that it's because NixOS has non standard path to applications?:

> which ydotool
/run/current-system/sw/bin/ydotool

Version, OS and Environment
(Get details from copyq version command if possible.)

Application Version 7.1.0
OS Linux > NixOS
Hyperland window manager

Detecting double copy

Is it possible to detect if the same text is copied to the clipboard twice in a row?

I would like to run certains actions, such as opening an url in the browser, if it is copied twice. This is more convenient than eg. assigning a global shortcut as I can just press Ctrl-C twice.

The problem is that CopyQ automatically removes duplicates which is normally wanted. So the second time the clip is copied, nothing happens.

Is it possible to run an action at a point before CopyQ checks if the item already exists?

trying to make command to replace single quote with two single quotes and vice versa

I'm doing a lot of database word where I'm passing some dynamic sql.

CASE WHEN [t].[VALUE] = 'Foo' THEN NULL ELSE 'Bar' END

and I often need to reverse it from '' to ' as well.

I have tried it this way

copyq:
function modifyText(text)
{
  // TODO: Modify text here!
  return text.replace("'", "''")
}

if (!copy())
  abort()

var text = str(clipboard())
var newText = modifyText(text)
if (text == newText)
  abort();

copy(newText)
paste()

and it only replaces the very first ' with ''. It never gets them both. Any help appreciated.

command List all tabs?

Hi.
I do not find the option to list all tabs and jump to a certain one per click.
Is there such script, command?
Where could i post a wish? :)
thx

Adding hotkey to ignore any copied text when held down

I was hoping you could help with a solution for the following script you wrote:

https://github.com/hluk/copyq-commands/blob/master/Global/copy-a-secret.ini

I'm using BitWarden and I frequently use the "copy password to clipboard" button on my password manager, rendering the copy secret hotkey ineffective. Would there be a way to set a hotkey that I would hold, and then click the "copy password to clipboard" button so the password would be ignored?

Any help would be appreciated!

Join Selected Items, execve Argument list too long

Subject of the issue

when running join selected items with a lot of items, it will fail with error execve Argument list too long and no item will be created but selected items are deleted

issue happened on 300 items of urls

[Command]
Command="
    copyq add %1"
Icon=\xf066
InMenu=true
Name=Join Selected Items
Remove=true
Shortcut=space

Your environment

CopyQ Clipboard Manager v3.13.0
Qt: 5.14.2
Compiler: GCC
Arch: x86_64-little_endian-lp64
OS: Ubuntu 21.10

Steps to reproduce

  1. add command to copyq
  2. create lot of items
  3. select all and run the command

Expected behaviour

item succesfully created

or

item not succesfully created but selected items are not deleted

Actual behaviour

  • error popup execve Argument list too long
  • selected items deleted
  • no item created

Comment

this is similar issue to hluk/CopyQ#1573 but the solution is to rewrite the command

i am not familiar enough with javascript or bash to rewrite the command, and also there is no example to get selected items to python

is it possible to add option to not remove selected item when command error ?

Window title not working in Hyprland

I would like to ignore text like passwords copied from specific windows. Therefore I understood a built in command is available but obviously not working in Hyprland. In Hyprland hyprctl clients shows all active windows, their class, title and so on, below an example of Firefox running and showing this GitHub page. However it seems copyq is considering some other values for the window name, as the filter criteria ^$ matches all windows I tried so far. Is there any way I can compare my regex against one of the values from below?

...
Window 590ed6fd0700 -> Issues Β· hluk/copyq-commands β€” Mozilla Firefox:
	mapped: 1
	hidden: 0
	at: 647,36
	size: 611,742
	workspace: 3 (3)
	floating: 0
	monitor: 0
	class: firefox
	title: Issues Β· hluk/copyq-commands β€” Mozilla Firefox
	initialClass: firefox
	initialTitle: Mozilla Firefox
	pid: 80075
	xwayland: 0
	pinned: 0
	fullscreen: 0
	fullscreenmode: 0
	fakefullscreen: 0
	grouped: 0
	swallowing: 0
	focusHistoryID: 1
...

Paste not working in terminal emulators on Hyprland with Wayland support script enabled

Creating this issue after hluk/CopyQ#2557.

I'm running Arch with Hyprland compositor. After enabling wayland support script everything runs smooth, except paste behavior ONLY in terminal emulators - instead of the clipboard content, it inserts something else. It seems to be related to the paste shortcut, which wayland support script sends and which seems to be Shift+Insert. As it is not paste shortcut by default in most terminal emulators - the issue occurs.

Some extra lines should be added to README.md file, going to do it by myself.

Error Modifying Selected Text

Hi

Trying modify-selected-text.ini and getting the following error:

Exception in "Template: Modify..."
Failed to copy to clipboard
Exit code: 4
1. copyq:
2. function modifyText(text)

I would like to remove end of line replacing EOL with space.

symfony-console-autocomplete using copyQ

I would like to give you this one Liner, my first copyQ oneLiner.

This will help completion build symfony consolne commands.

if you use a tab named symfonyBinConsole backup it first !!!

clear; copyq removetab symfonyBinConsole; copyq show symfonyBinConsole; rm ./symfonyBinConsole2copyQ.sh;  ~/symfony/example/bin/console > symfonyBinConsole2copyQ.sh; sed -ri 's/\s*([^ ]+)(.*)/copyq tab symfonyBinConsole add "\1 # \2"/' symfonyBinConsole2copyQ.sh ; chmod +x ./symfonyBinConsole2copyQ.sh ; ./symfonyBinConsole2copyQ.sh 

BTW: First i tried https://github.com/bamarni/symfony-console-autocomplete but not works for me.

how to know if my current copied clip exist in my old clips??

I am getting current clip using var clip = str(clipboard()) and working on that. But in long run I come across same clip which is flooding my work with duplicates.

So is there any method to know that my current clip exist in my old clips??
Thanks.

CopyQ: Command Search&Replace?

Hi.
Top app! :)
What about a command to search and replace specific text in an opened and edited item ?
Or globally for all items in the actual tab or all tabs?
thx :)

Error: TLS initialization failed

Note [2020-06-08 02:39:07.057] : --- backtrace ---
Note [2020-06-08 02:39:07.057] : importCommandsFromUrl(url = 'https://github.com/hluk/copyq-commands/blob/master/Automatic/big-data-tab.ini') at β€œ...”:23
Note [2020-06-08 02:39:07.057] : () at β€œ...”:31
Note [2020-06-08 02:39:07.057] : () at β€œ...”:4
Note [2020-06-08 02:39:07.057] : --- end backtrace ---
Note [2020-06-08 02:40:11.855] : ScriptError: Exception in command: Failed to fetch commands.
Note [2020-06-08 02:40:11.855] : Status code: undefined
Note [2020-06-08 02:40:11.855] : Error: TLS initialization failed

Issues with "Tab for URLs with Title and Icon" command

I'm using a CopyQ command from the repository to get the URL with Title and Icon (https://github.com/hluk/copyq-commands/blob/master/Automatic/tab-for-urls-with-title-and-icon.ini) and it gets the Title and the URL perfectly, but often it does not get the Icon. For example, it doesn't get an icon for http://www.woot.com or http://www.bgr.com. Second, when it does get an Icon, there is always an extra grey square in front of it. Is there a way to remove the grey square? See the attached screenshot for examples.

image

Thanks,
Rich

feature request: apply Display Commands to the tray menu items

Hello,

is it possible to apply Display Command to items in the tray menu?
I'd like to mask all items starting with some prefix.
E.g. items starting with 'S$' should be displayed in the tray menu as 'Masked Password'.

The below Command works as expected in the main CopyQ window, but it doesn't in the tray menu.

copyq:
const textData = str(data(mimeText));
const passwordPrefix = 'S$';

if (textData.startsWith(passwordPrefix)) {
  setData('text/plain', 'Masked Password');
}

image

Cheers
Jarek

Trying to Create an Automatic Command That Removes Entries That Are a Single Emoji

I use copyq on macOS and have a RayCast extension where I can search for emojis and paste them quickly. The problem is every time I paste an emoji, it copies it into my clipboard, causing unnecessary clutter. I'm looking to make an automatic command that checks newly added clipboard content for entries that contain only one emoji and nothing else (ex: 'πŸ§‘πŸΌβ€πŸ’»').

Can someone assist me in making this command? Thanks!
Pictures below:
image
image

Test Commands

Would be nice to have a script to test the commands.

For each command the script would:

  • set COPYQ_SESSION=command-tests,
  • set COPYQ_SETTINGS_PATH=config/path/ (available in development version, not in v3.5.0),
  • initiate configuration with the command (simple copy?),
  • start CopyQ,
  • start <command>.js script.

Travis could install latest CopyQ version and run the script.

Copy-to-tab makes clipboard selection to copy everything

Hi,

I'm using this command https://github.com/hluk/copyq-commands/blob/master/Automatic/move-images-to-other-tab.ini
to copy (not move) images to the "Images" tab.

I don't know how to programmatically do it, so I installed the command and in "Advanced" tab, I set the "Copy to tab: clipboard":

image

It did the job (although I'd like to know how to alter the command for no manual setup)

The issue

  • After doing that, every text selection from the mouse gets copied to the main "clipboard" tab 😳.

I tried removing the command and starting over again and same result. When I disable the command the mouse selection works fine.

CopyQ Clipboard Manager 7.1.0
Qt: 6.5.2
Compiler: GCC
Arch: x86_64-little_endian-lp64
OS: Ubuntu 23.04
X11

N.B. I did exactly the same with this command to copy URLs in a tab and the mouse works just fine!
https://github.com/hluk/copyq-commands/blob/master/Automatic/tab-for-urls-with-title-and-icon.ini

Use ctrl+ins instead of ctrl+c, for wayland copy command?

I was just passing by for another reason, and I happened to notice in #89 you mentioned something. I didn't want to hijack that issue so I thought I should make another one.

The default copy() override for Wayland Support uses the following command:

ydotool key 29:1 46:1 46:0 29:0

This sends Ctrl+C shortcut so if run it in terminal it will send interrupt signal on the command line (the Ctrl+C shortcut - see the ^C in your output) which causes the ydotool not to send final key release events to the system so you end up with Ctrl in "pressed" state.

When I saw this, it occurred to me - what if we were to use

ydotool key 29:1 110:1 110:0 29:0

To send ctrl+ins as the replacement copy command? I guess it probably should work for most things, and also, it would be terminal-friendly? But I have a feeling you will already have considered this and have chosen ctrl+c for a good reason I haven't thought of yet πŸ˜ƒ Anyway, I thought maybe this might be helpful.

Scripting top 10 Clips to FIle

I am trying to export the top 10 clips from the clipboard into a text file that can be read by MATRIC (an android dashboard for Windows). Here's what I've got so far but I'm missing something on how to reference the correct items.

var filePath = 'E:\\VSDev\\matric\\copyq\\clipboard.txt'
function storeClipboard() {
	var f = File(filePath)
	if ( !f.openWriteOnly() ) {
	popup(
		'Failed saving clipboard',
		'Cannot open file: ' + filePath
		+ '\n' + f.errorString())
	return;
    }
	selectItems(0,1,2,3,4,5,6,7,8,9)
	for(i=0;i<=9;i++) {
		var item = selectedItemData(i)
		//var text = JSON.stringify(item)
		var text = str(item[mimeText])
		if (text.length>15) {
			linedata = i+1 + ': ' + text.substring(1,15) + '...\n'
		} else {
			linedata = i+1 + ': ' + text + '\n'
		}
		f.write(linedata)
	} 
    f.close()
}
var onClipboardChanged_ = global.onClipboardChanged
global.onClipboardChanged = function() {
    onClipboardChanged_()
    storeClipboard()
}

The goal output is something like:

1: somecopied text
2: some really long ...
3: //image// <=note I have not added code for this yet
4: 123456
etc to 10

Separate tabs for long items

First of all, thanks for developing CopyQ! By now, it saved me countless of hours of work, all the while looking incredibly pretty (the UI and UX are top notch).

In my daily usage I often find myself copying a lot of lines at once, such that a single item fills up the entire CopyQ window as seen in the image below.

image

How would I go about creating an Automatic script to move these long items to a separate tab (perhaps named &long)? I took a look at the Scrpting API documentation but haven't gotten any ideas from it. So far, I have a hunch that a modified version of the Big Data Script may do the trick.

Thanks in advance!

[Request] Date stamp

Hi hluk,

Is it possible to capture a date and time stamp for each clipboard entry?

Thanks.

CopyQ: Command Merge and Delete ?

Hi.
Where is Command: Merge and Delete ?
copyq:
add(input())
I can not find it anymore.

It should not jump automatically to the top of the tab.

Shortcut key copy new item to specific tab

Can you please create scrip for X shortcut key copy new item to specific tab. or option to disable CTRL+C pasted in Copyq But rather other shortcut key will pasted in Copyq.

SYNC - SETUP & FORCING / INITIAL OPERATION

Apologies, but I searched and could not resolve this query - which is probably an embarrassingly obvious in some way that I missed.

In both my LNX (MX) and Win11 installations I cannot (for the life of me) get files to Sync to either my external cloud OR an internal directory.

I have tried multiple TAB and destination FOLDER variants. (See Image)
I have tried Closing and Re-opening the App.

So, how about this ... WHAT is the command (method) of FORCING the Sync operation to occur? I just want to see one single successful Sync either locally or in a Cloud folder.

I have not found the Sync user info page to be instructive in this regard. (Sorry - this section is dishearteningly thin.)

So ... HOW does a User get a simple, first-time, Sync of Items under a Tab name?

And then, can someone provide a Step x Step, explanation of the precise SYNTAX to specify for TAB NAME and PATH in Preferences? Are there prefix or suffix characters I have neglected to include??

Another thing not clarified in the Support Docs is IF or HOW recursive "Tab" DIRs are or could be included. OR if all sub-Tabs must be specified as separate entries. (If not, would be an obvious Feature Request).

With apologies for being a "Dummy" if I missed something in the Config that is obvious - but I really need to Sync the exact Clips for 2 machines which will read an external cloud drive containing the CPQ target CPQ SYNC CFG for Items copied.

Upon success, I would leap for joy.

Any way to move existing big items into another tab?

Hiya,

I'm pretty keen to try out the Big Data Tab since my clipboard needs to have many items, and for many months now, that's not been a problem, but lately, it's starting to freeze up when I search, obviously I have a few items in there that are too big and causing a problem.

This command seems like it could help, but it only acts when new items are added, and I still have the existing 'big data' items in my clipboard. Is there some command I could run, to search the entire list, and move those items into the big data tab, all at once?

Perhaps this is an FR, to add such a command to run when the big data tab command is added? I'm not sure.

Thanks for any help or advice you could give :)

Copy nth command

Please when i press shortcuts to copy item 0 or item 1 command for example
i need ever open copyQ window to change clipboard value ?
is possible for only press shortcuts and change clipboard value ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.