Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@hluk
hluk / CopyQ - Edit File.ini
Last active March 7, 2016 08:14
CopyQ - Edit File
[Command]
Name=Edit File
Match=^([a-zA-Z]:[\\\\/]|~|file://|%\\w+%|$\\w+|/)
Command="
copyq:
var editor = config('editor')
var fileName = str(input())
.replace(/^\\/([a-zA-Z])\\//, '$1:/')
.replace(/^file:\\/\\//, '')
@hluk
hluk / pdc_client.py
Last active September 26, 2017 08:25
class PDCClientWrapper(object):
def __init__(self, client, page_size):
self.client = client
self.page_size = page_size
def __call__(self, *args, **kwargs):
if 'page_size' not in kwargs:
kwargs['page_size'] = self.page_size
return self.client(*args, **kwargs)
@hluk
hluk / move_cursor_to_active_win.py
Created August 21, 2018 17:48
Move Mouse Cursor to Active Window
#!/usr/bin/env python3
import pyatspi
def on_object_focused(event):
if not event.source.getState().contains(pyatspi.STATE_FOCUSED):
return
print(event)
extents = event.source.get_extents(pyatspi.DESKTOP_COORDS)
@hluk
hluk / paste_separated.ini
Last active June 1, 2019 11:54
CopyQ Command: Paste multiple items separated by a blank line
[Command]
Command="
copyq:
hide()
var items = selectedItemsData()
var text = ''
for (var i in items) {
var itemText = str(items[i][mimeText]).trim()
text += itemText + '\\n\\n'
@hluk
hluk / add_blank_line.ini
Last active June 2, 2019 05:43
CopyQ Command: Add blank line when copied
[Command]
Automatic=true
Command="
copyq:
var text = str(data(mimeText))
if (!text)
abort()
text += '\\n\\n'
setData(mimeText, text)
@hluk
hluk / replace_selected_with_script.ini
Created June 3, 2019 12:54
CopyQ Command: Replace selected text with a script
[Command]
Command="
copyq:
// path to python script
// (always use forward slash as path separator)
script = 'c:/scripts/modify_text.py'
// get old text from clipboard
var oldText = str(clipboard())
@hluk
hluk / show_clipboard_owner.ini
Created August 3, 2019 09:05
CopyQ Command: Show clipboard owner in notification
[Command]
Command="
function showOwner() {
popup(
isClipboard() ? 'Clipboard Owner' : 'Selection Owner',
data(mimeWindowTitle)
)
}
var onClipboardChanged_ = onClipboardChanged
@hluk
hluk / snippets.ini
Last active December 8, 2019 14:55
CopyQ - Snippets Command (with custom dialog position)
[Command]
Command="
copyq:
var x = 1850
var y = 1000
var snippetsTabName = 'Snippets'
// List snippets instead of search combo box?
var listSnippets = false