diff --git a/src/speedwm-audioctrl b/src/speedwm-audioctrl index 977e575..7a30c39 100755 --- a/src/speedwm-audioctrl +++ b/src/speedwm-audioctrl @@ -33,7 +33,7 @@ MUTE() { RAISE() { if [ "$AUDIO" = "pulse" ]; then if [ -e "${BINDIR}pactl" ]; then - if [ "$(pactl get-sink-volume @DEFAULT_SINK@ | awk '{ print $5;exit }' | sed 's/%//g')" -gt "100" ]; then + if [ "$(pactl get-sink-volume @DEFAULT_SINK@ | awk '{ print $5;exit }' | sed 's/%//g')" = "110" ]; then pactl set-sink-volume @DEFAULT_SINK@ 100% else pactl set-sink-volume @DEFAULT_SINK@ +10% @@ -125,11 +125,6 @@ fi ;; esac -# Update status -UPDATESTATUS() { - pkill -x status && status & -} - case "$1" in "-mute") MUTE && GETMUTE > /tmp/speedwm-audioctrl-mutestatus ;; "-remute") remute=true ; MUTE && GETMUTE > /tmp/speedwm-audioctrl-mutestatus ; MUTE && GETMUTE > /tmp/speedwm-audioctrl-mutestatus ; remute="" ; exit 0 ;; diff --git a/src/speedwm-swal b/src/speedwm-swal index 5c4adcb..c457636 100755 --- a/src/speedwm-swal +++ b/src/speedwm-swal @@ -11,13 +11,15 @@ SWAL_DEFAULT_CONFIG() { SWAL_WALLPAPERDIR=$HOME/Wallpapers SWAL_OLDWALLPAPERDIR=$SWAL_WALLPAPERDIR + case "$RUNLAUNCHER" in "") RUNLAUNCHER=dmenu ;; esac + SWAL_OPT=xwallpaper SWAL_EXPORTDIR=$HOME/.config/speedwm/swal # Config directory SWAL_IMAGE_VIEWER="nsxiv -ato" # Image viewer to use () - SWAL_ASK_WAL=false # Ask whether or not to use Pywal if possible (true/false) + SWAL_USE_WAL=true # Whether or not to use Pywal if possible (true/false) SWAL_RANDOMIZE=false # Select a random wallpaper on login } @@ -46,7 +48,7 @@ fi SWAL_MKCONFIG() { mkdir -p $SWAL_EXPORTDIR touch $SWAL_EXPORTDIR/swalrc - SWAL_ASK_WAL_NEW=$SWAL_ASK_WAL + SWAL_USE_WAL_NEW=$SWAL_USE_WAL SWAL_WALLPAPERDIR_NEW=$SWAL_WALLPAPERDIR SWAL_CHANGE_WALLPAPERDIR() { @@ -54,7 +56,7 @@ SWAL_MKCONFIG() { } SWAL_CHANGE_ASK_WAL() { - command -v wal > /dev/null && SWAL_ASK_WAL_NEW=$(printf "Yes\nNo" | $RUNLAUNCHER $GRIDARG $GRIDNUM -p "Ask whether or not to use Pywal?" -l 2 | sed "s|No|false|g" | sed "s|Yes|true|g") + command -v wal > /dev/null && SWAL_USE_WAL_NEW=$(printf "Yes\nNo" | $RUNLAUNCHER $GRIDARG $GRIDNUM -p "Use Pywal?" -l 2 | sed "s|No|false|g; s|Yes|true|g") } SWAL_CHANGE_IMAGE_VIEWER() { @@ -62,7 +64,7 @@ SWAL_MKCONFIG() { } SWAL_CHANGE_RANDOMIZE() { - SWAL_RANDOMIZE=$(printf "Yes\nNo" | $RUNLAUNCHER $GRIDARG $GRIDNUM -p "Pick a random wallpaper on login?" -l 2 | sed "s|No|false|g" | sed "s|Yes|true|g") + SWAL_RANDOMIZE=$(printf "Yes\nNo" | $RUNLAUNCHER $GRIDARG $GRIDNUM -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 $GRIDARG $GRIDNUM -l 10 -p "What setting do you want to change?") @@ -81,7 +83,7 @@ SWAL_MKCONFIG() { "") $0 && exit 0 ;; esac - case "$SWAL_ASK_WAL_NEW" in + case "$SWAL_USE_WAL_NEW" in "true") ASKED=true ;; "false") ASKED=true ;; esac @@ -95,7 +97,7 @@ SWAL_MKCONFIG() { printf "\nSWAL_OPT=$SWAL_OPT" >> $SWAL_EXPORTDIR/swalrc printf "\nSWAL_EXPORTDIR=$SWAL_EXPORTDIR" >> $SWAL_EXPORTDIR/swalrc printf "\nSWAL_IMAGE_VIEWER='$SWAL_IMAGE_VIEWER'" >> $SWAL_EXPORTDIR/swalrc - printf "\nSWAL_ASK_WAL=$SWAL_ASK_WAL_NEW" >> $SWAL_EXPORTDIR/swalrc + printf "\nSWAL_USE_WAL=$SWAL_USE_WAL_NEW" >> $SWAL_EXPORTDIR/swalrc printf "\nSWAL_RANDOMIZE=$SWAL_RANDOMIZE" >> $SWAL_EXPORTDIR/swalrc } @@ -235,16 +237,10 @@ SWAL_SETTYPE() SWAL_WAL_STATUS="0" # Check whether or not to ask based on configuration file. - if [ "$ARG1" = "" ]; then - case "$SWAL_ASK_WAL" in - "true") command -v wal > /dev/null && SWAL_USE_WAL=$(printf "Yes\nNo" | $RUNLAUNCHER $GRIDARG $GRIDNUM -l 90 -p "Do you want to use Pywal?" -l 2) && SWAL_WAL_STATUS="1" ;; - "false") command -v wal > /dev/null && SWAL_USE_WAL="Yes" && SWAL_WAL_STATUS="1" ;; - esac - else + if [ "$SWAL_USE_WAL" = "true" ]; then command -v wal > /dev/null && SWAL_USE_WAL="Yes" && SWAL_WAL_STATUS="1" fi - # Don't perform pywal actions if not installed/used if [ "$SWAL_WAL_STATUS" = "0" ]; then SWAL_USE_WAL="No" @@ -261,25 +257,25 @@ SWAL_SETWALLPAPER() SWAL_EXPORT_SCRIPT() { if [ "$SWAL_RANDOMIZE" = "false" ]; then - printf "#!/bin/sh\n$SWAL_OPT $SWAL_TYPE ""'$SWAL_WALLPAPERDIR/$SWAL_SELWALLPAPER'""" > $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 - fi - - rm -f $SWAL_EXPORTDIR/CurrentWallpaper ; ln -s "$SWAL_WALLPAPERDIR/$SWAL_SELWALLPAPER" $SWAL_EXPORTDIR/CurrentWallpaper + printf "#!/bin/sh\n$SWAL_OPT $SWAL_TYPE ""'$SWAL_WALLPAPERDIR/$SWAL_SELWALLPAPER'""" > $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 + fi + + rm -f $SWAL_EXPORTDIR/CurrentWallpaper ; ln -s "$SWAL_WALLPAPERDIR/$SWAL_SELWALLPAPER" $SWAL_EXPORTDIR/CurrentWallpaper else - printf "#!/bin/sh" > $SWAL_EXPORTDIR/swal_wm - printf "\nSWAL_WALLPAPERDIR=""'$SWAL_OLDWALLPAPERDIR'""" >> $SWAL_EXPORTDIR/swal_wm - printf "\nSWAL_EXPORTDIR=""'$SWAL_EXPORTDIR'""" >> $SWAL_EXPORTDIR/swal_wm - printf '\nSWAL_SELWALLPAPER="$(find "$SWAL_WALLPAPERDIR"/* -type f | shuf -n 1)"' >> $SWAL_EXPORTDIR/swal_wm - printf "\n$SWAL_OPT $SWAL_TYPE " >> $SWAL_EXPORTDIR/swal_wm - printf '"$SWAL_SELWALLPAPER"' >> $SWAL_EXPORTDIR/swal_wm - printf "\nrm -f $SWAL_EXPORTDIR/CurrentWallpaper_prev" >> $SWAL_EXPORTDIR/swal_wm - printf '\nln -s "$(readlink $SWAL_EXPORTDIR/CurrentWallpaper)" ' >> $SWAL_EXPORTDIR/swal_wm - printf "$SWAL_EXPORTDIR/CurrentWallpaper_prev" >> $SWAL_EXPORTDIR/swal_wm - printf "\nrm -f $SWAL_EXPORTDIR/CurrentWallpaper" >> $SWAL_EXPORTDIR/swal_wm - printf '\nln -s "$SWAL_SELWALLPAPER" ' >> $SWAL_EXPORTDIR/swal_wm - printf "$SWAL_EXPORTDIR/CurrentWallpaper" >> $SWAL_EXPORTDIR/swal_wm + printf "#!/bin/sh" > $SWAL_EXPORTDIR/swal_wm + printf "\nSWAL_WALLPAPERDIR=""'$SWAL_OLDWALLPAPERDIR'""" >> $SWAL_EXPORTDIR/swal_wm + printf "\nSWAL_EXPORTDIR=""'$SWAL_EXPORTDIR'""" >> $SWAL_EXPORTDIR/swal_wm + printf '\nSWAL_SELWALLPAPER="$(find "$SWAL_WALLPAPERDIR"/* -type f | shuf -n 1)"' >> $SWAL_EXPORTDIR/swal_wm + printf "\n$SWAL_OPT $SWAL_TYPE " >> $SWAL_EXPORTDIR/swal_wm + printf '"$SWAL_SELWALLPAPER"' >> $SWAL_EXPORTDIR/swal_wm + printf "\nrm -f $SWAL_EXPORTDIR/CurrentWallpaper_prev" >> $SWAL_EXPORTDIR/swal_wm + printf '\nln -s "$(readlink $SWAL_EXPORTDIR/CurrentWallpaper)" ' >> $SWAL_EXPORTDIR/swal_wm + printf "$SWAL_EXPORTDIR/CurrentWallpaper_prev" >> $SWAL_EXPORTDIR/swal_wm + printf "\nrm -f $SWAL_EXPORTDIR/CurrentWallpaper" >> $SWAL_EXPORTDIR/swal_wm + printf '\nln -s "$SWAL_SELWALLPAPER" ' >> $SWAL_EXPORTDIR/swal_wm + printf "$SWAL_EXPORTDIR/CurrentWallpaper" >> $SWAL_EXPORTDIR/swal_wm fi chmod +x $SWAL_EXPORTDIR/swal_wm @@ -289,26 +285,30 @@ SWAL_EXPORT_SCRIPT() SWAL_EXPORT_SCRIPT_WAL() { if [ "$SWAL_RANDOMIZE" = "false" ]; then - 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$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 else - printf "#!/bin/sh" > $SWAL_EXPORTDIR/swal_wm - printf "\nSWAL_WALLPAPERDIR=""'$SWAL_OLDWALLPAPERDIR'""" >> $SWAL_EXPORTDIR/swal_wm - printf "\nSWAL_EXPORTDIR=""'$SWAL_EXPORTDIR'""" >> $SWAL_EXPORTDIR/swal_wm - printf '\nSWAL_SELWALLPAPER="$(find "$SWAL_WALLPAPERDIR"/* -type f | shuf -n 1)"' >> $SWAL_EXPORTDIR/swal_wm - printf "\n$SWAL_OPT $SWAL_TYPE " >> $SWAL_EXPORTDIR/swal_wm - printf '"$SWAL_SELWALLPAPER"' >> $SWAL_EXPORTDIR/swal_wm - printf '\nwal -nqi "$SWAL_SELWALLPAPER" || rm -rf $HOME/.cache/wal ; xrdb -remove\nxrdb $HOME/.cache/wal/colors.Xresources\nxrdb $HOME/.cache/wal/colors.Xresources' >> $SWAL_EXPORTDIR/swal_wm - printf "\nrm -f $SWAL_EXPORTDIR/CurrentWallpaper_prev" >> $SWAL_EXPORTDIR/swal_wm - printf '\nln -s "$(readlink $SWAL_EXPORTDIR/CurrentWallpaper)" ' >> $SWAL_EXPORTDIR/swal_wm - printf "$SWAL_EXPORTDIR/CurrentWallpaper_prev" >> $SWAL_EXPORTDIR/swal_wm - printf "\nrm -f $SWAL_EXPORTDIR/CurrentWallpaper" >> $SWAL_EXPORTDIR/swal_wm - printf '\nln -s "$SWAL_SELWALLPAPER" ' >> $SWAL_EXPORTDIR/swal_wm - printf "$SWAL_EXPORTDIR/CurrentWallpaper" >> $SWAL_EXPORTDIR/swal_wm + printf "#!/bin/sh" > $SWAL_EXPORTDIR/swal_wm + printf "\nSWAL_WALLPAPERDIR=""'$SWAL_OLDWALLPAPERDIR'""" >> $SWAL_EXPORTDIR/swal_wm + printf "\nSWAL_EXPORTDIR=""'$SWAL_EXPORTDIR'""" >> $SWAL_EXPORTDIR/swal_wm + printf '\nSWAL_SELWALLPAPER="$(find "$SWAL_WALLPAPERDIR"/* -type f | shuf -n 1)"' >> $SWAL_EXPORTDIR/swal_wm + printf "\n$SWAL_OPT $SWAL_TYPE " >> $SWAL_EXPORTDIR/swal_wm + printf '"$SWAL_SELWALLPAPER"' >> $SWAL_EXPORTDIR/swal_wm + printf '\nwal -nqi "$SWAL_SELWALLPAPER" || rm -rf $HOME/.cache/wal ; xrdb -remove\nxrdb $HOME/.cache/wal/colors.Xresources\nxrdb $HOME/.cache/wal/colors.Xresources' >> $SWAL_EXPORTDIR/swal_wm + printf "\nrm -f $SWAL_EXPORTDIR/CurrentWallpaper_prev" >> $SWAL_EXPORTDIR/swal_wm + printf '\nln -s "$(readlink $SWAL_EXPORTDIR/CurrentWallpaper)" ' >> $SWAL_EXPORTDIR/swal_wm + printf "$SWAL_EXPORTDIR/CurrentWallpaper_prev" >> $SWAL_EXPORTDIR/swal_wm + printf "\nrm -f $SWAL_EXPORTDIR/CurrentWallpaper" >> $SWAL_EXPORTDIR/swal_wm + printf '\nln -s "$SWAL_SELWALLPAPER" ' >> $SWAL_EXPORTDIR/swal_wm + printf "$SWAL_EXPORTDIR/CurrentWallpaper" >> $SWAL_EXPORTDIR/swal_wm fi + # make script executable chmod +x $SWAL_EXPORTDIR/swal_wm + rm -rf $HOME/.cache/wal # Delete previous colors - wal -nqi "'$SWAL_WALLPAPERDIR/$SWAL_SELWALLPAPER'" && xrdb ~/.cache/wal/colors.Xresources || xrdb -remove # Compatibility with my speedwm build + + 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