Code Monkey home page Code Monkey logo

Comments (8)

Shinyzenith avatar Shinyzenith commented on August 29, 2024

Thank you for your interest in the project, I will look into the following keys and implement them tomorrow.

from swhkd.

Shinyzenith avatar Shinyzenith commented on August 29, 2024

image
Hi are you talking about this key? I see quite a few under display and I don't know what function the key serves.

from swhkd.

Shinyzenith avatar Shinyzenith commented on August 29, 2024

https://docs.rs/evdev/latest/src/evdev/scancodes.rs.html
Found nothing under the name launch, maybe it's under some other name? if you can find it above I can bind it.
If it's not in that list, I can't bind that key.

from swhkd.

dithpri avatar dithpri commented on August 29, 2024

From what evtest tells me, the key for XF86Launch1 is KEY_PROG1, and for XF86Display is KEY_SWITCHVIDEOMODE though I can't use them by default on my Thinkpad with swhkd because of this check:

if device.supported_keys().map_or(false, |keys| keys.contains(Key::KEY_ENTER)) {

Both keys are in a separate device to the keyboard which does not contain an enter key:

Input driver version is 1.0.1
Input device ID: bus 0x19 vendor 0x17aa product 0x5054 version 0x4101
Input device name: "ThinkPad Extra Buttons"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 113 (KEY_MUTE)
    Event code 114 (KEY_VOLUMEDOWN)
    Event code 115 (KEY_VOLUMEUP)
    Event code 120 (KEY_SCALE)
    Event code 140 (KEY_CALC)
    Event code 142 (KEY_SLEEP)
    Event code 144 (KEY_FILE)
    Event code 148 (KEY_PROG1)
    Event code 152 (KEY_SCREENLOCK)
    Event code 156 (KEY_BOOKMARKS)
    Event code 158 (KEY_BACK)
    Event code 171 (KEY_CONFIG)
    Event code 173 (KEY_REFRESH)
    Event code 190 (KEY_F20)
    Event code 191 (KEY_F21)
    Event code 194 (KEY_F24)
    Event code 205 (KEY_SUSPEND)
    Event code 212 (KEY_CAMERA)
    Event code 217 (KEY_SEARCH)
    Event code 224 (KEY_BRIGHTNESSDOWN)
    Event code 225 (KEY_BRIGHTNESSUP)
    Event code 227 (KEY_SWITCHVIDEOMODE)
    Event code 228 (KEY_KBDILLUMTOGGLE)
    Event code 236 (KEY_BATTERY)
    Event code 237 (KEY_BLUETOOTH)
    Event code 238 (KEY_WLAN)
    Event code 240 (KEY_UNKNOWN)
    Event code 372 (KEY_ZOOM)
    Event code 374 (KEY_KEYBOARD)
    Event code 444 (?)
    Event code 445 (?)
    Event code 446 (?)
    Event code 466 (KEY_FN_F1)
    Event code 475 (KEY_FN_F10)
    Event code 476 (KEY_FN_F11)
    Event code 485 (?)
    Event code 582 (KEY_VOICECOMMAND)
    Event code 592 (KEY_BRIGHTNESS_MIN)
    Event code 634 (?)
  Event type 4 (EV_MSC)
    Event code 4 (MSC_SCAN)
  Event type 5 (EV_SW)
    Event code 3 (SW_RFKILL_ALL) state 1
Properties:
Testing ... (interrupt to exit)

If that check is modified so that this device is recognized as a keyboard by swhkd, KEY_PROG1 and KEY_SWITCHVIDEOMODE work.

(The modification I did for testing was just returning true except for swhkd virtual output devices, but that disabled my mouse :P )

from swhkd.

Shinyzenith avatar Shinyzenith commented on August 29, 2024

(The modification I did for testing was just returning true except for swhkd virtual output devices, but that disabled my mouse :P )

That is because we use that function to get valid keyboard and then call kernel grab syscall, so when you hardcoded true, it grabbed your mouse too.

If that check is modified so that this device is recognized as a keyboard by swhkd, KEY_PROG1 and KEY_SWITCHVIDEOMODE work.

Understood. Do you have any ideas for better keyboard checking? Checking for key_enter is definitely not ideal.

from swhkd.

dithpri avatar dithpri commented on August 29, 2024

Maybe detecting if something is not a keyboard? (Detecting if it's a mouse or joystick, etc.)

The only other type of detection I can think of is checking if it supports any possibly grabbable keys.

from swhkd.

Shinyzenith avatar Shinyzenith commented on August 29, 2024

Maybe detecting if something is not a keyboard? (Detecting if it's a mouse or joystick, etc.)

Doesn't sound robust due to a couple reasons:

  1. We would need to hard code multiple device states.
  2. A lot of input devices share common characteristics such as buttons.
  3. Evdev also handles output devices so we would need to write cases for them too.

from swhkd.

Shinyzenith avatar Shinyzenith commented on August 29, 2024

The only other type of detection I can think of is checking if it supports any possibly grabbable keys.

Afaik, key's aren't grab-able, output/input devices are.

from swhkd.

Related Issues (20)

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.