dumon 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: acc82471c1842c62b7a7cb432e20194d7ebf579a
4
+ data.tar.gz: 30145a002f41442f2b807e36c47c5771f6c0d664
5
+ SHA512:
6
+ metadata.gz: 2d4c3f4f8a83ffbd3a467bac3af0ed981b3b10211e5d58e1de1708c2b978eb1f97a13e0023233a898fd8688e841469b6d0bb829ae265e683a9628d39ed61e425
7
+ data.tar.gz: c7283d64b5ecf1612cc531508307a8c79ed5916c5b83d43efc622eee9711d72049ff749d2e71826ed9c2f0336070d48f789f4f498f55d74b7e8c102a892e1c01
@@ -75,6 +75,15 @@ module Dumon
75
75
  Dumon::App.instance.current_profile = options
76
76
  end
77
77
 
78
+ ###
79
+ # Resets output to the first one delivered by the underlaying system tool
80
+ # and switches to its default resolution.
81
+ def reset
82
+ assert(!outputs.nil?, 'no outputs found')
83
+ out = outputs.keys.first
84
+ switch :mode => :single, :out => out, :resolution => default_resolution(out)
85
+ end
86
+
78
87
  ###
79
88
  # Reads info about current accessible output devices and their settings.
80
89
  # Readed infos will be stored and accessible via reader 'outputs'.
data/lib/dumon/version.rb CHANGED
@@ -2,6 +2,7 @@ module Dumon
2
2
 
3
3
  # Version history.
4
4
  VERSION_HISTORY = [
5
+ ['0.2.4', '2013-03-29', 'New CLI argument: --reset, tested with MRI Ruby 2.0.0'],
5
6
  ['0.2.3', '2013-03-17', 'BF #10: Profile dialog fails unless configuration exists'],
6
7
  ['0.2.2', '2013-03-15', 'Enh #6: Vertical location of outputs'],
7
8
  ['0.2.1', '2013-03-13', 'BF #9: Crash Ruby 1.8.7 because of Dir.home'],
data/lib/dumon.rb CHANGED
@@ -43,10 +43,6 @@ module Dumon
43
43
  def initialize
44
44
  @ui = new_ui
45
45
  Dumon::logger.debug "Used UI: #{ui.class.name}"
46
-
47
- # storage of preferred resolution for next rendering (will be cleared by output changing)
48
- # {"LVDS1" => "1600x900", "VGA1" => "800x600"}
49
- @selected_resolution = {}
50
46
  end
51
47
 
52
48
  ###
@@ -145,14 +141,35 @@ Dumon::logger.level = Logger::INFO
145
141
  Dumon::logger.info \
146
142
  "Dumon #{Dumon::VERSION}, running on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
147
143
 
144
+
148
145
  # Capturing Ctrl+C to cleanly quit
149
- trap('INT') do
146
+ Signal.trap('INT') do
150
147
  Dumon::logger.debug 'Ctrl+C captured'
151
148
  Dumon::App.instance.quit
152
149
  end
150
+ # Capturing user signal to reset output settings
151
+ Signal.trap('SIGUSR1') do
152
+ Dumon::App.instance.ui.omanager.reset
153
+ end
154
+
155
+
156
+ # Sending a signal to existing Dumon's instance to reset output to a default device
157
+ # (first output with native resolution).
158
+ if ARGV.include?('--reset')
159
+ ps = `ps ax | grep -i 'ruby.*dumon' | grep -v #{Process.pid} | grep -v grep`
160
+ if ps.nil? or ps.empty?
161
+ Dumon::logger.warn "No running Dumon instance found"
162
+ else
163
+ pid = ps.split[0].to_i
164
+ `kill -s SIGUSR1 #{pid}`
165
+ Dumon::logger.info "Signal SIGUSR1 sent to already running Dumon instance, pid=#{pid}"
166
+ end
167
+ exit
168
+ end
153
169
 
154
170
 
155
- # development mode
171
+ ##################
172
+ # DEVELOPMENT MODE
156
173
  if __FILE__ == $0
157
174
  Dumon::logger.level = Logger::DEBUG
158
175
  Dumon::App.instance.run(ARGV.include? '--daemon')
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dumon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
5
- prerelease:
4
+ version: 0.2.4
6
5
  platform: ruby
7
6
  authors:
8
7
  - Vaclav Sykora
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-03-17 00:00:00.000000000 Z
11
+ date: 2013-03-29 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: gtk2
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
@@ -55,28 +52,27 @@ files:
55
52
  - test/test_rrutils_options.rb
56
53
  homepage: http://github.com/veny/dumon
57
54
  licenses: []
55
+ metadata: {}
58
56
  post_install_message:
59
57
  rdoc_options:
60
58
  - --charset=UTF-8
61
59
  require_paths:
62
60
  - lib
63
61
  required_ruby_version: !ruby/object:Gem::Requirement
64
- none: false
65
62
  requirements:
66
- - - ! '>='
63
+ - - '>='
67
64
  - !ruby/object:Gem::Version
68
65
  version: '0'
69
66
  required_rubygems_version: !ruby/object:Gem::Requirement
70
- none: false
71
67
  requirements:
72
- - - ! '>'
68
+ - - '>'
73
69
  - !ruby/object:Gem::Version
74
70
  version: 1.3.1
75
71
  requirements: []
76
72
  rubyforge_project:
77
- rubygems_version: 1.8.23
73
+ rubygems_version: 2.0.0
78
74
  signing_key:
79
- specification_version: 3
75
+ specification_version: 4
80
76
  summary: Dual monitor manager for Linux.
81
77
  test_files:
82
78
  - test/test_rrutils_options.rb