This commit is contained in:
Denis Lehmann 2025-02-01 15:49:12 +01:00 committed by Denis Lehmann
parent 95c11fe598
commit a8dbaf6157
6 changed files with 38 additions and 75 deletions

View file

@ -118,7 +118,7 @@
t = [2, 6] t = [2, 6]
#+end_src #+end_src
The =tab= identifies for example the key in the third row and second colum (counting starts at 0) which is the tabulator key on the keyboard. The =tab= identifies for example the key in the third row and second column (counting starts at 0) which is the tabulator key on the keyboard.
Those identifiers can then be used in profiles to set light colors. Those identifiers can then be used in profiles to set light colors.
*** Profiles *** Profiles
@ -183,7 +183,7 @@
The =;= waits until the game exited and the =rzr= command finally applies your =default= profile. The =;= waits until the game exited and the =rzr= command finally applies your =default= profile.
It is neccessary that *rzr* is installed correctly and available in your =$PATH=, otherwise Steam will not be able to call it. It is necessary that *rzr* is installed correctly and available in your =$PATH=, otherwise Steam will not be able to call it.
** Troubleshooting ** Troubleshooting

26
flake.lock generated
View file

@ -1,28 +1,11 @@
{ {
"nodes": { "nodes": {
"flake-utils": {
"locked": {
"lastModified": 1638122382,
"narHash": "sha256-sQzZzAbvKEqN9s0bzWuYmRaA03v40gaJ4+iL1LXjaeI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "74f7e4319258e287b0f9cb95426c9853b282730b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1642069818, "lastModified": 0,
"narHash": "sha256-666w6j8wl/bojfgpp0k58/UJ5rbrdYFbI2RFT2BXbSQ=", "narHash": "sha256-GFzPxJzTd1rPIVD4IW+GwJlyGwBDV1Tj5FLYwDQQ9sM=",
"owner": "NixOS", "path": "/nix/store/50yickar04m51aqnc43gxf45g2i0n3k9-source",
"repo": "nixpkgs", "type": "path"
"rev": "46821ea01c8f54d2a20f5a503809abfc605269d7",
"type": "github"
}, },
"original": { "original": {
"id": "nixpkgs", "id": "nixpkgs",
@ -31,7 +14,6 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
} }
} }

View file

@ -1,42 +1,50 @@
{ {
description = "A simple command line frontend for OpenRazer"; description = "A simple command line frontend for OpenRazer";
nixConfig.bash-prompt = "\[\\e[1m\\e[32mrzr-develop\\e[0m\]$ "; outputs = { self, nixpkgs }@inputs:
inputs.flake-utils.url = "github:numtide/flake-utils"; let
outputs = { self, nixpkgs, flake-utils }: forAllSystems = nixpkgs.lib.genAttrs nixpkgs.lib.platforms.unix;
flake-utils.lib.eachDefaultSystem
(system: nixpkgsFor = forAllSystems (system: import nixpkgs {
inherit system;
});
in
{
packages = forAllSystems (system:
let let
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgsFor.${system};
in in
{ {
# Package rzr =
packages.rzr = pkgs.python3Packages.buildPythonPackage {
pkgs.python3Packages.buildPythonApplication rec { pname = "rzr";
name = "rzr"; version = "main";
src = self; src = self;
nativeBuildInputs = with pkgs; [
wrapGAppsHook
];
propagatedBuildInputs = with pkgs; [ propagatedBuildInputs = with pkgs; [
python3Packages.colour python3Packages.colour
python3Packages.openrazer python3Packages.openrazer
python3Packages.toml python3Packages.toml
]; ];
}; };
defaultPackage = self.packages.${system}.rzr; default = self.packages.${system}.rzr;
}
);
# Development shell devShells = forAllSystems (system:
devShell = pkgs.mkShell { let
pkgs = nixpkgsFor.${system};
in
{
rzr = pkgs.mkShell {
buildInputs = with pkgs; [ buildInputs = with pkgs; [
python3 python3
python3Packages.colour python3Packages.colour
python3Packages.openrazer python3Packages.openrazer
python3Packages.pip
python3Packages.setuptools
python3Packages.toml python3Packages.toml
python3Packages.virtualenv
]; ];
}; };
default = self.devShells.${system}.rzr;
} }
); );
};
} }

View file

@ -1,2 +0,0 @@
colour
toml

28
bin/rzr → rzr Normal file → Executable file
View file

@ -12,24 +12,6 @@ import toml
import sys import sys
def print_greeter():
"""Print greeter."""
greeter = """ _ _ _
/\ \ /\ \ /\ \
/ \ \ / \ \ / \ \
/ /\ \ \ __/ /\ \ \ / /\ \ \
/ / /\ \_\/___/ /\ \ \ / / /\ \_\
/ / /_/ / /\___\/ / / / / / /_/ / /
/ / /__\/ / / / / / / /__\/ /
/ / /_____/ / / / _ / / /_____/
/ / /\ \ \ \ \ \__/\_\ / / /\ \ \
/ / / \ \ \ \ \___\/ // / / \ \ \
\/_/ \_\/ \/___/_/ \/_/ \_\/
"""
print(greeter)
def error(msg, e=True): def error(msg, e=True):
"""Print error to stderr and exit eventually.""" """Print error to stderr and exit eventually."""
print("ERROR: {}".format(msg), file=sys.stderr) print("ERROR: {}".format(msg), file=sys.stderr)
@ -102,9 +84,9 @@ def apply_device_profile(device_profile):
if "lights" in device_profile: if "lights" in device_profile:
for light in device_profile["lights"]: for light in device_profile["lights"]:
color_tuple = get_color_tuple((device_profile["lights"][light])) color_tuple = get_color_tuple((device_profile["lights"][light]))
device.fx.advanced.matrix[ device.fx.advanced.matrix[lightmap[light][0], lightmap[light][1]] = (
lightmap[light][0], lightmap[light][1] color_tuple
] = color_tuple )
else: else:
device.fx.none() device.fx.none()
@ -214,12 +196,8 @@ def list_profiles():
def main(): def main():
global device_manager, lightmap_directory, profile_directory global device_manager, lightmap_directory, profile_directory
# Print greeter
print_greeter()
# Parse arguments # Parse arguments
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description="A simple command line frontend for OpenRazer.", description="A simple command line frontend for OpenRazer.",

View file

@ -2,11 +2,8 @@ from setuptools import setup
setup( setup(
name="rzr", name="rzr",
version="0.0.1", scripts=["./rzr"],
author="Denis Lehmann", py_modules=[],
author_email="denis@opaque.tech",
scripts=["bin/rzr"],
url="https://git.opaque.tech/denis/rzr",
license="LICENSE", license="LICENSE",
description="A simple command line frontend for OpenRazer", description="A simple command line frontend for OpenRazer",
long_description=open("README.org").read(), long_description=open("README.org").read(),