Skip to content

Simplicity

probonopd edited this page Nov 3, 2022 · 14 revisions

helloSystem wants to create a simple yet powerful desktop experience.

  • Simplicity wins
  • Less, but better
  • Small tools that each do one job well

On this page we collect some examples of what we mean by that.

Example: Keep a user process running all the time

Use Case: I want to have baloo_file run all the time as a user process, and have it restarted if it crashes.

The complicated solution

[Unit]
After=network.target
Description=...

[Service]
Group=...
ExecStart=/usr/local/bin/baloo_file
Restart=always
TimeoutStartSec=0
Type=simple
User=...
WorkingDirectory=...

[Install]
WantedBy=multi-user.target
  1. Learn about all the fields and what they mean
  2. Write something like the above
  3. Find out how to name this file
  4. Find out where to put this file and save it there
  5. Activate this file using a command that needs to be found out
  6. Start this service using a command that needs to be found out

(As seen in systemd)

The simple but powerful solution

daemon -r baloo_file

(As seen in FreeBSD)

Example: Get the thumbnail for a file

The complicated solution

  1. Take the path
  2. Convert it to an URI
  3. Hash the URI with md5
  4. Find out in which multiple locations of indefinitely many possible locations thumbnails are stored
  5. Check each of those locations for potentially matching files
  6. Have an elaborated system in place that changes the thumbnail if the file contents change
  7. Have an elaborated system in place that cleans up thumbnails of deleted files

No one really knows whether file:///home/user/Music/Herbert Gr\xC3\xB6nemeyer - Bochum (Remastered 2016)/01 - Bochum (Remastered 2016).mp3 is correct, or c18a5600cbfbe514a6291ad8d28f106e for that matter.

(As seen in XDG)

The simple but powerful solution

Read the thumbnail xattr on /home/user/Music/Herbert Grönemeyer - Bochum (Remastered 2016)/01 - Bochum (Remastered 2016).mp3

(As soon seen in helloSystem)

Example: Send a message to a running process

The complicated solution

$ gdbus call --system \
    --dest org.freedesktop.FileManager1 \
    --object-path /org/freedesktop/FileManager1 \ 
    --method org.freedesktop.FileManager1.ShowItems \ 
     '["file:///usr"]' "" 

(As seen in D-Bus)

The simple but powerful solution

call 'org.freedesktop.FileManager1.ShowItems' '/usr'

(As maybe one time in the distant future seen in helloSystem)

Clone this wiki locally