aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSylvain Herlédan <sylvain.herledan@hrafnagud.info>2017-06-03 15:51:13 +0200
committerSylvain Herlédan <sylvain.herledan@hrafnagud.info>2017-06-03 15:51:13 +0200
commit67c379658432bca5a13eb0f3dcd8f1db16a54f20 (patch)
tree95988dc5b011673c846c8d414b799f6f308e1db1
parente33ad4f128fb8fef2119cf2c71371eaf9c19bd29 (diff)
downloaddotfiles-67c379658432bca5a13eb0f3dcd8f1db16a54f20.tar.gz
dotfiles-67c379658432bca5a13eb0f3dcd8f1db16a54f20.tar.bz2
dotfiles-67c379658432bca5a13eb0f3dcd8f1db16a54f20.zip
Add sxiv installation.
-rwxr-xr-xbin/image-info.sh23
-rwxr-xr-xsetup.sh28
2 files changed, 50 insertions, 1 deletions
diff --git a/bin/image-info.sh b/bin/image-info.sh
new file mode 100755
index 0000000..fb2664b
--- /dev/null
+++ b/bin/image-info.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+# Example for ~/.config/sxiv/exec/image-info
+# Called by sxiv(1) whenever an image gets loaded,
+# with the name of the image file as its first argument.
+# The output is displayed in sxiv's status bar.
+
+s=" | " # field separator
+
+filename=$(basename "$1")
+filesize=$(du -Hh "$1" | cut -f 1)
+
+# The '[0]' stands for the first frame of a multi-frame file, e.g. gif.
+# Requires imagemagick
+geometry=$(identify -format '%wx%h' "$1[0]")
+
+tags=""
+# Requires exiv2
+#tags=$(exiv2 -q pr -pi "$1" | awk '$1~"Keywords" { printf("%s,", $4); }')
+#tags=${tags%,}
+
+echo "${filesize}${s}${geometry}${tags:+$s}${tags}${s}${filename}"
+
diff --git a/setup.sh b/setup.sh
index 4f61e9f..3eeb729 100755
--- a/setup.sh
+++ b/setup.sh
@@ -66,6 +66,24 @@ function install_st()
fi
}
+# Sxiv installation -----------------------------------------------------------
+# -----------------------------------------------------------------------------
+install_sxiv()
+{
+ local tools_dir="${1}"; shift;
+ local install_dir="${1}"; shift;
+
+ if [ ! -f "${install_dir}/bin/sxiv" ];
+ then
+ if [ ! -d "${tools_dir}/sxiv" ];
+ then
+ git clone "https://github.com/muennich/sxiv.git" "${tools_dir}/sxiv"
+ fi
+ cd "${tools_dir}/sxiv"
+ make PREFIX="${install_dir}" install
+ fi
+}
+
# Dein installation -----------------------------------------------------------
#
# Dein is a manager for vim plugins.
@@ -142,6 +160,9 @@ create_symlinks()
rm -rf "${install_dir}/.config/dunst"
ln -sfT "${cfg_dir}/dunst" "${install_dir}/.config/dunst"
+
+ rm -rf "${install_dir}/.config/sxiv"
+ ln -sfT "${cfg_dir}/sxiv" "${install_dir}/.config/sxiv"
}
# Directory creation ----------------------------------------------------------
@@ -157,6 +178,8 @@ function create_dirs()
mkdir -p "${root_dir}/.local/config/dunst"
mkdir -p "${root_dir}/.local/config/i3"
mkdir -p "${root_dir}/.local/config/git"
+ mkdir -p "${root_dir}/.local/config/sxiv"
+ mkdir -p "${root_dir}/.local/config/sxiv/exec"
mkdir -p "${root_dir}/docs/downloads"
mkdir -p "${root_dir}/docs/screenshots"
@@ -192,6 +215,8 @@ function copy_files()
"${dst_dir}/.local/config/xinitrc"
cp -r "${src_dir}/dunstrc" \
"${dst_dir}/.local/config/dunst/dunstrc"
+ cp -r "${src_dir}/bin/image-info.sh" \
+ "${dst_dir}/.local/config/sxiv/exec/image-info"
configure_rtorrent "${src_dir}" "${dst_dir}"
}
@@ -228,7 +253,7 @@ configure_rtorrent()
check_requirements()
{
local requirements="git make wget i3";
- local optional_deps="notify-send dunst pulseaudio scrot sudo redshift numlockx";
+ local optional_deps="notify-send dunst pulseaudio scrot sudo redshift numlockx identify";
local requirements_not_met=0;
for cmd in ${optional_deps};
@@ -281,6 +306,7 @@ main()
install_st "${tools_dir}" "${local_dir}"
install_dein "${tools_dir}" "${local_dir}"
install_oh_my_zsh "${tools_dir}" "${local_dir}"
+ install_sxiv "${tools_dir}" "${local_dir}"
create_symlinks "${cfg_dir}" "${HOME}"
configure_xdg "${HOME}"