Hotkey support for "switch screen" in the driver please

 Hello , i got a kamvas 22 plus, and it doesnt have hardware buttons. This is no problem becasue i use my keyboard anyways


But one function from inside the huion driver can only be mapped to one of my pen-buttons , which is "switch screen" so i can use my pen on another monitor, which would otherwise be mapped to one of the buttons on the monitor (but my monitor doesnt have any buttons). I need the pen buttons for middle and rightclick obviously.

now i always have to use the mouse to get to another screen , which is not optimal.


As you already have a working "global hotkey" in Settings -> Hotkeys, please add a second one with the switch screen function , at least on the kamvas 22 (plus)


i made a quick mockup , your programmers could probably do that in under an hour , the code already exists for 90% of this request


i made a quick mockup

gggggg.jpg
(54.4 KB)

4 people like this idea
  • I came here looking for this same thing on Windows. Was hoping there was an official solution, but Alex's hack will work until we hopefully get one.


    A low tech and somewhat clunky workaround I've used is to set the middle click button to toggle screens by default except in a few programs where I actually need a middle click button (e.g. Blender). Then if I'm working in one of these programs, I just alt-tab out of them, and hit the middle button to toggle the screen. The same could be done in reverse, by having a small program (e.g. the calculator) with middle click set to toggle screens, and then alt-tab to that when you want to toggle.


    I also use it on Linux, and have written a small bash script to toggle the screen mapping there. Note that this is super specific to my setup, so you'll need to change a few things, for this to work with your setup, but if you're somewhat familiar with the terminal it should be doable.

    #!/bin/bash                                                                                                                                 
    
    
    HUION=~/.huion-mapping.cfg
    
    if $(xinput list --name-only | grep -q 'Huion Tablet_GT1562 Pen Pen (0)')
    then
        echo "Pen identified"
        if [ $(cat $HUION) -eq 1 ];
        then
            echo "Mapping to Huion Kamvas"
            xinput map-to-output "Huion Tablet_GT1562 Pen Pen (0)" HDMI-0
            echo "0" > $HUION
        else
            echo "Mapping to Dell U3011"
            xinput map-to-output "Huion Tablet_GT1562 Pen Pen (0)" DP-4
            echo "1" > $HUION
        fi
    else
        # This is needed, as the pen doesn't show up as a Virtual core pointer without it                                                       
        echo "Initiating pen"
        xinput map-to-output "Huion Tablet_GT1562 Pen" HDMI-0
        echo "0" > $HUION
    fi 

    Before editing the script, first run "xrandr" in the terminal to figure out the names of your displays. Mine show up as DP-4 and HDMI-0. This will depend on how you have your screens connected to your machine, so yours will likely be different.


    Then run "xinput list" in a terminal, to see the name of your device. I prefer using the name rather than the ID, as the ID can change from time to time.


    Save the script to a file called "huion-toggle" and run "chmod a+x huion-toggle" to make it executable.


    Replace my HDMI-0 and DP-0 with your screens in the script. Replace my tablet name with the one from you list. You may notice I have two variations of the tablet name, one with pen written twice. This is because the first time I connect the tablet, the pen only shows up under Virtual core keyboard, instead of under Virtual core pointer, when I run "xinput list". If you try to map the one under Virtual core keyboard, you'll get an error, but it will add a Pen entry under Virtual core pointer (with Pen Pen in the name), which you can then use to map the tablet.


    Finally, on Ubuntu got to "Keyboard Shortcuts" in the settings, and at the bottom hit the + sign to add a new keyboard shortcut. Set it to whatever key combo you want, and set the command to the full path to where you saved your huion-toggle script. (most other distros have a similar system wide keyboard shortcut setup you can use).

    This was just a quick hack from my side. I may improve on it a bit in the future to be more generic and hopefully work out of the box for more users without needing to edit the script. :)


    As a side note, it looks like xinput --get-prop "your_device_name" displays the mapping coordinates of your tablet, and xinput has a --set-prop option too, which it should in theory be possible to use to do manual calibration with. Mine maps pretty much perfectly out of the box, so I haven't messed with it.

  • @Alex Mehler This is just brilliant, and found your sollution on other site, and created an account just to congrat you!

Login or Signup to post a comment