Package not found: SUSE:ALP:RISCV/python-cheroot

File hyprpicker-0.4.1.obscpio of Package hyprpicker

07070100000000000081A400000000000000000000000166FAB0430000070E000000000000000000000000000000000000001F00000000hyprpicker-0.4.1/.clang-format---
Language: Cpp
BasedOnStyle: LLVM

AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignConsecutiveMacros: true
AlignConsecutiveAssignments: true
AlignEscapedNewlines: Right
AlignOperands: false
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: Yes
BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: false
BreakConstructorInitializers: AfterColon
ColumnLimit: 180
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: false
IncludeBlocks: Preserve
IndentCaseLabels: true
IndentWidth: 4
PointerAlignment: Left
ReflowComments: false
SortIncludes: false
SortUsingDeclarations: false
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Auto
TabWidth: 4
UseTab: Never

AllowShortEnumsOnASingleLine: false

BraceWrapping:
  AfterEnum: false

AlignConsecutiveDeclarations: AcrossEmptyLines

NamespaceIndentation: All
07070100000001000041ED00000000000000000000000266FAB04300000000000000000000000000000000000000000000001900000000hyprpicker-0.4.1/.github07070100000002000041ED00000000000000000000000266FAB04300000000000000000000000000000000000000000000002300000000hyprpicker-0.4.1/.github/workflows07070100000003000081A400000000000000000000000166FAB0430000031D000000000000000000000000000000000000003200000000hyprpicker-0.4.1/.github/workflows/nix-build.yamlname: Build Hyprpicker (Nix)

on: [push, pull_request, workflow_dispatch]
jobs:
  nix:
    name: "Build"
    runs-on: ubuntu-latest
    steps:
    - name: Clone repository
      uses: actions/checkout@v3
      with:
        submodules: recursive
    - name: Install nix
      uses: cachix/install-nix-action@v20
      with:
        install_url: https://nixos.org/nix/install
        extra_nix_config: |
          auto-optimise-store = true
          access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
          experimental-features = nix-command flakes
    - uses: cachix/cachix-action@v12
      with:
        name: hyprland
        authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
    - name: Build Hyprpicker with default settings
      run: nix build --print-build-logs --accept-flake-config
07070100000004000081A400000000000000000000000166FAB04300000123000000000000000000000000000000000000001C00000000hyprpicker-0.4.1/.gitignoreCMakeLists.txt.user
CMakeCache.txt
CMakeFiles
CMakeScripts
Testing
cmake_install.cmake
install_manifest.txt
compile_commands.json
CTestTestfile.cmake
_deps

build/
result
/.vscode/

*.o
*-protocol.c
*-protocol.h

protocols/*.cpp
protocols/*.hpp

.cache/

.ccls-cache

gmon.out
*.out
*.tar.gz07070100000005000081A400000000000000000000000166FAB043000012BA000000000000000000000000000000000000002000000000hyprpicker-0.4.1/CMakeLists.txtcmake_minimum_required(VERSION 3.12)

file(READ "${CMAKE_SOURCE_DIR}/VERSION" VER_RAW)
string(STRIP ${VER_RAW} VERSION)

project(
  hyprpicker
  DESCRIPTION "A blazing fast wayland wallpaper utility"
  VERSION ${VERSION})

set(CMAKE_MESSAGE_LOG_LEVEL "STATUS")

add_compile_definitions(HYPRPICKER_VERSION="${VERSION}")

message(STATUS "Configuring hyprpicker!")

# Get git info hash and branch
execute_process(
  COMMAND git rev-parse --abbrev-ref HEAD
  WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
  OUTPUT_VARIABLE GIT_BRANCH
  OUTPUT_STRIP_TRAILING_WHITESPACE)

execute_process(
  COMMAND git rev-parse HEAD
  WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
  OUTPUT_VARIABLE GIT_COMMIT_HASH
  OUTPUT_STRIP_TRAILING_WHITESPACE)

execute_process(
  COMMAND bash -c "git show ${GIT_COMMIT_HASH} | head -n 5 | tail -n 1"
  WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
  OUTPUT_VARIABLE GIT_COMMIT_MESSAGE
  OUTPUT_STRIP_TRAILING_WHITESPACE)

execute_process(
  COMMAND bash -c "git diff-index --quiet HEAD -- || echo \"dirty\""
  WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
  OUTPUT_VARIABLE GIT_DIRTY
  OUTPUT_STRIP_TRAILING_WHITESPACE)
#

include_directories(.)
set(CMAKE_CXX_STANDARD 23)
add_compile_options(-DWLR_USE_UNSTABLE)
add_compile_options(
  -Wall
  -Wextra
  -Wno-unused-parameter
  -Wno-unused-value
  -Wno-missing-field-initializers
  -Wno-narrowing
  -Wno-pointer-arith)
find_package(Threads REQUIRED)

find_package(PkgConfig REQUIRED)
pkg_check_modules(
  deps
  REQUIRED
  IMPORTED_TARGET
  wayland-client
  wayland-protocols
  xkbcommon
  cairo
  pango
  pangocairo
  libjpeg
  hyprutils>=0.2.0
  hyprwayland-scanner>=0.4.0)

file(GLOB_RECURSE SRCFILES "src/*.cpp")

add_executable(hyprpicker ${SRCFILES})

pkg_get_variable(WAYLAND_PROTOCOLS_DIR wayland-protocols pkgdatadir)
message(STATUS "Found wayland-protocols at ${WAYLAND_PROTOCOLS_DIR}")
pkg_get_variable(WAYLAND_SCANNER_DIR wayland-scanner pkgdatadir)
message(STATUS "Found wayland-scanner at ${WAYLAND_SCANNER_DIR}")

function(protocolnew protoPath protoName external)
  if(external)
    set(path ${CMAKE_SOURCE_DIR}/${protoPath})
  else()
    set(path ${WAYLAND_PROTOCOLS_DIR}/${protoPath})
  endif()
  add_custom_command(
    OUTPUT ${CMAKE_SOURCE_DIR}/protocols/${protoName}.cpp
           ${CMAKE_SOURCE_DIR}/protocols/${protoName}.hpp
    COMMAND hyprwayland-scanner --client ${path}/${protoName}.xml
            ${CMAKE_SOURCE_DIR}/protocols/
    WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
  target_sources(hyprpicker PRIVATE protocols/${protoName}.cpp
                                    protocols/${protoName}.hpp)
endfunction()
function(protocolWayland)
  add_custom_command(
    OUTPUT ${CMAKE_SOURCE_DIR}/protocols/wayland.cpp
           ${CMAKE_SOURCE_DIR}/protocols/wayland.hpp
    COMMAND hyprwayland-scanner --wayland-enums --client
            ${WAYLAND_SCANNER_DIR}/wayland.xml ${CMAKE_SOURCE_DIR}/protocols/
    WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
  target_sources(hyprpicker PRIVATE protocols/wayland.cpp protocols/wayland.hpp)
endfunction()

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)

target_compile_definitions(hyprpicker
                           PRIVATE "-DGIT_COMMIT_HASH=\"${GIT_COMMIT_HASH}\"")
target_compile_definitions(hyprpicker PRIVATE "-DGIT_BRANCH=\"${GIT_BRANCH}\"")
target_compile_definitions(
  hyprpicker PRIVATE "-DGIT_COMMIT_MESSAGE=\"${GIT_COMMIT_MESSAGE}\"")
target_compile_definitions(hyprpicker PRIVATE "-DGIT_DIRTY=\"${GIT_DIRTY}\"")

target_link_libraries(hyprpicker rt)

set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
include(CPack)

target_link_libraries(hyprpicker PkgConfig::deps)

target_link_libraries(hyprpicker pthread ${CMAKE_THREAD_LIBS_INIT}
                      wayland-cursor)

if(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES DEBUG)
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg -no-pie -fno-builtin")
  set(CMAKE_EXE_LINKER_FLAGS
      "${CMAKE_EXE_LINKER_FLAGS} -pg -no-pie -fno-builtin")
  set(CMAKE_SHARED_LINKER_FLAGS
      "${CMAKE_SHARED_LINKER_FLAGS} -pg -no-pie -fno-builtin")
endif(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES DEBUG)

if(NOT DEFINED CMAKE_INSTALL_MANDIR)
    set(CMAKE_INSTALL_MANDIR "${CMAKE_INSTALL_PREFIX}/share/man")
endif()

install(TARGETS hyprpicker)
install(FILES ${CMAKE_SOURCE_DIR}/doc/hyprpicker.1
        DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
07070100000006000081A400000000000000000000000166FAB043000005F4000000000000000000000000000000000000001900000000hyprpicker-0.4.1/LICENSEBSD 3-Clause License

Copyright (c) 2022, Hypr Development
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
   list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
   this list of conditions and the following disclaimer in the documentation
   and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
   contributors may be used to endorse or promote products derived from
   this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
07070100000007000081A400000000000000000000000166FAB043000004CD000000000000000000000000000000000000001B00000000hyprpicker-0.4.1/README.md# hyprpicker

A wlroots-compatible Wayland color picker that does not suck.

![hyprpickerShort](https://user-images.githubusercontent.com/43317083/188224867-7d77a3b3-0a66-488c-8019-39b00060ab42.gif)

# Usage

Launch it. Click. That's it.

## Options

`-f | --format=[fmt]` specifies the output format (`cmyk`, `hex`, `rgb`, `hsl`, `hsv`)

`-n | --no-fancy` disables the "fancy" (aka. colored) outputting

`-h | --help` prints a help message

`-a | --autocopy` automatically copies the output to the clipboard (requires [wl-clipboard](https://github.com/bugaevc/wl-clipboard))

`-r | --render-inactive` render (freeze) inactive displays too

`-z | --no-zoom` disable the zoom lens

# Building

## Arch

`yay -S hyprpicker-git`

## Manual

Install dependencies:
 - cmake
 - pkg-config
 - pango
 - cairo
 - wayland
 - wayland-protocols
 - hyprutils
 - xkbcommon

Building is done via CMake:

```sh
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr -S . -B ./build
cmake --build ./build --config Release --target hyprpicker -j`nproc 2>/dev/null || getconf _NPROCESSORS_CONF`
```

Install with:

```sh
cmake --install ./build
```

# Caveats

"Freezes" your displays when picking the color.
07070100000008000081A400000000000000000000000166FAB04300000006000000000000000000000000000000000000001900000000hyprpicker-0.4.1/VERSION0.4.1
07070100000009000041ED00000000000000000000000266FAB04300000000000000000000000000000000000000000000001500000000hyprpicker-0.4.1/doc0707010000000A000081A400000000000000000000000166FAB043000007EE000000000000000000000000000000000000002200000000hyprpicker-0.4.1/doc/hyprpicker.1.Dd $Mdocdate: November 14 2022 $
.Dt HYPRPICKER 1
.Os Linux
.Sh NAME
.Nm hyprpicker
.Nd wlroots-compatible wayland color picker
.Sh SYNOPSIS
.Nm
.Op Fl anh
.Op Fl f Ar fmt
.Sh DESCRIPTION
The
.Nm
utility is a color-picker with support for various output formats.
When
.Nm
is invoked the cursor is transformed into a magnifying lens, and clicking on any
pixel of the screen will print out that pixels color to the standard output.
The default output format is hexadecimal, but that can be configured with the
.Fl f
option.
.Pp
The options are as follows:
.Bl -tag -width Ds
.It Fl a , Fl Fl autocopy
Automatically copy the output of
.Nm
to the clipboard.
This option requires that the
.Xr wl-copy 1
command is installed on system.
.It Fl f Ar fmt , Fl Fl format Ns = Ns Ar fmt
Select the format to output the selected pixels color in.
The argument
.Ar fmt
is case-insensitive.
The available options are:
.Pp
.Bl -hang -compact
.It Ar cmyk
.Pq Dq C% M% Y% K%
.It Ar hex
.Pq Dq #RRGGBB
.It Ar rgb
.Pq Dq R G B
.It Ar hsl
.Pq Dq H S% L%
.It Ar hsv
.Pq Dq H S% V%
.El
.Pp
The default format is
.Ar hex .
.It Fl n , Fl Fl no-fancy
Disable colored output.
Default behavior is to color the output in the same color as the selected pixel.
.It Fl h , Fl Fl help
Display a help message and exit successfully from the program.
.El
.Sh ENVIRONMENT
.Bl -tag -width NO_COLOR
.It Ev NO_COLOR
If set, disables colored output.
.El
.Sh EXIT STATUS
.Ex -std
.Sh EXAMPLES
Get a pixels color:
.Pp
.Dl $ hyprpicker
.Pp
Get a pixels color in HSL, wrapped in a CSS
.Fn hsl
function:
.Pp
.Dl $ hyprpicker -f hsl | sed 's/^/rgb(/; s/$/)/; y/ /,/'
.Sh SEE ALSO
.Xr hyprctl 1 ,
.Xr hyprland 1 ,
.Xr sed 1 ,
.Xr wl-copy 1
.Pp
.Lk https://github.com/hyprwm/hyprpicker "The Hyprpicker Sources"
.Sh AUTHORS
.An -nosplit
The
.Nm
utility was originally written by
.An Vaxerski Aq Lk https://github.com/vaxerski
and the manual page by
.An Thomas Voss Aq Mt mail@thomasvoss.com .
.Sh BUGS
.Lk https://github.com/hyprwm/hyprpicker/issues "The Hyprpicker Bug Tracker"
0707010000000B000081A400000000000000000000000166FAB043000008B3000000000000000000000000000000000000001C00000000hyprpicker-0.4.1/flake.lock{
  "nodes": {
    "hyprutils": {
      "inputs": {
        "nixpkgs": [
          "nixpkgs"
        ],
        "systems": [
          "systems"
        ]
      },
      "locked": {
        "lastModified": 1727300645,
        "narHash": "sha256-OvAtVLaSRPnbXzOwlR1fVqCXR7i+ICRX3aPMCdIiv+c=",
        "owner": "hyprwm",
        "repo": "hyprutils",
        "rev": "3f5293432b6dc6a99f26aca2eba3876d2660665c",
        "type": "github"
      },
      "original": {
        "owner": "hyprwm",
        "repo": "hyprutils",
        "type": "github"
      }
    },
    "hyprwayland-scanner": {
      "inputs": {
        "nixpkgs": [
          "nixpkgs"
        ],
        "systems": [
          "systems"
        ]
      },
      "locked": {
        "lastModified": 1726874836,
        "narHash": "sha256-VKR0sf0PSNCB0wPHVKSAn41mCNVCnegWmgkrneKDhHM=",
        "owner": "hyprwm",
        "repo": "hyprwayland-scanner",
        "rev": "500c81a9e1a76760371049a8d99e008ea77aa59e",
        "type": "github"
      },
      "original": {
        "owner": "hyprwm",
        "repo": "hyprwayland-scanner",
        "type": "github"
      }
    },
    "nixpkgs": {
      "locked": {
        "lastModified": 1727122398,
        "narHash": "sha256-o8VBeCWHBxGd4kVMceIayf5GApqTavJbTa44Xcg5Rrk=",
        "owner": "NixOS",
        "repo": "nixpkgs",
        "rev": "30439d93eb8b19861ccbe3e581abf97bdc91b093",
        "type": "github"
      },
      "original": {
        "owner": "NixOS",
        "ref": "nixos-unstable",
        "repo": "nixpkgs",
        "type": "github"
      }
    },
    "root": {
      "inputs": {
        "hyprutils": "hyprutils",
        "hyprwayland-scanner": "hyprwayland-scanner",
        "nixpkgs": "nixpkgs",
        "systems": "systems"
      }
    },
    "systems": {
      "locked": {
        "lastModified": 1689347949,
        "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=",
        "owner": "nix-systems",
        "repo": "default-linux",
        "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68",
        "type": "github"
      },
      "original": {
        "owner": "nix-systems",
        "repo": "default-linux",
        "type": "github"
      }
    }
  },
  "root": "root",
  "version": 7
}
0707010000000C000081A400000000000000000000000166FAB0430000076D000000000000000000000000000000000000001B00000000hyprpicker-0.4.1/flake.nix{
  description = "Hyprpicker - a wlroots-compatible Wayland color picker that does not suck";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    systems.url = "github:nix-systems/default-linux";

    hyprutils = {
      url = "github:hyprwm/hyprutils";
      inputs.nixpkgs.follows = "nixpkgs";
      inputs.systems.follows = "systems";
    };

    hyprwayland-scanner = {
      url = "github:hyprwm/hyprwayland-scanner";
      inputs.nixpkgs.follows = "nixpkgs";
      inputs.systems.follows = "systems";
    };
  };

  outputs = {
    self,
    nixpkgs,
    systems,
    ...
  } @ inputs: let
    inherit (nixpkgs) lib;
    eachSystem = lib.genAttrs (import systems);
    pkgsFor = eachSystem (system:
      import nixpkgs {
        localSystem.system = system;
        overlays = with self.overlays; [hyprpicker];
      });
    mkDate = longDate: (lib.concatStringsSep "-" [
      (builtins.substring 0 4 longDate)
      (builtins.substring 4 2 longDate)
      (builtins.substring 6 2 longDate)
    ]);
    version = lib.removeSuffix "\n" (builtins.readFile ./VERSION);
  in {
    overlays = {
      default = self.overlays.hyprpicker;
      hyprpicker = lib.composeManyExtensions [
        inputs.hyprutils.overlays.default
        inputs.hyprwayland-scanner.overlays.default
        (final: prev: {
          hyprpicker = prev.callPackage ./nix/default.nix {
            stdenv = prev.gcc13Stdenv;
            version = version + "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty");
          };
          hyprpicker-debug = final.hyprpicker.override {debug = true;};
        })
      ];
    };

    packages = eachSystem (system: {
      default = self.packages.${system}.hyprpicker;
      inherit (pkgsFor.${system}) hyprpicker hyprpicker-debug;
    });

    formatter = eachSystem (system: pkgsFor.${system}.alejandra);
  };
}
0707010000000D000041ED00000000000000000000000266FAB04300000000000000000000000000000000000000000000001500000000hyprpicker-0.4.1/nix0707010000000E000081A400000000000000000000000166FAB04300000482000000000000000000000000000000000000002100000000hyprpicker-0.4.1/nix/default.nix{
  lib,
  stdenv,
  pkg-config,
  cmake,
  cairo,
  fribidi,
  hyprutils,
  hyprwayland-scanner,
  libdatrie,
  libGL,
  libjpeg,
  libselinux,
  libsepol,
  libthai,
  libxkbcommon,
  pango,
  pcre,
  pcre2,
  utillinux,
  wayland,
  wayland-protocols,
  wayland-scanner,
  xorg,
  debug ? false,
  version ? "git",
}:
stdenv.mkDerivation {
  pname = "hyprpicker" + lib.optionalString debug "-debug";
  inherit version;

  src = ../.;

  cmakeBuildType =
    if debug
    then "Debug"
    else "Release";

  nativeBuildInputs = [
    cmake
    hyprwayland-scanner
    pkg-config
  ];

  buildInputs = [
    cairo
    fribidi
    hyprutils
    libdatrie
    libGL
    libjpeg
    libselinux
    libsepol
    libthai
    libxkbcommon
    pango
    pcre
    pcre2
    utillinux
    wayland
    wayland-protocols
    wayland-scanner
    xorg.libXdmcp
  ];

  outputs = [
    "out"
    "man"
  ];

  meta = with lib; {
    homepage = "https://github.com/hyprwm/hyprpicker";
    description = "A wlroots-compatible Wayland color picker that does not suck";
    license = licenses.bsd3;
    platforms = platforms.linux;
    mainProgram = "hyprpicker";
  };
}
0707010000000F000041ED00000000000000000000000266FAB04300000000000000000000000000000000000000000000001B00000000hyprpicker-0.4.1/protocols07070100000010000081A400000000000000000000000166FAB0430000343C000000000000000000000000000000000000003B00000000hyprpicker-0.4.1/protocols/wlr-layer-shell-unstable-v1.xml<?xml version="1.0" encoding="UTF-8"?>
<protocol name="wlr_layer_shell_v1_unstable_v1">
  <copyright>
    Copyright © 2017 Drew DeVault

    Permission to use, copy, modify, distribute, and sell this
    software and its documentation for any purpose is hereby granted
    without fee, provided that the above copyright notice appear in
    all copies and that both that copyright notice and this permission
    notice appear in supporting documentation, and that the name of
    the copyright holders not be used in advertising or publicity
    pertaining to distribution of the software without specific,
    written prior permission.  The copyright holders make no
    representations about the suitability of this software for any
    purpose.  It is provided "as is" without express or implied
    warranty.

    THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
    SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
    FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
    SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
    WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
    AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
    ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
    THIS SOFTWARE.
  </copyright>

  <interface name="zwlr_layer_shell_v1" version="1">
    <description summary="create surfaces that are layers of the desktop">
      Clients can use this interface to assign the surface_layer role to
      wl_surfaces. Such surfaces are assigned to a "layer" of the output and
      rendered with a defined z-depth respective to each other. They may also be
      anchored to the edges and corners of a screen and specify input handling
      semantics. This interface should be suitable for the implementation of
      many desktop shell components, and a broad number of other applications
      that interact with the desktop.
    </description>

    <request name="get_layer_surface">
      <description summary="create a layer_surface from a surface">
        Create a layer surface for an existing surface. This assigns the role of
        layer_surface, or raises a protocol error if another role is already
        assigned.

        Creating a layer surface from a wl_surface which has a buffer attached
        or committed is a client error, and any attempts by a client to attach
        or manipulate a buffer prior to the first layer_surface.configure call
        must also be treated as errors.

        You may pass NULL for output to allow the compositor to decide which
        output to use. Generally this will be the one that the user most
        recently interacted with.

        Clients can specify a namespace that defines the purpose of the layer
        surface.
      </description>
      <arg name="id" type="new_id" interface="zwlr_layer_surface_v1"/>
      <arg name="surface" type="object" interface="wl_surface"/>
      <arg name="output" type="object" interface="wl_output" allow-null="true"/>
      <arg name="layer" type="uint" enum="layer" summary="layer to add this surface to"/>
      <arg name="namespace" type="string" summary="namespace for the layer surface"/>
    </request>

    <enum name="error">
      <entry name="role" value="0" summary="wl_surface has another role"/>
      <entry name="invalid_layer" value="1" summary="layer value is invalid"/>
      <entry name="already_constructed" value="2" summary="wl_surface has a buffer attached or committed"/>
    </enum>

    <enum name="layer">
      <description summary="available layers for surfaces">
        These values indicate which layers a surface can be rendered in. They
        are ordered by z depth, bottom-most first. Traditional shell surfaces
        will typically be rendered between the bottom and top layers.
        Fullscreen shell surfaces are typically rendered at the top layer.
        Multiple surfaces can share a single layer, and ordering within a
        single layer is undefined.
      </description>

      <entry name="background" value="0"/>
      <entry name="bottom" value="1"/>
      <entry name="top" value="2"/>
      <entry name="overlay" value="3"/>
    </enum>
  </interface>

  <interface name="zwlr_layer_surface_v1" version="1">
    <description summary="layer metadata interface">
      An interface that may be implemented by a wl_surface, for surfaces that
      are designed to be rendered as a layer of a stacked desktop-like
      environment.

      Layer surface state (size, anchor, exclusive zone, margin, interactivity)
      is double-buffered, and will be applied at the time wl_surface.commit of
      the corresponding wl_surface is called.
    </description>

    <request name="set_size">
      <description summary="sets the size of the surface">
        Sets the size of the surface in surface-local coordinates. The
        compositor will display the surface centered with respect to its
        anchors.

        If you pass 0 for either value, the compositor will assign it and
        inform you of the assignment in the configure event. You must set your
        anchor to opposite edges in the dimensions you omit; not doing so is a
        protocol error. Both values are 0 by default.

        Size is double-buffered, see wl_surface.commit.
      </description>
      <arg name="width" type="uint"/>
      <arg name="height" type="uint"/>
    </request>

    <request name="set_anchor">
      <description summary="configures the anchor point of the surface">
        Requests that the compositor anchor the surface to the specified edges
        and corners. If two orthoginal edges are specified (e.g. 'top' and
        'left'), then the anchor point will be the intersection of the edges
        (e.g. the top left corner of the output); otherwise the anchor point
        will be centered on that edge, or in the center if none is specified.

        Anchor is double-buffered, see wl_surface.commit.
      </description>
      <arg name="anchor" type="uint" enum="anchor"/>
    </request>

    <request name="set_exclusive_zone">
      <description summary="configures the exclusive geometry of this surface">
        Requests that the compositor avoids occluding an area of the surface
        with other surfaces. The compositor's use of this information is
        implementation-dependent - do not assume that this region will not
        actually be occluded.

        A positive value is only meaningful if the surface is anchored to an
        edge, rather than a corner. The zone is the number of surface-local
        coordinates from the edge that are considered exclusive.

        Surfaces that do not wish to have an exclusive zone may instead specify
        how they should interact with surfaces that do. If set to zero, the
        surface indicates that it would like to be moved to avoid occluding
        surfaces with a positive excluzive zone. If set to -1, the surface
        indicates that it would not like to be moved to accommodate for other
        surfaces, and the compositor should extend it all the way to the edges
        it is anchored to.

        For example, a panel might set its exclusive zone to 10, so that
        maximized shell surfaces are not shown on top of it. A notification
        might set its exclusive zone to 0, so that it is moved to avoid
        occluding the panel, but shell surfaces are shown underneath it. A
        wallpaper or lock screen might set their exclusive zone to -1, so that
        they stretch below or over the panel.

        The default value is 0.

        Exclusive zone is double-buffered, see wl_surface.commit.
      </description>
      <arg name="zone" type="int"/>
    </request>

    <request name="set_margin">
      <description summary="sets a margin from the anchor point">
        Requests that the surface be placed some distance away from the anchor
        point on the output, in surface-local coordinates. Setting this value
        for edges you are not anchored to has no effect.

        The exclusive zone includes the margin.

        Margin is double-buffered, see wl_surface.commit.
      </description>
      <arg name="top" type="int"/>
      <arg name="right" type="int"/>
      <arg name="bottom" type="int"/>
      <arg name="left" type="int"/>
    </request>

    <request name="set_keyboard_interactivity">
      <description summary="requests keyboard events">
        Set to 1 to request that the seat send keyboard events to this layer
        surface. For layers below the shell surface layer, the seat will use
        normal focus semantics. For layers above the shell surface layers, the
        seat will always give exclusive keyboard focus to the top-most layer
        which has keyboard interactivity set to true.

        Layer surfaces receive pointer, touch, and tablet events normally. If
        you do not want to receive them, set the input region on your surface
        to an empty region.

        Events is double-buffered, see wl_surface.commit.
      </description>
      <arg name="keyboard_interactivity" type="uint"/>
    </request>

    <request name="get_popup">
      <description summary="assign this layer_surface as an xdg_popup parent">
        This assigns an xdg_popup's parent to this layer_surface.  This popup
        should have been created via xdg_surface::get_popup with the parent set
        to NULL, and this request must be invoked before committing the popup's
        initial state.

        See the documentation of xdg_popup for more details about what an
        xdg_popup is and how it is used.
      </description>
      <arg name="popup" type="object" interface="xdg_popup"/>
    </request>

    <request name="ack_configure">
      <description summary="ack a configure event">
        When a configure event is received, if a client commits the
        surface in response to the configure event, then the client
        must make an ack_configure request sometime before the commit
        request, passing along the serial of the configure event.

        If the client receives multiple configure events before it
        can respond to one, it only has to ack the last configure event.

        A client is not required to commit immediately after sending
        an ack_configure request - it may even ack_configure several times
        before its next surface commit.

        A client may send multiple ack_configure requests before committing, but
        only the last request sent before a commit indicates which configure
        event the client really is responding to.
      </description>
      <arg name="serial" type="uint" summary="the serial from the configure event"/>
    </request>

    <request name="destroy" type="destructor">
      <description summary="destroy the layer_surface">
        This request destroys the layer surface.
      </description>
    </request>

    <event name="configure">
      <description summary="suggest a surface change">
        The configure event asks the client to resize its surface.

        Clients should arrange their surface for the new states, and then send
        an ack_configure request with the serial sent in this configure event at
        some point before committing the new surface.

        The client is free to dismiss all but the last configure event it
        received.

        The width and height arguments specify the size of the window in
        surface-local coordinates.

        The size is a hint, in the sense that the client is free to ignore it if
        it doesn't resize, pick a smaller size (to satisfy aspect ratio or
        resize in steps of NxM pixels). If the client picks a smaller size and
        is anchored to two opposite anchors (e.g. 'top' and 'bottom'), the
        surface will be centered on this axis.

        If the width or height arguments are zero, it means the client should
        decide its own window dimension.
      </description>
      <arg name="serial" type="uint"/>
      <arg name="width" type="uint"/>
      <arg name="height" type="uint"/>
    </event>

    <event name="closed">
      <description summary="surface should be closed">
        The closed event is sent by the compositor when the surface will no
        longer be shown. The output may have been destroyed or the user may
        have asked for it to be removed. Further changes to the surface will be
        ignored. The client should destroy the resource after receiving this
        event, and create a new surface if they so choose.
      </description>
    </event>

    <enum name="error">
      <entry name="invalid_surface_state" value="0" summary="provided surface state is invalid"/>
      <entry name="invalid_size" value="1" summary="size is invalid"/>
      <entry name="invalid_anchor" value="2" summary="anchor bitfield is invalid"/>
    </enum>

    <enum name="anchor" bitfield="true">
      <entry name="top" value="1" summary="the top edge of the anchor rectangle"/>
      <entry name="bottom" value="2" summary="the bottom edge of the anchor rectangle"/>
      <entry name="left" value="4" summary="the left edge of the anchor rectangle"/>
      <entry name="right" value="8" summary="the right edge of the anchor rectangle"/>
    </enum>
  </interface>
</protocol>
07070100000011000081A400000000000000000000000166FAB04300001DE9000000000000000000000000000000000000003A00000000hyprpicker-0.4.1/protocols/wlr-screencopy-unstable-v1.xml<?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>
07070100000012000041ED00000000000000000000000266FAB04300000000000000000000000000000000000000000000001500000000hyprpicker-0.4.1/src07070100000013000041ED00000000000000000000000266FAB04300000000000000000000000000000000000000000000001F00000000hyprpicker-0.4.1/src/clipboard07070100000014000081A400000000000000000000000166FAB04300000191000000000000000000000000000000000000002D00000000hyprpicker-0.4.1/src/clipboard/Clipboard.cpp#include "Clipboard.hpp"

#include "../includes.hpp"

void Clipboard::copy(const char* fmt, ...) {
    char    buf[CLIPBOARDMESSAGESIZE] = "";
    char*   outputStr;

    va_list args;
    va_start(args, fmt);
    vsnprintf(buf, sizeof buf, fmt, args);
    va_end(args);

    outputStr = strdup(buf);

    if (fork() == 0)
        execlp("wl-copy", "wl-copy", outputStr, NULL);

    free(outputStr);
}07070100000015000081A400000000000000000000000166FAB0430000006C000000000000000000000000000000000000002D00000000hyprpicker-0.4.1/src/clipboard/Clipboard.hpp#pragma once

#define CLIPBOARDMESSAGESIZE 24

namespace Clipboard {
    void copy(const char* fmt, ...);
};07070100000016000041ED00000000000000000000000266FAB04300000000000000000000000000000000000000000000001B00000000hyprpicker-0.4.1/src/debug07070100000017000081A400000000000000000000000166FAB04300000527000000000000000000000000000000000000002300000000hyprpicker-0.4.1/src/debug/Log.cpp#include "Log.hpp"

#include <fstream>
#include <iostream>

#include "../includes.hpp"

void Debug::log(LogLevel level, const char* fmt, ...) {
    std::string levelstr = "";

    if (quiet && (level != ERR && level != CRIT))
        return;

    if (!verbose && level == TRACE)
        return;

    switch (level) {
        case LOG: levelstr = "[LOG] "; break;
        case WARN: levelstr = "[WARN] "; break;
        case ERR: levelstr = "[ERR] "; break;
        case CRIT: levelstr = "[CRITICAL] "; break;
        case INFO: levelstr = "[INFO] "; break;
        default: break;
    }

    char    buf[LOGMESSAGESIZE] = "";
    char*   outputStr;
    int     logLen;

    va_list args;
    va_start(args, fmt);
    logLen = vsnprintf(buf, sizeof buf, fmt, args);
    va_end(args);

    if ((long unsigned int)logLen < sizeof buf) {
        outputStr = strdup(buf);
    } else {
        outputStr = (char*)malloc(logLen + 1);

        if (!outputStr) {
            printf("CRITICAL: Cannot alloc size %d for log! (Out of memory?)", logLen + 1);
            return;
        }

        va_start(args, fmt);
        vsnprintf(outputStr, logLen + 1U, fmt, args);
        va_end(args);
    }

    // hyprpicker only logs to stdout
    std::cout << levelstr << outputStr << "\n";

    // free the log
    free(outputStr);
}
07070100000018000081A400000000000000000000000166FAB0430000011F000000000000000000000000000000000000002300000000hyprpicker-0.4.1/src/debug/Log.hpp#pragma once
#include <string>

#define LOGMESSAGESIZE 1024

enum LogLevel {
    NONE = -1,
    LOG  = 0,
    WARN,
    ERR,
    CRIT,
    INFO,
    TRACE,
};

namespace Debug {
    inline bool quiet = false, verbose = false;
    void        log(LogLevel level, const char* fmt, ...);
};07070100000019000081A400000000000000000000000166FAB043000001E9000000000000000000000000000000000000002100000000hyprpicker-0.4.1/src/defines.hpp#pragma once

#include "debug/Log.hpp"
#include "includes.hpp"
#include "helpers/Monitor.hpp"
#include "helpers/Color.hpp"
#include "clipboard/Clipboard.hpp"

// git stuff
#ifndef GIT_COMMIT_HASH
#define GIT_COMMIT_HASH "?"
#endif
#ifndef GIT_BRANCH
#define GIT_BRANCH "?"
#endif
#ifndef GIT_COMMIT_MESSAGE
#define GIT_COMMIT_MESSAGE "?"
#endif
#ifndef GIT_DIRTY
#define GIT_DIRTY "?"
#endif

#include <sys/types.h>

#include <hyprutils/math/Vector2D.hpp>
using namespace Hyprutils::Math;
0707010000001A000041ED00000000000000000000000266FAB04300000000000000000000000000000000000000000000001D00000000hyprpicker-0.4.1/src/helpers0707010000001B000081A400000000000000000000000166FAB0430000006C000000000000000000000000000000000000002700000000hyprpicker-0.4.1/src/helpers/Color.hpp#pragma once

#include "../defines.hpp"

class CColor {
  public:
    uint8_t r = 0, g = 0, b = 0, a = 0;
};0707010000001C000081A400000000000000000000000166FAB04300000E9F000000000000000000000000000000000000002E00000000hyprpicker-0.4.1/src/helpers/LayerSurface.cpp#include "LayerSurface.hpp"

#include "../hyprpicker.hpp"

CLayerSurface::CLayerSurface(SMonitor* pMonitor) {
    m_pMonitor = pMonitor;

    pSurface = makeShared<CCWlSurface>(g_pHyprpicker->m_pCompositor->sendCreateSurface());

    if (!pSurface) {
        Debug::log(CRIT, "The compositor did not allow hyprpicker a surface!");
        g_pHyprpicker->finish(1);
        return;
    }

    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 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) { //
            Debug::log(TRACE, "Received a preferredScale for %s: %.2f", m_pMonitor->name.c_str(), scale120 / 120.F);
        });
    }

    pLayerSurface = makeShared<CCZwlrLayerSurfaceV1>(
        g_pHyprpicker->m_pLayerShell->sendGetLayerSurface(pSurface->resource(), pMonitor->output->resource(), ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY, "hyprpicker"));

    if (!pLayerSurface) {
        Debug::log(CRIT, "The compositor did not allow hyprpicker a layersurface!");
        g_pHyprpicker->finish(1);
        return;
    }

    pLayerSurface->setConfigure([this](CCZwlrLayerSurfaceV1* r, uint32_t serial, uint32_t width, uint32_t height) {
        m_pMonitor->size = {(double)width, (double)height};
        ACKSerial        = serial;
        wantsACK         = true;
        working          = true;

        g_pHyprpicker->recheckACK();
    });

    pLayerSurface->sendSetSize(0, 0);
    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);
    pSurface->sendCommit();

    wl_display_flush(g_pHyprpicker->m_pWLDisplay);
}

CLayerSurface::~CLayerSurface() {
    pLayerSurface.reset();
    pSurface.reset();
    frameCallback.reset();

    if (g_pHyprpicker->m_pWLDisplay)
        wl_display_flush(g_pHyprpicker->m_pWLDisplay);
}

// this has to be a separate function because frameCallback.reset() will destroy the listener func
static void onCallbackDone(CLayerSurface* surf, uint32_t when) {
    surf->frameCallback.reset();

    if (surf->dirty || !surf->rendered)
        g_pHyprpicker->renderSurface(g_pHyprpicker->m_pLastSurface);
}

void CLayerSurface::sendFrame() {
    frameCallback = makeShared<CCWlCallback>(pSurface->sendFrame());
    frameCallback->setDone([this](CCWlCallback* r, uint32_t when) { onCallbackDone(this, when); });

    const auto& PBUFFER = lastBuffer == 0 ? buffers[0] : buffers[1];

    pSurface->sendAttach(PBUFFER->buffer.get(), 0, 0);
    if (!g_pHyprpicker->m_bNoFractional) {
        pSurface->sendSetBufferScale(1);
        pViewport->sendSetDestination(m_pMonitor->size.x, m_pMonitor->size.y);
    } else
        pSurface->sendSetBufferScale(m_pMonitor->scale);

    pSurface->sendDamageBuffer(0, 0, 0xFFFF, 0xFFFF);
    pSurface->sendCommit();

    dirty = false;
}

void CLayerSurface::markDirty() {
    frameCallback = makeShared<CCWlCallback>(pSurface->sendFrame());
    frameCallback->setDone([this](CCWlCallback* r, uint32_t when) { onCallbackDone(this, when); });
    pSurface->sendCommit();

    dirty = true;
}
0707010000001D000081A400000000000000000000000166FAB04300000438000000000000000000000000000000000000002E00000000hyprpicker-0.4.1/src/helpers/LayerSurface.hpp#pragma once

#include "../defines.hpp"
#include "PoolBuffer.hpp"

struct SMonitor;

class CLayerSurface {
  public:
    CLayerSurface(SMonitor*);
    ~CLayerSurface();

    void                      sendFrame();
    void                      markDirty();

    SMonitor*                 m_pMonitor = nullptr;

    SP<CCZwlrLayerSurfaceV1>  pLayerSurface    = nullptr;
    SP<CCWlSurface>           pSurface         = nullptr;
    SP<CCWpViewport>          pViewport        = nullptr;
    SP<CCWpFractionalScaleV1> pFractionalScale = nullptr;

    bool                      wantsACK  = false;
    uint32_t                  ACKSerial = 0;
    bool                      working   = false;

    int                       lastBuffer = 0;
    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;
};0707010000001E000081A400000000000000000000000166FAB04300001228000000000000000000000000000000000000002900000000hyprpicker-0.4.1/src/helpers/Monitor.cpp#include "Monitor.hpp"
#include "LayerSurface.hpp"
#include "../hyprpicker.hpp"

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;
    });
    output->setScale([this](CCWlOutput* r, int32_t scale_) { //
        scale = scale_;
    });
    output->setName([this](CCWlOutput* r, const char* name_) { //
        if (name_)
            name = name_;
    });
}

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);

        SP<SPoolBuffer> newBuf = makeShared<SPoolBuffer>(transformedSize, pLS->screenBufferFormat, transformedSize.x * 4);

        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);
            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);

        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);

            // TODO: flipped
        };

        cairo_save(PCAIRO);

        cairo_set_source_rgba(PCAIRO, 0, 0, 0, 0);

        cairo_rectangle(PCAIRO, 0, 0, 0xFFFF, 0xFFFF);
        cairo_fill(PCAIRO);

        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);

        cairo_surface_flush(newBuf->surface);

        cairo_pattern_destroy(PATTERNPRE);

        cairo_destroy(PCAIRO);

        cairo_surface_destroy(oldSurface);

        pLS->screenBuffer = newBuf;

        g_pHyprpicker->renderSurface(pLS);

        pSCFrame.reset();
    });
    pSCFrame->setFailed([this](CCZwlrScreencopyFrameV1* r) {
        Debug::log(CRIT, "Failed to get a Screencopy!");
        g_pHyprpicker->finish(1);
    });
}0707010000001F000081A400000000000000000000000166FAB043000002BC000000000000000000000000000000000000002900000000hyprpicker-0.4.1/src/helpers/Monitor.hpp#pragma once

#include "../defines.hpp"
#include <hyprutils/math/Vector2D.hpp>
using namespace Hyprutils::Math;

class CLayerSurface;

struct SMonitor {
    SMonitor(SP<CCWlOutput> output_);
    void                        initSCFrame();

    std::string                 name         = "";
    SP<CCWlOutput>              output       = nullptr;
    uint32_t                    wayland_name = 0;
    Vector2D                    size;
    int                         scale;
    wl_output_transform         transform = WL_OUTPUT_TRANSFORM_NORMAL;

    bool                        ready = false;

    CLayerSurface*              pLS      = nullptr;
    SP<CCZwlrScreencopyFrameV1> pSCFrame = nullptr;
};07070100000020000081A400000000000000000000000166FAB0430000045C000000000000000000000000000000000000002C00000000hyprpicker-0.4.1/src/helpers/PoolBuffer.cpp#include "PoolBuffer.hpp"
#include "../hyprpicker.hpp"

SPoolBuffer::SPoolBuffer(const Vector2D& pixelSize_, uint32_t format_, uint32_t stride_) : stride(stride_), pixelSize(pixelSize_), format(format_) {
    const size_t SIZE = stride * pixelSize.y;

    const auto   FD = g_pHyprpicker->createPoolFile(SIZE, name);

    if (FD == -1) {
        Debug::log(CRIT, "Unable to create pool file!");
        g_pHyprpicker->finish(1);
    }

    const auto DATA = mmap(NULL, SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, FD, 0);

    size = SIZE;
    data = DATA;

    auto POOL = makeShared<CCWlShmPool>(g_pHyprpicker->m_pSHM->sendCreatePool(FD, SIZE));
    buffer    = makeShared<CCWlBuffer>(POOL->sendCreateBuffer(0, pixelSize.x, pixelSize.y, stride, format));

    buffer->setRelease([this](CCWlBuffer* r) { busy = false; });

    POOL.reset();

    close(FD);
}

SPoolBuffer::~SPoolBuffer() {
    buffer.reset();
    cairo_destroy(cairo);
    cairo_surface_destroy(surface);
    munmap(data, size);

    cairo   = nullptr;
    surface = nullptr;

    unlink(name.c_str());

    if (paddedData)
        free(paddedData);
}07070100000021000081A400000000000000000000000166FAB04300000232000000000000000000000000000000000000002C00000000hyprpicker-0.4.1/src/helpers/PoolBuffer.hpp#pragma once

#include "../defines.hpp"

struct SPoolBuffer {
    SPoolBuffer(const Vector2D& size, uint32_t format, uint32_t stride);
    ~SPoolBuffer();

    SP<CCWlBuffer>   buffer  = nullptr;
    cairo_surface_t* surface = nullptr;
    cairo_t*         cairo   = nullptr;
    void*            data    = nullptr;

    // malloc'ed buffer for 24bit formats
    void*       paddedData = nullptr;

    size_t      size   = 0;
    uint32_t    stride = 0;
    Vector2D    pixelSize;

    uint32_t    format;

    std::string name;

    bool        busy = false;
};07070100000022000081A400000000000000000000000166FAB043000066E7000000000000000000000000000000000000002400000000hyprpicker-0.4.1/src/hyprpicker.cpp#include "hyprpicker.hpp"
#include <signal.h>

void sigHandler(int sig) {
    g_pHyprpicker->m_vLayerSurfaces.clear();
    exit(0);
}

void CHyprpicker::init() {
    m_pXKBContext = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
    if (!m_pXKBContext)
        Debug::log(ERR, "Failed to create xkb context");

    m_pWLDisplay = wl_display_connect(nullptr);

    if (!m_pWLDisplay) {
        Debug::log(CRIT, "No wayland compositor running!");
        exit(1);
        return;
    }

    signal(SIGTERM, sigHandler);

    m_pRegistry = makeShared<CCWlRegistry>((wl_proxy*)wl_display_get_registry(m_pWLDisplay));
    m_pRegistry->setGlobal([this](CCWlRegistry* r, uint32_t name, const char* interface, uint32_t version) {
        if (strcmp(interface, wl_compositor_interface.name) == 0) {
            m_pCompositor = makeShared<CCWlCompositor>((wl_proxy*)wl_registry_bind((wl_registry*)m_pRegistry->resource(), name, &wl_compositor_interface, 4));
        } else if (strcmp(interface, wl_shm_interface.name) == 0) {
            m_pSHM = makeShared<CCWlShm>((wl_proxy*)wl_registry_bind((wl_registry*)m_pRegistry->resource(), name, &wl_shm_interface, 1));
        } else if (strcmp(interface, wl_output_interface.name) == 0) {
            m_mtTickMutex.lock();

            const auto PMONITOR = g_pHyprpicker->m_vMonitors
                                      .emplace_back(std::make_unique<SMonitor>(
                                          makeShared<CCWlOutput>((wl_proxy*)wl_registry_bind((wl_registry*)m_pRegistry->resource(), name, &wl_output_interface, 4))))
                                      .get();
            PMONITOR->wayland_name = name;

            m_mtTickMutex.unlock();
        } else if (strcmp(interface, zwlr_layer_shell_v1_interface.name) == 0) {
            m_pLayerShell = makeShared<CCZwlrLayerShellV1>((wl_proxy*)wl_registry_bind((wl_registry*)m_pRegistry->resource(), name, &zwlr_layer_shell_v1_interface, 1));
        } else if (strcmp(interface, wl_seat_interface.name) == 0) {
            m_pSeat = makeShared<CCWlSeat>((wl_proxy*)wl_registry_bind((wl_registry*)m_pRegistry->resource(), name, &wl_seat_interface, 1));

            m_pSeat->setCapabilities([this](CCWlSeat* seat, uint32_t caps) {
                if (caps & WL_SEAT_CAPABILITY_POINTER) {
                    if (!m_pPointer) {
                        m_pPointer = makeShared<CCWlPointer>(m_pSeat->sendGetPointer());
                        initMouse();
                        if (m_pCursorShapeMgr)
                            m_pCursorShapeDevice = makeShared<CCWpCursorShapeDeviceV1>(m_pCursorShapeMgr->sendGetPointer(m_pPointer->resource()));
                    }
                } else {
                    Debug::log(CRIT, "Hyprpicker cannot work without a pointer!");
                    g_pHyprpicker->finish(1);
                }

                if (caps & WL_SEAT_CAPABILITY_KEYBOARD) {
                    if (!m_pKeyboard) {
                        m_pKeyboard = makeShared<CCWlKeyboard>(m_pSeat->sendGetKeyboard());
                        initKeyboard();
                    }
                } else
                    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, 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));
        } else if (strcmp(interface, wp_fractional_scale_manager_v1_interface.name) == 0) {
            m_pFractionalMgr =
                makeShared<CCWpFractionalScaleManagerV1>((wl_proxy*)wl_registry_bind((wl_registry*)m_pRegistry->resource(), name, &wp_fractional_scale_manager_v1_interface, 1));
        } else if (strcmp(interface, wp_viewporter_interface.name) == 0) {
            m_pViewporter = makeShared<CCWpViewporter>((wl_proxy*)wl_registry_bind((wl_registry*)m_pRegistry->resource(), name, &wp_viewporter_interface, 1));
        }
    });

    wl_display_roundtrip(m_pWLDisplay);

    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");
        exit(1);
    }

    if (!m_pFractionalMgr) {
        Debug::log(WARN, "wp_fractional_scale_v1 not supported, fractional scaling won't work");
        m_bNoFractional = true;
    }
    if (!m_pViewporter) {
        Debug::log(WARN, "wp_viewporter not supported, fractional scaling won't work");
        m_bNoFractional = true;
    }

    for (auto& m : m_vMonitors) {
        m_vLayerSurfaces.emplace_back(std::make_unique<CLayerSurface>(m.get()));

        m_pLastSurface = m_vLayerSurfaces.back().get();

        m->pSCFrame = makeShared<CCZwlrScreencopyFrameV1>(m_pScreencopyMgr->sendCaptureOutput(false, m->output->resource()));
        m->pLS      = m_vLayerSurfaces.back().get();
        m->initSCFrame();
    }

    wl_display_roundtrip(m_pWLDisplay);

    while (m_bRunning && wl_display_dispatch(m_pWLDisplay) != -1) {
        //renderSurface(m_pLastSurface);
    }

    if (m_pWLDisplay) {
        wl_display_disconnect(m_pWLDisplay);
        m_pWLDisplay = nullptr;
    }
}

void CHyprpicker::finish(int code) {
    m_vLayerSurfaces.clear();

    if (m_pWLDisplay) {
        m_vLayerSurfaces.clear();
        m_vMonitors.clear();
        m_pCompositor.reset();
        m_pRegistry.reset();
        m_pSHM.reset();
        m_pLayerShell.reset();
        m_pScreencopyMgr.reset();
        m_pCursorShapeMgr.reset();
        m_pCursorShapeDevice.reset();
        m_pSeat.reset();
        m_pKeyboard.reset();
        m_pPointer.reset();
        m_pViewporter.reset();
        m_pFractionalMgr.reset();

        wl_display_disconnect(m_pWLDisplay);
        m_pWLDisplay = nullptr;
    }

    exit(code);
}

void CHyprpicker::recheckACK() {
    for (auto& ls : m_vLayerSurfaces) {
        if (ls->wantsACK) {
            ls->wantsACK = false;
            ls->pLayerSurface->sendAckConfigure(ls->ACKSerial);

            const auto MONITORSIZE = ls->screenBuffer && !g_pHyprpicker->m_bNoFractional ? ls->screenBuffer->pixelSize : ls->m_pMonitor->size * ls->m_pMonitor->scale;

            if (!ls->buffers[0] || ls->buffers[0]->pixelSize != MONITORSIZE) {
                ls->buffers[0] = makeShared<SPoolBuffer>(MONITORSIZE, WL_SHM_FORMAT_ARGB8888, MONITORSIZE.x * 4);
                ls->buffers[1] = makeShared<SPoolBuffer>(MONITORSIZE, WL_SHM_FORMAT_ARGB8888, MONITORSIZE.x * 4);
            }
        }
    }

    markDirty();
}

void CHyprpicker::markDirty() {
    for (auto& ls : m_vLayerSurfaces) {
        if (ls->frameCallback)
            continue;

        ls->markDirty();
    }
}

SP<SPoolBuffer> CHyprpicker::getBufferForLS(CLayerSurface* pLS) {
    SP<SPoolBuffer> returns = nullptr;

    for (auto i = 0; i < 2; ++i) {
        if (!pLS->buffers[i] || pLS->buffers[i]->busy)
            continue;

        returns = pLS->buffers[i];
    }

    return returns;
}

bool CHyprpicker::setCloexec(const int& FD) {
    long flags = fcntl(FD, F_GETFD);
    if (flags == -1) {
        return false;
    }

    if (fcntl(FD, F_SETFD, flags | FD_CLOEXEC) == -1) {
        return false;
    }

    return true;
}

int CHyprpicker::createPoolFile(size_t size, std::string& name) {
    const auto XDGRUNTIMEDIR = getenv("XDG_RUNTIME_DIR");
    if (!XDGRUNTIMEDIR) {
        Debug::log(CRIT, "XDG_RUNTIME_DIR not set!");
        g_pHyprpicker->finish(1);
    }

    name = std::string(XDGRUNTIMEDIR) + "/.hyprpicker_XXXXXX";

    const auto FD = mkstemp((char*)name.c_str());
    if (FD < 0) {
        Debug::log(CRIT, "createPoolFile: fd < 0");
        g_pHyprpicker->finish(1);
    }

    if (!setCloexec(FD)) {
        close(FD);
        Debug::log(CRIT, "createPoolFile: !setCloexec");
        g_pHyprpicker->finish(1);
    }

    if (ftruncate(FD, size) < 0) {
        close(FD);
        Debug::log(CRIT, "createPoolFile: ftruncate < 0");
        g_pHyprpicker->finish(1);
    }

    return FD;
}

void CHyprpicker::convertBuffer(SP<SPoolBuffer> pBuffer) {
    switch (pBuffer->format) {
        case WL_SHM_FORMAT_ARGB8888:
        case WL_SHM_FORMAT_XRGB8888: break;
        case WL_SHM_FORMAT_ABGR8888:
        case WL_SHM_FORMAT_XBGR8888: {
            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) {
                    struct pixel {
                        // little-endian ARGB
                        unsigned char blue;
                        unsigned char green;
                        unsigned char red;
                        unsigned char alpha;
                    }* px = (struct pixel*)(data + y * (int)pBuffer->pixelSize.x * 4 + x * 4);

                    std::swap(px->red, px->blue);
                }
            }
        } break;
        case WL_SHM_FORMAT_XRGB2101010:
        case WL_SHM_FORMAT_XBGR2101010: {
            uint8_t*   data = (uint8_t*)pBuffer->data;

            const bool FLIP = pBuffer->format == WL_SHM_FORMAT_XBGR2101010;

            for (int y = 0; y < pBuffer->pixelSize.y; ++y) {
                for (int x = 0; x < pBuffer->pixelSize.x; ++x) {
                    uint32_t* px = (uint32_t*)(data + y * (int)pBuffer->pixelSize.x * 4 + 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);
                }
            }
        } break;
        default: {
            Debug::log(CRIT, "Unsupported format %i", pBuffer->format);
        }
            g_pHyprpicker->finish(1);
    }
}

// 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;

    switch (pBuffer->format) {
        case WL_SHM_FORMAT_BGR888: {
            for (int y = 0; y < pBuffer->pixelSize.y; ++y) {
                for (int x = 0; x < pBuffer->pixelSize.x; ++x) {
                    struct pixel3 {
                        // little-endian RGB
                        unsigned char blue;
                        unsigned char green;
                        unsigned char red;
                    }* srcPx = (struct pixel3*)(oldBuffer + y * pBuffer->stride + x * 3);
                    struct pixel4 {
                        // little-endian ARGB
                        unsigned char blue;
                        unsigned char green;
                        unsigned char red;
                        unsigned char alpha;
                    }* dstPx = (struct pixel4*)(newBuffer + y * newBufferStride + x * 4);
                    *dstPx   = {srcPx->red, srcPx->green, srcPx->blue, 0xFF};
                }
            }
        } break;
        case WL_SHM_FORMAT_RGB888: {
            for (int y = 0; y < pBuffer->pixelSize.y; ++y) {
                for (int x = 0; x < pBuffer->pixelSize.x; ++x) {
                    struct pixel3 {
                        // big-endian RGB
                        unsigned char red;
                        unsigned char green;
                        unsigned char blue;
                    }* srcPx = (struct pixel3*)(oldBuffer + y * pBuffer->stride + x * 3);
                    struct pixel4 {
                        // big-endian ARGB
                        unsigned char alpha;
                        unsigned char red;
                        unsigned char green;
                        unsigned char blue;
                    }* dstPx = (struct pixel4*)(newBuffer + y * newBufferStride + x * 4);
                    *dstPx   = {0xFF, srcPx->red, srcPx->green, srcPx->blue};
                }
            }
        } break;
        default: {
            Debug::log(CRIT, "Unsupported format for 24bit buffer %i", pBuffer->format);
        }
            g_pHyprpicker->finish(1);
    }
    return newBuffer;
}

void CHyprpicker::renderSurface(CLayerSurface* pSurface, bool forceInactive) {
    const auto PBUFFER = getBufferForLS(pSurface);

    if (!PBUFFER || !pSurface->screenBuffer) {
        // Debug::log(ERR, PBUFFER ? "renderSurface: pSurface->screenBuffer null" : "renderSurface: PBUFFER null");
        return;
    }

    PBUFFER->surface =
        cairo_image_surface_create_for_data((unsigned char*)PBUFFER->data, CAIRO_FORMAT_ARGB32, PBUFFER->pixelSize.x, PBUFFER->pixelSize.y, PBUFFER->pixelSize.x * 4);

    PBUFFER->cairo = cairo_create(PBUFFER->surface);

    const auto PCAIRO = PBUFFER->cairo;

    cairo_save(PCAIRO);

    cairo_set_source_rgba(PCAIRO, 0, 0, 0, 0);

    cairo_rectangle(PCAIRO, 0, 0, PBUFFER->pixelSize.x, PBUFFER->pixelSize.y);
    cairo_fill(PCAIRO);

    if (pSurface == m_pLastSurface && !forceInactive) {
        const auto SCALEBUFS      = pSurface->screenBuffer->pixelSize / PBUFFER->pixelSize;
        const auto MOUSECOORDSABS = m_vLastCoords.floor() / pSurface->m_pMonitor->size;
        const auto CLICKPOS       = MOUSECOORDSABS * PBUFFER->pixelSize;

        const auto PATTERNPRE = cairo_pattern_create_for_surface(pSurface->screenBuffer->surface);
        cairo_pattern_set_filter(PATTERNPRE, CAIRO_FILTER_BILINEAR);
        cairo_matrix_t matrixPre;
        cairo_matrix_init_identity(&matrixPre);
        cairo_matrix_scale(&matrixPre, SCALEBUFS.x, SCALEBUFS.y);
        cairo_pattern_set_matrix(PATTERNPRE, &matrixPre);
        cairo_set_source(PCAIRO, PATTERNPRE);
        cairo_paint(PCAIRO);

        cairo_surface_flush(PBUFFER->surface);

        cairo_pattern_destroy(PATTERNPRE);

        // we draw the preview like this
        //
        //     200px        ZOOM: 10x
        // | --------- |
        // |           |
        // |     x     | 200px
        // |           |
        // | --------- |
        //

        cairo_restore(PCAIRO);
        if (!m_bNoZoom) {
            cairo_save(PCAIRO);

            const auto CLICKPOSBUF = CLICKPOS / PBUFFER->pixelSize * pSurface->screenBuffer->pixelSize;

            const auto PIXCOLOR = getColorFromPixel(pSurface, CLICKPOSBUF);
            cairo_set_source_rgba(PCAIRO, PIXCOLOR.r / 255.f, PIXCOLOR.g / 255.f, PIXCOLOR.b / 255.f, PIXCOLOR.a / 255.f);

            cairo_scale(PCAIRO, 1, 1);

            cairo_arc(PCAIRO, CLICKPOS.x, CLICKPOS.y, 105 / SCALEBUFS.x, 0, 2 * M_PI);
            cairo_clip(PCAIRO);

            cairo_fill(PCAIRO);
            cairo_paint(PCAIRO);

            cairo_surface_flush(PBUFFER->surface);

            cairo_restore(PCAIRO);
            cairo_save(PCAIRO);

            const auto PATTERN = cairo_pattern_create_for_surface(pSurface->screenBuffer->surface);
            cairo_pattern_set_filter(PATTERN, CAIRO_FILTER_NEAREST);
            cairo_matrix_t matrix;
            cairo_matrix_init_identity(&matrix);
            cairo_matrix_translate(&matrix, CLICKPOSBUF.x + 0.5f, CLICKPOSBUF.y + 0.5f);
            cairo_matrix_scale(&matrix, 0.1f, 0.1f);
            cairo_matrix_translate(&matrix, -CLICKPOSBUF.x / SCALEBUFS.x - 0.5f, -CLICKPOSBUF.y / SCALEBUFS.y - 0.5f);
            cairo_pattern_set_matrix(PATTERN, &matrix);
            cairo_set_source(PCAIRO, PATTERN);
            cairo_arc(PCAIRO, CLICKPOS.x, CLICKPOS.y, 100 / SCALEBUFS.x, 0, 2 * M_PI);
            cairo_clip(PCAIRO);
            cairo_paint(PCAIRO);

            cairo_surface_flush(PBUFFER->surface);

            cairo_restore(PCAIRO);

            cairo_pattern_destroy(PATTERN);
        }
    } else if (!m_bRenderInactive) {
        cairo_set_operator(PCAIRO, CAIRO_OPERATOR_SOURCE);
        cairo_set_source_rgba(PCAIRO, 0, 0, 0, 0);
        cairo_rectangle(PCAIRO, 0, 0, PBUFFER->pixelSize.x, PBUFFER->pixelSize.y);
        cairo_fill(PCAIRO);
    } else {
        const auto SCALEBUFS  = pSurface->screenBuffer->pixelSize / PBUFFER->pixelSize;
        const auto PATTERNPRE = cairo_pattern_create_for_surface(pSurface->screenBuffer->surface);
        cairo_pattern_set_filter(PATTERNPRE, CAIRO_FILTER_BILINEAR);
        cairo_matrix_t matrixPre;
        cairo_matrix_init_identity(&matrixPre);
        cairo_matrix_scale(&matrixPre, SCALEBUFS.x, SCALEBUFS.y);
        cairo_pattern_set_matrix(PATTERNPRE, &matrixPre);
        cairo_set_source(PCAIRO, PATTERNPRE);
        cairo_paint(PCAIRO);

        cairo_surface_flush(PBUFFER->surface);

        cairo_pattern_destroy(PATTERNPRE);
    }

    pSurface->sendFrame();
    cairo_destroy(PCAIRO);
    cairo_surface_destroy(PBUFFER->surface);

    PBUFFER->busy    = true;
    PBUFFER->cairo   = nullptr;
    PBUFFER->surface = nullptr;

    pSurface->rendered = true;
}

CColor CHyprpicker::getColorFromPixel(CLayerSurface* pLS, Vector2D pix) {
    void* dataSrc = pLS->screenBuffer->paddedData ? pLS->screenBuffer->paddedData : pLS->screenBuffer->data;
    struct pixel {
        unsigned char blue;
        unsigned char green;
        unsigned char red;
        unsigned char alpha;
    }* px = (struct pixel*)((char*)dataSrc + (int)pix.y * (int)pLS->screenBuffer->pixelSize.x * 4 + (int)pix.x * 4);

    return CColor{(uint8_t)px->red, (uint8_t)px->green, (uint8_t)px->blue, (uint8_t)px->alpha};
}

void CHyprpicker::initKeyboard() {
    m_pKeyboard->setKeymap([this](CCWlKeyboard* r, wl_keyboard_keymap_format format, int32_t fd, uint32_t size) {
        if (!m_pXKBContext)
            return;

        if (format != WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1) {
            Debug::log(ERR, "Could not recognise keymap format");
            return;
        }

        const char* buf = (const char*)mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0);
        if (buf == MAP_FAILED) {
            Debug::log(ERR, "Failed to mmap xkb keymap: %d", errno);
            return;
        }

        m_pXKBKeymap = xkb_keymap_new_from_buffer(m_pXKBContext, buf, size - 1, XKB_KEYMAP_FORMAT_TEXT_V1, XKB_KEYMAP_COMPILE_NO_FLAGS);

        munmap((void*)buf, size);
        close(fd);

        if (!m_pXKBKeymap) {
            Debug::log(ERR, "Failed to compile xkb keymap");
            return;
        }

        m_pXKBState = xkb_state_new(m_pXKBKeymap);
        if (!m_pXKBState) {
            Debug::log(ERR, "Failed to create xkb state");
            return;
        }
    });

    m_pKeyboard->setKey([this](CCWlKeyboard* r, uint32_t serial, uint32_t time, uint32_t key, uint32_t state) {
        if (state != WL_KEYBOARD_KEY_STATE_PRESSED)
            return;

        if (m_pXKBState) {
            if (xkb_state_key_get_one_sym(m_pXKBState, key + 8) == XKB_KEY_Escape)
                finish();
        } else if (key == 1) // Assume keycode 1 is escape
            finish();
    });
}

void CHyprpicker::initMouse() {
    m_pPointer->setEnter([this](CCWlPointer* r, uint32_t serial, wl_resource* surface, wl_fixed_t surface_x, wl_fixed_t surface_y) {
        auto x = wl_fixed_to_double(surface_x);
        auto y = wl_fixed_to_double(surface_y);

        m_vLastCoords = {x, y};

        markDirty();

        for (auto& ls : m_vLayerSurfaces) {
            if (ls->pSurface->resource() == surface) {
                m_pLastSurface = ls.get();
                break;
            }
        }

        m_pCursorShapeDevice->sendSetShape(serial, WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_CROSSHAIR);
    });
    m_pPointer->setLeave([this](CCWlPointer* r, uint32_t timeMs, wl_resource* surf) {
        for (auto& ls : m_vLayerSurfaces) {
            if (ls->pSurface->resource() == surf) {
                renderSurface(ls.get(), true);
            }
        }
    });
    m_pPointer->setMotion([this](CCWlPointer* r, uint32_t timeMs, wl_fixed_t surface_x, wl_fixed_t surface_y) {
        auto x = wl_fixed_to_double(surface_x);
        auto y = wl_fixed_to_double(surface_y);

        m_vLastCoords = {x, y};

        markDirty();
    });
    m_pPointer->setButton([this](CCWlPointer* r, uint32_t serial, uint32_t time, uint32_t button, uint32_t button_state) {
        auto fmax3 = [](float a, float b, float c) -> float { return (a > b && a > c) ? a : (b > c) ? b : c; };
        auto fmin3 = [](float a, float b, float c) -> float { return (a < b && a < c) ? a : (b < c) ? b : c; };

        // relative brightness of a color
        // https://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
        const auto FLUMI = [](const float& c) -> float { return c <= 0.03928 ? c / 12.92 : powf((c + 0.055) / 1.055, 2.4); };

        // get the px and print it
        const auto MOUSECOORDSABS = m_vLastCoords.floor() / m_pLastSurface->m_pMonitor->size;
        const auto CLICKPOS       = MOUSECOORDSABS * m_pLastSurface->screenBuffer->pixelSize;

        const auto COL = getColorFromPixel(m_pLastSurface, CLICKPOS);

        // threshold: (lumi_white + 0.05) / (x + 0.05) == (x + 0.05) / (lumi_black + 0.05)
        // https://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef
        const uint8_t FG = 0.2126 * FLUMI(COL.r / 255.0f) + 0.7152 * FLUMI(COL.g / 255.0f) + 0.0722 * FLUMI(COL.b / 255.0f) > 0.17913 ? 0 : 255;

        switch (m_bSelectedOutputMode) {
            case OUTPUT_CMYK: {
                // http://www.codeproject.com/KB/applications/xcmyk.aspx

                float r = 1 - COL.r / 255.0f, g = 1 - COL.g / 255.0f, b = 1 - COL.b / 255.0f;
                float k = fmin3(r, g, b), K = (k == 1) ? 1 : 1 - k;
                float c = (r - k) / K, m = (g - k) / K, y = (b - k) / K;

                c = std::round(c * 100);
                m = std::round(m * 100);
                y = std::round(y * 100);
                k = std::round(k * 100);

                if (m_bFancyOutput)
                    Debug::log(NONE, "\033[38;2;%i;%i;%i;48;2;%i;%i;%im%g%% %g%% %g%% %g%%\033[0m", FG, FG, FG, COL.r, COL.g, COL.b, c, m, y, k);
                else
                    Debug::log(NONE, "%g%% %g%% %g%% %g%%", c, m, y, k);

                if (m_bAutoCopy)
                    Clipboard::copy("%g%% %g%% %g%% %g%%", c, m, y, k);
                finish();
                break;
            }
            case OUTPUT_HEX: {
                auto toHex = [](int i) -> std::string {
                    const char* DS = "0123456789ABCDEF";

                    std::string result = "";

                    result += DS[i / 16];
                    result += DS[i % 16];

                    return result;
                };

                if (m_bFancyOutput)
                    Debug::log(NONE, "\033[38;2;%i;%i;%i;48;2;%i;%i;%im#%s%s%s\033[0m", FG, FG, FG, COL.r, COL.g, COL.b, toHex(COL.r).c_str(), toHex(COL.g).c_str(),
                               toHex(COL.b).c_str());
                else
                    Debug::log(NONE, "#%s%s%s", toHex(COL.r).c_str(), toHex(COL.g).c_str(), toHex(COL.b).c_str());

                if (m_bAutoCopy)
                    Clipboard::copy("#%s%s%s", toHex(COL.r).c_str(), toHex(COL.g).c_str(), toHex(COL.b).c_str());
                finish();
                break;
            }
            case OUTPUT_RGB: {
                if (m_bFancyOutput)
                    Debug::log(NONE, "\033[38;2;%i;%i;%i;48;2;%i;%i;%im%i %i %i\033[0m", FG, FG, FG, COL.r, COL.g, COL.b, COL.r, COL.g, COL.b);
                else
                    Debug::log(NONE, "%i %i %i", COL.r, COL.g, COL.b);

                if (m_bAutoCopy)
                    Clipboard::copy("%i %i %i", COL.r, COL.g, COL.b);
                finish();
                break;
            }
            case OUTPUT_HSL:
            case OUTPUT_HSV: {
                // https://en.wikipedia.org/wiki/HSL_and_HSV#From_RGB

                auto floatEq = [](float a, float b) -> bool {
                    return std::nextafter(a, std::numeric_limits<double>::lowest()) <= b && std::nextafter(a, std::numeric_limits<double>::max()) >= b;
                };

                float h, s, l, v;
                float r = COL.r / 255.0f, g = COL.g / 255.0f, b = COL.b / 255.0f;
                float max = fmax3(r, g, b), min = fmin3(r, g, b);
                float c = max - min;

                v = max;
                if (c == 0)
                    h = 0;
                else if (v == r)
                    h = 60 * (0 + (g - b) / c);
                else if (v == g)
                    h = 60 * (2 + (b - r) / c);
                else /* v == b */
                    h = 60 * (4 + (r - g) / c);

                float l_or_v;
                if (m_bSelectedOutputMode == OUTPUT_HSL) {
                    l      = (max + min) / 2;
                    s      = (floatEq(l, 0.0f) || floatEq(l, 1.0f)) ? 0 : (v - l) / std::min(l, 1 - l);
                    l_or_v = std::round(l * 100);
                } else {
                    v      = max;
                    s      = floatEq(v, 0.0f) ? 0 : c / v;
                    l_or_v = std::round(v * 100);
                }

                h = std::round(h);
                s = std::round(s * 100);

                if (m_bFancyOutput)
                    Debug::log(NONE, "\033[38;2;%i;%i;%i;48;2;%i;%i;%im%g %g%% %g%%\033[0m", FG, FG, FG, COL.r, COL.g, COL.b, h, s, l_or_v);
                else
                    Debug::log(NONE, "%g %g%% %g%%", h, s, l_or_v);

                if (m_bAutoCopy)
                    Clipboard::copy("%g %g%% %g%%", h, s, l_or_v);
                finish();
                break;
            }
        }

        finish();
    });
}
07070100000023000081A400000000000000000000000166FAB04300000C75000000000000000000000000000000000000002400000000hyprpicker-0.4.1/src/hyprpicker.hpp#pragma once

