C.H.I.P. Console Kit - autostart PICO-8 with gamepad - how to!


I have managed to get the C.H.I.P. Console Kit with DIP to autostart PICO-8 at bootup with gamepad enabled.

First I created a .config/autostart/PICO8.desktop file that instructs the xfce debian based c.h.i.p operating system to launch a script named pico.sh at bootup.

Inside the pico.sh script I tell the os to first launch a terminal
then I wait for the operating system to initialise before launching pico-8 because if I launch pico-8 too early then it will fail to initialise its full-screen mode.
After pico-8 have started up i use a tool called wmctl to grab the pico8 window and then uses another tool called xdotool to send then 0 key to pico-8 without having to use a keyboard.
Finally I simulate pressin alt+tab twice to enable the gamepad by using the wmctl tool to first switch to the Terminal window that i opened earlier and then switch back to pico-8. Done! Now you can browse the pico-8 splore using the gamepad directly after bootup!

I have prepared a script that do all the things listed above on your C.H.I.P. console-kit system:

wget https://gongiversum.com/chip/console-kit.tar.gz
tar zxvf console-kit.tar.gz
sudo sh console-kit-setup.sh
sudo reboot

I hope these instructions and setup scripts will make your console kit more enjoyable!

I will continue and include the exact details found in the scripts installed by the above setup commands:

content of .config/autostart/PICO8.desktop

[Desktop Entry]

contents of the pico.sh

cd /home/chip

exo-open --launch TerminalEmulator
sleep 11
/usr/bin/pico8 &

sleep 8
#send key 0 to pico 8
wmctrl -a pico-8
xdotool key 0

# activate gamepad by switching between desktop and pico 8 using wmctrl
sleep 2
wmctrl -a Terminal
sleep 2
wmctrl -a pico-8

# try send 0 again to just in case
# the "you are now connected to wifi network" window popped up
# and receive the 0 we sent earlier
xdotool key 0

contents of the console-kit-setup.sh

apt update
apt install xdotool wmctrl


C.H.I.P. PICO-8 Console Kit - how to?
Pico-8 at native resolution using a 128x128 SPI TFT
Boot chip directly into pico8
Pocket Chip , Console Kit (HELP!)
Need to change hdmi resolution every reboot
Possible to skip the Pico-8 "press zero (0) to start" splash screen from command line?

this is a great workaround to the “bug” somewhere that doesn’t activate the gamepad until the second time the screen/window is activated. If this is happening with the xfce WM (and we already know it is an issue for the awesome WM) then it is most likely a bug in pico-8…

Now, just need to adapt this to the pocketChip too…:slight_smile:


Great work. This is exactly what I needed for my console kit. Works perfectly with an HDMI dip on my TV. Thank you!!

UPDATE: Sadly, it has stopped working after a reboot :frowning: It still launches pico8 on startup, but just stays on the pico8 press 0 to start screen. I connected a bluetooth keyboard and have to manually hit the 0 and manually app switch to activate the controller.

UPDATE 2: I added more sleep time in pico.sh and that seems to have fixed it. I changed “sleep 11” before pico8 launches to “sleep 15” :smile:


I think the “you are now connected to wifi network” window popped up and received the first 0 sent

I added an extra
xdotool key 0
at the end of the script after the alt-tab trick
just to be sure that pico-8 gets one 0


First thing I did was click on the “Don’t show this message again” when the Wifi connect and disconnect messages popped up. Getting rid of them didn’t fix it for me, but adding the extra wait time did the trick. I hadn’t thought about adding extra 0 key presses but that should work too.


You da real hero!


Have you fixed the sleep to sleep 15 on the script so it continues to work after reboot?


This is awesome. I was wondering why the Gamepad didn’t work on Pico-8, I just assumed that I got a faulty pad.


Now, how would I go about making CHIP just completely shut down when I exit Pico-8? Currently it just takes me back to the terminal emulator.


Pico8 is actually invoked from the script /usr/bin/pico8 in that script above… SO (using sudo) just edit it to do a shutdown -h 0 command…(or whatever you want to do when you exit it).

Since the script above opens it in the background and then sends all the other things to make the gamepad work, it will be able to do the shutdown. You might have to set the “setuid bit” to make the shutdown run as the root user (it needs root level access, and you can’t just use sudo to do that because you can’t enter the password!) If you google that, you should be able to make it work OK.

Just be aware that then this becomes a pretty much pico8 (or nothing) type system, since it autostarts pico8, and shuts down system when you exit.

Good Luck