Haiku scripting

You seem to be using backticks instead of single quotes around the message constants ‘tgll’.

This works:
hey LaunchBox 'tgll' of View 0 of Window 0

1 Like

I think that discourse replace backticks with quotes, I’ll try you suggestion at soon as possible, tnx

Maybe a bit more explanations on why this works:

The MessageReceived code you quoted is from PadView, which is a view inside the window. So, if you send the message to the app or to the window itself, they won’t know what to do with it. You have to send it to the view where that MessageReceived function knows how to handle it.

Fortunately, the interface kit provides some support for hey, so that it is easy to find that view (that’s what “of View 0 of Window 0” will do)

1 Like

Hi, this let you to change your wallpaper randomly, I suggest to use this at boot or in loop with sleep if you want to change it every x minutes


# path in which it your backgrounds are


# path in which it the wallpaper is, you need to set the desktop background with any real file with such name , as the background preflet does not accept symlinks

# beware: the file you have set earlier will be overwritten by the symlinks then, therefore use a copy or file that you do not want to keep

# let's build the "database"

readarray -t rnd_file <<< `find "${work_dir}" -type f`

# create a symlink of a random entry

ln -fs "${rnd_file[$(($RANDOM%${#rnd_file[@]}))]}" ${work_file}

# the real magic, this message forces tracker to update the background in a blink

hey -o Tracker 'Tbgr'

EDIT: a friend pointed me out the existence of “readarray”, tnx Laura


It would be nice to have such a thing as default settings in the background preferences.

Considering that’s something you can find on linux distribs maybe it could be added as an option to the background app?

In the last 15 years nobody gave it a go: #3951 (Add "Random" feature to Backgrounds) – Haiku
Step up, step up… :slight_smile:

1 Like

And you don’t have enough experience to do it now?

Maybe. There are so many projects and so few time…
Maybe one of the recent newcomers would like to try their hand. :slight_smile:


Perhaps it isn’t complicated enough to get people attention. Let’s take inspiration from Clipdinger darkening feature and imagine full theme switching depending of luminosity. So, you would have a clear theme in the morning to arrive by steps to a dark theme in the evening.

1 Like