put files in folder
This commit is contained in:
+29
@@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
|
||||
icons=("" "" "" "")
|
||||
state_file="/tmp/battery_anim_index"
|
||||
|
||||
# init
|
||||
[ ! -f "$state_file" ] && echo 0 > "$state_file"
|
||||
i=$(cat "$state_file")
|
||||
|
||||
capacity=$(cat /sys/class/power_supply/BAT0/capacity)
|
||||
status=$(cat /sys/class/power_supply/BAT0/status)
|
||||
|
||||
if [ "$capacity" -le 15 ]; then
|
||||
echo "{\"text\": \" Connect charger $capacity%\", \"class\": \"critical\"}"
|
||||
|
||||
elif [ "$capacity" -le 25 ]; then
|
||||
echo "{\"text\": \" Battery low $capacity%\", \"class\": \"warning\"}"
|
||||
|
||||
elif [[ "$status" == "Full" ]]; then
|
||||
echo "{\"text\": \" Battery full $capacity%\", \"class\": \"full\"}"
|
||||
|
||||
elif [[ "$status" == "Charging" ]]; then
|
||||
echo "{\"text\": \"${icons[$i]} Charging $capacity%\", \"class\": \"charging\"}"
|
||||
i=$(( (i+1) % ${#icons[@]} ))
|
||||
echo $i > "$state_file"
|
||||
|
||||
else
|
||||
echo "{\"text\": \" $capacity%\", \"class\": \"normal\"}"
|
||||
fi
|
||||
@@ -0,0 +1,77 @@
|
||||
#!/bin/bash
|
||||
|
||||
# =========================
|
||||
# CONFIG
|
||||
# =========================
|
||||
|
||||
DIR="$HOME/Pictures/Screenshots"
|
||||
DEVICE_NAME="" # Optional
|
||||
|
||||
SOUND="/usr/share/sounds/freedesktop/stereo/screen-capture.oga"
|
||||
|
||||
# =========================
|
||||
# SETUP
|
||||
# =========================
|
||||
|
||||
mkdir -p "$DIR"
|
||||
TIME=$(date +"%d-%m-%Y_%H-%M-%S")
|
||||
FILE="$DIR/Screenshot_${TIME}.png"
|
||||
|
||||
# =========================
|
||||
# SCREENSHOT
|
||||
# =========================
|
||||
|
||||
if ! grim - | tee "$FILE" | wl-copy; then
|
||||
notify-send "❌ Screenshot failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# =========================
|
||||
# PLAY SOUND
|
||||
# =========================
|
||||
|
||||
if [ -f "$SOUND" ]; then
|
||||
paplay "$SOUND" &
|
||||
fi
|
||||
|
||||
# =========================
|
||||
# FILE READY CHECK
|
||||
# =========================
|
||||
|
||||
for i in {1..10}; do
|
||||
[ -f "$FILE" ] && break
|
||||
sleep 0.2
|
||||
done
|
||||
|
||||
# =========================
|
||||
# KDE CONNECT READY
|
||||
# =========================
|
||||
|
||||
if ! pgrep -x kdeconnectd >/dev/null; then
|
||||
kdeconnectd &
|
||||
sleep 2
|
||||
fi
|
||||
|
||||
# =========================
|
||||
# DEVICE DETECTION
|
||||
# =========================
|
||||
|
||||
if [ -n "$DEVICE_NAME" ]; then
|
||||
DEVICE_ID=$(kdeconnect-cli -a | grep "$DEVICE_NAME" | cut -d':' -f1)
|
||||
else
|
||||
DEVICE_ID=$(kdeconnect-cli -a --id-only | head -n 1)
|
||||
fi
|
||||
|
||||
# =========================
|
||||
# SEND FILE
|
||||
# =========================
|
||||
|
||||
if [ -n "$DEVICE_ID" ]; then
|
||||
if kdeconnect-cli -d "$DEVICE_ID" --share "$FILE"; then
|
||||
notify-send "Sent to your phone" "$(basename "$FILE")"
|
||||
else
|
||||
notify-send "⚠️ Send failed" "Saved locally"
|
||||
fi
|
||||
else
|
||||
notify-send "⚠️ No device found" "Saved locally"
|
||||
fi
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
hour=$(date +%H)
|
||||
|
||||
if [ "$hour" -ge 5 ] && [ "$hour" -lt 12 ]; then
|
||||
echo "Good Morning"
|
||||
elif [ "$hour" -ge 12 ] && [ "$hour" -lt 17 ]; then
|
||||
echo "Good Afternoon"
|
||||
elif [ "$hour" -ge 17 ] && [ "$hour" -lt 21 ]; then
|
||||
echo "Good Evening"
|
||||
else
|
||||
echo "Good Night"
|
||||
fi
|
||||
Executable
+61
@@ -0,0 +1,61 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -u
|
||||
|
||||
fallback_text="Nothing is playing"
|
||||
|
||||
json_escape() {
|
||||
printf '%s' "$1" | sed 's/\\/\\\\/g; s/"/\\"/g'
|
||||
}
|
||||
|
||||
player_icon() {
|
||||
case "$1" in
|
||||
*spotify*) printf '%s' " " ;;
|
||||
*firefox* | *zen*) printf '%s' " " ;;
|
||||
*chromium*) printf '%s' " " ;;
|
||||
*vlc*) printf '%s' " " ;;
|
||||
*) printf '%s' " " ;;
|
||||
esac
|
||||
}
|
||||
|
||||
playing_player=""
|
||||
paused_player=""
|
||||
while IFS= read -r p; do
|
||||
[ -n "$p" ] || continue
|
||||
status="$(playerctl -p "$p" status 2>/dev/null || true)"
|
||||
if [ "$status" = "Playing" ]; then
|
||||
playing_player="$p"
|
||||
break
|
||||
fi
|
||||
if [ "$status" = "Paused" ] && [ -z "$paused_player" ]; then
|
||||
paused_player="$p"
|
||||
fi
|
||||
done < <(playerctl -l 2>/dev/null || true)
|
||||
|
||||
target_player="$playing_player"
|
||||
[ -n "$target_player" ] || target_player="$paused_player"
|
||||
|
||||
if [ -z "$target_player" ]; then
|
||||
printf '{"text":"%s","tooltip":"%s"}\n' "$(json_escape "$fallback_text")" "$(json_escape "$fallback_text")"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
status="$(playerctl -p "$target_player" status 2>/dev/null || true)"
|
||||
title="$(playerctl -p "$target_player" metadata xesam:title 2>/dev/null || true)"
|
||||
artist="$(playerctl -p "$target_player" metadata xesam:artist 2>/dev/null | paste -sd ', ' - || true)"
|
||||
icon="$(player_icon "$target_player")"
|
||||
|
||||
[ -n "$title" ] || {
|
||||
printf '{"text":"%s","tooltip":"%s"}\n' "$(json_escape "$fallback_text")" "$(json_escape "$fallback_text")"
|
||||
exit 0
|
||||
}
|
||||
|
||||
if [ "$status" = "Paused" ]; then
|
||||
text="⏸ $icon $title"
|
||||
else
|
||||
text="$icon $title"
|
||||
fi
|
||||
tooltip="$title"
|
||||
[ -n "$artist" ] && tooltip="$title - $artist"
|
||||
|
||||
printf '{"text":"%s","tooltip":"%s"}\n' "$(json_escape "$text")" "$(json_escape "$tooltip")"
|
||||
@@ -0,0 +1,74 @@
|
||||
#!/bin/bash
|
||||
|
||||
# =========================
|
||||
# CONFIG
|
||||
# =========================
|
||||
|
||||
DIR="$HOME/Pictures/Screenshots"
|
||||
DEVICE_NAME=""
|
||||
SOUND="/usr/share/sounds/freedesktop/stereo/screen-capture.oga"
|
||||
|
||||
mkdir -p "$DIR"
|
||||
TIME=$(date +"%d-%m-%Y_%H-%M-%S")
|
||||
FILE="$DIR/Screenshot_${TIME}.png"
|
||||
|
||||
# =========================
|
||||
# WAYLAND CHECK
|
||||
# =========================
|
||||
|
||||
if [ -z "$WAYLAND_DISPLAY" ]; then
|
||||
notify-send "❌ Not running in Wayland"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# =========================
|
||||
# AREA SELECT
|
||||
# =========================
|
||||
|
||||
GEOM=$(slurp 2>/dev/null)
|
||||
|
||||
# cancel case
|
||||
if [ -z "$GEOM" ]; then
|
||||
notify-send "❌ Screenshot cancelled"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# =========================
|
||||
# SCREENSHOT
|
||||
# =========================
|
||||
|
||||
if ! grim -g "$GEOM" "$FILE"; then
|
||||
notify-send "❌ Screenshot failed (grim error)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# copy to clipboard
|
||||
wl-copy < "$FILE"
|
||||
|
||||
# =========================
|
||||
# SOUND
|
||||
# =========================
|
||||
|
||||
[ -f "$SOUND" ] && paplay "$SOUND" &
|
||||
|
||||
# =========================
|
||||
# KDE CONNECT
|
||||
# =========================
|
||||
|
||||
if ! pgrep -x kdeconnectd >/dev/null; then
|
||||
kdeconnectd &
|
||||
sleep 2
|
||||
fi
|
||||
|
||||
if [ -n "$DEVICE_NAME" ]; then
|
||||
DEVICE_ID=$(kdeconnect-cli -a | grep "$DEVICE_NAME" | cut -d':' -f1)
|
||||
else
|
||||
DEVICE_ID=$(kdeconnect-cli -a --id-only | head -n 1)
|
||||
fi
|
||||
|
||||
if [ -n "$DEVICE_ID" ]; then
|
||||
kdeconnect-cli -d "$DEVICE_ID" --share "$FILE" && \
|
||||
notify-send "Sent to your phone" "$(basename "$FILE")"
|
||||
else
|
||||
notify-send "⚠️ No device found" "Saved locally"
|
||||
fi
|
||||
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
WALL_DIR="$HOME/Wallpapers"
|
||||
|
||||
WALL=$(find "$WALL_DIR" -type f | shuf -n 1)
|
||||
|
||||
pkill swaybg
|
||||
|
||||
swaybg -i "$WALL" -m fill &
|
||||
|
||||
notify-send "Wallpaper changed" "$(basename "$WALL")" -i "$WALL"
|
||||
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
DIR="$HOME/Wallpapers"
|
||||
|
||||
IMG=$(find "$DIR" -type f \( -iname "*.jpg" -o -iname "*.png" -o -iname "*.jpeg" -o -iname "*.webp" \) | shuf -n 1)
|
||||
|
||||
cp "$IMG" ~/.cache/hyprlock_wall.png
|
||||
|
||||
hyprlock
|
||||
Reference in New Issue
Block a user