nixos-config/modules/home/wms/programs/wlpicker/default.nix

16 lines
480 B
Nix

{ config, lib, pkgs, ... }:
{
home.packages = with pkgs; lib.mkIf config.home.desktop.enable [
(pkgs.writeScriptBin "wlpicker" ''
# Get color position
position=$(slurp -b 00000000 -p)
# Sleep to prevet grim always returning improper color
sleep 1
# Store the hex color value using imagemagick
grim -g "$position" -t png - | magick - -format '%[pixel:p{0,0}]' txt:- | tail -n 1 | cut -d ' ' -f 4 | wl-copy -n
'')
];
}