diff options
-rwxr-xr-x | clipboardUtils.sh | 17 | ||||
-rwxr-xr-x | dmenuTerm.sh | 6 | ||||
-rwxr-xr-x | emoji/emoji.sh (renamed from emoji.sh) | 0 | ||||
-rwxr-xr-x | prompt.sh | 3 | ||||
-rwxr-xr-x | showColors.sh | 16 | ||||
-rwxr-xr-x | systemControl.sh | 6 | ||||
-rwxr-xr-x | webview.sh | 6 |
7 files changed, 31 insertions, 23 deletions
diff --git a/clipboardUtils.sh b/clipboardUtils.sh index fadb3e7..49f39d0 100755 --- a/clipboardUtils.sh +++ b/clipboardUtils.sh @@ -3,22 +3,27 @@ # Manipulate the X selection # Dependencies: dmenu, xsel -options="Show selections\nReplicate selections\nWrite to selection" -target="$(echo -e "$options" | dmenu -l 3 -i -p "~ Clipboard utils ~")" +options="Show selections\nReplicate selections\nWrite to selection\n" +selections="Clipboard\nPrimary\nSecondary\n" + +target="$(printf "$options" | dmenu -l 3 -i -p "~ Clipboard utils ~")" [ "$target" = "" ] && exit 0 + case "$target" in + "Show selections") notify-send "Clipboard: [$(xsel -bo)] Primary: [$(xsel -po)] Secondary: [$(xsel -so)]" ;; + "Replicate selections") - fromSelection="$(echo -e "Clipboard\nPrimary\nSecondary" | dmenu -l 3 -i -p "From selection:")" + fromSelection="$(printf "$selections" | dmenu -l 3 -i -p "From selection:")" [ "$fromSelection" = "" ] && exit 0 case "$fromSelection" in "Clipboard") fromOption=b ;; "Primary") fromOption=p ;; "Secondary") fromOption=s ;; esac - toSelection="$(echo -e "Clipboard\nPrimary\nSecondary" | dmenu -l 3 -i -p "To selection:")" + toSelection="$(printf "$selections" | dmenu -l 3 -i -p "To selection:")" [ "$toSelection" = "" ] && exit 0 case "$toSelection" in "Clipboard") toOption=b ;; @@ -26,8 +31,9 @@ Secondary: [$(xsel -so)]" ;; "Secondary") toOption=s ;; esac xsel -"$fromOption"o | xsel -"$toOption"i && notify-send "Copied [$(xsel -"$toOption"o)] from $fromSelection to $toSelection." ;; + "Write to selection") - selectedSelection="$(echo -e "Clipboard\nPrimary\nSecondary" | dmenu -l 3 -i -p "Write to which selection?")" + selectedSelection="$(printf "$selections" | dmenu -l 3 -i -p "Write to which selection?")" textToWrite="$(dmenu -p "Text to write to $selectedSelection:")" [ "$textToWrite" = "" ] && exit 0 case "$selectedSelection" in @@ -36,4 +42,5 @@ Secondary: [$(xsel -so)]" ;; "Secondary") echo "$textToWrite" | xsel -si ;; esac notify-send "Written [$textToWrite] to $selectedSelection." ;; + esac diff --git a/dmenuTerm.sh b/dmenuTerm.sh index b9a6d25..7f4e1f8 100755 --- a/dmenuTerm.sh +++ b/dmenuTerm.sh @@ -1,9 +1,11 @@ #!/bin/sh # dmenu script for opening console programs and scripts directly -options="neofetch\ncmus\ncmus (float)\nweather\nReset NetworkManager\nwifiUp\nwifiDown\nyears\nmonths\nbg selection\nshowColors\npython\nmusicMode\nClose music mode" +options="neofetch\ncmus\ncmus (float)\nweather\nReset NetworkManager\nwifiUp\nwifiDown\nyears\nmonths\nbg selection\nshowColors\npython\nmusicMode\nClose music mode\n" -chosen=$(echo -e "$options" | dmenu -i -p "~$ urxvt -e") +count="$(printf "$options" | wc -l)" + +chosen="$(printf "$options" | dmenu -i -l "$count" -p "~$ urxvt -e")" case "$chosen" in # floating windows diff --git a/emoji.sh b/emoji/emoji.sh index dfa22cb..dfa22cb 100755 --- a/emoji.sh +++ b/emoji/emoji.sh @@ -2,5 +2,4 @@ # A dmenu binary prompt script. # Gives a dmenu prompt labeled with $1 to perform command $2. -[ $(echo -e "No\nYes" | dmenu -i -p "$1") \ -== "Yes" ] && $2 +[ $(printf "No\nYes" | dmenu -l 2 -p "$1") == "Yes" ] && $2 diff --git a/showColors.sh b/showColors.sh index d879e51..dc1b911 100755 --- a/showColors.sh +++ b/showColors.sh @@ -1,12 +1,12 @@ #!/bin/bash -echo -e "\033[0;30mBlack (0;30) \033[1;30mLight Black (1;30)" -echo -e "\033[0;31mRed (0;31) \033[1;31mLight Red (1;31)" -echo -e "\033[0;32mGreen (0;32) \033[1;32mLight Green (1;32)" -echo -e "\033[0;33mOrange (0;33) \033[1;33mLight Orange (1;33)" -echo -e "\033[0;34mBlue (0;34) \033[1;34mLight Blue (1;34)" -echo -e "\033[0;35mMagenta (0;35) \033[1;35mLight Magenta (1;35)" -echo -e "\033[0;36mCyan (0;36) \033[1;36mLight Cyan (1;36)" -echo -e "\033[0;37mWhite (0;37) \033[1;37mLight White (1;37)" +printf "\033[0;30mBlack (0;30) \033[1;30mLight Black (1;30)\n" +printf "\033[0;31mRed (0;31) \033[1;31mLight Red (1;31)\n" +printf "\033[0;32mGreen (0;32) \033[1;32mLight Green (1;32)\n" +printf "\033[0;33mOrange (0;33) \033[1;33mLight Orange (1;33)\n" +printf "\033[0;34mBlue (0;34) \033[1;34mLight Blue (1;34)\n" +printf "\033[0;35mMagenta (0;35) \033[1;35mLight Magenta (1;35)\n" +printf "\033[0;36mCyan (0;36) \033[1;36mLight Cyan (1;36)\n" +printf "\033[0;37mWhite (0;37) \033[1;37mLight White (1;37)\n" read -rsp "" -d "q" diff --git a/systemControl.sh b/systemControl.sh index a751588..0426363 100755 --- a/systemControl.sh +++ b/systemControl.sh @@ -1,9 +1,9 @@ #!/bin/bash # A dmenu prompt script to control system functions. -options="lock\nreboot\nshutdown\nsuspend\nhibernate\nexit i3\nexit bspwm" +options="lock\nreboot\nshutdown\nsuspend\nhibernate\nexit bspwm\nexit i3" -chosen=$(echo -e "$options" | dmenu -p ">_") +chosen=$(printf "$options" | dmenu -c -bw 3 -l "$(printf "${options}\n" | wc -l)" -p ">_") case "$chosen" in "lock") i3lock.sh ;; @@ -11,6 +11,6 @@ case "$chosen" in "shutdown") ~/scripts/prompt.sh Shutdown? "systemctl poweroff" ;; "suspend") systemctl suspend ;; "hibernate") ~/scripts/prompt.sh Hibernate? "systemctl hibernate" ;; - "exit i3") ~/scripts/prompt.sh "Exit i3? (ends X session)" "i3-msg exit" ;; "exit bspwm") ~/scripts/prompt.sh "Exit bspwm? (ends X session)" "bspc quit" ;; + "exit i3") ~/scripts/prompt.sh "Exit i3? (ends X session)" "i3-msg exit" ;; esac @@ -14,7 +14,7 @@ imgViewer="showURLimage.sh" # Check youtube link if echo "$1" | grep "youtube" >/dev/null; then - chosen=$(echo -e "mpv\nmpv (loop)\nmpv (float)\nmpv (terminal)\ndownload (y-dl)\nqutebrowser\nw3m" | dmenu -i) + chosen=$(printf "mpv\nmpv (loop)\nmpv (float)\nmpv (terminal)\ndownload (y-dl)\nqutebrowser\nw3m\n" | dmenu -i) case "$chosen" in "mpv") nohup mpv "$1" >/dev/null & ;; "mpv (loop)") nohup mpv --loop "$1" >/dev/null & ;; @@ -28,7 +28,7 @@ if echo "$1" | grep "youtube" >/dev/null; then elif echo "$imageFiles" | grep -w "$ext" >/dev/null; then "$imgViewer" "$1" >/dev/null & elif echo "$mpvFiles" | grep -w "$ext" >/dev/null; then - chosen=$(echo -e "mpv\nmpv (loop)\nmpv (float)\nmpv (terminal)\nqutebrowser" | dmenu -i) + chosen=$(printf "mpv\nmpv (loop)\nmpv (float)\nmpv (terminal)\nqutebrowser\n" | dmenu -i) case "$chosen" in mpv) nohup mpv "$1" >/dev/null & ;; "mpv (loop)") nohup mpv --loop "$1" >/dev/null & ;; @@ -39,7 +39,7 @@ elif echo "$mpvFiles" | grep -w "$ext" >/dev/null; then elif echo "$wgetFiles" | grep -w "$ext" >/dev/null; then nohup wget "$1" >~/log-wget.txt & else - chosen=$(echo -e "mpv\nmpv (loop)\nmpv (float)\nmpv (terminal)\nsxiv\ndownload (y-dl)\nqutebrowser\nw3m" | dmenu -i) + chosen=$(printf "mpv\nmpv (loop)\nmpv (float)\nmpv (terminal)\nsxiv\ndownload (y-dl)\nqutebrowser\nw3m\n" | dmenu -i) case "$chosen" in mpv) nohup mpv "$1" >/dev/null & ;; "mpv (loop)") nohup mpv --loop "$1" >/dev/null & ;; |