macopix-fortune

A script to use the output of a command for MaCoPiX's click word.

Problem

MaCoPiX lets you set a string for your mascot to say on click (the click word), but it's not dynamic.

Solution

Use MaCoPiX's Time Signal option to run a script every hour that replaces the click word with the output of a command.

Script

#!/bin/sh

MASCOT=/path/to/mascot.mcpx
COMMAND=fortune

sed 's/^click_word.*$/click_word='"$($COMMAND | sed ':a;N;$!ba;s/\n/ /g')"'/' $MASCOT >$MASCOT.tmp &&
mv $MASCOT.tmp $MASCOT

kill $(pidof macopix)
macopix -s $MASCOT &

Usage

  1. Set MASCOT to the path of your mascot file
  2. Set COMMAND to the command you want to use
  3. Set up MaCoPiX's Time Signal:
  4. config

License

Distributed under the ISC license.