Giter Club home page Giter Club logo

scrolllock-wlroots-workaround's Introduction

scrolllock-wlroots-workaround

A workaround to activate Scroll Lock LED (the backlight in some keyboards) in wlroots based compositors.

According to this swaywm/sway#5342 (comment), the LEDs appear to be updated post-key-release regardless of the key, which causes the backlight to be disabled immediately after turning it on. LEDs now only update when a LED changes. A workaround is still needed though.

If you are using GNOME/Mutter you can use these workarounds in combination with the first workaround in this repo.

Related issues and links:

Issue on Gitlab | Backlight activated by the Scroll Lock LED can't be turn on

Merge request on Gitlab | types/wlr_keyboard.c : keyboard_led_update when leds is change (Merged)

libinput/issue #11 | scrolllock, the only key that can switch keyboard back light can't be activated

libinput/issue #102 | Scroll Lock doesn't work as expected

Reddit | I can't enable Scroll Lock to turn keyboard's LED lights [Devastador 2 Gaming Keyboard]

Workarounds

The python script workaround gives the same results as using xset led named "Scroll Lock" in Xorg, but requires executing a python script and executing it as root. This script should also work on GNOME/Mutter (untested).

Since the second "workaround" got merged, there's not need to patch wlroots anymore. I still recommend using the python script to prevent the CapsLock and NumLock from turning off the LED

Workaround - Python script

Download it here.

Requires to run the script with admin-level access. (It reads from /dev/input/event and /sys/class/leds/)

This script is based on libinput/examples/led-toggle.py

Dependencies

libevdev

Execution steps

After installing the necessary packages and modules, and downloading the script. You can proceed to execute it.

Usage

python ledToggler.py <path> <keystr> <ledstr> <forceLed> <startLed>

If you just want to enable your scroll lock LED use and toggle it as you want, then use: python ledToggler.py /dev/input/eventX scrolllock scrolllock 1 1

Replace X with your keyboard's handle event number. You can check it using: cat /proc/bus/input/devices

Arguments/Options explanation

<path> refers to the event path of your keyboard. dev/input/eventX

<keystr> refers to the name of the toggle key. numlock, capslock, scrolllock

<ledstr> refers to the name of the LED that you want to toggle. numlock, capslock, scrolllock

<forceLed> when disabled it won't force the LED to stay on (susceptible to LEDs updates), when enabled it forces the LED to stay on unless the toggle key state is off. 0, 1

Important: <forceLed> is useful to have it enabled because when CapsLock or NumLock are pressed, the ScrollLock LED turns off. When enabled, visually, the LED doesn't turn off.

<startLed> when disabled upon execution the script won't turn on the LED, when enabled upon execution the script will turn on the LED. 0, 1

Commands to toggle the LED

You can use these commands to toggle the LED without the python script:

brightnessctl --device='*::scrolllock' set 1 # ON
brightnessctl --device='*::scrolllock' set 0 # OFF

# Alternative
sudo sh -c 'echo 1 > /sys/class/leds/inputX::scrolllock/brightness' # ON
sudo sh -c 'echo 0 > /sys/class/leds/inputX::scrolllock/brightness' # OFF

You can also use these workarounds to activate the LEDs.


scrolllock-wlroots-workaround's People

Contributors

bigrand avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.