From dae97302c821e709654ce25204fd0a7485ce05aa Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Tue, 1 Jun 2021 21:44:12 +0530 Subject: Adds sxiv config --- config/sxiv/exec/image-info | 19 +++++++++++++++++++ config/sxiv/exec/key-handler | 27 +++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100755 config/sxiv/exec/image-info create mode 100755 config/sxiv/exec/key-handler (limited to 'config') diff --git a/config/sxiv/exec/image-info b/config/sxiv/exec/image-info new file mode 100755 index 0000000..155ca0e --- /dev/null +++ b/config/sxiv/exec/image-info @@ -0,0 +1,19 @@ +#!/usr/bin/env sh + +# Example for $XDG_CONFIG_HOME/sxiv/exec/image-info +# Called by sxiv(1) whenever an image gets loaded. +# The output is displayed in sxiv's status bar. +# Arguments: +# $1: path to image file +# $2: image width +# $3: image height + +s=" " # field separator + +exec 2>/dev/null + +filename=$(basename -- "$1") +filesize=$(du -Hh -- "$1" | cut -f 1) +geometry="${2}x${3}" + +echo "${geometry}${s}${filesize}${s}${filename}" diff --git a/config/sxiv/exec/key-handler b/config/sxiv/exec/key-handler new file mode 100755 index 0000000..590af3c --- /dev/null +++ b/config/sxiv/exec/key-handler @@ -0,0 +1,27 @@ +#!/usr/bin/env sh + +# Mod key = Ctrl + x + +rotate() { + degree="$1" + tr '\n' '\0' | xargs -0 realpath | sort | uniq | while read file; do + case "$(file -b -i "$file")" in + image/jpeg*) jpegtran -rotate "$degree" -copy all -outfile "$file" "$file" ;; + *) mogrify -rotate "$degree" "$file" ;; + esac + done +} + +# >, < Rotate +# Thumbnail view +# C-x w Set as wallpaper +# C-x C-c Copy to clipboard + +case "$1" in +# Copy image to clipboard +"C-c") while read file; do xclip -selection clipboard -target image/png "$file"; done ;; + +# Set as wallpaper +"w") while read file; do feh --bg-scale "$file"; done ;; +esac + -- cgit v1.3.1