#! /usr/bin/python3 -u

import re
import sys
from datetime import datetime,timedelta

wminfo  = ""
title   = ""
sysinfo = ""
notif   = ""
notif_t = datetime.now()
notif_timeout = timedelta(seconds=5)

for line in sys.stdin:
  line = line.rstrip()

  if line.startswith("T"):
    title = ">>>> {}".format(line[1:]) if len(line) > 1 else ""

  if line.startswith("S"):
    if (datetime.now() - notif_t) > notif_timeout: notif = ""
    sysinfo = line[1:]

  if line.startswith("N"):
    notif_t = datetime.now()
    notif = line[1:]

  if line.startswith("W"):
    wminfo = "DESKTOPS:"
    for item in line[1:].split(":"):
      if re.match(r"^[OUF]",item):
        wminfo = "{} %{{F#ff0000}}{}%{{F-}}".format(wminfo,item[1:])
      if re.match(r"^[ou]",item):
        wminfo = "{} {}".format(wminfo,item[1:])

  print("{} {} %{{c}} {} %{{r}} {}".format(wminfo,title,notif,sysinfo))
