update config structure to not conflict with old speedwm built in

scripts
This commit is contained in:
speediegq 2022-10-28 20:22:12 +02:00
parent 36be8a9085
commit 2e70e3b015
10 changed files with 76 additions and 72 deletions

View file

@ -14,7 +14,6 @@ if [ -e "$HOME/.config/speedwm/globalrc" ]; then
. $HOME/.config/speedwm/globalrc
echo "Loaded configuration!"
else
mkdir -p $HOME/.config/speedwm/global
printf "HAVE_GRID=$HAVE_GRID # Whether or not to use the Grid argument. If you do not have the dmenu grid patch, set this to false. Doing so will disable grid." > $HOME/.config/speedwm/globalrc
fi

View file

@ -17,7 +17,7 @@ HAVE_GRID="true"
if [ -e "$HOME/.config/speedwm/globalrc" ]; then
. $HOME/.config/speedwm/globalrc
else
mkdir -p $HOME/.config/speedwm/global
printf "HAVE_GRID=$HAVE_GRID # Whether or not to use the Grid argument. If you do not have the dmenu grid patch, set this to false. Doing so will disable grid." > $HOME/.config/speedwm/globalrc
fi

View file

@ -7,7 +7,7 @@
# https://speedie.gq/dmenu-scripts
# speedwm specfic dotfile directory, probably don't change
DOTDIR=$HOME/.config/speedwm/dfmpeg
DOTDIR=$HOME/.config/speedwm
NOMKCONFIG=false # Do not create a config file if this is set to true
# Set runlauncher
@ -24,7 +24,7 @@ HAVE_GRID="true"
if [ -e "$HOME/.config/speedwm/globalrc" ]; then
. $HOME/.config/speedwm/globalrc
else
mkdir -p $HOME/.config/speedwm/global
printf "HAVE_GRID=$HAVE_GRID # Whether or not to use the Grid argument. If you do not have the dmenu grid patch, set this to false. Doing so will disable grid." > $HOME/.config/speedwm/globalrc
fi
@ -57,29 +57,29 @@ defaultConfig() {
defaultConfig
USECONFIG() {
echo "Using $DOTDIR/config for configuration!" && . $DOTDIR/config
echo "Using $DOTDIR/dfmpegrc for configuration!" && . $DOTDIR/dfmpegrc
}
MKCONFIG() {
if [ -e "$DOTDIR/config" ]; then
if [ -e "$DOTDIR/dfmpegrc" ]; then
USECONFIG
else
if [ "$NOMKCONFIG" = "false" ]; then
mkdir -p $DOTDIR
printf "RESOLUTION=$RESOLUTION # The resolution to capture in" > $DOTDIR/config
printf "\nAUDIO_DEVICE=$AUDIO_DEVICE # How to capture audio (alsa/pulseaudio)" >> $DOTDIR/config
printf "\nFRAME_RATE=$FRAME_RATE # Frame rate to capture in." >> $DOTDIR/config
printf "\nOUTPUT_PATH=$OUTPUT_PATH # Directory where captures will be saved." >> $DOTDIR/config
printf "\nOUTPUT_FORMAT=$OUTPUT_FORMAT # What format to use" >> $DOTDIR/config
printf "\n#OUTPUT_FILENAME='filename'" >> $DOTDIR/config
printf "\n\nRECORD_DEVICE=$RECORD_DEVICE" >> $DOTDIR/config
printf "\nWH=$WH" >> $DOTDIR/config
printf "\nTERM=$TERMINAL # Terminal to use when editing the config file" >> $DOTDIR/config
printf "\nEDITOR=$EDITOR # Editor to edit the config file" >> $DOTDIR/config
printf "\nMEDIA_PLAYER=$MEDIA_PLAYER # Media player to play videos in" >> $DOTDIR/config
printf "\nENCODE=$ENCODE # Encode or not on 'Stop' (true/false)" >> $DOTDIR/config
printf "\nENCODE_CODEC=$ENCODE_CODEC # Codec to encode in (libx264 is default)" >> $DOTDIR/config
printf "\nENCODE_PRESET=$ENCODE_PRESET # ffmpeg preset. Available options: ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow" >> $DOTDIR/config
printf "RESOLUTION=$RESOLUTION # The resolution to capture in" > $DOTDIR/dfmpegrc
printf "\nAUDIO_DEVICE=$AUDIO_DEVICE # How to capture audio (alsa/pulseaudio)" >> $DOTDIR/dfmpegrc
printf "\nFRAME_RATE=$FRAME_RATE # Frame rate to capture in." >> $DOTDIR/dfmpegrc
printf "\nOUTPUT_PATH=$OUTPUT_PATH # Directory where captures will be saved." >> $DOTDIR/dfmpegrc
printf "\nOUTPUT_FORMAT=$OUTPUT_FORMAT # What format to use" >> $DOTDIR/dfmpegrc
printf "\n#OUTPUT_FILENAME='filename'" >> $DOTDIR/dfmpegrc
printf "\n\nRECORD_DEVICE=$RECORD_DEVICE" >> $DOTDIR/dfmpegrc
printf "\nWH=$WH" >> $DOTDIR/dfmpegrc
printf "\nTERM=$TERMINAL # Terminal to use when editing the config file" >> $DOTDIR/dfmpegrc
printf "\nEDITOR=$EDITOR # Editor to edit the config file" >> $DOTDIR/dfmpegrc
printf "\nMEDIA_PLAYER=$MEDIA_PLAYER # Media player to play videos in" >> $DOTDIR/dfmpegrc
printf "\nENCODE=$ENCODE # Encode or not on 'Stop' (true/false)" >> $DOTDIR/dfmpegrc
printf "\nENCODE_CODEC=$ENCODE_CODEC # Codec to encode in (libx264 is default)" >> $DOTDIR/dfmpegrc
printf "\nENCODE_PRESET=$ENCODE_PRESET # ffmpeg preset. Available options: ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow" >> $DOTDIR/dfmpegrc
fi
fi
}
@ -167,7 +167,7 @@ MORE_OPTIONS() {
"Encode last recording") encode ; exit 0 ;;
"Encode video") echo "$(echo "" | $RUNLAUNCHER -l 1 $GRIDARG $GRIDNUM -p "What file do you want to encode?")" > /tmp/outputfilename && encode ; exit 0 ;;
"Encode") encodeopts ; exit 0 ;;
"Configure") $TERM $EDITOR $DOTDIR/config ; exit 0 ;;
"Configure") $TERM $EDITOR $DOTDIR/dfmpegrc ; exit 0 ;;
"Convert") convert ; exit 0 ;;
"") exit 0 ;;
"..") $0 && exit 0 ;;

