browser_reposition 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/browser_reposition.gemspec +13 -0
- data/lib/browser_reposition.rb +14 -0
- metadata +60 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ec6cd5959e5f710fb593cfa714a2d197a3e0efbad7023184a572a8a0f819f33d
|
4
|
+
data.tar.gz: d7255ac2f4db7faa1ec904d8502736c49db049900b86554e67f020aa49d3a48b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8f3ee21cf25b19b71b9668095f713e1444d54692798825741f32d9b14ed0bc3524fcdb21a4e841fea80338a5dbbf5ae497f9f7be233425c40b21c75af689482a
|
7
|
+
data.tar.gz: 6e65c274b2a5b62e7f5a06ab1e7b32ef01cc93f451d90ccb24d1059c7189485e2c5b79206be56262eeeb6c4609492ec56791958dcb22db3e55c11ae8279bd30d
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2022 Victor Maslov
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
@@ -0,0 +1,13 @@
|
|
1
|
+
Gem::Specification.new do |spec|
|
2
|
+
spec.name = "browser_reposition"
|
3
|
+
spec.version = "0.0.0"
|
4
|
+
spec.summary = "repositions your Ferrum/Capybara/etc. browser to the upper left corner of the external display attached to your Macbook"
|
5
|
+
|
6
|
+
spec.author = "Victor Maslov aka Nakilon"
|
7
|
+
spec.email = "nakilon@gmail.com"
|
8
|
+
spec.license = "MIT"
|
9
|
+
|
10
|
+
spec.add_dependency "CFPropertyList"
|
11
|
+
|
12
|
+
spec.files = %w{ LICENSE browser_reposition.gemspec lib/browser_reposition.rb }
|
13
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module BrowserReposition
|
2
|
+
def reposition
|
3
|
+
require "cfpropertylist"
|
4
|
+
bounds = `osascript -e 'tell application "Finder"' -e "bounds of window of desktop" -e "end tell"`.split.map(&:to_i)
|
5
|
+
external_displays = CFPropertyList::List.new(file: "/Library/Preferences/com.apple.windowserver.plist").
|
6
|
+
value.value["DisplayAnyUserSets"].value.flat_map(&:value).map{ |i| i.value.values_at("OriginX", "OriginY", "Width", "Height").map(&:value) }.
|
7
|
+
select{ |ox, oy, w, h| [ox, oy] != [0, 0] && ox >= bounds[0] && oy >= bounds[1] && ox + w <= bounds[2] && oy + h <= bounds[3] }
|
8
|
+
case external_displays.size
|
9
|
+
when 0
|
10
|
+
when 1 ; self.position = {left: external_displays.first[0], top: external_displays.first[1]}
|
11
|
+
else ; fail "supported number of external displays is 0 or 1"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
metadata
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: browser_reposition
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Victor Maslov aka Nakilon
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-01-07 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: CFPropertyList
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description:
|
28
|
+
email: nakilon@gmail.com
|
29
|
+
executables: []
|
30
|
+
extensions: []
|
31
|
+
extra_rdoc_files: []
|
32
|
+
files:
|
33
|
+
- LICENSE
|
34
|
+
- browser_reposition.gemspec
|
35
|
+
- lib/browser_reposition.rb
|
36
|
+
homepage:
|
37
|
+
licenses:
|
38
|
+
- MIT
|
39
|
+
metadata: {}
|
40
|
+
post_install_message:
|
41
|
+
rdoc_options: []
|
42
|
+
require_paths:
|
43
|
+
- lib
|
44
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
requirements: []
|
55
|
+
rubygems_version: 3.3.25
|
56
|
+
signing_key:
|
57
|
+
specification_version: 4
|
58
|
+
summary: repositions your Ferrum/Capybara/etc. browser to the upper left corner of
|
59
|
+
the external display attached to your Macbook
|
60
|
+
test_files: []
|