Skip to main content

Control Razer devices from the command line

Project description

razer-cli

All Contributors

Command line interface for controlling Razer devices on Linux

About

With this command line interface you can configure your Razer peripherals, such as keyboard and mouse, set their colors and effects, etc.

The most simple use case (for which this tool was originally developed) is to use it in symbiosis with pywal. Then this tool will set your Razer colors to Pywal's colors. See below for more information.

Installation

pip install razer-cli

OR

git clone https://github.com/LoLei/razer-cli.git
cd razer-cli
sudo python setup.py install

OR

git clone https://github.com/LoLei/razer-cli.git
cd razer-cli
pip install . --user

Usage

$ razer-cli -h
usage: razer-cli [-h] [-man [MANUAL ...]] [-v] [-d DEVICE [DEVICE ...]]
                 [-a] [-e EFFECT [EFFECT ...]] [-c COLOR [COLOR ...]]
                 [-z ZONES [ZONES ...]] [-b BRIGHTNESS [BRIGHTNESS ...]]
                 [--dpi DPI] [--poll POLL]
                 [--battery BATTERY [BATTERY ...]] [-l] [-ll] [-ls]
                 [--sync] [--restore] [--version]

optional arguments:
  -h, --help            show this help message and exit
  -man [MANUAL ...], --manual [MANUAL ...]
                        Print help details for given feature(s)
  -v, --verbose         increase output verbosity
  -d DEVICE [DEVICE ...], --device DEVICE [DEVICE ...]
                        only affect these devices, same name as output of
                        -l
  -a, --automatic       try to find colors and set them to all devices
                        without user arguments, uses X or pywal colors
  -e EFFECT [EFFECT ...], --effect EFFECT [EFFECT ...]
                        set effect
  -c COLOR [COLOR ...], --color COLOR [COLOR ...]
                        choose color (default: X color1), use one argument
                        for hex, or three for base10 rgb
  -z ZONES [ZONES ...], --zone ZONES [ZONES ...]
                        choose zone for color(s)
  -b BRIGHTNESS [BRIGHTNESS ...], --brightness BRIGHTNESS [BRIGHTNESS ...]
                        set brightness of device
  --dpi DPI             set DPI of device (use print as a value to show
                        it)
  --poll POLL           set polling rate of device (use print as a value
                        to show it)
  --battery BATTERY [BATTERY ...]
                        set low threshold and/or idle delay (use print as
                        a value to show it)
  -l, --list_devices    list available devices, settings, and their
                        supported capabilities/effects
  -ll, --list_devices_long
                        list available devices settings, and list their
                        supported capabilities/effects
  -ls, --list_devices_short
                        list available devices and their settings
  --sync                sync lighting effects to all supported Razer
                        products
  --restore             Load last used settings
  --version             Print version number

This might be out of date, just run it with -h yourself to see the newest options.

Example usage with Pywal

To get your mouse and keyboard to use Pywal's colors, simply start razer-cli with the -a flag, after having executed wal: razer-cli -a
Example in action here.

Other examples

$ razer-cli -e ripple -c ff0000
$ razer-cli -e static -c ffffff

You can also leave out the color or the effect:
$ razer-cli -e breath_single
$ razer-cli -c 55ff99

Currently this will imply the -a flag being used for the missing setting. I plan on also having the option to reuse the current color/effect, if the argument is missing, in the future.

Effects

Effects are listed in razer_cli/settings.py. The effects that are supported per device can be listed with razer-cli -l[l]. Some of the built-in effects or not implemented yet. If such an effect is chosen, a notice will be logged. There are also custom effects that do not exist normally, such as multicolor, which is described in the same file.

Here's a showcase of that effect:

Other symbiosis tools

Dependencies

  • openrazer
    • :warning: Do not install openrazer from pip, which is something else.
    • Instead install it from one of the various package managers of your distribution.
  • xrdb
    • Also available on most distros.

Disclaimer

Not all devices have been tested, but basic effects should work everywhere. Some guesswork is being done as to what capabilities are supported on specific devices. If you need more advanced configuration, consider using the GUIs Polychromatic, RazerGenie or RazerCommander which have specific implementations for most devices.

Feel free to open feature request issues or PRs.

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Ansis

💻

Kainoa Kanter

🤔

IFo Hancroft

🐛 📓 📖

GM-Script-Writer-62850

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

razer-cli-2.1.0.tar.gz (36.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

razer_cli-2.1.0-py3-none-any.whl (43.1 kB view details)

Uploaded Python 3

File details

Details for the file razer-cli-2.1.0.tar.gz.

File metadata

  • Download URL: razer-cli-2.1.0.tar.gz
  • Upload date:
  • Size: 36.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/57.2.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.6

File hashes

Hashes for razer-cli-2.1.0.tar.gz
Algorithm Hash digest
SHA256 d73a70bc55a1b4bc91de88e85c9ecac7f9a3115c4ac6da47032643bd37063ef0
MD5 ba203472281a759378c5879d0bcf3d7f
BLAKE2b-256 d6e2a90af04bb78dfc589f8844f0806e785afeef42f03c474f15423c309d2c39

See more details on using hashes here.

File details

Details for the file razer_cli-2.1.0-py3-none-any.whl.

File metadata

  • Download URL: razer_cli-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 43.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/57.2.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.6

File hashes

Hashes for razer_cli-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d22779658dd7a8b23a9a9081ca7969eaf10fc7e1dc1bac10c6f53e91c6fa56aa
MD5 1f22d7bd999642053f97da5c77cb3fe6
BLAKE2b-256 0f55c65ad3bb9593e5432fccfa1c4da247c9e43486157b0b9d9ddfbef0a4e480

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page