Skip to content

Commit 70cce77

Browse files
committed
add gpgcrypt plugin
Add a plugin that opens and saves GPG-encrypted files (.gpg, .pgp). On open, the file is decrypted via the gpg CLI; on save, it is re-encrypted using the original method (symmetric or asymmetric with the same recipients). New files saved with a GPG extension default to symmetric encryption.
1 parent d773d55 commit 70cce77

12 files changed

Lines changed: 589 additions & 1 deletion

configure.ac

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ GLIB_GSETTINGS
8989
C_PLUGINS="bookmarks quickhighlight sourcecodebrowser wordcompletion"
9090

9191
# Python plugins that don't need special dependencies, besides Python
92-
PYTHON_PLUGINS="bracketcompletion codecomment markdown-preview smartspaces"
92+
PYTHON_PLUGINS="bracketcompletion codecomment gpgcrypt markdown-preview smartspaces"
9393

9494
PLUGINS="$C_PLUGINS"
9595
disabled_plugins=""
@@ -213,6 +213,10 @@ plugins/Makefile
213213
plugins/codecomment/codecomment.plugin.desktop.in
214214
plugins/codecomment/Makefile
215215
plugins/codecomment/pluma-codecomment.metainfo.xml.in
216+
plugins/gpgcrypt/Makefile
217+
plugins/gpgcrypt/pluma-gpgcrypt.metainfo.xml.in
218+
plugins/gpgcrypt/gpgcrypt.plugin.desktop.in
219+
plugins/gpgcrypt/gpgcrypt/Makefile
216220
plugins/markdown-preview/markdown-preview.plugin.desktop.in
217221
plugins/markdown-preview/Makefile
218222
plugins/markdown-preview/pluma-markdown-preview.metainfo.xml.in

help/C/gpgcrypt.page

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<page xmlns="http://projectmallard.org/1.0/"
2+
xmlns:its="http://www.w3.org/2005/11/its"
3+
type="topic" style="task"
4+
id="plugin-gpg-encryption">
5+
6+
<info>
7+
<link type="guide" xref="index#pluma-additional-plugins"/>
8+
<revision version="1.29" date="2026-03-25" status="review"/>
9+
10+
<credit type="author">
11+
<name>MATE Developers</name>
12+
<email its:translate="no">vkareh@redhat.com</email>
13+
</credit>
14+
15+
<desc>Open and save GPG-encrypted files.</desc>
16+
</info>
17+
18+
<title>GPG Encryption</title>
19+
20+
<p>The <app>GPG Encryption</app> plugin allows you to open and save
21+
GPG-encrypted files (<file>.gpg</file> and <file>.pgp</file>)
22+
transparently. When you open an encrypted file, the plugin decrypts it
23+
and displays the plaintext. When you save, the file is re-encrypted
24+
using the same method it was originally encrypted with.</p>
25+
26+
<p>To enable the GPG Encryption plugin, select
27+
<guiseq><gui style="menu">Edit</gui><gui style="menuitem">Preferences</gui>
28+
<gui>Plugins</gui><gui>GPG Encryption</gui></guiseq>.</p>
29+
30+
<note style="important">
31+
<p>This plugin requires the <cmd>gpg</cmd> command to be installed on
32+
your system. It delegates all authentication to <cmd>gpg-agent</cmd>,
33+
so smartcards (such as YubiKey) and pinentry dialogs are fully
34+
supported.</p>
35+
</note>
36+
37+
<section id="opening-files">
38+
<title>Opening encrypted files</title>
39+
<p>Simply open a <file>.gpg</file> or <file>.pgp</file> file as you
40+
would any other file. The plugin will invoke <cmd>gpg</cmd> to decrypt
41+
it. You may be prompted for a passphrase or smartcard PIN through your
42+
configured pinentry program.</p>
43+
</section>
44+
45+
<section id="saving-files">
46+
<title>Saving encrypted files</title>
47+
<p>When you save a file that was decrypted by the plugin, it is
48+
automatically re-encrypted using the original method:</p>
49+
<list>
50+
<item><p><em>Symmetric encryption</em> (passphrase-based): the file
51+
is re-encrypted with a passphrase.</p></item>
52+
<item><p><em>Asymmetric encryption</em> (public-key): the file is
53+
re-encrypted to the same recipients as before.</p></item>
54+
</list>
55+
</section>
56+
57+
<section id="new-encrypted-files">
58+
<title>Creating new encrypted files</title>
59+
<p>To create a new encrypted file, use <guiseq><gui style="menu">File</gui>
60+
<gui>Save As</gui></guiseq> and choose a filename ending in
61+
<file>.gpg</file> or <file>.pgp</file>. The file will be encrypted
62+
using symmetric (passphrase) encryption by default.</p>
63+
</section>
64+
65+
</page>

