added fluxo and hyprlock conf
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 7.0 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.6 MiB |
Executable
+33
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Get the current battery percentage
|
||||
battery_percentage=$(cat /sys/class/power_supply/BAT0/capacity)
|
||||
|
||||
# Get the battery status (Charging or Discharging)
|
||||
battery_status=$(cat /sys/class/power_supply/BAT0/status)
|
||||
|
||||
# Define the battery icons for each 10% segment
|
||||
battery_icons=("" "" "" "" "" "" "" "" "" "")
|
||||
|
||||
# Define the charging icon
|
||||
charging_icon=""
|
||||
|
||||
# Calculate the index for the icon array
|
||||
# Ensure the index is within bounds (0 to 9) for battery percentages 0 to 100
|
||||
icon_index=$((battery_percentage / 10))
|
||||
|
||||
# If the battery is 100%, use the last icon (index 9)
|
||||
if [ "$battery_percentage" -eq 100 ]; then
|
||||
icon_index=9
|
||||
fi
|
||||
|
||||
# Get the corresponding icon
|
||||
battery_icon=${battery_icons[$icon_index]}
|
||||
|
||||
# Check if the battery is charging
|
||||
if [ "$battery_status" = "Charging" ]; then
|
||||
battery_icon="$charging_icon"
|
||||
fi
|
||||
|
||||
# Output the battery percentage and icon
|
||||
echo "$battery_percentage% $battery_icon"
|
||||
Executable
+47
@@ -0,0 +1,47 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Path to the Hyprland configuration file
|
||||
config_file="$HOME/.config/hypr/hyprlock.conf"
|
||||
|
||||
# Read the bt-mode value from the configuration file
|
||||
bt_mode=$(grep -oP '^\$bt-mode\s*=\s*\K\S+' ~/.config/hypr/hyprlock.conf)
|
||||
|
||||
# Get Bluetooth power status
|
||||
bluetooth_status=$(bluetoothctl show | grep "Powered:" | awk '{print $2}')
|
||||
|
||||
# Check if Bluetooth is powered on
|
||||
if [ "$bluetooth_status" != "yes" ]; then
|
||||
echo " Bluetooth Off"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Initialize connected devices
|
||||
connected_devices=$(echo "$connected_devices" | sed 's/[[:space:]]*$//')
|
||||
|
||||
# Process Bluetooth devices
|
||||
while read -r line; do
|
||||
echo "Processing line: $line" >&2
|
||||
device_mac=$(echo "$line" | awk '{print $2}')
|
||||
device_name=$(echo "$line" | cut -d' ' -f3-)
|
||||
echo "Device MAC: $device_mac" >&2
|
||||
echo "Device Name: $device_name" >&2
|
||||
if bluetoothctl info "$device_mac" | grep -q "Connected: yes"; then
|
||||
connected_devices+="$device_name "
|
||||
fi
|
||||
echo "Finished processing $device_mac" >&2
|
||||
echo "---" >&2
|
||||
done < <(bluetoothctl devices)
|
||||
|
||||
# If no connected devices, show "No Devices"
|
||||
if [ -z "$connected_devices" ]; then
|
||||
echo " No Devices"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Display output based on bt-mode
|
||||
if [ "$bt_mode" = "true" ]; then
|
||||
echo " $connected_devices"
|
||||
else
|
||||
echo " Connected"
|
||||
fi
|
||||
|
||||
Executable
+22
@@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Only works if you use SWWW for your wallpapers
|
||||
|
||||
SWWW_DIR="$HOME/.cache/swww/"
|
||||
HYPRLOCK="$HOME/.config/hypr/hyprlock.conf"
|
||||
|
||||
# Get a Monitor Cache File
|
||||
FIRST_FILE=$(find "$SWWW_DIR" -type f | head -n 1)
|
||||
|
||||
# Check if SWWW file exists
|
||||
if [ -n "$FIRST_FILE" ] && [ -f "$FIRST_FILE" ]; then
|
||||
WALLPAPER=$(sed -n '2p' "$FIRST_FILE")
|
||||
|
||||
sed -i "s|^\(\$wallpaper[[:space:]]*=[[:space:]]*\).*|\1$WALLPAPER # (screenshot or /path/to/your/wallpaper.jpg)|" "$HYPRLOCK"
|
||||
echo "Wallpaper path updated to $WALLPAPER"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Error
|
||||
echo "Fehler: kein Wallpaper gefunden."
|
||||
exit 1
|
||||
Executable
+32
@@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Set your Username
|
||||
# username="TamarindX"
|
||||
|
||||
# Read the username alias from hyprlock.conf
|
||||
username=$(grep -oP '^\$USER\s*=\s*\K\S+' ~/.config/hypr/hyprlock.conf)
|
||||
|
||||
# Check if the username was successfully extracted
|
||||
if [ -z "$username" ]; then
|
||||
echo "Username not found in hyprlock.conf."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Get the current hour
|
||||
hour=$(date +%H)
|
||||
|
||||
# Determine the greeting based on the time
|
||||
if [ "$hour" -ge 5 ] && [ "$hour" -lt 12 ]; then
|
||||
greeting="Good Morning"
|
||||
elif [ "$hour" -ge 12 ] && [ "$hour" -lt 17 ]; then
|
||||
greeting="Good Afternoon"
|
||||
elif [ "$hour" -ge 17 ] && [ "$hour" -lt 21 ]; then
|
||||
greeting="Good Evening"
|
||||
elif [ "$hour" -ge 21 ] && [ "$hour" -lt 24 ]; then
|
||||
greeting="Good Night"
|
||||
else
|
||||
greeting="GO TO SLEEP!"
|
||||
fi
|
||||
|
||||
# Output the combined text
|
||||
echo -e "Hello, $username! $greeting"
|
||||
Executable
+65
@@ -0,0 +1,65 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Set this variable to control the output
|
||||
# Set to "true" to show SSID, "false" to show "Connected"
|
||||
# show_ssid=false
|
||||
|
||||
# Read the wifi-mode alias from hyprlock.conf
|
||||
show_ssid=$(grep -oP '^\$wifi-mode\s*=\s*\K\S+' ~/.config/hypr/hyprlock.conf)
|
||||
|
||||
# Check if the SSID was successfully extracted else fallback?!
|
||||
if [ -z "$show_ssid" ]; then
|
||||
show_ssid=false
|
||||
fi
|
||||
|
||||
# Check if any Ethernet connection is active
|
||||
ethernet_connected=$(nmcli -t -f DEVICE,TYPE,STATE dev | grep -E 'ethernet:connected')
|
||||
|
||||
# If Ethernet
|
||||
if [ -n "$ethernet_connected" ]; then
|
||||
echo " Ethernet"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Get Wi-Fi connection status
|
||||
wifi_status=$(nmcli -t -f WIFI g)
|
||||
|
||||
# Check if Wi-Fi is enabled
|
||||
if [ "$wifi_status" != "enabled" ]; then
|
||||
echo " Wi-Fi Off"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Get active Wi-Fi connection details
|
||||
wifi_info=$(nmcli -t -f ACTIVE,SSID,SIGNAL dev wifi | grep '^yes')
|
||||
|
||||
# If no active connection, show "Disconnected"
|
||||
if [ -z "$wifi_info" ]; then
|
||||
echo " No Wi-Fi"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Extract SSID
|
||||
ssid=$(echo "$wifi_info" | cut -d':' -f2)
|
||||
|
||||
# Extract signal strength
|
||||
signal_strength=$(echo "$wifi_info" | cut -d':' -f3)
|
||||
|
||||
# Define Wi-Fi icons based on signal strength
|
||||
wifi_icons=("" "" "" "" "") # From low to high signal
|
||||
|
||||
# Clamp signal strength between 0 and 100
|
||||
signal_strength=$((signal_strength < 0 ? 0 : (signal_strength > 100 ? 100 : signal_strength)))
|
||||
|
||||
# Calculate the icon index based on signal strength
|
||||
icon_index=$((signal_strength / 25))
|
||||
|
||||
# Get the corresponding icon
|
||||
wifi_icon=${wifi_icons[$icon_index]}
|
||||
|
||||
# Output based on show_ssid variable
|
||||
if [ "$show_ssid" = true ]; then
|
||||
echo "$wifi_icon $ssid"
|
||||
else
|
||||
echo "$wifi_icon Connected"
|
||||
fi
|
||||
Executable
+116
@@ -0,0 +1,116 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "Usage: $0 --title | --artist | --album | --source | --source-symbol"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Function to get metadata using playerctl
|
||||
get_metadata() {
|
||||
key=$1
|
||||
playerctl metadata --player=%any,chromium,firefox --format "{{ $key }}" 2>/dev/null
|
||||
}
|
||||
|
||||
# Check for arguments
|
||||
|
||||
# Function to determine the source and return an icon and text
|
||||
get_source_info_symbol() {
|
||||
trackid=$(get_metadata "mpris:trackid")
|
||||
if [[ "$trackid" == *"firefox"* ]]; then
|
||||
echo -e ""
|
||||
elif [[ "$trackid" == *"spotify"* ]]; then
|
||||
echo -e ""
|
||||
elif [[ "$trackid" == *"chromium"* ]]; then
|
||||
echo -e ""
|
||||
else
|
||||
echo ""
|
||||
fi
|
||||
}
|
||||
|
||||
get_source_info() {
|
||||
trackid=$(get_metadata "mpris:trackid")
|
||||
if [[ "$trackid" == *"firefox"* ]]; then
|
||||
echo -e "Firefox"
|
||||
elif [[ "$trackid" == *"spotify"* ]]; then
|
||||
echo -e "Spotify"
|
||||
elif [[ "$trackid" == *"chromium"* ]]; then
|
||||
echo -e "Chrome"
|
||||
else
|
||||
echo ""
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to truncate text with ellipsis if necessary
|
||||
truncate_with_ellipsis() {
|
||||
text=$1
|
||||
max_length=$2
|
||||
if [ ${#text} -gt $max_length ]; then
|
||||
echo "${text:0:$((max_length - 3))}..."
|
||||
else
|
||||
echo "$text"
|
||||
fi
|
||||
}
|
||||
|
||||
# Parse the argument
|
||||
case "$1" in
|
||||
--title)
|
||||
title=$(get_metadata "xesam:title")
|
||||
if [ -z "$title" ]; then
|
||||
echo ""
|
||||
else
|
||||
truncate_with_ellipsis "$title" 28 # Limit the output to 50 characters
|
||||
fi
|
||||
;;
|
||||
--artist)
|
||||
artist=$(get_metadata "xesam:artist")
|
||||
if [ -z "$artist" ]; then
|
||||
echo ""
|
||||
else
|
||||
truncate_with_ellipsis "$artist" 28 # Limit the output to 50 characters
|
||||
fi
|
||||
;;
|
||||
--status-symbol)
|
||||
status=$(playerctl status 2>/dev/null)
|
||||
if [[ $status == "Playing" ]]; then
|
||||
echo ""
|
||||
elif [[ $status == "Paused" ]]; then
|
||||
echo ""
|
||||
else
|
||||
echo ""
|
||||
fi
|
||||
;;
|
||||
--status)
|
||||
status=$(playerctl status 2>/dev/null)
|
||||
if [[ $status == "Playing" ]]; then
|
||||
echo "Playing Now"
|
||||
elif [[ $status == "Paused" ]]; then
|
||||
echo "Paused"
|
||||
else
|
||||
echo ""
|
||||
fi
|
||||
;;
|
||||
--album)
|
||||
album=$(playerctl metadata --player=%any,chromium,firefox --format "{{ xesam:album }}" 2>/dev/null)
|
||||
if [[ -n $album ]]; then
|
||||
echo "$album"
|
||||
else
|
||||
status=$(playerctl status 2>/dev/null)
|
||||
if [[ -n $status ]]; then
|
||||
echo "Not album"
|
||||
else
|
||||
truncate_with_ellipsis "$album" 28 # Limit the output to 50 characters
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
--source-symbol)
|
||||
get_source_info_symbol
|
||||
;;
|
||||
--source)
|
||||
get_source_info
|
||||
;;
|
||||
*)
|
||||
echo "Invalid option: $1"
|
||||
echo "Usage: $0 --title | --artist | --album | --source | --source-symbol"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
Executable
+39
@@ -0,0 +1,39 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Get location data using IP Geolocation
|
||||
|
||||
# Recommended with API, but you can try w/o API [IPINFO.IO]
|
||||
# API_TOKEN="YOUR_API_TOKEN"
|
||||
# location_data=$(curl -s "https://ipinfo.io?token=$API_TOKEN" 2>/dev/null)
|
||||
# location_data=$(curl -s https://ipinfo.io 2>/dev/null) #[Limited requests. Require API to send 50k request/month]
|
||||
|
||||
# Extract city and country code (ISO 3166-1 alpha-2 code)
|
||||
# CITY=$(echo "$location_data" | jq -r '.city // empty')
|
||||
# COUNTRY=$(echo "$location_data" | jq -r '.country // empty')
|
||||
|
||||
# IPINFO Alternative [IP-API.COM]
|
||||
location_data=$(curl -s "http://ip-api.com/json/" 2>/dev/null)
|
||||
|
||||
# Extract city and country code
|
||||
CITY=$(echo "$location_data" | jq -r '.city // empty')
|
||||
COUNTRY=$(echo "$location_data" | jq -r '.countryCode // empty')
|
||||
# Visit http://ip-api.com/json/ to find other variables
|
||||
|
||||
# HARDCODE Location
|
||||
# CITY=$(grep -oP '^\$CITY\s*=\s*\K.+' ~/.config/hypr/hyprlock.conf)
|
||||
# COUNTRY=$(grep -oP '^\$COUNTRY\s*=\s*\K.+' ~/.config/hypr/hyprlock.conf)
|
||||
|
||||
# Check if CITY and COUNTRY are valid
|
||||
if [[ -n "$CITY" && -n "$COUNTRY" ]]; then
|
||||
# Fetch weather info for the detected city from wttr.in
|
||||
weather_info=$(curl -s "wttr.in/$CITY?format=%c+%C+%t" 2>/dev/null)
|
||||
|
||||
# Check if the weather info is valid
|
||||
if [[ -n "$weather_info" ]]; then
|
||||
echo "$COUNTRY, $CITY: $weather_info"
|
||||
else
|
||||
echo "Weather info unavailable for $COUNTRY, $CITY"
|
||||
fi
|
||||
else
|
||||
echo "Unable to determine your location"
|
||||
fi
|
||||
Reference in New Issue
Block a user