xscreen_usb_unlocker 0.90.1 → 0.90.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,7 +5,7 @@ Options.banner = "Usage: Used to lock/unlock xscreensaver based on usb device id
5
5
  Options.on("-s", "--serial SERIAL", "make sure the device matches this serial.") { |s| Options[:serial] = s}
6
6
  Options.on("-d", "--device DEVICE", "make sure it is this specific device.") { |d| Options[:device] = d}
7
7
  Options.on("-D", "--daemonize", "Daemonize this process in the background.") { |d| Options[:daemonize] = true}
8
- Options.on("--save-config", "Save the device and serial to a config file and exit.") { |d| Options[:save_config] = true}
8
+ Options.on("--save-config", "Save the device and serial to a XscreenUsbUnlocker::Config file and exit.") { |d| Options[:save_config] = true}
9
9
  Options.parse!
10
10
 
11
11
  if !Options[:device] && !Options[:serial]
@@ -64,43 +64,41 @@ def toggle_lock
64
64
  end
65
65
  end
66
66
 
67
- if __FILE__ == $0
68
- # did we pry?
69
- Options.on_pry
70
-
71
- # should we save our config and bail?
72
- if Options[:save_config]
73
- Config["serial"] = Options[:serial] if Options[:serial]
74
- Config["device"] = Options[:device] if Options[:device]
75
- Config.save!
76
- puts "Saved configuration to #{Config.file}"
77
- exit
78
- end
79
-
80
- # kill a running copy of xscreensaver
81
- if xscreensaver_running?
82
- Log.info "xscreensaver appears to be running, killing so we can trap it."
83
- %x[killall -QUIT xscreensaver]
84
- end
67
+ # did we pry?
68
+ Options.on_pry
85
69
 
86
- # grab our notifications
87
- Notifier = INotify::Notifier.new
88
- Dir.glob("/dev/bus/usb/*").each do |d|
89
- Notifier.watch(d, :delete, :create) do
90
- toggle_lock
91
- end
92
- end
70
+ # should we save our config and bail?
71
+ if Options[:save_config]
72
+ XscreenUsbUnlocker::Config["serial"] = Options[:serial] if Options[:serial]
73
+ XscreenUsbUnlocker::Config["device"] = Options[:device] if Options[:device]
74
+ XscreenUsbUnlocker::Config.save!
75
+ puts "Saved configuration to #{Config.file}"
76
+ exit
77
+ end
93
78
 
94
- # fire off the lock cycle once.
95
- toggle_lock
79
+ # kill a running copy of xscreensaver
80
+ if xscreensaver_running?
81
+ Log.info "xscreensaver appears to be running, killing so we can trap it."
82
+ %x[killall -QUIT xscreensaver]
83
+ end
96
84
 
97
- # start the notifier, which will fire off callbacks as needed.
98
- if Options[:daemonize] || File.file?(Config.file)
99
- Log.debug "Opening logfile."
100
- Log.filename "/home/ebrodeur/.logs/xscreensaver_unlocker.log"
101
- Log.debug "Daemonizing."
102
- App.daemonize(:mulitple_pids => false) { Notifier.run }
103
- else
104
- Notifier.run
85
+ # grab our notifications
86
+ Notifier = INotify::Notifier.new
87
+ Dir.glob("/dev/bus/usb/*").each do |d|
88
+ Notifier.watch(d, :delete, :create) do
89
+ toggle_lock
105
90
  end
106
91
  end
92
+
93
+ # fire off the lock cycle once.
94
+ toggle_lock
95
+
96
+ # start the notifier, which will fire off callbacks as needed.
97
+ if Options[:daemonize] || File.file?(XscreenUsbUnlocker::Config.file)
98
+ Log.debug "Opening logfile."
99
+ Log.filename "/home/ebrodeur/.logs/xscreensaver_unlocker.log"
100
+ Log.debug "Daemonizing."
101
+ App.daemonize(:mulitple_pids => false) { Notifier.run }
102
+ else
103
+ Notifier.run
104
+ end
@@ -25,7 +25,7 @@ module XscreenUsbUnlocker
25
25
  super
26
26
 
27
27
  if @options[:version]
28
- puts XscreenUsbUnlocker::Version
28
+ puts XscreenUsbUnlocker::VERSION
29
29
  exit 0
30
30
  end
31
31
 
@@ -1,3 +1,3 @@
1
1
  module XscreenUsbUnlocker
2
- VERSION = "0.90.1"
2
+ VERSION = "0.90.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xscreen_usb_unlocker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.90.1
4
+ version: 0.90.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: