Updates
This commit is contained in:
1 parent
60741ca7d2
commit
96b0b70cbe
11 files changed
+263
-378
No files matched your search
@@ -1,73 +1,112 @@
|
||||
#!/bin/bash
|
||||
|
||||
######################################
|
||||
# #
|
||||
# Music #
|
||||
# #
|
||||
# #
|
||||
# Music #
|
||||
# #
|
||||
######################################
|
||||
|
||||
music(){
|
||||
|
||||
# Directory local music folder
|
||||
mDIR="$HOME/Music/"
|
||||
|
||||
# Directory for icons
|
||||
iDIR="$HOME/dotfiles/hypr/assets"
|
||||
|
||||
# Note: You can add more options below with the following format:
|
||||
# ["TITLE"]="link"
|
||||
# Online Stations. Edit as required
|
||||
declare -A online_music=(
|
||||
["ʙʜᴀᴊᴀɴ 🚩"]="https://youtube.com/playlist?list=PLwIh-QEhrDJDM8IF3gLUgnEyZm6dBgr_n&si=_RDHngYobHlcxaJW"
|
||||
["ʟᴏꜰɪ ɢɪʀʟ 📻🎶"]="https://www.youtube.com/watch?v=jfKfPfyJRdk"
|
||||
["ɴᴇᴘᴀʟɪ ᴏʟᴅ ꜱᴏɴɢ 📻🎶"]="https://youtube.com/playlist?list=PLXuVG9D9JQ8RAhpH2TyISgBgEmXONIhGY&si=SLyxb2vxaE0XuXsz"
|
||||
["ʙᴏʟʟʏᴡᴏᴏᴅ 📻🎶"]="https://youtube.com/playlist?list=PL9bw4S5ePsEEqCMJSiYZ-KTtEjzVy0YvK&si=J0gPvKL4R4fIlPz9"
|
||||
["ᴛᴏᴘ 50 ʙᴏʟʟʏᴡᴏᴏᴅ 📻🎶"]="https://youtube.com/playlist?list=PLHuHXHyLu7BEnMJNeVvkXpxapvDSp5UdI&si=-TBeeNJ28NqVcnKu"
|
||||
["ʜɪɴᴅɪ ᴅᴊ 🔊🎶"]="https://youtube.com/playlist?list=PLuVudh8_zaHsZKa76lLfirUazcMZWzodb&si=14t1wkmsHiREB71u"
|
||||
["ʜɪɴᴅɪ ʀᴇᴍɪx 📻🎶"]="https://youtube.com/playlist?list=PLuVudh8_zaHvhUe3kLBrq5H3DeTY0bjN2&si=9dzEcnR3n5j1It3S"
|
||||
["ᴍɪx 🔊🎶"]="https://youtube.com/playlist?list=PLwIh-QEhrDJCPrtNv-r0swKWG-onndWjg&si=37SGSalBVz7kwhso"
|
||||
["ᴀʟʟ ᴛɪᴍᴇ ɴᴇᴘᴀʟɪ ʙᴇꜱᴛ 📻🎶"]="https://youtube.com/playlist?list=PLMRKdK25AuPX9eE1G1W6-xBAYGDvKRX6H&si=pAmEK2fV6bLLN8Ss"
|
||||
)
|
||||
|
||||
# Define menu options as an associative array
|
||||
declare -A menu_options=(
|
||||
["ʙʜᴀᴊᴀɴ 🚩"]="https://youtube.com/playlist?list=PLwIh-QEhrDJDM8IF3gLUgnEyZm6dBgr_n&si=_RDHngYobHlcxaJW"
|
||||
["ʟᴏꜰɪ ɢɪʀʟ 📻🎶"]="https://www.youtube.com/watch?v=jfKfPfyJRdk"
|
||||
["ɴᴇᴘᴀʟɪ ᴏʟᴅ ꜱᴏɴɢ 📻🎶"]="https://youtube.com/playlist?list=PLXuVG9D9JQ8RAhpH2TyISgBgEmXONIhGY&si=SLyxb2vxaE0XuXsz"
|
||||
["ʙᴏʟʟʏᴡᴏᴏᴅ 📻🎶"]="https://youtube.com/playlist?list=PL9bw4S5ePsEEqCMJSiYZ-KTtEjzVy0YvK&si=J0gPvKL4R4fIlPz9"
|
||||
["ᴛᴏᴘ 50 ʙᴏʟʟʏᴡᴏᴏᴅ 📻🎶"]="https://youtube.com/playlist?list=PLHuHXHyLu7BEnMJNeVvkXpxapvDSp5UdI&si=-TBeeNJ28NqVcnKu"
|
||||
["ʜɪɴᴅɪ ᴅᴊ 🔊🎶"]="https://youtube.com/playlist?list=PLuVudh8_zaHsZKa76lLfirUazcMZWzodb&si=14t1wkmsHiREB71u"
|
||||
["ʜɪɴᴅɪ ʀᴇᴍɪx 📻🎶"]="https://youtube.com/playlist?list=PLuVudh8_zaHvhUe3kLBrq5H3DeTY0bjN2&si=9dzEcnR3n5j1It3S"
|
||||
["ᴍɪx 🔊🎶"]="https://youtube.com/playlist?list=PLwIh-QEhrDJCPrtNv-r0swKWG-onndWjg&si=37SGSalBVz7kwhso"
|
||||
["ᴀʟʟ ᴛɪᴍᴇ ɴᴇᴘᴀʟɪ ʙᴇꜱᴛ 📻🎶"]="https://youtube.com/playlist?list=PLMRKdK25AuPX9eE1G1W6-xBAYGDvKRX6H&si=pAmEK2fV6bLLN8Ss"
|
||||
)
|
||||
|
||||
# Populate local_music array with files from music directory and subdirectories
|
||||
populate_local_music() {
|
||||
local_music=()
|
||||
filenames=()
|
||||
while IFS= read -r file; do
|
||||
local_music+=("$file")
|
||||
filenames+=("$(basename "$file")")
|
||||
done < <(find "$mDIR" -type f \( -iname "*.mp3" -o -iname "*.flac" -o -iname "*.wav" -o -iname "*.ogg" \))
|
||||
}
|
||||
|
||||
# Function for displaying notifications
|
||||
notification() {
|
||||
notify-send -u normal -i "$iDIR/music.png" "$1"
|
||||
notify-send -u normal -i "$iDIR/music.png" "Playing: $@"
|
||||
}
|
||||
|
||||
# Function to play music
|
||||
play_music() {
|
||||
local choice="$1"
|
||||
local link="${menu_options[$choice]}"
|
||||
# Main function for playing local music
|
||||
play_local_music() {
|
||||
populate_local_music
|
||||
|
||||
# Check if the link is a playlist
|
||||
if [[ $link == *playlist* ]]; then
|
||||
mpv --shuffle --vid=no --no-resume-playback "$link"
|
||||
elif [[ -n $link ]]; then
|
||||
mpv "$link"
|
||||
# Prompt the user to select a song
|
||||
choice=$(printf "%s\n" "${filenames[@]}" | rofi -i -dmenu -p "Local Music")
|
||||
|
||||
if [ -z "$choice" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if mpv is running to ensure music is playing
|
||||
if pgrep -x "mpv" >/dev/null; then
|
||||
notification "Playing now: $choice"
|
||||
fi
|
||||
# Find the corresponding file path based on user's choice and set that to play the song then continue on the list
|
||||
for (( i=0; i<"${#filenames[@]}"; ++i )); do
|
||||
if [ "${filenames[$i]}" = "$choice" ]; then
|
||||
|
||||
notification "$choice"
|
||||
|
||||
# For some reason wont start playlist at 0
|
||||
if [[ $i -eq 0 ]]; then
|
||||
# Play the selected local music file using mpv
|
||||
mpv --loop-playlist --vid=no "$mDIR"
|
||||
|
||||
else
|
||||
file=$i
|
||||
# Play the selected local music file using mpv
|
||||
mpv --playlist-start="$file" --loop-playlist --vid=no "$mDIR"
|
||||
fi
|
||||
break
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Main function for shuffling local music
|
||||
shuffle_local_music() {
|
||||
notification "Shuffle local music"
|
||||
|
||||
######################################
|
||||
# #
|
||||
# Music Control #
|
||||
# #
|
||||
######################################
|
||||
# Play music in $mDIR on shuffle
|
||||
mpv --shuffle --loop-playlist --vid=no "$mDIR"
|
||||
}
|
||||
|
||||
music_controls() {
|
||||
local choice="$1"
|
||||
# Main function for playing online music
|
||||
play_online_music() {
|
||||
choice=$(printf "%s\n" "${!online_music[@]}" | rofi -i -dmenu -p "Online Music")
|
||||
|
||||
case "$choice" in
|
||||
"Play") playerctl --player=mpv play && notify-send -u low "▶️ Resuming music" ;;
|
||||
"Pause") playerctl --player=mpv pause && notify-send -u low "⏸️ Music paused" ;;
|
||||
"Stop") pkill mpv && notify-send -u low "🛑 Music stopped" ;;
|
||||
"Next track") playerctl --player=mpv next && notify-send -u low "⏭️ Next track playing" ;;
|
||||
"Previous track") playerctl --player=mpv previous && notify-send -u low "⏮️ Previous track playing" ;;
|
||||
"Increase volume") adjust_volume 0.1 && notify-send -u low "🔊 Increasing track volume" ;;
|
||||
"Decrease volume") adjust_volume -0.1 && notify-send -u low "🔉 Decreasing track volume" ;;
|
||||
esac
|
||||
if [ -z "$choice" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
link="${online_music[$choice]}"
|
||||
|
||||
notification "$choice"
|
||||
|
||||
# Play the selected online music using mpv
|
||||
mpv --shuffle --vid=no "$link"
|
||||
}
|
||||
|
||||
# Function to play/pause music
|
||||
play_pause() {
|
||||
playerctl --player=mpv play-pause
|
||||
if playerctl --player=mpv status | grep -q "Playing"; then
|
||||
notify-send -u low "▶️ Resuming music"
|
||||
else
|
||||
notify-send -u low "⏸️ Music paused"
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to adjust volume
|
||||
@@ -81,64 +120,61 @@ adjust_volume() {
|
||||
notify-send -u low "$message"
|
||||
}
|
||||
|
||||
# Function to play/pause music
|
||||
play_pause() {
|
||||
playerctl --player=mpv play-pause
|
||||
if playerctl --player=mpv status | grep -q "Playing"; then
|
||||
notify-send -u low "▶️ Resuming music"
|
||||
else
|
||||
notify-send -u low "⏸️ Music paused"
|
||||
fi
|
||||
music_controls() {
|
||||
local choice="$1"
|
||||
|
||||
case "$choice" in
|
||||
"Play") playerctl --player=mpv play && notify-send -u low "▶️ Resuming music" ;;
|
||||
"Pause") playerctl --player=mpv pause && notify-send -u low "⏸️ Music paused" ;;
|
||||
"Stop") pkill mpv && notify-send -u low "🛑 Music stopped" ;;
|
||||
"Next track") playerctl --player=mpv next && notify-send -u low "⏭️ Next track playing" ;;
|
||||
"Previous track") playerctl --player=mpv previous && notify-send -u low "⏮️ Previous track playing" ;;
|
||||
"Increase volume") adjust_volume 0.1 "🔊 Increasing track volume" ;;
|
||||
"Decrease volume") adjust_volume -0.1 "🔉 Decreasing track volume" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Main function
|
||||
main() {
|
||||
local is_music_playing=$(playerctl --player=mpv status 2>/dev/null)
|
||||
|
||||
if [ "$is_music_playing" == "Playing" ]; then
|
||||
local controls=("Play" "Pause" "Stop" "Next track" "Previous track" "Increase volume" "Decrease volume")
|
||||
choice=$(printf "%s\n" "${controls[@]}" | rofi -dmenu -i -p "Music Controls:")
|
||||
music_controls "$choice"
|
||||
else
|
||||
local options=("Play from Playlist" "Play from Folder")
|
||||
choice=$(printf "%s\n" "${options[@]}" | rofi -dmenu -i -p "Music Time:")
|
||||
|
||||
case "$choice" in
|
||||
"Play from Playlist")
|
||||
playlist_choice=$(printf "%s\n" "${!menu_options[@]}" | rofi -dmenu -i -p "Choose playlist:")
|
||||
play_music "$playlist_choice"
|
||||
;;
|
||||
"Play from Folder")
|
||||
local music_files=$(find ~/Music -type f \( -iname \*.mp3 -o -iname \*.flac -o -iname \*.wav -o -iname \*.ogg -o -iname \*.aac -o -iname \*.m4a -o -iname \*.wma -o -iname \*.opus \) -exec basename {} \; | rofi -dmenu -i -p "Choose music file:")
|
||||
if [ -n "$music_files" ]; then
|
||||
notification "Playing now: $music_files" # Moved the notification here
|
||||
local full_path=$(find ~/Music -type f \( -iname \*.mp3 -o -iname \*.flac -o -iname \*.wav -o -iname \*.ogg -o -iname \*.aac -o -iname \*.m4a -o -iname \*.wma -o -iname \*.opus \) -exec realpath {} \; | grep "$music_files")
|
||||
mpv "$full_path"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
fi
|
||||
main_menu() {
|
||||
if playerctl --player=mpv status | grep -q "Playing"; then
|
||||
local controls=("Pause" "Stop" "Next track" "Previous track" "Increase volume" "Decrease volume")
|
||||
choice=$(printf "%s\n" "${controls[@]}" | rofi -dmenu -i -p "Music Controls")
|
||||
music_controls "$choice"
|
||||
else
|
||||
local controls=("Play from Music Folder" "Play from Online Stations" "Shuffle Play from Music Folder")
|
||||
choice=$(printf "%s\n" "${controls[@]}" | rofi -dmenu -i -p "Select music source")
|
||||
case "$choice" in
|
||||
"Play from Music Folder") play_local_music ;;
|
||||
"Play from Online Stations") play_online_music ;;
|
||||
"Shuffle Play from Music Folder") shuffle_local_music ;;
|
||||
*) echo "Invalid choice" ;;
|
||||
esac
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
||||
######################################
|
||||
# #
|
||||
# Usage #
|
||||
# #
|
||||
######################################
|
||||
# usage
|
||||
usage() {
|
||||
echo "Usage: $0 [-m] [-i] [-d] [-n] [-p] [-k] [-s]"
|
||||
echo " -m Main menu"
|
||||
echo " -i Increase volume"
|
||||
echo " -d Decrease volume"
|
||||
echo " -n Next track"
|
||||
echo " -p Previous track"
|
||||
echo " -k Play/pause"
|
||||
echo " -s Stop music"
|
||||
exit 1
|
||||
}
|
||||
|
||||
while getopts "midnpks" flag; do
|
||||
case "${flag}" in
|
||||
m) main ;;
|
||||
i) adjust_volume 0.1 "🔊 Increasing track volume" ;;
|
||||
m) main_menu ;;
|
||||
i) adjust_volume 0.1 "🔊 Increasing track volume" ;;
|
||||
d) adjust_volume -0.1 "🔉 Decreasing track volume" ;;
|
||||
n) playerctl --player=mpv next && notify-send -u low "⏭️ Next track playing" ;;
|
||||
p) playerctl --player=mpv previous && notify-send -u low "⏮️ Previous track playing" ;;
|
||||
k) play_pause ;;
|
||||
s) pkill mpv && notify-send -u low "🛑 Music stopped" ;;
|
||||
*) usage ;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
@@ -34,15 +34,15 @@ clip() {
|
||||
|
||||
edit() {
|
||||
menu() {
|
||||
options=("Env-variables" "Window-Rules" "Startup_Apps" "User-Keybinds" "Monitors" "Laptop-Keybinds" "User-Settings" "Default-Settings" "Default-Keybinds")
|
||||
options=("Env-variables" "Window-Rules" "Startup_Apps" "User-Keybinds" "Monitors" "Laptop-Keybinds" "User-Settings" )
|
||||
for ((i = 0; i < ${#options[@]}; i++)); do
|
||||
printf "%d. view %s\n" "$((i + 1))" "${options[i]}"
|
||||
done
|
||||
}
|
||||
main() {
|
||||
options=("ENVariables.conf" "WindowRules.conf" "Startup_Apps.conf" "UserKeybinds.conf" "Monitors.conf" "Laptops.conf" "UserSettings.conf" "Settings.conf" "Keybinds.conf")
|
||||
options=("ENVariables.conf" "WindowRules.conf" "Startup_Apps.conf" "UserKeybinds.conf" "Monitors.conf" "Laptops.conf" "UserSettings.conf" )
|
||||
choice=$(menu | rofi -dmenu -i -p " View / Edit Hyprland Configs:" | cut -d. -f1)
|
||||
[[ $choice =~ ^[1-9]$ ]] && kitty -e nano "$UserConfigs/${options[choice - 1]}"
|
||||
[[ $choice =~ ^[1-7]$ ]] && kitty -e nvim "$UserConfigs/${options[choice - 1]}"
|
||||
}
|
||||
main
|
||||
}
|
||||
@@ -70,74 +70,3 @@ emoji() {
|
||||
[[ -n "$A" ]] && wl-copy -- "$A"
|
||||
}
|
||||
|
||||
|
||||
######################################
|
||||
# #
|
||||
# Powermenu #
|
||||
# #
|
||||
######################################
|
||||
|
||||
powermenu() {
|
||||
uptime=$(uptime -p | sed -e 's/up //g')
|
||||
host=$(hostnamectl hostname)
|
||||
|
||||
# Options
|
||||
shutdown=''
|
||||
reboot=''
|
||||
lock=''
|
||||
suspend=''
|
||||
logout=''
|
||||
yes=''
|
||||
no=''
|
||||
|
||||
rofi_cmd() {
|
||||
rofi -dmenu \
|
||||
-p "Uptime: $uptime" \
|
||||
-mesg "Uptime: $uptime" \
|
||||
-theme ~/.config/rofi/powermenu.rasi
|
||||
}
|
||||
|
||||
confirm_cmd() {
|
||||
rofi -theme-str 'window {location: center; anchor: center; fullscreen: false; width: 350px;}' \
|
||||
-theme-str 'mainbox {children: [ "message", "listview" ];}' \
|
||||
-theme-str 'listview {columns: 2; lines: 1;}' \
|
||||
-theme-str 'element-text {horizontal-align: 0.5;}' \
|
||||
-theme-str 'textbox {horizontal-align: 0.5;}' \
|
||||
-dmenu \
|
||||
-p 'Confirmation' \
|
||||
-mesg 'Are you sure?' \
|
||||
-theme ~/.config/rofi/powermenu.rasi
|
||||
}
|
||||
|
||||
confirm_exit() {
|
||||
echo -e "$yes\n$no" | confirm_cmd
|
||||
}
|
||||
|
||||
run_rofi() {
|
||||
echo -e "$lock\n$suspend\n$logout\n$reboot\n$shutdown" | rofi_cmd
|
||||
}
|
||||
|
||||
# Execute Command
|
||||
run_cmd() {
|
||||
selected=$(confirm_exit)
|
||||
if [[ "$selected" == "$yes" ]]; then
|
||||
case $1 in
|
||||
--shutdown) systemctl poweroff ;;
|
||||
--reboot) systemctl reboot ;;
|
||||
--suspend) hyprlock -f && systemctl suspend ;;
|
||||
--logout) loginctl terminate-user $USER ;;
|
||||
esac
|
||||
else
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
chosen=$(run_rofi)
|
||||
case ${chosen} in
|
||||
$shutdown) run_cmd --shutdown ;;
|
||||
$reboot) run_cmd --reboot ;;
|
||||
$lock) hyprlock ;;
|
||||
$suspend) run_cmd --suspend ;;
|
||||
$logout) run_cmd --logout ;;
|
||||
esac
|
||||
}
|
||||
@@ -47,6 +47,26 @@ sys_poweroff() {
|
||||
poweroff
|
||||
fi
|
||||
}
|
||||
sys_lock() {
|
||||
if _need_confirm "Lock screen?"; then
|
||||
pidof hyprlock || hyprlock -q
|
||||
fi
|
||||
}
|
||||
sys_logout() {
|
||||
if _need_confirm "Logout?"; then
|
||||
loginctl kill-session $XDG_SESSION_ID
|
||||
fi
|
||||
}
|
||||
sys_suspend() {
|
||||
if _need_confirm "Suspend system?"; then
|
||||
systemctl suspend
|
||||
fi
|
||||
}
|
||||
sys_hibernate() {
|
||||
if _need_confirm "Hibernate system?"; then
|
||||
systemctl hibernate
|
||||
fi
|
||||
}
|
||||
|
||||
#######################################################
|
||||
# #
|
||||
@@ -110,16 +130,6 @@ reload_hypr() {
|
||||
notify-send -u low -i $reload 'Reload Hyprland'
|
||||
}
|
||||
|
||||
######################################
|
||||
# #
|
||||
# lockscreen(hyprlock) #
|
||||
# #
|
||||
######################################
|
||||
|
||||
lock_screen() {
|
||||
hyprlock
|
||||
}
|
||||
|
||||
######################################
|
||||
# #
|
||||
# Battery Notifer #
|
||||
|
||||
@@ -247,18 +247,3 @@ kb_changer() {
|
||||
|
||||
notify-send -u low -i "$notif" "Keyboard language changed to $new_layout"
|
||||
}
|
||||
|
||||
|
||||
######################################
|
||||
# #
|
||||
# Cursor Zoom #
|
||||
# #
|
||||
######################################
|
||||
|
||||
cz() {
|
||||
if [ $(hyprctl -j getoption misc:cursor_zoom_factor | jq '.float' | sed 's/\..*$//') == 1 ]; then
|
||||
$(hyprctl keyword misc:cursor_zoom_factor 2) &> /dev/null
|
||||
else
|
||||
$(hyprctl keyword misc:cursor_zoom_factor 1) &> /dev/null
|
||||
fi
|
||||
}
|
||||
@@ -31,14 +31,17 @@ declare -A menu_options=(
|
||||
#RunCMD
|
||||
["; Launcher"]="rofi -show drun -modi drun,filebrowser,run,window"
|
||||
["cb Clipboard"]="$RunCMD clip"
|
||||
["rm RunCMDMusic"]="$RunCMD music -m"
|
||||
["emj RunCMDEmoji"]="$RunCMD emoji"
|
||||
["rm Music"]="$RunCMD music -m"
|
||||
["emj Emoji"]="$RunCMD emoji"
|
||||
["kb Kebinds"]="$RunCMD keybind"
|
||||
["qe Edits"]="$RunCMD edit"
|
||||
["qe QuickEdits"]="$RunCMD edit"
|
||||
#System
|
||||
["qq Shutdown"]="$RunCMD sys_poweroff"
|
||||
["rr Reboot"]="$RunCMD sys_reboot"
|
||||
["SS Wlogout"]="wlogout"
|
||||
["lk Lock"]="$RunCMD sys_lock"
|
||||
["lo LogOut"]="$RunCMD sys_logout"
|
||||
["sp Suspend"]="$RunCMD sys_suspend"
|
||||
["hb Hibernate"]="$RunCMD sys_hibernate"
|
||||
["cn Close Notifactions"]="swaync-client -C"
|
||||
["dm0 disable monitor"]="$RunCMD disable_edp1"
|
||||
["dm1 enable monitor"]="$RunCMD enable_edp1"
|
||||
@@ -63,6 +66,8 @@ main() {
|
||||
-mesg "Hello" \
|
||||
-max-history-size 0 \
|
||||
-auto-select
|
||||
|
||||
|
||||
)
|
||||
|
||||
if [ -z "$choice" ]; then
|
||||
|
||||
Reference in new issue
Block a user