From 9d3ef99adbc8613f82402d71ca314d9c841dfd2d Mon Sep 17 00:00:00 2001 From: Miran Bastaja Date: Mon, 16 Sep 2024 10:56:03 +0200 Subject: foot: add icat alias for priting out images --- share/cfg/foot.nix | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'share/cfg/foot.nix') diff --git a/share/cfg/foot.nix b/share/cfg/foot.nix index 310283c..9786e5e 100644 --- a/share/cfg/foot.nix +++ b/share/cfg/foot.nix @@ -1,4 +1,9 @@ -{ config, pkgs, ... }: +{ + config, + pkgs, + lib, + ... +}: let cfg = config.programs.foot; foot-pkg = pkgs.symlinkJoin { @@ -25,4 +30,20 @@ in }; }; }; + + programs.fish.functions.icat = + # TODO: find window manager agnostic way to get current window size + lib.mkIf (cfg.enable && config.wayland.windowManager.hyprland.enable) { + body = '' + set --local width $(hyprctl -j activewindow | jaq '.size[0]') + set --local maximgwidth $(math "ceil($width * 0.7)") + img2sixel --width $maximgwidth $argv + ''; + }; + + home.packages = lib.mkIf cfg.enable ( + builtins.attrValues { + inherit (pkgs) libsixel jaq hyprland; + } + ); } -- cgit v1.3.1