View file

@ -17,7 +17,7 @@ if [ -e "$HOME/.config/speedwm/globalrc" ]; then
. $HOME/.config/speedwm/globalrc
grep -q HAVE_PASSWORD $HOME/.config/speedwm/globalrc || printf "\nHAVE_PASSWORD=$HAVE_PASSWORD # Whether or not to use the Password argument if a script requests it. If you do not have the dmenu password patch, set this to false. Doing so will disable password prompts." >> $HOME/.config/speedwm/globalrc
else
mkdir -p $HOME/.config/speedwm/global
printf "HAVE_GRID=$HAVE_GRID # Whether or not to use the Grid argument. If you do not have the dmenu grid patch, set this to false. Doing so will disable grid." > $HOME/.config/speedwm/globalrc
printf "\nHAVE_PASSWORD=$HAVE_PASSWORD # Whether or not to use the Password argument if a script requests it. If you do not have the dmenu password patch, set this to false. Doing so will disable password prompts." >> $HOME/.config/speedwm/globalrc
fi
@ -34,11 +34,11 @@ SHOW_PASSWORD="true"
test ${BINDIR}iwctl || exit 0
if [ -e "$HOME/.config/speedwm/netctrl/config" ]; then
. $HOME/.config/speedwm/netctrl/config
if [ -e "$HOME/.config/speedwm/netctrlrc" ]; then
. $HOME/.config/speedwm/netctrlrc
else
mkdir -p $HOME/.config/speedwm/netctrl
printf "SHOW_PASSWORD=$SHOW_PASSWORD # Show password when entering it or not? Requires the 'password' dmenu patch. If you do not have it, you can get my build. You also need to enable it in $HOME/.config/speedwm/globalrc. (true/false)" > $HOME/.config/speedwm/netctrl/config
printf "SHOW_PASSWORD=$SHOW_PASSWORD # Show password when entering it or not? Requires the 'password' dmenu patch. If you do not have it, you can get my build. You also need to enable it in $HOME/.config/speedwm/globalrc. (true/false)" > $HOME/.config/speedwm/netctrlrc
fi
if [ "$SHOW_PASSWORD" = "false" ]; then

