some improvements to a few things

This commit is contained in:
speedie 2023-04-02 20:03:16 +02:00
parent f63aebe494
commit 67a684d3d0
5 changed files with 1881 additions and 1927 deletions

View file

@ -17,6 +17,7 @@ install:
mkdir -p ${DESTDIR}${PREFIX}/share/speedwm
cp -f src/speedwm* ${DESTDIR}${PREFIX}/bin ; chmod +x ${DESTDIR}${PREFIX}/bin/speedwm*
cp -r img/* ${DESTDIR}${PREFIX}/share/speedwm/
cp -r share/* ${DESTDIR}${PREFIX}/share/speedwm/
echo ${VERSION} > ${DESTDIR}${PREFIX}/share/speedwm/speedwm-extras-version
uninstall:

1649
share/emojis Normal file

File diff suppressed because it is too large Load diff

View file

@ -7,104 +7,106 @@
# Requires pactl for pulseaudio/pipewire or amixer for alsa
# Additionally requires pulsemixer for pulseaudio/pipewire or alsamixer for alsa if the mixer functionality is used
[ -z "$STATUS" ] && STATUS="speedwm_status"
[ -z "$NOTIF_SYSTEM" ] && NOTIF_SYSTEM="dnote"
status="${status:-speedwm_status}"
notif_system="${notif_system:-dnote}"
mixer="${mixer:-pulsemixer}"
MUTE() {
# Mute for pulseaudio/pipewire
[ "$AUDIO" = "pulse" ] && \
getvol() { [ "$audio" = "pulse" ] && command -v pactl > /dev/null && pactl get-sink-volume @DEFAULT_SINK@ | awk '{ print $5;exit }' || echo "$(amixer -c 0 get Master | tail -n 1 | sed -r "s/.*\[(.*)%\].*/\1/")%"; }
getmute() { [ "$audio" = "pulse" ] && command -v pactl > /dev/null && pactl get-sink-mute @DEFAULT_SINK@ | sed "s/Mute: //; s/no/Not muted/; s/yes/Muted/g"; }
run_mixer() { [ -x "$(command -v "$mixer")" ] && "$mixer"; }
get_audio_backend() {
command -v alsamixer > /dev/null && audio=alsa
command -v amixer > /dev/null && audio=alsa
command -v pulsemixer > /dev/null && audio=pulse
command -v pactl > /dev/null && audio=pulse
command -v pulseaudio > /dev/null && audio=pulse
command -v pipewire > /dev/null && audio=pulse
}
mute() {
[ "$audio" = "pulse" ] && \
command -v pactl > /dev/null && \
pactl set-sink-mute @DEFAULT_SINK@ toggle || amixer set Master toggle
pidof "$STATUS" > /dev/null && \
kill -38 $(pidof $STATUS)
pidof "$status" > /dev/null && \
kill -38 $(pidof $status)
}
RAISE() {
NOTIFY_VOL() {
[ "$NOTIF_SYSTEM" = "dnote" ] && command -v dnote > /dev/null && printf " %s\n" "$($0 -get_vol)" | dnote -loc 4
[ "$NOTIF_SYSTEM" = "notify-send" ] && command -v notify-send > /dev/null && notify-send " Volume" "$($0 -get_vol)"
raise() {
notify_vol() {
[ "$notif_system" = "dnote" ] && command -v dnote > /dev/null && printf " %s\n" "$($0 -get_vol)" | dnote -loc 4
[ "$notif_system" = "notify-send" ] && command -v notify-send > /dev/null && notify-send " Volume" "$($0 -get_vol)"
}
PULSE() {
command -v pactl > /dev/null && pactl set-sink-volume @DEFAULT_SINK@ +${NUM}%
pulse() {
command -v pactl > /dev/null && pactl set-sink-volume @DEFAULT_SINK@ +${volnum}%
[ "$($0 -get_vol | sed "s/%//g")" -gt "100" ] && \
command -v pactl > /dev/null && pactl set-sink-volume @DEFAULT_SINK@ 100%
}
ALSA() {
command -v amixer > /dev/null && amixer -c 0 set Master ${NUM}%+
alsa() {
command -v amixer > /dev/null && amixer -c 0 set Master ${volnum}%+
[ "$($0 -get_vol | sed "s/%//g")" -gt "100" ] && \
command -v amixer > /dev/null && amixer -c 0 set Master 100%
}
[ "$AUDIO" = "pulse" ] && PULSE || ALSA
[ "$audio" = "pulse" ] && pulse || alsa
pidof "$STATUS" > /dev/null && \
kill -38 $(pidof $STATUS)
pidof "$status" > /dev/null && \
kill -38 $(pidof $status)
NOTIFY_VOL
notify_vol
}
LOWER() {
NOTIFY_VOL() {
[ "$NOTIF_SYSTEM" = "dnote" ] && command -v dnote > /dev/null && printf " %s\n" "$($0 -get_vol)" | dnote -loc 4
[ "$NOTIF_SYSTEM" = "notify-send" ] && command -v notify-send > /dev/null && notify-send " Volume" "$($0 -get_vol)"
lower() {
notify_vol() {
[ "$notif_system" = "dnote" ] && command -v dnote > /dev/null && printf " %s\n" "$($0 -get_vol)" | dnote -loc 4
[ "$notif_system" = "notify-send" ] && command -v notify-send > /dev/null && notify-send " Volume" "$($0 -get_vol)"
}
PULSE() {
command -v pactl > /dev/null && pactl set-sink-volume @DEFAULT_SINK@ -${NUM}%
pulse() {
command -v pactl > /dev/null && pactl set-sink-volume @DEFAULT_SINK@ -${volnum}%
}
ALSA() {
command -v amixer > /dev/null && amixer -c 0 set Master ${NUM}%-
alsa() {
command -v amixer > /dev/null && amixer -c 0 set Master ${volnum}%-
}
[ "$AUDIO" = "pulse" ] && PULSE || ALSA
[ "$audio" = "pulse" ] && pulse || alsa
pidof "$STATUS" > /dev/null && \
kill -38 $(pidof $STATUS)
# send update signal
[ -n "$status" ] && pidof "$status" > /dev/null && kill -38 "$(pidof $status)"
NOTIFY_VOL
notify_vol
}
GETVOL() {
[ "$AUDIO" = "pulse" ] && command -v pactl > /dev/null && pactl get-sink-volume @DEFAULT_SINK@ | awk '{ print $5;exit }' || echo "$(amixer -c 0 get Master | tail -n 1 | sed -r "s/.*\[(.*)%\].*/\1/")%"
main() {
[ -z "$3" ] && get_audio_backend || audio="$3"
[ -z "$2" ] && volnum="5" || volnum="$2"
case "$1" in
"-mute") mute ;;
"-raise") raise ;;
"-lower") lower ;;
"-get_vol") getvol && exit 0 ;;
"-get_mute") getmute && exit 0 ;;
"-get_backend") printf "$audio\n" && exit 0 ;;
"-run_mixer") run_mixer && exit 0 ;;
"-help") printf "speedwm-audioctrl\n-mute - Toggle mute\n-raise - Raise the volume\n-lower - Lower the volume\n-switch - Toggle output\n-get_vol - Get current volume in percentage\n-get_mute - Get mute status\n-get_backend - Get audio backend (ALSA/PulseAudio)\n-run_mixer - Run the audio mixer detected on the system\n-help - Display this help screen\nNo arguments - Display this help screen\n"; exit 0 ;;
"") $0 -help && exit 0 ;;
esac
# compatibility arguments
case "$1" in
"-getvol") $0 -get_vol && exit 0 ;;
"-getmute") $0 -get_mute && exit 0 ;;
"-getbackend") $0 -get_backend && exit 0 ;;
"-runmixer") run_mixer ;;
esac
}
GETMUTE() {
[ "$AUDIO" = "pulse" ] && command -v pactl > /dev/null && pactl get-sink-mute @DEFAULT_SINK@ | sed "s/Mute: //; s/no/Not muted/; s/yes/Muted/g"
}
RUNMIXER() {
command -v pulsemixer > /dev/null && pulsemixer && exit 0
command -v alsamixer > /dev/null && alsamixer && exit 0
}
GET_AUDIO_BACKEND() {
command -v alsamixer > /dev/null && AUDIO=alsa
command -v amixer > /dev/null && AUDIO=alsa
command -v pulsemixer > /dev/null && AUDIO=pulse
command -v pactl > /dev/null && AUDIO=pulse
command -v pulseaudio > /dev/null && AUDIO=pulse
command -v pipewire > /dev/null && AUDIO=pulse
}
[ -z "$3" ] && GET_AUDIO_BACKEND || AUDIO="$3"
[ -z "$2" ] && NUM="5" || NUM="$2"
case "$1" in
"-mute") MUTE ;;
"-raise") RAISE ;;
"-lower") LOWER ;;
"-get_vol") GETVOL && exit 0 ;;
"-get_mute") GETMUTE&& exit 0 ;;
"-get_backend") printf "$AUDIO\n" && exit 0 ;;
"-run_mixer") RUNMIXER && exit 0 ;;
"-help") printf "speedwm-audioctrl\n-mute - Toggle mute\n-raise - Raise the volume\n-lower - Lower the volume\n-switch - Toggle output\n-get_vol - Get current volume in percentage\n-get_mute - Get mute status\n-get_backend - Get audio backend (ALSA/Pulseaudio)\n-run_mixer - Run the audio mixer detected on the system\n-help - Display this help screen\nNo arguments - Display this help screen\n"; exit 0 ;;
"") $0 -help && exit 0 ;;
esac
# compatibility arguments
case "$1" in
"-getvol") $0 -get_vol && exit 0 ;;
"-getmute") $0 -get_mute && exit 0 ;;
"-getbackend") $0 -get_backend && exit 0 ;;
"-runmixer") RUNMIXER ;;
esac
main "$@"

