Skip to content

Commit

Permalink
print commands
Browse files Browse the repository at this point in the history
  • Loading branch information
llybin committed Feb 16, 2024
1 parent 90b2800 commit 7082700
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# Asus TUF Linux Keyboard Backlight Control

This is a simple application to control the keyboard backlight of Asus TUF Gaming laptops. It uses the `asus-nb-wmi` kernel module to control the backlight.
This was written just for fun in one night.

This was written just for fun in one night. I recommend using the [terminal commands](https://gist.github.com/llybin/4740e423d8281d839ef013b6cc93db7f).
## Non-GUI Usage

[terminal commands](https://gist.github.com/llybin/4740e423d8281d839ef013b6cc93db7f)

## Installation

Expand Down
10 changes: 7 additions & 3 deletions asustufkeyboard/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,26 @@ class CommandMixin:
def set_state(self):
boot, awake, sleep = [int(b.isChecked()) for b in self.state_buttons]
command = f"echo '1 {boot} {awake} {sleep} 1' > /sys/class/leds/asus::kbd_backlight/kbd_rgb_state"
print(command)
subprocess.run(command, shell=True)

def set_brightness(self):
brightness = self.brightness_buttons.index(
next(button for button in self.brightness_buttons if button.isChecked())
)
command = f"echo {brightness} > /sys/class/leds/asus::kbd_backlight/brightness"
print(command)
subprocess.run(command, shell=True)

def set_mode_color_speed(self, *args, **kwargs):
mode = self.mode_buttons.index(next(button for button in self.mode_buttons if button.isChecked()))
red = self.color_chooser.color_dialog.currentColor().red()
green = self.color_chooser.color_dialog.currentColor().green()
blue = self.color_chooser.color_dialog.currentColor().blue()
current_color = self.color_chooser.color_dialog.currentColor()
red = current_color.red()
green = current_color.green()
blue = current_color.blue()
speed = self.speed_buttons.index(next(button for button in self.speed_buttons if button.isChecked()))
command = f"echo '1 {mode} {red} {green} {blue} {speed}' > /sys/class/leds/asus::kbd_backlight/kbd_rgb_mode"
print(command)
subprocess.run(command, shell=True)


Expand Down

0 comments on commit 7082700

Please sign in to comment.