From e73b6b1145898966ef995b9f25167441c9cbbedc Mon Sep 17 00:00:00 2001 From: stkhan Date: Tue, 10 May 2022 18:49:05 +0000 Subject: Switched dwm scripts, added space theme, and fixed dwmblocks-forecast --- HISTORY | 1 + dwm-6.3/config.h | 8 +++--- scripts/sarc.sh | 68 ++++++++++++++++++++++++++++++++++++++++++++++++ theme/space1/colors.h | 50 +++++++++++++++++++++++++++++++++++ theme/space1/space1.png | Bin 0 -> 228224 bytes 5 files changed, 123 insertions(+), 4 deletions(-) create mode 100755 scripts/sarc.sh create mode 100644 theme/space1/colors.h create mode 100644 theme/space1/space1.png diff --git a/HISTORY b/HISTORY index b2b2a12..113f42d 100644 --- a/HISTORY +++ b/HISTORY @@ -1,2 +1,3 @@ May 5, 2022 - switched from sxiv to nsxiv, uses config files now May 7, 2022 - started wayland branch +May 8, 2022 - note: commit dfbff596477bfcae02c6a27eb479700c571b97d5 should say 'Removed nsxiv-open', not surf diff --git a/dwm-6.3/config.h b/dwm-6.3/config.h index 16fbdb4..b479839 100644 --- a/dwm-6.3/config.h +++ b/dwm-6.3/config.h @@ -133,11 +133,11 @@ static Key keys[] = { { MODKEY, XK_F1, spawn, SHCMD("xbacklight -dec 5; kill -44 $(pidof dwmblocks)") }, { MODKEY, XK_F2, spawn, SHCMD("xbacklight -inc 5; kill -44 $(pidof dwmblocks)") }, { MODKEY, XK_p, spawn, SHCMD("nsxiv -t ~/Pictures") }, - { MODKEY, XK_F12, spawn, SHCMD("power") }, + { MODKEY, XK_F12, spawn, SHCMD("sarc_script --power") }, { MODKEY, XK_F4, spawn, SHCMD("galculator") }, - { MODKEY, XK_e, spawn, SHCMD("dmenuunicode") }, - { MODKEY, XK_s, spawn, SHCMD("dwm-search") }, - { MODKEY, XK_g, spawn, SHCMD("dwm-goto") }, + { MODKEY, XK_e, spawn, SHCMD("sarc_script --unicode") }, + { MODKEY, XK_s, spawn, SHCMD("sarc_script --search_web") }, + { MODKEY, XK_g, spawn, SHCMD("sarc_script --goto-website") }, TAGKEYS( XK_1, 0) TAGKEYS( XK_2, 1) TAGKEYS( XK_3, 2) 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 diff --git a/theme/space1/colors.h b/theme/space1/colors.h new file mode 100644 index 0000000..d8e4457 --- /dev/null +++ b/theme/space1/colors.h @@ -0,0 +1,50 @@ +/* Sarc config file */ + +/* + * DWM CONFIGURATION +*/ + +/* primary color */ + +static const char col_cyan[] = "#315FA1"; + +/* secondary colors */ + +static const char col_gray1[] = "#0B0A13"; +static const char col_gray2[] = "#444444"; +static const char col_gray3[] = "#bbbbbb"; +static const char col_gray4[] = "#eeeeee"; + +/* st config */ + +float alpha = 0.6; + +static const char *colorname[] = { + /* 8 normal colors */ + "black", + "red3", + "green3", + "yellow3", + "blue2", + "magenta3", + "cyan3", + "gray90", + + /* 8 bright colors */ + "gray50", + "red", + "green", + "yellow", + "#5c5cff", + "magenta", + "cyan", + "white", + + [255] = 0, + + /* more colors can be added after 255 to use with DefaultXX */ + "#cccccc", + "#555555", + "#000000", /* 258 -> bg */ + "#cfcfcf", /* 259 -> fg */ +}; diff --git a/theme/space1/space1.png b/theme/space1/space1.png new file mode 100644 index 0000000..b771a40 Binary files /dev/null and b/theme/space1/space1.png differ -- cgit v1.2.3