From 5e5ba5a5dad2c75cd723fd6005d3a1dad01b4c20 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Tue, 17 Feb 2026 00:19:29 -0500 Subject: [PATCH] fix(hyprland): pinch to zoom --- config/hypr/hyprland.conf | 4 ++-- config/nvim/after/ftplugin/typst.lua | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 config/nvim/after/ftplugin/typst.lua diff --git a/config/hypr/hyprland.conf b/config/hypr/hyprland.conf index 723fd47..f96a7d7 100644 --- a/config/hypr/hyprland.conf +++ b/config/hypr/hyprland.conf @@ -60,8 +60,8 @@ animations { } gestures { - gesture = 2, pinchin, cursorZoom, 1.75 - gesture = 2, pinchout, cursorZoom, -1.75 + gesture = 2, pinchin, cursorZoom, 1.5, mult + gesture = 2, pinchout, cursorZoom, 0.667, mult gesture = 3, horizontal, workspace gesture = 3, down, dispatcher, exec, ctl wallpaper lock && hyprlock } diff --git a/config/nvim/after/ftplugin/typst.lua b/config/nvim/after/ftplugin/typst.lua new file mode 100644 index 0000000..9a418a6 --- /dev/null +++ b/config/nvim/after/ftplugin/typst.lua @@ -0,0 +1,21 @@ +vim.keymap.set('n', 't', function() + if vim.fn.executable('sioyek') ~= 1 then + return vim.notify('sioyek not found', vim.log.levels.ERROR) + end + if vim.fn.executable('hyprctl') ~= 1 then + return vim.notify('hyprctl not found', vim.log.levels.ERROR) + end + local pdf = vim.fn.expand('%:p:r') .. '.pdf' + local basename = vim.fn.fnamemodify(pdf, ':t') + local ret = vim.system({ 'hyprctl', 'clients', '-j' }):wait() + if ret.code == 0 then + for _, c in ipairs(vim.json.decode(ret.stdout)) do + if (c.class or ''):lower():find('sioyek') + and (c.title or ''):find(basename, 1, true) then + vim.system({ 'hyprctl', 'dispatch', 'closewindow', 'address:' .. c.address }) + return + end + end + end + vim.system({ 'sioyek', pdf }) +end, { buffer = true })