#include "defines.hpp"
#include "helpers/LayerSurface.hpp"
#include "helpers/PoolBuffer.hpp"

enum eOutputMode {
    OUTPUT_CMYK = 0,
    OUTPUT_HEX,
    OUTPUT_RGB,
    OUTPUT_HSL,
    OUTPUT_HSV
};

class CHyprpicker {
  public:
    void                                        init();

    std::mutex                                  m_mtTickMutex;

    SP<CCWlCompositor>                          m_pCompositor;
    SP<CCWlRegistry>                            m_pRegistry;
    SP<CCWlShm>                                 m_pSHM;
    SP<CCZwlrLayerShellV1>                      m_pLayerShell;
    SP<CCZwlrScreencopyManagerV1>               m_pScreencopyMgr;
    SP<CCWpCursorShapeManagerV1>                m_pCursorShapeMgr;
    SP<CCWpCursorShapeDeviceV1>                 m_pCursorShapeDevice;
    SP<CCWlSeat>                                m_pSeat;
    SP<CCWlKeyboard>                            m_pKeyboard;
    SP<CCWlPointer>                             m_pPointer;
    SP<CCWpFractionalScaleManagerV1>            m_pFractionalMgr;
    SP<CCWpViewporter>                          m_pViewporter;
    wl_display*                                 m_pWLDisplay = nullptr;

