From 00997d20e5bf2a7f58775f1f3ab419bb6345f7cf Mon Sep 17 00:00:00 2001 From: kd Date: Fri, 27 Mar 2020 14:09:32 -0400 Subject: added a couple new scrpit for wallpapers --- Scripts/.config/Scripts/setbg | 21 +++++++++++++++++++++ Scripts/.config/Scripts/wp | 4 ++++ sxiv/.config/sxiv/exec/image-info | 20 ++++++++++++++++++++ sxiv/.config/sxiv/exec/key-handler | 38 ++++++++++++++++++++++++++------------ 4 files changed, 71 insertions(+), 12 deletions(-) create mode 100755 Scripts/.config/Scripts/setbg create mode 100755 Scripts/.config/Scripts/wp create mode 100755 sxiv/.config/sxiv/exec/image-info diff --git a/Scripts/.config/Scripts/setbg b/Scripts/.config/Scripts/setbg new file mode 100755 index 0000000..2487072 --- /dev/null +++ b/Scripts/.config/Scripts/setbg @@ -0,0 +1,21 @@ +#!/bin/bash + +# if given an argument, moves it there. This script without an +# argument sets ~/.config/wall.png as the wallpaper, which is required on login +# if you don't want a black screen. +# +# You may also give a directory name to select a random image from that +# directory as a wallpaper. Be careful that the directory only has images. + + +WALLPAPER_HOME="$HOME/Pictures/plasma_wal_hack" + +[ -f "$1" ] && rm -f $WALLPAPER_HOME/* && cp "$1" "$WALLPAPER_HOME" && notify-send -i "$WALLPAPER_HOME/$1" "Wallpaper changed." + +[ -d "$1" ] && rm -f $WALLPAPER_HOME/* && cp "$(find "$1" -name "*.jpg" -o -name "*.jpeg" -o -name "*.png" -type f | shuf -n 1)" "$WALLPAPER_HOME" && notify-send -i "$WALLPAPER_HOME/$1" "Random Wallpaper chosen." + +# If pywal is installed, use it. +type wal >/dev/null 2>&1 && { wal -c + wal -i "$WALLPAPER_HOME/$i" -n + xsetroot -name "fsignal:xrdb" & } >/dev/null 2>&1 + diff --git a/Scripts/.config/Scripts/wp b/Scripts/.config/Scripts/wp new file mode 100755 index 0000000..e36b9e0 --- /dev/null +++ b/Scripts/.config/Scripts/wp @@ -0,0 +1,4 @@ +#!/bin/sh + +find $HOME/Pictures/wallpapers -type f | shuf | sxiv - + diff --git a/sxiv/.config/sxiv/exec/image-info b/sxiv/.config/sxiv/exec/image-info new file mode 100755 index 0000000..20c10c1 --- /dev/null +++ b/sxiv/.config/sxiv/exec/image-info @@ -0,0 +1,20 @@ +#!/usr/bin/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 "${filesize}${s}${geometry}${s}${filename}" + diff --git a/sxiv/.config/sxiv/exec/key-handler b/sxiv/.config/sxiv/exec/key-handler index ea57b25..d9f1825 100755 --- a/sxiv/.config/sxiv/exec/key-handler +++ b/sxiv/.config/sxiv/exec/key-handler @@ -1,18 +1,32 @@ -#!/bin/bash - +#!/usr/bin/env sh while read file do case "$1" in - "r") - convert -rotate 90 "$file" "$file" ;; + "w") setbg "$file" & ;; "c") - echo -n "$file" | xclip -selection clipboard ;; - "C") - echo -n "${file##*/}" | xclip -selection clipboard ;; - "w") - cp "$file" ~/.config/wall1.jpg && wal -c -i "$file" && sudo make -C ~/st/ clean install & ;; - "b") - st -e cp "$file" ~/.config/wall1.jpg && wal -c -i "$file" && sudo make -C ~/st/ clean install & ;; + [ -z "$destdir" ] && destdir="$(sed "s/\s.*#.*$//;/^\s*$/d" ~/.config/directories | awk '{print $2}' | dmenu -l 20 -i -p "Copy file(s) to where?" | sed "s|~|$HOME|g")" + [ -z "$destdir" ] && exit + cp "$file" "$destdir" && notify-send -i "$(readlink -f "$file")" "$file copied to $destdir." & + ;; + "m") + [ -z "$destdir" ] && destdir="$(sed "s/\s.*#.*$//;/^\s*$/d" ~/.config/directories | awk '{print $2}' | dmenu -l 20 -i -p "Move file(s) to where?" | sed "s|~|$HOME|g")" + [ -z "$destdir" ] && exit + mv "$file" "$destdir" && notify-send -i "$(readlink -f "$file")" "$file moved to $destdir." & + ;; + "r") + convert -rotate 90 "$file" "$file" ;; + "R") + convert -rotate -90 "$file" "$file" ;; + "f") + convert -flop "$file" "$file" ;; + "y") + echo -n "$file" | xclip -selection clipboard && + notify-send "$file copied to clipboard" & ;; + "Y") + readlink -f "$file" | xclip -selection clipboard && + notify-send "$(readlink -f "$file") copied to clipboard" & ;; + "d") + [ "$(printf "No\\nYes" | dmenu -i -p "Really delete $file?")" = "Yes" ] && rm "$file" && notify-send "$file deleted." ;; + "g") ifinstalled gimp && gimp "$file" & ;; esac done - -- cgit v1.2.3