summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonne Haß2015-06-08 11:58:58 +0200
committerJonne Haß2015-06-08 11:58:58 +0200
commit6544df3fe65f050700b913b212ada368c5254c15 (patch)
tree12a652a6aed2bad519a83e56d552ae4b55f347a9
downloadaur-6544df3fe65f050700b913b212ada368c5254c15.tar.gz
add sublime-url-handler
-rw-r--r--.SRCINFO16
-rw-r--r--PKGBUILD21
-rw-r--r--sublime-url-handler16
-rw-r--r--sublime-url-handler.desktop12
-rw-r--r--sublime-url-handler.install9
5 files changed, 74 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 00000000000..2b57451836e
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,16 @@
+pkgbase = sublime-url-handler
+ pkgdesc = Open subl:// and txmt:// URLs in Sublime Text. Based on http://blog.byscripts.info/2013/02/txmt-protocol-and-sublime-text-2-english.html
+ pkgver = 0.0.4
+ pkgrel = 1
+ url = http://github.com/MrZYX/PKGBUILDs/tree/master/sublime-url-handler
+ install = sublime-url-handler.install
+ arch = any
+ license = MIT
+ depends = desktop-file-utils
+ source = sublime-url-handler
+ source = sublime-url-handler.desktop
+ sha256sums = 9ed93088ea896c0595cf5369b443cb4a386935462e23685d136b241478d64de6
+ sha256sums = cca3fa496ae05bdd5f6c4f4dcc5f63724002489e58c14a58ab0455aa45b06d66
+
+pkgname = sublime-url-handler
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 00000000000..3d7cd5d9229
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,21 @@
+# Maintainer: Jonne Haß <me@mrzyx.de>
+
+pkgname=sublime-url-handler
+pkgver=0.0.4
+pkgrel=1
+pkgdesc="Open subl:// and txmt:// URLs in Sublime Text. Based on http://blog.byscripts.info/2013/02/txmt-protocol-and-sublime-text-2-english.html"
+url='http://github.com/MrZYX/PKGBUILDs/tree/master/sublime-url-handler'
+arch=('any')
+license=('MIT')
+depends=('desktop-file-utils')
+install=sublime-url-handler.install
+source=($pkgname $pkgname.desktop)
+
+package() {
+ install -Dm755 $pkgname "$pkgdir/usr/bin/$pkgname"
+ RPM_BUILD_ROOT=$pkgdir desktop-file-install $pkgname.desktop
+}
+
+# vim:set ts=2 sw=2 et:
+sha256sums=('9ed93088ea896c0595cf5369b443cb4a386935462e23685d136b241478d64de6'
+ 'cca3fa496ae05bdd5f6c4f4dcc5f63724002489e58c14a58ab0455aa45b06d66')
diff --git a/sublime-url-handler b/sublime-url-handler
new file mode 100644
index 00000000000..a96ae112d23
--- /dev/null
+++ b/sublime-url-handler
@@ -0,0 +1,16 @@
+#!/usr/bin/env bash
+
+# Delete first 23 characters
+request=${1:23}
+
+# Decode URL
+request=$(echo $request | echo -e "$(sed 's/+/ /g; s/%/\\x/g')")
+
+# Replace &line= with :
+request=${request/&line=/:}
+
+# Replace &column= with :
+request=${request/&column=/:}
+
+# Launch Sublime
+subl $request
diff --git a/sublime-url-handler.desktop b/sublime-url-handler.desktop
new file mode 100644
index 00000000000..f06d933d645
--- /dev/null
+++ b/sublime-url-handler.desktop
@@ -0,0 +1,12 @@
+[Desktop Entry]
+Version=1.0
+Type=Application
+Name=Sublime Text 2 URL Handler
+Comment=Handle URL Scheme subl:// and txmt://
+Icon=sublime_text
+NoDisplay=true
+Categories=TextEditor;Utility;
+Exec=sublime-url-handler %u
+Terminal=false
+MimeType=x-scheme-handler/txmt;x-scheme-handler/subl;
+X-Desktop-File-Install-Version=0.21
diff --git a/sublime-url-handler.install b/sublime-url-handler.install
new file mode 100644
index 00000000000..3596f7d60d8
--- /dev/null
+++ b/sublime-url-handler.install
@@ -0,0 +1,9 @@
+post_install() {
+ update-desktop-database
+}
+
+post_upgrade() {
+ update-desktop-database
+}
+
+# vim:set ts=2 sw=2 et: