wslshot 0.0.11__tar.gz → 0.1.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.
- wslshot-0.1.0/PKG-INFO +282 -0
- wslshot-0.1.0/README.md +267 -0
- wslshot-0.1.0/pyproject.toml +64 -0
- wslshot-0.1.0/wslshot/cli.py +2423 -0
- wslshot-0.1.0/wslshot/exceptions.py +25 -0
- wslshot-0.0.11/LICENSE +0 -201
- wslshot-0.0.11/PKG-INFO +0 -173
- wslshot-0.0.11/README.md +0 -160
- wslshot-0.0.11/setup.cfg +0 -4
- wslshot-0.0.11/setup.py +0 -39
- wslshot-0.0.11/wslshot/cli.py +0 -592
- wslshot-0.0.11/wslshot.egg-info/PKG-INFO +0 -173
- wslshot-0.0.11/wslshot.egg-info/SOURCES.txt +0 -11
- wslshot-0.0.11/wslshot.egg-info/dependency_links.txt +0 -1
- wslshot-0.0.11/wslshot.egg-info/entry_points.txt +0 -2
- wslshot-0.0.11/wslshot.egg-info/requires.txt +0 -1
- wslshot-0.0.11/wslshot.egg-info/top_level.txt +0 -1
- {wslshot-0.0.11 → wslshot-0.1.0}/wslshot/__init__.py +0 -0
wslshot-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: wslshot
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Copy Windows screenshots into WSL for easy reuse.
|
|
5
|
+
Author: Sébastien De Revière
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Requires-Dist: click>=8.3.0
|
|
8
|
+
Requires-Dist: click-default-group>=1.2.4
|
|
9
|
+
Requires-Dist: pillow>=10.0.0
|
|
10
|
+
Requires-Python: >=3.10
|
|
11
|
+
Project-URL: Documentation, https://github.com/sderev/wslshot
|
|
12
|
+
Project-URL: Issues, https://github.com/sderev/wslshot/issues
|
|
13
|
+
Project-URL: Changelog, https://github.com/sderev/wslshot/blob/main/CHANGELOG.md
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
|
|
16
|
+
# Windows Screenshot for Linux
|
|
17
|
+
|
|
18
|
+
`wslshot` is a CLI tool designed to fetch the latest screenshot(s) from a directory shared with a Windows host, copy them to a designated directory in a Linux VM, and output their new paths in a configurable style (Markdown, HTML, or text).
|
|
19
|
+
|
|
20
|
+
Take a screenshot using the Windows Snipping tool (`win + shift + S`), then run `wslshot` in your terminal to transfer the image.
|
|
21
|
+
|
|
22
|
+

