Skip to content

Commit b8d184e

Browse files
committed
update
1 parent b98a6d3 commit b8d184e

22 files changed

Lines changed: 459 additions & 175 deletions

File tree

bin/bg.sh

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ IMG_DIR="${WALLPAPER_DIR:-$HOME/Pictures/walls/walls-main/anime}"
1212
IMG_INDEX_FILE="$CACHE_DIR/wallpaper-index.txt"
1313
BG_ID_FILE="$CACHE_DIR/current-bg-id"
1414

15-
1615
notify() {
1716
if [ -n "${SILENT}" ]; then
1817
echo "$@" >&2
@@ -190,13 +189,13 @@ process_wallpaper() {
190189
hyprctl hyprpaper preload "$img"
191190
hyprctl hyprpaper wallpaper "eDP-1,$img"
192191
log "INFO" "Set wallpaper (Wayland/hyprpaper): $img" true
193-
elif pgrep -x ".swww-daemon-wr" &>/dev/null; then
194-
if [ -z "$NIRI_NAMESPACE" ];then
195-
swww img "$img" --transition-type wipe >/dev/null 2>&1
196-
log "INFO" "Set wallpaper (Wayland/swww): $img" true
192+
elif pgrep -x ".awww-daemon-wr" &>/dev/null; then
193+
if [ -z "$NIRI_NAMESPACE" ]; then
194+
awww img "$img" --transition-type wipe >/dev/null 2>&1
195+
log "INFO" "Set wallpaper (Wayland/awww): $img" true
197196
else
198-
swww -n $NIRI_NAMESPACE img "$img" --transition-type wipe >/dev/null 2>&1
199-
log "INFO" "Set wallpaper (Wayland/swww) (Niri: $NIRI_NAMESPACE): $img" true
197+
awww -n $NIRI_NAMESPACE img "$img" --transition-type wipe >/dev/null 2>&1
198+
log "INFO" "Set wallpaper (Wayland/awww) (Niri: $NIRI_NAMESPACE): $img" true
200199
fi
201200
elif pgrep -x "swaybg" &>/dev/null; then
202201
killall -9 swaybg >/dev/null 2>&1
@@ -227,7 +226,7 @@ process_wallpaper() {
227226
echo "$BG_ID" >"$BG_ID_FILE"
228227

229228
if [ -x ~/dotnix/bin/rofi-make-config.sh ]; then
230-
~/dotnix/bin/rofi-make-config.sh
229+
~/dotnix/bin/rofi-make-config.sh
231230
fi
232231

233232
return 0
@@ -301,7 +300,6 @@ get_random_wallpaper() {
301300
fi
302301
}
303302

304-
305303
handle_last_wallpaper() {
306304
local get_only="${1:-false}"
307305
local last_img=$(get_last_wallpaper)
@@ -391,7 +389,6 @@ Notes:
391389
EOF
392390
}
393391

394-
395392
initialize
396393

397394
case "$1" in

bin/clean.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
dirs=(
6+
".zig-cache"
7+
".cache"
8+
".clangd"
9+
".ccls-cache"
10+
"zig-out"
11+
"node_modules"
12+
)
13+
14+
for dir in "${dirs[@]}"; do
15+
find . -type d -name "$dir" -prune -exec rm -rf {} +
16+
done
17+
18+
if find . -name "Cargo.toml" -print -quit | grep -q .; then
19+
find . -type d -name "target" -prune -exec rm -rf {} +
20+
fi
21+
22+
if find . -name "package.json" -print -quit | grep -q .; then
23+
find . -type d -name "dist" -prune -exec rm -rf {} +
24+
fi

bin/findcores.sh

Lines changed: 0 additions & 3 deletions
This file was deleted.

bin/light

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
11
#!/usr/bin/env bash
22

33
case "$1" in
4-
"")
5-
exec xbacklight -get
6-
;;
7-
-S)
8-
shift
9-
exec xbacklight -set "$1"
10-
;;
11-
-A)
12-
shift
13-
exec xbacklight -inc "$1"
14-
;;
15-
-U)
16-
shift
17-
exec xbacklight -dec "$1"
18-
;;
19-
*)
20-
echo "Unsupported option: $1"
21-
echo "Supported: (none), -S, -A, -U"
22-
exit 1
23-
;;
4+
"down")
5+
echo -n 1 >/sys/class/backlight/intel_backlight/brightness
6+
;;
7+
"")
8+
exec xbacklight -get
9+
;;
10+
-S)
11+
shift
12+
exec xbacklight -set "$1"
13+
;;
14+
-A)
15+
shift
16+
exec xbacklight -inc "$1"
17+
;;
18+
-U)
19+
shift
20+
exec xbacklight -dec "$1"
21+
;;
22+
*)
23+
echo "Unsupported option: $1"
24+
echo "Supported: (none), -S, -A, -U, down"
25+
exit 1
26+
;;
2427
esac

bin/lyrics-line.sh

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# pip install youtube-transcript-api # also present in nixpkgs by the same name
77

