'Restart TotalFinder' in menu bar, on addition to existing 'Restart Finder'



Because of a bug in Finder (not TotalFinder), I have to restart/relaunch Finder often to make the icons on the Desktop match the content of the ‘~/Desktop’ folder. Sometimes, new files don’t appear, sometimes, deleted files still have icons on the Desktop.

I understand why restarting Finder doesn’t automatically restart TotalFinder, this may cause infinite restart loops.

I made a script to fully automate restarting Finder and TotalFinder from the command line. It’s included below for anyone else having the same issue I do.

A much better and more convenient solution would be to have a ‘Restart TotalFinder’ entry in the menu bar next to the existing ‘Restart Finder’ entry.

# -*- coding: utf-8 -*-

# standard packages
import os
import signal
import sys

# non-standard packages which may need to be installed
  import psutil
except ImportError:
  print("psutil not installed, do it by running:")
  print("pip install psutil")

def killall_wait(match_string):
  # get list of process whose info contain 'match_string'
  cmd = os.popen("ps ax | grep " + match_string + " | grep -v grep")
  ps_lines ="\n")[:-1]
  del cmd
  # extract pids
  pids = [int(ps_line.split()[0]) for ps_line in ps_lines]
  del ps_lines
  # issue kill commands
  for pid in pids:
    os.kill(pid, signal.SIGKILL)
  # wait for kill commands to complete
  for pid in pids:
    while psutil.pid_exists(pid):

if __name__ == "__main__":
  # kill all Finder related process (including TotalFinder if running)
  # Finder will automatically restart (fixing desktop as expected side effect),
  # we need to restart 'TotalFinder', not done automatically to avoid crashing
  # loop.
  os.popen("open /Applications/").close()


You can restart Total Finder from the system applications folder. That works fine.