Package: wslshot
Windows Screenshot for Linuxwslshotis a CLI tool designed to fetch the latest screenshot(s) from a shared directory with a Windows host, copy them to a designated directory in a Linux VM, and output their new Markdown-formatted paths.Simply take a screenshot using the Windows Snipping tool (win + shift + S), and then runwslshotin your terminal to effortlessly transfer the image.Table of ContentsFeaturesInstallationInstall withpipInstall withpipx(Recommended)Windows ConfigurationShared Folder ConfigurationFor WSL UsersFor Virtual Machine UsersConfiguration ofwslshotFetching ScreenshotsSpecifying an Image Path Instead of a DirectoryOutputFile Copy BehaviorIntegration in VimFeaturesSet a default source directory for screenshots.Designate a custom source or destination directory per operation.Or automatically detect/assets/images/or other typical folders for this use case.Fetch the most recent screenshot or specify a number of recent screenshots to fetch.Control automatic staging of screenshots when copied to a git repository.Set a default output format (Markdown, HTML, plain text of the path) and specify a custom format per operation.InstallationEnsure you have Python 3.8 or later installed on your system.Install withpippython3-mpipinstallwslshotInstall withpipx(Recommended)pipxinstallwslshotWindows ConfigurationBefore usingwslshot, it's essential to configure the Windows Snipping Tool to save screenshots automatically. It should be the default behavior; if it's not, here's how to enable automatic saving of screenshots in the Windows Snipping Tool:Open the Snipping Tool.Click on "Settings...".Toggle the box that says "Automatically save screenshots".Shared Folder ConfigurationForwslshotto fetch screenshots from your Windows host, you need to set up a shared directory between your Windows host and your Linux VM.For WSL UsersIf you are using the Windows Subsystem for Linux (WSL), you can directly access your Windows file system from your WSL distro. The WindowsC:drive, for example, can be found at/mnt/c/within your WSL environment. Therefore, you can directly use a folder on your Windows file system as the source directory forwslshot.For Virtual Machine UsersIf 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 folder with your Windows host and the Linux VM. The process varies depending on your VM provider, but here are general steps:Choose a folder on your Windows host to use as your screenshot folder. This should be the same folder where you configured your Snipping Tool to automatically save screenshots.Go into your VM settings and locate the shared folders option. Add the chosen screenshot folder as a shared folder.Depending on your VM settings, this folder will now be available at a certain path in your Linux environment. Use this path as your source directory forwslshot.Remember to consult your VM provider's documentation for specific instructions on how to set up shared folders.Configuration ofwslshotBefore usingwslshot, you may want to configure it to suit your needs. You can do this using theconfigurecommand:wslshotconfigure--source/path/to/source--auto-stage-enabledTrue--output-formatHTMLThis command allows you to set various options:--sourceor-s: This option lets you specify the default source directory wherewslshotwill look for screenshots.--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 toFalse. If this option is set toTrue, any screenshot copied to a git repository will automatically be staged for commit.--output-formator-f: This option lets you set the default output format for the links to the screenshots thatwslshotcreates. The available formats are Markdown, HTML, and the plain text of the path (plain_text). If you do not set this option,wslshotwill output links in Markdown format by default.Remember, these are just the default settings. You can override these settings on a per-operation basis by providing the corresponding options when running thewslshotcommand.Fetching ScreenshotsFetch screenshots with thewslshotcommand:wslshotThis will fetch the most recent screenshots from the source directory. If this command is run inside a git repository, it will create the folder/assets/images(if it doesn't exist) and copy the screenshot to it.These are the folders automatically detected for the copy:/assets/img//assets/images//img//images/You can also choose a specific number of screenshots:wslshot-n3This will fetch the three most recent screenshots.These are all the possible options:wslshot[--source/custom/source][--destination/custom/destination][--count3][--output-formatHTML]Specifying an Image Path Instead of a DirectoryTo utilize this feature, provide the path to the image you'd like to copy as an argument when running thewslshotcommand:wslshot/mnt/c/user/my_name/Images/magic.gifNote that you candrag and dropa file into the Windows Terminal to automatically populate its path.OutputUpon success, the command will output the new path of the image in Markdown format:![magic.gif](/assets/images/animated_magic.gif)File Copy BehaviorAs with the standard usage ofwslshot, the specified image will be copied to your designated folder on the Linux VM.Integration in VimIfwslshotis in your PATH (this is by default if you installed it withpipx), you can easily call it with a shebang command.:.!wslshothttps://github.com/sderev/wslshot