Skip to content

Commit 1a7b61b

Browse files
Move HTML cheatsheet to home directory (#884)
* Make local HTML cheatsheet more robust * Add a comment * Narrow scope of PR Co-authored-by: Andreas Arvidsson <andreas.arvidsson87@gmail.com>
1 parent 81f0835 commit 1a7b61b

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/cheatsheet_html/cheat_sheet.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import tempfile
21
import webbrowser
32
from pathlib import Path
43

@@ -18,7 +17,6 @@
1817
tag: user.cursorless
1918
"""
2019

21-
cheatsheet_out_dir = Path(tempfile.mkdtemp())
2220
instructions_url = "https://www.cursorless.org/docs/"
2321

2422

@@ -44,8 +42,12 @@ def cursorless_open_instructions():
4442
@ctx.action_class("user")
4543
class Actions:
4644
def cursorless_cheat_sheet_show_html():
47-
"""Show new cursorless html cheat sheet"""
48-
cheatsheet_out_path = cheatsheet_out_dir / "cheatsheet.html"
45+
"""Show cursorless html cheat sheet"""
46+
# NB: We use the user's home directory instead of temp to make sure that
47+
# Linux snaps work
48+
cheatsheet_out_dir = Path.home() / ".cursorless" / "cheatsheet"
49+
cheatsheet_out_dir.mkdir(parents=True, exist_ok=True)
50+
cheatsheet_out_path = cheatsheet_out_dir / "index.html"
4951
run_rpc_command_and_wait(
5052
"cursorless.showCheatsheet",
5153
{

0 commit comments

Comments
 (0)