protonpass-tray 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. protonpass_tray-0.2.0/.gitignore +12 -0
  2. protonpass_tray-0.2.0/CHANGELOG.md +174 -0
  3. protonpass_tray-0.2.0/LICENSE +21 -0
  4. protonpass_tray-0.2.0/PKG-INFO +290 -0
  5. protonpass_tray-0.2.0/README.md +266 -0
  6. protonpass_tray-0.2.0/data/io.github.retienne.protonpass-tray.desktop +14 -0
  7. protonpass_tray-0.2.0/data/io.github.retienne.protonpass-tray.metainfo.xml +58 -0
  8. protonpass_tray-0.2.0/data/protonpass-tray.service +19 -0
  9. protonpass_tray-0.2.0/gnome-extension/README.md +28 -0
  10. protonpass_tray-0.2.0/pyproject.toml +53 -0
  11. protonpass_tray-0.2.0/src/protonpass_tray/__init__.py +6 -0
  12. protonpass_tray-0.2.0/src/protonpass_tray/__main__.py +4 -0
  13. protonpass_tray-0.2.0/src/protonpass_tray/actions.py +431 -0
  14. protonpass_tray-0.2.0/src/protonpass_tray/asking.py +178 -0
  15. protonpass_tray-0.2.0/src/protonpass_tray/cli.py +329 -0
  16. protonpass_tray-0.2.0/src/protonpass_tray/icons/protonpass-tray-locked.svg +13 -0
  17. protonpass_tray-0.2.0/src/protonpass_tray/icons/protonpass-tray-no-lock.svg +13 -0
  18. protonpass_tray-0.2.0/src/protonpass_tray/icons/protonpass-tray-unknown.svg +13 -0
  19. protonpass_tray-0.2.0/src/protonpass_tray/icons/protonpass-tray-unlocked.svg +13 -0
  20. protonpass_tray-0.2.0/src/protonpass_tray/passcli.py +436 -0
  21. protonpass_tray-0.2.0/src/protonpass_tray/prompt.py +250 -0
  22. protonpass_tray-0.2.0/src/protonpass_tray/state.py +136 -0
  23. protonpass_tray-0.2.0/src/protonpass_tray/tray.py +444 -0
  24. protonpass_tray-0.2.0/tests/common.py +78 -0
  25. protonpass_tray-0.2.0/tests/stub_pass_cli.py +295 -0
  26. protonpass_tray-0.2.0/tests/test_asking.py +228 -0
  27. protonpass_tray-0.2.0/tests/test_cli.py +661 -0
  28. protonpass_tray-0.2.0/tests/test_frontends.py +237 -0
  29. protonpass_tray-0.2.0/tests/test_passcli.py +380 -0
  30. protonpass_tray-0.2.0/tests/test_prompt.py +173 -0
  31. protonpass_tray-0.2.0/tests/test_state.py +62 -0
  32. protonpass_tray-0.2.0/tests/test_tray.py +209 -0
