Simple Colour Picker in Sway/Wayland

One of the hurdles of running Sway (a manual tiling window manager, like i3, but built for Wayland) for me has been the lack of colour picker. I spend a load of time goofing around on the Internet and getting colours right is a big deal. I thought Wayland's security model made having a colour picker nigh impossible, until I came upon this StackExchange answer by Matthias Braun.

Just for clarification, you'll need to be running Wayland and an wlroots based environment, Sway in my case, so you can install the dependencies: grim, slurp, wl-clipboard and imagemagick. This is the keybinding I've added to my ~/.config/sway/config file (triggered by `Super+Shift+P).

bindsym $mod+Shift+p exec grim -g "$(slurp -p)" -t ppm - | convert - -format '%[pixel:p{0,0}]' txt:- | tail -n 1 | cut -d ' ' -f 4 | wl-copy

Hitting that keybinding dumps a hex-color (e.g., #rrggbb) to my clipboard and I can use it however I please. All smiles from this dork.

Comments?

Nope. Don't worry about leaving them here, instead hit me up @TRST_Blog and share your thoughts.

What is this Place?

This is the weblog of the strangely disembodied TRST. Here it attempts to write somewhat intelligibly on, well, anything really. Overall, it may be less than enticing.