Revert "slim: remove duplicate code"

This reverts commit f7d5e83abbe95ed06aac58f4d1a2e971fae4d186.  It
breaks the Firefox and Xfce tests:

  in job ‘tests.firefox.x86_64-linux’:
  cannot coerce a boolean to a string

  in job ‘tests.xfce.x86_64-linux’:
  infinite recursion encountered