Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package hyprpicker for openSUSE:Factory checked in at 2026-11-19 16:56:00 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/hyprpicker (Old) and /work/SRC/openSUSE:Factory/.hyprpicker.new.1251 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "hyprpicker" Thu Nov 19 16:56:00 2026 rev:6 rq:1398621 version:0.4.8 Changes: -------- --- /work/SRC/openSUSE:Factory/hyprpicker/hyprpicker.changes 2026-07-23 23:15:43.707628868 +0200 +++ /work/SRC/openSUSE:Factory/.hyprpicker.new.1251/hyprpicker.changes 2026-11-19 16:57:06.990873358 +0100 @@ -1,0 +2,15 @@ +Wed Nov 18 15:06:05 UTC 2026 - Nassim Lhadj <[email protected]> + +- Update to version 0.4.8: + * Nix: remove pcre dep + * layer: request ondemand focus if available + * Fix: updated notification app name + * Add libc++ <20 fallback for floating-point scale value validation + * Feat: support matching and copying 141 W3C standard color names + * Fix hyprpicker not attaching a buffer to Jay + * core: migrate to ext-icc for screencopy + * chore: clang-format + * Fix character sizing + * Fix: make standard color names more readable + +------------------------------------------------------------------- Old: ---- hyprpicker-0.4.7.obscpio New: ---- hyprpicker-0.4.8.obscpio ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ hyprpicker.spec ++++++ --- /var/tmp/diff_new_pack.601P2e/_old 2026-11-19 16:57:08.116921088 +0100 +++ /var/tmp/diff_new_pack.601P2e/_new 2026-11-19 16:57:08.117921131 +0100 @@ -17,7 +17,7 @@ Name: hyprpicker -Version: 0.4.7 +Version: 0.4.8 Release: 0 Summary: A wlroots-compatible Wayland color picker License: BSD-3-Clause ++++++ hyprpicker-0.4.7.obscpio -> hyprpicker-0.4.8.obscpio ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hyprpicker-0.4.7/CMakeLists.txt new/hyprpicker-0.4.8/CMakeLists.txt --- old/hyprpicker-0.4.7/CMakeLists.txt 2026-05-05 01:34:34.000000000 +0200 +++ new/hyprpicker-0.4.8/CMakeLists.txt 2026-11-01 19:08:15.000000000 +0100 @@ -59,7 +59,7 @@ REQUIRED IMPORTED_TARGET wayland-client - wayland-protocols + wayland-protocols>=1.37 xkbcommon cairo pango @@ -105,13 +105,15 @@ protocolwayland() protocolnew("protocols" "wlr-layer-shell-unstable-v1" true) -protocolnew("protocols" "wlr-screencopy-unstable-v1" true) protocolnew("stable/linux-dmabuf" "linux-dmabuf-v1" false) protocolnew("staging/fractional-scale" "fractional-scale-v1" false) protocolnew("stable/viewporter" "viewporter" false) protocolnew("stable/xdg-shell" "xdg-shell" false) protocolnew("staging/cursor-shape" "cursor-shape-v1" false) protocolnew("stable/tablet" "tablet-v2" false) +protocolnew("staging/ext-foreign-toplevel-list" "ext-foreign-toplevel-list-v1" false) +protocolnew("staging/ext-image-capture-source" "ext-image-capture-source-v1" false) +protocolnew("staging/ext-image-copy-capture" "ext-image-copy-capture-v1" false) target_compile_definitions(hyprpicker PRIVATE "-DGIT_COMMIT_HASH=\"${GIT_COMMIT_HASH}\"") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hyprpicker-0.4.7/VERSION new/hyprpicker-0.4.8/VERSION --- old/hyprpicker-0.4.7/VERSION 2026-05-05 01:34:34.000000000 +0200 +++ new/hyprpicker-0.4.8/VERSION 2026-11-01 19:08:15.000000000 +0100 @@ -1 +1 @@ -0.4.7 +0.4.8 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hyprpicker-0.4.7/flake.lock new/hyprpicker-0.4.8/flake.lock --- old/hyprpicker-0.4.7/flake.lock 2026-05-05 01:34:34.000000000 +0200 +++ new/hyprpicker-0.4.8/flake.lock 2026-11-01 19:08:15.000000000 +0100 @@ -10,11 +10,11 @@ ] }, "locked": { - "lastModified": 1772459870, - "narHash": "sha256-xxkK2Cvqxpf/4UGcJ/TyCwrvmiNWsKsJfFzHMp2bxis=", + "lastModified": 1786464080, + "narHash": "sha256-W1hxvumEM57yV+QwsZ4QdAHEqOkr7e4S8VAkLX60qDE=", "owner": "hyprwm", "repo": "hyprutils", - "rev": "e63f3a79334dec49f8eb1691f66f18115df04085", + "rev": "c157fe1e3092b980cc69315a6631f89aff09dcce", "type": "github" }, "original": { @@ -33,11 +33,11 @@ ] }, "locked": { - "lastModified": 1772459835, - "narHash": "sha256-978jRz/y/9TKmZb/qD4lEYHCQGHpEXGqy+8X2lFZsak=", + "lastModified": 1786464033, + "narHash": "sha256-QM8Qe4/L8lpdVN4bgwahmi+jyyc4fisseDMe4afcDxA=", "owner": "hyprwm", "repo": "hyprwayland-scanner", - "rev": "0a692d4a645165eebd65f109146b8861e3a925e7", + "rev": "62e62c1ca23da17612c6890d4ad2064f575643db", "type": "github" }, "original": { @@ -48,11 +48,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1772433332, - "narHash": "sha256-izhTDFKsg6KeVBxJS9EblGeQ8y+O8eCa6RcW874vxEc=", + "lastModified": 1786247143, + "narHash": "sha256-8S3Kcxs7D4UtxJxSJZz0m14CGhuW0MxfrIwJxeGWGnQ=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "cf59864ef8aa2e178cccedbe2c178185b0365705", + "rev": "279b4a8275f032c566576b3f181fa0f27197f588", "type": "github" }, "original": { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hyprpicker-0.4.7/nix/default.nix new/hyprpicker-0.4.8/nix/default.nix --- old/hyprpicker-0.4.7/nix/default.nix 2026-05-05 01:34:34.000000000 +0200 +++ new/hyprpicker-0.4.8/nix/default.nix 2026-11-01 19:08:15.000000000 +0100 @@ -16,8 +16,6 @@ libXdmcp, libxkbcommon, pango, - pcre, - pcre2, util-linux, wayland, wayland-protocols, @@ -52,8 +50,6 @@ libXdmcp libxkbcommon pango - pcre - pcre2 util-linux wayland wayland-protocols diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hyprpicker-0.4.7/nix/overlays.nix new/hyprpicker-0.4.8/nix/overlays.nix --- old/hyprpicker-0.4.7/nix/overlays.nix 2026-05-05 01:34:34.000000000 +0200 +++ new/hyprpicker-0.4.8/nix/overlays.nix 2026-11-01 19:08:15.000000000 +0100 @@ -24,7 +24,7 @@ hyprpicker = final: prev: { hyprpicker = prev.callPackage ./default.nix { - stdenv = prev.gcc15Stdenv; + stdenv = prev.gcc16Stdenv; version = version + "+date=" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hyprpicker-0.4.7/protocols/wlr-screencopy-unstable-v1.xml new/hyprpicker-0.4.8/protocols/wlr-screencopy-unstable-v1.xml --- old/hyprpicker-0.4.7/protocols/wlr-screencopy-unstable-v1.xml 2026-05-05 01:34:34.000000000 +0200 +++ new/hyprpicker-0.4.8/protocols/wlr-screencopy-unstable-v1.xml 1970-01-01 01:00:00.000000000 +0100 @@ -1,179 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<protocol name="wlr_screencopy_unstable_v1"> - <copyright> - Copyright © 2018 Simon Ser - - Permission is hereby granted, free of charge, to any person obtaining a - copy of this software and associated documentation files (the "Software"), - to deal in the Software without restriction, including without limitation - the rights to use, copy, modify, merge, publish, distribute, sublicense, - and/or sell copies of the Software, and to permit persons to whom the - Software is furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice (including the next - paragraph) shall be included in all copies or substantial portions of the - Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - </copyright> - - <description summary="screen content capturing on client buffers"> - This protocol allows clients to ask the compositor to copy part of the - screen content to a client buffer. - - Warning! The protocol described in this file is experimental and - backward incompatible changes may be made. Backward compatible changes - may be added together with the corresponding interface version bump. - Backward incompatible changes are done by bumping the version number in - the protocol and interface names and resetting the interface version. - Once the protocol is to be declared stable, the 'z' prefix and the - version number in the protocol and interface names are removed and the - interface version number is reset. - </description> - - <interface name="zwlr_screencopy_manager_v1" version="1"> - <description summary="manager to inform clients and begin capturing"> - This object is a manager which offers requests to start capturing from a - source. - </description> - - <request name="capture_output"> - <description summary="capture an output"> - Capture the next frame of an entire output. - </description> - <arg name="frame" type="new_id" interface="zwlr_screencopy_frame_v1"/> - <arg name="overlay_cursor" type="int" - summary="composite cursor onto the frame"/> - <arg name="output" type="object" interface="wl_output"/> - </request> - - <request name="capture_output_region"> - <description summary="capture an output's region"> - Capture the next frame of an output's region. - - The region is given in output logical coordinates, see - xdg_output.logical_size. The region will be clipped to the output's - extents. - </description> - <arg name="frame" type="new_id" interface="zwlr_screencopy_frame_v1"/> - <arg name="overlay_cursor" type="int" - summary="composite cursor onto the frame"/> - <arg name="output" type="object" interface="wl_output"/> - <arg name="x" type="int"/> - <arg name="y" type="int"/> - <arg name="width" type="int"/> - <arg name="height" type="int"/> - </request> - - <request name="destroy" type="destructor"> - <description summary="destroy the manager"> - All objects created by the manager will still remain valid, until their - appropriate destroy request has been called. - </description> - </request> - </interface> - - <interface name="zwlr_screencopy_frame_v1" version="1"> - <description summary="a frame ready for copy"> - This object represents a single frame. - - When created, a "buffer" event will be sent. The client will then be able - to send a "copy" request. If the capture is successful, the compositor - will send a "flags" followed by a "ready" event. - - If the capture failed, the "failed" event is sent. This can happen anytime - before the "ready" event. - - Once either a "ready" or a "failed" event is received, the client should - destroy the frame. - </description> - - <event name="buffer"> - <description summary="buffer information"> - Provides information about the frame's buffer. This event is sent once - as soon as the frame is created. - - The client should then create a buffer with the provided attributes, and - send a "copy" request. - </description> - <arg name="format" type="uint" summary="buffer format"/> - <arg name="width" type="uint" summary="buffer width"/> - <arg name="height" type="uint" summary="buffer height"/> - <arg name="stride" type="uint" summary="buffer stride"/> - </event> - - <request name="copy"> - <description summary="copy the frame"> - Copy the frame to the supplied buffer. The buffer must have a the - correct size, see zwlr_screencopy_frame_v1.buffer. The buffer needs to - have a supported format. - - If the frame is successfully copied, a "flags" and a "ready" events are - sent. Otherwise, a "failed" event is sent. - </description> - <arg name="buffer" type="object" interface="wl_buffer"/> - </request> - - <enum name="error"> - <entry name="already_used" value="0" - summary="the object has already been used to copy a wl_buffer"/> - <entry name="invalid_buffer" value="1" - summary="buffer attributes are invalid"/> - </enum> - - <enum name="flags" bitfield="true"> - <entry name="y_invert" value="1" summary="contents are y-inverted"/> - </enum> - - <event name="flags"> - <description summary="frame flags"> - Provides flags about the frame. This event is sent once before the - "ready" event. - </description> - <arg name="flags" type="uint" enum="flags" summary="frame flags"/> - </event> - - <event name="ready"> - <description summary="indicates frame is available for reading"> - Called as soon as the frame is copied, indicating it is available - for reading. This event includes the time at which presentation happened - at. - - The timestamp is expressed as tv_sec_hi, tv_sec_lo, tv_nsec triples, - each component being an unsigned 32-bit value. Whole seconds are in - tv_sec which is a 64-bit value combined from tv_sec_hi and tv_sec_lo, - and the additional fractional part in tv_nsec as nanoseconds. Hence, - for valid timestamps tv_nsec must be in [0, 999999999]. The seconds part - may have an arbitrary offset at start. - - After receiving this event, the client should destroy the object. - </description> - <arg name="tv_sec_hi" type="uint" - summary="high 32 bits of the seconds part of the timestamp"/> - <arg name="tv_sec_lo" type="uint" - summary="low 32 bits of the seconds part of the timestamp"/> - <arg name="tv_nsec" type="uint" - summary="nanoseconds part of the timestamp"/> - </event> - - <event name="failed"> - <description summary="frame copy failed"> - This event indicates that the attempted frame copy has failed. - - After receiving this event, the client should destroy the object. - </description> - </event> - - <request name="destroy" type="destructor"> - <description summary="delete this object, used or not"> - Destroys the frame. This request can be sent at any time by the client. - </description> - </request> - </interface> -</protocol> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hyprpicker-0.4.7/src/helpers/Color.cpp new/hyprpicker-0.4.8/src/helpers/Color.cpp --- old/hyprpicker-0.4.7/src/helpers/Color.cpp 2026-05-05 01:34:34.000000000 +0200 +++ new/hyprpicker-0.4.8/src/helpers/Color.cpp 2026-11-01 19:08:15.000000000 +0100 @@ -1,5 +1,7 @@ #include "Color.hpp" #include <algorithm> +#include <cstdint> +#include <string_view> #include "../hyprpicker.hpp" static float fmax3(float a, float b, float c) { @@ -78,3 +80,166 @@ s = std::round(s * 100); l = std::round(l * 100); } + +std::string_view CColor::getStandardColorName() const { + struct SStandardColor { + uint8_t red; + uint8_t green; + uint8_t blue; + std::string_view colorName; + }; + + static constexpr std::array<SStandardColor, 141> standardColors = {{ + {0xF0, 0xF8, 0xFF, "Alice Blue"}, + {0xFA, 0xEB, 0xD7, "Antique White"}, + {0x00, 0xFF, 0xFF, "Aqua"}, + {0x7F, 0xFF, 0xD4, "Aquamarine"}, + {0xF0, 0xFF, 0xFF, "Azure"}, + {0xF5, 0xF5, 0xDC, "Beige"}, + {0xFF, 0xE4, 0xC4, "Bisque"}, + {0x00, 0x00, 0x00, "Black"}, + {0xFF, 0xEB, 0xCD, "Blanched Almond"}, + {0x00, 0x00, 0xFF, "Blue"}, + {0x8A, 0x2B, 0xE2, "Blue Violet"}, + {0xA5, 0x2A, 0x2A, "Brown"}, + {0xDE, 0xB8, 0x87, "Burlywood"}, + {0x5F, 0x9E, 0xA0, "Cadet Blue"}, + {0x7F, 0xFF, 0x00, "Chartreuse"}, + {0xD2, 0x69, 0x1E, "Chocolate"}, + {0xFF, 0x7F, 0x50, "Coral"}, + {0x64, 0x95, 0xED, "Cornflower Blue"}, + {0xFF, 0xF8, 0xDC, "Cornsilk"}, + {0xDC, 0x14, 0x3C, "Crimson"}, + {0x00, 0xFF, 0xFF, "Cyan"}, + {0x00, 0x00, 0x8B, "Dark Blue"}, + {0x00, 0x8B, 0x8B, "Dark Cyan"}, + {0xB8, 0x86, 0x0B, "Dark Goldenrod"}, + {0xA9, 0xA9, 0xA9, "Dark Gray"}, + {0x00, 0x64, 0x00, "Dark Green"}, + {0xBD, 0xB7, 0x6B, "Dark Khaki"}, + {0x8B, 0x00, 0x8B, "Dark Magenta"}, + {0x55, 0x6B, 0x2F, "Dark Olivegreen"}, + {0xFF, 0x8C, 0x00, "Dark Orange"}, + {0x99, 0x32, 0xCC, "Dark Orchid"}, + {0x8B, 0x00, 0x00, "Dark Red"}, + {0xE9, 0x96, 0x7A, "Dark Salmon"}, + {0x8F, 0xBC, 0x8F, "Dark Seagreen"}, + {0x48, 0x3D, 0x8B, "Dark Slateblue"}, + {0x2F, 0x4F, 0x4F, "Dark Slategray"}, + {0x00, 0xCE, 0xD1, "Dark Turquoise"}, + {0x94, 0x00, 0xD3, "Dark Violet"}, + {0xFF, 0x14, 0x93, "Deep Pink"}, + {0x00, 0xBF, 0xFF, "Deep Sky Blue"}, + {0x69, 0x69, 0x69, "Dim Gray"}, + {0x1E, 0x90, 0xFF, "Dodger Blue"}, + {0xB2, 0x22, 0x22, "Firebrick"}, + {0xFF, 0xFA, 0xF0, "Floral White"}, + {0x22, 0x8B, 0x22, "Forest Green"}, + {0xFF, 0x00, 0xFF, "Fuchsia"}, + {0xDC, 0xDC, 0xDC, "Gainsboro"}, + {0xF8, 0xF8, 0xFF, "Ghost White"}, + {0xFF, 0xD7, 0x00, "Gold"}, + {0xDA, 0xA5, 0x20, "Goldenrod"}, + {0x80, 0x80, 0x80, "Gray"}, + {0x00, 0x80, 0x00, "Green"}, + {0xAD, 0xFF, 0x2F, "Green Yellow"}, + {0xF0, 0xFF, 0xF0, "Honeydew"}, + {0xFF, 0x69, 0xB4, "Hot Pink"}, + {0xCD, 0x5C, 0x5C, "Indian Red"}, + {0x4B, 0x00, 0x82, "Indigo"}, + {0xFF, 0xFF, 0xF0, "Ivory"}, + {0xF0, 0xE6, 0x8C, "Khaki"}, + {0xE6, 0xE6, 0xFA, "Lavender"}, + {0xFF, 0xF0, 0xF5, "Lavender Blush"}, + {0x7C, 0xFC, 0x00, "Lawn Green"}, + {0xFF, 0xFA, 0xCD, "Lemonchiffon"}, + {0xAD, 0xD8, 0xE6, "Light Blue"}, + {0xF0, 0x80, 0x80, "Light Coral"}, + {0xE0, 0xFF, 0xFF, "Light Cyan"}, + {0xFA, 0xFA, 0xD2, "Light Goldenrod Yellow"}, + {0xD3, 0xD3, 0xD3, "Light Gray"}, + {0x90, 0xEE, 0x90, "Light Green"}, + {0xFF, 0xB6, 0xC1, "Light Pink"}, + {0xFF, 0xA0, 0x7A, "Light Salmon"}, + {0x20, 0xB2, 0xAA, "Light Sea Green"}, + {0x87, 0xCE, 0xFA, "Light Sky Blue"}, + {0x77, 0x88, 0x99, "Light Slate Gray"}, + {0xB0, 0xC4, 0xDE, "Light Steel Blue"}, + {0xFF, 0xFF, 0xE0, "Light Yellow"}, + {0x00, 0xFF, 0x00, "Lime"}, + {0x32, 0xCD, 0x32, "Lime Green"}, + {0xFA, 0xF0, 0xE6, "Linen"}, + {0xFF, 0x00, 0xFF, "Magenta"}, + {0x80, 0x00, 0x00, "Maroon"}, + {0x66, 0xCD, 0xAA, "Medium Aquamarine"}, + {0x00, 0x00, 0xCD, "Medium Blue"}, + {0xBA, 0x55, 0xD3, "Medium Orchid"}, + {0x93, 0x70, 0xDB, "Medium Purple"}, + {0x3C, 0xB3, 0x71, "Medium Sea Green"}, + {0x7B, 0x68, 0xEE, "Medium Slate Blue"}, + {0x00, 0xFA, 0x9A, "Medium Spring Green"}, + {0x48, 0xD1, 0xCC, "Medium Turquoise"}, + {0xC7, 0x15, 0x85, "Medium Violet Red"}, + {0x19, 0x19, 0x70, "Midnight Blue"}, + {0xF5, 0xFF, 0xFA, "Mintcream"}, + {0xFF, 0xE4, 0xE1, "Mistyrose"}, + {0xFF, 0xE4, 0xB5, "Moccasin"}, + {0xFF, 0xDE, 0xAD, "Navajo White"}, + {0x00, 0x00, 0x80, "Navy"}, + {0xFD, 0xF5, 0xE6, "Oldlace"}, + {0x80, 0x80, 0x00, "Olive"}, + {0x6B, 0x8E, 0x23, "Olive Drab"}, + {0xFF, 0xA5, 0x00, "Orange"}, + {0xFF, 0x45, 0x00, "Orange Red"}, + {0xDA, 0x70, 0xD6, "Orchid"}, + {0xEE, 0xE8, 0xAA, "Pale Goldenrod"}, + {0x98, 0xFB, 0x98, "Pale green"}, + {0xAF, 0xEE, 0xEE, "Pale Turquoise"}, + {0xDB, 0x70, 0x93, "Pale Violet Red"}, + {0xFF, 0xEF, 0xD5, "Papayawhip"}, + {0xFF, 0xDA, 0xB9, "Peachpuff"}, + {0xCD, 0x85, 0x3F, "Peru"}, + {0xFF, 0xC0, 0xCB, "Pink"}, + {0xDD, 0xA0, 0xDD, "Plum"}, + {0xB0, 0xE0, 0xE6, "Powder Blue"}, + {0x80, 0x00, 0x80, "Purple"}, + {0x66, 0x33, 0x99, "Rebecca Purple"}, + {0xFF, 0x00, 0x00, "Red"}, + {0xBC, 0x8F, 0x8F, "Rosy Brown"}, + {0x41, 0x69, 0xE1, "Royal Blue"}, + {0x8B, 0x45, 0x13, "Saddle Brown"}, + {0xFA, 0x80, 0x72, "Salmon"}, + {0xF4, 0xA4, 0x60, "Sandy Brown"}, + {0x2E, 0x8B, 0x57, "Sea Green"}, + {0xFF, 0xF5, 0xEE, "Seashell"}, + {0xA0, 0x52, 0x2D, "Sienna"}, + {0xC0, 0xC0, 0xC0, "Silver"}, + {0x87, 0xCE, 0xEB, "Sky Blue"}, + {0x6A, 0x5A, 0xCD, "Slate Blue"}, + {0x70, 0x80, 0x90, "Slate Gray"}, + {0xFF, 0xFA, 0xFA, "Snow"}, + {0x00, 0xFF, 0x7F, "Spring Green"}, + {0x46, 0x82, 0xB4, "Steel Blue"}, + {0xD2, 0xB4, 0x8C, "Tan"}, + {0x00, 0x80, 0x80, "Teal"}, + {0xD8, 0xBF, 0xD8, "Thistle"}, + {0xFF, 0x63, 0x47, "Tomato"}, + {0x40, 0xE0, 0xD0, "Turquoise"}, + {0xEE, 0x82, 0xEE, "Violet"}, + {0xF5, 0xDE, 0xB3, "Wheat"}, + {0xFF, 0xFF, 0xFF, "White"}, + {0xF5, 0xF5, 0xF5, "White Smoke"}, + {0xFF, 0xFF, 0x00, "Yellow"}, + {0x9A, 0xCD, 0x32, "Yellow Green"}, + }}; + + auto matchColor = [this](const SStandardColor& referenceColor) { return referenceColor.red == r && referenceColor.green == g && referenceColor.blue == b; }; + + auto iterator = std::ranges::find_if(standardColors, matchColor); + + if (iterator != standardColors.end()) { + return iterator->colorName; + } + + return ""; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hyprpicker-0.4.7/src/helpers/Color.hpp new/hyprpicker-0.4.8/src/helpers/Color.hpp --- old/hyprpicker-0.4.7/src/helpers/Color.hpp 2026-05-05 01:34:34.000000000 +0200 +++ new/hyprpicker-0.4.8/src/helpers/Color.hpp 2026-11-01 19:08:15.000000000 +0100 @@ -1,11 +1,14 @@ #pragma once #include "../defines.hpp" +#include <string_view> class CColor { public: - uint8_t r = 0, g = 0, b = 0, a = 0; - void getCMYK(float& c, float& m, float& y, float& k) const; - void getHSV(float& h, float& s, float& v) const; - void getHSL(float& h, float& s, float& l) const; + uint8_t r = 0, g = 0, b = 0, a = 0; + void getCMYK(float& c, float& m, float& y, float& k) const; + void getHSV(float& h, float& s, float& v) const; + void getHSL(float& h, float& s, float& l) const; + + std::string_view getStandardColorName() const; }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hyprpicker-0.4.7/src/helpers/LayerSurface.cpp new/hyprpicker-0.4.8/src/helpers/LayerSurface.cpp --- old/hyprpicker-0.4.7/src/helpers/LayerSurface.cpp 2026-05-05 01:34:34.000000000 +0200 +++ new/hyprpicker-0.4.8/src/helpers/LayerSurface.cpp 2026-11-01 19:08:15.000000000 +0100 @@ -14,7 +14,7 @@ if (!g_pHyprpicker->m_bNoFractional) { pViewport = makeShared<CCWpViewport>(g_pHyprpicker->m_pViewporter->sendGetViewport(pSurface->resource())); - // this will not actually be used, as we assume we'll be fullscreen and we can get the real dimensions from screencopy, but we'll have + // this will not actually be used, as we assume we'll be fullscreen and we can get the real dimensions from image copy capture, but we'll have // this for if we need it in the future pFractionalScale = makeShared<CCWpFractionalScaleV1>(g_pHyprpicker->m_pFractionalMgr->sendGetFractionalScale(pSurface->resource())); pFractionalScale->setPreferredScale([this](CCWpFractionalScaleV1* r, uint32_t scale120) { // @@ -47,7 +47,7 @@ pLayerSurface->sendSetAnchor((zwlrLayerSurfaceV1Anchor)(ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP | ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT | ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM | ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT)); pLayerSurface->sendSetExclusiveZone(-1); - pLayerSurface->sendSetKeyboardInteractivity(1); + pLayerSurface->sendSetKeyboardInteractivity(pLayerSurface->version() >= 4 ? 2 /* ON_DEMAND */ : 1 /* EXCLUSIVE */); pSurface->sendCommit(); wl_display_flush(g_pHyprpicker->m_pWLDisplay); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hyprpicker-0.4.7/src/helpers/LayerSurface.hpp new/hyprpicker-0.4.8/src/helpers/LayerSurface.hpp --- old/hyprpicker-0.4.7/src/helpers/LayerSurface.hpp 2026-05-05 01:34:34.000000000 +0200 +++ new/hyprpicker-0.4.8/src/helpers/LayerSurface.hpp 2026-11-01 19:08:15.000000000 +0100 @@ -30,12 +30,10 @@ SP<SPoolBuffer> buffers[2]; SP<SPoolBuffer> screenBuffer; - uint32_t scflags = 0; - uint32_t screenBufferFormat = 0; bool dirty = true; bool rendered = false; SP<CCWlCallback> frameCallback = nullptr; -}; \ No newline at end of file +}; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hyprpicker-0.4.7/src/helpers/Monitor.cpp new/hyprpicker-0.4.8/src/helpers/Monitor.cpp --- old/hyprpicker-0.4.7/src/helpers/Monitor.cpp 2026-05-05 01:34:34.000000000 +0200 +++ new/hyprpicker-0.4.8/src/helpers/Monitor.cpp 2026-11-01 19:08:15.000000000 +0100 @@ -1,12 +1,11 @@ #include "Monitor.hpp" #include "LayerSurface.hpp" #include "../hyprpicker.hpp" +#include <array> +#include <limits> +#include <optional> SMonitor::SMonitor(SP<CCWlOutput> output_) : output(output_) { - output->setGeometry([this](CCWlOutput* r, int32_t x, int32_t y, int32_t width_mm, int32_t height_mm, int32_t subpixel, const char* make, const char* model, - int32_t transform_) { // - transform = (wl_output_transform)transform_; - }); output->setDone([this](CCWlOutput* r) { // ready = true; }); @@ -19,103 +18,156 @@ }); } -void SMonitor::initSCFrame() { - pSCFrame->setBuffer([this](CCZwlrScreencopyFrameV1* r, uint32_t format, uint32_t width, uint32_t height, uint32_t stride) { - pLS->screenBufferFormat = format; - - if (!pLS->screenBuffer) - pLS->screenBuffer = makeShared<SPoolBuffer>(Vector2D{(double)width, (double)height}, format, stride); - - pSCFrame->sendCopy(pLS->screenBuffer->buffer->resource()); - }); - pSCFrame->setFlags([this](CCZwlrScreencopyFrameV1* r, uint32_t flags) { - pLS->scflags = flags; - - g_pHyprpicker->recheckACK(); - }); - pSCFrame->setReady([this](CCZwlrScreencopyFrameV1* r, uint32_t tv_sec_hi, uint32_t tv_sec_lo, uint32_t tv_nsec) { - Vector2D transformedSize = pLS->screenBuffer->pixelSize; - - if (pLS->m_pMonitor->transform % 2 == 1) - std::swap(transformedSize.x, transformedSize.y); +namespace { + struct SCaptureFormat { + uint32_t format; + uint32_t bytesPerPixel; + }; + + constexpr std::array<SCaptureFormat, 8> CAPTURE_FORMATS = {{{WL_SHM_FORMAT_XRGB8888, 4}, + {WL_SHM_FORMAT_ARGB8888, 4}, + {WL_SHM_FORMAT_XBGR8888, 4}, + {WL_SHM_FORMAT_ABGR8888, 4}, + {WL_SHM_FORMAT_XRGB2101010, 4}, + {WL_SHM_FORMAT_XBGR2101010, 4}, + {WL_SHM_FORMAT_BGR888, 3}, + {WL_SHM_FORMAT_RGB888, 3}}}; + + std::optional<SCaptureFormat> selectCaptureFormat(const std::vector<uint32_t>& advertisedFormats) { + for (const auto& candidate : CAPTURE_FORMATS) { + if (std::find(advertisedFormats.begin(), advertisedFormats.end(), candidate.format) != advertisedFormats.end()) + return candidate; + } - Debug::log(TRACE, "Frame ready: pixel %.0fx%.0f, xfmd: %.0fx%.0f", pLS->screenBuffer->pixelSize.x, pLS->screenBuffer->pixelSize.y, transformedSize.x, transformedSize.y); + return std::nullopt; + } +} - SP<SPoolBuffer> newBuf = makeShared<SPoolBuffer>(transformedSize, pLS->screenBufferFormat, transformedSize.x * 4); +void SMonitor::initCapture() { + pCaptureSource = makeShared<CCExtImageCaptureSourceV1>(g_pHyprpicker->m_pImageCaptureSourceMgr->sendCreateSource(output->resource())); - int bytesPerPixel = pLS->screenBuffer->stride / (int)pLS->screenBuffer->pixelSize.x; - void* data = pLS->screenBuffer->data; - if (bytesPerPixel == 4) - g_pHyprpicker->convertBuffer(pLS->screenBuffer); - else if (bytesPerPixel == 3) { - Debug::log(WARN, "24 bit formats are unsupported, hyprpicker may or may not work as intended!"); - data = g_pHyprpicker->convert24To32Buffer(pLS->screenBuffer); - pLS->screenBuffer->paddedData = data; - } else { - Debug::log(CRIT, "Unsupported stride/bytes per pixel %i", bytesPerPixel); + auto OPTIONS = static_cast<extImageCopyCaptureManagerV1Options>(0); + if (g_pHyprpicker->m_bIncludeCursor) + OPTIONS = EXT_IMAGE_COPY_CAPTURE_MANAGER_V1_OPTIONS_PAINT_CURSORS; + pCaptureSession = makeShared<CCExtImageCopyCaptureSessionV1>(g_pHyprpicker->m_pImageCopyCaptureMgr->sendCreateSession(pCaptureSource->resource(), OPTIONS)); + + pCaptureSession->setBufferSize([this](CCExtImageCopyCaptureSessionV1* r, uint32_t width, uint32_t height) { + pendingConstraints.width = width; + pendingConstraints.height = height; + pendingConstraints.hasSize = true; + }); + pCaptureSession->setShmFormat([this](CCExtImageCopyCaptureSessionV1* r, uint32_t format) { pendingConstraints.shmFormats.emplace_back(format); }); + pCaptureSession->setDone([this](CCExtImageCopyCaptureSessionV1* r) { + if (!pendingConstraints.hasSize || pendingConstraints.width == 0 || pendingConstraints.height == 0) { + Debug::log(CRIT, "Image copy capture provided invalid buffer constraints for output %s", name.c_str()); g_pHyprpicker->finish(1); } - cairo_surface_t* oldSurface = cairo_image_surface_create_for_data((unsigned char*)data, CAIRO_FORMAT_ARGB32, pLS->screenBuffer->pixelSize.x, pLS->screenBuffer->pixelSize.y, - pLS->screenBuffer->pixelSize.x * 4); - - cairo_surface_flush(oldSurface); - - newBuf->surface = cairo_image_surface_create_for_data((unsigned char*)newBuf->data, CAIRO_FORMAT_ARGB32, transformedSize.x, transformedSize.y, transformedSize.x * 4); - - const auto PCAIRO = cairo_create(newBuf->surface); + constraints = std::move(pendingConstraints); + pendingConstraints = {}; + ++constraintsGeneration; - auto cairoTransformMtx = [&](cairo_matrix_t* mtx) -> void { - const auto TR = pLS->m_pMonitor->transform % 4; - - if (TR == 0) - return; - - cairo_matrix_rotate(mtx, -M_PI_2 * (double)TR); - - if (TR == 1) - cairo_matrix_translate(mtx, -transformedSize.x, 0); - else if (TR == 2) - cairo_matrix_translate(mtx, -transformedSize.x, -transformedSize.y); - else if (TR == 3) - cairo_matrix_translate(mtx, 0, -transformedSize.y); + if (!selectCaptureFormat(constraints.shmFormats)) { + Debug::log(CRIT, "Image copy capture did not provide a supported SHM format for output %s", name.c_str()); + g_pHyprpicker->finish(1); + } - // TODO: flipped - }; + if (!pCaptureFrame) + capture(); + }); + pCaptureSession->setStopped([this](CCExtImageCopyCaptureSessionV1* r) { + Debug::log(CRIT, "Image copy capture session stopped for output %s", name.c_str()); + g_pHyprpicker->finish(1); + }); +} - cairo_save(PCAIRO); +void SMonitor::capture() { + const auto FORMAT = selectCaptureFormat(constraints.shmFormats); + if (!FORMAT) { + Debug::log(CRIT, "Image copy capture has no usable SHM format for output %s", name.c_str()); + g_pHyprpicker->finish(1); + } - cairo_set_source_rgba(PCAIRO, 0, 0, 0, 0); + constexpr uint64_t MAX_WAYLAND_SIZE = std::numeric_limits<int32_t>::max(); + const uint64_t stride = static_cast<uint64_t>(constraints.width) * FORMAT->bytesPerPixel; + const uint64_t normalizedStride = static_cast<uint64_t>(constraints.width) * 4; + if (constraints.width > MAX_WAYLAND_SIZE || constraints.height > MAX_WAYLAND_SIZE || stride > MAX_WAYLAND_SIZE || normalizedStride > MAX_WAYLAND_SIZE || + stride * constraints.height > MAX_WAYLAND_SIZE) { + Debug::log(CRIT, "Image copy capture provided an oversized buffer for output %s", name.c_str()); + g_pHyprpicker->finish(1); + } - cairo_rectangle(PCAIRO, 0, 0, 0xFFFF, 0xFFFF); - cairo_fill(PCAIRO); + captureBytesPerPixel = FORMAT->bytesPerPixel; + frameConstraintsGeneration = constraintsGeneration; + pLS->screenBuffer = + makeShared<SPoolBuffer>(Vector2D{static_cast<double>(constraints.width), static_cast<double>(constraints.height)}, FORMAT->format, static_cast<uint32_t>(stride)); + pCaptureFrame = makeShared<CCExtImageCopyCaptureFrameV1>(pCaptureSession->sendCreateFrame()); + + pCaptureFrame->setReady([this](CCExtImageCopyCaptureFrameV1* r) { captureReady(); }); + pCaptureFrame->setFailed([this](CCExtImageCopyCaptureFrameV1* r, extImageCopyCaptureFrameV1FailureReason reason) { captureFailed(reason); }); + + pCaptureFrame->sendAttachBuffer(pLS->screenBuffer->buffer->resource()); + pCaptureFrame->sendDamageBuffer(0, 0, static_cast<int32_t>(constraints.width), static_cast<int32_t>(constraints.height)); + pCaptureFrame->sendCapture(); +} - const auto PATTERNPRE = cairo_pattern_create_for_surface(oldSurface); - cairo_pattern_set_filter(PATTERNPRE, CAIRO_FILTER_BILINEAR); - cairo_matrix_t matrixPre; - cairo_matrix_init_identity(&matrixPre); - cairo_matrix_scale(&matrixPre, 1.0, 1.0); - cairoTransformMtx(&matrixPre); - cairo_pattern_set_matrix(PATTERNPRE, &matrixPre); - cairo_set_source(PCAIRO, PATTERNPRE); - cairo_paint(PCAIRO); +void SMonitor::captureReady() { + if (!pLS->screenBuffer) { + Debug::log(CRIT, "Image copy capture returned without a buffer for output %s", name.c_str()); + g_pHyprpicker->finish(1); + } - cairo_surface_flush(newBuf->surface); + void* data = pLS->screenBuffer->data; + if (captureBytesPerPixel == 4) + g_pHyprpicker->convertBuffer(pLS->screenBuffer); + else if (captureBytesPerPixel == 3) { + data = g_pHyprpicker->convert24To32Buffer(pLS->screenBuffer); + pLS->screenBuffer->paddedData = data; + } else { + Debug::log(CRIT, "Unsupported image copy capture pixel size %u", captureBytesPerPixel); + g_pHyprpicker->finish(1); + } - cairo_pattern_destroy(PATTERNPRE); + const auto CAIROSTRIDE = static_cast<int32_t>(pLS->screenBuffer->pixelSize.x) * 4; + pLS->screenBuffer->surface = + cairo_image_surface_create_for_data(static_cast<unsigned char*>(data), CAIRO_FORMAT_ARGB32, pLS->screenBuffer->pixelSize.x, pLS->screenBuffer->pixelSize.y, CAIROSTRIDE); + if (cairo_surface_status(pLS->screenBuffer->surface) != CAIRO_STATUS_SUCCESS) { + Debug::log(CRIT, "Failed to create a Cairo surface for captured output %s", name.c_str()); + g_pHyprpicker->finish(1); + } - cairo_destroy(PCAIRO); + Debug::log(TRACE, "Image copy frame ready: pixel %.0fx%.0f", pLS->screenBuffer->pixelSize.x, pLS->screenBuffer->pixelSize.y); - cairo_surface_destroy(oldSurface); + g_pHyprpicker->recheckACK(); + g_pHyprpicker->renderSurface(pLS); - pLS->screenBuffer = newBuf; + pCaptureFrame.reset(); + pCaptureSession.reset(); + pCaptureSource.reset(); +} - g_pHyprpicker->renderSurface(pLS); +void SMonitor::captureFailed(extImageCopyCaptureFrameV1FailureReason reason) { + pCaptureFrame.reset(); + pLS->screenBuffer.reset(); + + if (reason == EXT_IMAGE_COPY_CAPTURE_FRAME_V1_FAILURE_REASON_BUFFER_CONSTRAINTS) { + if (constraintsGeneration > frameConstraintsGeneration) + capture(); + else + Debug::log(WARN, "Image copy capture constraints changed for output %s, waiting for a new constraint batch", name.c_str()); + return; + } + + if (reason == EXT_IMAGE_COPY_CAPTURE_FRAME_V1_FAILURE_REASON_UNKNOWN && unknownFailureCount++ == 0) { + Debug::log(WARN, "Image copy capture failed for output %s, retrying", name.c_str()); + capture(); + return; + } + + if (reason == EXT_IMAGE_COPY_CAPTURE_FRAME_V1_FAILURE_REASON_STOPPED) + Debug::log(CRIT, "Image copy capture session stopped for output %s", name.c_str()); + else + Debug::log(CRIT, "Image copy capture failed for output %s", name.c_str()); - pSCFrame.reset(); - }); - pSCFrame->setFailed([](CCZwlrScreencopyFrameV1* r) { - Debug::log(CRIT, "Failed to get a Screencopy!"); - g_pHyprpicker->finish(1); - }); + g_pHyprpicker->finish(1); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hyprpicker-0.4.7/src/helpers/Monitor.hpp new/hyprpicker-0.4.8/src/helpers/Monitor.hpp --- old/hyprpicker-0.4.7/src/helpers/Monitor.hpp 2026-05-05 01:34:34.000000000 +0200 +++ new/hyprpicker-0.4.8/src/helpers/Monitor.hpp 2026-11-01 19:08:15.000000000 +0100 @@ -8,17 +8,37 @@ struct SMonitor { SMonitor(SP<CCWlOutput> output_); - void initSCFrame(); + void initCapture(); - std::string name = ""; - SP<CCWlOutput> output = nullptr; - uint32_t wayland_name = 0; - Vector2D size; - int32_t scale; - wl_output_transform transform = WL_OUTPUT_TRANSFORM_NORMAL; + std::string name = ""; + SP<CCWlOutput> output = nullptr; + uint32_t wayland_name = 0; + Vector2D size; + int32_t scale = 1; - bool ready = false; + bool ready = false; - CLayerSurface* pLS = nullptr; - SP<CCZwlrScreencopyFrameV1> pSCFrame = nullptr; + CLayerSurface* pLS = nullptr; + SP<CCExtImageCaptureSourceV1> pCaptureSource; + SP<CCExtImageCopyCaptureSessionV1> pCaptureSession; + SP<CCExtImageCopyCaptureFrameV1> pCaptureFrame; + + private: + struct SCaptureConstraints { + uint32_t width = 0; + uint32_t height = 0; + bool hasSize = false; + std::vector<uint32_t> shmFormats; + }; + + void capture(); + void captureReady(); + void captureFailed(extImageCopyCaptureFrameV1FailureReason reason); + + SCaptureConstraints pendingConstraints; + SCaptureConstraints constraints; + uint64_t constraintsGeneration = 0; + uint64_t frameConstraintsGeneration = 0; + uint32_t captureBytesPerPixel = 0; + uint32_t unknownFailureCount = 0; }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hyprpicker-0.4.7/src/hyprpicker.cpp new/hyprpicker-0.4.8/src/hyprpicker.cpp --- old/hyprpicker-0.4.7/src/hyprpicker.cpp 2026-05-05 01:34:34.000000000 +0200 +++ new/hyprpicker-0.4.8/src/hyprpicker.cpp 2026-11-01 19:08:15.000000000 +0100 @@ -1,6 +1,7 @@ #include "hyprpicker.hpp" #include "src/debug/Log.hpp" #include "src/notify/Notify.hpp" +#include <algorithm> #include <cmath> #include <csignal> #include <cstddef> @@ -74,9 +75,12 @@ m_pKeyboard.reset(); }); - } else if (strcmp(interface, zwlr_screencopy_manager_v1_interface.name) == 0) { - m_pScreencopyMgr = - makeShared<CCZwlrScreencopyManagerV1>((wl_proxy*)wl_registry_bind((wl_registry*)m_pRegistry->resource(), name, &zwlr_screencopy_manager_v1_interface, 1)); + } else if (strcmp(interface, ext_output_image_capture_source_manager_v1_interface.name) == 0) { + m_pImageCaptureSourceMgr = makeShared<CCExtOutputImageCaptureSourceManagerV1>( + (wl_proxy*)wl_registry_bind((wl_registry*)m_pRegistry->resource(), name, &ext_output_image_capture_source_manager_v1_interface, 1)); + } else if (strcmp(interface, ext_image_copy_capture_manager_v1_interface.name) == 0) { + m_pImageCopyCaptureMgr = makeShared<CCExtImageCopyCaptureManagerV1>( + (wl_proxy*)wl_registry_bind((wl_registry*)m_pRegistry->resource(), name, &ext_image_copy_capture_manager_v1_interface, 1)); } else if (strcmp(interface, wp_cursor_shape_manager_v1_interface.name) == 0) { m_pCursorShapeMgr = makeShared<CCWpCursorShapeManagerV1>((wl_proxy*)wl_registry_bind((wl_registry*)m_pRegistry->resource(), name, &wp_cursor_shape_manager_v1_interface, 1)); @@ -93,8 +97,8 @@ if (!m_pCursorShapeMgr) Debug::log(ERR, "cursor_shape_v1 not supported, cursor won't be affected"); - if (!m_pScreencopyMgr) { - Debug::log(CRIT, "zwlr_screencopy_v1 not supported, can't proceed"); + if (!m_pImageCaptureSourceMgr || !m_pImageCopyCaptureMgr) { + Debug::log(CRIT, "ext-image-copy-capture-v1 output capture is not supported, can't proceed"); exit(1); } @@ -112,9 +116,8 @@ m_pLastSurface = m_vLayerSurfaces.back().get(); - m->pSCFrame = makeShared<CCZwlrScreencopyFrameV1>(m_pScreencopyMgr->sendCaptureOutput(m_bIncludeCursor, m->output->resource())); - m->pLS = m_vLayerSurfaces.back().get(); - m->initSCFrame(); + m->pLS = m_vLayerSurfaces.back().get(); + m->initCapture(); } wl_display_roundtrip(m_pWLDisplay); @@ -135,7 +138,8 @@ m_pRegistry.reset(); m_pSHM.reset(); m_pLayerShell.reset(); - m_pScreencopyMgr.reset(); + m_pImageCopyCaptureMgr.reset(); + m_pImageCaptureSourceMgr.reset(); m_pCursorShapeMgr.reset(); m_pCursorShapeDevice.reset(); m_pSeat.reset(); @@ -169,25 +173,13 @@ std::string hexColor = std::format("#{0:02x}{1:02x}{2:02x}", COL.r, COL.g, COL.b); + std::string formattedColor; + switch (m_bSelectedOutputMode) { case OUTPUT_CMYK: { float c, m, y, k; COL.getCMYK(c, m, y, k); - - std::string formattedColor = std::vformat(m_sOutputFormat, std::make_format_args(c, m, y, k)); - - if (m_bFancyOutput) - Debug::log(NONE, "\033[38;2;%i;%i;%i;48;2;%i;%i;%im%s\033[0m", FG, FG, FG, COL.r, COL.g, COL.b, formattedColor.c_str()); - else - Debug::log(NONE, formattedColor.c_str()); - - if (m_bAutoCopy) - NClipboard::copy(formattedColor); - - if (m_bNotify) - NNotify::send(hexColor, formattedColor); - - finish(); + formattedColor = std::vformat(m_sOutputFormat, std::make_format_args(c, m, y, k)); break; } case OUTPUT_HEX: { @@ -201,36 +193,11 @@ gHex = std::format("{:02X}", COL.g); bHex = std::format("{:02X}", COL.b); } - std::string formattedColor = std::vformat(m_sOutputFormat, std::make_format_args(rHex, gHex, bHex)); - if (m_bFancyOutput) - Debug::log(NONE, "\033[38;2;%i;%i;%i;48;2;%i;%i;%im%s\033[0m", FG, FG, FG, COL.r, COL.g, COL.b, formattedColor.c_str()); - else - Debug::log(NONE, formattedColor.c_str()); - - if (m_bAutoCopy) - NClipboard::copy(hexColor); - - if (m_bNotify) - NNotify::send(hexColor, hexColor); - - finish(); + formattedColor = std::vformat(m_sOutputFormat, std::make_format_args(rHex, gHex, bHex)); break; } case OUTPUT_RGB: { - std::string formattedColor = std::vformat(m_sOutputFormat, std::make_format_args(COL.r, COL.g, COL.b)); - - if (m_bFancyOutput) - Debug::log(NONE, "\033[38;2;%i;%i;%i;48;2;%i;%i;%im%s\033[0m", FG, FG, FG, COL.r, COL.g, COL.b, formattedColor.c_str()); - else - Debug::log(NONE, formattedColor.c_str()); - - if (m_bAutoCopy) - NClipboard::copy(formattedColor); - - if (m_bNotify) - NNotify::send(hexColor, formattedColor); - - finish(); + formattedColor = std::vformat(m_sOutputFormat, std::make_format_args(COL.r, COL.g, COL.b)); break; } case OUTPUT_HSL: @@ -241,23 +208,30 @@ else COL.getHSL(h, s, l_or_v); - std::string formattedColor = std::vformat(m_sOutputFormat, std::make_format_args(h, s, l_or_v)); - if (m_bFancyOutput) - Debug::log(NONE, "\033[38;2;%i;%i;%i;48;2;%i;%i;%im%s\033[0m", FG, FG, FG, COL.r, COL.g, COL.b, formattedColor.c_str()); - else - Debug::log(NONE, formattedColor.c_str()); - - if (m_bAutoCopy) - NClipboard::copy(formattedColor); + formattedColor = std::vformat(m_sOutputFormat, std::make_format_args(h, s, l_or_v)); + break; + } + } - if (m_bNotify) - NNotify::send(hexColor, formattedColor); + std::string_view matchedStandardName = COL.getStandardColorName(); + bool shouldCopyName = m_bCopyStandardColorName && !matchedStandardName.empty(); - finish(); - break; + if (m_bFancyOutput) + Debug::log(NONE, "\033[38;2;%i;%i;%i;48;2;%i;%i;%im%s\033[0m", FG, FG, FG, COL.r, COL.g, COL.b, formattedColor.c_str()); + else + Debug::log(NONE, formattedColor.c_str()); + + if (m_bAutoCopy) { + if (shouldCopyName) { + NClipboard::copy(std::string(matchedStandardName)); + } else { + NClipboard::copy(formattedColor); } } + if (m_bNotify) + NNotify::send(hexColor, formattedColor); + finish(); } @@ -350,8 +324,15 @@ void CHyprpicker::convertBuffer(SP<SPoolBuffer> pBuffer) { switch (pBuffer->format) { - case WL_SHM_FORMAT_ARGB8888: - case WL_SHM_FORMAT_XRGB8888: break; + case WL_SHM_FORMAT_ARGB8888: break; + case WL_SHM_FORMAT_XRGB8888: { + uint8_t* data = (uint8_t*)pBuffer->data; + + for (int y = 0; y < pBuffer->pixelSize.y; ++y) { + for (int x = 0; x < pBuffer->pixelSize.x; ++x) + data[static_cast<size_t>(y) * pBuffer->stride + static_cast<size_t>(x) * 4 + 3] = 0xFF; + } + } break; case WL_SHM_FORMAT_ABGR8888: case WL_SHM_FORMAT_XBGR8888: { uint8_t* data = (uint8_t*)pBuffer->data; @@ -364,9 +345,11 @@ unsigned char green; unsigned char red; unsigned char alpha; - }* px = (struct SPixel*)(data + (static_cast<ptrdiff_t>(y * (int)pBuffer->pixelSize.x * 4)) + (static_cast<ptrdiff_t>(x * 4))); + }* px = (struct SPixel*)(data + static_cast<size_t>(y) * pBuffer->stride + static_cast<size_t>(x) * 4); std::swap(px->red, px->blue); + if (pBuffer->format == WL_SHM_FORMAT_XBGR8888) + px->alpha = 0xFF; } } } break; @@ -378,16 +361,15 @@ for (int y = 0; y < pBuffer->pixelSize.y; ++y) { for (int x = 0; x < pBuffer->pixelSize.x; ++x) { - uint32_t* px = (uint32_t*)(data + (static_cast<ptrdiff_t>(y * (int)pBuffer->pixelSize.x * 4)) + (static_cast<ptrdiff_t>(x * 4))); + uint32_t* px = (uint32_t*)(data + static_cast<size_t>(y) * pBuffer->stride + static_cast<size_t>(x) * 4); // conv to 8 bit uint8_t R = (uint8_t)std::round((255.0 * (((*px) & 0b00000000000000000000001111111111) >> 0) / 1023.0)); uint8_t G = (uint8_t)std::round((255.0 * (((*px) & 0b00000000000011111111110000000000) >> 10) / 1023.0)); uint8_t B = (uint8_t)std::round((255.0 * (((*px) & 0b00111111111100000000000000000000) >> 20) / 1023.0)); - uint8_t A = (uint8_t)std::round((255.0 * (((*px) & 0b11000000000000000000000000000000) >> 30) / 3.0)); // write 8-bit values - *px = ((FLIP ? B : R) << 0) + (G << 8) + ((FLIP ? R : B) << 16) + (A << 24); + *px = ((FLIP ? B : R) << 0) + (G << 8) + ((FLIP ? R : B) << 16) + (0xFFU << 24); } } } break; @@ -400,9 +382,16 @@ // Mallocs a new buffer, which needs to be free'd! void* CHyprpicker::convert24To32Buffer(SP<SPoolBuffer> pBuffer) { - uint8_t* newBuffer = (uint8_t*)malloc((size_t)pBuffer->pixelSize.x * pBuffer->pixelSize.y * 4); - int newBufferStride = pBuffer->pixelSize.x * 4; - uint8_t* oldBuffer = (uint8_t*)pBuffer->data; + const size_t WIDTH = static_cast<size_t>(pBuffer->pixelSize.x); + const size_t HEIGHT = static_cast<size_t>(pBuffer->pixelSize.y); + const size_t NEWBUFFERSTRIDE = WIDTH * 4; + uint8_t* newBuffer = (uint8_t*)malloc(NEWBUFFERSTRIDE * HEIGHT); + uint8_t* oldBuffer = (uint8_t*)pBuffer->data; + + if (!newBuffer) { + Debug::log(CRIT, "Failed to allocate a 32-bit capture buffer"); + g_pHyprpicker->finish(1); + } switch (pBuffer->format) { case WL_SHM_FORMAT_BGR888: { @@ -420,7 +409,7 @@ unsigned char green; unsigned char red; unsigned char alpha; - }* dstPx = (struct SPixel4*)(newBuffer + (static_cast<ptrdiff_t>(y * newBufferStride)) + (static_cast<ptrdiff_t>(x * 4))); + }* dstPx = (struct SPixel4*)(newBuffer + static_cast<size_t>(y) * NEWBUFFERSTRIDE + static_cast<size_t>(x) * 4); *dstPx = {.blue = srcPx->red, .green = srcPx->green, .red = srcPx->blue, .alpha = 0xFF}; } } @@ -429,19 +418,19 @@ for (int y = 0; y < pBuffer->pixelSize.y; ++y) { for (int x = 0; x < pBuffer->pixelSize.x; ++x) { struct SPixel3 { - // big-endian RGB - unsigned char red; - unsigned char green; + // little-endian RGB unsigned char blue; + unsigned char green; + unsigned char red; }* srcPx = (struct SPixel3*)(oldBuffer + (y * pBuffer->stride) + (x * 3)); struct SPixel4 { - // big-endian ARGB - unsigned char alpha; - unsigned char red; - unsigned char green; + // little-endian ARGB unsigned char blue; - }* dstPx = (struct SPixel4*)(newBuffer + (y * newBufferStride) + (x * 4)); - *dstPx = {.alpha = 0xFF, .red = srcPx->red, .green = srcPx->green, .blue = srcPx->blue}; + unsigned char green; + unsigned char red; + unsigned char alpha; + }* dstPx = (struct SPixel4*)(newBuffer + static_cast<size_t>(y) * NEWBUFFERSTRIDE + static_cast<size_t>(x) * 4); + *dstPx = {.blue = srcPx->blue, .green = srcPx->green, .red = srcPx->red, .alpha = 0xFF}; } } } break; @@ -584,49 +573,65 @@ }; }; cairo_set_source_rgba(PCAIRO, 0.0, 0.0, 0.0, 0.75); + cairo_select_font_face(PCAIRO, "monospace", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL); + cairo_set_font_size(PCAIRO, 18); + cairo_text_extents_t extents; + cairo_text_extents(PCAIRO, "X", &extents); + + std::string_view standardColorName = currentColor.getStandardColorName(); + bool hasStandardName = !standardColorName.empty(); - double x, y, width = 8 + (11 * previewBuffer.length()), height = 28, radius = 6; + double horizontalTextPadding = 5.0; + double characterWidth = extents.x_advance; + double previewBufferWidth = (2 * horizontalTextPadding) + (characterWidth * previewBuffer.length()); + double standardNameWidth = hasStandardName ? (2 * horizontalTextPadding) + (characterWidth * standardColorName.length()) : 0.0; + + double boxWidth = std::max(previewBufferWidth, standardNameWidth); + double boxHeight = hasStandardName ? 50.0 : 28.0; + double cornerRadius = 6.0; + + double boxPositionX = 0.0; + double boxPositionY = 0.0; + double upwardShift = hasStandardName ? 62.0 : 40.0; if (CLICKPOS.y > (PBUFFER->pixelSize.y - 50) && CLICKPOS.x > (PBUFFER->pixelSize.x - 100)) { - x = CLICKPOS.x - 80; - y = CLICKPOS.y - 40; + boxPositionX = CLICKPOS.x - 80; + boxPositionY = CLICKPOS.y - upwardShift; } else if (CLICKPOS.y > (PBUFFER->pixelSize.y - 50)) { - x = CLICKPOS.x; - y = CLICKPOS.y - 40; + boxPositionX = CLICKPOS.x; + boxPositionY = CLICKPOS.y - upwardShift; } else if (CLICKPOS.x > (PBUFFER->pixelSize.x - 100)) { - x = CLICKPOS.x - 80; - y = CLICKPOS.y + 20; + boxPositionX = CLICKPOS.x - 80; + boxPositionY = CLICKPOS.y + 20; } else { - x = CLICKPOS.x; - y = CLICKPOS.y + 20; + boxPositionX = CLICKPOS.x; + boxPositionY = CLICKPOS.y + 20; } - x -= 5.5 * previewBuffer.length(); - cairo_move_to(PCAIRO, x + radius, y); - cairo_arc(PCAIRO, x + width - radius, y + radius, radius, -M_PI_2, 0); - cairo_arc(PCAIRO, x + width - radius, y + height - radius, radius, 0, M_PI_2); - cairo_arc(PCAIRO, x + radius, y + height - radius, radius, M_PI_2, M_PI); - cairo_arc(PCAIRO, x + radius, y + radius, radius, M_PI, -M_PI_2); + + size_t longestTextLength = hasStandardName ? std::max(previewBuffer.length(), standardColorName.length()) : previewBuffer.length(); + boxPositionX -= 0.5 * characterWidth * longestTextLength; + + cairo_arc(PCAIRO, boxPositionX + boxWidth - cornerRadius, boxPositionY + cornerRadius, cornerRadius, -M_PI_2, 0); + cairo_arc(PCAIRO, boxPositionX + boxWidth - cornerRadius, boxPositionY + boxHeight - cornerRadius, cornerRadius, 0, M_PI_2); + cairo_arc(PCAIRO, boxPositionX + cornerRadius, boxPositionY + boxHeight - cornerRadius, cornerRadius, M_PI_2, M_PI); + cairo_arc(PCAIRO, boxPositionX + cornerRadius, boxPositionY + cornerRadius, cornerRadius, M_PI, -M_PI_2); cairo_close_path(PCAIRO); cairo_fill(PCAIRO); cairo_set_source_rgba(PCAIRO, 1.0, 1.0, 1.0, 1.0); - cairo_select_font_face(PCAIRO, "monospace", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL); - cairo_set_font_size(PCAIRO, 18); - double padding = 5.0; - double textX = x + padding; + double textDrawPositionX = boxPositionX + horizontalTextPadding; - if (CLICKPOS.y > (PBUFFER->pixelSize.y - 50) && CLICKPOS.x > (PBUFFER->pixelSize.x - 100)) - cairo_move_to(PCAIRO, textX, CLICKPOS.y - 20); - else if (CLICKPOS.y > (PBUFFER->pixelSize.y - 50)) - cairo_move_to(PCAIRO, textX, CLICKPOS.y - 20); - else if (CLICKPOS.x > (PBUFFER->pixelSize.x - 100)) - cairo_move_to(PCAIRO, textX, CLICKPOS.y + 40); - else - cairo_move_to(PCAIRO, textX, CLICKPOS.y + 40); - - cairo_show_text(PCAIRO, previewBuffer.c_str()); + if (hasStandardName) { + cairo_move_to(PCAIRO, textDrawPositionX, boxPositionY + 20); + cairo_show_text(PCAIRO, previewBuffer.c_str()); + cairo_move_to(PCAIRO, textDrawPositionX, boxPositionY + 42); + cairo_show_text(PCAIRO, standardColorName.data()); + } else { + cairo_move_to(PCAIRO, textDrawPositionX, boxPositionY + 20); + cairo_show_text(PCAIRO, previewBuffer.c_str()); + } cairo_surface_flush(PBUFFER->surface); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hyprpicker-0.4.7/src/hyprpicker.hpp new/hyprpicker-0.4.8/src/hyprpicker.hpp --- old/hyprpicker-0.4.7/src/hyprpicker.hpp 2026-05-05 01:34:34.000000000 +0200 +++ new/hyprpicker-0.4.8/src/hyprpicker.hpp 2026-11-01 19:08:15.000000000 +0100 @@ -26,7 +26,8 @@ SP<CCWlRegistry> m_pRegistry; SP<CCWlShm> m_pSHM; SP<CCZwlrLayerShellV1> m_pLayerShell; - SP<CCZwlrScreencopyManagerV1> m_pScreencopyMgr; + SP<CCExtOutputImageCaptureSourceManagerV1> m_pImageCaptureSourceMgr; + SP<CCExtImageCopyCaptureManagerV1> m_pImageCopyCaptureMgr; SP<CCWpCursorShapeManagerV1> m_pCursorShapeMgr; SP<CCWpCursorShapeDeviceV1> m_pCursorShapeDevice; SP<CCWlSeat> m_pSeat; @@ -45,14 +46,15 @@ bool m_bFancyOutput = true; - bool m_bAutoCopy = false; - bool m_bNotify = false; - bool m_bRenderInactive = false; - bool m_bNoZoom = false; - bool m_bNoFractional = false; - bool m_bDisablePreview = false; - bool m_bUseLowerCase = false; - bool m_bIncludeCursor = false; + bool m_bAutoCopy = false; + bool m_bNotify = false; + bool m_bRenderInactive = false; + bool m_bNoZoom = false; + bool m_bNoFractional = false; + bool m_bDisablePreview = false; + bool m_bUseLowerCase = false; + bool m_bIncludeCursor = false; + bool m_bCopyStandardColorName = false; volatile std::atomic<bool> m_bRunning = true; float m_fZoomScale = 10.0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hyprpicker-0.4.7/src/includes.hpp new/hyprpicker-0.4.8/src/includes.hpp --- old/hyprpicker-0.4.7/src/includes.hpp 2026-05-05 01:34:34.000000000 +0200 +++ new/hyprpicker-0.4.8/src/includes.hpp 2026-11-01 19:08:15.000000000 +0100 @@ -11,9 +11,10 @@ #include <cmath> #include "protocols/cursor-shape-v1.hpp" +#include "protocols/ext-image-capture-source-v1.hpp" +#include "protocols/ext-image-copy-capture-v1.hpp" #include "protocols/fractional-scale-v1.hpp" #include "protocols/wlr-layer-shell-unstable-v1.hpp" -#include "protocols/wlr-screencopy-unstable-v1.hpp" #include "protocols/viewporter.hpp" #include "protocols/wayland.hpp" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hyprpicker-0.4.7/src/main.cpp new/hyprpicker-0.4.8/src/main.cpp --- old/hyprpicker-0.4.7/src/main.cpp 2026-05-05 01:34:34.000000000 +0200 +++ new/hyprpicker-0.4.8/src/main.cpp 2026-11-01 19:08:15.000000000 +0100 @@ -27,6 +27,7 @@ << " -l | --lowercase-hex | Outputs the hexcode in lowercase\n" << " -s | --scale=scale | Set the zoom scale (between 1 and 10)\n" << " -u | --radius=radius | Set the circle radius (between 1 and 1000)\n" + << " -N | --name | Copies the standard color name instead of the format if matched (requires -a)\n" << " -V | --version | Print version info\n"; } @@ -52,9 +53,10 @@ {"version", no_argument, nullptr, 'V'}, {"scale", required_argument, nullptr, 's'}, {"radius", required_argument, nullptr, 'u'}, + {"name", no_argument, nullptr, 'N'}, {nullptr, 0, nullptr, 0}}; - int c = getopt_long(argc, argv, ":f:o:hnbarzqvtdlcVs:u:", long_options, &option_index); + int c = getopt_long(argc, argv, ":f:o:hnbarzqvtdlcVs:u:N", long_options, &option_index); if (c == -1) break; @@ -76,6 +78,7 @@ } break; case 'o': g_pHyprpicker->m_sOutputFormat = optarg; break; + case 'N': g_pHyprpicker->m_bCopyStandardColorName = true; break; case 'h': help(); exit(0); case 'b': g_pHyprpicker->m_bFancyOutput = false; break; case 'n': g_pHyprpicker->m_bNotify = true; break; @@ -94,12 +97,24 @@ } case 's': { float value; - auto result = std::from_chars(optarg, optarg + strlen(optarg), value); +#if defined(_LIBCPP_VERSION) && _LIBCPP_VERSION < 200000 + try { + size_t pos; + value = std::stof(optarg, &pos); + if (pos != strlen(optarg)) + throw std::invalid_argument(""); + } catch (...) { + std::cerr << "Invalid scale value: " << optarg << "\n"; + exit(1); + } +#else + auto result = std::from_chars(optarg, optarg + strlen(optarg), value); if (result.ec != std::errc() || result.ptr != optarg + strlen(optarg)) { std::cerr << "Invalid scale value: " << optarg << "\n"; exit(1); } +#endif if (value < 1.0f || value > 10.0f) { std::cerr << "Scale must be between 1 and 10!\n"; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hyprpicker-0.4.7/src/notify/Notify.cpp new/hyprpicker-0.4.8/src/notify/Notify.cpp --- old/hyprpicker-0.4.7/src/notify/Notify.cpp 2026-05-05 01:34:34.000000000 +0200 +++ new/hyprpicker-0.4.8/src/notify/Notify.cpp 2026-11-01 19:08:15.000000000 +0100 @@ -13,7 +13,7 @@ void NNotify::send(std::string hexColor, std::string formattedColor) { std::string notifyBody = std::format("<span>Selected color: <span color='{}'><b>{}</b></span></span>", hexColor, formattedColor); - Hyprutils::OS::CProcess notify("notify-send", {"-t", "5000", "-i", "color-select-symbolic", "Color Picker", notifyBody}); + Hyprutils::OS::CProcess notify("notify-send", {"-a", "hyprpicker", "-t", "5000", "-i", "color-select-symbolic", "Color Picker", notifyBody}); notify.runAsync(); } ++++++ hyprpicker.obsinfo ++++++ --- /var/tmp/diff_new_pack.601P2e/_old 2026-11-19 16:57:08.250926769 +0100 +++ /var/tmp/diff_new_pack.601P2e/_new 2026-11-19 16:57:08.255926980 +0100 @@ -1,5 +1,5 @@ name: hyprpicker -version: 0.4.7 -mtime: 1777937674 -commit: 8c163ce9b8a40f85babe4dd6e23a238787351164 +version: 0.4.8 +mtime: 1793556495 +commit: 838147963f8c2a22b60a455b2ccc02b5aa4a7b98
