Skip to content

Instantly share code, notes, and snippets.

@hmijail
Last active April 29, 2025 05:25
Show Gist options
  • Save hmijail/78b42f9becc52e137323ef024cd2c910 to your computer and use it in GitHub Desktop.
Save hmijail/78b42f9becc52e137323ef024cd2c910 to your computer and use it in GitHub Desktop.
A CopyQ command to implement a "Clipboard Revolver" (or LIFO, or Stack)
[Command]
Command="
copyq:
//works as of CopyQ v10.0.0
var c = count()
if (c==0) {
fail()
}
select(0)
try {
paste()
} catch (e) {
popup('Pasting Failed', e)
abort()
}
if (config('move') == 'true') {
remove(c-1)
} else {
remove(0)
}
popup('LIFO-pasted', str(c-1)+\" remaining\", 2000)
"
GlobalShortcut=meta+ctrl+v
IsGlobalShortcut=true
Name=HM Clipboard LIFO
@hmijail
Copy link
Author

hmijail commented Dec 23, 2019

Unfortunately I can only say that when I posted it, it worked... and then it stopped working. I don't remember if it was because of a CopyQ update or an OS update; the failure mode changed a couple of times and I never looked seriously into making it work again.

@waiting-for-dev
Copy link

Probably can be fixed in a similar way that the FIFO counterpart:

https://gist.github.com/hmijail/5676ce439edbd3c1c5a0e46e04c5293a#gistcomment-3965258

@hmijail
Copy link
Author

hmijail commented Apr 29, 2025

I just updated it to a version that works with CopyQ v10.0.0.
Thank you @waiting-for-dev !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment