Skip to content

nathonius/py5Q

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WARNING

I have no idea what the status of this code is right now. I haven't touched it in a while and it's very possible I left it broken. Don't @ me.

py5Q: Python bindings for the Das Keyboard 5Q

Installation

For now, you'll need to clone the repo.

Script Usage

import py5Q
Q = py5Q.py5Q(clientId='YOUR ID', clientSecret='YOUR SECRET')

# Make the A key red
signalId = Q.signal('KEY_A', '#ff0000')

# Delete a signal
Q.delete(signalId)

# Batch signals
signalIds = Q.batchSignal(('KEY_A', 'KEY_S', '2,2'), '#00ff00')

# Batch signal range
# Make the entire 'Insert' through 'Page Down' section of the keyboard blue
rangeIds = Q.batchSignalRange((16, 18), (1, 2), '#0000ff')

# Special zones
# Make numpad yellow
numpadSignals = Q.batchSignal(Q.zones.numpad, '#ffff00')

# Delete ALL signals
Q.deleteAll()

Command Line Usage

For now, CLI usage requires automatic authentication.

// A Key -> Red
Q.py signal -z KEY_A -c #ff0000

// Delete all signals
Q.py delete --all

Full Command Line Reference

Global Options

option (short) effect default example
signal Send a signal. None. signal or delete is required. signal
delete Delete a signal. None. signal or delete is required delete
--no-cache Do not used cached tokens. Forces re-authentication. None --no-cache

signal Options

option (short) effect default example
--zones (-z) Which zones to affect. Can be one or a list. No default. This option is required. --zones KEY_A KEY_B
--color (-c) Color to set. No default. This option is required. --color #ff0000
--name (-n) Name of signal. "py5Q Signal" --name "My Signal"
--effect (-e) Effect to use. See here for a list. SET_COLOR --effect BLINK
--message (-m) Signal message. None --message "Signal message."
--notify Sets shouldNotify true. None --notify
--read (-r) Sets isRead true. None --read
--archived (-a) Sets isArchived true. Signal will be shown in the signal center, but not on the keyboard. None --archived
--muted Sets isMuted true. None --muted

delete Options

option (short) effect default example
--all (-a) Ignores any given IDs and instead deletes ALL signals. None --all
signals A list of signal IDs to delete None delete <ID1> <ID2> <ID3> ...

Automatic Authentication

If no clientId and clientSecret are specified, they will be loaded from a file called config.json in the same folder as the py5Q.py file. The file is formatted like this:

{
    "clientId": "YOUR ID",
    "clientSecret": "YOUR SECRET",
    "username": "",
    "password": ""
}

With that file, the object can be created like this:

import py5Q
Q = py5Q.py5Q()

Token Caching

Unless --no-cache is specified on the CLI or the py5Q object is created with cacheTokens=False, tokens will be read from a tokens.json file in the same directory as the script.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages