aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-x.local/bin/scripts/Heads-Up-Display13
-rw-r--r--.local/bin/scripts/README.md1
-rwxr-xr-x.local/bin/scripts/bspwm_resize.sh67
-rwxr-xr-x.local/bin/scripts/cryptocheck31
-rwxr-xr-x.local/bin/scripts/cryptonotify19
-rwxr-xr-x.local/bin/scripts/layer.sh24
-rwxr-xr-x.local/bin/scripts/opacity-change.sh34
-rwxr-xr-x.local/bin/scripts/powermenu38
-rwxr-xr-x.local/bin/scripts/scratchpad30
9 files changed, 257 insertions, 0 deletions
diff --git a/.local/bin/scripts/Heads-Up-Display b/.local/bin/scripts/Heads-Up-Display
new file mode 100755
index 0000000..cac8681
--- /dev/null
+++ b/.local/bin/scripts/Heads-Up-Display
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+id=$(xdotool search --class Heads-Up-Display);
+if [ -z "$id" ]; then
+ st -c Heads-Up-Display -e tmux attach -t HUD || tmux new -s HUD;
+else
+ if [ ! -f /tmp/hide_hud ]; then
+ touch /tmp/hide_hud && xdo hide "$id"
+ elif [ -f /tmp/hide_hud ]; then
+ rm /tmp/hide_hud && xdo show "$id"
+ fi
+fi
+
diff --git a/.local/bin/scripts/README.md b/.local/bin/scripts/README.md
new file mode 100644
index 0000000..458b3cc
--- /dev/null
+++ b/.local/bin/scripts/README.md
@@ -0,0 +1 @@
+# scripts
diff --git a/.local/bin/scripts/bspwm_resize.sh b/.local/bin/scripts/bspwm_resize.sh
new file mode 100755
index 0000000..29ab5cf
--- /dev/null
+++ b/.local/bin/scripts/bspwm_resize.sh
@@ -0,0 +1,67 @@
+#!/bin/bash
+
+size=${2:-'10'}
+dir=$1
+
+# Find current window mode
+is_tiled() {
+bspc query -T -n | grep -q '"state":"tiled"'
+}
+# If the window is floating, move it
+if ! is_tiled; then
+#only parse input if window is floating,tiled windows accept input as is
+ case "$dir" in
+ west) switch="-w"
+ sign="-"
+ ;;
+ east) switch="-w"
+ sign="+"
+ ;;
+ north) switch="-h"
+ sign="-"
+ ;;
+ south) switch="-h"
+ sign="+"
+ ;;
+ esac
+ xdo resize ${switch} ${sign}${size}
+
+# Otherwise, window is tiled: switch with window in given direction
+else
+ case "$dir" in
+ west) bspc node @west -r -$size || bspc node @east -r -${size}
+ ;;
+ east) bspc node @west -r +$size || bspc node @east -r +${size}
+ ;;
+ north) bspc node @south -r -$size || bspc node @north -r -${size}
+ ;;
+ south) bspc node @south -r +$size || bspc node @north -r +${size}
+ ;;
+ esac
+fi
+
+##!/bin/bash
+#
+#[ "$#" -eq 3 ] || { echo "Needs exactly three arguments."; exit 1; }
+#
+#motion="$1"
+#direction="$2"
+#size="$3"
+#
+#if [ "$motion" = 'expand' ]; then
+# # These expand the window's given side
+# case "$direction" in
+# north) bspc node -z top 0 -"$size" ;;
+# east) bspc node -z right "$size" 0 ;;
+# south) bspc node -z bottom 0 "$size" ;;
+# west) bspc node -z left -"$size" 0 ;;
+# esac
+#else
+# # These contract the window's given side
+# case "$direction" in
+# north) bspc node -z top 0 "$size" ;;
+# east) bspc node -z right -"$size" 0 ;;
+# south) bspc node -z bottom 0 -"$size" ;;
+# west) bspc node -z left "$size" 0 ;;
+# esac
+#fi
diff --git a/.local/bin/scripts/cryptocheck b/.local/bin/scripts/cryptocheck
new file mode 100755
index 0000000..02ba42d
--- /dev/null
+++ b/.local/bin/scripts/cryptocheck
@@ -0,0 +1,31 @@
+#!/usr/bin/env bash
+if [ ! -d ~/.cache/crypto ]; then
+ mkdir ~/.cache/crypto
+fi
+ticker=(BTC ETH ADA DOT SOL XMR)
+
+for currency in "${ticker[@]}"; do
+ echo "$currency"
+done | while read coin
+ do
+ price=$(curl rate.sx/1$coin)
+ if [ $coin = "BTC" ]; then
+ icon=󰠓
+ elif [ $coin = "ETH" ]; then
+ icon=󰡪
+ elif [ $coin = "ADA" ]; then
+ icon=󰝨
+ elif [ $coin = "DOT" ]; then
+ icon=󰐇
+ elif [ $coin = "SOL" ]; then
+ icon=󰘙
+ elif [ $coin = "XMR" ]; then
+ icon=󰝴
+ fi
+
+ echo "$icon $coin: $price" > ~/.cache/crypto/$coin
+
+ done
+
+date > ~/.cache/crypto/time
+
diff --git a/.local/bin/scripts/cryptonotify b/.local/bin/scripts/cryptonotify
new file mode 100755
index 0000000..47883c3
--- /dev/null
+++ b/.local/bin/scripts/cryptonotify
@@ -0,0 +1,19 @@
+#!/bin/sh
+source cryptocheck
+Output=
+for file in ~/.cache/crypto/*
+do
+ if [ ! -z "$Output" ]; then
+ if [ ! $(basename $file) = "time" ]; then
+ Output="$Output\n$(cat $file)"
+ fi
+ else
+ if [ ! $(basename $file) = "time" ]; then
+ Output="$Output$(cat $file)"
+ fi
+ fi
+
+done
+
+Output="$Output\n$(cat ~/.cache/crypto/time)"
+notify-send "Crypto Prices" "$Output"
diff --git a/.local/bin/scripts/layer.sh b/.local/bin/scripts/layer.sh
new file mode 100755
index 0000000..4b17ed1
--- /dev/null
+++ b/.local/bin/scripts/layer.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+current_layer="$(bspc query -T -n | jq -r '.client.layer')"
+case $1 in
+ +|-)
+ declare -A _layers=( [below]=0 [normal]=1 [above]=2 )
+ layers=( below normal above )
+ maxl=$(( ${#layers[@]} - 1 ))
+ current_layer="$(bspc query -T -n | jq -r '.client.layer')"
+ i=$(( ${_layers[$current_layer]} $1 1 ))
+ if [[ $i -lt 0 ]]; then
+ i=0
+ elif [[ $i -gt $maxl ]]; then
+ i=$maxl
+ fi
+ #cycle? nah
+ #i=$(( (${_layers[$current_layer]} + ${#layers[@]} ${1} 1) % ${#layers[@]} ))
+ new_layer="${layers[$i]}"
+ ;;
+ *)
+ new_layer="$(bspc query -T -n | jq -r '.client.lastLayer')"
+ ;;
+esac
+[[ "$current_layer" != "$new_layer" ]] && bspc node -l "$new_layer"
diff --git a/.local/bin/scripts/opacity-change.sh b/.local/bin/scripts/opacity-change.sh
new file mode 100755
index 0000000..b509936
--- /dev/null
+++ b/.local/bin/scripts/opacity-change.sh
@@ -0,0 +1,34 @@
+#!/usr/bin/env bash
+set -eu
+[[ -n ${DEBUG:-} ]] && set -x
+
+#### Example alacritty.yml usage
+#key_bindings:
+# - { key: N, mods: Control|Shift, action: SpawnNewInstance }
+# - { key: O, mods: Control|Shift, command: { program: "opacity-change.sh", args: ["-"] } }
+# - { key: P, mods: Control|Shift, command: { program: "opacity-change.sh", args: ["+"] } }
+
+
+operation="${1:-}${2:-}" # Arg #1 & #2 (in case the user misinterpreted a space in the usage), Default ''
+step="${operation:1}" # Substring from char index 1
+step="${step:-1}" # Default '1'
+operation="${operation:0:1}" # Substring from char index 0 length of 1
+config_file="$HOME/.config/alacritty/alacritty.yml"
+config_field="opacity"
+tmp_file="/tmp/$(basename $config_file).$(date +%s)"
+current_value=$(sed 's/#.*//g; /\b'"$config_field"':/!d; s/.*: \?//' < "$config_file")
+
+case $operation in
+"-")
+ verb="Decreasing" ;;
+"+")
+ verb="Increasing" ;;
+*)
+ echo "Usage: ${BASH_SOURCE[0]} (-|+)[int]"; exit 255 ;;
+esac
+
+new_value="$(awk '{n=$1+$2/10; print (n<0 ? 0 : n>1 ? 1 : n)}' <<<"$current_value $operation$step")"
+echo "$verb $config_field from $current_value to $new_value" >&2
+cp "$config_file" "$tmp_file"
+sed "s/\b$config_field:.*/$config_field: $new_value/" "$tmp_file" > "$config_file"
+
diff --git a/.local/bin/scripts/powermenu b/.local/bin/scripts/powermenu
new file mode 100755
index 0000000..7bd913e
--- /dev/null
+++ b/.local/bin/scripts/powermenu
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+# display a power menu to: shutdown, reboot,
+# lock, logout, and suspend. This script can be
+# executed by clicking on the polybar powermenu module
+# or with a keyboard shortcut
+
+# options to be displayed
+shutdown=" Shutdown"
+reboot=" Reboot"
+lock=" Lock"
+logout=" Logout"
+suspend=" Suspend"
+
+uptime=$(uptime -p | sed -e 's/up //g')
+
+# options passed into variable
+options="$shutdown\n$reboot\n$lock\n$logout\n$suspend"
+
+chosen="$(echo -e "$options" | rofi -theme ~/.config/rofi/styles/powermenu.rasi -lines 5 -dmenu -p "$uptime")"
+
+case $chosen in
+$shutdown)
+ systemctl poweroff
+ ;;
+$reboot)
+ systemctl reboot
+ ;;
+$lock)
+ betterlockscreen --lock dimblur
+ ;;
+$logout)
+ bspc quit
+ ;;
+$suspend)
+ systemctl suspend
+ ;;
+esac
diff --git a/.local/bin/scripts/scratchpad b/.local/bin/scripts/scratchpad
new file mode 100755
index 0000000..331f8a2
--- /dev/null
+++ b/.local/bin/scripts/scratchpad
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+#sid=$(wmctrl -lx | grep scratch.scratchpad| cut -d' ' -f1| head -1) \
+#&& [ -z "$(echo $sid)" ] \
+# && alacritty -t scratchpad --class scratch,scratchpad -e tmux new-session -A -s scratchpad
+# & sleep 1 \
+# && sid=$(wmctrl -lx | grep scratch.scratchpad| cut -d' ' -f1| head -1) \
+# && echo "$sid" > /tmp/scratchID ;
+if id="$(xdo id -N scratch)"
+ then bspc node "$id" -g hidden -f
+ else alacritty --class scratch,scratchpad -e tmux new-session -A -s scratch -e bash > /dev/null 2>&1 &
+ #else alacritty --class scratch,scratchpad -e tmux new-session -A -s scratch -e bash > /dev/null 2>&1 &
+fi
+
+#id=$(xdotool search --class scratchpad);
+#if [ -z "$id" ]; then
+# alacritty --class scratch,scratchpad -e tmux new-session -A -s scratch;
+#else
+# if [ ! -f /tmp/hide_scratch ]; then
+# touch /tmp/hide_scratch && xdo hide "$id"
+# elif [ -f /tmp/hide_scratch ]; then
+# rm /tmp/hide_scratch && xdo show "$id"
+# fi
+#fi
+
+# alacritty -t scratchpad --class scratch,scratchpad -e zsh -c "zsh tmux attach -t scratch || tmux new -s scratch";
+# st -c scratchy -e tmux attach -t scratchy || tmux new -s scratchy;
+# && alacritty -t scratchpad --class scratch,scratchpad -e zsh -c "zsh tmux attach -t scratch || tmux new -s scratch"\
+# alacritty --class scratch,scratchpad -e tmux attach -t scratch || tmux new -s scratch;
+