|
|
23
|
+
|
|
24
|
+
<!-- TOC -->
|
|
25
|
+
## Table of Contents
|
|
26
|
+
|
|
27
|
+
1. [Features](#features)
|
|
28
|
+
1. [AI Agent Snippet](#ai-agent-snippet)
|
|
29
|
+
1. [Installation](#installation)
|
|
30
|
+
1. [Install with `pip`](#install-with-pip)
|
|
31
|
+
1. [Install with `uv`](#install-with-uv)
|
|
32
|
+
1. [Quick Start](#quick-start)
|
|
33
|
+
1. [Windows Configuration](#windows-configuration)
|
|
34
|
+
1. [For Windows 11 Users](#for-windows-11-users)
|
|
35
|
+
1. [For Windows 10 Users](#for-windows-10-users)
|
|
36
|
+
1. [Shared Directory Configuration](#shared-directory-configuration)
|
|
37
|
+
1. [For WSL Users](#for-wsl-users)
|
|
38
|
+
1. [For Virtual Machine Users](#for-virtual-machine-users)
|
|
39
|
+
1. [Configuration](#configuration)
|
|
40
|
+
1. [Fetching Screenshots](#fetching-screenshots)
|
|
41
|
+
1. [Using a Specific Image Path](#using-a-specific-image-path)
|
|
42
|
+
1. [Output](#output)
|
|
43
|
+
1. [File Copy Behavior](#file-copy-behavior)
|
|
44
|
+
1. [Vim Integration](#vim-integration)
|
|
45
|
+
<!-- /TOC -->
|
|
46
|
+
|
|
47
|
+
## Features
|
|
48
|
+
|
|
49
|
+
* Set a default source directory for screenshots.
|
|
50
|
+
* Designate a custom source or destination directory per operation, or let wslshot detect typical image directories automatically.
|
|
51
|
+
* Fetch the most recent screenshot or specify a number of recent screenshots to fetch.
|
|
52
|
+
* Print source paths without copying files using `--no-transfer`.
|
|
53
|
+
* Control automatic staging of screenshots when copied to a git repository.
|
|
54
|
+
* Convert screenshots to `png`, `jpg`/`jpeg`, `webp`, or `gif` during copy (flag or default).
|
|
55
|
+
* Optimize copied screenshots in place without changing filenames or extensions.
|
|
56
|
+
* Set a default output style (Markdown, HTML, text) and specify a custom style per operation.
|
|
57
|
+
* Migrate legacy config values with `migrate-config --dry-run`.
|
|
58
|
+
|
|
59
|
+
## AI Agent Snippet
|
|
60
|
+
|
|
61
|
+
Nice thing to have in your `AGENTS.md`:
|
|
62
|
+
|
|
63
|
+
```md
|
|
64
|
+
## Screenshots ("use/look at a screenshot")
|
|
65
|
+
* Run `wslshot -n <number> --no-transfer` to pick n screenshots.
|
|
66
|
+
* Run `wslshot --optimize` to copy the latest screenshot and optimize it when preparing docs/images.
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Example
|
|
70
|
+
|
|
71
|
+
```text
|
|
72
|
+
Look at my last screenshot.
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
The agent will run `wslshot -n 1 --no-transfer` and inspect it.
|
|
76
|
+
|
|
77
|
+
## Installation
|
|
78
|
+
|
|
79
|
+
Ensure you have Python 3.10 or later installed on your system.
|
|
80
|
+
|
|
81
|
+
### Install with `pip`
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
python3 -m pip install wslshot
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Install with `uv`
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
uv tool install wslshot
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Quick Start
|
|
94
|
+
|
|
95
|
+
This assumes your Windows screenshots are already saved in a directory your Linux environment can access.
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
wslshot configure --source /path --destination /path
|
|
99
|
+
wslshot
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Windows Configuration
|
|
103
|
+
|
|
104
|
+
Before using `wslshot`, you need to ensure that your screenshots are automatically saved to a directory accessible by your Linux environment.
|
|
105
|
+
|
|
106
|
+
### For Windows 11 Users
|
|
107
|
+
|
|
108
|
+
The Windows Snipping Tool in Windows 11 supports automatic saving of screenshots (it should be enabled by default):
|
|
109
|
+
|
|
110
|
+
1. Open the Snipping Tool.
|
|
111
|
+
1. Click on "Settings...".
|
|
112
|
+
1. Toggle the box that says "Automatically save screenshots".
|
|
113
|
+
|
|
114
|
+
### For Windows 10 Users
|
|
115
|
+
|
|
116
|
+
The Snipping Tool in Windows 10 doesn't support automatic saving. However, you can use the following methods to automatically save screenshots:
|
|
117
|
+
|
|
118
|
+
1. **Use `Win + PrtScn`**: It captures the entire screen and saves to `C:\Users\[Your Username]\Pictures\Screenshots`.
|
|
119
|
+
1. **Use `Win + Alt + PrtScn`**: It captures the active window and saves to `C:\Users\[Your Username]\Videos\Captures`.
|
|
120
|
+
* To unify the save directory, right-click on the `Captures` directory, select **Properties**, and set your desired directory in the **Location** tab.
|
|
121
|
+
1. **Use a third-party tool**.
|
|
122
|
+
|
|
123
|
+
You can still use the Snipping Tool, but you'll need to manually save each screenshot after capturing it.
|
|
124
|
+
|
|
125
|
+
## Shared Directory Configuration
|
|
126
|
+
|
|
127
|
+
For `wslshot` to fetch screenshots from your Windows host, you need to set up a shared directory between your Windows host and your Linux VM.
|
|
128
|
+
|
|
129
|
+
### For WSL Users
|
|
130
|
+
|
|
131
|
+
If you are using the Windows Subsystem for Linux (WSL), you can directly access your Windows file system from your WSL distro. The Windows `C:` drive, for example, can be found at `/mnt/c/` within your WSL environment. Therefore, you can directly use a directory on your Windows file system as the source directory for `wslshot`.
|
|
132
|
+
|
|
133
|
+
### For Virtual Machine Users
|
|
134
|
+
|
|
135
|
+
If you are using a traditional virtual machine managed by a hypervisor (e.g., VirtualBox, VMware, Hyper-V), you'll need to set up a shared directory with your Windows host and the Linux VM. The process varies depending on your hypervisor, but here are general steps:
|
|
136
|
+
|
|
137
|
+
1. Choose a directory on your Windows host to use as your screenshot directory. This should be the same directory where you configured your Snipping Tool to automatically save screenshots.
|
|
138
|
+
1. Go into your VM settings and locate the shared directories option. Add the chosen screenshot directory as a shared directory.
|
|
139
|
+
1. Depending on your VM settings, this directory will now be available at a certain path in your Linux environment. Use this path as your source directory for `wslshot`.
|
|
140
|
+
|
|
141
|
+
Remember to consult the documentation of your hypervisor for specific instructions on how to set up shared directories.
|
|
142
|
+
|
|
143
|
+
## Configuration
|
|
144
|
+
|
|
145
|
+
Configure `wslshot` to suit your needs using the `configure` command:
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
wslshot configure [--source /path] [--destination /path] [--auto-stage-enabled True] [--output-style HTML] [--convert-to png]
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
This command allows you to set various options:
|
|
152
|
+
|
|
153
|
+
* **`--source` or `-s`**: This option lets you specify the default source directory where `wslshot` will look for screenshots.
|
|
154
|
+
|
|
155
|
+
* **`--destination` or `-d`**: This option lets you specify the default destination directory where `wslshot` will copy screenshots. When running inside a git repository, this default is ignored unless you pass `--destination` on that command; otherwise, `wslshot` uses repository image directories (`/img/`, `/images/`, `/assets/img/`, `/assets/images/`) in that order.
|
|
156
|
+
|
|
157
|
+
* **`--auto-stage-enabled`**: This option lets you control whether screenshots are automatically staged when copied to a git repository. By default, this option is set to `False`. If this option is set to `True`, any screenshot copied to a git repository will automatically be staged for commit.
|
|
158
|
+
|
|
159
|
+
* **`--output-style`**: This option lets you set the default output style for the links to the screenshots that `wslshot` creates. The available styles are Markdown, HTML, and text. If you do not set this option, `wslshot` will output links in Markdown format by default.
|
|
160
|
+
|
|
161
|
+
* **`--convert-to` or `-c`**: Set the default image conversion format. Supported formats: png, jpg, jpeg, webp, gif. Conversion runs after copying; the converted file replaces the copied original. `jpeg` is treated as `jpg`. A CLI `--convert-to` flag overrides this default.
|
|
162
|
+
|
|
163
|
+
These are default settings. Override them on a per-operation basis by providing the corresponding options when running the `wslshot` command.
|
|
164
|
+
|
|
165
|
+
Migrate older configuration keys to the current names with `migrate-config`:
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
wslshot migrate-config --dry-run
|
|
169
|
+
wslshot migrate-config
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Use `--dry-run` to preview changes without writing the config file.
|
|
173
|
+
|
|
174
|
+
## Fetching Screenshots
|
|
175
|
+
|
|
176
|
+
**Fetch screenshots with the `wslshot` command**:
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
wslshot
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
This fetches the most recent screenshot from the source directory. If run inside a git repository, wslshot looks for an existing image directory (checked in priority order) and copies the screenshot there. If none exists, it creates `/assets/images/`.
|
|
183
|
+
|
|
184
|
+
**Directories checked in priority order**:
|
|
185
|
+
|
|
186
|
+
1. `/img/`
|
|
187
|
+
2. `/images/`
|
|
188
|
+
3. `/assets/img/`
|
|
189
|
+
4. `/assets/images/`
|
|
190
|
+
|
|
191
|
+
**You can also choose a specific number of screenshots**:
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
wslshot -n 3
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
This fetches the three most recent screenshots.
|
|
198
|
+
|
|
199
|
+
**Print source paths without copying files**:
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
wslshot --no-transfer
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
This prints the source paths for the selected screenshots without copying files or interacting with git. Output defaults to text; override with `--output-style`.
|
|
206
|
+
|
|
207
|
+
This mode rejects flags that require transfer (`--destination`, `--convert-to`, `--optimize`).
|
|
208
|
+
|
|
209
|
+
**Convert screenshots to a different format**:
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
wslshot --convert-to png
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
This converts the screenshot(s) to the specified format. Supported formats: png, jpg, jpeg, webp, gif. If a default conversion is set in configuration, it runs when no flag is provided. Conversion happens after copying, and the converted file replaces the copied original. If auto-staging is enabled in a git repository, only the converted file is staged. Conversion is skipped only when the copied file already has the target extension; `.jpeg` files are rewritten to `.jpg`. Conversion applies both to the latest-screenshot workflow and when you pass a specific image path.
|
|
216
|
+
|
|
217
|
+
**Optimize copied screenshots in place**:
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
wslshot --optimize
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
This optimizes copied screenshots after transfer and rewrites destination files in place. Source files are never modified. Optimization preserves each copied file's extension. If a default conversion format is configured, `--optimize` takes precedence for that run and skips conversion.
|
|
224
|
+
|
|
225
|
+
`--optimize` conflicts with `--no-transfer` and `--convert-to`.
|
|
226
|
+
|
|
227
|
+
**Allow symlinks (security risk)**:
|
|
228
|
+
|
|
229
|
+
```bash
|
|
230
|
+
wslshot --allow-symlinks
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
WARNING: Only use with trusted paths. By default, `wslshot` rejects symlinks for security.
|
|
234
|
+
|
|
235
|
+
**These are all the possible options**:
|
|
236
|
+
|
|
237
|
+
```bash
|
|
238
|
+
wslshot [--source /custom/source] [--destination /custom/destination] [--count 3] [--output-style HTML] [--no-transfer] [--convert-to png] [--optimize] [--allow-symlinks]
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
Notes:
|
|
242
|
+
|
|
243
|
+
* `--no-transfer` cannot be combined with `--destination`, `--convert-to`, or `--optimize`.
|
|
244
|
+
* `--optimize` cannot be combined with `--convert-to`.
|
|
245
|
+
|
|
246
|
+
## Using a Specific Image Path
|
|
247
|
+
|
|
248
|
+
Provide the path to a specific image as an argument:
|
|
249
|
+
|
|
250
|
+
```bash
|
|
251
|
+
wslshot /mnt/c/user/my_name/Images/magic.gif
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
Note that you can _drag and drop_ a file into the Windows Terminal to automatically populate its path.
|
|
255
|
+
|
|
256
|
+
### Output
|
|
257
|
+
|
|
258
|
+
Upon success, the command outputs the new path in your configured output style (Markdown by default). Override per run with `--output-style`:
|
|
259
|
+
|
|
260
|
+
```
|
|
261
|
+

|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
### File Copy Behavior
|
|
265
|
+
|
|
266
|
+
The specified image is copied to your designated directory on the Linux VM.
|
|
267
|
+
|
|
268
|
+
Supported source image formats are PNG, JPEG/JPG, and GIF.
|
|
269
|
+
|
|
270
|
+
## Vim Integration
|
|
271
|
+
|
|
272
|
+
If `wslshot` is in your PATH, call it with a filter command:
|
|
273
|
+
|
|
274
|
+
```vim
|
|
275
|
+
:.!wslshot
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+

|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
<https://github.com/sderev/wslshot>
|
wslshot-0.1.0/README.md
ADDED
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
# Windows Screenshot for Linux
|
|
2
|
+
|
|
3
|
+
`wslshot` is a CLI tool designed to fetch the latest screenshot(s) from a directory shared with a Windows host, copy them to a designated directory in a Linux VM, and output their new paths in a configurable style (Markdown, HTML, or text).
|
|
4
|
+
|
|
5
|
+
Take a screenshot using the Windows Snipping tool (`win + shift + S`), then run `wslshot` in your terminal to transfer the image.
|
|
6
|
+
|
|
7
|
+

|
|
8
|
+
|
|
9
|
+
<!-- TOC -->
|
|
10
|
+
## Table of Contents
|
|
11
|
+
|
|
12
|
+
1. [Features](#features)
|
|
13
|
+
1. [AI Agent Snippet](#ai-agent-snippet)
|
|
14
|
+
1. [Installation](#installation)
|
|
15
|
+
1. [Install with `pip`](#install-with-pip)
|
|
16
|
+
1. [Install with `uv`](#install-with-uv)
|
|
17
|
+
1. [Quick Start](#quick-start)
|
|
18
|
+
1. [Windows Configuration](#windows-configuration)
|
|
19
|
+
1. [For Windows 11 Users](#for-windows-11-users)
|
|
20
|
+
1. [For Windows 10 Users](#for-windows-10-users)
|
|
21
|
+
1. [Shared Directory Configuration](#shared-directory-configuration)
|
|
22
|
+
1. [For WSL Users](#for-wsl-users)
|
|
23
|
+
1. [For Virtual Machine Users](#for-virtual-machine-users)
|
|
24
|
+
1. [Configuration](#configuration)
|
|
25
|
+
1. [Fetching Screenshots](#fetching-screenshots)
|
|
26
|
+
1. [Using a Specific Image Path](#using-a-specific-image-path)
|
|
27
|
+
1. [Output](#output)
|
|
28
|
+
1. [File Copy Behavior](#file-copy-behavior)
|
|
29
|
+
1. [Vim Integration](#vim-integration)
|
|
30
|
+
<!-- /TOC -->
|
|
31
|
+
|
|
32
|
+
## Features
|
|
33
|
+
|
|
34
|
+
* Set a default source directory for screenshots.
|
|
35
|
+
* Designate a custom source or destination directory per operation, or let wslshot detect typical image directories automatically.
|
|
36
|
+
* Fetch the most recent screenshot or specify a number of recent screenshots to fetch.
|
|
37
|
+
* Print source paths without copying files using `--no-transfer`.
|
|
38
|
+
* Control automatic staging of screenshots when copied to a git repository.
|
|
39
|
+
* Convert screenshots to `png`, `jpg`/`jpeg`, `webp`, or `gif` during copy (flag or default).
|
|
40
|
+
* Optimize copied screenshots in place without changing filenames or extensions.
|
|
41
|
+
* Set a default output style (Markdown, HTML, text) and specify a custom style per operation.
|
|
42
|
+
* Migrate legacy config values with `migrate-config --dry-run`.
|
|
43
|
+
|
|
44
|
+
## AI Agent Snippet
|
|
45
|
+
|
|
46
|
+
Nice thing to have in your `AGENTS.md`:
|
|
47
|
+
|
|
48
|
+
```md
|
|
49
|
+
## Screenshots ("use/look at a screenshot")
|
|
50
|
+
* Run `wslshot -n <number> --no-transfer` to pick n screenshots.
|
|
51
|
+
* Run `wslshot --optimize` to copy the latest screenshot and optimize it when preparing docs/images.
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Example
|
|
55
|
+
|
|
56
|
+
```text
|
|
57
|
+
Look at my last screenshot.
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
The agent will run `wslshot -n 1 --no-transfer` and inspect it.
|
|
61
|
+
|
|
62
|
+
## Installation
|
|
63
|
+
|
|
64
|
+
Ensure you have Python 3.10 or later installed on your system.
|
|
65
|
+
|
|
66
|
+
### Install with `pip`
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
python3 -m pip install wslshot
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Install with `uv`
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
uv tool install wslshot
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Quick Start
|
|
79
|
+
|
|
80
|
+
This assumes your Windows screenshots are already saved in a directory your Linux environment can access.
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
wslshot configure --source /path --destination /path
|
|
84
|
+
wslshot
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Windows Configuration
|
|
88
|
+
|
|
89
|
+
Before using `wslshot`, you need to ensure that your screenshots are automatically saved to a directory accessible by your Linux environment.
|
|
90
|
+
|
|
91
|
+
### For Windows 11 Users
|
|
92
|
+
|
|
93
|
+
The Windows Snipping Tool in Windows 11 supports automatic saving of screenshots (it should be enabled by default):
|
|
94
|
+
|
|
95
|
+
1. Open the Snipping Tool.
|
|
96
|
+
1. Click on "Settings...".
|
|
97
|
+
1. Toggle the box that says "Automatically save screenshots".
|
|
98
|
+
|
|
99
|
+
### For Windows 10 Users
|
|
100
|
+
|
|
101
|
+
The Snipping Tool in Windows 10 doesn't support automatic saving. However, you can use the following methods to automatically save screenshots:
|
|
102
|
+
|
|
103
|
+
1. **Use `Win + PrtScn`**: It captures the entire screen and saves to `C:\Users\[Your Username]\Pictures\Screenshots`.
|
|
104
|
+
1. **Use `Win + Alt + PrtScn`**: It captures the active window and saves to `C:\Users\[Your Username]\Videos\Captures`.
|
|
105
|
+
* To unify the save directory, right-click on the `Captures` directory, select **Properties**, and set your desired directory in the **Location** tab.
|
|
106
|
+
1. **Use a third-party tool**.
|
|
107
|
+
|
|
108
|
+
You can still use the Snipping Tool, but you'll need to manually save each screenshot after capturing it.
|
|
109
|
+
|
|
110
|
+
## Shared Directory Configuration
|
|
111
|
+
|
|
112
|
+
For `wslshot` to fetch screenshots from your Windows host, you need to set up a shared directory between your Windows host and your Linux VM.
|
|
113
|
+
|
|
114
|
+
### For WSL Users
|
|
115
|
+
|
|
116
|
+
If you are using the Windows Subsystem for Linux (WSL), you can directly access your Windows file system from your WSL distro. The Windows `C:` drive, for example, can be found at `/mnt/c/` within your WSL environment. Therefore, you can directly use a directory on your Windows file system as the source directory for `wslshot`.
|
|
117
|
+
|
|
118
|
+
### For Virtual Machine Users
|
|
119
|
+
|
|
120
|
+
If you are using a traditional virtual machine managed by a hypervisor (e.g., VirtualBox, VMware, Hyper-V), you'll need to set up a shared directory with your Windows host and the Linux VM. The process varies depending on your hypervisor, but here are general steps:
|
|
121
|
+
|
|
122
|
+
1. Choose a directory on your Windows host to use as your screenshot directory. This should be the same directory where you configured your Snipping Tool to automatically save screenshots.
|
|
123
|
+
1. Go into your VM settings and locate the shared directories option. Add the chosen screenshot directory as a shared directory.
|
|
124
|
+
1. Depending on your VM settings, this directory will now be available at a certain path in your Linux environment. Use this path as your source directory for `wslshot`.
|
|
125
|
+
|
|
126
|
+
Remember to consult the documentation of your hypervisor for specific instructions on how to set up shared directories.
|
|
127
|
+
|
|
128
|
+
## Configuration
|
|
129
|
+
|
|
130
|
+
Configure `wslshot` to suit your needs using the `configure` command:
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
wslshot configure [--source /path] [--destination /path] [--auto-stage-enabled True] [--output-style HTML] [--convert-to png]
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
This command allows you to set various options:
|
|
137
|
+
|
|
138
|
+
* **`--source` or `-s`**: This option lets you specify the default source directory where `wslshot` will look for screenshots.
|
|
139
|
+
|
|
140
|
+
* **`--destination` or `-d`**: This option lets you specify the default destination directory where `wslshot` will copy screenshots. When running inside a git repository, this default is ignored unless you pass `--destination` on that command; otherwise, `wslshot` uses repository image directories (`/img/`, `/images/`, `/assets/img/`, `/assets/images/`) in that order.
|
|
141
|
+
|
|
142
|
+
* **`--auto-stage-enabled`**: This option lets you control whether screenshots are automatically staged when copied to a git repository. By default, this option is set to `False`. If this option is set to `True`, any screenshot copied to a git repository will automatically be staged for commit.
|
|
143
|
+
|
|
144
|
+
* **`--output-style`**: This option lets you set the default output style for the links to the screenshots that `wslshot` creates. The available styles are Markdown, HTML, and text. If you do not set this option, `wslshot` will output links in Markdown format by default.
|
|
145
|
+
|
|
146
|
+
* **`--convert-to` or `-c`**: Set the default image conversion format. Supported formats: png, jpg, jpeg, webp, gif. Conversion runs after copying; the converted file replaces the copied original. `jpeg` is treated as `jpg`. A CLI `--convert-to` flag overrides this default.
|
|
147
|
+
|
|
148
|
+
These are default settings. Override them on a per-operation basis by providing the corresponding options when running the `wslshot` command.
|
|
149
|
+
|
|
150
|
+
Migrate older configuration keys to the current names with `migrate-config`:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
wslshot migrate-config --dry-run
|
|
154
|
+
wslshot migrate-config
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Use `--dry-run` to preview changes without writing the config file.
|
|
158
|
+
|
|
159
|
+
## Fetching Screenshots
|
|
160
|
+
|
|
161
|
+
**Fetch screenshots with the `wslshot` command**:
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
wslshot
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
This fetches the most recent screenshot from the source directory. If run inside a git repository, wslshot looks for an existing image directory (checked in priority order) and copies the screenshot there. If none exists, it creates `/assets/images/`.
|
|
168
|
+
|
|
169
|
+
**Directories checked in priority order**:
|
|
170
|
+
|
|
171
|
+
1. `/img/`
|
|
172
|
+
2. `/images/`
|
|
173
|
+
3. `/assets/img/`
|
|
174
|
+
4. `/assets/images/`
|
|
175
|
+
|
|
176
|
+
**You can also choose a specific number of screenshots**:
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
wslshot -n 3
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
This fetches the three most recent screenshots.
|
|
183
|
+
|
|
184
|
+
**Print source paths without copying files**:
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
wslshot --no-transfer
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
This prints the source paths for the selected screenshots without copying files or interacting with git. Output defaults to text; override with `--output-style`.
|
|
191
|
+
|
|
192
|
+
This mode rejects flags that require transfer (`--destination`, `--convert-to`, `--optimize`).
|
|
193
|
+
|
|
194
|
+
**Convert screenshots to a different format**:
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
wslshot --convert-to png
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
This converts the screenshot(s) to the specified format. Supported formats: png, jpg, jpeg, webp, gif. If a default conversion is set in configuration, it runs when no flag is provided. Conversion happens after copying, and the converted file replaces the copied original. If auto-staging is enabled in a git repository, only the converted file is staged. Conversion is skipped only when the copied file already has the target extension; `.jpeg` files are rewritten to `.jpg`. Conversion applies both to the latest-screenshot workflow and when you pass a specific image path.
|
|
201
|
+
|
|
202
|
+
**Optimize copied screenshots in place**:
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
wslshot --optimize
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
This optimizes copied screenshots after transfer and rewrites destination files in place. Source files are never modified. Optimization preserves each copied file's extension. If a default conversion format is configured, `--optimize` takes precedence for that run and skips conversion.
|
|
209
|
+
|
|
210
|
+
`--optimize` conflicts with `--no-transfer` and `--convert-to`.
|
|
211
|
+
|
|
212
|
+
**Allow symlinks (security risk)**:
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
wslshot --allow-symlinks
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
WARNING: Only use with trusted paths. By default, `wslshot` rejects symlinks for security.
|
|
219
|
+
|
|
220
|
+
**These are all the possible options**:
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
wslshot [--source /custom/source] [--destination /custom/destination] [--count 3] [--output-style HTML] [--no-transfer] [--convert-to png] [--optimize] [--allow-symlinks]
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
Notes:
|
|
227
|
+
|
|
228
|
+
* `--no-transfer` cannot be combined with `--destination`, `--convert-to`, or `--optimize`.
|
|
229
|
+
* `--optimize` cannot be combined with `--convert-to`.
|
|
230
|
+
|
|
231
|
+
## Using a Specific Image Path
|
|
232
|
+
|
|
233
|
+
Provide the path to a specific image as an argument:
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
wslshot /mnt/c/user/my_name/Images/magic.gif
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
Note that you can _drag and drop_ a file into the Windows Terminal to automatically populate its path.
|
|
240
|
+
|
|
241
|
+
### Output
|
|
242
|
+
|
|
243
|
+
Upon success, the command outputs the new path in your configured output style (Markdown by default). Override per run with `--output-style`:
|
|
244
|
+
|
|
245
|
+
```
|
|
246
|
+

|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
### File Copy Behavior
|
|
250
|
+
|
|
251
|
+
The specified image is copied to your designated directory on the Linux VM.
|
|
252
|
+
|
|
253
|
+
Supported source image formats are PNG, JPEG/JPG, and GIF.
|
|
254
|
+
|
|
255
|
+
## Vim Integration
|
|
256
|
+
|
|
257
|
+
If `wslshot` is in your PATH, call it with a filter command:
|
|
258
|
+
|
|
259
|
+
```vim
|
|
260
|
+
:.!wslshot
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+

|
|
264
|
+
|
|
265
|
+
---
|
|
266
|
+
|
|
267
|
+
<https://github.com/sderev/wslshot>
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["uv_build>=0.9.21,<0.10.0"]
|
|
3
|
+
build-backend = "uv_build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "wslshot"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Copy Windows screenshots into WSL for easy reuse."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "Apache-2.0"
|
|
11
|
+
authors = [{ name = "Sébastien De Revière" }]
|
|
12
|
+
requires-python = ">=3.10"
|
|
13
|
+
dependencies = [
|
|
14
|
+
"click>=8.3.0",
|
|
15
|
+
"click-default-group>=1.2.4",
|
|
16
|
+
"Pillow>=10.0.0",
|
|
17
|
+
]
|
|
18
|
+
|
|
19
|
+
[dependency-groups]
|
|
20
|
+
dev = [
|
|
21
|
+
"pytest>=8.0.0",
|
|
22
|
+
"scriv[toml]>=1.5.0",
|
|
23
|
+
# urllib3 is a transitive dependency of scriv (via requests).
|
|
24
|
+
# Pinned to fix CVE-2026-21441 (decompression bomb in streaming API).
|
|
25
|
+
"urllib3>=2.6.3",
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
[project.urls]
|
|
29
|
+
Documentation = "https://github.com/sderev/wslshot"
|
|
30
|
+
Issues = "https://github.com/sderev/wslshot/issues"
|
|
31
|
+
Changelog = "https://github.com/sderev/wslshot/blob/main/CHANGELOG.md"
|
|
32
|
+
|
|
33
|
+
[project.scripts]
|
|
34
|
+
wslshot = "wslshot.cli:wslshot"
|
|
35
|
+
|
|
36
|
+
[tool.uv.build-backend]
|
|
37
|
+
module-root = ""
|
|
38
|
+
|
|
39
|
+
[tool.ruff]
|
|
40
|
+
line-length = 100
|
|
41
|
+
|
|
42
|
+
[tool.ruff.lint]
|
|
43
|
+
extend-select = ["I001"]
|
|
44
|
+
|
|
45
|
+
[tool.pytest.ini_options]
|
|
46
|
+
addopts = "-ra"
|
|
47
|
+
testpaths = ["tests"]
|
|
48
|
+
|
|
49
|
+
[tool.scriv]
|
|
50
|
+
version = "literal: pyproject.toml: project.version"
|
|
51
|
+
format = "md"
|
|
52
|
+
md_header_level = 2
|
|
53
|
+
output_file = "CHANGELOG.md"
|
|
54
|
+
fragment_directory = "changelog.d"
|
|
55
|
+
new_fragment_template = "file: changelog.d/templates/fragment.md.j2"
|
|
56
|
+
categories = [
|
|
57
|
+
"Added",
|
|
58
|
+
"Changed",
|
|
59
|
+
"Deprecated",
|
|
60
|
+
"Removed",
|
|
61
|
+
"Fixed",
|
|
62
|
+
"Security",
|
|
63
|
+
]
|
|
64
|
+
entry_title_template = "{{ version }} - {{ date.strftime('%Y-%m-%d') }}"
|