help/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ pluma_help_sources = [
22
'bookmarks.page',
33
'bracketcompletion.page',
44
'codecomment.page',
5+
'gpgcrypt.page',
56
'synctex.page',
67
'terminal.page',
78
'wordcompletion.page',

meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ all_plugins = {
4747
'bookmarks': {'language': 'c'},
4848
'bracketcompletion': {'language': 'python'},
4949
'codecomment': {'language': 'python'},
50+
'gpgcrypt': {'language': 'python'},
5051
'quickhighlight': {'language': 'c'},
5152
'smartspaces': {'language': 'python'},
5253
'sourcecodebrowser': {'language': 'python'},

meson_options.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
option('plugin_bookmarks', type: 'boolean')
22
option('plugin_bracketcompletion', type: 'boolean')
33
option('plugin_codecomment', type: 'boolean')
4+
option('plugin_gpgcrypt', type: 'boolean')
45
option('plugin_markdown_preview', type: 'boolean')
56
option('plugin_quickhighlight', type: 'boolean')
67
option('plugin_smartspaces', type: 'boolean')

plugins/gpgcrypt/Makefile.am

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# GPG Encryption Plugin
2+
SUBDIRS = gpgcrypt
3+
plugindir = $(PLUMA_PLUGINS_LIBS_DIR)
4+
5+
plugin_in_files = gpgcrypt.plugin.desktop.in
6+
plugin_DATA = $(plugin_in_files:.desktop.in=)
7+
8+
$(plugin_DATA): $(plugin_in_files)
9+
$(AM_V_GEN) $(MSGFMT) --keyword=Name --keyword=Description --desktop --template $< -d $(top_srcdir)/po -o $@
10+
11+
metainfodir = $(datadir)/metainfo
12+
metainfo_DATA = pluma-gpgcrypt.metainfo.xml
13+
metainfo_in_files = $(metainfo_DATA:=.in)
14+
15+
$(metainfo_DATA): $(metainfo_in_files)
16+
$(AM_V_GEN) GETTEXTDATADIR=$(top_srcdir) $(MSGFMT) --xml --template $< -d $(top_srcdir)/po -o $@
17+
18+
EXTRA_DIST = \
19+
$(metainfo_in_files:=.in) \
20+
$(plugin_in_files:=.in)
21+
22+
CLEANFILES = \
23+
$(metainfo_DATA) \
24+
$(plugin_DATA)
25+
26+
DISTCLEANFILES = \
27+
$(metainfo_in_files) \
28+
$(plugin_in_files)
29+
30+
-include $(top_srcdir)/git.mk
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[Plugin]
2+
Loader=python3
3+
Module=gpgcrypt
4+
IAge=3
5+
Name=GPG Encryption
6+
Description=Open and save GPG-encrypted files.
7+
Authors=MATE Developers
8+
Copyright=Copyright © 2026 MATE Developers
9+
Website=@PACKAGE_URL@
10+
Version=@VERSION@
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# GPG Encryption Plugin
2+
plugindir = $(PLUMA_PLUGINS_LIBS_DIR)/gpgcrypt
3+
plugin_PYTHON = \
4+
__init__.py \
5+
gpgcrypt.py
6+
7+
CLEANFILES =
8+
DISTCLEANFILES =
9+
10+
-include $(top_srcdir)/git.mk
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import gi
2+
gi.require_version('Pluma', '1.0')
3+
gi.require_version('Gtk', '3.0')
4+
gi.require_version('Peas', '1.0')
5+
gi.require_version('PeasGtk', '1.0')
6+
7+
from .gpgcrypt import GpgCryptWindowActivatable

0 commit comments

Comments
 (0)