    xkb_context*                                m_pXKBContext = nullptr;
    xkb_keymap*                                 m_pXKBKeymap  = nullptr;
    xkb_state*                                  m_pXKBState   = nullptr;

    eOutputMode                                 m_bSelectedOutputMode = OUTPUT_HEX;

    bool                                        m_bFancyOutput = true;

    bool                                        m_bAutoCopy       = false;
    bool                                        m_bRenderInactive = false;
    bool                                        m_bNoZoom         = false;
    bool                                        m_bNoFractional   = false;

    bool                                        m_bRunning = true;

    std::vector<std::unique_ptr<SMonitor>>      m_vMonitors;
    std::vector<std::unique_ptr<CLayerSurface>> m_vLayerSurfaces;

    CLayerSurface*                              m_pLastSurface;

    Vector2D                                    m_vLastCoords;

    void                                        renderSurface(CLayerSurface*, bool forceInactive = false);

    int                                         createPoolFile(size_t, std::string&);
    bool                                        setCloexec(const int&);
    void                                        recheckACK();
    void                                        initKeyboard();
    void                                        initMouse();

    SP<SPoolBuffer>                             getBufferForLS(CLayerSurface*);

    void                                        convertBuffer(SP<SPoolBuffer>);
    void*                                       convert24To32Buffer(SP<SPoolBuffer>);

    void                                        markDirty();

    void                                        finish(int code = 0);

    CColor                                      getColorFromPixel(CLayerSurface*, Vector2D);

  private:
};

inline std::unique_ptr<CHyprpicker> g_pHyprpicker;07070100000024000081A400000000000000000000000166FAB0430000039C000000000000000000000000000000000000002200000000hyprpicker-0.4.1/src/includes.hpp#pragma once

#include <vector>
#include <deque>
#include <iostream>
#include <fstream>
#include <string.h>
#include <string>

#include <pthread.h>
#include <cmath>
#include <math.h>

#include "protocols/cursor-shape-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"

#include <assert.h>
#include <cairo.h>
#include <cairo/cairo.h>
#include <fcntl.h>
#include <getopt.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include <unistd.h>
#include <wayland-client.h>
#include <xkbcommon/xkbcommon.h>

#include <algorithm>
#include <filesystem>
#include <thread>
#include <unordered_map>

#include <hyprutils/memory/WeakPtr.hpp>
using namespace Hyprutils::Memory;

#define SP CSharedPointer
#define WP CWeakPointer
07070100000025000081A400000000000000000000000166FAB04300000F54000000000000000000000000000000000000001E00000000hyprpicker-0.4.1/src/main.cpp#include <strings.h>

#include <iostream>

