Quickly take screenshots on Linux—sharing instantly with Nextcloud
Nextshot enables quick and easy capture of the desktop, a window or selection— either instantly or after a delay. Images can be copied directly to clipboard, or shared automatically via Nextcloud (the default) so you can paste the public link in chats.
From the start, the primary goal has been to work with both i3 and Sway. Since the release of 1.0, this has largely been achieved. While Nextshot will work on Sway and likely most X11-based environments, the nature of Wayland means extra work will be required for eventual compatibility with compositors other than Sway.
TL;DR: YMMV
NextShot can be installed from the AUR as nextshot.
Its dependencies vary based on your environment:
# To use in i3 (or other X11-based environments)
sudo pacman -S --asdeps imagemagick slop xclip xdotool yad
# To use in Sway
sudo pacman -S --asdeps grim slurp wl-clipboard yadFor more information on dependencies, run nextshot --deps after install.
Note that Nextshot will not automatically
install any keyboard shortcuts. A set of recommended keybindings
is provided below for users of i3 and Sway.
For other distributions, install dependencies as above then run the following to install Nextshot:
git clone -b master https://github.com/dshoreman/nextshot.git
cd nextshot && sudo make installTo have Nextshot's primary functions bound to the Print Screen key on i3 and
Sway, add the following to your config file in ~/.config/i3
and/or ~/.config/sway respectively:
bindsym Print exec --no-startup-id "nextshot -m"
bindsym Mod4+Print exec --no-startup-id "nextshot -w"
bindsym Shift+Print exec --no-startup-id "nextshot -a"
bindsym Ctrl+Print exec --no-startup-id "nextshot -mc"
bindsym Ctrl+Mod4+Print exec --no-startup-id "nextshot -wc"
bindsym Ctrl+Shift+Print exec --no-startup-id "nextshot -ac"These bindings will have PrtScr capture the current screen, Shift+PrtScr
capture an area, and Super+PrtScr capture a window—each uploading automatically
to Nextcloud and copying the share link to your clipboard.
When combined with ctrl, the raw image will be copied to clipboard
instead of uploading to Nextcloud.
Nextshot can be used in a few ways, but it's most flexible when run in a terminal.
Some of the more common usage examples are listed below. For details on all available
CLI options, run nextshot --help.
The following examples will upload a screenshot to Nextcloud and copy the
share link. To bypass Nextcloud and instead copy the image to clipboard, add
the -c or --clipboard option.
-
Capture an area/selection
nextshot -aornextshot --area -
Capture a specific window
nextshot -wornextshot --window -
Capture the active display
nextshot -mornextshot --monitor -
Capture all outputs
nextshot -fornextshot --fullscreen
Image capture can also be delayed by passing the -d, --delay option followed
by a TIMEOUT, for example nextshot -d3.5 or nextshot --delay 2m
to delay 3.5 seconds or 2 minutes respectively.
To abort selection in the --area or --window modes, press the Escape key.
There are two modes that support uploading an existing image to Nextcloud.
-
Share an image from the clipboard
nextshot -pornextshot --paste -
Share an image from the local filesystem
nextshot --file kittens.jpgNote: The
--fileoption bypasses the rename prompt and may overwrite existing files if it is already in Nextcloud. To avoid issues, first rename or copy the image to ensure a unique filename in Nextcloud.
If you have Yad installed, you can use Nextshot via its tray icon. A normal click
will trigger Nextshot's --area screenshot mode, while right
clicking will open a menu with quick access to most of Nextshot's functions.
The Nextshot tray menu can be started with nextshot -t, which you can add to .xinitrc
or your i3/Sway config to have it automatically started when you login.
The first time you run Nextshot, one of two things will happen. If you
don't have Yad, you'll be prompted to open an example config ready for
editing in your $EDITOR. See below for details on
all available options.
If you do have Yad, a GUI will open for you to enter your settings. Follow the instructions and click Ok. You'll now see a preview of the config - correct any mistakes and click Save when you're done.
The nextshot.conf file should be stored in the ~/.config/nextshot directory,
which is created automatically when you first run Nextshot. It's sourced as a
Bash script, so config options are assigned much the same way as you would
define any regular Bash variables:
server='https://example.com/nextcloud'
username='jenBloggs'
password='rcPn0-zyKC9-Dt0Vn-LG9Cn-Aa3EE'
savedir='Screenshots'
rename=falseThis is the base URL to your Nextcloud instance, including http[s]:// but
excluding the trailing /. It may be for example https://nc.example.com
or https://example.com/nextcloud depending on whether you use a subdomain
specific to Nextcloud or simply host it in a folder on your main website.
The username you use for Nextcloud, used to authenticate with the API when uploading screenshots.
This is not your Nextcloud account password but an App Password
that you create specifically for Nextshot, to be used in conjunction
with your username for API authentication.
You can create an App password by going to Settings > Personal > Security in your Nextcloud UI.
Assuming your Nextcloud is hosted at nc.example.com:
- Head to https://nc.example.com/settings/user/security
- Enter
Nextshotin the App name input - Click Create new app password and enter your account password to confirm
- Copy the resulting App Password to your config, then click Done
The app password will be 5 blocks of alphanumeric characters, separated by dashes.
The name of a folder on your Nextcloud instance which should be used to upload screenshots.
This is relative to your Nextcloud root. To have your screenshots uploaded to
a Screenshots folder inside the root-level Photos directory, you would set
savedir='Photos/Screenshots' in your config file.
Note that this folder is not created automatically, so it must exist in Nextcloud before running Nextshot.
When set to true, Nextshot will append /preview to generated share links.
With this option enabled, clicking the link will take you directly to
the full-size image rather than Nextcloud's default share UI.
Defaults to false
When disabled (set to false), this will insert /index.php in share links,
after the Server URL. Leave this set to true (enabled) if your Nextcloud
server has Pretty URLs enabled.
Defaults to true
Set the default image format and file extension for saving screenshots.
Supported values are png, jpg or jpeg.
Defaults to png.
When you set this option to true, Nextshot will prompt you to enter
a custom filename before uploading to Nextcloud. Be sure to include the
extension as it will not be added automatically. Triggering Nextshot from
the [#tray-menu](tray menu) or a #recommended-shortcuts
will require Yad for the rename prompt.
Defaults to false.
Set this to customise the highlight colour when selecting an area or window to screenshot.
It should be specified as comma-separated RGB so that Nextshot can parse the individual colour values and pass them along to either Slop or Slurp, depending on whether you use X11 or Wayland.
Defaults to 255,100,180.
In some cases, Nextshot's environment detection may not work as expected, e.g. if your system has both X11 and Wayland. If you start a tmux session under X11, switch to Wayland then run Nextshot within tmux, it would try to use X11 tools.
To fix this you can bypass the default detection method:
nextshot --env=wayland ...If Nextshot detects Wayland while running under X11, pass --env=x11 instead.
For a more permanent fix, set or export the NEXTSHOT_ENV environment variable:
export NEXTSHOT_ENV=wayland
nextshot ...
# or
NEXTSHOT_ENV=wayland nextshot ...For more details and possible values, see nextshot --help.
Slop works by creating a window the size of the screen. When used together with
Picom and background-blur enabled, Slop's window may blur what's underneath.
To fix, exclude Slop's selection window in your ~/.config/picom/picom.conf:
blur-background-exclude = [
"name = 'slop'"
]There was a bug introduced to Yad in v1.0 that broke the tray icon's context menus.
This issue was fixed in v1cont/yad@06de51c, which was released as part of Yad v5.0. Update to v5 or newer and the tray menu will be working again. If you still have problems, please create an issue.
If you find Nextshot useful and would like to contribute, there are a few ways you can help:
- Report any bugs you find while using Nextshot
- Submit a feature request if there's something you'd like added
- Send a PR if you know some Bash! Check the open issues for ideas
- Finally, donate via PayPal or Liberapay (but only if you can afford to)
Nextshot camera icon provided by Icons8.

