Skip to content

Commit fdfe62d

Browse files
authored
Merge pull request #104
Bootstrap Safari App Extension project
2 parents 4089021 + 260b510 commit fdfe62d

27 files changed

+3663
-35
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
Changelog
22
-------------
33

4+
### 2.0.0 (14/7/2018)
5+
* vimari now exists as a Safari App Extension, making it compatible with Safari
6+
version 12
7+
48
### 1.13.0 (4/12/2017)
59
* New fresh icon
610
* Removed shift as default modifier key

README.md

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,3 @@
1-
:rotating_light: **Attention!** We are currently blocked from releasing new
2-
version of this extension, and we have a proposal solving this problem
3-
:rotating_light:
4-
5-
**Funding Progress**
6-
7-
![Funding progress](http://progressed.io/bar/100)
8-
9-
**For full context, read [the full proposal](/docs/crowdfunding.md).**
10-
11-
## Proposal
12-
13-
I propose we use [Ko-fi](https://ko-fi.com) as a crowdfunding platform in order
14-
to collect $99 for a ADP membership to be registered in my name (Simon
15-
Egersand).
16-
17-
## If we reach our goal
18-
19-
If we reach the goal and successfully raise all the money we need, what
20-
happens? First of all, I will register my account for a ADP membership and then
21-
make all the changes required to publish the extension to the Safari Extension
22-
Gallery (some changes are required, see
23-
[#100](https://github.com/guyht/vimari/issues/100)). But what happens after
24-
that?
25-
26-
I commit to being active in maintaining this extension for the next year. That
27-
means I will work on fixing bugs, developing new features, increasing test
28-
coverage and generally improving the code. And I welcome everyone to join me!
29-
30-
---
31-
32-
**NOTE: If you have a pre 1.2 version of Vimari, you need to manually
33-
update to the latest version as there is a bug in the auto-update code.
34-
Versions post 1.2 will automatically update to the lastest version.**
35-
361
Vimari - Keyboard Shortcuts extension for Safari
372
================================================
383

@@ -44,6 +9,7 @@ Vimari attempts to provide a lightweight port of vimium to Safari,
449
taking the best components of vimium and adapting them to Safari.
4510

4611
### Releases
12+
- [Version 2.0.0](docs/safari_12.md) (Safari v12)
4713
- [Version 1.12](https://github.com/guyht/vimari/releases/tag/v1.12)
4814
- [Version 1.11](https://github.com/guyht/vimari/releases/tag/v1.11)
4915
- [Version 1.10](https://github.com/guyht/vimari/releases/tag/v1.10)

app_extension/vimari/.gitignore

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
2+
# Created by https://www.gitignore.io/api/swift
3+
4+
### Swift ###
5+
# Xcode
6+
#
7+
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
8+
9+
## Build generated
10+
build/
11+
DerivedData/
12+
13+
## Various settings
14+
*.pbxuser
15+
!default.pbxuser
16+
*.mode1v3
17+
!default.mode1v3
18+
*.mode2v3
19+
!default.mode2v3
20+
*.perspectivev3
21+
!default.perspectivev3
22+
xcuserdata/
23+
24+
## Other
25+
*.moved-aside
26+
*.xccheckout
27+
*.xcscmblueprint
28+
29+
## Obj-C/Swift specific
30+
*.hmap
31+
*.ipa
32+
*.dSYM.zip
33+
*.dSYM
34+
35+
## Playgrounds
36+
timeline.xctimeline
37+
playground.xcworkspace
38+
39+
# Swift Package Manager
40+
#
41+
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
42+
# Packages/
43+
# Package.pins
44+
# Package.resolved
45+
.build/
46+
47+
# CocoaPods
48+
#
49+
# We recommend against adding the Pods directory to your .gitignore. However
50+
# you should judge for yourself, the pros and cons are mentioned at:
51+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
52+
#
53+
# Pods/
54+
#
55+
# Add this line if you want to avoid checking in source code from the Xcode workspace
56+
# *.xcworkspace
57+
58+
# Carthage
59+
#
60+
# Add this line if you want to avoid checking in source code from Carthage dependencies.
61+
# Carthage/Checkouts
62+
63+
Carthage/Build
64+
65+
# fastlane
66+
#
67+
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
68+
# screenshots whenever they are needed.
69+
# For more information about the recommended setup visit:
70+
# https://docs.fastlane.tools/best-practices/source-control/#source-control
71+
72+
fastlane/report.xml
73+
fastlane/Preview.html
74+
fastlane/screenshots/**/*.png
75+
fastlane/test_output
76+
77+
78+
# End of https://www.gitignore.io/api/swift
79+
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11134" systemVersion="15F34" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
3+
<dependencies>
4+
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11134"/>
5+
</dependencies>
6+
<objects>
7+
<customObject id="-2" userLabel="File's Owner" customClass="SafariExtensionViewController" customModuleProvider="target">
8+
<connections>
9+
<outlet property="view" destination="c22-O7-iKe" id="vwT-Xx-Aiz"/>
10+
</connections>
11+
</customObject>
12+
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
13+
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
14+
<customView id="c22-O7-iKe">
15+
<rect key="frame" x="0.0" y="0.0" width="330" height="119"/>
16+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
17+
<subviews>
18+
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="4Iy-aV-wGF">
19+
<rect key="frame" x="103" y="82" width="124" height="17"/>
20+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
21+
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="extension" id="2Ec-kd-q2K">
22+
<font key="font" metaFont="system"/>
23+
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
24+
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
25+
</textFieldCell>
26+
</textField>
27+
</subviews>
28+
</customView>
29+
</objects>
30+
</document>
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>$(DEVELOPMENT_LANGUAGE)</string>
7+
<key>CFBundleDisplayName</key>
8+
<string>vimari</string>
9+
<key>CFBundleExecutable</key>
10+
<string>$(EXECUTABLE_NAME)</string>
11+
<key>CFBundleIdentifier</key>
12+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
13+
<key>CFBundleInfoDictionaryVersion</key>
14+
<string>6.0</string>
15+
<key>CFBundleName</key>
16+
<string>$(PRODUCT_NAME)</string>
17+
<key>CFBundlePackageType</key>
18+
<string>XPC!</string>
19+
<key>CFBundleShortVersionString</key>
20+
<string>2.0.0</string>
21+
<key>CFBundleVersion</key>
22+
<string>2</string>
23+
<key>LSMinimumSystemVersion</key>
24+
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
25+
<key>NSExtension</key>
26+
<dict>
27+
<key>SFSafariStyleSheet</key>
28+
<array>
29+
<dict>
30+
<key>Style Sheet</key>
31+
<string>injected.css</string>
32+
</dict>
33+
</array>
34+
<key>NSExtensionPointIdentifier</key>
35+
<string>com.apple.Safari.extension</string>
36+
<key>NSExtensionPrincipalClass</key>
37+
<string>$(PRODUCT_MODULE_NAME).SafariExtensionHandler</string>
38+
<key>SFSafariContentScript</key>
39+
<array>
40+
<dict>
41+
<key>Script</key>
42+
<string>settings.js</string>
43+
</dict>
44+
<dict>
45+
<key>Script</key>
46+
<string>keyboard-utils.js</string>
47+
</dict>
48+
<dict>
49+
<key>Script</key>
50+
<string>vimium-scripts.js</string>
51+
</dict>
52+
<dict>
53+
<key>Script</key>
54+
<string>link-hints.js</string>
55+
</dict>
56+
<dict>
57+
<key>Script</key>
58+
<string>mousetrap.js</string>
59+
</dict>
60+
<dict>
61+
<key>Script</key>
62+
<string>injected.js</string>
63+
</dict>
64+
</array>
65+
<key>SFSafariWebsiteAccess</key>
66+
<dict>
67+
<key>Level</key>
68+
<string>All</string>
69+
</dict>
70+
</dict>
71+
<key>NSHumanReadableCopyright</key>
72+
<string>MIT license</string>
73+
<key>NSHumanReadableDescription</key>
74+
<string>Safari port of vimium</string>
75+
</dict>
76+
</plist>
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
//
2+
// SafariExtensionHandler.swift
3+
// extension
4+
//
5+
// Created by Simon on 2018-07-13.
6+
// Copyright © 2018 vimari. All rights reserved.
7+
//
8+
9+
import SafariServices
10+
11+
class SafariExtensionHandler: SFSafariExtensionHandler {
12+
13+
override func messageReceived(withName messageName: String, from page: SFSafariPage, userInfo: [String : Any]?) {
14+
// This method will be called when a content script provided by your extension calls safari.extension.dispatchMessage("message").
15+
page.getPropertiesWithCompletionHandler { properties in
16+
NSLog("The extension received a message (\(messageName)) from a script injected into (\(String(describing: properties?.url))) with userInfo (\(userInfo ?? [:]))")
17+
}
18+
}
19+
20+
override func toolbarItemClicked(in window: SFSafariWindow) {
21+
// This method will be called when your toolbar item is clicked.
22+
NSLog("The extension's toolbar item was clicked")
23+
}
24+
25+
override func validateToolbarItem(in window: SFSafariWindow, validationHandler: @escaping ((Bool, String) -> Void)) {
26+
// This is called when Safari's state changed in some way that would require the extension's toolbar item to be validated again.
27+
validationHandler(true, "")
28+
}
29+
30+
override func popoverViewController() -> SFSafariExtensionViewController {
31+
return SafariExtensionViewController.shared
32+
}
33+
34+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//
2+
// SafariExtensionViewController.swift
3+
// extension
4+
//
5+
// Created by Simon on 2018-07-13.
6+
// Copyright © 2018 vimari. All rights reserved.
7+
//
8+
9+
import SafariServices
10+
11+
class SafariExtensionViewController: SFSafariExtensionViewController {
12+
13+
static let shared = SafariExtensionViewController()
14+
15+
}

0 commit comments

Comments
 (0)