View file

@ -12,67 +12,48 @@ SWAL_DEFAULT_CONFIG()
SWAL_WALLPAPERDIR=$HOME/Wallpapers
SWAL_OLDWALLPAPERDIR=$SWAL_WALLPAPERDIR
case "$RUNLAUNCHER" in
"") RUNLAUNCHER=spmenu ;;
esac
[ -z "$RUNLAUNCHER" ] && RUNLAUNCHER="spmenu"
SWAL_OPT=xwallpaper
SWAL_EXPORTDIR=$HOME/.config/speedwm/swal # Config directory
SWAL_OPT="xwallpaper"
SWAL_EXPORTDIR="$HOME/.config/speedwm/swal" # Config directory
SWAL_IMAGE_VIEWER="nsxiv -ato" # Image viewer to use (<char>)
SWAL_USE_WAL=true # Whether or not to use Pywal if possible (true/false)
SWAL_RANDOMIZE=false # Select a random wallpaper on login
SWAL_USE_IMAGE=false # Have image support
SWAL_USE_WAL="true" # Whether or not to use Pywal if possible (true/false)
SWAL_RANDOMIZE="false" # Select a random wallpaper on login
SWAL_USE_IMAGE="false" # Have image support
SWAL_IMAGE_SIZE="500" # Image size
}
# Create the configuration
SWAL_MKCONFIG() {
mkdir -p $SWAL_EXPORTDIR
touch $SWAL_EXPORTDIR/swalrc
SWAL_USE_WAL_NEW=$SWAL_USE_WAL
SWAL_WALLPAPERDIR_NEW=$SWAL_WALLPAPERDIR
mkdir -p "$SWAL_EXPORTDIR"
touch "$SWAL_EXPORTDIR/swalrc"
SWAL_USE_WAL_NEW="$SWAL_USE_WAL"
SWAL_WALLPAPERDIR_NEW="$SWAL_WALLPAPERDIR"
SWAL_CHANGE_WALLPAPERDIR() {
SWAL_WALLPAPERDIR_NEW=$(printf "Your wallpaper directory" | $RUNLAUNCHER -g 1 -p "Where are all your wallpapers stored?" -l 1)
}
SWAL_CHANGE_WALLPAPERDIR() { SWAL_WALLPAPERDIR_NEW=$(printf "Your wallpaper directory" | $RUNLAUNCHER -g 1 -p "Where are all your wallpapers stored?" -l 1); }
SWAL_CHANGE_ASK_WAL() { command -v wal > /dev/null && SWAL_USE_WAL_NEW=$(printf "Yes\nNo" | $RUNLAUNCHER -g 1 -p "Use Pywal?" -l 2 | sed "s|No|false|g; s|Yes|true|g"); }
SWAL_CHANGE_IMAGE_VIEWER() { SWAL_IMAGE_VIEWER=$(printf "" | $RUNLAUNCHER -g 1 -p "What image viewer do you want to use for previews?" -l 1); }
SWAL_CHANGE_RANDOMIZE() { SWAL_RANDOMIZE=$(printf "Yes\nNo" | $RUNLAUNCHER -g 1 -p "Pick a random wallpaper on login?" -l 2 | sed "s|No|false|g; s|Yes|true|g"); }
SWAL_CHANGE_ASK_WAL() {
command -v wal > /dev/null && SWAL_USE_WAL_NEW=$(printf "Yes\nNo" | $RUNLAUNCHER -g 1 -p "Use Pywal?" -l 2 | sed "s|No|false|g; s|Yes|true|g")
}
SWAL_CHANGE_IMAGE_VIEWER() {
SWAL_IMAGE_VIEWER=$(printf "" | $RUNLAUNCHER -g 1 -p "What image viewer do you want to use for previews?" -l 1)
}
SWAL_CHANGE_RANDOMIZE() {
SWAL_RANDOMIZE=$(printf "Yes\nNo" | $RUNLAUNCHER -g 1 -p "Pick a random wallpaper on login?" -l 2 | sed "s|No|false|g; s|Yes|true|g")
}
USER_OPT_ACTION=$(printf "Wallpaper directory\nPywal\nImage Viewer\nRandomize\n------\nExit" | $RUNLAUNCHER -g 1 -l 10 -p "What setting do you want to change?")
USER_OPT_ACTION=$(printf "Wallpaper directory\nPywal\nImage Viewer\nRandomize\n\nExit" | $RUNLAUNCHER -g 1 -l 10 -p "What setting do you want to change?")
case "$USER_OPT_ACTION" in
"") $0 && exit 0 ;;
"Wallpaper directory") SWAL_CHANGE_WALLPAPERDIR && CHANGED=true ;;
"Pywal") SWAL_CHANGE_ASK_WAL && CHANGED=true ;;
"Image Viewer") SWAL_CHANGE_IMAGE_VIEWER && CHANGED=true ;;
"Randomize") SWAL_CHANGE_RANDOMIZE && CHANGED=true ;;
"Exit") exit 0 ;;
"------") $0 && exit 0 ;;
"Wallpaper directory") SWAL_CHANGE_WALLPAPERDIR && CHANGED=true ;;
"Pywal") SWAL_CHANGE_ASK_WAL && CHANGED=true ;;
"Image Viewer") SWAL_CHANGE_IMAGE_VIEWER && CHANGED=true ;;
"Randomize") SWAL_CHANGE_RANDOMIZE && CHANGED=true ;;
"Exit") exit 0 ;;
"") exit 0 ;;
"") $0 && exit 0 ;;
esac
case "$CHANGED" in
"") $0 && exit 0 ;;
esac
[ -z "$CHANGED" ] && $0 && exit 0
case "$SWAL_USE_WAL_NEW" in
"true") ASKED=true ;;
"false") ASKED=true ;;
"true") ASKED=true ;;
"false") ASKED=true ;;
esac
if [ "$ASKED" = "" ]; then
$0 && exit 0
fi
printf "SWAL_WALLPAPERDIR=$SWAL_WALLPAPERDIR_NEW" > $SWAL_EXPORTDIR/swalrc
printf "\nRUNLAUNCHER=$RUNLAUNCHER" >> $SWAL_EXPORTDIR/swalrc
printf "\nSWAL_OPT=$SWAL_OPT" >> $SWAL_EXPORTDIR/swalrc
@ -90,7 +71,7 @@ SWAL_OLDWALLPAPERDIR=$SWAL_WALLPAPERDIR
# Source things
SWAL_SOURCE()
{
ls "$SWAL_EXPORTDIR/swalrc" || SWAL_MKCONFIG
[ ! -f "$SWAL_EXPORTDIR/swalrc" ] && SWAL_MKCONFIG
. "$SWAL_EXPORTDIR/swalrc" || rm -f "$SWAL_EXPORTDIR/swalrc"
}
@ -130,17 +111,17 @@ SWAL_USAGE() {
SWAL_SELWALLPAPER()
{
LIST_IMG() {
printf "\033[0;32mCurrent directory: %s\n\n" "$SWAL_WALLPAPERDIR"
for i in $(seq "$(ls "$SWAL_WALLPAPERDIR" | wc -l)"); do
CUR_IMAGE="$(ls "$SWAL_WALLPAPERDIR" | sed -n ${i},${i}p)"
CUR_IMAGE_PATH="$SWAL_WALLPAPERDIR/$CUR_IMAGE"
[ ! -f "$CUR_IMAGE_PATH" ] && printf "$CUR_IMAGE\n" && continue
[ ! -f "$CUR_IMAGE_PATH" ] && printf "\033[1;39m$CUR_IMAGE\n" && continue
if [ "$SWAL_USE_IMAGE" = "true" ]; then
printf "IMG:$CUR_IMAGE_PATH\t$CUR_IMAGE\n"
printf "IMG:$CUR_IMAGE_PATH\t\033[1;35m$CUR_IMAGE\n"
else
printf "$CUR_IMAGE\n"
printf "\033[1;35m$CUR_IMAGE\n"
fi
done
}
@ -152,30 +133,32 @@ SWAL_SELWALLPAPER()
fi
if [ "$ARG1" = "" ]; then
SWAL_SELWALLPAPER="$(printf "$(LIST_IMG)\n------\n..\nPreview\nPrevious\nRandom\nFavorites\nAdd used wallpaper to favorites\nOptions\nHelp\nExit" | $RUNLAUNCHER -g 1 -l 30 -p "What wallpaper would you like to set?" $IMG_ARG $SWAL_IMAGE_SIZE $IMG_ARG_2 $SWAL_IMAGE_SIZE)"
SWAL_SELWALLPAPER="$(printf "$(LIST_IMG)\n..\n\nPreview\nPrevious\nRandom\nFavorites\nAdd used wallpaper to favorites\nOptions\nHelp\nExit" | $RUNLAUNCHER -g 1 -l 30 -p "What wallpaper would you like to set?" $IMG_ARG $SWAL_IMAGE_SIZE $IMG_ARG_2 $SWAL_IMAGE_SIZE | sed -e 's/\x1b\[[0-9;]*m//g')"
fi
}
# Set the type/check what was selected.
SWAL_SETTYPE()
{
# do arguments first
case "$ARG1" in
"--randomize") SWAL_SELWALLPAPER="Random" ;;
"--previous") SWAL_SELWALLPAPER="Previous" ;;
"--randomize") SWAL_SELWALLPAPER="Random" ;;
"--previous") SWAL_SELWALLPAPER="Previous" ;;
esac
# check selected item
case "$SWAL_SELWALLPAPER" in
"Options") SWAL_MKCONFIG && $0 $@ && exit 0 ;;
"") $0 && exit 0 ;;
"Favorites") SWAL_SELWALLPAPER="$(printf "$(cat $SWAL_EXPORTDIR/favorites.filename)\n------\n..\nClear\n\nExit" | $RUNLAUNCHER -g 1 -l 100 -p "What wallpaper would you like to set?")" ; FAVORITES=true ;;
"Add used wallpaper to favorites") echo "$(readlink "$SWAL_EXPORTDIR/CurrentWallpaper")" >> $SWAL_EXPORTDIR/favorites ; echo "$(basename "$(readlink "$SWAL_EXPORTDIR/CurrentWallpaper")")" >> $SWAL_EXPORTDIR/favorites.filename && $0 && exit 0 ;;
"Preview") SWAL_PREVIEWIMG="$($SWAL_IMAGE_VIEWER "$SWAL_WALLPAPERDIR"/*)" ;;
"..") cd "$SWAL_WALLPAPERDIR/.." && SWAL_WALLPAPERDIR="$(pwd)" && SWAL_SELWALLPAPER && SET && exit 0 ;;
"Random") SWAL_FULL="$(find $SWAL_WALLPAPERDIR/* -type f | shuf -n 1)" ; SWAL_WALLPAPERDIR="$(dirname "$SWAL_FULL")" ; SWAL_SELWALLPAPER="$(basename "$SWAL_FULL")" ; SWAL_SELWAL=$SWAL_SELWALLPAPER ;;
"Previous") SWAL_PREVWAL=$(readlink $SWAL_EXPORTDIR/CurrentWallpaper_prev) ; SWAL_WALLPAPERDIR="$(dirname "$SWAL_PREVWAL")" ; SWAL_SELWALLPAPER="$(basename "$SWAL_PREVWAL")" ;;
"Exit") exit 0 ;;
"Help") SWAL_USAGE | $RUNLAUNCHER -g 1 -l 50 -p "How to use" && $0 && exit 0 ;;
"------") $0 && exit 0 ;;
"Options") SWAL_MKCONFIG && $0 $@ && exit 0 ;;
"") exit 0 ;;
"Favorites") SWAL_SELWALLPAPER="$(printf "$(cat $SWAL_EXPORTDIR/favorites.filename)\n\n..\nClear\n\nExit" | $RUNLAUNCHER -g 1 -l 100 -p "What wallpaper would you like to set?")" ; FAVORITES=true ;;
"Add used wallpaper to favorites") echo "$(readlink "$SWAL_EXPORTDIR/CurrentWallpaper")" >> $SWAL_EXPORTDIR/favorites ; echo "$(basename "$(readlink "$SWAL_EXPORTDIR/CurrentWallpaper")")" >> $SWAL_EXPORTDIR/favorites.filename && $0 && exit 0 ;;
"Preview") SWAL_PREVIEWIMG="$($SWAL_IMAGE_VIEWER "$SWAL_WALLPAPERDIR"/*)" ;;
"..") cd "$SWAL_WALLPAPERDIR/.." && SWAL_WALLPAPERDIR="$(pwd)" && SWAL_SELWALLPAPER && SET && exit 0 ;;
"Random") SWAL_FULL="$(find $SWAL_WALLPAPERDIR/* -type f | shuf -n 1)" ; SWAL_WALLPAPERDIR="$(dirname "$SWAL_FULL")" ; SWAL_SELWALLPAPER="$(basename "$SWAL_FULL")" ; SWAL_SELWAL=$SWAL_SELWALLPAPER ;;
"Previous") SWAL_PREVWAL=$(readlink $SWAL_EXPORTDIR/CurrentWallpaper_prev) ; SWAL_WALLPAPERDIR="$(dirname "$SWAL_PREVWAL")" ; SWAL_SELWALLPAPER="$(basename "$SWAL_PREVWAL")" ;;
"Exit") exit 0 ;;
"Help") SWAL_USAGE | $RUNLAUNCHER -g 1 -l 50 -p "How to use" && $0 && exit 0 ;;
"") $0 && exit 0 ;;
esac
# Favorites feature
@ -185,7 +168,7 @@ SWAL_SETTYPE()
"Clear") rm -f $SWAL_EXPORTDIR/favorites* ; $0 && exit 0 ;;
"Exit") exit 0 ;;
"..") $0 && exit 0 ;;
"------") $0 && exit 0 ;;
"") $0 && exit 0 ;;
esac
SWAL_WALLPAPERDIR="$(dirname "$(cat "$SWAL_EXPORTDIR/favorites" | grep "$SWAL_SELWALLPAPER")")"
fi
@ -217,7 +200,7 @@ SWAL_SETTYPE()
if [ "$SWAL_ASK_TYPE" != "false" ]; then
if [ "$ARG1" = "" ]; then
[ -z "$SWAL_SELWALLPAPER" ] && exit 0
SWAL_TYPE=$(printf "Center\nTile\nZoom\nStretch\n------\nExit" | $RUNLAUNCHER -p "How do you want to set the wallpaper?" -g 1 -l 7)
SWAL_TYPE=$(printf "Center\nTile\nZoom\nStretch\n\nExit" | $RUNLAUNCHER -p "How do you want to set the wallpaper?" -g 1 -l 7)
else
SWAL_TYPE="Stretch"
fi
@ -229,7 +212,7 @@ SWAL_SETTYPE()
"Zoom") SWAL_TYPE=zoom ;;
"Stretch") SWAL_TYPE=stretch ;;
"Exit") exit 0 ;;
"------") $0 && exit 0 ;;
"") $0 && exit 0 ;;
"") $0 && exit 0 ;;
esac
@ -265,12 +248,12 @@ SWAL_EXPORT_SCRIPT()
[ "$SWAL_RANDOMIZE" != "true" ] && printf "#!/bin/sh\n$SWAL_OPT $SWAL_TYPE ""'$SWAL_WALLPAPERDIR/$SWAL_SELWALLPAPER'""" > $SWAL_EXPORTDIR/swal_wm || printf "#!/bin/sh\n$0 --randomize\nreturn\n" > $SWAL_EXPORTDIR/swal_wm
if [ -e "$SWAL_EXPORTDIR/CurrentWallpaper" ]; then
rm -f $SWAL_EXPORTDIR/CurrentWallpaper_prev ; ln -s "$(readlink $SWAL_EXPORTDIR/CurrentWallpaper)" $SWAL_EXPORTDIR/CurrentWallpaper_prev
rm -f $SWAL_EXPORTDIR/CurrentWallpaper_prev ; ln -s "$(readlink "$SWAL_EXPORTDIR/CurrentWallpaper")" "$SWAL_EXPORTDIR/CurrentWallpaper_prev"
fi
rm -f $SWAL_EXPORTDIR/CurrentWallpaper ; ln -s "$SWAL_WALLPAPERDIR/$SWAL_SELWALLPAPER" $SWAL_EXPORTDIR/CurrentWallpaper
rm -f "$SWAL_EXPORTDIR/CurrentWallpaper" ; ln -s "$SWAL_WALLPAPERDIR/$SWAL_SELWALLPAPER" "$SWAL_EXPORTDIR/CurrentWallpaper"
chmod +x $SWAL_EXPORTDIR/swal_wm
chmod +x "$SWAL_EXPORTDIR/swal_wm"
}
# Export script to autostart on login for Pywal users
@ -279,34 +262,34 @@ SWAL_EXPORT_SCRIPT_WAL()
[ "$SWAL_RANDOMIZE" != "true" ] && printf "#!/bin/sh\n$SWAL_OPT $SWAL_TYPE ""'$SWAL_WALLPAPERDIR/$SWAL_SELWALLPAPER'""\nwal -qi ""'$SWAL_WALLPAPERDIR/$SWAL_SELWALLPAPER'"" || rm -rf $HOME/.cache/wal ; xrdb -remove\nxrdb ~/.cache/wal/colors.Xresources" > $SWAL_EXPORTDIR/swal_wm || printf "#!/bin/sh\n$0 --randomize\nreturn\n" > $SWAL_EXPORTDIR/swal_wm
# make script executable
chmod +x $SWAL_EXPORTDIR/swal_wm
chmod +x "$SWAL_EXPORTDIR/swal_wm"
rm -rf $HOME/.cache/wal # Delete previous colors
rm -rf "$HOME/.cache/wal" # Delete previous colors
wal -nqi "'$SWAL_WALLPAPERDIR/$SWAL_SELWALLPAPER'" && xrdb ~/.cache/wal/colors.Xresources || xrdb -remove # Remove xrdb values
if [ -e "$SWAL_EXPORTDIR/CurrentWallpaper" ]; then
rm -f $SWAL_EXPORTDIR/CurrentWallpaper_prev ; ln -s "$(readlink $SWAL_EXPORTDIR/CurrentWallpaper)" $SWAL_EXPORTDIR/CurrentWallpaper_prev
fi
[ -e "$SWAL_EXPORTDIR/CurrentWallpaper" ] && rm -f "$SWAL_EXPORTDIR/CurrentWallpaper_prev" ; ln -s "$(readlink "$SWAL_EXPORTDIR/CurrentWallpaper")" "$SWAL_EXPORTDIR/CurrentWallpaper_prev"
rm -f $SWAL_EXPORTDIR/CurrentWallpaper ; ln -s "$SWAL_WALLPAPERDIR/$SWAL_SELWALLPAPER" $SWAL_EXPORTDIR/CurrentWallpaper
rm -f $SWAL_EXPORTDIR/CurrentWallpaper ; ln -s "$SWAL_WALLPAPERDIR/$SWAL_SELWALLPAPER" "$SWAL_EXPORTDIR/CurrentWallpaper"
command -v wal > /dev/null && wal -nqi "$SWAL_WALLPAPERDIR/$SWAL_SELWALLPAPER"
libspeedwm --perform core_wm_reload
speedwm -s "Loading"
# hide the ugly #cmd: status
command -v speedwm > /dev/null && \
pidof speedwm > /dev/null && \
speedwm -s "Loading"
# run script
if [ -e "$SWAL_EXPORTDIR/postrun.sh" ]; then
$SWAL_EXPORTDIR/postrun.sh
fi
[ -x "$SWAL_EXPORTDIR/postrun.sh" ] && "$SWAL_EXPORTDIR/postrun.sh"
}
# Send notification
SWAL_SENDNOTIFICATION() {
if [ "$SWAL_SELWAL" = "" ]; then
command -v notify-send > /dev/null && notify-send " $SWAL_SELWALLPAPER set as wallpaper in $(echo $SWAL_TYPE | sed "s|--||g") mode."
command -v notify-send > /dev/null && notify-send " $SWAL_SELWALLPAPER set as wallpaper in $(echo "$SWAL_TYPE" | sed "s|--||g") mode."
else
command -v notify-send > /dev/null && notify-send " $SWAL_SELWAL set as wallpaper in $(echo $SWAL_TYPE | sed "s|--||g") mode."
command -v notify-send > /dev/null && notify-send " $SWAL_SELWAL set as wallpaper in $(echo "$SWAL_TYPE" | sed "s|--||g") mode."
fi
exit 0
@ -318,7 +301,7 @@ SWAL_CHECK || SWAL_DIE
SWAL_SELWALLPAPER || SWAL_DIE
SET() {
SWAL_SETTYPE || SWAL_DIE
SWAL_SETTYPE "$@" || SWAL_DIE
SWAL_SETWALLPAPER || SWAL_DIE
# Pywal
@ -334,6 +317,4 @@ SET() {
SWAL_SENDNOTIFICATION
}
SET
$0 && exit 0
SET "$@"

File diff suppressed because it is too large Load diff