mirror of
https://github.com/hyprwm/hyprpicker.git
synced 2026-05-08 21:18:02 +02:00
Merge branch 'main' into fix/missing-include
This commit is contained in:
commit
7b7abb4a04
8 changed files with 97 additions and 105 deletions
53
.github/workflows/nix-build.yaml
vendored
53
.github/workflows/nix-build.yaml
vendored
|
|
@ -1,50 +1,11 @@
|
|||
name: Build Hyprpicker (Nix)
|
||||
name: Build
|
||||
|
||||
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: nixbuild/nix-quick-install-action@v31
|
||||
with:
|
||||
nix_conf: |
|
||||
keep-env-derivations = true
|
||||
keep-outputs = true
|
||||
|
||||
- name: Restore and save Nix store
|
||||
uses: nix-community/cache-nix-action@v6
|
||||
with:
|
||||
# restore and save a cache using this key
|
||||
primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', '**/flake.lock') }}
|
||||
# if there's no cache hit, restore a cache by this prefix
|
||||
restore-prefixes-first-match: nix-${{ runner.os }}-
|
||||
# collect garbage until the Nix store size (in bytes) is at most this number
|
||||
# before trying to save a new cache
|
||||
# 1G = 1073741824
|
||||
gc-max-store-size-linux: 1G
|
||||
# do purge caches
|
||||
purge: true
|
||||
# purge all versions of the cache
|
||||
purge-prefixes: nix-${{ runner.os }}-
|
||||
# created more than this number of seconds ago
|
||||
purge-created: 0
|
||||
# or, last accessed more than this number of seconds ago
|
||||
# relative to the start of the `Post Restore and save Nix store` phase
|
||||
purge-last-accessed: 0
|
||||
# except any version with the key that is the same as the `primary-key`
|
||||
purge-primary-key: never
|
||||
|
||||
- uses: cachix/cachix-action@v16
|
||||
with:
|
||||
name: hyprland
|
||||
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
||||
|
||||
- name: Build Hyprpicker with default settings
|
||||
run: nix build --print-build-logs --accept-flake-config
|
||||
if: (github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork)
|
||||
uses: hyprwm/actions/.github/workflows/nix.yml@main
|
||||
secrets: inherit
|
||||
with:
|
||||
command: nix build --print-build-logs --accept-flake-config
|
||||
|
|
|
|||
18
flake.lock
generated
18
flake.lock
generated
|
|
@ -10,11 +10,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1749135356,
|
||||
"narHash": "sha256-Q8mAKMDsFbCEuq7zoSlcTuxgbIBVhfIYpX0RjE32PS0=",
|
||||
"lastModified": 1772459870,
|
||||
"narHash": "sha256-xxkK2Cvqxpf/4UGcJ/TyCwrvmiNWsKsJfFzHMp2bxis=",
|
||||
"owner": "hyprwm",
|
||||
"repo": "hyprutils",
|
||||
"rev": "e36db00dfb3a3d3fdcc4069cb292ff60d2699ccb",
|
||||
"rev": "e63f3a79334dec49f8eb1691f66f18115df04085",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -33,11 +33,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1749145760,
|
||||
"narHash": "sha256-IHaGWpGrv7seFWdw/1A+wHtTsPlOGIKMrk1TUIYJEFI=",
|
||||
"lastModified": 1772459835,
|
||||
"narHash": "sha256-978jRz/y/9TKmZb/qD4lEYHCQGHpEXGqy+8X2lFZsak=",
|
||||
"owner": "hyprwm",
|
||||
"repo": "hyprwayland-scanner",
|
||||
"rev": "817918315ea016cc2d94004bfb3223b5fd9dfcc6",
|
||||
"rev": "0a692d4a645165eebd65f109146b8861e3a925e7",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -48,11 +48,11 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1748929857,
|
||||
"narHash": "sha256-lcZQ8RhsmhsK8u7LIFsJhsLh/pzR9yZ8yqpTzyGdj+Q=",
|
||||
"lastModified": 1772433332,
|
||||
"narHash": "sha256-izhTDFKsg6KeVBxJS9EblGeQ8y+O8eCa6RcW874vxEc=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "c2a03962b8e24e669fb37b7df10e7c79531ff1a4",
|
||||
"rev": "cf59864ef8aa2e178cccedbe2c178185b0365705",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
|||
66
flake.nix
66
flake.nix
|
|
@ -18,46 +18,32 @@
|
|||
};
|
||||
};
|
||||
|
||||
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];
|
||||
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-with-deps ];
|
||||
}
|
||||
);
|
||||
in
|
||||
{
|
||||
overlays = import ./nix/overlays.nix { inherit inputs lib self; };
|
||||
|
||||
packages = eachSystem (system: {
|
||||
default = self.packages.${system}.hyprpicker;
|
||||
inherit (pkgsFor.${system}) hyprpicker hyprpicker-debug;
|
||||
});
|
||||
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.gcc15Stdenv;
|
||||
version = version + "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty");
|
||||
};
|
||||
hyprpicker-debug = final.hyprpicker.override {debug = true;};
|
||||
})
|
||||
];
|
||||
|
||||
formatter = eachSystem (system: pkgsFor.${system}.nixfmt-tree);
|
||||
};
|
||||
|
||||
packages = eachSystem (system: {
|
||||
default = self.packages.${system}.hyprpicker;
|
||||
inherit (pkgsFor.${system}) hyprpicker hyprpicker-debug;
|
||||
});
|
||||
|
||||
formatter = eachSystem (system: pkgsFor.${system}.alejandra);
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
libselinux,
|
||||
libsepol,
|
||||
libthai,
|
||||
libXdmcp,
|
||||
libxkbcommon,
|
||||
pango,
|
||||
pcre,
|
||||
|
|
@ -21,7 +22,6 @@
|
|||
wayland,
|
||||
wayland-protocols,
|
||||
wayland-scanner,
|
||||
xorg,
|
||||
debug ? false,
|
||||
version ? "git",
|
||||
}:
|
||||
|
|
@ -31,10 +31,7 @@ stdenv.mkDerivation {
|
|||
|
||||
src = ../.;
|
||||
|
||||
cmakeBuildType =
|
||||
if debug
|
||||
then "Debug"
|
||||
else "Release";
|
||||
cmakeBuildType = if debug then "Debug" else "Release";
|
||||
|
||||
nativeBuildInputs = [
|
||||
cmake
|
||||
|
|
@ -52,6 +49,7 @@ stdenv.mkDerivation {
|
|||
libselinux
|
||||
libsepol
|
||||
libthai
|
||||
libXdmcp
|
||||
libxkbcommon
|
||||
pango
|
||||
pcre
|
||||
|
|
@ -60,7 +58,6 @@ stdenv.mkDerivation {
|
|||
wayland
|
||||
wayland-protocols
|
||||
wayland-scanner
|
||||
xorg.libXdmcp
|
||||
];
|
||||
|
||||
outputs = [
|
||||
|
|
|
|||
37
nix/overlays.nix
Normal file
37
nix/overlays.nix
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
{
|
||||
lib,
|
||||
inputs,
|
||||
self,
|
||||
...
|
||||
}:
|
||||
let
|
||||
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
|
||||
{
|
||||
default = self.overlays.hyprpicker;
|
||||
hyprpicker-with-deps = lib.composeManyExtensions [
|
||||
inputs.hyprutils.overlays.default
|
||||
inputs.hyprwayland-scanner.overlays.default
|
||||
self.overlays.hyprpicker
|
||||
];
|
||||
|
||||
hyprpicker = final: prev: {
|
||||
hyprpicker = prev.callPackage ./default.nix {
|
||||
stdenv = prev.gcc15Stdenv;
|
||||
version =
|
||||
version
|
||||
+ "+date="
|
||||
+ (mkDate (self.lastModifiedDate or "19700101"))
|
||||
+ "_"
|
||||
+ (self.shortRev or "dirty");
|
||||
};
|
||||
hyprpicker-debug = final.hyprpicker.override { debug = true; };
|
||||
};
|
||||
}
|
||||
|
|
@ -1,10 +1,12 @@
|
|||
#include "hyprpicker.hpp"
|
||||
#include "src/debug/Log.hpp"
|
||||
#include "src/notify/Notify.hpp"
|
||||
#include <cmath>
|
||||
#include <csignal>
|
||||
#include <cstddef>
|
||||
#include <cstdio>
|
||||
#include <format>
|
||||
#include <mutex>
|
||||
#include <hyprutils/math/Vector2D.hpp>
|
||||
#include <wayland-client-protocol.h>
|
||||
#include <xkbcommon/xkbcommon-keysyms.h>
|
||||
|
|
@ -786,10 +788,19 @@ void CHyprpicker::initMouse() {
|
|||
|
||||
double delta = wl_fixed_to_double(value);
|
||||
|
||||
if (delta < 0)
|
||||
m_fZoomScale = std::min(m_fZoomScale + 1.0, 100.0);
|
||||
double velocity = std::pow(M_E, m_fZoomScale * 0.01) - 1.;
|
||||
|
||||
delta *= velocity;
|
||||
|
||||
if (delta > 0)
|
||||
delta = std::min(delta, 1.);
|
||||
else
|
||||
m_fZoomScale = std::max(m_fZoomScale - 1.0, 1.0);
|
||||
delta = std::max(delta, -1.);
|
||||
|
||||
if (delta > 0)
|
||||
m_fZoomScale = std::max(m_fZoomScale - delta, 1.);
|
||||
else
|
||||
m_fZoomScale = std::min(m_fZoomScale - delta, 100.);
|
||||
|
||||
markDirty();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <mutex>
|
||||
|
||||
#include "defines.hpp"
|
||||
#include "helpers/LayerSurface.hpp"
|
||||
#include "helpers/PoolBuffer.hpp"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#include <cstdint>
|
||||
#include <format>
|
||||
#include <regex>
|
||||
#include <charconv>
|
||||
#include <strings.h>
|
||||
|
||||
#include <iostream>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue