updates
This commit is contained in:
1 parent
3dab288c51
commit
b25e81d1a3
35 files changed
+422
-772
No files matched your search
Executable
+177
@@ -0,0 +1,177 @@
|
||||
#!/bin/bash
|
||||
trap resume_processes SIGINT
|
||||
in_range() { local num=$1 local min=$2 local max=$3 ; [[ $num =~ ^[0-9]+$ ]] && (( num >= min && num <= max )); }
|
||||
mnc=5 mxc=80 mnl=20 mxl=50 mnu=80 mxu=100 mnt=60 mxt=1000 mnf=80 mxf=100 mnn=1 mxn=60 mni=1 mxi=10 verbose=false undock=false #Defaults Ranges
|
||||
while (( "$#" )); do # Parse command-line arguments and defaults
|
||||
case "$1" in
|
||||
"--full"|"-f") if in_range "$2" $mnf $mxf; then battery_full_threshold=$2 ; shift 2 ; else echo "$1 Error: Full Threshold must be $mnf - $mxf." >&2 ; exit 1 ; fi;;
|
||||
"--critical"|"-c") if in_range "$2" $mnc $mxc; then battery_critical_threshold=$2 ; shift 2 ; else echo "$1 ERROR: Critical Threshold must be $mnc - $mxc." >&2 ; exit 1 ; fi;;
|
||||
"--low"|"-l") if in_range "$2" $mnl $mnu; then battery_low_threshold=$2 ; shift 2 ; else echo "$1 ERROR: Low Threshold $mnl - $mnu." >&2 ; exit 1 ; fi;;
|
||||
"--unplug"|"-u") if in_range "$2" $mnu $mxu; then unplug_charger_threshold=$2 ; shift 2 ; else echo "$1 ERROR: Unplug Threshold must be $mnu $mxu." >&2 ; exit 1 ; fi;;
|
||||
"--timer"|"-t") if in_range "$2" $mnt $mxt; then timer=$2 ; shift 2 ; else echo "$1 ERROR: Timer must be $mnt - $mxt." >&2 ; exit 1 ; fi;;
|
||||
"--notify"|"-n") if in_range "$2" $mnn $mxn; then notify=$2 ; shift 2 ; else echo "$1 ERROR: Notify must be $mnn - $mxn in minutes." >&2 ; exit 1 ; fi;;
|
||||
"--interval"|"-i") if in_range "$2" $mni $mxi; then interval=$2 ; shift 2 ; else echo "$1 ERROR: Interval must be by $mni% - $mxi% intervals." >&2 ; exit 1 ; fi;;
|
||||
"--verbose"|"-v") verbose=true ; shift ;;
|
||||
"--undock"|"on") undock=true ; shift ;;
|
||||
"--execute"|"-e") execute=$2 ; shift 2 ;;
|
||||
|
||||
*|"--help"|"-h")
|
||||
echo "Usage: $0 [options]"
|
||||
echo " --verbose, -v Verbose Mode"
|
||||
echo " --undock, on Shows Battery Plug In/Out/Full Notification"
|
||||
echo " --full, -f Set battery full threshold (default: 100% percent)"
|
||||
echo " --critical, -c Set battery critical threshold (default: 10% percent)"
|
||||
echo " --low, -l Set battery low threshold (default: 20% percent)"
|
||||
echo " --unplug, -u Set unplug charger threshold (default: 80% percent )"
|
||||
echo " --timer, -t Set countdown timer (default: 120 seconds)"
|
||||
echo " --interval, -i Set notify interval on LOW UNPLUG Status (default: 5% percent)"
|
||||
echo " --notify, -n Set notify interval for Battery Full Status (default: 1140 mins/ 1 day)"
|
||||
echo " --execute, -e Set command/script to execute if battery on critical threshold (default: systemctl suspend)"
|
||||
echo " --help, -h Show this help message
|
||||
Visit https://github.com/prasanthrangan/hyprdots for the Github Repo"
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
done
|
||||
is_laptop() { # Check if the system is a laptop
|
||||
if grep -q "Battery" /sys/class/power_supply/BAT*/type; then
|
||||
return 0 # It's a laptop
|
||||
else
|
||||
echo "Cannot Detect a Battery. If this seems an error please report an issue to https://github.com/prasanthrangan/hyprdots."
|
||||
exit 0 # It's not a laptop
|
||||
fi
|
||||
}
|
||||
fn_verbose () {
|
||||
if $verbose; then
|
||||
cat << VERBOSE
|
||||
=============================================
|
||||
Battery Status: $battery_status
|
||||
Battery Percentage: $battery_percentage
|
||||
=============================================
|
||||
|
||||
|
||||
VERBOSE
|
||||
fi
|
||||
}
|
||||
fn_notify () { # Send notification
|
||||
|
||||
notify-send -a "Power" $1 -u $2 "$3" "$4" -p # Call the notify-send command with the provided arguments \$1 is the flags \$2 is the urgency \$3 is the title \$4 is the message
|
||||
}
|
||||
fn_percentage () {
|
||||
if [[ "$battery_percentage" -ge "$unplug_charger_threshold" ]] && [[ "$battery_status" != "Discharging" ]] && [[ "$battery_status" != "Full" ]] && (( (battery_percentage - last_notified_percentage) >= $interval )); then if $verbose; then echo "Prompt:UNPLUG: $battery_unplug_threshold $battery_status $battery_percentage" ; fi
|
||||
fn_notify "-t 5000 " "CRITICAL" "Battery Charged" "Battery is at $battery_percentage%. You can unplug the charger!"
|
||||
last_notified_percentage=$battery_percentage
|
||||
elif [[ "$battery_percentage" -le "$battery_critical_threshold" ]]; then
|
||||
count=$(( timer > $mnt ? timer : $mnt )) # reset count
|
||||
while [ $count -gt 0 ] && [[ $battery_status == "Discharging"* ]]; do
|
||||
for battery in /sys/class/power_supply/BAT*; do battery_status=$(< "$battery/status") ; done
|
||||
if [[ $battery_status != "Discharging" ]] ; then break ; fi
|
||||
fn_notify "-t 5000 -r 69 " "CRITICAL" "Battery Critically Low" "$battery_percentage% is critically low. Device will execute $execute in $((count/60)):$((count%60)) ."
|
||||
count=$((count-1))
|
||||
sleep 1
|
||||
done
|
||||
[ $count -eq 0 ] && fn_action
|
||||
elif [[ "$battery_percentage" -le "$battery_low_threshold" ]] && [[ "$battery_status" == "Discharging" ]] && (( (last_notified_percentage - battery_percentage) >= $interval )); then if $verbose; then echo "Prompt:LOW: $battery_low_threshold $battery_status $battery_percentage" ; fi
|
||||
fn_notify "-t 5000 " "CRITICAL" "Battery Low" "Battery is at $battery_percentage%. Connect the charger."
|
||||
last_notified_percentage=$battery_percentage
|
||||
fi
|
||||
}
|
||||
fn_action () { #handles the $execute command
|
||||
count=$(( timer > $mnt ? timer : $mnt )) # reset count
|
||||
nohup $execute
|
||||
}
|
||||
|
||||
fn_status () {
|
||||
if [[ $battery_percentage -ge $battery_full_threshold ]] && [ "$battery_status" == *"Charging"* ]; then echo "Full and $battery_status"
|
||||
battery_status="Full" ;fi
|
||||
case "$battery_status" in # Handle the power supply status
|
||||
"Discharging") if $verbose; then echo "Case:$battery_status Level: $battery_percentage" ;fi
|
||||
if [[ "$prev_status" != "Discharging" ]] || [[ "$prev_status" == "Full" ]] ; then
|
||||
prev_status=$battery_status
|
||||
urgency=$([[ $battery_percentage -le "$battery_low_threshold" ]] && echo "CRITICAL" || echo "NORMAL")
|
||||
fn_notify "-t 5000 -r 54321 " "$urgency" "Charger Plug OUT" "Battery is at $battery_percentage%."
|
||||
fi
|
||||
fn_percentage
|
||||
;;
|
||||
"Not"*|"Charging") if $verbose; then echo "Case:$battery_status Level: $battery_percentage" ;fi
|
||||
# Due to modifications of some devices Not Charging after reaching 99 or limits
|
||||
#if [[ ! -f "/tmp/hyprdots.batterynotify.status.$battery_status-$$" ]] && [[ "$battery_status" == "Not"* ]] ; then
|
||||
#touch "/tmp/hyprdots.batterynotify.status.$battery_status-$$"
|
||||
#count=$(( timer > $mnt ? timer : $mnt )) # reset count
|
||||
#echo "Status: '==>> "$battery_status" <<==' Device Reports Not Charging!,This may be device Specific errors."
|
||||
#fn_notify "-t 5000 " "CRITICAL" "Charger Plug In" "Battery is at $battery_percentage%."
|
||||
#fi
|
||||
if [[ "$prev_status" == "Discharging" ]] || [[ "$prev_status" == "Not"* ]] ; then
|
||||
prev_status=$battery_status
|
||||
count=$(( timer > $mnt ? timer : $mnt )) # reset count
|
||||
urgency=$([[ "$battery_percentage" -ge $unplug_charger_threshold ]] && echo "CRITICAL" || echo "NORMAL")
|
||||
fn_notify "-t 5000 -r 54321 " "$urgency" "Charger Plug In" "Battery is at $battery_percentage%."
|
||||
fi
|
||||
fn_percentage
|
||||
;;
|
||||
"Full") if $verbose; then echo "Case:$battery_status Level: $battery_percentage" ;fi
|
||||
|
||||
if [[ $battery_status != "Discharging" ]]; then
|
||||
now=$(date +%s)
|
||||
if [[ "$prev_status" == *"harging"* ]] || ((now - lt >= $((notify*60)) )); then
|
||||
fn_notify "-t 5000 -r 54321" "CRITICAL" "Battery Full" "Please unplug your Charger"
|
||||
prev_status=$battery_status lt=$now
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
if [[ ! -f "/tmp/hyprdots.batterynotify.status.fallback.$battery_status-$$" ]]; then
|
||||
echo "Status: '==>> "$battery_status" <<==' Script on Fallback mode,Unknown power supply status.Please copy this line and raise an issue to the Github Repo.Also run 'ls /tmp/hyprdots.batterynotify' to see the list of lock files.*"
|
||||
touch "/tmp/hyprdots.batterynotify.status.fallback.$battery_status-$$"
|
||||
fi
|
||||
fn_percentage
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
fn_status_change () { # Handle when status changes
|
||||
for battery in /sys/class/power_supply/BAT*; do battery_status=$(< "$battery/status") battery_percentage=$(< "$battery/capacity")
|
||||
if [ "$battery_status" != "$last_battery_status" ] || [ "$battery_percentage" != "$last_battery_percentage" ]; then last_battery_status=$battery_status last_battery_percentage=$battery_percentage # Check if battery status or percentage has changed
|
||||
fn_verbose
|
||||
fn_percentage
|
||||
if $undock; then fn_status echo yes ; fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
resume_processes() { for pid in $pids ; do if [ $pid -ne $current_pid ] ; then kill -CONT $pid ; notify-send -a "Battery Notify" -t 2000 -r 9889 -u "CRITICAL" "Debugging ENDED, Resuming Regular Process" ; fi ; done }
|
||||
main() { # Main function
|
||||
if is_laptop; then
|
||||
rm -fr /tmp/hyprdots.batterynotify* # Cleaning the lock file
|
||||
battery_full_threshold=${battery_full_threshold:-100}
|
||||
battery_critical_threshold=${battery_critical_threshold:-10}
|
||||
unplug_charger_threshold=${unplug_charger_threshold:-80}
|
||||
battery_low_threshold=${battery_low_threshold:-20}
|
||||
timer=${timer:-120}
|
||||
notify=${notify:-1140}
|
||||
interval=${interval:-5}
|
||||
|
||||
execute=${execute:-"systemctl suspend"}
|
||||
cat << EOF
|
||||
Script is running...
|
||||
Check $0 --help for options.
|
||||
|
||||
STATUS THRESHOLD INTERVAL
|
||||
Full $battery_full_threshold $notify Minutes
|
||||
Critical $battery_critical_threshold $timer Seconds then "$execute"
|
||||
Low $battery_low_threshold $interval Percent
|
||||
Unplug $unplug_charger_threshold $interval Percent
|
||||
|
||||
|
||||
EOF
|
||||
if $verbose; then for line in "Verbose Mode is ON..." "" "" "" "" ; do echo $line ; done;
|
||||
current_pid=$$
|
||||
pids=$(pgrep -f "/bin/bash $HOME/.config/hypr/scripts/batterynotify.sh" )
|
||||
for pid in $pids ; do if [ $pid -ne $current_pid ] ;then kill -STOP $pid ;notify-send -a "Battery Notify" -t 2000 -r 9889 -u "CRITICAL" "Debugging STARTED, Pausing Regular Process" ;fi ; done ; trap resume_processes SIGINT ; fi
|
||||
fn_status_change # initiate the function
|
||||
last_notified_percentage=$battery_percentage
|
||||
prev_status=$battery_status
|
||||
|
||||
dbus-monitor --system "type='signal',interface='org.freedesktop.DBus.Properties',path='$(upower -e | grep battery)'" 2> /dev/null | while read -r battery_status_change; do fn_status_change ; done
|
||||
fi
|
||||
}
|
||||
main
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
CONFIG=$(rofi -show file-browser-extended -file-browser-stdout -file-browser-dir "$HOME"/.config/keyb/bindings -config ~/.config/rofi/keybinds.rasi)
|
||||
|
||||
hyprctl dispatch exec "[float;size 45% 80%;center 1] kitty keyb -k '$CONFIG'"
|
||||
@@ -1,8 +1,8 @@
|
||||
#! /usr/bin/env bash
|
||||
|
||||
# Control moosic using keyboard
|
||||
# Control music using keyboard
|
||||
|
||||
|
||||
# SUPER + M should open a submap
|
||||
# M should open the rofi-music menu
|
||||
# i should increase volume
|
||||
# u should decrease volume
|
||||
|
||||
@@ -1,18 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
defaultDir="$HOME/.config/hypr/configs"
|
||||
userDir="$HOME/.config/hypr/UserConfigs"
|
||||
userDir="$HOME/.config/hypr/configs"
|
||||
|
||||
|
||||
menu(){
|
||||
printf "1. view Env-variables\n"
|
||||
printf "2. view Window-Rules\n"
|
||||
printf "3. view Startup_Apps\n"
|
||||
printf "4. view User-Keybinds\n"
|
||||
printf "4. view Keybinds\n"
|
||||
printf "5. view Monitors\n"
|
||||
printf "6. view Laptop-Keybinds\n"
|
||||
printf "7. view User-Settings\n"
|
||||
printf "8. view Default-Settings\n"
|
||||
printf "9. view Default-Keybinds\n"
|
||||
printf "7. view Settings\n"
|
||||
}
|
||||
|
||||
main() {
|
||||
@@ -28,7 +26,7 @@ main() {
|
||||
kitty -e nano "$userDir/Startup_Apps.conf"
|
||||
;;
|
||||
4)
|
||||
kitty -e nano "$userDir/UserKeybinds.conf"
|
||||
kitty -e nano "$userDir/Keybinds.conf"
|
||||
;;
|
||||
5)
|
||||
kitty -e nano "$userDir/Monitors.conf"
|
||||
@@ -37,14 +35,9 @@ main() {
|
||||
kitty -e nano "$userDir/Laptops.conf"
|
||||
;;
|
||||
7)
|
||||
kitty -e nano "$userDir/UserSettings.conf"
|
||||
;;
|
||||
8)
|
||||
kitty -e nano "$defaultDir/Settings.conf"
|
||||
;;
|
||||
9)
|
||||
kitty -e nano "$defaultDir/Keybinds.conf"
|
||||
kitty -e nano "$userDir/Settings.conf"
|
||||
;;
|
||||
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -1,98 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
|
||||
# Import Theme
|
||||
theme="$HOME/.config/rofi/config-quicklink.rasi"
|
||||
|
||||
# Theme Elements
|
||||
prompt="Quick Links: Using '$BROWSER' as web browser"
|
||||
|
||||
# Check if the theme variable is not empty
|
||||
if [ -n "$theme" ]; then
|
||||
list_col='6'
|
||||
list_row='1'
|
||||
fi
|
||||
|
||||
# Options
|
||||
if [ -z "$BROWSER" ]; then
|
||||
BROWSER="firefox" # Set your default browser here
|
||||
prompt="Quick Links: Using '$BROWSER' as web browser"
|
||||
else
|
||||
prompt="Quick Links: Using '$BROWSER' as web browser"
|
||||
fi
|
||||
|
||||
layout=$(grep 'USE_ICON' "$theme" | cut -d'=' -f2)
|
||||
if [ "$layout" == 'NO' ]; then
|
||||
option_1=" Google"
|
||||
option_2=" Gmail"
|
||||
option_3=" Youtube"
|
||||
option_4=" Github"
|
||||
option_5=" Reddit"
|
||||
option_6=" Facebook"
|
||||
else
|
||||
option_1=""
|
||||
option_2=""
|
||||
option_3=""
|
||||
option_4=""
|
||||
option_5=""
|
||||
option_6=""
|
||||
fi
|
||||
|
||||
# Define the font variable
|
||||
efonts="Fira Code SemiBold 28"
|
||||
|
||||
# Rofi CMD
|
||||
rofi_cmd() {
|
||||
rofi -theme-str "listview {columns: $list_col; lines: $list_row;}" \
|
||||
-theme-str 'textbox-prompt-colon {str: "";}' \
|
||||
-theme-str "element-text {font: \"$efonts\";}" \
|
||||
-dmenu \
|
||||
-p "$prompt" \
|
||||
-markup-rows \
|
||||
-theme "$theme"
|
||||
}
|
||||
|
||||
# Pass variables to rofi dmenu
|
||||
run_rofi() {
|
||||
echo -e "$option_1\n$option_2\n$option_3\n$option_4\n$option_5\n$option_6" | rofi_cmd
|
||||
}
|
||||
|
||||
# Execute Command
|
||||
run_cmd() {
|
||||
if [ "$1" == '--opt1' ]; then
|
||||
xdg-open 'https://www.google.com/'
|
||||
elif [ "$1" == '--opt2' ]; then
|
||||
xdg-open 'https://mail.google.com/'
|
||||
elif [ "$1" == '--opt3' ]; then
|
||||
xdg-open 'https://www.youtube.com/'
|
||||
elif [ "$1" == '--opt4' ]; then
|
||||
xdg-open 'https://www.github.com/'
|
||||
elif [ "$1" == '--opt5' ]; then
|
||||
xdg-open 'https://www.reddit.com/'
|
||||
elif [ "$1" == '--opt6' ]; then
|
||||
xdg-open 'https://www.facebook.com/'
|
||||
fi
|
||||
}
|
||||
|
||||
# Actions
|
||||
chosen="$(run_rofi)"
|
||||
case $chosen in
|
||||
$option_1)
|
||||
run_cmd --opt1
|
||||
;;
|
||||
$option_2)
|
||||
run_cmd --opt2
|
||||
;;
|
||||
$option_3)
|
||||
run_cmd --opt3
|
||||
;;
|
||||
$option_4)
|
||||
run_cmd --opt4
|
||||
;;
|
||||
$option_5)
|
||||
run_cmd --opt5
|
||||
;;
|
||||
$option_6)
|
||||
run_cmd --opt6
|
||||
;;
|
||||
esac
|
||||
Executable
+10
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
function random_hex() {
|
||||
random_hex=("0xff$(openssl rand -hex 3)")
|
||||
echo $random_hex
|
||||
}
|
||||
|
||||
hyprctl keyword general:col.active_border $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) 270deg
|
||||
|
||||
hyprctl keyword general:col.inactive_border $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) 270deg
|
||||
Executable
+48
@@ -0,0 +1,48 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Directory for icons
|
||||
iDIR="$HOME/.config/swaync/icons"
|
||||
|
||||
# Note: You can add more options below with the following format:
|
||||
# ["TITLE"]="link"
|
||||
|
||||
# Define menu options as an associative array
|
||||
declare -A menu_options=(
|
||||
["Lofi Girl ☕️🎶"]="https://play.streamafrica.net/lofiradio"
|
||||
["96.3 Easy Rock 📻🎶"]="https://radio-stations-philippines.com/easy-rock"
|
||||
["Ghibli Music 🎻🎶"]="https://youtube.com/playlist?list=PLNi74S754EXbrzw-IzVhpeAaMISNrzfUy&si=rqnXCZU5xoFhxfOl"
|
||||
["Top Youtube Music 2023 ☕️🎶"]="https://youtube.com/playlist?list=PLDIoUOhQQPlXr63I_vwF9GD8sAKh77dWU&si=y7qNeEVFNgA-XxKy"
|
||||
["Chillhop ☕️🎶"]="http://stream.zeno.fm/fyn8eh3h5f8uv"
|
||||
["SmoothChill ☕️🎶"]="https://media-ssl.musicradio.com/SmoothChill"
|
||||
["Relaxing Music ☕️🎶"]="https://youtube.com/playlist?list=PLMIbmfP_9vb8BCxRoraJpoo4q1yMFg4CE"
|
||||
["Youtube Remix 📻🎶"]="https://youtube.com/playlist?list=PLeqTkIUlrZXlSNn3tcXAa-zbo95j0iN-0"
|
||||
["Korean Drama OST 📻🎶"]="https://youtube.com/playlist?list=PLUge_o9AIFp4HuA-A3e3ZqENh63LuRRlQ"
|
||||
)
|
||||
|
||||
# Function for displaying notifications
|
||||
notification() {
|
||||
notify-send -u normal -i "$iDIR/music.png" "Playing now: $@"
|
||||
}
|
||||
|
||||
# Main function
|
||||
main() {
|
||||
choice=$(printf "%s\n" "${!menu_options[@]}" | rofi -dmenu -config ~/.config/rofi/config-rofi-music.rasi -i -p "")
|
||||
|
||||
if [ -z "$choice" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
link="${menu_options[$choice]}"
|
||||
|
||||
notification "$choice"
|
||||
|
||||
# Check if the link is a playlist
|
||||
if [[ $link == *playlist* ]]; then
|
||||
mpv --shuffle --vid=no "$link"
|
||||
else
|
||||
mpv "$link"
|
||||
fi
|
||||
}
|
||||
|
||||
# Check if an online music process is running and send a notification, otherwise run the main function
|
||||
pkill -f http && notify-send -u low -i "$iDIR/music.png" "Online Music stopped" || main
|
||||
@@ -36,19 +36,19 @@ function music() {
|
||||
|
||||
if [[ "$chosen" == "$play_bhajan" ]]; then
|
||||
notify "Playing Bhajan"
|
||||
exec -a "rofi-music" mpv --no-video $BHAJAN
|
||||
exec -a "rofi-music" mpv --no-video "$BHAJAN" --shuffle --no-resume-playback
|
||||
elif [[ "$chosen" == "$play_lofi" ]]; then
|
||||
notify "🎹 Playing lofi girl"
|
||||
exec -a "rofi-music" mpv --no-video $LOFI_STREAM
|
||||
exec -a "rofi-music" mpv --no-video "$LOFI_STREAM" --no-resume-playback
|
||||
elif [[ "$chosen" == "$play_chill_hits" ]]; then
|
||||
notify "🎹 Playing all time chill hits"
|
||||
exec -a "rofi-music" mpv --no-video "$ALL_TIME_CHILL_HITS" --shuffle
|
||||
exec -a "rofi-music" mpv --no-video "$ALL_TIME_CHILL_HITS" --shuffle --no-resume-playback
|
||||
elif [[ "$chosen" == "$play_malayalam_hits" ]]; then
|
||||
notify "🎹 Playing malayalam hits"
|
||||
exec -a "rofi-music" mpv --no-video "$ALL_TIME_MALAYALAM_HITS" --shuffle
|
||||
exec -a "rofi-music" mpv --no-video "$ALL_TIME_MALAYALAM_HITS" --shuffle --no-resume-playback
|
||||
elif [[ "$chosen" == "$play_hand_picked_hits" ]]; then
|
||||
notify "🎹 Playing hand picked hits"
|
||||
exec -a "rofi-music" mpv --no-video "$HAND_PICKED_HITS" --shuffle
|
||||
exec -a "rofi-music" mpv --no-video "$HAND_PICKED_HITS" --shuffle --no-resume-playback
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
Executable
+2
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
wlsunset -t 4000 -T 6500 -d 900 -S 07:00 -s 19:00
|
||||
@@ -1,57 +1,86 @@
|
||||
#!/bin/bash
|
||||
|
||||
WALLPAPERS_DIR="$HOME/Pictures/wallpapers/"
|
||||
SCRIPTSDIR="$HOME/.config/hypr/scripts"
|
||||
|
||||
# find image size to display (very slow)
|
||||
#echo $(identify -format '%[fx:w]x%[fx:h]\' $HOME/Pictures/wallpapers/$A 2>/dev/null)
|
||||
# WALLPAPERS PATH
|
||||
DIR="$HOME/Pictures/wallpapers"
|
||||
|
||||
build_theme() {
|
||||
rows=$1
|
||||
cols=$2
|
||||
icon_size=$3
|
||||
# Transition config
|
||||
FPS=30
|
||||
TYPE="wipe"
|
||||
DURATION=1
|
||||
BEZIER=".43,1.19,1,.4"
|
||||
SWWW_PARAMS="--transition-fps $FPS --transition-type $TYPE --transition-duration $DURATION"
|
||||
|
||||
echo "element{orientation:vertical;}element-text{horizontal-align:0.5;}element-icon{size:$icon_size.0000em;}listview{lines:$rows;columns:$cols;}"
|
||||
}
|
||||
|
||||
theme="$HOME/.config/rofi/config-wallpaper.rasi"
|
||||
|
||||
ROFI_CMD="rofi -dmenu -i -show-icons -theme-str $(build_theme 3 5 6) -theme ${theme}"
|
||||
|
||||
choice=$(ls --escape "$WALLPAPERS_DIR" | xargs -I {} printf "{}\x00icon\x1f$WALLPAPERS_DIR/{}\n" | $ROFI_CMD -p " Wallpaper")
|
||||
|
||||
wallpaper="$WALLPAPERS_DIR/$choice"
|
||||
|
||||
set_wallpaper_kde() {
|
||||
qdbus org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.evaluateScript \
|
||||
"var allDesktops = desktops(); for (i=0;i<allDesktops.length;i++) {d = allDesktops[i];d.wallpaperPlugin = \"org.kde.image\";d.currentConfigGroup = Array(\"Wallpaper\", \"org.kde.image\", \"General\");d.writeConfig(\"Image\", \"file:$1\")}"
|
||||
notify-send "Wallpaper Changed" -i "$1"
|
||||
}
|
||||
|
||||
set_wallpaper_gnome() {
|
||||
gsettings set org.gnome.desktop.background picture-uri "file://$1"
|
||||
gsettings set org.gnome.desktop.background picture-uri-dark "file://$1"
|
||||
notify-send "Wallpaper Changed" -i "$1"
|
||||
}
|
||||
|
||||
set_wallpaper_sway() {
|
||||
swaymsg output "*" bg "$1" "stretch"
|
||||
notify-send "Wallpaper Changed" -i "$1"
|
||||
}
|
||||
|
||||
set_wallpaper_default() {
|
||||
swww img -t any --transition-bezier 0,.53,1,.48 --transition-duration 1 --transition-fps 60 "$1" &&
|
||||
ln -sf "$1" "$HOME/.config/hypr/.current_wallpaper"
|
||||
notify-send "Wallpaper Changed" -i "$1"
|
||||
}
|
||||
|
||||
if [ -n "$choice" ]; then
|
||||
case "$XDG_CURRENT_DESKTOP" in
|
||||
"KDE") set_wallpaper_kde "$wallpaper" ;;
|
||||
"GNOME") set_wallpaper_gnome "$wallpaper" ;;
|
||||
"sway") set_wallpaper_sway "$wallpaper" ;;
|
||||
*) set_wallpaper_default "$wallpaper" ;;
|
||||
esac
|
||||
exit 0
|
||||
# Check if swaybg is running
|
||||
if pidof swaybg > /dev/null; then
|
||||
pkill swaybg
|
||||
fi
|
||||
|
||||
exit 1
|
||||
# Retrieve image files
|
||||
PICS=($(ls "${DIR}" | grep -E ".jpg$|.jpeg$|.png$|.gif$"))
|
||||
RANDOM_PIC="${PICS[$((RANDOM % ${#PICS[@]}))]}"
|
||||
RANDOM_PIC_NAME="${#PICS[@]}. random"
|
||||
|
||||
# Rofi command
|
||||
rofi_command="rofi -show -dmenu -config ~/.config/rofi/config-wallpaper.rasi"
|
||||
|
||||
menu() {
|
||||
for i in "${!PICS[@]}"; do
|
||||
# Displaying .gif to indicate animated images
|
||||
if [[ -z $(echo "${PICS[$i]}" | grep .gif$) ]]; then
|
||||
printf "$(echo "${PICS[$i]}" | cut -d. -f1)\x00icon\x1f${DIR}/${PICS[$i]}\n"
|
||||
else
|
||||
printf "${PICS[$i]}\n"
|
||||
fi
|
||||
done
|
||||
|
||||
printf "$RANDOM_PIC_NAME\n"
|
||||
}
|
||||
|
||||
swww query || swww init
|
||||
|
||||
main() {
|
||||
choice=$(menu | ${rofi_command})
|
||||
|
||||
# No choice case
|
||||
if [[ -z $choice ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Random choice case
|
||||
if [ "$choice" = "$RANDOM_PIC_NAME" ]; then
|
||||
swww img "${DIR}/${RANDOM_PIC}" $SWWW_PARAMS
|
||||
|
||||
# Create symbolic link
|
||||
ln -sf "${DIR}/${RANDOM_PIC}" "$HOME/.config/hypr/.current_wallpaper"
|
||||
|
||||
notify-send "Wallpaper Changed" -i "${DIR}/${RANDOM_PIC}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Find the index of the selected file
|
||||
pic_index=-1
|
||||
for i in "${!PICS[@]}"; do
|
||||
filename=$(basename "${PICS[$i]}")
|
||||
if [[ "$filename" == "$choice"* ]]; then
|
||||
pic_index=$i
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ $pic_index -ne -1 ]]; then
|
||||
swww img "${DIR}/${PICS[$pic_index]}" $SWWW_PARAMS
|
||||
|
||||
# Create symbolic link
|
||||
ln -sf "${DIR}/${PICS[$pic_index]}" "$HOME/.config/hypr/.current_wallpaper"
|
||||
|
||||
notify-send "Wallpaper Changed" -i "${DIR}/${PICS[$pic_index]}"
|
||||
else
|
||||
notify-send "Wallpaper Changed" -i "Image not found."
|
||||
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
main
|
||||
|
||||
Executable
+29
@@ -0,0 +1,29 @@
|
||||
# #! /bin/bash
|
||||
|
||||
#----- Optimized bars animation without much CPU usage increase --------
|
||||
bar="▁▂▃▄▅▆▇█"
|
||||
dict="s/;//g"
|
||||
|
||||
# Calculate the length of the bar outside the loop
|
||||
bar_length=${#bar}
|
||||
|
||||
# Create dictionary to replace char with bar
|
||||
for ((i = 0; i < bar_length; i++)); do
|
||||
dict+=";s/$i/${bar:$i:1}/g"
|
||||
done
|
||||
|
||||
# Create cava config
|
||||
config_file="/tmp/bar_cava_config"
|
||||
cat >"$config_file" <<EOF
|
||||
[general]
|
||||
bars = 10
|
||||
|
||||
[output]
|
||||
method = raw
|
||||
raw_target = /dev/stdout
|
||||
data_format = ascii
|
||||
ascii_max_range = 7
|
||||
EOF
|
||||
|
||||
# Read stdout from cava and perform substitution in a single sed command
|
||||
cava -p "$config_file" | sed -u "$dict"
|
||||
Executable
+62
@@ -0,0 +1,62 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
# Define directories
|
||||
config_dir="$HOME/.config/waybar/configs"
|
||||
waybar_config="$HOME/.config/waybar/config"
|
||||
scripts_dir="$HOME/.config/hypr/scripts"
|
||||
rofi_config="$HOME/.config/rofi/config-waybar-layout.rasi"
|
||||
|
||||
# Function to display menu options
|
||||
menu() {
|
||||
options=()
|
||||
while IFS= read -r file; do
|
||||
options+=("$(basename "$file")")
|
||||
done < <(find "$config_dir" -maxdepth 1 -type f -exec basename {} \; | sort)
|
||||
|
||||
printf '%s\n' "${options[@]}"
|
||||
}
|
||||
|
||||
# Apply selected configuration
|
||||
apply_config() {
|
||||
ln -sf "$config_dir/$1" "$waybar_config"
|
||||
restart_waybar_if_needed
|
||||
}
|
||||
|
||||
# Restart Waybar
|
||||
restart_waybar_if_needed() {
|
||||
if pgrep -x "waybar" >/dev/null; then
|
||||
pkill waybar
|
||||
sleep 0.1 # Delay for Waybar to completely terminate
|
||||
fi
|
||||
"${scripts_dir}/Refresh.sh" &
|
||||
}
|
||||
|
||||
# Main function
|
||||
main() {
|
||||
choice=$(menu | rofi -dmenu -config "$rofi_config")
|
||||
|
||||
if [[ -z "$choice" ]]; then
|
||||
echo "No option selected. Exiting."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
case $choice in
|
||||
"no panel")
|
||||
pgrep -x "waybar" && pkill waybar || true
|
||||
;;
|
||||
*)
|
||||
apply_config "$choice"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Kill Rofi if already running before execution
|
||||
if pgrep -x "rofi" >/dev/null; then
|
||||
pkill rofi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
main
|
||||
Executable
+121
@@ -0,0 +1,121 @@
|
||||
#!/usr/bin/env python3
|
||||
# From https://raw.githubusercontent.com/rxyhn/dotfiles/main/home/rxyhn/modules/desktop/waybar/scripts/waybar-wttr.py
|
||||
|
||||
## ensure to insert city inside ""
|
||||
import json
|
||||
import requests
|
||||
from datetime import datetime
|
||||
|
||||
WEATHER_CODES = {
|
||||
'113': ' ',
|
||||
'116': ' ',
|
||||
'119': ' ',
|
||||
'122': ' ',
|
||||
'143': ' ',
|
||||
'176': ' ',
|
||||
'179': ' ',
|
||||
'182': ' ',
|
||||
'185': ' ',
|
||||
'200': '⛈️',
|
||||
'227': '🌨️',
|
||||
'230': '🌨️',
|
||||
'248': '☁️',
|
||||
'260': '☁️',
|
||||
'263': '🌧️',
|
||||
'266': '🌧️',
|
||||
'281': '🌧️',
|
||||
'284': '🌧️',
|
||||
'293': '🌧️',
|
||||
'296': '🌧️',
|
||||
'299': '🌧️',
|
||||
'302': '🌧️',
|
||||
'305': '🌧️',
|
||||
'308': '🌧️',
|
||||
'311': '🌧️',
|
||||
'314': '🌧️',
|
||||
'317': '🌧️',
|
||||
'320': '🌨️',
|
||||
'323': '🌨️',
|
||||
'326': '🌨️',
|
||||
'329': '❄️',
|
||||
'332': '❄️',
|
||||
'335': '❄️',
|
||||
'338': '❄️',
|
||||
'350': '🌧️',
|
||||
'353': '🌧️',
|
||||
'356': '🌧️',
|
||||
'359': '🌧️',
|
||||
'362': '🌧️',
|
||||
'365': '🌧️',
|
||||
'368': '🌧️',
|
||||
'371': '❄️',
|
||||
'374': '🌨️',
|
||||
'377': '🌨️',
|
||||
'386': '🌨️',
|
||||
'389': '🌨️',
|
||||
'392': '🌧️',
|
||||
'395': '❄️'
|
||||
}
|
||||
|
||||
data = {}
|
||||
|
||||
|
||||
weather = requests.get("https://wttr.in/Kohalpur?format=j1").json()
|
||||
|
||||
|
||||
def format_time(time):
|
||||
return time.replace("00", "").zfill(2)
|
||||
|
||||
|
||||
def format_temp(temp):
|
||||
return (hour['FeelsLikeC']+"°").ljust(3)
|
||||
|
||||
|
||||
def format_chances(hour):
|
||||
chances = {
|
||||
"chanceoffog": "Fog",
|
||||
"chanceoffrost": "Frost",
|
||||
"chanceofovercast": "Overcast",
|
||||
"chanceofrain": "Rain",
|
||||
"chanceofsnow": "Snow",
|
||||
"chanceofsunshine": "Sunshine",
|
||||
"chanceofthunder": "Thunder",
|
||||
"chanceofwindy": "Wind"
|
||||
}
|
||||
|
||||
conditions = []
|
||||
for event in chances.keys():
|
||||
if int(hour[event]) > 0:
|
||||
conditions.append(chances[event]+" "+hour[event]+"%")
|
||||
return ", ".join(conditions)
|
||||
|
||||
tempint = int(weather['current_condition'][0]['FeelsLikeC'])
|
||||
extrachar = ''
|
||||
if tempint > 0 and tempint < 10:
|
||||
extrachar = '+'
|
||||
|
||||
|
||||
data['text'] = ' '+WEATHER_CODES[weather['current_condition'][0]['weatherCode']] + \
|
||||
" "+extrachar+weather['current_condition'][0]['FeelsLikeC']+"°"
|
||||
|
||||
data['tooltip'] = f"<b>{weather['current_condition'][0]['weatherDesc'][0]['value']} {weather['current_condition'][0]['temp_C']}°</b>\n"
|
||||
data['tooltip'] += f"Feels like: {weather['current_condition'][0]['FeelsLikeC']}°\n"
|
||||
data['tooltip'] += f"Wind: {weather['current_condition'][0]['windspeedKmph']}Km/h\n"
|
||||
data['tooltip'] += f"Humidity: {weather['current_condition'][0]['humidity']}%\n"
|
||||
for i, day in enumerate(weather['weather']):
|
||||
data['tooltip'] += f"\n<b>"
|
||||
if i == 0:
|
||||
data['tooltip'] += "Today, "
|
||||
if i == 1:
|
||||
data['tooltip'] += "Tomorrow, "
|
||||
data['tooltip'] += f"{day['date']}</b>\n"
|
||||
data['tooltip'] += f"⬆️{day['maxtempC']}° ⬇️{day['mintempC']}° "
|
||||
data['tooltip'] += f"🌅{day['astronomy'][0]['sunrise']} 🌇{day['astronomy'][0]['sunset']}\n"
|
||||
for hour in day['hourly']:
|
||||
if i == 0:
|
||||
if int(format_time(hour['time'])) < datetime.now().hour-2:
|
||||
continue
|
||||
data['tooltip'] += f"{format_time(hour['time'])} {WEATHER_CODES[hour['weatherCode']]} {format_temp(hour['FeelsLikeC'])} {hour['weatherDesc'][0]['value']}, {format_chances(hour)}\n"
|
||||
|
||||
|
||||
print(json.dumps(data))
|
||||
Reference in new issue
Block a user