#!/usr/bin/env ruby require 'clock_window' @hash = {} begin loop do sleep 15 x = ClockWindow::ClockIt.new.active_window @hash[x] = @hash[x].to_f + 0.25 end ensure @hash = {"*---------- WINDOW NAME ----------*" => "minutes"}.merge(@hash) File.open("timelog.json","w") do |f| f.write(JSON.neat_generate(@hash,aligned:true,around_colon:1)) end end