88
PLAYER="${1:-spotify}"
9-
FIREFOX=~/.zen/hbvavekk.School/sessionstore-backups/recovery.jsonlz4
9+
FIREFOX=$(sh -c 'ls $HOME/.zen/*.Default\ Profile/sessionstore-backups/recovery.jsonlz4')
1010
CACHE_DIR=$HOME/.cache/lyrics
1111
LOCK_DIR=$HOME/.cache/lyrics/locks
1212
mkdir -p "$CACHE_DIR"
@@ -18,7 +18,7 @@ get_id() {
1818
if [[ "$url" =~ ^https://www\.youtube\.com/watch\?v= ]]; then
1919
echo "$url" | perl -pe 's|https:\/\/www\.youtube\.com\/watch\?v=||'
2020
else
21-
echo "Error: The URL is not from YouTube." >&2
21+
# echo "Error: The URL is not from YouTube." >&2
2222
return 1
2323
fi
2424
}
@@ -229,14 +229,14 @@ youtube() {
229229
230230
print(convert_json_to_timestamp_format(t), end='\n')
231231
EOF
232-
)
233-
if [ $? -eq 0 ]; then
234-
echo "$res" >"$file_path"
235-
fi
232+
)
233+
if [ $? -eq 0 ]; then
234+
echo "$res" >"$file_path"
235+
fi
236236

237-
# Release the lock
238-
release_lock "$lock_name"
239-
echo "$res"
237+
# Release the lock
238+
release_lock "$lock_name"
239+
echo "$res"
240240
fi
241241
}
242242

@@ -252,34 +252,34 @@ handle_player() {
252252
fi
253253

254254
case "$player" in
255-
spotify | spotifyd | spotify_player)
256-
PLAYER=$player
257-
if ! lrclib | current_line "$(get_position)"; then
258-
playerctl metadata --format "{{title}} - {{artist}}"
259-
fi
260-
;;
261-
chromium)
262-
PLAYER=chromium
263-
album=$(playerctl -p $PLAYER metadata xesam:album | tr -d '\n')
264-
if [ -z "$album" ]; then
265-
playerctl -p $PLAYER metadata --format "{{title}} {{artist}}"
266-
else
267-
lrclib | current_line "$(get_position)"
268-
fi
269-
;;
270-
firefox)
271-
PLAYER=firefox
272-
album=$(playerctl -p $PLAYER metadata xesam:album | tr -d '\n')
273-
if [ -z "$album" ]; then
274-
id=$(get_id)
275-
if [ $? -eq 0 ]; then
276-
subs=$(youtube "$id")
277-
echo "$subs" | current_line "$(get_position)"
278-
fi
279-
else
280-
lrclib | current_line "$(get_position)"
255+
spotify | spotifyd | spotify_player)
256+
PLAYER=$player
257+
if ! lrclib | current_line "$(get_position)"; then
258+
playerctl metadata --format "{{title}} - {{artist}}"
259+
fi
260+
;;
261+
chromium)
262+
PLAYER=chromium
263+
album=$(playerctl -p $PLAYER metadata xesam:album | tr -d '\n')
264+
if [ -z "$album" ]; then
265+
playerctl -p $PLAYER metadata --format "{{title}} {{artist}}"
266+
else
267+
lrclib | current_line "$(get_position)"
268+
fi
269+
;;
270+
firefox)
271+
PLAYER=firefox
272+
album=$(playerctl -p $PLAYER metadata xesam:album | tr -d '\n')
273+
if [ -z "$album" ]; then
274+
id=$(get_id)
275+
if [ $? -eq 0 ]; then
276+
subs=$(youtube "$id")
277+
echo "$subs" | current_line "$(get_position)"
281278
fi
282-
;;
279+
else
280+
lrclib | current_line "$(get_position)"
281+
fi
282+
;;
283283
esac
284284
}
285285

bin/wpi-rdp.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/usr/bin/env bash
2+
3+
CACHE_FILE="$HOME/.cache/wpi-rdp.cache"
4+
5+
source "$HOME/wpi/rdp-auth.sh"
6+
7+
SERVERS=(
8+
# Makaroff
9+
"arc-research-01"
10+
11+
"arc-research-09"
12+
"arc-research-10"
13+
"arc-research-11"
14+
15+
# other
16+
"arc-teach-01" # solid works
17+
"elabs" # solid works
18+
"windows"
19+
20+
"matlab01"
21+
"matlab02"
22+
)
23+
24+
if [[ -f "$CACHE_FILE" ]]; then
25+
LAST_SERVER="$(<"$CACHE_FILE")"
26+
SERVERS=("$LAST_SERVER" "${SERVERS[@]}")
27+
fi
28+
29+
SERVER="$(printf '%s\n' "${SERVERS[@]}" | awk '!seen[$0]++' | rofi -dmenu -p "choose server")"
30+
[[ -n "$SERVER" ]] || exit 0
31+
32+
printf '%s\n' "$SERVER" >"$CACHE_FILE"
33+
notify-send "RDP" "Connecting $USER to $SERVER.wpi.edu"
34+
35+
yes | xfreerdp \
36+
"/v:$SERVER.wpi.edu" \
37+
"/u:$USER" \
38+
"/p:$PASS" \
39+
/dynamic-resolution \
40+
/clipboard \
41+
+auto-reconnect \
42+
"$@"

0 commit comments

Comments
 (0)