aboutsummaryrefslogtreecommitdiff
path: root/hypr/hypr-zoom
diff options
context:
space:
mode:
Diffstat (limited to 'hypr/hypr-zoom')
-rw-r--r--hypr/hypr-zoom/.github/workflows/main.yml33
-rwxr-xr-xhypr/hypr-zoom/exec.sh8
-rw-r--r--hypr/hypr-zoom/go.mod5
-rw-r--r--hypr/hypr-zoom/go.sum2
-rw-r--r--hypr/hypr-zoom/hypr-zoom.go143
-rw-r--r--hypr/hypr-zoom/readme.md104
6 files changed, 0 insertions, 295 deletions
diff --git a/hypr/hypr-zoom/.github/workflows/main.yml b/hypr/hypr-zoom/.github/workflows/main.yml
deleted file mode 100644
index ab277d7..0000000
--- a/hypr/hypr-zoom/.github/workflows/main.yml
+++ /dev/null
@@ -1,33 +0,0 @@
-name: Build and upliad artifact
-
-on:
- push:
- branches: [ "main" ]
- pull_request:
- branches: [ "main" ]
-
-jobs:
- build:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v4
-
- - name: Set up Go
- uses: actions/setup-go@v4
- with:
- go-version: '1.23'
-
- - name: Build
- run: go build -v -o hypr-zoom ./hypr-zoom.go # Specify the output binary name
-
- - name: Delete Previous artifact
- uses: geekyeggo/delete-artifact@v5
- with:
- name: hypr-zoom
- failOnError: false
-
- - name: Upload Artifact
- uses: actions/upload-artifact@v4
- with:
- name: hypr-zoom
- path: hypr-zoom
diff --git a/hypr/hypr-zoom/exec.sh b/hypr/hypr-zoom/exec.sh
deleted file mode 100755
index d83b73e..0000000
--- a/hypr/hypr-zoom/exec.sh
+++ /dev/null
@@ -1,8 +0,0 @@
-file="~/.config/hypr/hypr-zoom/hypr-zoom"
-if [ -f "$file" ]; then
- ./hypr-zoom -duration=10 -steps=50 -interp=Linear
-else
- cd ~/.config/hypr/hypr-zoom/
- go build -o hypr-zoom
- ./hypr-zoom -duration=10 -steps=50 -interp=Linear
-fi
diff --git a/hypr/hypr-zoom/go.mod b/hypr/hypr-zoom/go.mod
deleted file mode 100644
index 32db86a..0000000
--- a/hypr/hypr-zoom/go.mod
+++ /dev/null
@@ -1,5 +0,0 @@
-module hypr-zoom
-
-go 1.22.5
-
-require github.com/fogleman/ease v0.0.0-20170301025033-8da417bf1776 // indirect
diff --git a/hypr/hypr-zoom/go.sum b/hypr/hypr-zoom/go.sum
deleted file mode 100644
index 8254f11..0000000
--- a/hypr/hypr-zoom/go.sum
+++ /dev/null
@@ -1,2 +0,0 @@
-github.com/fogleman/ease v0.0.0-20170301025033-8da417bf1776 h1:VRIbnDWRmAh5yBdz+J6yFMF5vso1It6vn+WmM/5l7MA=
-github.com/fogleman/ease v0.0.0-20170301025033-8da417bf1776/go.mod h1:9wvnDu3YOfxzWM9Cst40msBF1C2UdQgDv962oTxSuMs=
diff --git a/hypr/hypr-zoom/hypr-zoom.go b/hypr/hypr-zoom/hypr-zoom.go
deleted file mode 100644
index d77606c..0000000
--- a/hypr/hypr-zoom/hypr-zoom.go
+++ /dev/null
@@ -1,143 +0,0 @@
-package main
-
-import (
- "flag"
- "fmt"
- "math"
- "os/exec"
- "strconv"
- "strings"
- "time"
-
- "github.com/fogleman/ease"
-)
-
-type EasingFunction func(t float64) float64
-type InterpolatorFunc func(s, e, t float64) float64
-
-// Linear interpolation function
-func lerp(start, end, t float64) float64 {
- return start + t*(end-start)
-}
-
-func logInterp(start, end, t float64) float64 {
- if t == 0 {
- return start
- }
- return start + (end-start)*(math.Log(t+1)/math.Log(2))
-}
-
-// Main animation loop
-func zoom(duration int, steps int, startValue, endValue float64, easingFunc EasingFunction, interInterpolatorFunc InterpolatorFunc) {
- interval := float64(duration) / float64(steps) / 1000
-
- for i := 0; i <= steps; i++ {
- t := float64(i) / float64(steps)
- easedT := easingFunc(t)
- interpolatedValue := interInterpolatorFunc(startValue, endValue, easedT)
-
- _ = exec.Command("hyprctl", "keyword", "cursor:zoom_factor", fmt.Sprintf("%f", interpolatedValue)).Run()
- time.Sleep(time.Duration(interval * float64(time.Second)))
- }
-}
-
-// Execute a shell command and return its output as a string
-func executeCommand(command string) (string, error) {
- output, err := exec.Command("bash", "-c", command).Output()
- if err != nil {
- return "", err
- }
- return string(output), nil
-}
-
-func main() {
- output, err := executeCommand("hyprctl getoption cursor:zoom_factor | grep 'float:' | awk '{print $2}' | tr -d '[:space:]'")
- if err != nil {
- fmt.Println("Error getting initial zoom factor:", err)
- return
- }
-
- duration := flag.Int("duration", 500, "Duration of the animation in milliseconds")
- steps := flag.Int("steps", 100, "Number of steps in the animation")
- easing := flag.String("easing", "InOutExpo", "Easing function to use")
- easingOut := flag.String("easingOut", "", "Easing function to use for zoom-out (optional)")
- targetZoom := flag.Float64("target", 2.0, "Zoom Target")
- interpolator := flag.String("interp", "Log", "Animation interpolator function")
- force := flag.Bool("force", false, "Forcing target parameter even if zoom is not equal to 1")
- flag.Parse()
-
- initialZoom, err := strconv.ParseFloat(strings.TrimSpace(output), 64)
- if err != nil {
- fmt.Println("Error parsing initial zoom factor:", err)
- return
- }
-
- if *steps <= 0 {
- fmt.Println("Error: `steps` must be greater than 0.")
- return
- }
-
- easingFunctions := map[string]EasingFunction{
- "Linear": ease.Linear,
- "InQuad": ease.InQuad,
- "OutQuad": ease.OutQuad,
- "InOutQuad": ease.InOutQuad,
- "InCubic": ease.InCubic,
- "OutCubic": ease.OutCubic,
- "InOutCubic": ease.InOutCubic,
- "InQuart": ease.InQuart,
- "OutQuart": ease.OutQuart,
- "InOutQuart": ease.InOutQuart,
- "InQuint": ease.InQuint,
- "OutQuint": ease.OutQuint,
- "InOutQuint": ease.InOutQuint,
- "InSine": ease.InSine,
- "OutSine": ease.OutSine,
- "InOutSine": ease.InOutSine,
- "InExpo": ease.InExpo,
- "OutExpo": ease.OutExpo,
- "InOutExpo": ease.InOutExpo,
- "InCirc": ease.InCirc,
- "OutCirc": ease.OutCirc,
- "InOutCirc": ease.InOutCirc,
- // "InElastic": ease.InElastic,
- // "OutElastic": ease.OutElastic,
- // "InOutElastic": ease.InOutElastic,
- "InBack": ease.InBack,
- "OutBack": ease.OutBack,
- "InOutBack": ease.InOutBack,
- "InBounce": ease.InBounce,
- "OutBounce": ease.OutBounce,
- "InOutBounce": ease.InOutBounce,
- "InSquare": ease.InSquare,
- "OutSquare": ease.OutSquare,
- "InOutSquare": ease.InOutSquare,
- }
-
- interpolatorFunctions := map[string]InterpolatorFunc{
- "Log": logInterp,
- "Linear": lerp,
- }
-
- interpolatorFunc, exists := interpolatorFunctions[*interpolator]
- if !exists {
- fmt.Println("Unknown interpolator function:", *interpolator, "Set to default")
- interpolatorFunc = interpolatorFunctions["Log"]
- }
-
- easingFunction, exists := easingFunctions[*easing]
- if !exists {
- fmt.Println("Unknown easing function:", *easing, "Set to default")
- easingFunction = easingFunctions["InOutExpo"]
- }
-
- if (initialZoom > 1 && !*force) {
- *targetZoom = 1.0
- _, exists := easingFunctions[*easingOut]
- if exists {
- easingFunction = easingFunctions[*easingOut]
- }
- }
-
- zoom(*duration, *steps, initialZoom, *targetZoom, easingFunction, interpolatorFunc)
-}
diff --git a/hypr/hypr-zoom/readme.md b/hypr/hypr-zoom/readme.md
deleted file mode 100644
index ab938ad..0000000
--- a/hypr/hypr-zoom/readme.md
+++ /dev/null
@@ -1,104 +0,0 @@
-# hypr-zoom
-
-`hypr-zoom` is a command-line tool written in Go that smoothly animates the Hyprland cursor zoom-factor changes using variety of easing functions.
-It simply uses the `hyprctl` command to adjust the cursor zoom-factor and the ease library for animation interpolation.
-
-## Why ?
-Hyprland cursor zoom factor changes happen instantly, which can feel ood since Hyprland has cool animations. This little CLI solves that.
-
-## Features
-
-- Smoothly animates cursor zoom-factor using a variety of easing and interpolation functions.
-- Configurable animation duration and steps.
-
-## Installation
-install from aur: [hypr-zoom](https://aur.archlinux.org/packages/hypr-zoom)
-
-Grab from release or :
-1. Clone the repository:
- ```sh
- git clone https://github.com/FaqihS/hypr-zoom.git
- cd hypr-zoom
- ```
-
-2. Build the project:
- ```sh
- go build -o hypr-zoom
- ```
-
-## Usage
-
-The `hypr-zoom` command has several flags to configure the animation:
-
-- `-duration`: Duration of the animation in milliseconds (default: 500)
-- `-steps`: Number of steps in the animation (default: 100)
-- `-easing`: Easing function to use for the animation (default: InOutExpo)
-- `-easingOut`: Easing function to use for the zoom-out animation (optional)
-- `-target`: Target zoom factor (default: 2.0)
-- `-interp`: Interpolation Function used for animation(default: Log)
-- `-force` : Forcing target parameter (default: false)
-
-### Example
-
-```sh
-hypr-zoom -easing=InOutExpo -duration=500 -steps=60 -target=1.2
-```
-
-This command will animate the zoom factor to 1.2 using the InOutExpo easing function over 500 milliseconds with 60 steps.
-
-```sh
-hypr-zoom -easing=OutBack -easingOut=OutExpo
-```
-
-This command will animate the zoom factor using the OutBack easing function when zooming-in and OutExpo when zooming-out.
-
-> [!WARNING]
-> Adjust duration and steps wisely.
-
-### Supported Easing Functions
-The following easing functions are supported:
-
-- Linear
-- InQuad, OutQuad, InOutQuad
-- InCubic, OutCubic, InOutCubic
-- InQuart, OutQuart, InOutQuart
-- InQuint, OutQuint, InOutQuint
-- InSine, OutSine, InOutSine
-- InExpo, OutExpo, InOutExpo
-- InCirc, OutCirc, InOutCirc
-- InBack, OutBack, InOutBack
-- InBounce, OutBounce, InOutBounce
-- InSquare, OutSquare, InOutSquare
-
-For animation preview [see here](https://github.com/fogleman/ease).
-
-### Supported Interpolation function
-- Linear
-- Log (Logarithmic)
-
-## Showcase
-### Default+Linear
-```sh
-hypr-zoom -interp=Linear
-```
-https://github.com/user-attachments/assets/261aff62-955f-49e6-9a7b-c5f714389dc4
-### InOutCubic
-```sh
-hypr-zoom -easing=InOutCubic -interp=Linear
-```
-https://github.com/user-attachments/assets/622d4a4b-b805-495d-8178-ad5e130279c2
-### OutBack-Inback
-```sh
-hypr-zoom -duration=600 -steps=150 -easing=OutBack -easingOut=InBack -interp=Linear
-```
-https://github.com/user-attachments/assets/de4f2924-b5e8-43a8-9bbf-6f1ac795687c
-
-
-
-
-## Contributing
-Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes. Although i'm not real Go Dev :p
-
-## Acknowledgements
-- [fogleman/ease](https://github.com/fogleman/ease) - Easing functions library used in this project.
-- [Hyprland](https://hyprland.org)