summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorstkhan <personal@slickd.xyz>2022-05-10 18:49:05 +0000
committerstkhan <personal@slickd.xyz>2022-05-10 18:49:05 +0000
commite73b6b1145898966ef995b9f25167441c9cbbedc (patch)
treedc19542d026bf7b7e04bc655c884ff45603999a1 /scripts
parent1958de218756ea968bc2188a7666fc456b33f5dd (diff)
Switched dwm scripts, added space theme, and fixed dwmblocks-forecast
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/sarc.sh68
1 files changed, 68 insertions, 0 deletions
diff --git a/scripts/sarc.sh b/scripts/sarc.sh
new file mode 100755
index 0000000..48d721d
--- /dev/null
+++ b/scripts/sarc.sh
@@ -0,0 +1,68 @@
+#!/bin/bash
+
+search_web() {
+ QUERY=$(tac ~/.config/surf/search.txt | sort -u | dmenu -l 20 -p "Search DuckDuckGo: ")
+ SEARCH=$(echo $QUERY | sed 's/ /+/g; s/-e//')
+ URL="duckduckgo.com/?q=$SEARCH"
+ CMD="firejail --noprofile --hosts-file=~/.config/surf/ads.txt tabbed -dn tabbed-surf -r 2 surf -e '' $URL"
+
+ if [[ -z "$SEARCH" ]]; then
+ exit
+ else
+ # saves search to history
+ echo $QUERY | sed 's/-e//' >> ~/.config/surf/search.txt
+ $CMD
+fi
+}
+
+goto_website() {
+ URL=$(cat ~/.config/surf/history.txt | sed 's/^[^ *]* //' | sort -u | dmenu -p "Enter a URL: ")
+ POSTURL=$(echo $URL | sed 's/-e//; s/reddit.com/old.reddit.com/')
+ CMD="firejail --noprofile --hosts-file=~/.config/surf/ads.txt tabbed -dn tabbed-surf -r 2 surf -e '' $POSTURL"
+
+ if [[ -z "$URL" ]]; then
+ exit
+ else
+ # saves url to history
+ echo $URL >> ~/.config/surf/history.txt
+ $CMD
+ fi
+}
+
+get_unicode() {
+# The famous "get a menu of emojis to copy" script.
+
+# Get user selection via dmenu from emoji file.
+chosen=$(cut -d ';' -f1 ~/.local/share/larbs/emoji | dmenu -i -l 30 | sed "s/ .*//")
+
+# Exit if none chosen.
+[ -z "$chosen" ] && exit
+
+# If you run this command with an argument, it will automatically insert the
+# character. Otherwise, show a message that the emoji has been copied.
+ if [ -n "$1" ]; then
+ xdotool type "$chosen"
+ else
+ printf "$chosen" | xclip -selection clipboard
+ notify-send "'$chosen' copied to clipboard." &
+ fi
+}
+
+power() {
+ case "$(printf "🔃 reboot\n🖥️shutdown\n" | dmenu -i -p 'Power: ')" in
+ '🔃 reboot') sudo reboot ;;
+ '🖥️shutdown') sudo poweroff ;;
+ *) exit 1 ;;
+ esac
+}
+case $1 in
+ --get_weather)
+ rm -rf ~/.cache/weather_report
+ curl wttr.in > ~/.cache/weather_report
+ st less -Srf ~/.cache/weather_report;;
+ --search_web)
+ search_web;;
+ --unicode) get_unicode;;
+ --power) power;;
+ --goto-website) goto_website;;
+esac