ruby-wmctrl 0.0.1

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.
@@ -0,0 +1,3 @@
1
+ module WMCtrl
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,26 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "wmctrl/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "ruby-wmctrl"
7
+ s.version = WMCtrl::VERSION
8
+ s.authors = ["Takayuki YAMAGUCHI"]
9
+ s.email = ["d@ytak.info"]
10
+ s.homepage = ""
11
+ s.summary = "Ruby bindings to control windows"
12
+ s.description = "Ruby bindings to control windows in EWMH and NetWM compatible X Window manager, which is created from source code of wmctrl command."
13
+
14
+ s.rubyforge_project = "ruby-wmctrl"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib", "ext"]
20
+ s.extensions = Dir.glob("ext/**/extconf.rb")
21
+
22
+ # specify any dependencies here; for example:
23
+ s.add_development_dependency "rspec"
24
+ s.add_development_dependency "yard"
25
+ s.add_runtime_dependency "pkg-config"
26
+ end
@@ -0,0 +1,30 @@
1
+ require 'wmctrl'
2
+ require 'pp'
3
+
4
+ pid1 = Process.spawn('zenity --calendar')
5
+ pid2 = Process.spawn('zenity --calendar')
6
+
7
+ sleep(0.1)
8
+
9
+ wm = WMCtrl.new
10
+
11
+ pp wm.list_windows
12
+ win1 = wm.list_windows.find do |h|
13
+ h[:pid] == pid1
14
+ end
15
+ win2 = wm.list_windows.find do |h|
16
+ h[:pid] == pid2
17
+ end
18
+
19
+ wm.action_window(win1[:id], :move_resize, 0, 0, 0, -1, -1)
20
+ wm.action_window(win2[:id], :move_resize, 0, 300, 0, -1, -1)
21
+
22
+ wm.action_window(win1[:id], :activate)
23
+ puts "Activate another calendar after 1 second"
24
+ sleep(1)
25
+ wm.action_window(win2[:id], :activate)
26
+
27
+ puts "Close calendars after 1 second"
28
+ sleep(1)
29
+ wm.action_window(win1[:id], :close)
30
+ wm.action_window(win2[:id], :close)
@@ -0,0 +1,5 @@
1
+ require 'wmctrl'
2
+ require 'pp'
3
+
4
+ wm = WMCtrl.new
5
+ pp wm.change_number_of_desktops(2)
@@ -0,0 +1,34 @@
1
+ require 'wmctrl'
2
+ require 'pp'
3
+
4
+ pid = Process.spawn('zenity --calendar')
5
+
6
+ sleep(0.1)
7
+
8
+ wm = WMCtrl.new
9
+
10
+ win = wm.list_windows.find do |h|
11
+ h[:pid] == pid
12
+ end
13
+
14
+ p win
15
+
16
+ sleep(1)
17
+
18
+ wm.action_window(win[:id], :change_state, "add", "maximized_vert")
19
+
20
+ sleep(1)
21
+
22
+ wm.action_window(win[:id], :change_state, "remove", "maximized_vert")
23
+
24
+ sleep(1)
25
+
26
+ wm.action_window(win[:id], :change_state, "toggle", "maximized_horz", "maximized_vert")
27
+
28
+ sleep(1)
29
+
30
+ wm.action_window(win[:id], :change_state, "toggle", "maximized_vert")
31
+
32
+ puts "Close calendars after 1 second"
33
+ sleep(1)
34
+ wm.action_window(win[:id], :close)
@@ -0,0 +1,34 @@
1
+ require 'wmctrl'
2
+ require 'pp'
3
+
4
+ pid = Process.spawn('zenity --calendar')
5
+
6
+ sleep(0.1)
7
+
8
+ wm = WMCtrl.new
9
+
10
+ win = wm.list_windows.find do |h|
11
+ h[:pid] == pid
12
+ end
13
+
14
+ p win
15
+
16
+ sleep(1)
17
+
18
+ wm.action_window(win[:id], :change_state, "add", "maximized_vert")
19
+
20
+ sleep(1)
21
+
22
+ wm.action_window(win[:id], :change_state, "remove", "maximized_vert")
23
+
24
+ sleep(1)
25
+
26
+ wm.action_window(win[:id], :change_state, "toggle", "maximized_horz", "maximized_vert")
27
+
28
+ sleep(1)
29
+
30
+ wm.action_window(win[:id], :change_state, "toggle", "maximized_vert")
31
+
32
+ puts "Close calendars after 1 second"
33
+ sleep(1)
34
+ wm.action_window(win[:id], :close)
data/sample/close.rb ADDED
@@ -0,0 +1,16 @@
1
+ require 'wmctrl'
2
+ require 'pp'
3
+
4
+ pid = Process.spawn('zenity --calendar')
5
+
6
+ sleep(0.1)
7
+
8
+ wm = WMCtrl.new
9
+ win = wm.list_windows.find do |h|
10
+ h[:pid] == pid
11
+ end
12
+
13
+ pp win
14
+ puts "Close after 1 second"
15
+ sleep(1)
16
+ wm.action_window(win[:id], :close)
data/sample/info.rb ADDED
@@ -0,0 +1,5 @@
1
+ require 'wmctrl'
2
+ require 'pp'
3
+
4
+ wm = WMCtrl.new
5
+ pp wm.info
@@ -0,0 +1,5 @@
1
+ require 'wmctrl'
2
+ require 'pp'
3
+
4
+ wm = WMCtrl.new
5
+ pp wm.list_desktops
@@ -0,0 +1,5 @@
1
+ require 'wmctrl'
2
+ require 'pp'
3
+
4
+ wm = WMCtrl.new
5
+ pp wm.list_windows
@@ -0,0 +1,5 @@
1
+ require 'wmctrl'
2
+ require 'pp'
3
+
4
+ wm = WMCtrl.new
5
+ wm.action_window(ARGV[0].to_i, :move_resize, 0, 100, 200, 500, 400)
@@ -0,0 +1,24 @@
1
+ require 'wmctrl'
2
+ require 'pp'
3
+
4
+ pid = Process.spawn('zenity --calendar')
5
+
6
+ sleep(0.1)
7
+
8
+ wm = WMCtrl.new
9
+
10
+ win = wm.list_windows.find do |h|
11
+ h[:pid] == pid
12
+ end
13
+
14
+ sleep(1)
15
+
16
+ wm.action_window(win[:id], :move_to_desktop, 1)
17
+
18
+ sleep(1)
19
+
20
+ wm.action_window(win[:id], :move_to_current)
21
+
22
+ puts "Close calendars after 1 second"
23
+ sleep(1)
24
+ wm.action_window(win[:id], :close)
@@ -0,0 +1,23 @@
1
+ require 'wmctrl'
2
+ require 'pp'
3
+
4
+ pid = Process.spawn('zenity --calendar')
5
+
6
+ sleep(0.1)
7
+
8
+ wm = WMCtrl.new
9
+
10
+ win = wm.list_windows.find do |h|
11
+ h[:pid] == pid
12
+ end
13
+
14
+ wm.action_window(win[:id], :set_title_long, "title long")
15
+ wm.action_window(win[:id], :set_title_short, "title short")
16
+
17
+ sleep(3)
18
+
19
+ wm.action_window(win[:id], :set_title_both, "title both") # This method is ignored?
20
+
21
+ puts "Close calendars after 3 second"
22
+ sleep(3)
23
+ wm.action_window(win[:id], :close)
@@ -0,0 +1,12 @@
1
+ require 'wmctrl'
2
+ require 'pp'
3
+
4
+ fork do
5
+ wm = WMCtrl.new
6
+ wm.showing_desktop(true)
7
+ end
8
+
9
+ sleep(3)
10
+
11
+ wm = WMCtrl.new
12
+ pp wm.showing_desktop(false)
@@ -0,0 +1,12 @@
1
+ require 'wmctrl'
2
+ require 'pp'
3
+
4
+ fork do
5
+ wm = WMCtrl.new
6
+ pp wm.switch_desktop(1)
7
+ end
8
+
9
+ sleep(3)
10
+
11
+ wm = WMCtrl.new
12
+ pp wm.switch_desktop(0)
metadata ADDED
@@ -0,0 +1,102 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ruby-wmctrl
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Takayuki YAMAGUCHI
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-09-17 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rspec
16
+ requirement: &7209860 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: *7209860
25
+ - !ruby/object:Gem::Dependency
26
+ name: yard
27
+ requirement: &7209440 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *7209440
36
+ - !ruby/object:Gem::Dependency
37
+ name: pkg-config
38
+ requirement: &7209020 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :runtime
45
+ prerelease: false
46
+ version_requirements: *7209020
47
+ description: Ruby bindings to control windows in EWMH and NetWM compatible X Window
48
+ manager, which is created from source code of wmctrl command.
49
+ email:
50
+ - d@ytak.info
51
+ executables: []
52
+ extensions:
53
+ - ext/extconf.rb
54
+ extra_rdoc_files: []
55
+ files:
56
+ - .gitignore
57
+ - COPYING
58
+ - Gemfile
59
+ - Rakefile
60
+ - ext/extconf.rb
61
+ - ext/wmctrl.c
62
+ - lib/wmctrl/version.rb
63
+ - ruby-wmctrl.gemspec
64
+ - sample/activate.rb
65
+ - sample/change_number_of_desktops.rb
66
+ - sample/change_state.rb
67
+ - sample/change_state2.rb
68
+ - sample/close.rb
69
+ - sample/info.rb
70
+ - sample/list_desktops.rb
71
+ - sample/list_windows.rb
72
+ - sample/move_resize.rb
73
+ - sample/move_to_desktop.rb
74
+ - sample/set_title.rb
75
+ - sample/showing_desktop.rb
76
+ - sample/switch_desktop.rb
77
+ homepage: ''
78
+ licenses: []
79
+ post_install_message:
80
+ rdoc_options: []
81
+ require_paths:
82
+ - lib
83
+ - ext
84
+ required_ruby_version: !ruby/object:Gem::Requirement
85
+ none: false
86
+ requirements:
87
+ - - ! '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ required_rubygems_version: !ruby/object:Gem::Requirement
91
+ none: false
92
+ requirements:
93
+ - - ! '>='
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ requirements: []
97
+ rubyforge_project: ruby-wmctrl
98
+ rubygems_version: 1.8.5
99
+ signing_key:
100
+ specification_version: 3
101
+ summary: Ruby bindings to control windows
102
+ test_files: []