fidget 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +42 -7
- data/bin/fidget +8 -2
- data/lib/fidget.rb +4 -2
- data/lib/fidget/platform/linux.rb +3 -2
- data/lib/fidget/platform/windows.rb +1 -1
- data/lib/fidget/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 071950c0536d7b69138334ac835bd62b2fb905e6
|
4
|
+
data.tar.gz: 144764a39998a5493f86d9a44af78e33db43d053
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
-
|
9
|
-
|
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
|
30
|
-
|
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
|
-
###
|
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
|
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 "
|
73
|
+
puts "\nNormal power management resumed."
|
68
74
|
end
|
data/lib/fidget.rb
CHANGED
@@ -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
|
35
|
-
Fidget::Platform.allow_sleep
|
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
|
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
|
data/lib/fidget/version.rb
CHANGED