View file

@ -17,7 +17,7 @@ HAVE_GRID="true"
if [ -e "$HOME/.config/speedwm/globalrc" ]; then
. $HOME/.config/speedwm/globalrc
else
mkdir -p $HOME/.config/speedwm/global
printf "HAVE_GRID=$HAVE_GRID # Whether or not to use the Grid argument. If you do not have the dmenu grid patch, set this to false. Doing so will disable grid." > $HOME/.config/speedwm/globalrc
fi
@ -29,7 +29,7 @@ if [ "$HAVE_GRID" = "true" ]; then
GRIDARG="-g"
fi
EXPORTDIR=$HOME/.config/speedwm/screenshotutil
EXPORTDIR=$HOME/.config/speedwm
mkdir -p $EXPORTDIR
@ -38,12 +38,12 @@ SHOWCURSOR="true" # Show cursor or not (true/false)
DEFAULTSCREENSHOTPATH=$HOME/Screenshots # Default screenshot path
FORMAT="+%T_%D" # Screenshot format
if [ -e "$EXPORTDIR/config" ]; then
. $EXPORTDIR/config
if [ -e "$EXPORTDIR/screenshotutilrc" ]; then
. $EXPORTDIR/screenshotutilrc
else
printf "SHOWCURSOR=$SHOWCURSOR # Show cursor or not (true/false)" > $EXPORTDIR/config
printf "\nDEFAULTSCREENSHOTPATH=$DEFAULTSCREENSHOTPATH # Where screenshots are saved\n" >> $EXPORTDIR/config
echo "FORMAT='$FORMAT' # Where screenshots are saved. : and / will be replaced with _ and nothing respectively." >> $EXPORTDIR/config
printf "SHOWCURSOR=$SHOWCURSOR # Show cursor or not (true/false)" > $EXPORTDIR/screenshotutilrc
printf "\nDEFAULTSCREENSHOTPATH=$DEFAULTSCREENSHOTPATH # Where screenshots are saved\n" >> $EXPORTDIR/screenshotutilrc
echo "FORMAT='$FORMAT' # Where screenshots are saved. : and / will be replaced with _ and nothing respectively." >> $EXPORTDIR/screenshotutilrc
fi
case "$SHOWCURSOR" in
@ -64,19 +64,24 @@ HELP() {
# Sleep argument (-t)
if [ "$1" = "-t" ]; then
sleep $2 && maim -s${ARG2}B > /tmp/screenshot-$DATE || exit 0
sleep "$2" && maim -s${ARG2}B > /tmp/screenshot-$DATE || exit 0
fi
# Open argument (-o)
if [ "$1" = "-o" ]; then
cat $2 > /tmp/screenshot-$DATE
if [ -e "$2" ]; then
cat "$2" > /tmp/screenshot-$DATE
else
printf "File $2 not found.\n"
exit 1
fi
fi
# Sleep and full argument (-tf)
if [ "$1" = "-tf" ]; then
sleep $2 && maim -${ARG2}B > /tmp/screenshot-$DATE || exit 0
sleep "$2" && maim -${ARG2}B > /tmp/screenshot-$DATE || exit 0
elif [ "$1" = "-ft" ]; then
sleep $2 && maim -${ARG2}B > /tmp/screenshot-$DATE || exit 0
sleep "$2" && maim -${ARG2}B > /tmp/screenshot-$DATE || exit 0
fi
# Full argument (-f)

View file

@ -1,5 +1,5 @@
#!/bin/sh
# speedwm-shutdwon
# speedwm-shutdown
# This simple script uses $RUNLAUNCHER to ask the user what action they want to perform.
#
# NOTE: You must either permit nopass for poweroff and reboot commands for your user or simply enable nopass entirely!!
@ -16,7 +16,7 @@ HAVE_GRID="true"
if [ -e "$HOME/.config/speedwm/globalrc" ]; then
. $HOME/.config/speedwm/globalrc
else
mkdir -p $HOME/.config/speedwm/global
printf "HAVE_GRID=$HAVE_GRID # Whether or not to use the Grid argument. If you do not have the dmenu grid patch, set this to false. Doing so will disable grid." > $HOME/.config/speedwm/globalrc
fi
@ -30,7 +30,7 @@ fi
BINDIR="$(dirname $(command -v speedwm-core))/"
EXPORTDIR=$HOME/.config/speedwm/powermenu
EXPORTDIR=$HOME/.config/speedwm
mkdir -p $EXPORTDIR
command -v sudo > /dev/null && PERM=sudo
@ -53,21 +53,21 @@ USEDEFAULTCOLORS=true
LOCK_TEXT=""
# Load config if available and override settings
if [ -e "$EXPORTDIR/config" ]; then
. $EXPORTDIR/config
if [ -e "$EXPORTDIR/powermenurc" ]; then
. $EXPORTDIR/powermenurc
else
printf "# Colors for the prompt. Replace the color values with 'dmenu' for regular default colors." > $EXPORTDIR/config
printf "\nCOL_NORMAL_TEXT_NORMAL=$COL_NORMAL_TEXT_NORMAL # Text color for not selected options (Regular prompt)" >> $EXPORTDIR/config
printf "\nCOL_NORMAL_TEXT_SELECTED=$COL_NORMAL_TEXT_SELECTED # Text color for selected option (Regular prompt)" >> $EXPORTDIR/config
printf "\nCOL_NORMAL_BACKGROUND_NORMAL=$COL_NORMAL_BACKGROUND_NORMAL # Background color for not selected options (Regular prompt)" >> $EXPORTDIR/config
printf "\nCOL_NORMAL_BACKGROUND_SELECTED=$COL_NORMAL_BACKGROUND_SELECTED # Background color for selected option (Regular prompt)" >> $EXPORTDIR/config
printf "\nCOL_WARNING_TEXT_NORMAL=$COL_WARNING_TEXT_NORMAL # Text color for not selected options (Warning prompt)" >> $EXPORTDIR/config
printf "\nCOL_WARNING_TEXT_SELECTED=$COL_WARNING_TEXT_SELECTED # Text color for selected option (Warning prompt)" >> $EXPORTDIR/config
printf "\nCOL_WARNING_BACKGROUND_NORMAL=$COL_WARNING_BACKGROUND_NORMAL # Background color for not selected options (Warning prompt)" >> $EXPORTDIR/config
printf "\nCOL_WARNING_BACKGROUND_SELECTED=$COL_WARNING_BACKGROUND_SELECTED # Background color for selected option (Warning prompt)" >> $EXPORTDIR/config
printf "\nPERM=$PERM # Root access tool (sudo, doas, etc.). Must support nopass for poweroff and reboot commands." >> $EXPORTDIR/config
printf "\nUSEDEFAULTCOLORS=$USEDEFAULTCOLORS # Use $RUNLAUNCHER colors instead of custom ones (true/false)" >> $EXPORTDIR/config
printf "\nLOCK_TEXT=$LOCK_TEXT # Text to display on the lock screen. Only works with slock and requires the message patch." >> $EXPORTDIR/config
printf "# Colors for the prompt. Replace the color values with 'dmenu' for regular default colors." > $EXPORTDIR/powermenurc
printf "\nCOL_NORMAL_TEXT_NORMAL=$COL_NORMAL_TEXT_NORMAL # Text color for not selected options (Regular prompt)" >> $EXPORTDIR/powermenurc
printf "\nCOL_NORMAL_TEXT_SELECTED=$COL_NORMAL_TEXT_SELECTED # Text color for selected option (Regular prompt)" >> $EXPORTDIR/powermenurc
printf "\nCOL_NORMAL_BACKGROUND_NORMAL=$COL_NORMAL_BACKGROUND_NORMAL # Background color for not selected options (Regular prompt)" >> $EXPORTDIR/powermenurc
printf "\nCOL_NORMAL_BACKGROUND_SELECTED=$COL_NORMAL_BACKGROUND_SELECTED # Background color for selected option (Regular prompt)" >> $EXPORTDIR/powermenurc
printf "\nCOL_WARNING_TEXT_NORMAL=$COL_WARNING_TEXT_NORMAL # Text color for not selected options (Warning prompt)" >> $EXPORTDIR/powermenurc
printf "\nCOL_WARNING_TEXT_SELECTED=$COL_WARNING_TEXT_SELECTED # Text color for selected option (Warning prompt)" >> $EXPORTDIR/powermenurc
printf "\nCOL_WARNING_BACKGROUND_NORMAL=$COL_WARNING_BACKGROUND_NORMAL # Background color for not selected options (Warning prompt)" >> $EXPORTDIR/powermenurc
printf "\nCOL_WARNING_BACKGROUND_SELECTED=$COL_WARNING_BACKGROUND_SELECTED # Background color for selected option (Warning prompt)" >> $EXPORTDIR/powermenurc
printf "\nPERM=$PERM # Root access tool (sudo, doas, etc.). Must support nopass for poweroff and reboot commands." >> $EXPORTDIR/powermenurc
printf "\nUSEDEFAULTCOLORS=$USEDEFAULTCOLORS # Use $RUNLAUNCHER colors instead of custom ones (true/false)" >> $EXPORTDIR/powermenurc
printf "\nLOCK_TEXT=$LOCK_TEXT # Text to display on the lock screen. Only works with slock and requires the message patch." >> $EXPORTDIR/powermenurc
fi
case "$LOCK_TEXT" in

View file

@ -27,7 +27,7 @@ if [ -e "$HOME/.config/speedwm/globalrc" ]; then
. $HOME/.config/speedwm/globalrc
echo "Loaded configuration!"
else
mkdir -p $HOME/.config/speedwm/global
printf "HAVE_GRID=$HAVE_GRID # Whether or not to use the Grid argument. If you do not have the dmenu grid patch, set this to false. Doing so will disable grid." > $HOME/.config/speedwm/globalrc
fi
@ -45,7 +45,7 @@ fi
# Create the configuration
SWAL_MKCONFIG() {
mkdir -p $SWAL_EXPORTDIR
touch $SWAL_EXPORTDIR/config
touch $SWAL_EXPORTDIR/swalrc
SWAL_ASK_WAL_NEW=$SWAL_ASK_WAL
SWAL_WALLPAPERDIR_NEW=$SWAL_WALLPAPERDIR
@ -90,13 +90,13 @@ SWAL_MKCONFIG() {
$0 && exit 0
fi
printf "SWAL_WALLPAPERDIR=$SWAL_WALLPAPERDIR_NEW" > $SWAL_EXPORTDIR/config
printf "\nRUNLAUNCHER=$RUNLAUNCHER" >> $SWAL_EXPORTDIR/config
printf "\nSWAL_OPT=$SWAL_OPT" >> $SWAL_EXPORTDIR/config
printf "\nSWAL_EXPORTDIR=$SWAL_EXPORTDIR" >> $SWAL_EXPORTDIR/config
printf "\nSWAL_IMAGE_VIEWER='$SWAL_IMAGE_VIEWER'" >> $SWAL_EXPORTDIR/config
printf "\nSWAL_ASK_WAL=$SWAL_ASK_WAL_NEW" >> $SWAL_EXPORTDIR/config
printf "\nSWAL_RANDOMIZE=$SWAL_RANDOMIZE" >> $SWAL_EXPORTDIR/config
printf "SWAL_WALLPAPERDIR=$SWAL_WALLPAPERDIR_NEW" > $SWAL_EXPORTDIR/swalrc
printf "\nRUNLAUNCHER=$RUNLAUNCHER" >> $SWAL_EXPORTDIR/swalrc
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_RANDOMIZE=$SWAL_RANDOMIZE" >> $SWAL_EXPORTDIR/swalrc
}
# Binary directory
@ -105,8 +105,8 @@ SWAL_OLDWALLPAPERDIR=$SWAL_WALLPAPERDIR
# Source things
SWAL_SOURCE()
{
ls "$SWAL_EXPORTDIR/config" || SWAL_MKCONFIG
. "$SWAL_EXPORTDIR/config" || rm -f "$SWAL_EXPORTDIR/config"
ls "$SWAL_EXPORTDIR/swalrc" || SWAL_MKCONFIG
. "$SWAL_EXPORTDIR/swalrc" || rm -f "$SWAL_EXPORTDIR/swalrc"
}
# Set image viewer if none is specified.

View file

@ -11,7 +11,7 @@ HAVE_GRID="true"
if [ -e "$HOME/.config/speedwm/globalrc" ]; then
. $HOME/.config/speedwm/globalrc
else
mkdir -p $HOME/.config/speedwm/global
printf "HAVE_GRID=$HAVE_GRID # Whether or not to use the Grid argument. If you do not have the dmenu grid patch, set this to false. Doing so will disable grid." > $HOME/.config/speedwm/globalrc
fi

View file

@ -11,7 +11,7 @@ HAVE_GRID="true"
if [ -e "$HOME/.config/speedwm/globalrc" ]; then
. $HOME/.config/speedwm/globalrc
else
mkdir -p $HOME/.config/speedwm/global
printf "HAVE_GRID=$HAVE_GRID # Whether or not to use the Grid argument. If you do not have the dmenu grid patch, set this to false. Doing so will disable grid." > $HOME/.config/speedwm/globalrc
fi

View file

@ -27,7 +27,7 @@ HAVE_GRID="true"
if [ -e "$HOME/.config/speedwm/globalrc" ]; then
. $HOME/.config/speedwm/globalrc
else
mkdir -p $HOME/.config/speedwm/global
printf "HAVE_GRID=$HAVE_GRID # Whether or not to use the Grid argument. If you do not have the dmenu grid patch, set this to false. Doing so will disable grid." > $HOME/.config/speedwm/globalrc
fi
@ -44,16 +44,16 @@ case "$RUNLAUNCHER" in
esac
BINDIR="$(dirname $(command -v speedwm-core))/"
DOTDIR=$HOME/.config/speedwm/winnav
DOTDIR="$HOME/.config/speedwm"
POSITION="bottom" # top, bottom, center (your $RUNLAUNCHER must support center for this to work)
mkdir -p $HOME/.config/speedwm/winnav
mkdir -p "$DOTDIR"
# Create config if it does not exist.
if [ -e "$HOME/.config/speedwm/winnav/config" ]; then
. $HOME/.config/speedwm/winnav/config
if [ -e "$DOTDIR/winnavrc" ]; then
. "$DOTDIR/winnavrc"
else
printf "POSITION=$POSITION # top, bottom, center (Your installed $RUNLAUNCHER must support center (-c) for this to work)" > $HOME/.config/speedwm/winnav/config
printf "POSITION=$POSITION # top, bottom, center (Your installed $RUNLAUNCHER must support center (-c) for this to work)" > $DOTDIR/winnavrc
fi
# Set position based on config