Macro Pi

LCD Screen Raspberry Pi Macro Pad

The Macro Pi is a project that I built using a combination of a Raspberry Pi 4 (64 bit, 4 core CPU,
4GB RAM, with a wireless card for 2.4GHz WiFi and Bluetooth), a 3.5 inch LCD screen/case that
attached to the GP I/O pins, and some python and bash scripting. While the hardware may be a little
overkill for something this small of scale the end result was quite nice.

The Macro Pi utilizes the os.system() function to interact with the system terminal. It then calls
the screen command with the argument -S to name the screen and -dm to detach the screen from the
current terminal session as referred to in the documentation.

The GUI was created with the tkinter library and programs are called on button press. An example of
the Steam Flatpak being called looks something like this:

def steam():
os.system(‘screen -S Steam -dm ssh localServerIP “export DISPLAY=serverSessionNumber && flatpak run com.valvesoftware.Steam”’)

and then the function steam being passed through to the command variable in the ttk.Button:

ttk.Button(frm, text=”Steam”, command=steam).grid(column=1, row=2)

The portion “export DISPLAY=” needs to be set to the tty session of the server which can be found
by running the “w” command in the terminal. For my personal configuration the tty session is “:1”
so it would look like “export DISPLAY=:1”. This allows the graphical application to open on the
server rather than on the client. In this case without exporting the display the application would
attempt to open on the Raspberry Pi instead of opening on the laptop or desktop you are trying to
control.

The code can be found here at my GitHub