From d6f32d35d3233f5dfbb0ed3fd2770dc7c9d0aa91 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Sun, 1 Nov 2020 09:32:20 +0100 Subject: update --- bin/fpac | 8 +++++++- bin/hdmi | 3 ++- bin/icat | 30 ++++++++++++++++++++++++++++-- bin/idot | 4 +++- 4 files changed, 40 insertions(+), 5 deletions(-) (limited to 'bin') diff --git a/bin/fpac b/bin/fpac index db30d36..6207191 100755 --- a/bin/fpac +++ b/bin/fpac @@ -1,3 +1,9 @@ #!/bin/sh # pacman + fzf -pacman -Slq | fzf --no-clear --multi --preview 'cat <(pacman -Si {1}) <(pacman -Fl {1} | awk "{print \$2}")' | xargs -ro sudo pacman -S +#pacman -Slq | fzf --no-clear --multi --preview 'cat <(pacman -Si {1}) <(pacman -Fl {1} | awk "{print \$2}")' | xargs -ro sudo pacman -S +pacman -Slq | +fzf --no-clear --multi \ + --bind=left:preview-page-up --bind=right:preview-page-down \ + --preview-window=right:66% \ + --preview 'cat <(pacman -Si {1}) <(pacman -Fl {1} 2>/dev/null | awk "! /\/$/ {print \$2}")' | +xargs -ro sudo pacman -S diff --git a/bin/hdmi b/bin/hdmi index 75e6f37..0b04531 100755 --- a/bin/hdmi +++ b/bin/hdmi @@ -1,7 +1,8 @@ #!/bin/sh # Toggle auxiliary HDMI screen on/off when connected/disconnected. -opt="--auto --right-of eDP-1" +opt="--auto --left-of eDP-1" +#opt="--auto --right-of eDP-1" #opt="--auto --above eDP-1" # Also add the following rule to /etc/udev/rules.d/hdmi.rules diff --git a/bin/icat b/bin/icat index b15a6d4..702d648 100755 --- a/bin/icat +++ b/bin/icat @@ -1,2 +1,28 @@ -#!/bin/sh -exec convert -resize '800x480>' -flatten -- ${1:--} sixel:- +#!/bin/sh -e +# Display images directly in terminal. +# Tested with xterm v361 + +# maxsize prints the geomtry size of terminal window, with +# a maximum value of 1000 pixels for width and height, or +# 640x480 if size can not be probed. +maxsize() { + [ "$WINDOWID" ] || { echo "640x480>"; return; } + xwininfo -id "$WINDOWID" | { + w=1000 h=1000 + while read -r a b; do + case $a in + (Width:) [ $((b < w)) = 1 ] && w=$b ;; + (Height:) [ $((b < h)) = 1 ] && h=$b ;; + esac + done + echo "${w}x$h" + } +} + +# Use convert(1) from imagemagick to output sixel format. +# -flatten uses the terminal background color as transparent layer +# -resize use the terminal size as bounding box, with a limit of 1000 pixels +# image is not resized if smaller than limit +#exec convert -resize "$(maxsize)>" -transparent-color white -flatten -- ${1:--} sixel:- +# color #rrrrggggbbbb +exec convert -resize "$(maxsize)>" -- ${1:--} sixel:${2:--} diff --git a/bin/idot b/bin/idot index d36d947..44387e8 100755 --- a/bin/idot +++ b/bin/idot @@ -1,2 +1,4 @@ #!/bin/sh -dot -Tpng -Gsize=8 "${1:-}" | convert -- - sixel:- +# dot -Gsize=9 -Nshape=box -Nstyle=rounded -Tsvg | convert -- - sixel:/dev/tty +# dot -Gsize=9 -Nfontname=Helvetica -Tsvg | convert -- - sixel:/-dev/tty +dot -Gsize=9 -Nfontname=Arial -Tpng | icat - /dev/tty -- cgit v1.2.3