Use spmenu instead of dmenu, get rid of global file
This commit is contained in:
parent
74bf68e525
commit
07c9a9b943
2
Makefile
2
Makefile
|
@ -2,7 +2,7 @@
|
|||
# See LICENSE file for copyright and license details.
|
||||
|
||||
PREFIX = /usr
|
||||
VERSION = 1.8
|
||||
VERSION = 1.9
|
||||
|
||||
dist:
|
||||
mkdir -p speedwm-extras-${VERSION}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
# speedwm-extras
|
||||
|
||||
Extra scripts for speedwm.
|
||||
Extra scripts for speedwm, most of them use [spmenu](https://codeberg.org/speedie/spmenu) by default. You can change it to dmenu by exporting $RUNLAUNCHER.
|
||||
|
||||
NOTE: Requires libspeedwm, which can be found here: https://codeberg.org/speedie/libspeedwm.
|
||||
NOTE: Most of the scripts **require** [libspeedwm](https://codeberg.org/speedie/libspeedwm).
|
||||
|
||||
## Usage with speedwm-swal
|
||||
|
||||
|
|
|
@ -1,74 +0,0 @@
|
|||
#!/bin/sh
|
||||
# speedwm-applist
|
||||
# list extra applications
|
||||
# license: gplv3
|
||||
|
||||
# rl
|
||||
case "$RUNLAUNCHER" in
|
||||
"") RUNLAUNCHER=dmenu ;;
|
||||
esac
|
||||
|
||||
# create applist
|
||||
MK_APPLIST() {
|
||||
if [ -e "$HOME/.local/share/speedwm/applist" ]; then
|
||||
USER_CMD="$(printf "%s\n------\nAdd command\nRemove command\nClear\n" "$(cat "$HOME/.local/share/speedwm/applist")" | $RUNLAUNCHER -l 20 -p 'Run:' -g 0)"
|
||||
else
|
||||
mkdir -p "$HOME/.local/share/speedwm"
|
||||
echo "No commands added." > "$HOME/.local/share/speedwm/applist"
|
||||
$0 && exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
# remove commands
|
||||
REMOVE_CMD() {
|
||||
USER_CMD="$(printf "%s\n------\nAdd command\nRemove command\nClear\n" "$(cat "$HOME/.local/share/speedwm/applist")" | $RUNLAUNCHER -l 20 -p 'Remove: ' -g 0)"
|
||||
|
||||
if [ "$(wc -l < "$HOME/.local/share/speedwm/applist")" -lt "2" ]; then
|
||||
rm -f "$HOME/.local/share/speedwm/applist"
|
||||
else
|
||||
grep -v "$USER_CMD" "$HOME/.local/share/speedwm/applist" | sed ':a;N;$!ba;s/\n//g' > "/tmp/applist"
|
||||
mv "/tmp/applist" "$HOME/.local/share/speedwm/applist"
|
||||
fi
|
||||
|
||||
$0 && exit 0
|
||||
}
|
||||
|
||||
|
||||
# clear commands
|
||||
CLEAR_CMD() {
|
||||
case "$(printf "Yes\nNo\n" | $RUNLAUNCHER -l 2 -p 'Are you sure?')" in
|
||||
"Yes") rm -f "$HOME/.local/share/speedwm/applist" ;;
|
||||
esac
|
||||
|
||||
$0 && exit 0
|
||||
}
|
||||
|
||||
|
||||
# add command
|
||||
ADD_CMD() {
|
||||
grep -q "No commands added" "$HOME/.local/share/speedwm/applist" && rm -f "$HOME/.local/share/speedwm/applist"
|
||||
USER_I_ARG="$(printf "" | $RUNLAUNCHER -l 0 -p 'Enter a command:' -g 0)"
|
||||
printf "%s\n" "$USER_I_ARG" >> "$HOME/.local/share/speedwm/applist"
|
||||
$0 && exit 0
|
||||
}
|
||||
|
||||
MK_APPLIST
|
||||
|
||||
# check user cmd
|
||||
if [ "$USER_CMD" = "" ]; then
|
||||
exit 0
|
||||
else
|
||||
if [ "$USER_CMD" = "Add command" ]; then
|
||||
ADD_CMD
|
||||
else
|
||||
if [ "$USER_CMD" = "Clear" ]; then
|
||||
CLEAR_CMD
|
||||
else
|
||||
if [ "$USER_CMD" = "Remove command" ]; then
|
||||
REMOVE_CMD
|
||||
else
|
||||
$USER_CMD
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
|
@ -1,39 +1,17 @@
|
|||
#!/bin/sh
|
||||
# speedwm-btctrl
|
||||
# Basic dmenu/other run launcher Bluetooth manager written for speedwm.
|
||||
# Basic spmenu/other run launcher Bluetooth manager written for speedwm.
|
||||
# Licensed under GNU GPLv3.
|
||||
|
||||
# Check stuff
|
||||
CHECK() {
|
||||
case "$RUNLAUNCHER" in
|
||||
"") RUNLAUNCHER=dmenu ;;
|
||||
esac
|
||||
case "$RUNLAUNCHER" in
|
||||
"") RUNLAUNCHER=spmenu ;;
|
||||
esac
|
||||
|
||||
BINDIR="$(dirname $(command -v speedwm-core))/"
|
||||
}
|
||||
|
||||
HAVE_GRID="true"
|
||||
|
||||
if [ -e "$HOME/.config/speedwm/globalrc" ]; then
|
||||
. $HOME/.config/speedwm/globalrc
|
||||
else
|
||||
|
||||
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
|
||||
|
||||
if [ "$HAVE_GRID" = "true" ]; then
|
||||
GRIDNUM="1"
|
||||
fi
|
||||
|
||||
if [ "$HAVE_GRID" = "true" ]; then
|
||||
GRIDARG="-g"
|
||||
fi
|
||||
|
||||
CHECK
|
||||
BINDIR="$(dirname $(command -v speedwm-winnav))/"
|
||||
|
||||
# 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 $GRIDARG $GRIDNUM -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 -g 1 -p 'How to use'
|
||||
$0 && exit 0
|
||||
}
|
||||
|
||||
|
@ -42,7 +20,7 @@ ENABLE_BT() {
|
|||
bluetoothctl power on > /dev/null && echo "Power: On"
|
||||
bluetoothctl scan on & # Start scanning for devices
|
||||
bluetoothctl devices | grep -q "No default controller" && printf "No Bluetooth controller was found.\n" && exit 1
|
||||
USEROPT_1="$(printf "$(bluetoothctl devices | cut -d\ -f3-)\n------\nRefresh\nHelp\nExit" | $RUNLAUNCHER -l 12 $GRIDARG $GRIDNUM -p "Select a device")"
|
||||
USEROPT_1="$(printf "$(bluetoothctl devices | cut -d\ -f3-)\n------\nRefresh\nHelp\nExit" | $RUNLAUNCHER -l 12 -g 1 -p "Select a device")"
|
||||
|
||||
# Check what to do
|
||||
case "$USEROPT_1" in
|
||||
|
@ -65,7 +43,7 @@ ENABLE_BT
|
|||
|
||||
# List options for the device
|
||||
LIST_OPTIONS() {
|
||||
USEROPT_2="$(echo -e "-- Options --\nConnect\nDisconnect\n-- Toggle --\nPair\nRemove\nTrust\nUntrust\n--\nExit\nHelp" | sed "s/-e //g" | $RUNLAUNCHER $GRIDARG $GRIDNUM -l 20 -p "What do you want to do with this device?" | awk '{ print $1 }')"
|
||||
USEROPT_2="$(echo -e "-- Options --\nConnect\nDisconnect\n-- Toggle --\nPair\nRemove\nTrust\nUntrust\n--\nExit\nHelp" | sed "s/-e //g" | $RUNLAUNCHER -g 1 -l 20 -p "What do you want to do with this device?" | awk '{ print $1 }')"
|
||||
}
|
||||
|
||||
LIST_OPTIONS
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
#!/bin/sh
|
||||
# speedwm-core
|
||||
# basically useless, only here for compatibility reasons
|
||||
|
||||
case "$1" in
|
||||
"-curl-weather") clear ; curl -s wttr.in | head -n 38 | tail -n 37 && read a ;;
|
||||
esac
|
|
@ -1,16 +1,16 @@
|
|||
#!/bin/sh
|
||||
# speedwm-dfmpeg
|
||||
# dmenu/other run launcher GUI for recording your screen with ffmpeg
|
||||
# spmenu/other run launcher GUI for recording your screen with ffmpeg
|
||||
#
|
||||
# Licensed under MIT, written by speedie
|
||||
# Modified version for speedwm (available https://speedie.gq/speedwm)
|
||||
# https://speedie.gq/dmenu-scripts
|
||||
# https://speedie.gq/spmenu-scripts
|
||||
|
||||
# speedwm specfic dotfile directory, probably don't change
|
||||
[ -z "$DFMPEG_DOTDIR" ] && DFMPEG_DOTDIR="$HOME/.config/speedwm"
|
||||
[ -z "$NOMKCONFIG" ] && NOMKCONFIG=false
|
||||
[ -z "$HAVEGRID" ] && HAVEGRID=true
|
||||
[ -z "$RUNLAUNCHER" ] && RUNLAUNCHER=dmenu
|
||||
[ -z "$RUNLAUNCHER" ] && RUNLAUNCHER=spmenu
|
||||
[ "$1" = "-s" ] && pkill -x ffmpeg && rm -f /tmp/dfmpeg-recording && STATUS=idle && exit
|
||||
|
||||
mkdir -p "$DFMPEG_DOTDIR"
|
||||
|
@ -70,7 +70,7 @@ about_screen="dfmpeg $dfmpeg_ver."
|
|||
# About screen text
|
||||
about_screen_2="Licensed under MIT, written by speedie.gq and emilyd."
|
||||
about_screen_3="Modified for https://speedie.gq/speedwm"
|
||||
about_screen_4="https://speedie.gq/dmenu-scripts"
|
||||
about_screen_4="https://speedie.gq/spmenu-scripts"
|
||||
|
||||
encodeopts() {
|
||||
|
||||
|
|
|
@ -1,52 +1,16 @@
|
|||
#!/bin/sh
|
||||
# speedwm-netctrl
|
||||
# dmenu/other run launcher GUI for iwd
|
||||
# spmenu/other run launcher GUI for iwd
|
||||
# Licensed under the GNU GPLv3 free software license.
|
||||
|
||||
case "$RUNLAUNCHER" in
|
||||
"") RUNLAUNCHER=dmenu ;;
|
||||
"") RUNLAUNCHER=spmenu ;;
|
||||
esac
|
||||
|
||||
BINDIR="$(dirname $(command -v speedwm-core))/"
|
||||
BINDIR="$(dirname $(command -v speedwm-winnav))/"
|
||||
|
||||
command -v iwctl > /dev/null || exit 1
|
||||
|
||||
HAVE_GRID="true"
|
||||
HAVE_PASSWORD="false"
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
if [ "$HAVE_GRID" = "true" ]; then
|
||||
GRIDNUM="1"
|
||||
fi
|
||||
|
||||
if [ "$HAVE_GRID" = "true" ]; then
|
||||
GRIDARG="-g"
|
||||
fi
|
||||
|
||||
SHOW_PASSWORD="true"
|
||||
|
||||
test ${BINDIR}iwctl || exit 0
|
||||
|
||||
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/netctrlrc
|
||||
fi
|
||||
|
||||
if [ "$SHOW_PASSWORD" = "false" ]; then
|
||||
if [ "$HAVE_PASSWORD" = "true" ]; then
|
||||
PASS_ARG="-P"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Get the device used to connect.
|
||||
getdevice() {
|
||||
seldevice=$1
|
||||
|
@ -55,7 +19,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 $GRIDARG $GRIDNUM) && 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 -g 1) && echo $seldevice > $HOME/.local/share/seldevice ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
|
@ -70,7 +34,7 @@ connectwifi() {
|
|||
# if it is disconnect, disconnect
|
||||
if [ "$INARGS" != "disconnect" ]; then
|
||||
iwctl station $seldevice scan
|
||||
network="$(printf "$(iwctl station $seldevice get-networks | sed -n 6,20p | sed "s|>||g" | awk '{ print $1 }')\nDisconnect\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")"
|
||||
network="$(printf "$(iwctl station $seldevice get-networks | sed -n 6,20p | sed "s|>||g" | awk '{ print $1 }')\nDisconnect\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")"
|
||||
|
||||
case "$network" in
|
||||
"") exit 0 ;;
|
||||
|
@ -85,7 +49,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 $GRIDARG $GRIDNUM $PASS_ARG)
|
||||
PASSPHRASE=$(printf "\n" | $RUNLAUNCHER -p "This network is protected. Enter the passphrase." -l 1 -g 1 -P)
|
||||
case "$PASSPHRASE" in
|
||||
"") exit 0 ;;
|
||||
esac
|
||||
|
@ -120,6 +84,6 @@ connectwifi() {
|
|||
fi
|
||||
}
|
||||
|
||||
export INARGS="$1"
|
||||
getdevice && connectwifi
|
||||
INARGS="$1"
|
||||
getdevice "$@" && connectwifi "$@"
|
||||
pgrep -x status > /dev/null && pkill status && status &
|
||||
|
|
|
@ -8,30 +8,13 @@
|
|||
rm -f /tmp/screenshot*
|
||||
|
||||
case "$RUNLAUNCHER" in
|
||||
"") RUNLAUNCHER=dmenu ;;
|
||||
"") RUNLAUNCHER=spmenu ;;
|
||||
esac
|
||||
|
||||
BINDIR="$(dirname $(command -v speedwm-core))/"
|
||||
BINDIR="$(dirname $(command -v speedwm-winnav))/"
|
||||
|
||||
HAVE_GRID="true"
|
||||
if [ -e "$HOME/.config/speedwm/globalrc" ]; then
|
||||
. $HOME/.config/speedwm/globalrc
|
||||
else
|
||||
|
||||
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
|
||||
|
||||
if [ "$HAVE_GRID" = "true" ]; then
|
||||
GRIDNUM="1"
|
||||
fi
|
||||
|
||||
if [ "$HAVE_GRID" = "true" ]; then
|
||||
GRIDARG="-g"
|
||||
fi
|
||||
|
||||
EXPORTDIR=$HOME/.config/speedwm
|
||||
|
||||
mkdir -p $EXPORTDIR
|
||||
EXPORTDIR"=$HOME/.config/speedwm"
|
||||
mkdir -p "$EXPORTDIR"
|
||||
|
||||
# Config
|
||||
SHOWCURSOR="true" # Show cursor or not (true/false)
|
||||
|
@ -144,7 +127,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 $GRIDARG $GRIDNUM -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 -g 1 -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
|
||||
|
|
|
@ -5,30 +5,14 @@
|
|||
# NOTE: You must either permit nopass for poweroff and reboot commands for your user or simply enable nopass entirely!!
|
||||
|
||||
case "$RUNLAUNCHER" in
|
||||
"") RUNLAUNCHER=dmenu ;;
|
||||
"") RUNLAUNCHER=spmenu ;;
|
||||
esac
|
||||
|
||||
case "$TERMINAL" in
|
||||
"") TERMINAL=st ;;
|
||||
esac
|
||||
|
||||
HAVE_GRID="true"
|
||||
if [ -e "$HOME/.config/speedwm/globalrc" ]; then
|
||||
. $HOME/.config/speedwm/globalrc
|
||||
else
|
||||
|
||||
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
|
||||
|
||||
if [ "$HAVE_GRID" = "true" ]; then
|
||||
GRIDNUM="1"
|
||||
fi
|
||||
|
||||
if [ "$HAVE_GRID" = "true" ]; then
|
||||
GRIDARG="-g"
|
||||
fi
|
||||
|
||||
BINDIR="$(dirname $(command -v speedwm-core))/"
|
||||
BINDIR="$(dirname $(command -v speedwm-winnav))/"
|
||||
|
||||
EXPORTDIR=$HOME/.config/speedwm
|
||||
mkdir -p $EXPORTDIR
|
||||
|
@ -56,7 +40,7 @@ LOCK_TEXT=""
|
|||
if [ -e "$EXPORTDIR/powermenurc" ]; then
|
||||
. $EXPORTDIR/powermenurc
|
||||
else
|
||||
printf "# Colors for the prompt. Replace the color values with 'dmenu' for regular default colors." > $EXPORTDIR/powermenurc
|
||||
printf "# Colors for the prompt. Replace the color values with 'spmenu' 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
|
||||
|
@ -95,54 +79,54 @@ if [ "$USEDEFAULTCOLORS" = "true" ]; then
|
|||
fi
|
||||
|
||||
# Standard Background
|
||||
if [ "$COL_NORMAL_BACKGROUND_SELECTED" = "dmenu" ]; then
|
||||
if [ "$COL_NORMAL_BACKGROUND_SELECTED" = "spmenu" ]; then
|
||||
SBFLAG=""
|
||||
COL_NORMAL_BACKGROUND_SELECTED=""
|
||||
fi
|
||||
|
||||
# Normal Background
|
||||
if [ "$COL_NORMAL_BACKGROUND_NORMAL" = "dmenu" ]; then
|
||||
if [ "$COL_NORMAL_BACKGROUND_NORMAL" = "spmenu" ]; then
|
||||
NBFLAG=""
|
||||
COL_NORMAL_BACKGROUND_NORMAL=""
|
||||
fi
|
||||
|
||||
# Standard Background
|
||||
if [ "$COL_NORMAL_TEXT_SELECTED" = "dmenu" ]; then
|
||||
if [ "$COL_NORMAL_TEXT_SELECTED" = "spmenu" ]; then
|
||||
SFFLAG=""
|
||||
COL_NORMAL_TEXT_SELECTED=""
|
||||
fi
|
||||
|
||||
# Normal Text
|
||||
if [ "$COL_NORMAL_TEXT_NORMAL" = "dmenu" ]; then
|
||||
if [ "$COL_NORMAL_TEXT_NORMAL" = "spmenu" ]; then
|
||||
NFFLAG=""
|
||||
COL_NORMAL_TEXT_NORMAL=""
|
||||
fi
|
||||
|
||||
# Standard Background
|
||||
if [ "$COL_WARNING_BACKGROUND_SELECTED" = "dmenu" ]; then
|
||||
if [ "$COL_WARNING_BACKGROUND_SELECTED" = "spmenu" ]; then
|
||||
SBFLAG=""
|
||||
COL_WARNING_BACKGROUND_SELECTED=""
|
||||
fi
|
||||
|
||||
# Normal Background
|
||||
if [ "$COL_WARNING_BACKGROUND_NORMAL" = "dmenu" ]; then
|
||||
if [ "$COL_WARNING_BACKGROUND_NORMAL" = "spmenu" ]; then
|
||||
NBFLAG=""
|
||||
COL_WARNING_BACKGROUND_NORMAL=""
|
||||
fi
|
||||
# Standard Background
|
||||
if [ "$COL_WARNING_TEXT_SELECTED" = "dmenu" ]; then
|
||||
if [ "$COL_WARNING_TEXT_SELECTED" = "spmenu" ]; then
|
||||
SFFLAG=""
|
||||
COL_WARNING_TEXT_SELECTED=""
|
||||
fi
|
||||
|
||||
# Normal Text
|
||||
if [ "$COL_WARNING_TEXT_NORMAL" = "dmenu" ]; then
|
||||
if [ "$COL_WARNING_TEXT_NORMAL" = "spmenu" ]; then
|
||||
NFFLAG=""
|
||||
COL_WARNING_TEXT_NORMAL=""
|
||||
fi
|
||||
|
||||
MOREOPTS() {
|
||||
USER_OPT3=$(printf "Restart speedwm\nEnd task\nspeedwm command\n.." | $RUNLAUNCHER -l 4 $GRIDARG $GRIDNUM -p "What do you want to do?" $NBFLAG $COL_NORMAL_BACKGROUND_NORMAL $SBFLAG $COL_NORMAL_BACKGROUND_SELECTED $NFFLAG $COL_NORMAL_TEXT_NORMAL $SFFLAG $COL_NORMAL_TEXT_SELECTED)
|
||||
USER_OPT3=$(printf "Restart speedwm\nEnd task\nspeedwm command\n.." | $RUNLAUNCHER -l 4 -g 1 -p "What do you want to do?" $NBFLAG $COL_NORMAL_BACKGROUND_NORMAL $SBFLAG $COL_NORMAL_BACKGROUND_SELECTED $NFFLAG $COL_NORMAL_TEXT_NORMAL $SFFLAG $COL_NORMAL_TEXT_SELECTED)
|
||||
|
||||
case "$USER_OPT3" in
|
||||
"") exit 0 ;;
|
||||
|
@ -166,7 +150,7 @@ esac
|
|||
|
||||
USER_OPT2=$(printf "Yes\nNo" | $RUNLAUNCHER -l 2 -p "Are you sure?" $NBFLAG "$COL_WARNING_BACKGROUND_NORMAL" $SBFLAG "$COL_WARNING_BACKGROUND_SELECTED" $NFFLAG "$COL_WARNING_TEXT_NORMAL" $SFFLAG "$COL_WARNING_TEXT_SELECTED")
|
||||
case "$USER_OPT2" in
|
||||
"Yes") $CMD ;;
|
||||
"Yes") "$CMD" ;;
|
||||
"No") exit 0 ;;
|
||||
"") exit 0 ;;
|
||||
esac
|
||||
|
|
|
@ -13,7 +13,7 @@ SWAL_DEFAULT_CONFIG()
|
|||
SWAL_OLDWALLPAPERDIR=$SWAL_WALLPAPERDIR
|
||||
|
||||
case "$RUNLAUNCHER" in
|
||||
"") RUNLAUNCHER=dmenu ;;
|
||||
"") RUNLAUNCHER=spmenu ;;
|
||||
esac
|
||||
|
||||
SWAL_OPT=xwallpaper
|
||||
|
@ -23,27 +23,6 @@ SWAL_DEFAULT_CONFIG()
|
|||
SWAL_RANDOMIZE=false # Select a random wallpaper on login
|
||||
}
|
||||
|
||||
# By default, assume we have grid.
|
||||
HAVE_GRID="true"
|
||||
if [ -e "$HOME/.config/speedwm/globalrc" ]; then
|
||||
. $HOME/.config/speedwm/globalrc
|
||||
echo "Loaded configuration!"
|
||||
else
|
||||
|
||||
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
|
||||
|
||||
# Grid number is one
|
||||
if [ "$HAVE_GRID" = "true" ]; then
|
||||
GRIDNUM="1"
|
||||
fi
|
||||
|
||||
# Grid argument
|
||||
if [ "$HAVE_GRID" = "true" ]; then
|
||||
GRIDARG="-g"
|
||||
fi
|
||||
|
||||
|
||||
# Create the configuration
|
||||
SWAL_MKCONFIG() {
|
||||
mkdir -p $SWAL_EXPORTDIR
|
||||
|
@ -52,22 +31,22 @@ SWAL_MKCONFIG() {
|
|||
SWAL_WALLPAPERDIR_NEW=$SWAL_WALLPAPERDIR
|
||||
|
||||
SWAL_CHANGE_WALLPAPERDIR() {
|
||||
SWAL_WALLPAPERDIR_NEW=$(printf "Your wallpaper directory" | $RUNLAUNCHER $GRIDARG $GRIDNUM -p "Where are all your wallpapers stored?" -l 1)
|
||||
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 $GRIDARG $GRIDNUM -p "Use Pywal?" -l 2 | sed "s|No|false|g; s|Yes|true|g")
|
||||
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 $GRIDARG $GRIDNUM -p "What image viewer do you want to use for previews?" -l 1)
|
||||
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 $GRIDARG $GRIDNUM -p "Pick a random wallpaper on login?" -l 2 | sed "s|No|false|g; s|Yes|true|g")
|
||||
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 $GRIDARG $GRIDNUM -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 ;;
|
||||
|
@ -147,7 +126,7 @@ SWAL_USAGE() {
|
|||
SWAL_SELWALLPAPER()
|
||||
{
|
||||
if [ "$ARG1" = "" ]; then
|
||||
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?")"
|
||||
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?")"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -162,14 +141,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 $GRIDARG $GRIDNUM -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 -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 $GRIDARG $GRIDNUM -l 50 -p "How to use" && $0 && exit 0 ;;
|
||||
"Help") SWAL_USAGE | $RUNLAUNCHER -g 1 -l 50 -p "How to use" && $0 && exit 0 ;;
|
||||
"------") $0 && exit 0 ;;
|
||||
esac
|
||||
|
||||
|
@ -211,7 +190,7 @@ SWAL_SETTYPE()
|
|||
# don't set type if using argument
|
||||
if [ "$SWAL_ASK_TYPE" != "false" ]; then
|
||||
if [ "$ARG1" = "" ]; then
|
||||
SWAL_TYPE=$(printf "Center\nTile\nZoom\nStretch\n------\nExit" | $RUNLAUNCHER -p "How do you want to set the wallpaper?" $GRIDARG $GRIDNUM -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
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# Licensed under GNU GPLv3.
|
||||
|
||||
case "$RUNLAUNCHER" in
|
||||
"") RUNLAUNCHER=dmenu # Run launcher to use (dmenu, rofi, etc.) ;;
|
||||
"") RUNLAUNCHER=spmenu # Run launcher to use (spmenu, rofi, etc.) ;;
|
||||
esac
|
||||
|
||||
GENERAL() {
|
||||
|
@ -31,7 +31,7 @@ OPT() {
|
|||
}
|
||||
|
||||
HELP() {
|
||||
printf "speedwm-utils - Control speedwm using your terminal or dmenu.\n"
|
||||
printf "speedwm-utils - Control speedwm using your terminal or spmenu.\n"
|
||||
printf "\nlayout Let the user select a speedwm layout"
|
||||
printf "\nreloadcolors Reload .Xresources"
|
||||
printf "\nexec <signum> Execute an fsignal signum"
|
||||
|
|
|
@ -4,26 +4,10 @@
|
|||
# https://speedie.gq/speedwm
|
||||
|
||||
case "$RUNLAUNCHER" in
|
||||
"") RUNLAUNCHER=dmenu ;;
|
||||
"") RUNLAUNCHER=spmenu ;;
|
||||
esac
|
||||
|
||||
HAVE_GRID="true"
|
||||
if [ -e "$HOME/.config/speedwm/globalrc" ]; then
|
||||
. $HOME/.config/speedwm/globalrc
|
||||
else
|
||||
|
||||
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
|
||||
|
||||
if [ "$HAVE_GRID" = "true" ]; then
|
||||
GRIDNUM="1"
|
||||
fi
|
||||
|
||||
if [ "$HAVE_GRID" = "true" ]; then
|
||||
GRIDARG="-g"
|
||||
fi
|
||||
|
||||
BINDIR="$(dirname $(command -v speedwm-core))/"
|
||||
BINDIR="$(dirname $(command -v speedwm-winnav))/"
|
||||
|
||||
EMOJILIST()
|
||||
{
|
||||
|
@ -2133,7 +2117,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 $GRIDARG $GRIDNUM)
|
||||
CREDIT_SEL=$(printf "$(DBOARD_CREDITS)" | $RUNLAUNCHER -p 'dboard was created with the help of and by: ' -l 20 -g 1)
|
||||
case "$CREDIT_SEL" in
|
||||
"speedie - Wrote the script & Swedish characters") $BROWSER 'https://speedie.gq' ;;
|
||||
"emilyd - Helped out with some code") $BROWSER 'https://donut.gq' ;;
|
||||
|
@ -2145,7 +2129,7 @@ esac
|
|||
elif [ "$ACTION" = "Exit" ]; then
|
||||
exit 0
|
||||
elif [ "$ACTION" = "About" ]; then
|
||||
printf "$(DBOARD_ABOUT)" | $RUNLAUNCHER -p 'About dboard: ' -l 20 $GRIDARG $GRIDNUM
|
||||
printf "$(DBOARD_ABOUT)" | $RUNLAUNCHER -p 'About dboard: ' -l 20 -g 1
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
# - Tab goes down, j/k to navigate
|
||||
# - Removed class from $windows making it look nicer
|
||||
# - Configuration file
|
||||
# - dmenu center patch support
|
||||
# - spmenu center patch support
|
||||
# - Other small improvements.
|
||||
|
||||
RESTORE() {
|
||||
|
@ -22,28 +22,11 @@ RESTORE() {
|
|||
fi
|
||||
}
|
||||
|
||||
HAVE_GRID="true"
|
||||
|
||||
if [ -e "$HOME/.config/speedwm/globalrc" ]; then
|
||||
. $HOME/.config/speedwm/globalrc
|
||||
else
|
||||
|
||||
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
|
||||
|
||||
if [ "$HAVE_GRID" = "true" ]; then
|
||||
GRIDNUM="1"
|
||||
fi
|
||||
|
||||
if [ "$HAVE_GRID" = "true" ]; then
|
||||
GRIDARG="-g"
|
||||
fi
|
||||
|
||||
case "$RUNLAUNCHER" in
|
||||
"") RUNLAUNCHER=dmenu ;;
|
||||
"") RUNLAUNCHER=spmenu ;;
|
||||
esac
|
||||
|
||||
BINDIR="$(dirname $(command -v speedwm-core))/"
|
||||
BINDIR="$(dirname $(command -v speedwm-winnav))/"
|
||||
DOTDIR="$HOME/.config/speedwm"
|
||||
POSITION="bottom" # top, bottom, center (your $RUNLAUNCHER must support center for this to work)
|
||||
|
||||
|
@ -104,7 +87,7 @@ windows=$(echo "$windows" | \
|
|||
$1 = ""; printf "%s\n", $0}')
|
||||
|
||||
|
||||
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")
|
||||
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")
|
||||
|
||||
case "$target" in
|
||||
"") RESTORE && exit 0 ;;
|
||||
|
|
Loading…
Reference in a new issue