config

OpenBSD system configuration
git clone git://jacobedwards.org/config
Log | Files | Refs | README

commit 8c2518af47838af404feda4785616aebd78c3323
parent 385907c4a4e256ef7b7f37916baa49dea28dad26
Author: Jacob R. Edwards <jacobouno@protonmail.com>
Date:   Sun, 14 Feb 2021 21:51:32 -0800

Cleanup wpaper script

Diffstat:
Mmodules/scripts/.local/bin/wpaper | 26++++++++++++--------------
1 file changed, 12 insertions(+), 14 deletions(-)

diff --git a/modules/scripts/.local/bin/wpaper b/modules/scripts/.local/bin/wpaper @@ -1,21 +1,19 @@ -#!/usr/bin/env dash -# Copywrite 2020, 2021 Jacob R. Edwards +#!/bin/sh -e +# Copywrite 2021 Jacob R. Edwards # License: GPLv3 # # wpaper -- wallpaper selection # -# By default all wallpapers under the directory specified by -# `WALLPAPER_DIR' are opened with sxiv, however, if the `s' flag -# is passed, fsmenu will be invoked allowing the selection of any -# directory under `WALLPAPER_DIR'. +# Invoke sxiv(1) on WALLPAPER_DIR, or, if `-s' is given, on a +# directory selected with fsmenu. -set -eu - -if test $# -eq 0; then - sxiv -rtb $WALLPAPER_DIR -elif test "$1" = "-s"; then - sxiv -rtbi `fsmenu $WALLPAPER_DIR -type d` -else +case $* +in +(-s) + exec sxiv -rtb `fsmenu ${WALLPAPER_DIR:?unset} -type d`;; +('') + exec sxiv -rtb ${WALLPAPER_DIR:?unset};; +(*) printf 'usage: %s [-s]\n' `basename $0` 1>&2 exit 1 -fi +esac