def act_on_change(self, screen, workspace):
        self.workspaces = screen.get_workspaces()
        key = self.workspaces.index(workspace)
        currtime = time.time()
        span = currtime - self.starttime
        # try get current time for key, add key if needed
        try:
            curr_spent = self.workspace_data[key]["time"]
        except KeyError:
            curr_spent = 0
            self.workspace_data[key] = {
                "time": curr_spent,
                "custom_name": "workspace: " + str(key + 1)
            }
        self.workspace_data[key]["time"] = curr_spent + span
        self.starttime = currtime
        open(self.logfile, "wt").write(str(self.workspace_data))