@@ -0,0 +1,12 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ .venv/
4
+ venv/
5
+ build/
6
+ dist/
7
+ *.egg-info/
8
+ .pytest_cache/
9
+ .ruff_cache/
10
+ .venv-dev/
11
+ dist/
12
+ .check/
@@ -0,0 +1,174 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented here. The format follows
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project uses
5
+ [semantic versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [0.2.0] - 2026-11-29
8
+
9
+ ### Measured
10
+
11
+ - A locked session does **not** disable `pass-cli ssh-agent`. `ssh` keeps working and every
12
+ key stays listed, in both states; the documented warning is about refreshing keys, not
13
+ signing.
14
+ - **`pass-cli info` can report `Session has lock: no` while the session is locked.** Proved on
15
+ a live session: `session create-lock` refused with `Session is locked. Please unlock your
16
+ session and try again.` at the same time as `info` denied any lock. So `info`'s lock line is
17
+ not evidence, and `refresh()` always probes with `vault list` instead of trusting it.
18
+ - **The lock does not remove itself.** Settled: the code set at 10:44 unlocked the session at
19
+ 23:17, 12.5 hours and many idle periods later. The earlier "removes itself" note came from
20
+ one `info` reading and was an artefact of the bug above. The lock is a standing gate.
21
+ - What the timeout counts is settled, from the binary's own strings: `- Session has lock: yes
22
+ (locks after …)`, `Session will lock after <n> seconds of inactivity` and the session field
23
+ `session_lock_after_seconds` all say the session **locks** after that much **inactivity**.
24
+ The `--idle-timeout` help line saying "auto-unlocks" is a slip in one string, and it had
25
+ been read here as corroboration for the self-removal above. It is not.
26
+ - **pass-cli 2.7.0 does not touch the session lock.** Checked on 2026-11-12, the day it was
27
+ installed here: all sixteen literals this engine classifies on are present, and the lock
28
+ vocabulary is identical in both wording and count - down to the wrong "auto-unlocks" help
29
+ line and the single `set_session_lock_after_seconds` setter. What 2.7.0 adds is an item
30
+ cache and a core-event cursor, and the locked-session refusal now appears in those new
31
+ paths too, where this engine already recognises it. Unchanged words are evidence that the
32
+ lock code was not touched, not proof: a fix that changed where `info` reads the lock from
33
+ would have left every string alone. `just check-strings` is what re-runs this check.
34
+ - **pass-cli 2.7.1 fixes the deadlock at its source.** Read off Proton's published source on
35
+ 2026-11-23, and seen on a live session on 2026-11-24: with `vault list` refused as locked,
36
+ `session unlock` asked for the code and unlocked, and `session lock` on the locked session
37
+ answered "Session is already locked" - every string this engine matches on is in the binary
38
+ too (`just check-strings`, 18 of 18). The session store's lock value is now
39
+ shared between its clones (`Arc<RwLock<…>>`, where it had been a per-clone copy written
40
+ back stale), and `lock`, `unlock`, `remove-lock`, `create-lock` and `info` each ask
41
+ `GET /pass/v1/user/session/lock/check` before acting instead of trusting the local value.
42
+ A locked session answers that check with the API's "session locked" code, so `unlock`
43
+ asks for the code on exactly the session 2.7.0 refused to. The `--idle-timeout` help now
44
+ says the session *locks* after that much inactivity. Every literal this engine classifies
45
+ on is still there; two are new, below.
46
+
47
+ ### Added
48
+
49
+ - **The Qt tray icon** (`protonpass-tray tray`, extra `[tray]`). StatusNotifierItem, so it
50
+ works on Plasma, XFCE, LXQt, Cinnamon and most Wayland panels. It is also the prompt of last
51
+ resort for the rest of the machine: a hook with no terminal reaches it over a socket in
52
+ `$XDG_RUNTIME_DIR` and gets a dialog.
53
+ - **A Plasma 6 widget** (`plasmoid/`), installable from store.kde.org. It asks for no code of
54
+ its own: QML cannot write a file or open a socket, so the code would have had to travel
55
+ through a command line.
56
+ - **A GNOME Shell extension** (`gnome-extension/`), for the desktop that has no tray at all.
57
+ The PIN is typed in the panel menu and piped to the engine's stdin.
58
+ - `--code-file` and `--code-stdin` on every subcommand that needs the code, for a front-end
59
+ that cannot prompt.
60
+ - A graphical fallback in the prompt chain: `kdialog`, `zenity` or `qarma` when there is a
61
+ display but no terminal and no tray. None of them is a dependency.
62
+ - A `justfile` with recipes for both desktop faces, their store artefacts, and
63
+ `install-data` for packagers. `just` rather than `make`: packaging goes through PEP 517
64
+ either way, so the only readers are contributors, and `just test -k lock` passes its
65
+ argument through where the make equivalent needed `ARGS="..."` across an expansion
66
+ layer that stripped quotes.
67
+
68
+ - **A waiting unlock prompt ends when the session is unlocked from somewhere else.** Seen on
69
+ 2026-11-25: `protonpass-tray unlock` waiting in a terminal, the code typed into the widget,
70
+ and the terminal still asking. Every prompt (terminal, the tray's dialog, kdialog, zenity,
71
+ systemd) now watches the state file, at no API call, and gives up once it says "unlocked"
72
+ with a time after the prompt began; the command then exits 0. What was half typed is
73
+ discarded rather than left for the shell. It cannot reach `pass-cli session unlock`, which
74
+ waits on its own read of the terminal, nor learn of an unlock made there until a face
75
+ refreshes.
76
+
77
+ - **`protonpass-tray set-timeout SECONDS`**, and the same in the Qt tray's menu and the Plasma
78
+ widget: change how long idle is too long, keeping the code. pass-cli has no command for it,
79
+ so the lock is removed and created again with the code the removal has just proved right.
80
+ A creation that fails is tried once more, and if the session is left with no lock the
81
+ message says so. Only on an unlocked session. Not in the GNOME extension yet.
82
+
83
+ - **The Plasma widget says when something is waiting for the code**: a notification naming the
84
+ program and terminal, which opens the popup with the cursor in the code field. It comes
85
+ about five seconds after the prompt, so not to someone answering it, once per prompt, and
86
+ it goes when the prompt does. A waiting prompt announces itself in
87
+ `$XDG_RUNTIME_DIR/protonpass-tray/asking/` and is believed only while it keeps rewriting
88
+ its file. It names a program and never a command line, which can hold secrets. Only
89
+ `protonpass-tray unlock` does this: `pass-cli session unlock` tells nobody it is waiting.
90
+ The Qt tray needs no such thing, as it shows the dialog itself. Not in the GNOME extension.
91
+ - **`protonpass-tray unlock --wait SECONDS`**, for a script with no terminal: it asks nothing
92
+ itself, has the widget say what is waiting, and waits for an unlock from there. Not a hang:
93
+ it fails at once unless a face is running (the widget touches `listening`, every five
94
+ seconds) and, for five minutes after a wait nobody answered, fails at once again.
95
+
96
+ ### Changed
97
+
98
+ - The icon is our own: a terminal in the panel's text colour, the state in its screen (closed
99
+ padlock, open padlock, "!" for no lock, a dimmed prompt for unknown), with the Proton Pass
100
+ mark as a badge in its top-right corner where the application is installed. It had been the
101
+ mark itself, and an unlocked session looked exactly like the Proton Pass application beside
102
+ it in the panel. The mark is still referenced from the user's installation, never shipped.
103
+ In the Qt tray and the Plasma widget; the GNOME extension keeps its symbolic padlock.
104
+ - A failed operation answers in **pass-cli's own words** when it has any, and only falls back
105
+ to describing the state when it does not. Describing the state instead turned `Error locking
106
+ session` into `No lock configured` — true, and no answer at all to someone who had just
107
+ asked for a lock to be created.
108
+ - The state a failed operation was trying to *leave* is no longer reported as its outcome, and
109
+ no failure exits 0. Both are read by a face deciding what to offer next: answering a failed
110
+ `setup` with "no lock is configured" sent a widget back to the button that had just failed,
111
+ and a refused `remove-lock` on an unlocked session had exited 0.
112
+ - Seven of pass-cli's failure lines are now recognised by name (`Error locking session`,
113
+ `Error persisting session`, `Error unlocking session`, `Error removing session lock` and the
114
+ three shapes of `Error {creating,sending} … session … request`), read off the 2.5.1 binary.
115
+ Each used to arrive as "unrecognised".
116
+ - pass-cli 2.7.1's two new sentences are recognised. `Session is already locked` (from `lock`,
117
+ exit 0) is a lock, not an unreadable answer. `Error checking session lock` - the server
118
+ check failing before any code is read - is a failure on every command, and in particular
119
+ not a wrong code on `unlock`, which is what a non-zero exit in unknown words reads as there.
120
+ - `setup` on a locked session answers EXIT_LOCKED and "unlock it first" again on 2.7.1, which
121
+ says `Session already has a lock` there where 2.5.1 said `Session is locked`. Taken at its
122
+ word it was a usage error telling the operator to remove a lock they could not yet reach.
123
+ - "pass-cli could not read the code" is no longer classified as a wrong code. It is the one
124
+ case the stdin fallback exists for, and calling it a wrong code both told the user the wrong
125
+ thing and suppressed that retry — which therefore had never run.
126
+ - The idle timeout is parsed with its unit, and from both shapes pass-cli prints it in.
127
+ `(locks after 5m)` had been read as five seconds, which expires a countdown at once and has
128
+ every face infer a lock that has not engaged.
129
+ - The five operations moved into `actions.py`, so the command line and the tray are the same
130
+ program rather than two that agree for now.
131
+ - `pass-cli`'s path is read on every call instead of once at import, because a tray started by
132
+ systemd and a shell hook do not share an environment.
133
+ - A failed operation establishes the state for real before answering, instead of leaving the
134
+ cache as it was. One extra API call, on a path that has already failed, and it is what lets
135
+ a face recover by itself rather than wait to be restarted.
136
+ - `status --json` aside, the exit codes are the interface both desktop faces now read: 10, 11
137
+ and 12 say what the state *is*, so neither of them reports one as a fault any more.
138
+ - The release workflow pins every action to a commit, gives each job only the permissions it
139
+ uses (the build none that write), refuses a tag that disagrees with `pyproject.toml`, and
140
+ carries the PyPI upload as a trusted-publisher job switched on by the `PYPI_PUBLISH`
141
+ repository variable. CI pins its actions the same way; Dependabot moves the pins monthly.
142
+ - `SECURITY.md` says how to report a vulnerability privately and what counts as one. The
143
+ README's links to it and to `LICENSE` are absolute, so they also work on PyPI.
144
+
145
+ ### Fixed
146
+
147
+ - The tray survived no caller that left while its dialog was up: answering a connection that
148
+ had already been deleted raised in a Qt slot, which ends the process.
149
+ - **An unlock that could not be read reported pass-cli's prompt as the reason.** `Enter lock
150
+ code: ` carries no newline, so it is the first thing in every captured exchange and any real
151
+ message continues the same line. A Plasma widget spent an evening showing a red
152
+ `Enter lock code:` as the error — for a session whose lock had removed itself, so there was
153
+ nothing to unlock and nothing had gone wrong.
154
+ - **A failed operation left the cached state untouched,** so the widget went on offering an
155
+ Unlock field for a lock that no longer existed. No PIN could ever work, and nothing said
156
+ why. This was the bug behind three earlier attempts at the symptoms.
157
+ - **A timeout was retried down a channel `pass-cli` ignores,** spending the timeout twice and
158
+ leaving a widget spinning for a minute. It also masked a real bug: the pty path could not
159
+ answer a *silent* confirmation prompt at all — only the first code was ever sent — because
160
+ the stdin fallback writes both lines at once and quietly covered for it.
161
+ - Whether a failure was a wrong code is decided by the command that ran, not by scraping the
162
+ output for the word "unlock". The output of a failed unlock is the prompt, which does not
163
+ contain it.
164
+ - `$XDG_RUNTIME_DIR/protonpass-tray` is forced to `0700`. `mkdir(mode=…)` applies only to a
165
+ directory it creates, and this one is usually already there — found at `0775`.
166
+
167
+ ## [0.1.0] - 2026-11-11
168
+
169
+ ### Added
170
+
171
+ - `protonpass-tray status|lock|unlock|setup|remove-lock`, a front-end over `pass-cli session`
172
+ that never puts the lock code in `argv` and never prints a secret.
173
+ - Lock state cached in `$XDG_RUNTIME_DIR`, so every face agrees without any of them asking the
174
+ Proton Pass API.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Etienne Reichenbach
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,290 @@
1
+ Metadata-Version: 2.5
2
+ Name: protonpass-tray
3
+ Version: 0.2.0
4
+ Summary: Unofficial tray icon and unlock prompt for the Proton Pass CLI session lock
5
+ Project-URL: Homepage, https://github.com/retienne/protonpass-tray
6
+ Project-URL: Issues, https://github.com/retienne/protonpass-tray/issues
7
+ Project-URL: Changelog, https://github.com/retienne/protonpass-tray/blob/main/CHANGELOG.md
8
+ Author: Etienne Reichenbach
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Keywords: pass-cli,proton,proton-pass,session-lock,statusnotifieritem,tray
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Environment :: X11 Applications :: Qt
14
+ Classifier: Intended Audience :: End Users/Desktop
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Operating System :: POSIX :: Linux
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Topic :: Desktop Environment
19
+ Classifier: Topic :: Security
20
+ Requires-Python: >=3.10
21
+ Provides-Extra: tray
22
+ Requires-Dist: pyqt6>=6.4; extra == 'tray'
23
+ Description-Content-Type: text/markdown
24
+
25
+ # protonpass-tray
26
+
27
+ Lock your [Proton Pass CLI](https://protonpass.github.io/pass-cli/) session behind a short
28
+ code, unlock it from your panel or a dialog, and let your scripts find out which it is without
29
+ a second thought.
30
+
31
+ > **Unofficial.** Not affiliated with, endorsed by, or supported by Proton AG. It drives the
32
+ > `pass-cli` binary and holds no credentials of its own.
33
+
34
+ ## The problem it solves
35
+
36
+ `pass-cli` keeps an authenticated session on your machine, and every process running as you
37
+ can spend it — read any password, sign with any SSH key — for as long as it lasts. Since 2.5.x
38
+ the CLI can gate that session behind a *lock code*: a PIN-length secret, held server-side,
39
+ that re-arms itself after an idle period you choose (`--idle-timeout`, 30–900 seconds).
40
+
41
+ What the CLI has nowhere to do is **ask** you for that code, except on the terminal that
42
+ happens to be in front of it. So a locked session surfaces as a command that failed, the wrong
43
+ error in a deploy script, and an SSH key that will not sign. This fills that gap.
44
+
45
+ ## One engine, three faces
46
+
47
+ The engine is a small Python program; each face is a thin presentation layer that runs it and
48
+ decides nothing itself. All three do the same things, except that the GNOME one
49
+ cannot change the timeout or tell you that a prompt is waiting.
50
+
51
+ | | |
52
+ | --- | --- |
53
+ | **the command** | `protonpass-tray status\|lock\|unlock\|setup\|set-timeout\|remove-lock` — works over SSH, in a script, on a server with no desktop |
54
+ | **the Qt tray** | `protonpass-tray tray` — StatusNotifierItem, so Plasma, XFCE, LXQt, Cinnamon and most Wayland panels show it |
55
+ | **the Plasma widget** | a native KDE applet with the code field, the countdown and the setup in its popup |
56
+ | **the GNOME extension** | GNOME removed system tray icons, so there an extension is the only way to have an indicator at all |
57
+
58
+ ## Install
59
+
60
+ ```bash
61
+ pipx install protonpass-tray # the command, no Qt needed
62
+ pipx install 'protonpass-tray[tray]' # with the Qt tray icon
63
+ ```
64
+
65
+ You also need `pass-cli` itself, from
66
+ [Proton's releases](https://github.com/ProtonPass/pass-cli/releases), and a session
67
+ (`pass-cli login`). Then put the lock in place:
68
+
69
+ ```bash
70
+ protonpass-tray setup --idle-timeout 600 # 10 minutes; 30-900 are pass-cli's own limits
71
+ ```
72
+
73
+ The code may be a four-digit PIN — the CLI enforces no minimum. Whether the API rate-limits
74
+ wrong attempts is not documented anywhere, so treat a short PIN as protection against someone
75
+ walking past your desk, not against someone scripting against your terminal.
76
+
77
+ **Either desktop face needs the engine installed too**, because neither store can deliver a
78
+ dependency: the widget and the extension each say so plainly rather than looking broken.
79
+
80
+ <details>
81
+ <summary>Running a face from a git checkout, before any store is involved</summary>
82
+
83
+ ```bash
84
+ just plasmoid-install # then: right-click a panel -> Add Widgets
85
+ just gnome-install # then log out and in, and: gnome-extensions enable ...
86
+ protonpass-tray tray # the Qt one, from the terminal
87
+ ```
88
+ </details>
89
+
90
+ ## Using it from a script
91
+
92
+ The exit codes are the interface, so a hook never has to parse prose:
93
+
94
+ | Code | Meaning |
95
+ | --- | --- |
96
+ | `0` | unlocked, or the command did what was asked |
97
+ | `10` | locked — a code is needed |
98
+ | `11` | no lock is configured (`protonpass-tray setup`) |
99
+ | `12` | no Proton Pass session at all (`pass-cli login`) |
100
+ | `3` | `pass-cli` said something this version does not recognise |
101
+ | `4` | `pass-cli` is not installed |
102
+
103
+ ```bash
104
+ protonpass-tray status --refresh >/dev/null || protonpass-tray unlock || exit 1
105
+ secret="$(pass-cli item view "pass://vault/title/password")"
106
+ ```
107
+
108
+ If the session is unlocked from a panel while `protonpass-tray unlock` is waiting in a
109
+ terminal, the terminal stops asking and the command succeeds. On Plasma the widget also raises
110
+ a notification that something is waiting, and for what. `pass-cli session unlock` can do
111
+ neither, so prefer this one in scripts.
112
+
113
+ With no terminal at all - a timer, an agent - `protonpass-tray unlock --wait 100` raises that
114
+ notification and waits for you to unlock from the panel. It exits 10 at once if no panel widget
115
+ is running to tell you, and after the time given otherwise.
116
+
117
+ `status` alone is free and silent — it reads a cache and asks nothing, so a hook may call it
118
+ on every SSH connection. `--json` adds the idle countdown.
119
+
120
+ ## Three rules the code is built on
121
+
122
+ **Nothing polls the API.** The lock is an *idle* timer, so every request resets it. A panel
123
+ icon that polled to keep its picture fresh would prevent the lock from ever engaging — while
124
+ displaying "unlocked" perfectly accurately, which is what makes that bug so hard to see. So
125
+ every face reads the same cache in `$XDG_RUNTIME_DIR`, runs the countdown locally, and infers
126
+ the lock when the countdown reaches zero. Only `--refresh`, or an action you took, costs a
127
+ call. The countdown is a floor rather than a promise: any `pass-cli` command in any terminal
128
+ resets the server's timer without telling us, so an inferred lock says so.
129
+
130
+ **The code never touches `argv` or the environment.** It goes to `pass-cli` down a pipe, or
131
+ down a pty with echo off for a release that insists on a terminal — both paths are implemented
132
+ and both are tested, because which one a given `pass-cli` needs is a property of the release.
133
+
134
+ **Every face takes the code where you are looking, and none of them passes it as an
135
+ argument.** It travels on stdin: GJS writes to the subprocess directly, and the Plasma widget
136
+ pipes it (`printf | protonpass-tray --code-stdin`), because QML can neither write a file nor
137
+ open a socket. That last one leaves the code in the argv of one short-lived shell, for a
138
+ fraction of a second — a deliberate trade, not an oversight. The alternative is for the engine
139
+ to raise a dialog of its own, which is a second window for something that belongs in the one
140
+ you already opened; and this lock defends against a person at your keyboard, not against a
141
+ process already running as you, which could read the keyring, ptrace the shell or keylog any
142
+ dialog in any case. What never happens is the code becoming an argument of `protonpass-tray`,
143
+ where `ps` would hold it for the whole run. `tests/test_frontends.py` asserts that, the
144
+ quoting, and that each field is cleared the moment it is sent.
145
+
146
+ ## About the icon
147
+
148
+ The Qt tray and the Plasma widget draw a **terminal**, in your panel's text colour, with the
149
+ state in its screen: a closed padlock when the session is locked, an open one when it is
150
+ unlocked, an exclamation mark when no lock is set up, and a dimmed prompt when nothing can be
151
+ said. Where the Proton Pass application is installed, its mark sits in the terminal's top-right
152
+ corner as a badge, saying which service the status is about.
153
+
154
+ Only ever as a badge. The icon used to be Proton's mark with a padlock over it, and an unlocked
155
+ session sat in the panel looking exactly like the Proton Pass application beside it. A
156
+ third-party tool may say which service a status is about; it may not dress up as it.
157
+
158
+ The mark is *referenced* from your own installation and never shipped here: this repository
159
+ carries no Proton artwork, and nothing that represents the project, from the application icon
160
+ and the entry in Plasma's widget chooser to a store listing, uses it. Without the application
161
+ installed you get the terminal alone. `tests/test_frontends.py` and `tests/test_tray.py` assert
162
+ both halves.
163
+
164
+ The GNOME extension draws a symbolic padlock for now, without the badge.
165
+
166
+ ## Publishing the two desktop faces
167
+
168
+ Both stores are manual uploads — neither has a usable API — so a tag builds the artefacts and
169
+ you upload exactly what the tag contains:
170
+
171
+ ```bash
172
+ just plasmoid-zip gnome-zip # also produced by the release workflow
173
+ ```
174
+
175
+ **KDE.** Upload `dist/*.plasmoid` at [store.kde.org](https://store.kde.org/) (a KDE Identity
176
+ account, category *Plasma 6 Add-Ons → Plasma Widgets*, with screenshots). It then appears in
177
+ Plasma's **Add Widgets → Get New Widgets**, which is the KNewStuff client for that store, and
178
+ in Discover.
179
+
180
+ **GNOME.** Upload `dist/*.shell-extension.zip` at
181
+ [extensions.gnome.org/upload](https://extensions.gnome.org/upload/). A person reviews it.
182
+ `shell-version` in `metadata.json` must list the GNOME releases it has actually been tried on,
183
+ so **a new GNOME release means a new upload**, not just a new tag.
184
+
185
+ **The engine's own discoverability** is a packaging question rather than a store one: the
186
+ AppStream metainfo in `data/` is what GNOME Software and KDE Discover read, and it only
187
+ reaches them once the engine is in a distro (AUR, COPR, OBS, Nixpkgs — see `just install-data`
188
+ for what a package should install).
189
+
190
+ ## What the lock actually does, measured
191
+
192
+ Proton's own documentation contradicts itself about the timer, so it was measured on a live
193
+ session on 2026-11-11 with a 600-second lock. One of the two answers is settled; the other
194
+ turned out to be the opposite of what the first run suggested.
195
+
196
+ **Settled: a locked session does not take your SSH keys away.** The documentation says only
197
+ that the agent "will not refresh the keys automatically … if the session has a lock", which
198
+ left open whether a locked session would empty it — the binary does contain `Returning empty
199
+ identity list: agent is locked` and `Refusing to sign: agent is locked`. It does not: `ssh`
200
+ connected normally and `ssh-add -l` listed every key, run in **both** states, so the result is
201
+ not an accident of timing. Those strings belong to the SSH agent's own lock (`ssh-add -x`),
202
+ which a session lock does not engage. The warning means what it says and no more: no *refresh*,
203
+ so a key added in the app will not appear until you unlock.
204
+
205
+ **What the timeout counts, settled.** pass-cli's help for `--idle-timeout` says "time before
206
+ the session **auto-unlocks**", which read literally would make the lock protection for one
207
+ timeout rather than a standing gate. Every other string in the binary says the opposite, and
208
+ they outnumber it — all four are its own, read with `strings` on 2.5.1 and unchanged in
209
+ 2.7.0:
210
+
211
+ | Where | What it says |
212
+ | --- | --- |
213
+ | `pass-cli info` | `- Session has lock: yes (locks after …)` |
214
+ | `pass-cli info` | `Session will lock after <n> seconds of inactivity` |
215
+ | the session field | `session_lock_after_seconds` |
216
+ | `--idle-timeout --help` | `Time in seconds before the session auto-unlocks (min 30, max 900)` |
217
+
218
+ So the timeout counts **inactivity** and the session **locks** when it runs out. The
219
+ "auto-unlocks" line is a slip in one help string, not a description of the behaviour, and
220
+ 2.7.1 corrected it: "Seconds of inactivity after which the session locks".
221
+
222
+ **The lock is a standing gate — and `info` is not to be believed about it.** Observed over one
223
+ day on a live session:
224
+
225
+ | Time | What happened |
226
+ | --- | --- |
227
+ | 10:44:18 | lock created, 600s timeout, session unlocked |
228
+ | by 11:01:12 | a server-side check found it **locked** — so it does lock itself when idle |
229
+ | 11:01:40 | locked again by hand, after an unlock |
230
+ | 11:12:32 | `pass-cli info` reported **no lock at all** — 10m52s later, with nothing touching it |
231
+ | 22:08:18 | `session create-lock` refused: `Session is locked. Please unlock your session and try again.` — while `info` still denied any lock |
232
+ | 23:17:37 | the code set at 10:44 **unlocked it**, 12.5 hours later |
233
+
234
+ That last row settles it. The lock was in place the whole time, through many idle periods, so
235
+ it does **not** remove itself: the 11:12:32 reading was `info` misreporting the lock on a
236
+ session that was locked at the time, which the 22:08 row shows directly.
237
+
238
+ So **`info`'s `Session has lock:` line is not evidence while the session is locked.** Ask an
239
+ ordinary API call instead — this is why `refresh()` always probes with `vault list` rather than
240
+ returning early on `info`. Believing it cost an evening: every face published "no lock
241
+ configured", so each offered to create one, and pass-cli refuses `create-lock` on a locked
242
+ session too. The only control on screen was the only one that could not work, and no face
243
+ could recover by itself.
244
+
245
+ **The one case still untested** is an agent *restart* while the session is locked — a reboot,
246
+ or a systemd unit's `Restart=on-failure`. It would have to fetch the keys from the API, which a
247
+ locked session refuses, so expect an empty agent until you unlock.
248
+
249
+ ## Status
250
+
251
+ 0.2.0 is the engine, the Qt tray, the Plasma widget and the GNOME extension. The whole lock
252
+ cycle — create with a code, lock itself when idle, unlock with the code, lock on demand — has
253
+ been exercised end to end on KDE Plasma 6 against a real Proton Pass session. The GNOME
254
+ extension has not yet run in a live shell.
255
+
256
+ ## Development
257
+
258
+ ```bash
259
+ just test # the whole suite
260
+ just test -k lock # or by name, passed through verbatim
261
+ just lint # ruff, as CI runs it
262
+ ```
263
+
264
+ The recipes are in `justfile` ([just](https://github.com/casey/just) — `apt install just`,
265
+ `brew install just`, or a release binary). Nothing in it is needed to *use* the project.
266
+
267
+ No dependencies, no network, no account. `tests/stub_pass_cli.py` stands in for the real
268
+ binary and reproduces its wording, because the wording is the interface this code reads. The
269
+ Qt tests are skipped where PyQt6 is absent, and say so rather than passing quietly.
270
+
271
+ The QML cannot be checked in CI — resolving the Plasma imports needs Plasma installed — but on
272
+ a machine that has it:
273
+
274
+ ```bash
275
+ just plasmoid-check # loads the widget offscreen, fails on any QML error
276
+ just plasmoid-install # then: right-click a panel -> Add Widgets
277
+ ```
278
+
279
+ `plasmoid-check` shadows the engine on `PATH` with a stub, because the widget refreshes at
280
+ start-up and a check must not reach a real Proton Pass session. It exercises the package, the
281
+ imports and the full view; the compact icon is only instantiated by a real panel.
282
+
283
+ ## Security
284
+
285
+ Please report a vulnerability privately, not in an issue: see
286
+ [SECURITY.md](https://github.com/retienne/protonpass-tray/blob/main/SECURITY.md).
287
+
288
+ ## Licence
289
+
290
+ MIT — see [LICENSE](https://github.com/retienne/protonpass-tray/blob/main/LICENSE).