repozish 0.0.0 → 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/bin/repozish +16 -5
  2. metadata +3 -3
data/bin/repozish CHANGED
@@ -38,6 +38,10 @@ executing the following:
38
38
  will read the positions of the files in `#{DOC_RUN_CONTROL}` and position and
39
39
  size the apps accordingly.
40
40
 
41
+ ## installation
42
+
43
+ gem install repozish
44
+
41
45
  ## other notes
42
46
 
43
47
  `#{DOLLA_ZERO}(1)` only operates on the front window of applications. it may
@@ -66,11 +70,18 @@ and it will choose the appropriate layout for the attached screens.
66
70
  """
67
71
 
68
72
  def set_dims(app, dims)
69
- `osascript -e 'tell application "#{app}" to set the bounds of the front window to {#{dims.join ', '}}'`
73
+ `osascript -e 'set theSBounds to {{#{dims[0]}, #{dims[1]}}, {#{dims[2]}, #{dims[3]}}}
74
+ tell application \"System Events\"
75
+ set size of front window of application process \"#{app}\" to item 1 of theSBounds
76
+ set position of front window of application process \"#{app}\" to item 2 of theSBounds
77
+ end tell'`
70
78
  end
71
79
 
72
80
  def get_dims(app)
73
- `osascript -e 'tell application "#{app}" to get the bounds of the front window'`
81
+ `osascript -e 'tell application \"System Events\"
82
+ set the props to get the properties of the front window of application process \"#{app}\"
83
+ {size, position} of props
84
+ end tell'`
74
85
  end
75
86
 
76
87
  def displays()
@@ -78,9 +89,9 @@ def displays()
78
89
  display_data['Graphics/Displays'].map do |d|
79
90
  monitors = d[1]['Displays']
80
91
  if monitors && monitors.length
81
- monitors.map{|m| m[1]['Resolution']}.join('').gsub(' ', '')
92
+ monitors.map{|m| m[1]['Resolution'].gsub(' ', '')}.sort().join('_')
82
93
  end
83
- end.find_all{|d| d}.join "_"
94
+ end.find_all{|d| d}.sort().join "_"
84
95
  end
85
96
 
86
97
  mode = 'set'
@@ -111,7 +122,7 @@ apps.each do |app|
111
122
  if mode == 'get'
112
123
  rc[profile][app] = get_dims(app).split(',').map {|s| s.to_i}
113
124
  else
114
- set_dims app, rc[profile][app] if rc[profile][app]
125
+ 2.times { set_dims app, rc[profile][app] if rc[profile][app] }
115
126
  end
116
127
  end
117
128
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: repozish
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 0
10
- version: 0.0.0
9
+ - 1
10
+ version: 0.0.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Aaron Stacy