summaryrefslogtreecommitdiffstats
path: root/plugins/externaltools/data
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--plugins/externaltools/data/build.desktop.in9
-rwxr-xr-xplugins/externaltools/data/build.tool.in15
-rw-r--r--plugins/externaltools/data/meson.build46
-rw-r--r--plugins/externaltools/data/open-terminal-here-osx.desktop.in9
-rwxr-xr-xplugins/externaltools/data/open-terminal-here-osx.tool.in16
-rw-r--r--plugins/externaltools/data/open-terminal-here.desktop.in9
-rwxr-xr-xplugins/externaltools/data/open-terminal-here.tool.in4
-rw-r--r--plugins/externaltools/data/remove-trailing-spaces.desktop.in9
-rwxr-xr-xplugins/externaltools/data/remove-trailing-spaces.tool.in3
-rw-r--r--plugins/externaltools/data/run-command.desktop.in8
-rwxr-xr-xplugins/externaltools/data/run-command.tool.in4
-rw-r--r--plugins/externaltools/data/send-to-fpaste.desktop.in11
-rwxr-xr-xplugins/externaltools/data/send-to-fpaste.tool.in26
13 files changed, 169 insertions, 0 deletions
diff --git a/plugins/externaltools/data/build.desktop.in b/plugins/externaltools/data/build.desktop.in
new file mode 100644
index 0000000..14dfebd
--- /dev/null
+++ b/plugins/externaltools/data/build.desktop.in
@@ -0,0 +1,9 @@
+[Gedit Tool]
+Name=Build
+Comment=Run “make” in the document directory
+Input=nothing
+Output=output-panel
+Shortcut=<Control>F8
+Applicability=local
+Save-files=all
+Languages=
diff --git a/plugins/externaltools/data/build.tool.in b/plugins/externaltools/data/build.tool.in
new file mode 100755
index 0000000..0b81d5b
--- /dev/null
+++ b/plugins/externaltools/data/build.tool.in
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+EHOME=`echo $HOME | sed "s/#/\#/"`
+DIR=$GEDIT_CURRENT_DOCUMENT_DIR
+while test "$DIR" != "/"; do
+ for m in GNUmakefile makefile Makefile; do
+ if [ -f "${DIR}/${m}" ]; then
+ echo "Using ${m} from ${DIR}" | sed "s#$EHOME#~#" > /dev/stderr
+ make -C "${DIR}"
+ exit
+ fi
+ done
+ DIR=`dirname "${DIR}"`
+done
+echo "No Makefile found!" > /dev/stderr
diff --git a/plugins/externaltools/data/meson.build b/plugins/externaltools/data/meson.build
new file mode 100644
index 0000000..02d5d6c
--- /dev/null
+++ b/plugins/externaltools/data/meson.build
@@ -0,0 +1,46 @@
+externaltools_tools = [
+ 'build',
+ 'remove-trailing-spaces',
+ 'send-to-fpaste',
+]
+
+if host_machine.system() == 'darwin'
+ externaltools_tools += [
+ 'open-terminal-here-osx',
+ ]
+elif host_machine.system() != 'windows'
+ externaltools_tools += [
+ 'open-terminal-here',
+ 'run-command',
+ ]
+endif
+
+foreach tool_name: externaltools_tools
+ dektop_file = custom_target(
+ '@0@.desktop'.format(tool_name),
+ input: '@0@.desktop.in'.format(tool_name),
+ output: '@0@.desktop'.format(tool_name),
+ command: msgfmt_externaltools_cmd,
+ install: false,
+ )
+
+ custom_target(
+ '@0@.tool'.format(tool_name),
+ input: '@0@.tool.in'.format(tool_name),
+ output: '@0@'.format(tool_name),
+ depends: dektop_file,
+ command: [
+ merge_tool_prg,
+ '@INPUT@',
+ dektop_file.full_path(),
+ ],
+ capture: true,
+ install: true,
+ install_dir: join_paths(
+ pkgdatadir,
+ 'plugins',
+ 'externaltools',
+ 'tools',
+ )
+ )
+endforeach
diff --git a/plugins/externaltools/data/open-terminal-here-osx.desktop.in b/plugins/externaltools/data/open-terminal-here-osx.desktop.in
new file mode 100644
index 0000000..846ff9a
--- /dev/null
+++ b/plugins/externaltools/data/open-terminal-here-osx.desktop.in
@@ -0,0 +1,9 @@
+[Gedit Tool]
+Name=Open terminal here
+Comment=Open a terminal in the document location
+Input=nothing
+Output=output-panel
+Applicability=local
+Save-files=nothing
+Languages=
+Shortcut=<Primary><Alt>t
diff --git a/plugins/externaltools/data/open-terminal-here-osx.tool.in b/plugins/externaltools/data/open-terminal-here-osx.tool.in
new file mode 100755
index 0000000..c336006
--- /dev/null
+++ b/plugins/externaltools/data/open-terminal-here-osx.tool.in
@@ -0,0 +1,16 @@
+#!/usr/bin/osascript
+
+set the_path to system attribute "GEDIT_CURRENT_DOCUMENT_DIR"
+set cmd to "cd " & quoted form of the_path
+
+tell application "System Events" to set terminalIsRunning to exists application process "Terminal"
+
+tell application "Terminal"
+ activate
+
+ if terminalIsRunning is true then
+ do script with command cmd
+ else
+ do script with command cmd in window 1
+ end if
+end tell
diff --git a/plugins/externaltools/data/open-terminal-here.desktop.in b/plugins/externaltools/data/open-terminal-here.desktop.in
new file mode 100644
index 0000000..846ff9a
--- /dev/null
+++ b/plugins/externaltools/data/open-terminal-here.desktop.in
@@ -0,0 +1,9 @@
+[Gedit Tool]
+Name=Open terminal here
+Comment=Open a terminal in the document location
+Input=nothing
+Output=output-panel
+Applicability=local
+Save-files=nothing
+Languages=
+Shortcut=<Primary><Alt>t
diff --git a/plugins/externaltools/data/open-terminal-here.tool.in b/plugins/externaltools/data/open-terminal-here.tool.in
new file mode 100755
index 0000000..9365648
--- /dev/null
+++ b/plugins/externaltools/data/open-terminal-here.tool.in
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+#TODO: use "gconftool-2 -g /desktop/gnome/applications/terminal/exec"
+gnome-terminal --working-directory="$GEDIT_CURRENT_DOCUMENT_DIR" &
diff --git a/plugins/externaltools/data/remove-trailing-spaces.desktop.in b/plugins/externaltools/data/remove-trailing-spaces.desktop.in
new file mode 100644
index 0000000..9a34de7
--- /dev/null
+++ b/plugins/externaltools/data/remove-trailing-spaces.desktop.in
@@ -0,0 +1,9 @@
+[Gedit Tool]
+Name=Remove trailing spaces
+Comment=Remove useless trailing spaces in your file
+Input=document
+Output=replace-document
+Shortcut=<Alt>F12
+Applicability=all
+Save-files=nothing
+Languages=
diff --git a/plugins/externaltools/data/remove-trailing-spaces.tool.in b/plugins/externaltools/data/remove-trailing-spaces.tool.in
new file mode 100755
index 0000000..83e4c19
--- /dev/null
+++ b/plugins/externaltools/data/remove-trailing-spaces.tool.in
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+sed 's/[[:blank:]]*$//'
diff --git a/plugins/externaltools/data/run-command.desktop.in b/plugins/externaltools/data/run-command.desktop.in
new file mode 100644
index 0000000..ca7b7da
--- /dev/null
+++ b/plugins/externaltools/data/run-command.desktop.in
@@ -0,0 +1,8 @@
+[Gedit Tool]
+Name=Run command
+Comment=Execute a custom command and put its output in a new document
+Input=nothing
+Output=new-document
+Applicability=all
+Save-files=nothing
+Languages=
diff --git a/plugins/externaltools/data/run-command.tool.in b/plugins/externaltools/data/run-command.tool.in
new file mode 100755
index 0000000..77ad4e6
--- /dev/null
+++ b/plugins/externaltools/data/run-command.tool.in
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+#TODO: use "gconftool-2 -g /desktop/gnome/applications/terminal/exec"
+eval $(zenity --entry --title="Run Command - gedit" --text="Command to run:")
diff --git a/plugins/externaltools/data/send-to-fpaste.desktop.in b/plugins/externaltools/data/send-to-fpaste.desktop.in
new file mode 100644
index 0000000..40282c8
--- /dev/null
+++ b/plugins/externaltools/data/send-to-fpaste.desktop.in
@@ -0,0 +1,11 @@
+[Gedit Tool]
+Name=Send to fpaste
+Comment=Paste selected text or current document to fpaste
+Input=selection-document
+Output=output-panel
+Shortcut=<Shift><Super>p
+Applicability=always
+Save-files=nothing
+Languages=
+
+
diff --git a/plugins/externaltools/data/send-to-fpaste.tool.in b/plugins/externaltools/data/send-to-fpaste.tool.in
new file mode 100755
index 0000000..d392173
--- /dev/null
+++ b/plugins/externaltools/data/send-to-fpaste.tool.in
@@ -0,0 +1,26 @@
+#!/usr/bin/env python3
+
+import os, urllib, json, sys, urllib.request
+from gi.repository import Gtk, Gdk
+
+text = sys.stdin.read()
+
+lang = os.getenv('GEDIT_CURRENT_DOCUMENT_LANGUAGE')
+if lang is None:
+ lang = "text"
+
+url_params = urllib.parse.urlencode({'paste_data': text, 'paste_lang': lang, 'mode':'json', 'api_submit':'true'})
+openfpaste = urllib.request.urlopen("http://fpaste.org", bytes(url_params, 'utf-8')).read().decode("utf-8")
+if openfpaste is None:
+ print("Failed to send fpaste request.")
+
+final_data = json.loads(openfpaste)
+
+paste_url = "http://fpaste.org/" + final_data['result']['id']
+
+disp = Gdk.Display.get_default()
+clipboard = Gtk.Clipboard.get_for_display(disp, Gdk.SELECTION_CLIPBOARD)
+clipboard.set_text(paste_url, len(paste_url))
+clipboard.store()
+
+print(paste_url + " has been copied to the clipboard.")