fidget 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 053aecb8ac134a93352ee94ad74e2b5d53391157
4
- data.tar.gz: a03308997ca134b329f148f477865d630b336efb
3
+ metadata.gz: 071950c0536d7b69138334ac835bd62b2fb905e6
4
+ data.tar.gz: 144764a39998a5493f86d9a44af78e33db43d053
5
5
  SHA512:
6
- metadata.gz: e891bb9f07dab6e7c6406cb1693cc59c84cf3ad3fce0f02741010af879d88e63cb9c982190ac418e53afa5fc63e981de9ed59d5d33ee97ed999ec053aaf76349
7
- data.tar.gz: 75076bdb11679fe0e55c2df30e62a03ef218d64e841923e2569113e5b7c7c795728f86eee6bdb96e6661f24eff86ea61674226a7aac82779a007ee8bb0af6d1d
6
+ metadata.gz: 02a03445b97d4f61a5ccccd827d1e747cdc850b57076395c99faa40cead70ad6967df6d78e77d97477c2a38b46ecda15341d13a8b9e45aca210eac0e33dfabc9
7
+ data.tar.gz: 9dcbb6fe00c3cb618f98b44754cd3fb164b68770237c5bc1cf11098ffe0c495142fb537375eb0d476aafef7808b1a72b138d04efc682f1ff2718c37fa79021d1
data/README.md CHANGED
@@ -1,12 +1,26 @@
1
1
  # Fidget
2
2
  A cross platform tool to prevent your computer from sleeping.
3
3
 
4
+
4
5
  ## Overview
5
6
 
6
- Usage : `fidget [-o <options>] [command]`
7
+ Do you really dig `caffeinate` on OS X and wish that you could use it on
8
+ Windows? Are you building something that supports multiple platforms and
9
+ need the display to stay on without much fuss? Does the phrase "[Yes.
10
+ `gnome-screensaver` has a simple to use DBus API for this](https://wiki.gnome.org/Projects/GnomeScreensaver/FrequentlyAskedQuestions#I.27m_developing_an_application_that_has_a_fullscreen_mode.__Is_there_a_way_that_I_can_disable_the_screensaver.3F)"
11
+ make you irrationally angry?
12
+
13
+ If so, this might be the tool for you. Fidget provides both a commandline
14
+ tool and a library to simply and easily inhibit sleep on all major platforms.
15
+
16
+
17
+ ## Usage
7
18
 
8
- Sleep options may very between platforms. Each platform will include at least
9
- the following core options:
19
+ $ fidget [-o <options>] [command]
20
+
21
+ Options should be passed as a comma-separated list. Sleep options may very
22
+ between platforms. Each platform will include at least the following core
23
+ options:
10
24
 
11
25
  * `display` will prevent the display from sleeping.
12
26
  * `sleep` prevent the system from sleeping.
@@ -26,10 +40,28 @@ Additional Linux options:
26
40
 
27
41
  * `blanking` disables terminal blanking on Linux.
28
42
 
29
- If you pass the a command, then Fidget will execute that command and prevent
30
- the system from sleeping until that command terminates. If you do not provide a
43
+ If you pass a command, then Fidget will execute that command and prevent the
44
+ system from sleeping until that command terminates. If you do not provide a
31
45
  command, then Fidget will prevent sleeping until you press Ctrl-C to terminate.
32
46
 
47
+ ### Examples
48
+
49
+ Simply keep the computer from sleeping until you press Ctrl-C
50
+
51
+ $ fidget
52
+ System has been prevented from sleeping.
53
+ - Press Ctrl-C to resume normal power management.
54
+
55
+ Pass options and run a command
56
+
57
+ $ fidget -o sleep,idle make
58
+
59
+
60
+ ## Installation
61
+
62
+ $ gem install fidget
63
+
64
+
33
65
  ## Library Usage
34
66
 
35
67
  There are three methods you may use in your programs. The `options` parameter
@@ -45,7 +77,7 @@ or symbols.
45
77
  * `Fidget.current_process(options)`
46
78
  * Shortcut method to inhibit sleep during the execution of the current process.
47
79
 
48
- ### Example usages:
80
+ ### Examples
49
81
 
50
82
  Default options, with a block:
51
83
 
@@ -100,7 +132,10 @@ Simply prevent the computer from sleeping while the current process is running:
100
132
 
101
133
  ## Limitations
102
134
 
103
- This is super early in development and has not yet been battle tested.
135
+ This is super early in development and has not yet been battle tested. If you
136
+ discover a platform it doesn't work on, or a use case that it should cover,
137
+ please do [file an issue](https://github.com/binford2k/fidget/issues)
138
+
104
139
 
105
140
  ## Disclaimer
106
141
 
data/bin/fidget CHANGED
@@ -22,6 +22,7 @@ Additional OS X options:
22
22
 
23
23
  Additional Windows options:
24
24
  * 'away' enables a low-power, but not sleeping, mode on Windows.
25
+ * `simulate` will simulate a user keyboard action every few seconds.
25
26
 
26
27
  Additional Linux options:
27
28
  * 'blanking' disables terminal blanking on Linux.
@@ -35,10 +36,15 @@ command, then Fidget will prevent sleeping until you press Ctrl-C to terminate.
35
36
  options = arg.split(',').map{ |e| e.to_sym }
36
37
  end
37
38
 
38
- opts.on("-d", "--debug", "Display or log debugging messages") do
39
+ opts.on("-d", "--debug", "Display debugging messages") do
39
40
  loglevel = Logger::DEBUG
40
41
  end
41
42
 
43
+ opts.on("-v", "--version", "Display the version of Fidget") do
44
+ puts Fidget::VERSION
45
+ exit(0)
46
+ end
47
+
42
48
  opts.separator('')
43
49
 
44
50
  opts.on("-h", "--help", "Displays this help") do
@@ -64,5 +70,5 @@ begin
64
70
  sleep
65
71
  end
66
72
  rescue Interrupt => e
67
- puts "Normal power management resumed."
73
+ puts "\nNormal power management resumed."
68
74
  end
@@ -1,4 +1,6 @@
1
1
  class Fidget
2
+ require 'fidget/version'
3
+
2
4
  case Gem::Platform.local.os
3
5
  when /darwin/
4
6
  require 'fidget/platform/darwin'
@@ -31,8 +33,8 @@ class Fidget
31
33
  end
32
34
  end
33
35
 
34
- def self.allow_sleep(handle)
35
- Fidget::Platform.allow_sleep(handle)
36
+ def self.allow_sleep
37
+ Fidget::Platform.allow_sleep
36
38
  end
37
39
 
38
40
  end
@@ -22,7 +22,7 @@ class Fidget::Platform
22
22
  pid
23
23
  end
24
24
 
25
- def self.allow_sleep(handle)
25
+ def self.allow_sleep
26
26
  options = munge(options)
27
27
  resume(options)
28
28
  end
@@ -61,9 +61,10 @@ class Fidget::Platform
61
61
  # This is possibly because the inhibit expires when the dbus-session command terminates
62
62
  # I don't know if this will work in other distros though. Yay for consistency. *\o/*
63
63
  begin
64
- dbus_screensaver.Inhibit(root_win, 'Administratively disabled')
64
+ @@cookie = dbus_screensaver.Inhibit(root_win, 'Administratively disabled')
65
65
  rescue => e
66
66
  STDERR.puts 'Fidget: DBus action failed.'
67
+ STDERR.puts e.message
67
68
  STDERR.puts e.backtrace.join "\n"
68
69
  end
69
70
  end
@@ -29,7 +29,7 @@ class Fidget::Platform
29
29
  pid
30
30
  end
31
31
 
32
- def self.allow_sleep(handle)
32
+ def self.allow_sleep
33
33
  set_state(nil)
34
34
  end
35
35
 
@@ -1,3 +1,3 @@
1
1
  class Fidget
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fidget
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Ford