Skip to content

Instantly share code, notes, and snippets.

@RyanScottLewis
Created September 23, 2016 18:38
Show Gist options
  • Save RyanScottLewis/f677966fefa8e5192015be53e058755e to your computer and use it in GitHub Desktop.
Save RyanScottLewis/f677966fefa8e5192015be53e058755e to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# vim: syntax=ruby
# light v0.0.1
# Display a bright screen to use your device's screen as a light
#
# Created By: Ryan Scott Lewis <[email protected]>
# License: MIT
# TODO
# * Add label saying how to quit (using the ESCAPE KEYS and Gdk::Keyval.to_name)
# * Change colors! HSV or RGB mode
# * Remember state ^
# * Configuration to change quit screens
# # Option for starting in fullscreen or not
# # Slow startup, maybe use something other than GTK for this or try in C
require 'gtk3'
ESCAPE_KEYS = [Gdk::Keyval::KEY_Escape, Gdk::Keyval::KEY_q]
window = Gtk::Window.new('Light')
window.set_size_request(400, 400)
window.set_border_width(10)
color = Gdk::RGBA.new(1, 1, 1, 1)
window.override_background_color(0, color)
window.signal_connect('key-press-event') do |widget, event|
Gtk.main_quit if ESCAPE_KEYS.include?(event.keyval)
end
window.show_all
window.fullscreen
Gtk.main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment