A native screenshot tool for wlroots based compositors such as sway and river written in Rust

Related tags

Command-line wayshot
Overview

wayshot

A native screenshot tool for wlroots based compositors such as sway and river written in Rust. X11 support coming soon.

Usage:

Region Selection:

wayshot -s "$(slurp -f '%x %y %w %h')"

Fullscreen:

wayshot

Custom file path:

wayshot -f ../screenshot.png --extension jpg

Screenshot and copy to clipboard:

wayshot --stdout | wl-copy

Pick a hex color code, using ImageMagick:

wayshot -s "$(slurp -p -f '%x %y %w %h')" --stdout | convert - -format '%[pixel:p{0,0}]' txt:-|egrep "#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})" -o

Pick a color, using ImageMagick:

wayshot -s "$(slurp -p -f '%x %y %w %h')" --stdout | convert - -format '%[pixel:p{0,0}]' txt:-

Known bugs:

Multi monitor systems break on --slurp usage. This is quite the tricky bug and will need some refactoring which we're currently working on. (#7)

Installation

AUR:

wayshot-git & wayshot-bin have been packaged.

OpenSuse Tumbleweed:

As root:

zypper addrepo https://download.opensuse.org/repositories/X11:Wayland/openSUSE_Tumbleweed/X11:Wayland.repo
zypper refresh
zypper install wayshot

Compile time dependencies:

  • rustup
  • make

Compiling:

  • git clone https://github.com/waycrate/wayshot && cd wayshot
  • make setup
  • make
  • sudo make install

Support:

  1. https://matrix.to/#/#waycrate-tools:matrix.org
  2. https://discord.gg/KKZRDYrRYW

Smithay Developers:

Massive thanks to smithay developer Cmeissl and Victor Berger. Without them this project won't be possible as my wayland knowledge is limited.

Comments
  • Problem with converting from grim to wayshot

    Problem with converting from grim to wayshot

    Hi,

    I use fish as shell and Sway as WM, and I believe one of it, causing problems with some commands that I try convert from grim to wayshot:

    What works:

    bindsym 1 exec 'wayshot -f ~/ps_$(date +"%Y%m%d%H%M%S").png', mode "default"
    bindsym 2 exec 'wayshot --stdout | wl-copy', mode "default"
    

    What I couldn't make convert:

    bindsym 3 exec 'grim -g "$(slurp)" ~/ps_$(date +"%Y%m%d%H%M%S").png', mode "default"
    bindsym 4 exec 'grim -g "$(slurp)" - | wl-copy', mode "default"
    

    I tried to convert them to like this, but from Sway they don't wont to work (nothing happens):

    • For bindsym 3 tried to make it:
    wayshot -s "$(slurp -f '%x %y %w %h')" -f ~/ps_$(date +"%Y%m%d%H%M%S").png
    

    If I try from console:

    wayshot -s "(slurp -f '%x %y %w %h')" -f ~/ps_(date +"%Y%m%d%H%M%S").png                                                                                                         5m26s/23:53
    thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: ParseIntError { kind: InvalidDigit }', src/wayshot.rs:73:69
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    

    If I try in bash

    wayshot -s "$(slurp -f '%x %y %w %h')" -f ~/ps_$(date +"%Y%m%d%H%M%S").png
    

    It' just working.

    • For bindsym 4 tried to make it:
    wayshot -s "$(slurp -f '%x %y %w %h')" --stdout | wl-copy
    

    If I try from console:

    wayshot -s "(slurp -f '%x %y %w %h')" --stdout | wl-copy
    thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: ParseIntError { kind: InvalidDigit }', src/wayshot.rs:73:69
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    

    If I try in bash

    wayshot -s "$(slurp -f '%x %y %w %h')" --stdout | wl-copy
    

    It' just working.

    opened by roland-rollo 26
  • man pages missing in the releases tar.gz file

    man pages missing in the releases tar.gz file

    I am using the 1.1.9 release and its missing docs/*.scd files. the build is failing.
    why are they not available in the release tarballs ?

    logs: https://github.com/void-linux/void-packages/runs/8087567118?check_suite_focus=true#step:7:176

    void linux package: https://github.com/void-linux/void-packages/pull/38546

    opened by akhiljalagam 3
  • Release tags are gone

    Release tags are gone

    Why did you remove all the release tags?! These are important (among others) for distributions that package wayshot. I’m maintainer of the wayshot package in Alpine Linux, just wanted to move it from the testing repository to the community repository and noticed that the build is broken due to missing source.

    opened by jirutka 3
  • Can't compile e03feb5 commit version

    Can't compile e03feb5 commit version

    There was update in Arch AUR wayshot-git package and it fails at this:

    ==> Starting build()...
       Compiling autocfg v1.1.0
       Compiling cfg-if v1.0.0
       Compiling libc v0.2.122
       Compiling bitflags v1.2.1
       Compiling proc-macro2 v1.0.37
       Compiling unicode-xid v0.2.2
       Compiling pkg-config v0.3.25
       Compiling xml-rs v0.8.4
       Compiling memchr v2.4.1
       Compiling lazy_static v1.4.0
       Compiling log v0.4.16
       Compiling smallvec v1.8.0
       Compiling once_cell v1.10.0
       Compiling scoped-tls v1.0.0
       Compiling crc32fast v1.3.2
       Compiling minimal-lexical v0.2.1
       Compiling downcast-rs v1.2.0
       Compiling adler32 v1.2.0
       Compiling adler v1.0.2
       Compiling termcolor v1.1.3
       Compiling hashbrown v0.11.2
       Compiling strsim v0.10.0
       Compiling fastrand v1.7.0
       Compiling remove_dir_all v0.5.3
       Compiling bytemuck v1.9.1
       Compiling color_quant v1.1.0
       Compiling byteorder v1.4.3
       Compiling textwrap v0.15.0
       Compiling jpeg-decoder v0.2.4
       Compiling libloading v0.7.3
       Compiling deflate v1.0.0
       Compiling miniz_oxide v0.5.1
    error: failed to run custom build command for `log v0.4.16`
    
    Caused by:
      process didn't exit successfully: `/home/roland/.cache/paru/clone/wayshot-git/src/wayshot/target/release/build/log-47e1f50aa54007f1/build-script-build` (signal: 11, SIGSEGV: invalid memory reference)
      --- stdout
      cargo:rustc-cfg=atomic_cas
      cargo:rustc-cfg=has_atomics
      cargo:rerun-if-changed=build.rs
    warning: build failed, waiting for other jobs to finish...
    error: build failed
    ==> ERROR: A failure occurred in build().
        Aborting...
    error: failed to build 'wayshot-git-1.1.1.55.g4235f3c-3':
    error: packages failed to build: wayshot-git-1.1.1.55.g4235f3c-3
    

    Maybe log crate version is to high?

    opened by roland-rollo 3
  • wayshot-git does not build from Arch AUR

    wayshot-git does not build from Arch AUR

    wayshot-git does not build from Arch AUR

    ╰> paru -S wayshot-git
    :: Resolving dependencies...
    :: Calculating conflicts...
    :: Calculating inner conflicts...
    
    :: Conflicts found:
        rustup: rust (cargo)  rust (rustfmt)  rust  rust (cargo)  rust (rustfmt)  
    
    :: Conflicting packages will have to be confirmed manually
    
    Repo Make (1) rustup-1.24.3-2
    Aur (1) wayshot-git-1.1.1.55.g4235f3c-3
    
    :: Proceed with installation? [Y/n]: 
    
    :: Downloading PKGBUILDs...
     PKGBUILDs up to date
    [sudo] password for justine: 
    resolving dependencies...
    looking for conflicting packages...
    :: rustup and rust are in conflict. Remove rust? [y/N] y
    
    Packages (2) rust-1:1.61.0-1 [removal]  rustup-1.24.3-2
    
    Total Installed Size:     7.73 MiB
    Net Upgrade Size:      -514.24 MiB
    
    :: Proceed with installation? [Y/n] 
    (1/1) checking keys in keyring                                                                                                                [--------------------------------------------------------------------------------------] 100%
    (1/1) checking package integrity                                                                                                              [--------------------------------------------------------------------------------------] 100%
    (1/1) loading package files                                                                                                                   [--------------------------------------------------------------------------------------] 100%
    (1/1) checking for file conflicts                                                                                                             [--------------------------------------------------------------------------------------] 100%
    (2/2) checking available disk space                                                                                                           [--------------------------------------------------------------------------------------] 100%
    :: Processing package changes...
    (1/1) removing rust                                                                                                                           [--------------------------------------------------------------------------------------] 100%
    (1/1) installing rustup                                                                                                                       [--------------------------------------------------------------------------------------] 100%
    You may need to run rustup update stable
    and possibly also rustup self upgrade-data
    Optional dependencies for rustup
        lldb: rust-lldb script
        gdb: rust-gdb script
    :: Running post-transaction hooks...
    (1/1) Arming ConditionNeedsUpdate...
    fetching devel info...
    ==> Making package: wayshot-git 1.1.1.55.g4235f3c-3 (Mon 27 Jun 2022 03:01:42 PM BST)
    ==> Retrieving sources...
      -> Updating wayshot git repo...
    Fetching origin
    ==> Validating source files with sha256sums...
        wayshot ... Skipped
    ==> Making package: wayshot-git 1.1.1.55.g4235f3c-3 (Mon 27 Jun 2022 03:01:43 PM BST)
    ==> Checking runtime dependencies...
    ==> Checking buildtime dependencies...
    ==> Retrieving sources...
      -> Updating wayshot git repo...
    Fetching origin
    ==> Validating source files with sha256sums...
        wayshot ... Skipped
    ==> Removing existing $srcdir/ directory...
    ==> Extracting sources...
      -> Creating working copy of wayshot git repo...
    Cloning into 'wayshot'...
    done.
    ==> Starting pkgver()...
    ==> Updated version: wayshot-git 1.1.7.83.g95f62eb-1
    ==> Sources are ready.
    wayshot-git-1.1.1.55.g4235f3c-3: parsing pkg list...
    ==> Making package: wayshot-git 1.1.7.83.g95f62eb-1 (Mon 27 Jun 2022 03:01:45 PM BST)
    ==> Checking runtime dependencies...
    ==> Checking buildtime dependencies...
    ==> WARNING: Using existing $srcdir/ tree
    ==> Starting pkgver()...
    ==> Removing existing $pkgdir/ directory...
    ==> Starting build()...
    error: no override and no default toolchain set
    ==> ERROR: A failure occurred in build().
        Aborting...
    error: failed to build 'wayshot-git-1.1.1.55.g4235f3c-3': 
    error: packages failed to build: wayshot-git-1.1.1.55.g4235f3c-3
    bug 
    opened by justinesmithies 2
  • [refactor] wl_output name from version 4 of wl_output.

    [refactor] wl_output name from version 4 of wl_output.

    Previously I had to add xdgoutput to environment to get the output names. This is no longer required, we can just bind to the 4th version of wl_output.

    opened by Shinyzenith 2
  • Added 10-bit back buffer support

    Added 10-bit back buffer support

    I experiment with render_bit_depth option in sway and found that nothing can make screenshots in this mode. So I've added this feature. I only support Xbgr2101010 and Abgr2101010 because I don't have anything to test it on Xrgb2101010 or Argb101010 formats.

    • Allow user to make screenshots if back buffer uses 10 bits per color channel.
    • Image conversion moved to convert.rs
    opened by gigablaster 1
  • No man pages in wayshot-bin AUR Package

    No man pages in wayshot-bin AUR Package

    Steps to reproduce:

    Install wayshot-bin 1.2.2-2 from the AUR

    $ pacman -Ql wayshot-bin
    wayshot-bin /usr/
    wayshot-bin /usr/bin/
    wayshot-bin /usr/bin/wayshot
    

    Installing wayshot-git 1.1.9.98.g538caac-1 doesn't have the same issue.

    $ pacman -Ql wayshot-git
    wayshot-git /usr/
    wayshot-git /usr/bin/
    wayshot-git /usr/bin/wayshot
    wayshot-git /usr/share/
    wayshot-git /usr/share/man/
    wayshot-git /usr/share/man/man1/
    wayshot-git /usr/share/man/man1/wayshot.1.gz
    wayshot-git /usr/share/man/man7/
    wayshot-git /usr/share/man/man7/wayshot.7.gz
    
    opened by salameme 0
  • [feature] add RGB565 buffer support

    [feature] add RGB565 buffer support

    This makes it possible to take screenshots if the compositor renders to an RGB565 buffer.

    I am submitting this PR because I already wrote the patch, and there's a chance it matches the project goals. However, as essentially no wlroots-based compositors currently allow rendering to RGB565 buffers, what with XBGR8888 or higher formats being preferable in almost all cases, I will understand and not be surprised if you close this.

    I tested this with a branch of sway that lets you set the output bit format/depth with the command swaymsg output '*' render_bit_depth 5.

    opened by mstoeckl 1
  • Cargo.lock is outdated in 1.2.1 release

    Cargo.lock is outdated in 1.2.1 release

    $ cargo build --locked
    error: the lock file Cargo.lock needs to be updated but --locked was passed to prevent this
    
    --- Cargo.lock
    +++ Cargo.lock.updated
    @@ -442,7 +442,7 @@
    
     [[package]]
     name = "wayshot"
    -version = "1.2.0"
    +version = "1.2.1"
     dependencies = [
      "clap",
      "env_logger",
    
    bug 
    opened by jirutka 2
  • [feat] set png compression/filter type through arguments

    [feat] set png compression/filter type through arguments

    Implemented the ability to set png compression/filter type with -C and -F argument

    pub enum CompressionType {
        Default,
        Fast,
        Best,
        Huffman,
        Rle,
    }
    
    pub enum FilterType {
        NoFilter,
        Sub,
        Up,
        Avg,
        Paeth,
        Adaptive,
    }
    
    enhancement 
    opened by EdenQwQ 3
Releases(1.2.2)
Owner
Waycrate
We write tools that are suckless in nature for the wayland protocol.
Waycrate
Satty - a Screenshot Annotation Tool inspired by Swappy and Flameshot

Satty Satty - a Screenshot Annotation Tool inspired by Swappy and Flameshot. Install You can get the official Arch Linux package from the AUR: yay -S

gabm 22 Oct 10, 2023
High performance wlroots screen recording, featuring hardware encoding

wl-screenrec High performance wlroots based screen recorder. Uses dma-buf transfers to get surface, and uses the GPU to do both the pixel format conve

Russell Greene 32 Jan 21, 2023
TMM is a Linux native game modding tool. it allows to install and depoly mods for Linux native and wine games.

Tux Mod Manager TMM is a Linux native mod manager made with the Tauri toolkit. It can install, load, remove and deploy mods for both Linux native and

Mathiew May 119 Dec 27, 2022
Adds back-and-forth jumping between current and previous focused windows to Sway.

sway-focus-back-and-forth Implements back-and-forth movement between the current and the previous focused windows. It also can be seen as a fix to thi

Vinícius Müller 4 Aug 11, 2022
"Better" tab and stack navigation for Sway WM.

sway_bfocus "Better" tab and stack navigation for Sway WM. Proof of concept. This program lets you create one set of keybinds exclusively for cycling

null 42 Oct 23, 2022
An i3/Sway utility to switch focus to your last focused window. Alt+Tab in i3

i3-back An i3/Sway utility to switch focus to your last focused window. Allows for behavior similar to Alt+Tab on other desktop environments. Features

Charles C 17 Mar 13, 2023
Crates.io library that provides high-level APIs for obtaining information on various entertainment media such as books, movies, comic books, anime, manga, and so on.

Crates.io library that provides high-level APIs for obtaining information on various entertainment media such as books, movies, comic books, anime, manga, and so on.

consumet-rs 5 Aug 13, 2023
Provides a mock Ambi client that emulates real sensor hardware such as an Edge client

ambi_mock_client Provides a mock Ambi client that emulates real sensor hardware such as an Edge client. Usage You must have Rust installed to build am

Rust Never Sleeps 2 Apr 1, 2022
👑 Show in-organization ranking of GitHub activities such as review count.

gh-ranking Show in-organization ranking of GitHub activities such as review count. Installation gh extension install yukukotani/gh-ranking Usage USAG

Yuku Kotani 3 Dec 28, 2022
A top-down arena shooter roguelite in which you're a mythical marshmallow god fighting against peasant munchies such as chocolates, jellies, or candies!

Mythmellow A top-down arena shooter roguelite in which you're a mythical marshmallow god fighting against peasant munchies such as chocolates, jellies

Umut 3 Oct 16, 2023
A top-down arena shooter roguelite in which you're a mythical marshmallow god fighting against peasant munchies such as chocolates, jellies, or candies!

Mythmallow A top-down arena shooter roguelite in which you're a mythical marshmallow god fighting against peasant munchies such as chocolates, jellies

Umut 3 Oct 29, 2023
Native cross-platform full feature terminal-based sequence editor for git interactive rebase.

Native cross-platform full feature terminal-based sequence editor for git interactive rebase.

Tim Oram 1.2k Jan 2, 2023
Shared memory - A Rust wrapper around native shared memory for Linux and Windows

shared_memory A crate that allows you to share memory between processes. This crate provides lightweight wrappers around shared memory APIs in an OS a

elast0ny 274 Dec 29, 2022
Cloud Native Buildpack that builds an OCI image with Ollama and a large language model.

Ollama Cloud Native Buildpack This buildpack builds an OCI image with Ollama and a large language model. Configure your model by an Ollama Modelfile o

Manuel Fuchs 3 Mar 19, 2024
A command line tool written in Rust and designed to be a modern build tool + package manager for C/C++ projects.

CCake CCake is a command line tool written in Rust and designed to be a modern build tool + package manager for C/C++ projects. Goals To be easily und

Boston Vanseghi 4 Oct 24, 2022
Cucumber testing framework for Rust. Fully native, no external test runners or dependencies.

Cucumber testing framework for Rust An implementation of the Cucumber testing framework for Rust. Fully native, no external test runners or dependenci

Cucumber Rust 393 Dec 31, 2022
Dechrome is a tool written in Rust for batch removing Chromium-based browsers.

Dechrome Dechrome is a tool written in Rust for batch removing Chromium-based browsers and installing Firefox as a replacement. Warning The script is

Ryze 7 Aug 29, 2023
Rust File Management CLI is a command-line tool written in Rust that provides essential file management functionalities. Whether you're working with files or directories, this tool simplifies common file operations with ease.

Rust FileOps Rust File Management CLI is a command-line tool written in Rust that provides essential file management functionalities. Whether you're w

Harikesh Ranjan Sinha 5 May 2, 2024