r/Deno • • 4d ago

Building deno-desktop GUI wrapper for linux CLI tool

Hi, I decided to use deno-desktop for building a linux GUI wrapper around existing CLI tool.

There is a tool for managing backups btrbk, which is CLI only. I created functional GUI wrapper for it. The hardest part was to run root-operations from webview. To achieve this I needed to use service-helper and Polkit. So overall architecture looks like this:

  • Frontend: React UI rendered inside a Deno Desktop webview window.
  • Unprivileged app backend (Deno): Runs as the normal user. It triggers native file/folder pickers via XDG Desktop Portal over D-Bus, parses btrbk configs and snapshot trees, and calls our system service.
  • Privileged root helper (packages/helper): A standalone compiled Deno binary (btrbk-gui-helper) running on the system D-Bus as com.snapshot_machine.BtrbkService1.

The GUI never runs with sudo or root. The helper checks incoming caller authority against Polkit actions (.configure, .run, .schedule) via org.freedesktop.PolicyKit1.Authority. Normal desktop users get the standard system Polkit prompt when authorization is needed

If you wanna build similar wrapper for another CLI tool, I made generic simple bilerplate: https://github.com/skorphil/linux-wrapper-starter

My app itself is in a very early stage, but if this idea of simple backup tool for linux sounds interesting, u can contribute or try it as well https://github.com/skorphil/snapshot-machine

2 Upvotes

1 comment sorted by

1

u/Ronin-s_Spirit 4d ago

I wouldn't use a JS runtime for something like that. There's no reason to not make a native program.