Sha256: 8fdcb9d09b8912394be62002b73f2e549b68ec968e44eba33ffffb5c85e3425b

Contents?: true

Size: 454 Bytes

Versions: 1

Compression:

Stored size: 454 Bytes

Contents

#!/usr/bin/env ruby

require 'neatjson'
@hash = {}
begin
  loop do
    sleep 15
    x = `xprop -id $(xprop -root 32x '\t$0' _NET_ACTIVE_WINDOW | cut -f 2) _NET_WM_NAME`
    x = x.match(/.*\"(.*)\"\n\z/)[1][0..60]
    @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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
clock_window-0.0.1 exe/clock_window