From 231bfa1d7aa2befb94abe1782eb055eb532aa495 Mon Sep 17 00:00:00 2001 From: speediegq Date: Tue, 23 Aug 2022 15:47:37 +0200 Subject: [PATCH] Add password toggle to global config --- scripts/speedwm-btctrl | 23 +++++++++++++++--- scripts/speedwm-dfmpeg | 22 ++++++++++++++--- scripts/speedwm-netctrl | 29 ++++++++++++++++++---- scripts/speedwm-pdfopen | 18 +++++++++++++- scripts/speedwm-screenshotutil | 18 +++++++++++++- scripts/speedwm-shutdown | 18 +++++++++++++- scripts/speedwm-swal | 43 +++++++++++++++++++++++---------- scripts/speedwm-utils | 18 +++++++++++++- scripts/speedwm-virtualkeyboard | 20 +++++++++++++-- scripts/speedwm-winnav | 19 ++++++++++++++- scripts/speedwm_run | 18 +++++++++++++- 11 files changed, 214 insertions(+), 32 deletions(-) diff --git a/scripts/speedwm-btctrl b/scripts/speedwm-btctrl index 08544c2..ddf3038 100755 --- a/scripts/speedwm-btctrl +++ b/scripts/speedwm-btctrl @@ -12,11 +12,28 @@ CHECK() { BINDIR=$(cat /usr/share/speedwm-bindir) # Set binary directory to the contents of this file for NixOS support } +HAVE_GRID="true" + +if [ -e "$HOME/.config/speedwm-de/global/config" ]; then + . $HOME/.config/speedwm-de/global/config +else + mkdir -p $HOME/.config/speedwm-de/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-de/global/config +fi + +if [ "$HAVE_GRID" = "true" ]; then + GRIDNUM="1" +fi + +if [ "$HAVE_GRID" = "true" ]; then + GRIDARG="-g" +fi + CHECK # Help HELP() { - printf "\n1. Turn on your device\n2. Make sure the bluetooth service is running. If it is not, start it.\n3. Press the pair button on your device\n4. Select your device in the list of devices. If it does not show up, select 'Refresh'.\n5. Select 'Pair' and then optionally 'Trust' to save it in the list of devices.\n6. And finally, select 'Connect' to connect the device." | $RUNLAUNCHER -l 12 -g 1 -p 'How to use' + printf "\n1. Turn on your device\n2. Make sure the bluetooth service is running. If it is not, start it.\n3. Press the pair button on your device\n4. Select your device in the list of devices. If it does not show up, select 'Refresh'.\n5. Select 'Pair' and then optionally 'Trust' to save it in the list of devices.\n6. And finally, select 'Connect' to connect the device." | $RUNLAUNCHER -l 12 $GRIDARG $GRIDNUM -p 'How to use' $0 && exit 0 } @@ -24,7 +41,7 @@ HELP() { ENABLE_BT() { bluetoothctl power on > /dev/null && echo "Power: On" bluetoothctl scan on & # Start scanning for devices - USEROPT_1="$(printf "$(bluetoothctl devices | cut -d\ -f3-)\n------\nRefresh\nHelp\nExit" | $RUNLAUNCHER -l 12 -g 1 -p "Select a device")" + USEROPT_1="$(printf "$(bluetoothctl devices | cut -d\ -f3-)\n------\nRefresh\nHelp\nExit" | $RUNLAUNCHER -l 12 $GRIDARG $GRIDNUM -p "Select a device")" # Check what to do case "$USEROPT_1" in @@ -47,7 +64,7 @@ ENABLE_BT # List options for the device LIST_OPTIONS() { - USEROPT_2="$(echo "-- Options --\nConnect\nDisconnect\n-- Toggle --\nPair\nRemove\nTrust\nUntrust\n--\nExit\nHelp" | $RUNLAUNCHER -g 1 -l 20 -p "What do you want to do with this device?" | awk '{ print $1 }')" + USEROPT_2="$(echo "-- Options --\nConnect\nDisconnect\n-- Toggle --\nPair\nRemove\nTrust\nUntrust\n--\nExit\nHelp" | $RUNLAUNCHER $GRIDARG $GRIDNUM -l 20 -p "What do you want to do with this device?" | awk '{ print $1 }')" } LIST_OPTIONS diff --git a/scripts/speedwm-dfmpeg b/scripts/speedwm-dfmpeg index 1c70881..8149460 100755 --- a/scripts/speedwm-dfmpeg +++ b/scripts/speedwm-dfmpeg @@ -15,6 +15,22 @@ case "$RUNLAUNCHER" in "") RUNLAUNCHER=dmenu esac +HAVE_GRID="true" +if [ -e "$HOME/.config/speedwm-de/global/config" ]; then + . $HOME/.config/speedwm-de/global/config +else + mkdir -p $HOME/.config/speedwm-de/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-de/global/config +fi + +if [ "$HAVE_GRID" = "true" ]; then + GRIDNUM="1" +fi + +if [ "$HAVE_GRID" = "true" ]; then + GRIDARG="-g" +fi + # Write default configuration defaultConfig() { RESOLUTION="1920x1080" # The resolution to record in @@ -130,7 +146,7 @@ encodeopts() { case "$(printf 'Encode last recording\nEncode video\n------\n..\nExit' | $RUNLAUNCHER -l 40 -p 'Encoding options')" in "Encode last recording") encode ; exit 0 ;; - "Encode video") echo "$(echo "" | $RUNLAUNCHER -l 1 -g 1 -p "What file do you want to encode?")" > /tmp/outputfilename && 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 ;; "------") $0 && exit 0 ;; "Exit") exit 0 ;; "..") $0 && exit 0 ;; @@ -142,7 +158,7 @@ encodeopts() { MORE_OPTIONS() { case "$(printf 'Encode\nConvert\nConfigure\n------\n..\nExit' | $RUNLAUNCHER -l 40 -p 'More options')" in "Encode last recording") encode ; exit 0 ;; - "Encode video") echo "$(echo "" | $RUNLAUNCHER -l 1 -g 1 -p "What file do you want to encode?")" > /tmp/outputfilename && 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 ;; "Convert") convert ; exit 0 ;; @@ -170,7 +186,7 @@ case "$(printf 'Start\nStop\nStart without audio\nPlay last\n------\nMore option echo $about_screen_2 >> /tmp/dfmpeg_about echo $about_screen_3 >> /tmp/dfmpeg_about echo $about_screen_4 >> /tmp/dfmpeg_about - cat /tmp/dfmpeg_about | $RUNLAUNCHER -l 40 -g 1 + cat /tmp/dfmpeg_about | $RUNLAUNCHER -l 40 $GRIDARG $GRIDNUM ;; esac diff --git a/scripts/speedwm-netctrl b/scripts/speedwm-netctrl index c537833..15f23f8 100755 --- a/scripts/speedwm-netctrl +++ b/scripts/speedwm-netctrl @@ -9,6 +9,23 @@ esac BINDIR=$(cat /usr/share/speedwm-bindir) +HAVE_GRID="true" +if [ -e "$HOME/.config/speedwm-de/global/config" ]; then + . $HOME/.config/speedwm-de/global/config +else + mkdir -p $HOME/.config/speedwm-de/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-de/global/config + 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." +fi + +if [ "$HAVE_GRID" = "true" ]; then + GRIDNUM="1" +fi + +if [ "$HAVE_GRID" = "true" ]; then + GRIDARG="-g" +fi + SHOW_PASSWORD="true" test ${BINDIR}iwctl || exit 0 @@ -17,11 +34,13 @@ if [ -e "$HOME/.config/speedwm-de/netctrl/config" ]; then . $HOME/.config/speedwm-de/netctrl/config else mkdir -p $HOME/.config/speedwm-de/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 (true/false)" > $HOME/.config/speedwm-de/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-de/global/config. (true/false)" > $HOME/.config/speedwm-de/netctrl/config fi if [ "$SHOW_PASSWORD" = "false" ]; then - PASS_ARG="-P" + if [ "$HAVE_PASSWORD" = "true" ]; then + PASS_ARG="-P" + fi fi # Get the device used to connect. @@ -32,7 +51,7 @@ getdevice() { else case "$1" in "") devices="$(printf "\n$(ip link)" | awk '{ print $2 }' | awk 'NR%2==0' | sed "s/://g")" - seldevice=$(echo $devices | sed 's/ /\n/g' | $RUNLAUNCHER -p "What device do you want to connect with?" -l 10 -g 1) && echo $seldevice > $HOME/.local/share/seldevice ;; + seldevice=$(echo $devices | sed 's/ /\n/g' | $RUNLAUNCHER -p "What device do you want to connect with?" -l 10 $GRIDARG $GRIDNUM) && echo $seldevice > $HOME/.local/share/seldevice ;; esac fi @@ -43,7 +62,7 @@ getdevice() { connectwifi() { iwctl station $seldevice scan - network="$(printf "$(iwctl station $seldevice get-networks | sed -n 6,20p | sed "s|>||g" | awk '{ print $1 }')\n------\nExit" | sed "s| |No networks found|g" | $RUNLAUNCHER -l 10 -g 1 -p "Select a network to connect to" | sed "s|------||g" | sed "s|No networks found| |g")" + network="$(printf "$(iwctl station $seldevice get-networks | sed -n 6,20p | sed "s|>||g" | awk '{ print $1 }')\n------\nExit" | sed "s| |No networks found|g" | $RUNLAUNCHER -l 10 $GRIDARG $GRIDNUM -p "Select a network to connect to" | sed "s|------||g" | sed "s|No networks found| |g")" case "$network" in "") $0 && exit 0 ;; @@ -53,7 +72,7 @@ connectwifi() { iwctl station $seldevice get-networks | grep "$network" > /dev/null || exit 1 connect_pass() { - PASSPHRASE=$(printf "\n" | $RUNLAUNCHER -p "This network is protected. Enter the passphrase." -l 1 -g 1 $PASS_ARG) + PASSPHRASE=$(printf "\n" | $RUNLAUNCHER -p "This network is protected. Enter the passphrase." -l 1 $GRIDARG $GRIDNUM $PASS_ARG) case "$PASSPHRASE" in "") exit 0 ;; esac diff --git a/scripts/speedwm-pdfopen b/scripts/speedwm-pdfopen index 676c760..beece8d 100755 --- a/scripts/speedwm-pdfopen +++ b/scripts/speedwm-pdfopen @@ -8,7 +8,23 @@ case "$RUNLAUNCHER" in "") RUNLAUNCHER=dmenu ;; esac -SELPDF=$(ls -Ap1 *.pdf | $RUNLAUNCHER -g 1 -l 50 -p "What PDF do you want to open?") +HAVE_GRID="true" +if [ -e "$HOME/.config/speedwm-de/global/config" ]; then + . $HOME/.config/speedwm-de/global/config +else + mkdir -p $HOME/.config/speedwm-de/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-de/global/config +fi + +if [ "$HAVE_GRID" = "true" ]; then + GRIDNUM="1" +fi + +if [ "$HAVE_GRID" = "true" ]; then + GRIDARG="-g" +fi + +SELPDF=$(ls -Ap1 *.pdf | $RUNLAUNCHER $GRIDARG $GRIDNUM -l 50 -p "What PDF do you want to open?") case "$SELPDF" in "") exit 0 ;; diff --git a/scripts/speedwm-screenshotutil b/scripts/speedwm-screenshotutil index 64fff49..03389f4 100755 --- a/scripts/speedwm-screenshotutil +++ b/scripts/speedwm-screenshotutil @@ -17,6 +17,22 @@ else BINDIR="/usr/bin/" fi +HAVE_GRID="true" +if [ -e "$HOME/.config/speedwm-de/global/config" ]; then + . $HOME/.config/speedwm-de/global/config +else + mkdir -p $HOME/.config/speedwm-de/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-de/global/config +fi + +if [ "$HAVE_GRID" = "true" ]; then + GRIDNUM="1" +fi + +if [ "$HAVE_GRID" = "true" ]; then + GRIDARG="-g" +fi + EXPORTDIR=$HOME/.config/speedwm-de/screenshotutil mkdir -p $EXPORTDIR @@ -127,7 +143,7 @@ mkdir -p $DEFAULTSCREENSHOTPATH case "$U_INPUT" in "Image") cat /tmp/screenshot-$DATE | xclip -selection clipboard -t image/png && SENDNOTIF_IMG ;; "URL") printf "\n" | xclip -selection clipboard && curl -s -F source=@"/tmp/screenshot-$DATE" -F "type=file" -F "action=upload" "https://imgbb.com/json" | sed "s/\\\\//g; s/\"/\\n/g" | grep -m 1 -A 2 url | tail -n 1 | xclip -selection clipboard && SENDNOTIF_URL ;; -"Save") SAVEDIR=$(printf "$DEFAULTSCREENSHOTPATH/screenshot-$(date "$FORMAT" | sed "s|:|-|g" | sed "s|/||g").png" | $RUNLAUNCHER -l 1 -g 1 -p "Where do you want to save it? (Including filename)") && cat /tmp/screenshot-$DATE > $SAVEDIR && SENDNOTIF_SAVE ;; +"Save") SAVEDIR=$(printf "$DEFAULTSCREENSHOTPATH/screenshot-$(date "$FORMAT" | sed "s|:|-|g" | sed "s|/||g").png" | $RUNLAUNCHER -l 1 $GRIDARG $GRIDNUM -p "Where do you want to save it? (Including filename)") && cat /tmp/screenshot-$DATE > $SAVEDIR && SENDNOTIF_SAVE ;; esac rm -f /tmp/screenshot* # Remove the screenshots diff --git a/scripts/speedwm-shutdown b/scripts/speedwm-shutdown index 3673fb1..a9149c3 100755 --- a/scripts/speedwm-shutdown +++ b/scripts/speedwm-shutdown @@ -12,6 +12,22 @@ case "$TERMINAL" in "") TERMINAL=st ;; esac +HAVE_GRID="true" +if [ -e "$HOME/.config/speedwm-de/global/config" ]; then + . $HOME/.config/speedwm-de/global/config +else + mkdir -p $HOME/.config/speedwm-de/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-de/global/config +fi + +if [ "$HAVE_GRID" = "true" ]; then + GRIDNUM="1" +fi + +if [ "$HAVE_GRID" = "true" ]; then + GRIDARG="-g" +fi + if [ -e "/usr/share/speedwm-bindir" ]; then BINDIR=$(cat /usr/share/speedwm-bindir) else @@ -60,7 +76,7 @@ case "$LOCK_TEXT" in esac MOREOPTS() { - USER_OPT3=$(printf "Restart speedwm\nEnd task\nspeedwm command\nUpdate speedwm\n.." | $RUNLAUNCHER -l 4 -g 1 -p "What do you want to do?" -nb "$COL_NORMAL_BACKGROUND_NORMAL" -sb "$COL_NORMAL_BACKGROUND_SELECTED" -nf "$COL_NORMAL_TEXT_NORMAL" -sf "$COL_NORMAL_TEXT_SELECTED") + USER_OPT3=$(printf "Restart speedwm\nEnd task\nspeedwm command\nUpdate speedwm\n.." | $RUNLAUNCHER -l 4 $GRIDARG $GRIDNUM -p "What do you want to do?" -nb "$COL_NORMAL_BACKGROUND_NORMAL" -sb "$COL_NORMAL_BACKGROUND_SELECTED" -nf "$COL_NORMAL_TEXT_NORMAL" -sf "$COL_NORMAL_TEXT_SELECTED") case "$USER_OPT3" in "") exit 0 ;; diff --git a/scripts/speedwm-swal b/scripts/speedwm-swal index 72fe26b..fa22c1f 100755 --- a/scripts/speedwm-swal +++ b/scripts/speedwm-swal @@ -20,6 +20,23 @@ SWAL_DEFAULT_CONFIG() SWAL_RANDOMIZE=false # Select a random wallpaper on login } +HAVE_GRID="true" +if [ -e "$HOME/.config/speedwm-de/global/config" ]; then + . $HOME/.config/speedwm-de/global/config +else + mkdir -p $HOME/.config/speedwm-de/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-de/global/config +fi + +if [ "$HAVE_GRID" = "true" ]; then + GRIDNUM="1" +fi + +if [ "$HAVE_GRID" = "true" ]; then + GRIDARG="-g" +fi + + SWAL_MKCONFIG() { mkdir -p $SWAL_EXPORTDIR touch $SWAL_EXPORTDIR/config @@ -27,22 +44,22 @@ SWAL_MKCONFIG() { 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_WALLPAPERDIR_NEW=$(printf "Your wallpaper directory" | $RUNLAUNCHER $GRIDARG $GRIDNUM -p "Where are all your wallpapers stored?" -l 1) } SWAL_CHANGE_ASK_WAL() { - wal -v > /dev/null && SWAL_ASK_WAL_NEW=$(printf "Yes\nNo" | $RUNLAUNCHER -g 1 -p "Ask whether or not to use Pywal?" -l 2 | sed "s|No|false|g" | sed "s|Yes|true|g") + wal -v > /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") } 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_IMAGE_VIEWER=$(printf "" | $RUNLAUNCHER $GRIDARG $GRIDNUM -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" | 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" | sed "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 $GRIDARG $GRIDNUM -l 10 -p "What setting do you want to change?") case "$USER_OPT_ACTION" in "") $0 && exit 0 ;; @@ -121,21 +138,21 @@ SWAL_USAGE() { SWAL_SELWALLPAPER() { case "$NEW1" in - "") ls /tmp/swal_cpath || SWAL_SELWALLPAPER="$(printf "$(ls "$SWAL_WALLPAPERDIR")\n------\n..\nPreview\nPrevious\nRandom\nFavorites\nAdd used wallpaper to favorites\nOptions\nHelp\nExit" | $RUNLAUNCHER -g 1 -l 100 -p "What wallpaper would you like to set?")" ;; + "") ls /tmp/swal_cpath || SWAL_SELWALLPAPER="$(printf "$(ls "$SWAL_WALLPAPERDIR")\n------\n..\nPreview\nPrevious\nRandom\nFavorites\nAdd used wallpaper to favorites\nOptions\nHelp\nExit" | $RUNLAUNCHER $GRIDARG $GRIDNUM -l 100 -p "What wallpaper would you like to set?")" ;; "-w") SWAL_SELWALLPAPER="$(basename "$NEW2")" && touch /tmp/swal_cpath ;; - "-h") SWAL_HELP | $RUNLAUNCHER -g 1 -l 90 ;; + "-h") SWAL_HELP | $RUNLAUNCHER $GRIDARG $GRIDNUM 1 -l 90 ;; "-f") SWAL_FSIGNAL_RELOAD_XRESOURCES="$NEW2" ;; esac case "$NEW3" in "-w") SWAL_SELWALLPAPER="$(basename "$NEW4")" && touch /tmp/swal_cpath ;; - "-h") SWAL_HELP | $RUNLAUNCHER -g 1 -l 90 ;; + "-h") SWAL_HELP | $RUNLAUNCHER $GRIDARG $GRIDNUM -l 90 ;; "-f") SWAL_FSIGNAL_RELOAD_XRESOURCES="$NEW4" ;; esac case "$NEW5" in "-w") SWAL_SELWALLPAPER="$(basename "$NEW6")" && touch /tmp/swal_cpath ;; - "-h") SWAL_HELP | $RUNLAUNCHER -g 1 -l 90 ;; + "-h") SWAL_HELP | $RUNLAUNCHER $GRIDARG $GRIDNUM -l 90 ;; "-f") SWAL_FSIGNAL_RELOAD_XRESOURCES="$NEW6" ;; esac } @@ -145,14 +162,14 @@ SWAL_SETTYPE() 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 ;; + "Favorites") SWAL_SELWALLPAPER="$(printf "$(cat $SWAL_EXPORTDIR/favorites.filename)\n------\n..\nClear\n\nExit" | $RUNLAUNCHER $GRIDARG $GRIDNUM -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="$(basename $($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 ;; + "Help") SWAL_USAGE | $RUNLAUNCHER $GRIDARG $GRIDNUM -l 50 -p "How to use" && $0 && exit 0 ;; "------") $0 && exit 0 ;; esac @@ -188,7 +205,7 @@ SWAL_SETTYPE() ls "$SWAL_WALLPAPERDIR/$SWAL_SELWALLPAPER" || FAIL_NOT_REAL - 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?" $GRIDARG $GRIDNUM -l 7) case "$SWAL_TYPE" in "Center") SWAL_TYPE=center ;; @@ -204,7 +221,7 @@ SWAL_SETTYPE() SWAL_WAL_STATUS="0" case "$SWAL_ASK_WAL" in - "true") wal -v && SWAL_USE_WAL=$(printf "Yes\nNo" | $RUNLAUNCHER -g 1 -l 90 -p "Do you want to use Pywal?" -l 2) && SWAL_WAL_STATUS="1" ;; + "true") wal -v && 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") wal -v && SWAL_USE_WAL="Yes" && SWAL_WAL_STATUS="1" ;; esac diff --git a/scripts/speedwm-utils b/scripts/speedwm-utils index 2b39bd9..759bb27 100755 --- a/scripts/speedwm-utils +++ b/scripts/speedwm-utils @@ -7,6 +7,22 @@ case "$RUNLAUNCHER" in "") RUNLAUNCHER=dmenu # Run launcher to use (dmenu, rofi, etc.) ;; esac +HAVE_GRID="true" +if [ -e "$HOME/.config/speedwm-de/global/config" ]; then + . $HOME/.config/speedwm-de/global/config +else + mkdir -p $HOME/.config/speedwm-de/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-de/global/config +fi + +if [ "$HAVE_GRID" = "true" ]; then + GRIDNUM="1" +fi + +if [ "$HAVE_GRID" = "true" ]; then + GRIDARG="-g" +fi + VARS() { BINDIR=$(cat /usr/share/speedwm-bindir) @@ -81,7 +97,7 @@ esac HELP() { printf "speedwmutils allows you to control speedwm using your terminal or dmenu/rofi.\n-- Arguments --\n-layout | Let the user select a speedwm layout\n-reloadxrdb | Reload .Xresources\n-spawn | Spawn a command through speedwm\n-exec | Execute an fsignal signum\n-list | List all available signums\n" > /tmp/speedwm-printed-help pgrep -x $RUNLAUNCHER || cat /tmp/speedwm-printed-help - pgrep -x $RUNLAUNCHER && cat /tmp/speedwm-printed-help | $RUNLAUNCHER -p 'speedwmutils help' -g 1 -l 20 + pgrep -x $RUNLAUNCHER && cat /tmp/speedwm-printed-help | $RUNLAUNCHER -p 'speedwmutils help' $GRIDARG $GRIDNUM -l 20 } case "$1" in diff --git a/scripts/speedwm-virtualkeyboard b/scripts/speedwm-virtualkeyboard index ac00176..d6ce00b 100755 --- a/scripts/speedwm-virtualkeyboard +++ b/scripts/speedwm-virtualkeyboard @@ -7,6 +7,22 @@ case "$RUNLAUNCHER" in "") RUNLAUNCHER=dmenu ;; esac +HAVE_GRID="true" +if [ -e "$HOME/.config/speedwm-de/global/config" ]; then + . $HOME/.config/speedwm-de/global/config +else + mkdir -p $HOME/.config/speedwm-de/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-de/global/config +fi + +if [ "$HAVE_GRID" = "true" ]; then + GRIDNUM="1" +fi + +if [ "$HAVE_GRID" = "true" ]; then + GRIDARG="-g" +fi + BINDIR=$(cat /usr/share/speedwm-bindir) EMOJILIST() @@ -2219,7 +2235,7 @@ ARABICCOPY elif [ "$ACTION" = "Romanian letters" ]; then ROMANIANCOPY elif [ "$ACTION" = "Credits" ]; then -CREDIT_SEL=$(printf "$(DBOARD_CREDITS)" | $RUNLAUNCHER -p 'dboard was created with the help of and by: ' -l 20 -g 1) +CREDIT_SEL=$(printf "$(DBOARD_CREDITS)" | $RUNLAUNCHER -p 'dboard was created with the help of and by: ' -l 20 $GRIDARG $GRIDNUM) case "$CREDIT_SEL" in "speedie - Wrote the script & Swedish characters") $BROWSER 'https://speedie.gq' ;; "jornmann - Helped out with some code") $BROWSER 'https://donut.gq' ;; @@ -2231,7 +2247,7 @@ esac elif [ "$ACTION" = "Exit" ]; then exit 0 elif [ "$ACTION" = "About" ]; then -printf "$(DBOARD_ABOUT)" | $RUNLAUNCHER -p 'About dboard: ' -l 20 -g 1 +printf "$(DBOARD_ABOUT)" | $RUNLAUNCHER -p 'About dboard: ' -l 20 $GRIDARG $GRIDNUM fi exit 0 diff --git a/scripts/speedwm-winnav b/scripts/speedwm-winnav index 85f0597..09ae4f2 100755 --- a/scripts/speedwm-winnav +++ b/scripts/speedwm-winnav @@ -22,6 +22,23 @@ RESTORE() { fi } +HAVE_GRID="true" + +if [ -e "$HOME/.config/speedwm-de/global/config" ]; then + . $HOME/.config/speedwm-de/global/config +else + mkdir -p $HOME/.config/speedwm-de/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-de/global/config +fi + +if [ "$HAVE_GRID" = "true" ]; then + GRIDNUM="1" +fi + +if [ "$HAVE_GRID" = "true" ]; then + GRIDARG="-g" +fi + case "$RUNLAUNCHER" in "") RUNLAUNCHER=dmenu ;; esac @@ -87,7 +104,7 @@ windows=$(echo "$windows" | \ $1 = ""; printf "%s\n", $0}') -target=$(printf "\n$windows" | cut -f 2- -d ' ' | sed 's/^ *//g' | $RUNLAUNCHER $POSARG -l 10 -g 1 -p "Which window?" | tr -s '[:blank:]' | sed "s/$class | //g") +target=$(printf "\n$windows" | cut -f 2- -d ' ' | sed 's/^ *//g' | $RUNLAUNCHER $POSARG -l 10 $GRIDARG $GRIDNUM -p "Which window?" | tr -s '[:blank:]' | sed "s/$class | //g") case "$target" in "") RESTORE && exit 0 ;; diff --git a/scripts/speedwm_run b/scripts/speedwm_run index b2952f2..ecafac7 100755 --- a/scripts/speedwm_run +++ b/scripts/speedwm_run @@ -12,6 +12,22 @@ else echo "Unknown argument: $2" ; exit 1 fi +HAVE_GRID="true" +if [ -e "$HOME/.config/speedwm-de/global/config" ]; then + . $HOME/.config/speedwm-de/global/config +else + mkdir -p $HOME/.config/speedwm-de/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-de/global/config +fi + +if [ "$HAVE_GRID" = "true" ]; then + GRIDNUM="1" +fi + +if [ "$HAVE_GRID" = "true" ]; then + GRIDARG="-g" +fi + # Don't make config if asked not to. if [ -e "$HOME/.local/share/speedwm-do-not-mkconfig" ]; then DONOTMKCONFIG=true @@ -125,7 +141,7 @@ CONFIGURE() { "") RUNLAUNCHER=dmenu esac - $TERMINAL $EDITOR "$(printf "$DOTFILE1\n$DOTFILE2\n$DOTFILE3\n$DOTFILE4\n$DOTFILE5\n$DOTFILE6\n$DOTFILE7\n$DOTFILE8" | $RUNLAUNCHER -l 8 -g 1 -p "Edit which configuration?")" + $TERMINAL $EDITOR "$(printf "$DOTFILE1\n$DOTFILE2\n$DOTFILE3\n$DOTFILE4\n$DOTFILE5\n$DOTFILE6\n$DOTFILE7\n$DOTFILE8" | $RUNLAUNCHER -l 8 $GRIDARG $GRIDNUM -p "Edit which configuration?")" } # List of arguments