aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xnotepicker35
-rwxr-xr-xrat88
-rwxr-xr-xration101
-rwxr-xr-xwallpicker14
4 files changed, 238 insertions, 0 deletions
diff --git a/notepicker b/notepicker
new file mode 100755
index 0000000..95126da
--- /dev/null
+++ b/notepicker
@@ -0,0 +1,35 @@
+#!/usr/bin/env bash
+
+# pass in notes directory as parameter
+NOTEDIR=$1
+SUFFIX=''
+
+opennote () {
+ kitty --directory $NOTEDIR$SUFFIX nvim $notefile
+}
+
+journal () {
+ cd journal
+ SUFFIX=/journal
+ choice=$(echo -e "New\n$(ls -1 *.md)" | rofi -dmenu -p "Entries") || exit 0
+
+ case $choice in
+ New) notefile=$(date +%F_%T.md | tr ':' '-'); opennote ;;
+ *.md) notefile=$choice; opennote ;;
+ *) exit 0 ;;
+ esac
+}
+
+pick () {
+ cd $NOTEDIR
+ choice=$(echo -e "Journal\n$(ls -t1 *.md)" | rofi -dmenu -p "Notes") || exit 0
+
+ case $choice in
+ Journal) journal ;;
+ *.md) notefile=$choice; opennote ;;
+ *!) notefile=$(echo $choice | tr -d '!').md; opennote ;;
+ *) exit 0 ;;
+ esac
+}
+
+pick
diff --git a/rat b/rat
new file mode 100755
index 0000000..1a6bc24
--- /dev/null
+++ b/rat
@@ -0,0 +1,88 @@
+#!/usr/bin/env bash
+
+SHARE=$HOME/.local/share/rat
+
+update_waybar () {
+ killall -35 waybar
+}
+
+cull_rats () {
+ pkill -f -A " $(which rat) "
+}
+
+firewall_set () {
+ case $1 in
+ disable)
+ echo $2 > $SHARE/status
+ sudo ufw disable
+ notify-send "Firewall has been disabled." ;;
+ enable)
+ sudo ufw enable
+ notify-send -u critical "Firewall has been enabled."
+ echo 0 > $SHARE/status
+ update_waybar ;;
+ *) echo "Invalid argument to firewall_set" > /dev/stderr
+ exit 1 ;;
+ esac
+}
+
+for_duration () {
+ cull_rats
+ firewall_set disable 1
+ endtime=$(($1*60+$(date +%s)))
+ echo $endtime > $SHARE/data
+ while [[ $endtime > $(date +%s) ]]; do
+ update_waybar
+ sleep 1
+ done
+ firewall_set enable
+}
+
+for_task () {
+ cull_rats
+ firewall_set disable 2
+ update_waybar
+ while true; do
+ sleep 5m
+ notif="$(notify-send -A open "ask yourself: do I still need the rat to $1?")"
+ if [[ -n "$notif" ]]; then
+ kitty --app-id ration bash -i ration
+ break
+ fi
+ done
+}
+
+for_program () {
+ cull_rats
+ firewall_set disable 3
+ echo $1 > $SHARE/data
+ echo "$*" > $HOME/out
+ update_waybar
+ $@
+ firewall_set enable
+}
+
+for_work () {
+ endtime=$(date -d 1700 +%s)
+ if [[ $(date +%s) > $endtime ]]; then
+ notify-send "It's past work hours!"
+ exit 0
+ fi
+ cull_rats
+ firewall_set disable 4
+ update_waybar
+ while [[ $(date +%s) < $endtime ]]; do
+ sleep 1
+ done
+ firewall_set enable
+}
+
+case $1 in
+ duration) for_duration $2 ;;
+ task) for_task "$2" ;;
+ program) for_program ${@:2} ;;
+ work) for_work ;;
+ reset) cull_rats; firewall_set enable ;;
+ *) echo "Invalid positional parameter" > /dev/stderr
+ exit 1 ;;
+esac
diff --git a/ration b/ration
new file mode 100755
index 0000000..ecbfb98
--- /dev/null
+++ b/ration
@@ -0,0 +1,101 @@
+#!/usr/bin/env bash
+
+echo -e "\n\
+ ██████╗ █████╗ ████████╗██╗ ██████╗ ███╗ ██╗\n\
+ ██╔══██╗██╔══██╗╚══██╔══╝██║██╔═══██╗████╗ ██║\n\
+ ██████╔╝███████║ ██║ ██║██║ ██║██╔██╗ ██║\n\
+ ██╔══██╗██╔══██║ ██║ ██║██║ ██║██║╚██╗██║\n\
+ ██║ ██║██║ ██║ ██║ ██║╚██████╔╝██║ ╚████║\n\
+ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝\n"
+
+SHARE=$HOME/.local/share/rat
+
+if ! [[ -d $SHARE ]]; then
+ mkdir $SHARE
+fi
+
+if ! [[ -f $SHARE/status ]]; then
+ echo 0 > $SHARE/status
+fi
+
+yn_prompt () {
+ while true; do
+ read -p "(y/n): " choice
+ case $choice in
+ [Yy]) echo y; break ;;
+ [Nn]) echo n; break ;;
+ esac
+ done
+}
+
+for_duration () {
+ unset choice duration
+
+ while ! [[ "$duration" =~ ^[0-9]+$ ]]; do
+ echo -n "enter duration in minutes: "
+ read duration
+ done
+
+ echo "the firewall will close after $duration minutes. is this okay?"
+
+ case $(yn_prompt) in
+ y) nohup rat duration $duration > /dev/null & ;;
+ n) for_duration ;;
+ esac
+}
+
+for_task () {
+ while [[ -z "$task" ]]; do
+ echo "what do you need the rat for?"
+ read -p "I am going to: " task
+ done
+
+ echo "is that so?"
+
+ case $(yn_prompt) in
+ y) nohup rat task "$task" > /dev/null & ;;
+ n) for_task ;;
+ esac
+}
+
+for_program () {
+ nohup rofi -run-command 'rat program {cmd}' -show drun > /dev/null &
+}
+
+for_work () {
+ unset response
+ echo "you're not just saying that?"
+ read -p "(I am not): " response
+
+ if [[ "$response" = "I am not" ]]; then
+ nohup rat work > /dev/null &
+ elif [[ "$response" = "I am" ]]; then
+ exit 0
+ else
+ for_work
+ fi
+}
+
+if [[ "$(cat $SHARE/status)" != 0 ]]; then
+ echo "the rat is loose. would you like to snuff it out?"
+ if [[ $(yn_prompt) = y ]]; then
+ nohup rat reset > /dev/null &
+ fi
+ exit 0
+fi
+
+echo "open the firewall for..."
+PS3="selection: "
+
+select choice in "a duration" "a task" "a program" "the work day"; do
+ case $choice in
+ "a duration") for_duration
+ break ;;
+ "a task") for_task
+ break ;;
+ "a program") for_program
+ break ;;
+ "the work day") for_work
+ break ;;
+ esac
+done
diff --git a/wallpicker b/wallpicker
new file mode 100755
index 0000000..c28c149
--- /dev/null
+++ b/wallpicker
@@ -0,0 +1,14 @@
+#!/usr/bin/env bash
+
+FOLDER=~/Pictures/wallpapers
+
+CHOICE=$(swayimg -a wallpicker --gallery $FOLDER)
+
+case $CHOICE in
+ *.*) wallust run $CHOICE ;;
+ *) exit 0 ;;
+esac
+
+swaymsg reload
+killall dunst
+notify-send "Updated wallpaper and colorscheme."