awesomer 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. data/History.txt +3 -0
  2. data/Manifest.txt +5 -0
  3. data/README.txt +62 -0
  4. data/Rakefile +14 -0
  5. data/lib/awesomer.rb +104 -0
  6. metadata +68 -0
@@ -0,0 +1,3 @@
1
+ === 1.0.0 / 2008-02-10
2
+
3
+ * First public release
@@ -0,0 +1,5 @@
1
+ History.txt
2
+ Manifest.txt
3
+ README.txt
4
+ Rakefile
5
+ lib/awesomer.rb
@@ -0,0 +1,62 @@
1
+ = awesomer
2
+
3
+ * http://awesomer.rubyforge.org
4
+ * by Eivind Uggedal <eu@redflavor.com>
5
+
6
+ == DESCRIPTION:
7
+
8
+ Awesomer is a ruby library for interacting with the +awesome+
9
+ window manager. It replaces the +awesome-client+ distributed
10
+ with the window manager.
11
+
12
+ == SYNOPSIS:
13
+
14
+ It's used by either creating a new Awesomer object, connecting,
15
+ performing actions, and lastly close the connection:
16
+
17
+ a = Awesomer.new
18
+ a.connect
19
+ a.tag_view 2
20
+ sleep 1
21
+ a.tag_view 3
22
+ a.close
23
+
24
+ A better way to handle this is to contact the window manager using
25
+ a block. Connecting and closing are then handled automatically:
26
+
27
+ Awesomer.contact do |a|
28
+ a.tag_view 4
29
+ a.spawn :urxvt
30
+ sleep 3
31
+ a.tag_view 5
32
+ a.spawn :urxvt
33
+ end
34
+
35
+ == INSTALL:
36
+
37
+ gem install awesomer
38
+
39
+ == LICENSE:
40
+
41
+ (The MIT License)
42
+
43
+ Copyright (c) 2008 Eivind Uggedal <eu@redflavor.com>
44
+
45
+ Permission is hereby granted, free of charge, to any person obtaining
46
+ a copy of this software and associated documentation files (the
47
+ 'Software'), to deal in the Software without restriction, including
48
+ without limitation the rights to use, copy, modify, merge, publish,
49
+ distribute, sublicense, and/or sell copies of the Software, and to
50
+ permit persons to whom the Software is furnished to do so, subject to
51
+ the following conditions:
52
+
53
+ The above copyright notice and this permission notice shall be
54
+ included in all copies or substantial portions of the Software.
55
+
56
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
57
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
58
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
59
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
60
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
61
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
62
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,14 @@
1
+ require 'rubygems'
2
+ require 'hoe'
3
+ require './lib/awesomer.rb'
4
+
5
+ Hoe.new('awesomer', Awesomer::VERSION) do |p|
6
+ p.rubyforge_name = 'awesomer'
7
+ p.author = 'Eivind Uggedal'
8
+ p.email = 'eu@redflavor.com'
9
+ p.summary = 'Library for interacting with the awesome window manager'
10
+ # p.description = p.paragraphs_of('README.txt', 2..5).join("\n\n")
11
+ # p.url = p.paragraphs_of('README.txt', 0).first.split(/\n/)[1..-1]
12
+ p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
13
+ p.remote_rdoc_dir = ''
14
+ end
@@ -0,0 +1,104 @@
1
+ require 'socket'
2
+
3
+ # Awesomer is a ruby library for interacting with the +awesome+
4
+ # window manager. It replaces the +awesome-client+ distributed
5
+ # with the window manager.
6
+ #
7
+ # It's used by either creating a new Awesomer object, connecting,
8
+ # performing actions, and lastly close the connection:
9
+ #
10
+ # a = Awesomer.new
11
+ # a.connect
12
+ # a.tag_view 2
13
+ # sleep 1
14
+ # a.tag_view 3
15
+ # a.close
16
+ #
17
+ # A better way to handle this is to contact the window manager using
18
+ # a block. Connecting and closing are then handled automatically:
19
+ #
20
+ # Awesomer.contact do |a|
21
+ # a.tag_view 4
22
+ # a.spawn :urxvt
23
+ # sleep 3
24
+ # a.tag_view 5
25
+ # a.spawn :urxvt
26
+ # end
27
+ #
28
+ class Awesomer
29
+ VERSION = '1.0.0'
30
+
31
+ FUNCTIONS = %w( quit
32
+ statusbar_toggle
33
+ spawn
34
+ exec
35
+ widget_tell
36
+ client_kill
37
+ client_moveresize
38
+ client_settrans
39
+ client_swapnext
40
+ client_swapprev
41
+ client_focusnext
42
+ client_focusprev
43
+ client_togglemax
44
+ client_togglehorizontalmax
45
+ client_toggleverticalmax
46
+ client_togglefloating
47
+ client_zoom
48
+ client_movetoscreen
49
+ client_tag
50
+ client_toggletag
51
+ client_movemouse
52
+ client_resizemouse
53
+ tag_setlayout
54
+ tag_toggleview
55
+ tag_view
56
+ tag_viewnext
57
+ tag_viewprev
58
+ tag_viewprev_selected
59
+ tag_setmwfact
60
+ tag_setncol
61
+ tag_setnmaster
62
+ tag_create
63
+ focus_client_byname
64
+ focus_history
65
+ screen_focus )
66
+
67
+ attr_accessor :screen
68
+ attr_accessor :socket
69
+
70
+ def initialize(screen = 0)
71
+ @screen = screen
72
+ end
73
+
74
+ # Contact the awesome window manager using a block.
75
+ def self.contact(screen = 0)
76
+ awesome = Awesomer.new(screen)
77
+ awesome.connect
78
+ yield awesome
79
+ awesome.close
80
+ end
81
+
82
+ def method_missing(method, *args)
83
+ return unless FUNCTIONS.include?(method.to_s) && @socket
84
+ send(method, args)
85
+ end
86
+
87
+ # Connect to the awesome window manager socket.
88
+ def connect
89
+ @socket = Socket.new(Socket::AF_UNIX, Socket::SOCK_DGRAM, 0)
90
+ path = File.join(ENV['HOME'], ".awesome_ctl.#@screen")
91
+ @socket.connect(Socket.pack_sockaddr_un(path))
92
+ end
93
+
94
+ # Close connection to the awesome window manager socket.
95
+ def close
96
+ @socket.close
97
+ end
98
+
99
+ private
100
+
101
+ def send(method, message)
102
+ @socket.send("#@screen #{method} #{message}\n", 0)
103
+ end
104
+ end
metadata ADDED
@@ -0,0 +1,68 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: awesomer
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Eivind Uggedal
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-02-10 00:00:00 +01:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: hoe
17
+ version_requirement:
18
+ version_requirements: !ruby/object:Gem::Requirement
19
+ requirements:
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 1.5.0
23
+ version:
24
+ description: Awesomer is a ruby library for interacting with the +awesome+ window manager. It replaces the +awesome-client+ distributed with the window manager.
25
+ email: eu@redflavor.com
26
+ executables: []
27
+
28
+ extensions: []
29
+
30
+ extra_rdoc_files:
31
+ - History.txt
32
+ - Manifest.txt
33
+ - README.txt
34
+ files:
35
+ - History.txt
36
+ - Manifest.txt
37
+ - README.txt
38
+ - Rakefile
39
+ - lib/awesomer.rb
40
+ has_rdoc: true
41
+ homepage: http://awesomer.rubyforge.org
42
+ post_install_message:
43
+ rdoc_options:
44
+ - --main
45
+ - README.txt
46
+ require_paths:
47
+ - lib
48
+ required_ruby_version: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: "0"
53
+ version:
54
+ required_rubygems_version: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ version: "0"
59
+ version:
60
+ requirements: []
61
+
62
+ rubyforge_project: awesomer
63
+ rubygems_version: 1.0.1
64
+ signing_key:
65
+ specification_version: 2
66
+ summary: Library for interacting with the awesome window manager
67
+ test_files: []
68
+