#include "hyprpicker.hpp"

static void help(void) {
    std::cout << "Hyprpicker usage: hyprpicker [arg [...]].\n\nArguments:\n"
              << " -a | --autocopy          | Automatically copies the output to the clipboard (requires wl-clipboard)\n"
              << " -f | --format=fmt        | Specifies the output format (cmyk, hex, rgb, hsl, hsv)\n"
              << " -n | --no-fancy          | Disables the \"fancy\" (aka. colored) outputting\n"
              << " -h | --help              | Show this help message\n"
              << " -r | --render-inactive   | Render (freeze) inactive displays\n"
              << " -z | --no-zoom           | Disable the zoom lens\n"
              << " -q | --quiet             | Disable most logs (leaves errors)\n"
              << " -v | --verbose           | Enable more logs\n"
              << " -t | --no-fractional     | Disable fractional scaling support\n"
              << " -V | --version           | Print version info\n";
}

int main(int argc, char** argv, char** envp) {
    g_pHyprpicker = std::make_unique<CHyprpicker>();

    while (true) {
        int                  option_index   = 0;
        static struct option long_options[] = {{"autocopy", no_argument, NULL, 'a'},
                                               {"format", required_argument, NULL, 'f'},
                                               {"help", no_argument, NULL, 'h'},
                                               {"no-fancy", no_argument, NULL, 'n'},
                                               {"render-inactive", no_argument, NULL, 'r'},
                                               {"no-zoom", no_argument, NULL, 'z'},
                                               {"no-fractional", no_argument, NULL, 't'},
                                               {"quiet", no_argument, NULL, 'q'},
                                               {"verbose", no_argument, NULL, 'v'},
                                               {"version", no_argument, NULL, 'V'},
                                               {NULL, 0, NULL, 0}};

        int                  c = getopt_long(argc, argv, ":f:hnarzqvtV", long_options, &option_index);
        if (c == -1)
            break;

        switch (c) {
            case 'f':
                if (strcasecmp(optarg, "cmyk") == 0)
                    g_pHyprpicker->m_bSelectedOutputMode = OUTPUT_CMYK;
                else if (strcasecmp(optarg, "hex") == 0)
                    g_pHyprpicker->m_bSelectedOutputMode = OUTPUT_HEX;
                else if (strcasecmp(optarg, "rgb") == 0)
                    g_pHyprpicker->m_bSelectedOutputMode = OUTPUT_RGB;
                else if (strcasecmp(optarg, "hsl") == 0)
                    g_pHyprpicker->m_bSelectedOutputMode = OUTPUT_HSL;
                else if (strcasecmp(optarg, "hsv") == 0)
                    g_pHyprpicker->m_bSelectedOutputMode = OUTPUT_HSV;
                else {
                    Debug::log(NONE, "Unrecognized format %s", optarg);
                    exit(1);
                }
                break;
            case 'h': help(); exit(0);
            case 'n': g_pHyprpicker->m_bFancyOutput = false; break;
            case 'a': g_pHyprpicker->m_bAutoCopy = true; break;
            case 'r': g_pHyprpicker->m_bRenderInactive = true; break;
            case 'z': g_pHyprpicker->m_bNoZoom = true; break;
            case 't': g_pHyprpicker->m_bNoFractional = true; break;
            case 'q': Debug::quiet = true; break;
            case 'v': Debug::verbose = true; break;
            case 'V': {
                std::cout << "hyprpicker v" << HYPRPICKER_VERSION << "\n";
                exit(0);
            }

            default: help(); exit(1);
        }
    }

    if (!isatty(fileno(stdout)) || getenv("NO_COLOR"))
        g_pHyprpicker->m_bFancyOutput = false;

    g_pHyprpicker->init();

    return 0;
}
07070100000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000B00000000TRAILER!!!183 blocks
openSUSE Build Service is sponsored by