Skip to content

Simplicity

probonopd edited this page Nov 3, 2022 · 14 revisions

helloSystem wants to create a "simple, yet powerful" desktop experience.

  • Design is how it works, not just how it looks
  • Simplicity wins
  • Less, but better

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

Example: Keeping a user process running all the time

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: Getting 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: Telling the file manager to open a folder

The complicated solution

  1. Understand the concepts of interfaces, paths, objects, methods, and whatnot
  2. Write an XML file
  3. Execute
$ gdbus call --system \
    --dest org.freedesktop.FileManager1 \
    --object-path /org/freedesktop/FileManager1 \ 
    --method org.freedesktop.FileManager1.ShowItems \ 
     '["file:///usr"]' "" 

Note that the exact same combination of org, freedesktop, and FileManager1 has to be used no less than three(!) times in different(!) notiations.

(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)

Example: Autostarting an application

[Desktop Entry]
Version=1.0
Exec=/System/Dock.AppDir/AppRun
Terminal=false
Type=Application
X-GNOME-Autostart-...=...
X-KDE-autostart-...=...
  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

(As seen in xdg)

The simple but powerful solution

ln -s /System/Dock.AppDir /Applications/Autostart

(As seen in helloSystem)