Sha256: c1fc42e63839de7605f2f8b3c279d5efd2a26b4c5e567bf71e729c84cc9832c8

Contents?: true

Size: 745 Bytes

Versions: 6

Compression:

Stored size: 745 Bytes

Contents

Shoes.app title: "Sleepless", width: 80, height: 120 do
  @push = button "☕️"
  @note = para "😪"
  @push.click {
    if @pid.nil?
      if RUBY_PLATFORM =~ /darwin/
        @pid = spawn("caffeinate -d")
      elsif RUBY_PLATFORM =~ /linux/
        @pid = spawn("xset s off -dpms")
      elsif RUBY_PLATFORM =~ /win32|win64|\.NET/
        @pid = spawn("powercfg -change -monitor-timeout-ac 0")
      end
      @note.replace "😳"
    else
      if RUBY_PLATFORM =~ /darwin/
        system("kill #{@pid}")
      elsif RUBY_PLATFORM =~ /linux/
        system("kill -9 #{@pid}")
      elsif RUBY_PLATFORM =~ /win32|win64|\.NET/
        system("taskkill /pid #{@pid} /f")
      end
      @pid = nil
      @note.replace "😪"
    end
  }
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
scarpe-0.4.0 examples/sleepless.rb
scarpe-0.3.0 examples/sleepless.rb
scarpe-0.2.2 examples/sleepless.rb
lacci-0.2.1 examples/sleepless.rb
scarpe-0.2.1 examples/sleepless.rb
scarpe-0.2.0 examples/sleepless.rb