ActivePen2 top button


first of all this is not about the touchsupport of the active pen but the top button some pens have!
In the last day or two i tryed setting up the top button of the lenovo active pen 2 and had some trouble…
The conection via bt was no problem (holding down top button 5-7sec) but then the pen will disconect.
The intended behavior(from lenovo active pen2) is as follows: when pressing the top button (short) the device will connect via bt and then send a key press after that it will disconect again.

The initial idea was to use udev rules but these never applyed with the pen maybe the connection time was too short ? information on this is welcome!
The workaround i use now is to use a service which uses
udevadm monitor (shows connection of the pen) and then check if the connected device is the pen…
this works and i can now use the top button!

if someone wants to use my solution u need to add a service with the following:

Description=active-pen2 top-button

ExecStartPre=/bin/sleep 10
SuccessExitStatus=3 4
RestartForceExitStatus=3 4


and the activePen2 file should contain


export DISPLAY


udevadm monitor | while read -r line
    if [[ $line == "KERNEL"*"add"*"hci0:3585"*"bluetooth"* ]]; then
        if pgrep -x "$SERVICE" >/dev/null
            #xournal  is running wannt to open the sidebar in xournal(shortcute f12)
            xte "key F12"
            #xournal not running open it now
            sudo -u felix_j xournalpp &>/dev/null &
exit 0

if you have a cleaner solution using udev pls comment !
my udev rule to test if my pen would raise a add action was
ACTION=“add”, RUN+=“sudo -u felix_j xournalpp &>/dev/null &”
this would work if connecting a usb device or headphones but not with the active pen2 top button

Best reagards

I may be misunderstanding your topic but activepen2 - Are you sure this is a bluetooth devices - and have a button at the top?

I have a lenovo miix2 700 with something called activepen2 and it is not a bt device and has no top button. It has two buttons on the side but the general functionality of the pen is limited on Linux.

edit: I just did a search for activepen2 and admittedly there is one - I am confused - and probably others with me.

didn’t know that there are multiple active pen 2’s from lenovo sorry
this one and you can see the top button and its also just a minor problem since the side buttons and the writing itself works :wink:
and yes it is a bt device but only the top button all other buttons do not need bt!

i cant post links / pics here but here is the article nr GX80N07825