summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xabraham-porter.sh180
-rwxr-xr-xdockd.sh37
-rwxr-xr-xtoggle-screencast.sh4
-rwxr-xr-xurl_handler.sh7
-rwxr-xr-xwal.sh4
-rwxr-xr-xweather.sh6
6 files changed, 116 insertions, 122 deletions
diff --git a/abraham-porter.sh b/abraham-porter.sh
index 033ffb0..5b13524 100755
--- a/abraham-porter.sh
+++ b/abraham-porter.sh
@@ -6,9 +6,6 @@
doas="doas"
terminal="alacritty"
pager="rofi -location 2 -width -81 -e"
-ports_dir="/usr/local/poudriere/ports/default"
-pkglist="$HOME/.pkglist"
-jail="121x64"
## Error codes
@@ -19,16 +16,17 @@ NO_PKG_DESCR_FOUND=5
NO_WANT_ANOTHER_PROVIDED=6
-## Gets a port name from the user with dmenu
-get_port() {
- fetch -o /tmp/ports.txt -i /tmp/ports.txt https://pkg.53hor.net/ports.txt
- dmenu -p "Port" < /tmp/ports.txt
+## Lets user choose a port from a list of FreshPorts search results.
+search_port() {
+ query="$(dmenu -p 'Search?')"
+ fetch -qo - "https://www.freshports.org/search.php?stype=name&method=match&num=500&format=plaintext&query=$query"\
+ | dmenu -p "Port?"
}
## Gets an action from the user with dmenu
get_action() {
- action=$(dmenu -p "Abraham Porter" << EOF
+ action=$(dmenu -p "Abraham Porter" << EOH
1. print pkg-descr
2. set options
3. set options, add to pkglist
@@ -37,70 +35,70 @@ get_action() {
6. add to pkglist
7. set options on pkglist
8. build entire pkglist (lengthy and intensive!)
-EOF
+EOH
)
echo "$action" | cut -d'.' -f1
}
-## Handle printing a package description file
-handle_print_pkg_desc() {
- port=$(get_port)
- [ -z $port ] && exit $NO_PORT_PROVIDED
- pkg_descr="$ports_dir"/$port/pkg-descr
- [ ! -f "$pkg_descr" ] && exit $NO_PKG_DESCR_FOUND
- text=$(cat "$ports_dir"/$port/pkg-descr)
- $pager "$text"
-}
+### Handle printing a package description file
+#handle_print_pkg_desc() {
+# port=$(get_port)
+# [ -z $port ] && exit $NO_PORT_PROVIDED
+# pkg_descr="$ports_dir"/$port/pkg-descr
+# [ ! -f "$pkg_descr" ] && exit $NO_PKG_DESCR_FOUND
+# text=$(cat "$ports_dir"/$port/pkg-descr)
+# $pager "$text"
+#}
-## Handle appending a port to the pkglist. Skips appending if already present
-handle_append_pkglist() {
- port="$1"
- grep -q $port "$pkglist" && exit $OK
- cp "$pkglist" "$pkglist".bak
- echo $port >> "$pkglist"
- sort "$pkglist" -o "$pkglist"
- echo $port
-}
+### Handle appending a port to the pkglist. Skips appending if already present
+#handle_append_pkglist() {
+# port="$1"
+# grep -q $port "$pkglist" && exit $OK
+# cp "$pkglist" "$pkglist".bak
+# echo $port >> "$pkglist"
+# sort "$pkglist" -o "$pkglist"
+# echo $port
+#}
-## Handle running poudriere options on a single port
-handle_poudriere_options_single() {
- port="$1"
- $terminal -e $doas poudriere options -c $port
- echo $port
-}
+### Handle running poudriere options on a single port
+#handle_poudriere_options_single() {
+# port="$1"
+# $terminal -e $doas poudriere options -c $port
+# echo $port
+#}
-## Handle running poudriere bulk on a single port
-handle_poudriere_bulk_single() {
- port="$1"
- notify-send "Poudriere bulk started" "$port"
- $terminal -e $doas poudriere bulk -j "$jail" $port
- notify-send "Poudriere bulk finished" "$port"
-}
+### Handle running poudriere bulk on a single port
+#handle_poudriere_bulk_single() {
+# port="$1"
+# notify-send "Poudriere bulk started" "$port"
+# $terminal -e $doas poudriere bulk -j "$jail" $port
+# notify-send "Poudriere bulk finished" "$port"
+#}
-## Handle running poudriere options on pkglist
-handle_poudriere_options_pkglist() {
- $terminal -e $doas poudriere options -f "$pkglist"
-}
+### Handle running poudriere options on pkglist
+#handle_poudriere_options_pkglist() {
+# $terminal -e $doas poudriere options -f "$pkglist"
+#}
-## Handle running poudriere bulk on pkglist
-handle_poudriere_bulk_pkglist() {
- notify-send "Poudriere bulk started" "(pkglist)"
- $terminal -e $doas poudriere bulk -j "$jail" -f "$pkglist"
- notify-send "Poudriere bulk finished" "(pkglist)"
-}
+### Handle running poudriere bulk on pkglist
+#handle_poudriere_bulk_pkglist() {
+# notify-send "Poudriere bulk started" "(pkglist)"
+# $terminal -e $doas poudriere bulk -j "$jail" -f "$pkglist"
+# notify-send "Poudriere bulk finished" "(pkglist)"
+#}
get_another() {
- choice=$(dmenu -p "Do you want another?" << EOF
+ choice=$(dmenu -p "Do you want another?" << EOH
no
yes
-EOF
+EOH
)
[ $choice = "no" ] && return 1
[ $choice = "yes" ] && return 0
@@ -110,43 +108,45 @@ EOF
## Main
while true ; do
- action=$(get_action)
- case $action in
- 1)
- # 1. print pkg-descr
- handle_print_pkg_desc
- ;;
- 2)
- # 2. set options
- handle_poudriere_options_single $(get_port)
- ;;
- 3)
- # 3. set options, add to pkglist
- handle_poudriere_options_single $(handle_append_pkglist $(get_port))
- ;;
- 4)
- # 4. set options, build pkg
- handle_poudriere_bulk_single $(handle_poudriere_options_single $(get_port))
- ;;
- 5)
- # 5. set options, build pkg, add to pkglist
- handle_poudriere_bulk_single $(handle_poudriere_options_single $(handle_append_pkglist $(get_port)))
- ;;
- 6)
- # 6. add to pkglist
- handle_append_pkglist $(get_port)
- ;;
- 7)
- # 7. set options on pkglist
- handle_poudriere_options_pkglist
- ;;
- 8)
- # 8. build entire pkglist (lengthy and intensive!)
- handle_poudriere_bulk_pkglist
- ;;
- *)
- exit $NO_ACTION_PROVIDED
- ;;
- esac
+ port="$(search_port)"
+ #action=$(get_action)
+ #case $action in
+ # 1)
+ # # 1. print pkg-descr
+ # handle_print_pkg_desc
+ # ;;
+ # 2)
+ # # 2. set options
+ # handle_poudriere_options_single $(get_port)
+ # ;;
+ # 3)
+ # # 3. set options, add to pkglist
+ # handle_poudriere_options_single $(handle_append_pkglist $(get_port))
+ # ;;
+ # 4)
+ # # 4. set options, build pkg
+ # handle_poudriere_bulk_single $(handle_poudriere_options_single $(get_port))
+ # ;;
+ # 5)
+ # # 5. set options, build pkg, add to pkglist
+ # handle_poudriere_bulk_single $(handle_poudriere_options_single $(handle_append_pkglist $(get_port)))
+ # ;;
+ # 6)
+ # # 6. add to pkglist
+ # handle_append_pkglist $(get_port)
+ # ;;
+ # 7)
+ # # 7. set options on pkglist
+ # handle_poudriere_options_pkglist
+ # ;;
+ # 8)
+ # # 8. build entire pkglist (lengthy and intensive!)
+ # handle_poudriere_bulk_pkglist
+ # ;;
+ # *)
+ # exit $NO_ACTION_PROVIDED
+ # ;;
+ #esac
+ echo $port
get_another || exit $OK
done
diff --git a/dockd.sh b/dockd.sh
index 6c5831e..4b67bc5 100755
--- a/dockd.sh
+++ b/dockd.sh
@@ -9,8 +9,7 @@ set -x
# - disable auto locking and sleeping
dock() {
xrandr --output DP-3 --off --output DP-2 --auto --primary
- nvidia-settings --assign CurrentMetaMode="DP-2:nvidia-auto-select +0+0 { ForceCompositionPipeline = On }"
- themer.sh -r
+ #nvidia-settings --assign CurrentMetaMode="DP-2:nvidia-auto-select +0+0 { ForceCompositionPipeline = On }"
sysctl hw.snd.default_unit=1
doas sysctl hw.acpi.lid_switch_state=NONE
killall xautolock
@@ -25,8 +24,7 @@ dock() {
# - enable auto locking and sleeping
undock() {
xrandr --output DP-3 --auto --primary --output DP-2 --off
- nvidia-settings --assign CurrentMetaMode="DP-3:nvidia-auto-select +0+0 { ForceCompositionPipeline = On }"
- themer.sh -r
+ #nvidia-settings --assign CurrentMetaMode="DP-3:nvidia-auto-select +0+0 { ForceCompositionPipeline = On }"
sysctl hw.snd.default_unit=4
doas sysctl hw.acpi.lid_switch_state=S3
killall xautolock
@@ -35,26 +33,21 @@ undock() {
-killer "sleep 0.5; doas acpiconf -s3" \
-notify 10 \
-time 10 \
- -locker "i3lock -n -f -c 000000 -i ~/.local/share/wallpapers/lock.png; sleep 0.2" \
+ -locker "i3lock -n -f -c 002b36 ; sleep 0.2" \
-notifier "notify-send -t=10000 '10 seconds to lock...'" &
notify-send Undocked
}
-[ "$1" = "dock" ] && dock && return 0
-[ "$1" = "undock" ] && undock && return 0
-
-while sleep 5
-do
- xrandr=$(xrandr)
- case "$xrandr" in
- *"DP-2 disconnected primary"*)
- # if DP-2 is disconnected and primary then undock
- undock
- ;;
- *"DP-2 connected ("*)
- # if DP-2 is connected but isn't primary then dock
- dock
- ;;
- esac
-done
+sleep 1
+xrandr=$(xrandr)
+case "$xrandr" in
+ *"DP-2 disconnected primary"*)
+ # if DP-2 is disconnected and primary then undock
+ undock
+ ;;
+ *"DP-2 connected ("*)
+ # if DP-2 is connected but isn't primary then dock
+ dock
+ ;;
+esac
diff --git a/toggle-screencast.sh b/toggle-screencast.sh
index 0088cea..d99b32e 100755
--- a/toggle-screencast.sh
+++ b/toggle-screencast.sh
@@ -34,8 +34,8 @@ start_recording() {
notify-send -t 3000 "Starting screencast." "3...2...1..."
sleep 4
pkill -76 i3blocks
- ffmpeg -video_size 1920x1080 \
- -framerate 50 \
+ ffmpeg -video_size 2560x1440 \
+ -framerate 25 \
-thread_queue_size 512 -f x11grab -i :0.0+0,0 \
-vcodec libx264rgb -crf 0 -preset:v ultrafast \
-acodec pcm_s16le \
diff --git a/url_handler.sh b/url_handler.sh
index 5ae6c59..55d225c 100755
--- a/url_handler.sh
+++ b/url_handler.sh
@@ -83,6 +83,7 @@ handle_youtube() {
# Main
URL=$1
+[ -n "$URL" ] || URL=$(xclip -o)
[ -n "$URL" ] || URL=$(get_url)
[ -n "$URL" ] || exit
echo "$URL"
@@ -90,9 +91,9 @@ echo "$URL"
case $URL in
*youtube.com*) handle_youtube "$URL" ;;
*youtu.be*) handle_youtube "$URL" ;;
- *ytsearch:*) handle_youtube "$URL" ;;
- *mailto*) mutt "$URL" ;;
- *http?*) $BROWSER "$URL" ;;
+ ytsearch:*) handle_youtube "$URL" ;;
+ mailto*) mutt "$URL" ;;
+ http?*) $BROWSER "$URL" ;;
*)
$BROWSER --search "$URL"
esac
diff --git a/wal.sh b/wal.sh
new file mode 100755
index 0000000..5c7513a
--- /dev/null
+++ b/wal.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+[ -f "$1" ] && ln -sf "$(readlink -f $1)" ~/.local/share/wallpaper.svg
+sed 's/fill=/fill="#657b83" _=/g' ~/.local/share/wallpaper.svg | display -background '#002b36' -window root -
diff --git a/weather.sh b/weather.sh
index 37089c8..cb6a0ca 100755
--- a/weather.sh
+++ b/weather.sh
@@ -37,18 +37,14 @@ do
;;
esac
- #printf "$ICON"
;;
description*)
- #printf "${line#description }"
DESCRIPTION="${line#description }"
;;
humidity*)
- #printf "󰖎%.2d%% " "${line#humidity }"
HUMIDITY="${line#humidity }"
;;
feels_like*)
- #printf "%2.1f℉ " "${line#feels_like }"
FEELS_LIKE="${line#feels_like }"
;;
esac
@@ -59,4 +55,4 @@ $(fetch -qo - "https://api.openweathermap.org/data/2.5/weather?zip=$ZIP_CODE&uni
| tr ':' ' ')
EOF
-printf "%s%s %2.1f℉ 󰖎%.2d%%\n" "$ICON" "$DESCRIPTION" "$FEELS_LIKE" "$HUMIDITY"
+printf "%s %s %2.1f℉ 󰖎 %.2d%%\n" "$ICON" "$DESCRIPTION" "$FEELS_LIKE" "$HUMIDITY"