totalspaces2 2.0.3 → 2.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fef721df45dd16cb94c6d20cc5794c07b9594b29
4
- data.tar.gz: 48000e5f3c609db3eac831593cb618e8b11f2bef
3
+ metadata.gz: 0f3ddbebf28e2e9743d6fe6d61c761e6268bc975
4
+ data.tar.gz: 713cce61a7e38741d5a7f8c5185d7c6171cce93a
5
5
  SHA512:
6
- metadata.gz: a7f195209c9866777288c61b8bf52a2a99611492fa79701da58af70afc9a5564ad5bb44153ea3541095be3a166b27758027984e7f3c7192e8bacc6fbb46d5ae5
7
- data.tar.gz: 67bc4ea8980d48580618c47da9cad93dcb4a0e502946552fe9f112568a14e8f0c1306bd9bf099ae942900ea05b5a3a18b05cb12a39497532f83bcd2b245e96a4
6
+ metadata.gz: 44ea68c12359088a5c4d9ec63d71192c6788c85afd69c4fc414506e915116f786ea7aaf176a952eb9b823ca7d8bfb41332a7f6f6e7d14b5e5195083c877817ff
7
+ data.tar.gz: 1bf43400af7a477760785af3dbf51b66aa50ba9446e623347368a74be98974a3cb0214893aa25ee5a3a4e576800859cda0eceaabaf7e2ccf4250f71e3cc85677
@@ -1,8 +1,6 @@
1
1
  = TotalSpaces2 - Ruby API bindings for TotalSpaces2 from BinaryAge
2
2
 
3
- == PRERELEASE: You can only use the API with versions 2.1 and above of TotalSpaces2.
4
-
5
- Version 2.1+ of TotalSpaces2 is available by ticking the "Include pre-releases" checkbox in General Preferences and then selecting "Check for updates" from the menu.
3
+ == You can only use the API with versions 2.1 and above of TotalSpaces2.
6
4
 
7
5
  This gem enables you to get information from and to control {TotalSpaces2}[link:http://totalspaces.binaryage.com]
8
6
 
@@ -87,17 +87,39 @@ void tsapi_freeDisplayList(struct tsapi_displays *displayList);
87
87
  /*
88
88
  * The number of the current space.
89
89
  *
90
- * If the current space is the dashboard, 0 is returned.
90
+ * Numbering starts at 1.
91
91
  */
92
92
  unsigned int tsapi_currentSpaceNumberOnDisplay(CGDirectDisplayID displayID);
93
93
 
94
94
  /*
95
95
  * The name for the given space number.
96
96
  *
97
+ * The name is either the custom one that has been set, or a name generated by TotalSpaces
98
+ * such as "Desktop 3".
97
99
  * You must call tsapi_freeString when you have finished with the returned string.
98
100
  */
99
101
  const char *tsapi_spaceNameForSpaceNumberOnDisplay(unsigned int spaceNumber, CGDirectDisplayID displayID);
100
102
 
103
+ /*
104
+ * The custom name for the given space number. If the space has no custom name set in,
105
+ * TotalSpaces2, NULL is returned.
106
+ *
107
+ * You must call tsapi_freeString when you have finished with the returned string.
108
+ */
109
+ const char *tsapi_customNameForSpaceNumberOnDisplay(unsigned int spaceNumber, CGDirectDisplayID displayID);
110
+
111
+ typedef enum {
112
+ SpaceTypeDesktop,
113
+ SpaceTypeFullScreen,
114
+ SpaceTypeDashboard,
115
+ } SpaceType;
116
+
117
+ /*
118
+ * The type of the space.
119
+ *
120
+ */
121
+ SpaceType tsapi_spaceTypeForSpaceNumberOnDisplay(unsigned int spaceNumber, CGDirectDisplayID displayID);
122
+
101
123
  /*
102
124
  * The uuid for the given space number. This uniquely identifies the space, even when
103
125
  * it is moved to a different position or to another monitor.
@@ -275,5 +297,20 @@ bool tsapi_removeDesktopsOnDisplay(unsigned int numberToRemove, CGDirectDisplayI
275
297
  */
276
298
  void tsapi_setFrontWindow(unsigned int windowID);
277
299
 
300
+ /*
301
+ * Move a window
302
+ * Use the origin from the frame given in the tsapi_window struct
303
+ * as the starting point to make adustments. There is no validation,
304
+ * you can place a window far off the screen if you wish.
305
+ */
306
+ void tsapi_moveWindow(unsigned int windowID, float x, float y);
307
+
308
+ /*
309
+ * Bind an app to a particular space.
310
+ * Set spaceUUID to NULL to remove a binding for a partular app.
311
+ * Set spaceUUID to "AllSpaces" to make an app appear on every space.
312
+ */
313
+ void tsapi_bindAppToSpace(char *bundleID, char *spaceUUID);
314
+
278
315
  #endif
279
316
 
Binary file
@@ -113,6 +113,9 @@ module TSApi #:nodoc:
113
113
  attach_function :tsapi_removeDesktopsOnDisplay, [:uint, :uint], :bool
114
114
 
115
115
  attach_function :tsapi_setFrontWindow, [:uint], :void
116
+ attach_function :tsapi_moveWindow, [:uint, :float, :float], :void
117
+
118
+ attach_function :tsapi_bindAppToSpace, [:string, :string], :void
116
119
  end
117
120
 
118
121
  module TotalSpaces2
@@ -177,7 +180,7 @@ module TotalSpaces2
177
180
 
178
181
  public
179
182
 
180
- # Returns the version of the dylib, a string such as "1.0"
183
+ # Returns the version of the dylib, a string such as "1.0.1"
181
184
  # You should be using the same dylib major version number as that returned by the api_version call
182
185
  #
183
186
  # puts "libTotalSpaces2 version: #{TotalSpaces2.lib_total_spaces_version}"
@@ -192,8 +195,8 @@ module TotalSpaces2
192
195
  string_and_free(TSApi.tsapi_libTotalSpacesVersion)
193
196
  end
194
197
 
195
- # Returns the version of the api present in TotalSpaces2, a string such as "1.0"
196
- # You should be using the same dylib version as that returned by the this call
198
+ # Returns the version of the api present in TotalSpaces2, a string such as "1.0.1"
199
+ # You should be using the same dylib major version number as that returned by the this call
197
200
  #
198
201
  # puts "TotalSpaces2 API version: #{TotalSpaces2.api_version}"
199
202
  #
@@ -620,5 +623,32 @@ module TotalSpaces2
620
623
  def set_front_window(window_id)
621
624
  TSApi.tsapi_setFrontWindow(window_id)
622
625
  end
626
+
627
+ # Move a particular window to a new position.
628
+ # Use the origin from the frame given by window_list
629
+ # as the starting point to make adustments. There is no validation,
630
+ # you can place a window far off the screen if you wish.
631
+ #
632
+ # For instance, if the frame or window id 123 is "{{146, 23}, {1133, 754}}",
633
+ # the origin is (146, 23). To move the window down 20 pixels, you would do this:
634
+ #
635
+ # TotalSpaces2.move_window(123, 146, 43)
636
+ #
637
+ def move_window(window_id, x, y)
638
+ TSApi.tsapi_moveWindow(window_id, x, y)
639
+ end
640
+
641
+ # Bind an app to a space.
642
+ # The bundle_id is normally in the format "com.apple.mail"
643
+ # Setting the space_uuid to AllSpaces will result in an app
644
+ # appearing on every desktop.
645
+ # Setting the space_uuid to nil will delete the setting for the
646
+ # given bundle_id.
647
+ #
648
+ # TotalSpaces2.bind_app_to_space("com.apple.mail", "AllSpaces")
649
+ #
650
+ def bind_app_to_space(bundle_id, space_uuid)
651
+ TSApi.tsapi_bindAppToSpace(bundle_id, space_uuid)
652
+ end
623
653
  end
624
654
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: totalspaces2
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.3
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen Sykes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-07 00:00:00.000000000 Z
11
+ date: 2015-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -63,7 +63,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
63
63
  version: '0'
64
64
  requirements: []
65
65
  rubyforge_project:
66
- rubygems_version: 2.2.2
66
+ rubygems_version: 2.4.5
67
67
  signing_key:
68
68
  specification_version: 4
69
69
  summary: TotalSpaces2 control from ruby