From 6cbe2a886fb5104aa37e6da971c88e02f59ee828 Mon Sep 17 00:00:00 2001 From: S4NKALP Date: Wed, 24 Jan 2024 23:46:11 +0545 Subject: [PATCH] Huge Update --- config/hypr/UserConfigs/Laptops.conf | 30 +- config/hypr/UserConfigs/Startup_Apps.conf | 2 +- config/hypr/UserConfigs/UserKeybinds.conf | 12 +- config/hypr/initial-boot.sh | 8 +- config/hypr/scripts/Brightness.sh | 59 ---- config/hypr/scripts/Device_cmd.sh | 102 ------- config/hypr/scripts/Linker.sh | 32 --- config/hypr/scripts/Music_cmd.sh | 138 +++++---- config/hypr/scripts/Ref.sh | 2 +- config/hypr/scripts/RunCMD.sh | 2 +- config/hypr/scripts/ScreenShot.sh | 46 --- config/hypr/scripts/System_cmd.sh | 336 ++++++++++++++++++++++ config/hypr/scripts/Ui_cmd.sh | 77 ++++- config/hypr/scripts/Volume.sh | 137 --------- config/hypr/scripts/Widget.sh | 141 --------- config/hypr/scripts/Xmenu.sh | 49 +--- config/rofi/config-panel.rasi | 178 ------------ config/waybar/config | 2 +- config/waybar/modules | 44 +-- 19 files changed, 551 insertions(+), 846 deletions(-) delete mode 100755 config/hypr/scripts/Brightness.sh delete mode 100755 config/hypr/scripts/Linker.sh delete mode 100755 config/hypr/scripts/ScreenShot.sh create mode 100755 config/hypr/scripts/System_cmd.sh delete mode 100755 config/hypr/scripts/Volume.sh delete mode 100755 config/hypr/scripts/Widget.sh delete mode 100644 config/rofi/config-panel.rasi diff --git a/config/hypr/UserConfigs/Laptops.conf b/config/hypr/UserConfigs/Laptops.conf index 2fb703f4..36daae5e 100644 --- a/config/hypr/UserConfigs/Laptops.conf +++ b/config/hypr/UserConfigs/Laptops.conf @@ -4,22 +4,22 @@ $mainMod = SUPER $scriptsDir = $HOME/.config/hypr/scripts -$device = $scriptsDir/Device_cmd.sh +$RunCMD = $scriptsDir/RunCMD.sh $UserConfigs = $HOME/.config/hypr/UserConfigs #Brightness Control -bind = ,xf86KbdBrightnessDown, exec, $scriptsDir/Brightness.sh --dec-kbd #Keyboard brightness Down -bind = ,xf86KbdBrightnessUp, exec, $scriptsDir/Brightness.sh --inc-kbd #Keyboard brightness up -bind = ,XF86MonBrightnessUp, exec, $scriptsDir/Brightness.sh --inc -bind = ,XF86MonBrightnessDown, exec, $scriptsDir/Brightness.sh --dec -bind = $mainMod_SHIFT, D, exec, $device toggle_touchpad # Disable Touchpad +bind = ,xf86KbdBrightnessDown, exec, $RunCMD brightness --dec-kbd #Keyboard brightness Down +bind = ,xf86KbdBrightnessUp, exec, $RunCMD brightness --inc-kbd #Keyboard brightness up +bind = ,XF86MonBrightnessUp, exec, $RunCMD brightness --inc +bind = ,XF86MonBrightnessDown, exec, $RunCMD brightness --dec +bind = $mainMod_SHIFT, D, exec, $RunCMD touchpad # Disable Touchpad #VolumeControl -bind = ,XF86AudioRaiseVolume, exec, $scriptsDir/Volume.sh --inc -bind = ,XF86AudioLowerVolume, exec, $scriptsDir/Volume.sh --dec -bind = ,XF86AudioMute, exec, $scriptsDir/Volume.sh --toggle -bind = ,XF86AudioMicMute, exec, $scriptsDir/Volume.sh --toggle-mic +bind = ,XF86AudioRaiseVolume, exec, $RunCMD volume --inc +bind = ,XF86AudioLowerVolume, exec, $RunCMD volume --dec +bind = ,XF86AudioMute, exec, $RunCMD volume --toggle +bind = ,XF86AudioMicMute, exec, $RunCMD volume --toggle-mic bind = ,XF86AudioNext, exec, playerctl next bind = ,XF86AudioPrev, exec, playerctl previous bind = ,XF86AudioPlay, exec, playerctl play @@ -27,11 +27,11 @@ bind = ,XF86AudioStop, exec, playerctl pause # ScreenShot -bind = , Print, exec, $scriptsDir/ScreenShot.sh --now # Fullscreen -bind = CTRL, Print, exec, $scriptsDir/ScreenShot.sh --active # active window -bind = ALT, Print, exec, $scriptsDir/ScreenShot.sh --in5 # Screenshot in 5 Sec -bind = SHIFT, Print, exec, $scriptsDir/ScreenShot.sh --in10 # Screenshot in 10 sec -bind = $mainMod, Z, exec, $scriptsDir/ScreenShot.sh --area +bind = , Print, exec, $RunCMD screenshot --now # Fullscreen +bind = CTRL, Print, exec, $RunCMD screenshot --active # active window +bind = ALT, Print, exec, $RunCMD screenshot --in5 # Screenshot in 5 Sec +bind = SHIFT, Print, exec, $RunCMD screenshot --in10 # Screenshot in 10 sec +bind = $mainMod, Z, exec, $RunCMD screenshot --area # Laptops Other Key bind = , xf86Sleep, exec, systemctl suspend # sleep button diff --git a/config/hypr/UserConfigs/Startup_Apps.conf b/config/hypr/UserConfigs/Startup_Apps.conf index 4fdfefd5..3928a22a 100644 --- a/config/hypr/UserConfigs/Startup_Apps.conf +++ b/config/hypr/UserConfigs/Startup_Apps.conf @@ -38,7 +38,7 @@ exec-once = wl-paste --type text --watch cliphist store exec-once = wl-paste --type image --watch cliphist store # Rainbow borders -exec-once = $ui rainbowborder +exec-once = $RunCMD rainbowborder # sway-idle with lock only #exec-once = swayidle -w timeout 900 '$lock' diff --git a/config/hypr/UserConfigs/UserKeybinds.conf b/config/hypr/UserConfigs/UserKeybinds.conf index 4ea0b2b1..d9b4a2e8 100644 --- a/config/hypr/UserConfigs/UserKeybinds.conf +++ b/config/hypr/UserConfigs/UserKeybinds.conf @@ -30,7 +30,7 @@ bind = $mainMod, Slash, exec, kitty nvim bind = $mainMod_SHIFT, Slash, exec, codium --disable-gpu # FEATURES / EXTRAS -bind = SHIFT_ALT, R, exec, $RunCMD reload +bind = SHIFT_ALT, R, exec, $RunCMD reloadall bind = $mainMod, X, exec, $RunCMD powermenu bind = $mainMod_SHIFT, A, exec, $RunCMD gamemode bind = ALT, slash, exec, $RunCMD emoji @@ -50,11 +50,11 @@ bind = $mainMod, R, exec, $RunCMD sr bind = $mainMod_SHIFT, N, exec, swaync-client -C # Online Music related keybinds -bind = ALT, M, exec, $scriptsDir/Music_cmd.sh -m -bind = ALT, S, exec, $scriptsDir/Music_cmd.sh -s # Stop -bind = ALT, N, exec, $scriptsDir/Music_cmd.sh -n # Next -bind = ALT, P, exec, $scriptsDir/Music_cmd.sh -p # Previous -bind = ALT, R, exec, $scriptsDir/Music_cmd.sh -k # Resume +bind = ALT, M, exec, $scriptsDir/RunCMD music -m # open rofi music +bind = ALT, S, exec, $scriptsDir/RunCMD music -s # Stop +bind = ALT, N, exec, $scriptsDir/RunCMD music -n # Next +bind = ALT, P, exec, $scriptsDir/RunCMD music -p # Previous +bind = ALT, R, exec, $scriptsDir/RunCMD music -k # Resume # Waybar / Bar related diff --git a/config/hypr/initial-boot.sh b/config/hypr/initial-boot.sh index cbdaa9d4..ca71ad1b 100755 --- a/config/hypr/initial-boot.sh +++ b/config/hypr/initial-boot.sh @@ -6,8 +6,8 @@ # not necessary to do since this script is only designed to run only once as long as the marker exists # Variables -scriptsDir=$HOME/.config/hypr/scripts -wallpaper=$HOME/Pictures/wallpapers/62.jpg +RunCMD=$HOME/.config/hypr/scripts/RunCMD.sh +wallpaper=$HOME/Pictures/wallpapers/1.png kvantum_theme="Tokyo-Night" swww="swww img" @@ -20,7 +20,7 @@ if [ ! -f $HOME/cache/.initial_startup_done ]; then swww init || swww query && $swww "$wallpaper" $effect # For Symbolic Link - "$scriptsDir/Linker.sh" > /dev/null 2>&1 + "$RunCMD linker" > /dev/null 2>&1 # initiate GTK dark mode and apply icon and cursor theme gsettings set org.gnome.desktop.interface gtk-theme Tokyonight-Dark-BL-LB > /dev/null 2>&1 & @@ -36,7 +36,7 @@ if [ ! -f $HOME/cache/.initial_startup_done ]; then grep 'kb_layout=' "$HOME/.config/hypr/UserConfigs/UserSettings.conf" | cut -d '=' -f 2 | cut -d ',' -f 1 2>/dev/null > $HOME/.cache/kb_layout # Refreshing waybar, dunst, rofi etc. - "$scriptsDir/Refresh.sh" > /dev/null 2>&1 & + "$RunCMD reloadall" > /dev/null 2>&1 & # Create a marker file to indicate that the script has been executed. touch $HOME/.cache/.initial_startup_done diff --git a/config/hypr/scripts/Brightness.sh b/config/hypr/scripts/Brightness.sh deleted file mode 100755 index 94f2b830..00000000 --- a/config/hypr/scripts/Brightness.sh +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/bash - -# Script for keyboard backlights (if supported) & screen using brightnessctl - -iDIR="$HOME/.config/swaync/icons" -notification_timeout=1000 - -get_backlight() { - echo $(brightnessctl -m | cut -d, -f4) -} - -get_kbd_backlight() { - brightnessctl -d '*::kbd_backlight' -m | cut -d, -f4 | tr -d '%' -} - -get_icon() { - current=$(get_backlight | sed 's/%//') - [ "$current" -le "20" ] && icon="$iDIR/brightness-20.png" || - [ "$current" -le "40" ] && icon="$iDIR/brightness-40.png" || - [ "$current" -le "60" ] && icon="$iDIR/brightness-60.png" || - [ "$current" -le "80" ] && icon="$iDIR/brightness-80.png" || - icon="$iDIR/brightness-100.png" -} - -notify_user() { - notify-send -e -h string:x-canonical-private-synchronous:brightness_notif -h int:value:$current -u low -i "$icon" "Brightness: $current%" -} - -change_backlight() { - brightnessctl set "$1" && get_icon && notify_user -} - -change_kbd_backlight() { - brightnessctl -d '*::kbd_backlight' set "$1" && get_icon && notify_user -} - -case "$1" in - "--get") - get_backlight - ;; - "--inc") - change_backlight "+5%" - ;; - "--dec") - change_backlight "5%-" - ;; - "--get-kbd") - get_kbd_backlight - ;; - "--inc-kbd") - change_kbd_backlight "+30%" - ;; - "--dec-kbd") - change_kbd_backlight "30%-" - ;; - *) - get_backlight - ;; -esac diff --git a/config/hypr/scripts/Device_cmd.sh b/config/hypr/scripts/Device_cmd.sh index 7d0f514a..d83f9006 100755 --- a/config/hypr/scripts/Device_cmd.sh +++ b/config/hypr/scripts/Device_cmd.sh @@ -46,71 +46,6 @@ bluetooth() { fi } -# Reload Waybar, Rofi, Swaync, and Rainbowborder.sh (SHIFT ALT R) -reload() { - file_exists() { - [ -e "$1" ] - } - - processes=("waybar" "rofi" "swaync") - - for process in "${processes[@]}"; do - pid=$(pidof "$process") - if [ -n "$pid" ]; then - pkill "$process" - fi - done - - sleep 0.3 - waybar & - sleep 0.5 - swaync > /dev/null 2>&1 & - sleep 1 - - script_path="${UserSCRIPTSDIR}/RainbowBorders.sh" - if file_exists "$script_path"; then - "$script_path" & - fi -} - - -# LockScreen with swaylock -lockscreen() { - LOCKCONFIG="$HOME/.config/swaylock/config" - sleep 0.5s - swaylock --config ${LOCKCONFIG} & - disown -} - - -# Switch Keyboard Layout (ALT F1) -kb() { -if [ ! -f "$layout_f" ]; then - default_layout=$(grep 'kb_layout=' "$settings_file" | cut -d '=' -f 2 | cut -d ',' -f 1 2>/dev/null) - if [ -z "$default_layout" ]; then - default_layout="us" # Default to 'us' layout if Settings.conf or 'kb_layout' is not found - fi - echo "$default_layout" > "$layout_f" -fi -current_layout=$(cat "$layout_f") -if [ -f "$settings_file" ]; then # Read keyboard layout settings from Settings.conf - kb_layout_line=$(grep 'kb_layout=' "$settings_file" | cut -d '=' -f 2) - IFS=',' read -ra layout_mapping <<< "$kb_layout_line" -fi -layout_count=${#layout_mapping[@]} -for ((i = 0; i < layout_count; i++)); do # Find the index of the current layout in the mapping - if [ "$current_layout" == "${layout_mapping[i]}" ]; then - current_index=$i - break - fi -done -next_index=$(( (current_index + 1) % layout_count )) # Calculate the index of the next layout -new_layout="${layout_mapping[next_index]}" -hyprctl keyword input:kb_layout "$new_layout" # Update the keyboard layout -echo "$new_layout" > "$layout_f" -notify-send -u low -i "$notif" "Keyboad Layout Changed to $new_layout" -} - disable_edp1() { enable_edp1 sleep 1 @@ -120,40 +55,3 @@ enable_edp1() { hyprctl keyword monitor eDP-1,preferred,auto,1 } -weather() { - city=kohalpur - cachedir=~/.cache/rbn - cachefile=${0##*/}-$1 - - mkdir -p $cachedir - touch $cachedir/$cachefile - - SAVEIFS=$IFS;IFS=$'\n' - cacheage=$(($(date +%s) - $(stat -c '%Y' "$cachedir/$cachefile"))) - [ $cacheage -gt 1740 ] || [ ! -s $cachedir/$cachefile ] && { - data=($(curl -s https://en.wttr.in/"$city"$1\?0qnT 2>&1)) - for i in {1..2}; do echo ${data[$i]} | sed -E 's/^.{15}//' >> $cachedir/$cachefile; done - } - IFS=$SAVEIFS - - weather=($(cat $cachedir/$cachefile)) - temperature=$(echo ${weather[2]} | sed -E 's/([[:digit:]]+)\.\./\1 to /g') - - case $(echo ${weather[1]##*,} | tr '[:upper:]' '[:lower:]') in - clear|sunny) condition="" ;; - partly\ cloudy) condition="󰖕" ;; - cloudy) condition="" ;; - overcast) condition="" ;; - fog|freezing\ fog) condition="" ;; - patchy\ rain\ possible|patchy\ light\ drizzle|light\ drizzle|patchy\ light\ rain|light\ rain|light\ rain\ shower|mist|rain) condition="󰼳" ;; - moderate\ rain\ at\ times|moderate\ rain|heavy\ rain\ at\ times|heavy\ rain|moderate\ or\ heavy\ rain\ shower|torrential\ rain\ shower|rain\ shower) condition="" ;; - patchy\ snow\ possible|patchy\ sleet\ possible|patchy\ freezing\ drizzle\ possible|freezing\ drizzle|heavy\ freezing\ drizzle|light\ freezing\ rain|moderate\ or\ heavy\ freezing\ rain|light\ sleet|ice\ pellets|light\ sleet\ showers|moderate\ or\ heavy\ sleet\ showers) condition="󰼴" ;; - blowing\ snow|moderate\ or\ heavy\ sleet|patchy\ light\ snow|light\ snow|light\ snow\ showers) condition="󰙿" ;; - blizzard|patchy\ moderate\ snow|moderate\ snow|patchy\ heavy\ snow|heavy\ snow|moderate\ or\ heavy\ snow\ with\ thunder|moderate\ or\ heavy\ snow\ showers) condition="" ;; - thundery\ outbreaks\ possible|patchy\ light\ rain\ with\ thunder|moderate\ or\ heavy\ rain\ with\ thunder|patchy\ light\ snow\ with\ thunder) condition="" ;; - *) condition="" ;; - esac - - echo -e "{\"text\":\""$temperature $condition"\", \"alt\":\""${weather[0]}"\", \"tooltip\":\""${weather[0]}: $temperature ${weather[1]}"\"}" -} - diff --git a/config/hypr/scripts/Linker.sh b/config/hypr/scripts/Linker.sh deleted file mode 100755 index a7f4ae10..00000000 --- a/config/hypr/scripts/Linker.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash - -# Define the path to the swww cache directory -cache_dir="$HOME/.cache/swww/" - -# Get a list of monitor outputs -monitor_outputs=("$cache_dir"/*) - -# Initialize a flag to determine if the ln command was executed -ln_success=false - -# Loop through monitor outputs -for cache_file in "${monitor_outputs[@]}"; do - # Check if the cache file exists for the current monitor output - if [ -f "$cache_file" ]; then - # Get the wallpaper path from the cache file - wallpaper_path=$(<"$cache_file") - - # Copy the wallpaper to the location Rofi can access - if ln -sf "$wallpaper_path" "$HOME/.config/rofi/.current_wallpaper"; then - ln_success=true # Set the flag to true upon successful execution - break # Exit the loop after processing the first found monitor output - fi - fi -done - -# Add a message indicating whether the ln command was successful -if $ln_success; then - echo "Wallpaper linked successfully." -else - echo "Failed to link wallpaper." -fi diff --git a/config/hypr/scripts/Music_cmd.sh b/config/hypr/scripts/Music_cmd.sh index 125f1717..780c043f 100755 --- a/config/hypr/scripts/Music_cmd.sh +++ b/config/hypr/scripts/Music_cmd.sh @@ -1,73 +1,101 @@ -#!/usr/bin/env bash +#!/bin/bash +music(){ +# Directory for icons iDIR="$HOME/.config/swaync/icons" -LOFI_STREAM="https://www.youtube.com/watch?v=jfKfPfyJRdk" -NEPALI_OLD_SONG="https://youtube.com/playlist?list=PLXuVG9D9JQ8RAhpH2TyISgBgEmXONIhGY&si=SLyxb2vxaE0XuXsz" -BOLLYWOOD_LOVE_SONG="https://youtube.com/playlist?list=PL9bw4S5ePsEEqCMJSiYZ-KTtEjzVy0YvK&si=J0gPvKL4R4fIlPz9" -TOP_50_BOLLYWOOD="https://youtube.com/playlist?list=PLHuHXHyLu7BEnMJNeVvkXpxapvDSp5UdI&si=-TBeeNJ28NqVcnKu" -BHAJAN="https://youtube.com/playlist?list=PLwIh-QEhrDJDM8IF3gLUgnEyZm6dBgr_n&si=_RDHngYobHlcxaJW" -play=" Play music" -pause=" Pause music" -stop=" Stop music" -next_track=" Next track" -prev_track=" Previous track" -increase_volume="󰝝 Increase volume" -decrease_volume="󰝞 Decrease volume" +# Note: You can add more options below with the following format: +# ["TITLE"]="link" -play_bhajan="󰥳 Play Bhajan" -play_lofi=" Play lofi girl" -play_old_nepali="1.  Play Nepali Old Song" -play_bollywood_love="2.  Play BollyWood Love" -play_TOP_50_BOLLYWOOD="3.  Play Top 50 BollyWood" +# Define menu options as an associative array +declare -A menu_options=( + ["Play Bhajan"]="https://youtube.com/playlist?list=PLwIh-QEhrDJDM8IF3gLUgnEyZm6dBgr_n&si=_RDHngYobHlcxaJW" + ["Play lofi girl"]="https://www.youtube.com/watch?v=jfKfPfyJRdk" + ["Play Nepali Old Song"]="https://youtube.com/playlist?list=PLXuVG9D9JQ8RAhpH2TyISgBgEmXONIhGY&si=SLyxb2vxaE0XuXsz" + ["Play BollyWood Love"]="https://youtube.com/playlist?list=PL9bw4S5ePsEEqCMJSiYZ-KTtEjzVy0YvK&si=J0gPvKL4R4fIlPz9" + ["Play Top 50 BollyWood"]="https://youtube.com/playlist?list=PLHuHXHyLu7BEnMJNeVvkXpxapvDSp5UdI&si=-TBeeNJ28NqVcnKu" +) -notify() { notify-send -u normal -i "$iDIR/music.png" "$1"; } - -music() { - if pgrep -x "mpv" > /dev/null; then - controls - else - local chosen=$(printf "%s\n%s\n%s\n%s\n" "$play_bhajan" "$play_lofi" "$play_old_nepali" "$play_bollywood_love" "$play_TOP_50_BOLLYWOOD" | rofi -dmenu -i -l 5 -p "Music Time:" -config ~/.config/rofi/config.rasi) - - case "$chosen" in - "$play_bhajan") notify "Playing Bhajan"; exec -a "rofi-music" mpv --no-video "$BHAJAN" --shuffle --no-resume-playback ;; - "$play_lofi") notify "🎹 Playing lofi girl"; exec -a "rofi-music" mpv --no-video "$LOFI_STREAM" --no-resume-playback ;; - "$play_old_nepali") notify "🎹 Playing nepali old song"; exec -a "rofi-music" mpv --no-video "$NEPALI_OLD_SONG" --shuffle --no-resume-playback ;; - "$play_bollywood_love") notify "🎹 Playing bollywood love"; exec -a "rofi-music" mpv --no-video "$BOLLYWOOD_LOVE_SONG" --shuffle --no-resume-playback ;; - "$play_TOP_50_BOLLYWOOD") notify "🎹 Playing top 50 bollywood"; exec -a "rofi-music" mpv --no-video "$TOP_50_BOLLYWOOD" --shuffle --no-resume-playback ;; - esac - fi +# Function for displaying notifications +notification() { + notify-send -u normal -i "$iDIR/music.png" "$1" } -controls() { - local chosen=$(printf "%s\n%s\n%s\n%s\n%s\n%s\n%s\n" "$play" "$pause" "$stop" "$next_track" "$prev_track" "$increase_volume" "$decrease_volume" | rofi -dmenu -i -l 7 -p "Music Controls:" -config ~/.config/rofi/config.rasi) +# Function to play music +play_music() { + local choice="$1" + local link="${menu_options[$choice]}" - case "$chosen" in - "$play") playerctl --player=mpv play && notify-send -u normal -i "$1" "▶️ Resuming music" ;; - "$pause") playerctl --player=mpv pause && notify-send -u normal -i "$1" "⏸️ Music paused" ;; - "$stop") pkill mpv && notify-send -u normal -i "$1" "🛑 Music stopped" ;; - "$next_track") playerctl --player=mpv next && notify-send -u normal -i "$1" "⏭️ Next track playing" ;; - "$prev_track") playerctl --player=mpv previous && notify-send -u normal -i "$1" "⏮️ Previous track playing" ;; - "$increase_volume") adjust_volume 0.1 "🔊 Increasing track volume" ;; - "$decrease_volume") adjust_volume -0.1 "🔉 Decreasing track volume" ;; - esac + notification "Playing now: $choice" + + # Check if the link is a playlist + if [[ $link == *playlist* ]]; then + mpv --shuffle --vid=no --no-resume-playback "$link" + else + mpv "$link" + fi } +# Function for music controls +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 +} + +# Function to adjust volume adjust_volume() { - current_volume=$(playerctl --player=mpv volume) - new_volume=$(echo "$current_volume + $1" | bc) - playerctl --player=mpv volume "$new_volume" - notify-send -u normal -i "$iDIR/music.png" "$2" + local change="$1" + local message="$2" + + current_volume=$(playerctl --player=mpv volume) + new_volume=$(echo "$current_volume + $change" | bc) + playerctl --player=mpv volume "$new_volume" + notify-send -u low "$message" } -while getopts midnpks flag; do +# 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 +} + +# Main function +main() { + local is_music_playing=$(pgrep -x "mpv") + local streaming_options=("Play Bhajan" "Play lofi girl" "Play Nepali Old Song" "Play BollyWood Love" "Play Top 50 BollyWood") + + if [ -n "$is_music_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 + choice=$(printf "%s\n" "${streaming_options[@]}" | rofi -dmenu -i -p "Music Time:") + play_music "$choice" + fi +} + +while getopts "midnpks" flag; do case "${flag}" in - m) music ;; - i) adjust_volume 0.1 "🔊 Increasing track volume" ;; + m) main ;; + i) adjust_volume 0.1 "🔊 Increasing track volume" ;; d) adjust_volume -0.1 "🔉 Decreasing track volume" ;; - s) kill $(pidof "rofi-music") && notify-send "🛑 Music stopped" ;; - n) playerctl --player=mpv next && notify-send "⏭️ Next track playing" ;; - p) playerctl --player=mpv previous && notify-send "⏮️ Previous track playing" ;; + 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" ;; esac done +} diff --git a/config/hypr/scripts/Ref.sh b/config/hypr/scripts/Ref.sh index 54f53ff2..199d4737 100755 --- a/config/hypr/scripts/Ref.sh +++ b/config/hypr/scripts/Ref.sh @@ -56,7 +56,7 @@ height=$(wc -l "$file" | awk '{print $1}') # For Waybar Layout config_dir="$HOME/.config/waybar/configs" waybar_config="$HOME/.config/waybar/config" -CMD="$SCRIPTSDIR/RunCMD.sh reload" +RunCMD="$SCRIPTSDIR/RunCMD.sh" # For Note diff --git a/config/hypr/scripts/RunCMD.sh b/config/hypr/scripts/RunCMD.sh index 8909517e..83753ddf 100755 --- a/config/hypr/scripts/RunCMD.sh +++ b/config/hypr/scripts/RunCMD.sh @@ -3,8 +3,8 @@ source ~/.config/hypr/scripts/Ui_cmd.sh source ~/.config/hypr/scripts/Device_cmd.sh source ~/.config/hypr/scripts/Rofi_cmd.sh +source ~/.config/hypr/scripts/System_cmd.sh source ~/.config/hypr/scripts/Music_cmd.sh -source ~/.config/hypr/scripts/Widget.sh help() { declare -F diff --git a/config/hypr/scripts/ScreenShot.sh b/config/hypr/scripts/ScreenShot.sh deleted file mode 100755 index 7428e412..00000000 --- a/config/hypr/scripts/ScreenShot.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash - -iDIR="$HOME/.config/swaync/icons" -notify_cmd_shot="notify-send -h string:x-canonical-private-synchronous:shot-notify -u low -i ${iDIR}/picture.png" -time=$(date "+%d-%b_%H-%M-%S") -dir="$(xdg-user-dir)/Pictures/Screenshots" -file="Screenshot_${time}_${RANDOM}.png" -active_window_path="${dir}/Screenshot_${time}_$(hyprctl -j activewindow | jq -r '(.class)').png" - -notify_view() { - local msg="Screenshot Saved." - [[ "$1" == "active" && ! -e "${active_window_path}" ]] && msg="Screenshot NOT Saved." - ${notify_cmd_shot} "$msg" -} - -countdown() { - for sec in $(seq $1 -1 1); do - notify-send -h string:x-canonical-private-synchronous:shot-notify -t 1000 -i "$iDIR"/timer.png "Taking shot in : $sec" - sleep 1 - done -} - -take_shot() { - cd ${dir} && grim - | tee "$file" | wl-copy - sleep 2 - notify_view "$1" -} - -shotnow() { take_shot; } -shot5() { countdown '5'; sleep 1 && take_shot; } -shot10() { countdown '10'; take_shot; } -shotarea() { cd ${dir} && grim -g "$(slurp)" - | tee "$file" | wl-copy; notify_view; } -shotactive() { hyprctl -j activewindow | jq -r '"\(.at[0]),\(.at[1]) \(.size[0])x\(.size[1])"' | grim -g - "${active_window_path}" && sleep 1 && notify_view "active"; } - -[[ ! -d "$dir" ]] && mkdir -p "$dir" - -case "$1" in - --now) shotnow ;; - --in5) shot5 ;; - --in10) shot10 ;; - --area) shotarea ;; - --active) shotactive ;; - *) echo -e "Available Options: --now --in5 --in10 --area --active" -esac - -exit 0 diff --git a/config/hypr/scripts/System_cmd.sh b/config/hypr/scripts/System_cmd.sh new file mode 100755 index 00000000..0786ac7e --- /dev/null +++ b/config/hypr/scripts/System_cmd.sh @@ -0,0 +1,336 @@ +#!/bin/bash +source ~/.config/hypr/scripts/Ref.sh + + +_confirm_rofi() { + rofi -theme-str 'window {location: center; anchor: center; fullscreen: false; width: 250px;}' \ + -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;}' \ + -kb-accept-entry 'Return,space' \ + -dmenu \ + -mesg "$1" + +} +_need_confirm() { + local _result="$(echo -e "No\nYes" | _confirm_rofi "$1")" + if [[ "$_result" == "Yes" ]]; then + return 0 + else + return 1 + fi +} +sys_reboot() { + if _need_confirm "Reboot system?"; then + reboot + fi +} +sys_poweroff() { + if _need_confirm "Shutdown system?"; then + poweroff + fi +} + +# Reload Waybar, Rofi, Swaync, and Rainbowborder.sh (SHIFT ALT R) +reloadall() { + file_exists() { + [ -e "$1" ] + } + + processes=("waybar" "rofi" "swaync") + + for process in "${processes[@]}"; do + pid=$(pidof "$process") + if [ -n "$pid" ]; then + pkill "$process" + fi + done + + sleep 0.3 + waybar & + sleep 0.5 + swaync > /dev/null 2>&1 & + sleep 1 + + script_path="${UserSCRIPTSDIR}/RainbowBorders.sh" + if file_exists "$script_path"; then + "$script_path" & + fi +} +reload_waybar() { + _ps=(waybar rofi) + for _prs in "${_ps[@]}"; do + if pidof "${_prs}" >/dev/null; then + pkill "${_prs}" + fi + done + + sleep 0.1 + # Relaunch waybar + if [[ -z $1 ]]; then + waybar & + fi + $notif "Reload Waybar" +} + +update_waybar() { + pkill -RTMIN+4 waybar + notify-send -u low -i $notif 'Refresh Waybar' +} +reload_hypr() { + hyprctl reload + notify-send -u low -i $notif 'Reload Hyprland' +} +restart_waybar_if_needed() { + if pgrep -x "waybar" >/dev/null; then + pkill waybar + sleep 0.1 # Delay for Waybar to completely terminate + fi + reload_waybar & +} + +lock_screen() { + LOCKCONFIG="$HOME/.config/swaylock/config" + sleep 0.5s + swaylock --config ${LOCKCONFIG} & + disown +} + + +# Volume Controller +volume() { + iDIR="$HOME/.config/swaync/icons" + + get_volume() { + volume=$(pamixer --get-volume) + if [[ "$volume" -eq "0" ]]; then + echo "Muted" + else + echo "$volume%" + fi + } + + get_icon() { + current=$(get_volume) + if [[ "$current" == "Muted" ]]; then + echo "$iDIR/volume-mute.png" + elif [[ "${current%\%}" -le 30 ]]; then + echo "$iDIR/volume-low.png" + elif [[ "${current%\%}" -le 60 ]]; then + echo "$iDIR/volume-mid.png" + else + echo "$iDIR/volume-high.png" + fi + } + + notify_user() { + if [[ "$(get_volume)" == "Muted" ]]; then + notify-send -e -h string:x-canonical-private-synchronous:volume_notif -u low -i "$(get_icon)" "Volume: Muted" + else + notify-send -e -h int:value:"$(get_volume | sed 's/%//')" -h string:x-canonical-private-synchronous:volume_notif -u low -i "$(get_icon)" "Volume: $(get_volume)" + fi + } + + inc_volume() { + if [ "$(pamixer --get-mute)" == "true" ]; then + pamixer -u && notify_user + fi + pamixer -i 5 && notify_user + } + + dec_volume() { + if [ "$(pamixer --get-mute)" == "true" ]; then + pamixer -u && notify_user + fi + pamixer -d 5 && notify_user + } + + toggle_mute() { + if [ "$(pamixer --get-mute)" == "false" ]; then + pamixer -m && notify-send -e -u low -i "$iDIR/volume-mute.png" "Volume Switched OFF" + elif [ "$(pamixer --get-mute)" == "true" ]; then + pamixer -u && notify-send -e -u low -i "$(get_icon)" "Volume Switched ON" + fi + } + + toggle_mic() { + if [ "$(pamixer --default-source --get-mute)" == "false" ]; then + pamixer --default-source -m && notify-send -e -u low -i "$iDIR/microphone-mute.png" "Microphone Switched OFF" + elif [ "$(pamixer --default-source --get-mute)" == "true" ]; then + pamixer -u --default-source u && notify-send -e -u low -i "$iDIR/microphone.png" "Microphone Switched ON" + fi + } + + get_mic_icon() { + current=$(pamixer --default-source --get-volume) + if [[ "$current" -eq "0" ]]; then + echo "$iDIR/microphone-mute.png" + else + echo "$iDIR/microphone.png" + fi + } + + get_mic_volume() { + volume=$(pamixer --default-source --get-volume) + if [[ "$volume" -eq "0" ]]; then + echo "Muted" + else + echo "$volume%" + fi + } + + notify_mic_user() { + volume=$(get_mic_volume) + icon=$(get_mic_icon) + notify-send -e -h int:value:"$volume" -h "string:x-canonical-private-synchronous:volume_notif" -u low -i "$icon" "Mic-Level: $volume" + } + + inc_mic_volume() { + if [ "$(pamixer --default-source --get-mute)" == "true" ]; then + pamixer --default-source -u && notify_mic_user + fi + pamixer --default-source -i 5 && notify_mic_user + } + + dec_mic_volume() { + if [ "$(pamixer --default-source --get-mute)" == "true" ]; then + pamixer --default-source -u && notify_mic_user + fi + pamixer --default-source -d 5 && notify_mic_user + } + + if [[ "$1" == "--get" ]]; then + get_volume + elif [[ "$1" == "--inc" ]]; then + inc_volume + elif [[ "$1" == "--dec" ]]; then + dec_volume + elif [[ "$1" == "--toggle" ]]; then + toggle_mute + elif [[ "$1" == "--toggle-mic" ]]; then + toggle_mic + elif [[ "$1" == "--get-icon" ]]; then + get_icon + elif [[ "$1" == "--get-mic-icon" ]]; then + get_mic_icon + elif [[ "$1" == "--mic-inc" ]]; then + inc_mic_volume + elif [[ "$1" == "--mic-dec" ]]; then + dec_mic_volume + else + get_volume + fi +} + + +# ScreenShot +screenshot() { + iDIR="$HOME/.config/swaync/icons" + notify_cmd_shot="notify-send -h string:x-canonical-private-synchronous:shot-notify -u low -i ${iDIR}/picture.png" + time=$(date "+%d-%b_%H-%M-%S") + dir="$(xdg-user-dir)/Pictures/Screenshots" + file="Screenshot_${time}_${RANDOM}.png" + active_window_path="${dir}/Screenshot_${time}_$(hyprctl -j activewindow | jq -r '(.class)').png" + + notify_view() { + local msg="Screenshot Saved." + [[ "$1" == "active" && ! -e "${active_window_path}" ]] && msg="Screenshot NOT Saved." + ${notify_cmd_shot} "$msg" + } + + countdown() { + for ((sec = $1; sec > 0; sec--)); do + notify-send -h string:x-canonical-private-synchronous:shot-notify -t 1000 -i "$iDIR"/timer.png "Taking shot in: $sec" + sleep 1 + done + } + + take_shot() { + cd "${dir}" && grim - | tee "$file" | wl-copy + sleep 2 + notify_view "$1" + } + + shotnow() { take_shot; } + shot_timer() { countdown "$1"; sleep 1 && take_shot; } + shot5() { shot_timer 5; } + shot10() { shot_timer 10; } + shotarea() { cd "${dir}" && grim -g "$(slurp)" - | tee "$file" | wl-copy && notify_view; } + shotactive() { hyprctl -j activewindow | jq -r '"\(.at[0]),\(.at[1]) \(.size[0])x\(.size[1])"' | grim -g - "${active_window_path}" && sleep 1 && notify_view "active"; } + + [[ ! -d "$dir" ]] && mkdir -p "$dir" + + case "$1" in + --now) shotnow ;; + --in5) shot5 ;; + --in10) shot10 ;; + --area) shotarea ;; + --active) shotactive ;; + *) echo -e "Available Options: --now --in5 --in10 --area --active" + esac + + exit 0 +} + + +# Brightness Controller +brightness() { + +iDIR="$HOME/.config/swaync/icons" +notification_timeout=1000 + +get_backlight() { + echo $(brightnessctl -m | cut -d, -f4) +} + +get_kbd_backlight() { + brightnessctl -d '*::kbd_backlight' -m | cut -d, -f4 | tr -d '%' +} + +get_icon() { + current=$(get_backlight | sed 's/%//') + [ "$current" -le "20" ] && icon="$iDIR/brightness-20.png" || + [ "$current" -le "40" ] && icon="$iDIR/brightness-40.png" || + [ "$current" -le "60" ] && icon="$iDIR/brightness-60.png" || + [ "$current" -le "80" ] && icon="$iDIR/brightness-80.png" || + icon="$iDIR/brightness-100.png" +} + +notify_user() { + notify-send -e -h string:x-canonical-private-synchronous:brightness_notif -h int:value:$current -u low -i "$icon" "Brightness: $current%" +} + +change_backlight() { + brightnessctl set "$1" && get_icon && notify_user +} + +change_kbd_backlight() { + brightnessctl -d '*::kbd_backlight' set "$1" && get_icon && notify_user +} + +case "$1" in + "--get") + get_backlight + ;; + "--inc") + change_backlight "+5%" + ;; + "--dec") + change_backlight "5%-" + ;; + "--get-kbd") + get_kbd_backlight + ;; + "--inc-kbd") + change_kbd_backlight "+30%" + ;; + "--dec-kbd") + change_kbd_backlight "30%-" + ;; + *) + get_backlight + ;; +esac +} + diff --git a/config/hypr/scripts/Ui_cmd.sh b/config/hypr/scripts/Ui_cmd.sh index c4c6409c..9884fc19 100755 --- a/config/hypr/scripts/Ui_cmd.sh +++ b/config/hypr/scripts/Ui_cmd.sh @@ -69,7 +69,7 @@ randomwall() { if [[ ${#PICS[@]} -gt 0 ]]; then RANDOMPICS=${PICS[RANDOM % ${#PICS[@]}]} # Select a random image swww img "${RANDOMPICS}" ${SWWW_PARAMS} # Set the randomly selected wallpaper - $linker + linker else echo "No images found in ${wallDIR}" fi @@ -84,7 +84,7 @@ autowall() { while true; do find "$wallDIR" -type f \( -name "*.jpg" -o -name "*.jpeg" -o -name "*.png" -o -name "*.gif" \) -print0 \ | shuf -z -n 1 \ - | xargs -0 -I {} swww img "{}" ${SWWW_PARAMS} && $linker + | xargs -0 -I {} swww img "{}" ${SWWW_PARAMS} && linker sleep $INTERVAL done @@ -113,7 +113,7 @@ selectwall() { choice=$(find "$wallDIR" -type f -maxdepth 1 -printf "%f\n" | shuf -n1) fi wallpaper="$wallDIR/${choice#*icon\x1f}" - swww img $SWWW_PARAMS1 "$wallpaper" && $linker + swww img $SWWW_PARAMS1 "$wallpaper" && linker else echo "No wallpaper selected. Exiting." exit 0 @@ -139,9 +139,15 @@ waybarl() { } apply_config() { ln -sf "$config_dir/$1" "$waybar_config" - pkill -x waybar && sleep 0.1 - $CMD & + restart_waybar_if_needed } +restart_waybar_if_needed() { + if pgrep -x "waybar" >/dev/null; then + pkill waybar + sleep 0.1 + fi + $RunCMD reload_waybar & +} main() { choice=$(menu | rofi -dmenu -p " Choose Waybar Layout") @@ -186,3 +192,64 @@ name=$(whoami) notify-send "Hello" "${name}?,you're back? welcome what will we do today!" } + +# Switch Keyboard Layout (ALT F1) +kb() { +if [ ! -f "$layout_f" ]; then + default_layout=$(grep 'kb_layout=' "$settings_file" | cut -d '=' -f 2 | cut -d ',' -f 1 2>/dev/null) + if [ -z "$default_layout" ]; then + default_layout="us" # Default to 'us' layout if Settings.conf or 'kb_layout' is not found + fi + echo "$default_layout" > "$layout_f" +fi +current_layout=$(cat "$layout_f") +if [ -f "$settings_file" ]; then # Read keyboard layout settings from Settings.conf + kb_layout_line=$(grep 'kb_layout=' "$settings_file" | cut -d '=' -f 2) + IFS=',' read -ra layout_mapping <<< "$kb_layout_line" +fi +layout_count=${#layout_mapping[@]} +for ((i = 0; i < layout_count; i++)); do # Find the index of the current layout in the mapping + if [ "$current_layout" == "${layout_mapping[i]}" ]; then + current_index=$i + break + fi +done +next_index=$(( (current_index + 1) % layout_count )) # Calculate the index of the next layout +new_layout="${layout_mapping[next_index]}" +hyprctl keyword input:kb_layout "$new_layout" # Update the keyboard layout +echo "$new_layout" > "$layout_f" +notify-send -u low -i "$notif" "Keyboad Layout Changed to $new_layout" +} + +linker() { + # Define the path to the swww cache directory +cache_dir="$HOME/.cache/swww/" + +# Get a list of monitor outputs +monitor_outputs=("$cache_dir"/*) + +# Initialize a flag to determine if the ln command was executed +ln_success=false + +# Loop through monitor outputs +for cache_file in "${monitor_outputs[@]}"; do + # Check if the cache file exists for the current monitor output + if [ -f "$cache_file" ]; then + # Get the wallpaper path from the cache file + wallpaper_path=$(<"$cache_file") + + # Copy the wallpaper to the location Rofi can access + if ln -sf "$wallpaper_path" "$HOME/.config/rofi/.current_wallpaper"; then + ln_success=true # Set the flag to true upon successful execution + break # Exit the loop after processing the first found monitor output + fi + fi +done + +# Add a message indicating whether the ln command was successful +if $ln_success; then + echo "Wallpaper linked successfully." +else + echo "Failed to link wallpaper." +fi +} diff --git a/config/hypr/scripts/Volume.sh b/config/hypr/scripts/Volume.sh deleted file mode 100755 index a2457771..00000000 --- a/config/hypr/scripts/Volume.sh +++ /dev/null @@ -1,137 +0,0 @@ -#!/bin/bash - -# Scripts for volume controls for audio and mic - -iDIR="$HOME/.config/swaync/icons" - -# Get Volume -get_volume() { - volume=$(pamixer --get-volume) - if [[ "$volume" -eq "0" ]]; then - echo "Muted" - else - echo "$volume%" - fi -} - -# Get icons -get_icon() { - current=$(get_volume) - if [[ "$current" == "Muted" ]]; then - echo "$iDIR/volume-mute.png" - elif [[ "${current%\%}" -le 30 ]]; then - echo "$iDIR/volume-low.png" - elif [[ "${current%\%}" -le 60 ]]; then - echo "$iDIR/volume-mid.png" - else - echo "$iDIR/volume-high.png" - fi -} - -# Notify -notify_user() { - if [[ "$(get_volume)" == "Muted" ]]; then - notify-send -e -h string:x-canonical-private-synchronous:volume_notif -u low -i "$(get_icon)" "Volume: Muted" - else - notify-send -e -h int:value:"$(get_volume | sed 's/%//')" -h string:x-canonical-private-synchronous:volume_notif -u low -i "$(get_icon)" "Volume: $(get_volume)" - fi -} - -# Increase Volume -inc_volume() { - if [ "$(pamixer --get-mute)" == "true" ]; then - pamixer -u && notify_user - fi - pamixer -i 5 && notify_user -} - -# Decrease Volume -dec_volume() { - if [ "$(pamixer --get-mute)" == "true" ]; then - pamixer -u && notify_user - fi - pamixer -d 5 && notify_user -} - -# Toggle Mute -toggle_mute() { - if [ "$(pamixer --get-mute)" == "false" ]; then - pamixer -m && notify-send -e -u low -i "$iDIR/volume-mute.png" "Volume Switched OFF" - elif [ "$(pamixer --get-mute)" == "true" ]; then - pamixer -u && notify-send -e -u low -i "$(get_icon)" "Volume Switched ON" - fi -} - -# Toggle Mic -toggle_mic() { - if [ "$(pamixer --default-source --get-mute)" == "false" ]; then - pamixer --default-source -m && notify-send -e -u low -i "$iDIR/microphone-mute.png" "Microphone Switched OFF" - elif [ "$(pamixer --default-source --get-mute)" == "true" ]; then - pamixer -u --default-source u && notify-send -e -u low -i "$iDIR/microphone.png" "Microphone Switched ON" - fi -} -# Get Mic Icon -get_mic_icon() { - current=$(pamixer --default-source --get-volume) - if [[ "$current" -eq "0" ]]; then - echo "$iDIR/microphone-mute.png" - else - echo "$iDIR/microphone.png" - fi -} - -# Get Microphone Volume -get_mic_volume() { - volume=$(pamixer --default-source --get-volume) - if [[ "$volume" -eq "0" ]]; then - echo "Muted" - else - echo "$volume%" - fi -} - -# Notify for Microphone -notify_mic_user() { - volume=$(get_mic_volume) - icon=$(get_mic_icon) - notify-send -e -h int:value:"$volume" -h "string:x-canonical-private-synchronous:volume_notif" -u low -i "$icon" "Mic-Level: $volume" -} - -# Increase MIC Volume -inc_mic_volume() { - if [ "$(pamixer --default-source --get-mute)" == "true" ]; then - pamixer --default-source -u && notify_mic_user - fi - pamixer --default-source -i 5 && notify_mic_user -} - -# Decrease MIC Volume -dec_mic_volume() { - if [ "$(pamixer --default-source --get-mute)" == "true" ]; then - pamixer --default-source -u && notify_mic_user - fi - pamixer --default-source -d 5 && notify_mic_user -} - -# Execute accordingly -if [[ "$1" == "--get" ]]; then - get_volume -elif [[ "$1" == "--inc" ]]; then - inc_volume -elif [[ "$1" == "--dec" ]]; then - dec_volume -elif [[ "$1" == "--toggle" ]]; then - toggle_mute -elif [[ "$1" == "--toggle-mic" ]]; then - toggle_mic -elif [[ "$1" == "--get-icon" ]]; then - get_icon -elif [[ "$1" == "--get-mic-icon" ]]; then - get_mic_icon -elif [[ "$1" == "--mic-inc" ]]; then - inc_mic_volume -elif [[ "$1" == "--mic-dec" ]]; then - dec_mic_volume -else - get_volume -fi diff --git a/config/hypr/scripts/Widget.sh b/config/hypr/scripts/Widget.sh deleted file mode 100755 index 9858bc44..00000000 --- a/config/hypr/scripts/Widget.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/usr/bin/env bash - -# Source the configuration file. -CONFIG_FILE=~/.config/hypr/scripts/Ref.sh -source "$CONFIG_FILE" - -panel(){ -# Theme Elements -prompt='Panel' - -list_col='2' -list_row='2' -win_width='450px' - -# Options -bluetooth_status=$(bluetoothctl show | awk '/Powered:/ {print $2}') -bluetooth_icon="" -[ "$bluetooth_status" = "yes" ] && bluetooth_icon="" - -wifi_status=$(nmcli radio wifi) -wifi_icon="" -[ "$wifi_status" = "enabled" ] && wifi_icon="" - -layout=$(grep 'USE_ICON' "$theme" | cut -d'=' -f2) -if [[ "$layout" == 'NO' ]]; then - option_1="" - option_2="" - option_3="" - option_4="" -else - option_1=" ${wifi_icon}" # Wifi - option_2=" ⏸" # Play pause - option_3=" ${bluetooth_icon}" # Bluetooth - option_4="" # Settings -fi - -# Rofi CMD -rofi_cmd() { - rofi -theme-str "window {width: $win_width;}" \ - -theme-str "listview {columns: $list_col; lines: $list_row;}" \ - -theme-str 'textbox-prompt-colon {str: " ";}' \ - -dmenu -p "$prompt" -markup-rows -theme "$theme" -hover-select -} - -# Pass variables to rofi dmenu -run_rofi() { - echo -e "$option_1\n$option_2\n$option_3\n$option_4" | rofi_cmd -} - -# Execute Command -run_cmd() { - case $1 in - '--opt1') $SCRIPTSDIR/RunCMD.sh wifi ;; - '--opt2') playerctl play-pause ;; - '--opt3') $SCRIPTSDIR/RunCMD.sh bluetooth ;; - '--opt4') $SCRIPTSDIR/RunCMD.sh panelsetting ;; - esac -} - -# 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 ;; -esac -} - -panelsetting(){ -# Theme Elements -prompt='Panel Settings' - - -list_col='2' -list_row='2' -win_width='450px' - -# Options - -layout=`cat ${theme} | grep 'USE_ICON' | cut -d'=' -f2` -if [[ "$layout" == 'NO' ]]; then - option_1="" - option_2="" - option_3="" - option_4="" -else - option_1="" # Wifi - option_2="" # Back - option_3="" # Bluetooth - option_4="" # Hyprconf -fi - -# Rofi CMD -rofi_cmd() { - rofi \ - -theme-str "window {width: $win_width;}" \ - -theme-str "listview {columns: $list_col; lines: $list_row;}" \ - -theme-str 'textbox-prompt-colon {str: " ";}' \ - -dmenu \ - -p "$prompt" \ - -markup-rows \ - -theme ${theme} \ - -hover-select -} - -# Pass variables to rofi dmenu -run_rofi() { - echo -e "$option_1\n$option_2\n$option_3\n$option_4" | rofi_cmd -} - -# Execute Command -run_cmd() { - if [[ "$1" == '--opt1' ]]; then - kitty nmtui - elif [[ "$1" == '--opt2' ]]; then - $SCRIPTSDIR/RunCMD.sh panel - elif [[ "$1" == '--opt3' ]]; then - blueberry - elif [[ "$1" == '--opt4' ]]; then - $SCRIPTSDIR/RunCMD.sh edit - 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 - ;; -esac -} diff --git a/config/hypr/scripts/Xmenu.sh b/config/hypr/scripts/Xmenu.sh index d707f420..44d839a3 100755 --- a/config/hypr/scripts/Xmenu.sh +++ b/config/hypr/scripts/Xmenu.sh @@ -4,8 +4,6 @@ iDIR="$HOME/.config/swaync/icons" scriptsDir="$HOME/.config/hypr/scripts" RunCMD="$scriptsDir/RunCMD.sh" -yes='Yes' -no='No' # Note: You can add more options below with the following format: # ["TITLE"]="link" @@ -16,22 +14,24 @@ declare -A menu_options=( #waybar ["wbt ToggleWaybar"]="killall -SIGUSR1 waybar" ["wbl WaybarLayout"]="$RunCMD waybarl" + ["wbr Reload Waybar"]="$RunCMD reload_waybar" + ["wbu Update Waybar"]="$RunCMD update_waybar" #hypr - ["hpr Reload hyprland"]="hyprctl reload" + ["hpr Reload hyprland"]="$RunCMD reload_hypr" + ["rld Reload All"]="$RunCMD reloadall" ["cl ChangeLayout"]="$RunCMD layout" - ["rld Reload All"]="$RunCMD reload" ["gm GameMode"]="$RunCMD gamemode" ["bl ChangeBlur"]="$RunCMD blur" ["flt Float all window"]="hyprctl dispatch workspaceopt allfloat" - ["wop1 enable_opaque"]="$RunCMD enable_opaque" - ["wop0 disable_opaque"]="$RunCMD disable_opaque" + ["op1 enable_opaque"]="$RunCMD enable_opaque" + ["op0 disable_opaque"]="$RunCMD disable_opaque" #wallpaper ["ws Wallpaper Select"]="$RunCMD selectwall" ["wc Random Wallpaper"]="$RunCMD randomwall" #RunCMD ["; Launcher"]="rofi -show drun -modi drun,filebrowser,run,window -theme $HOME/.config/rofi/launcher.rasi" ["cb Clipboard"]="$RunCMD clip" - ["rm RunCMDMusic"]="$scriptsDir/Music_cmd.sh -m" + ["rmc RunCMDMusic"]="$RunCMD music -m" ["emj RunCMDEmoji"]="$RunCMD emoji" ["cc Calculator"]="$RunCMD calc" ["td Todo"]="$RunCMD todo" @@ -40,8 +40,8 @@ declare -A menu_options=( ["kb Kebinds"]="$RunCMD keybind" ["qe Edits"]="$RunCMD edit" #System - ["QQ Shutdown"]="needConfim "poweroff"" - ["RR Reboot"]="needConfim "reboot"" + ["qq Shutdown"]="$RunCMD sys_poweroff" + ["rr Reboot"]="$RunCMD sys_reboot" ["pm Powermenu"]="$RunCMD powermenu" ["cn Close Notifactions"]="swaync-client -C" ["dm0"]="$RunCMD enable_edp1" @@ -58,35 +58,6 @@ declare -A menu_options=( ["cd Codium"]="codium" ) -# Function for displaying notifications -notification() { - notify-send -e -u low "$@" -} - -confirm_cmd() { - rofi -theme-str 'window {location: center; anchor: center; fullscreen: false; width: 250px;}' \ - -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;}' \ - -kb-accept-entry 'Return,space' \ - -dmenu \ - -p 'Confirmation' \ - -mesg 'Are you Sure?' - # -theme ${dir}/${theme}.rasi -} - -# Ask for confirmation -confirm_exit() { - echo -e "$no\n$yes" | confirm_cmd -} -needConfim() { - selected="$(confirm_exit)" - if [[ "$selected" == "$yes" ]]; then - $1 - fi -} -# myt="$(notification number)" # Main function main() { choice=$( @@ -104,8 +75,6 @@ main() { link="${menu_options[$choice]}" $link - # notification "$choice" - # test_cmd } main diff --git a/config/rofi/config-panel.rasi b/config/rofi/config-panel.rasi deleted file mode 100644 index 808e98f8..00000000 --- a/config/rofi/config-panel.rasi +++ /dev/null @@ -1,178 +0,0 @@ -/** - * - * Author : Aditya Shakya (adi1090x) - * Github : @adi1090x - * - * Rofi Theme File - * Rofi Version: 1.7.3 - **/ - -/*****----- Configuration -----*****/ -configuration { - show-icons: false; -} - -/*****----- Global Properties -----*****/ -* { - font: "JetBrains Mono Nerd Font 10"; - background: #1E1D2FFF; - background-alt: #282839FF; - foreground: #D9E0EEFF; - selected: #7AA2F7FF; - active: #ABE9B3FF; - urgent: #F28FADFF; -} - -/* -USE_BUTTONS=YES -*/ - -/*****----- Main Window -----*****/ -window { - /* properties for window widget */ - transparency: "real"; - location: center; - anchor: center; - fullscreen: false; - width: 115px; - x-offset: -15px; - y-offset: 0px; - - /* properties for all widgets */ - enabled: true; - margin: 0px; - padding: 0px; - border: 2px; - border-radius: 10px; - border-color: @selected; - cursor: "default"; - background-color: @background; -} - -/*****----- Main Box -----*****/ -mainbox { - enabled: true; - spacing: 15px; - margin: 0px; - padding: 15px; - border: 0px solid; - border-radius: 10px; - border-color: @selected; - background-color: transparent; - children: [ "listview" ]; - background-image: url("~/.config/rofi/.current_wallpaper", width); -} - -/*****----- Inputbar -----*****/ -inputbar { - enabled: true; - spacing: 0px; - margin: 0px; - padding: 0px; - border: 0px; - border-radius: 10px; - border-color: @selected; - background-color: transparent; - text-color: @foreground; - children: [ "textbox-prompt-colon", "prompt"]; -} - -dummy { - background-color: transparent; -} - -textbox-prompt-colon { - enabled: true; - expand: false; - str: ""; - padding: 12px 16px; - border-radius: 10px; - background-color: @urgent; - text-color: @background; -} -prompt { - enabled: true; - padding: 12px; - border-radius: 10px; - background-color: @active; - text-color: @background; -} - -/*****----- Message -----*****/ -message { - enabled: true; - margin: 0px; - padding: 12px; - border: 0px solid; - border-radius: 10px; - border-color: @selected; - background-color: @background-alt; - text-color: @foreground; -} -textbox { - background-color: inherit; - text-color: inherit; - vertical-align: 0.5; - horizontal-align: 0.5; - placeholder-color: @foreground; - blink: true; - markup: true; -} -error-message { - padding: 12px; - border: 0px solid; - border-radius: 10px; - border-color: @selected; - background-color: @background; - text-color: @foreground; -} - -/*****----- Listview -----*****/ -listview { - enabled: true; - columns: 1; - lines: 5; - cycle: true; - dynamic: true; - scrollbar: false; - layout: vertical; - reverse: false; - fixed-height: true; - fixed-columns: true; - - spacing: 15px; - margin: 0px; - padding: 0px; - border: 0px solid; - border-radius: 10px; - border-color: @selected; - background-color: transparent; - text-color: @foreground; - cursor: "default"; -} - -/*****----- Elements -----*****/ -element { - enabled: true; - spacing: 0px; - margin: 0px; - padding: 20px 0px; - border: 0px solid; - border-radius: 10px; - border-color: @selected; - background-color: transparent; - text-color: @foreground; - cursor: pointer; -} -element-text { - font: "feather bold 24"; - background-color: transparent; - text-color: inherit; - cursor: inherit; - vertical-align: 0.5; - horizontal-align: 0.5; -} -element selected.normal { - background-color: var(selected); - text-color: var(background); -} diff --git a/config/waybar/config b/config/waybar/config index d244b1ad..72fca87a 120000 --- a/config/waybar/config +++ b/config/waybar/config @@ -1 +1 @@ -/home/sankalp/.config/waybar/configs/[BOT] gardenia \ No newline at end of file +/home/sankalp/.config/waybar/configs/[TOP & BOT] summitsplit \ No newline at end of file diff --git a/config/waybar/modules b/config/waybar/modules index 6fc4f158..8e43ab1c 100644 --- a/config/waybar/modules +++ b/config/waybar/modules @@ -174,8 +174,8 @@ "on-click-middle": "", "on-click-right": "", "on-update": "", - "on-scroll-up": "~/.config/hypr/scripts/Brightness.sh --inc", - "on-scroll-down": "~/.config/hypr/scripts/Brightness.sh --dec", + "on-scroll-up": "~/.config/hypr/scripts/RunCMD.sh brightness --inc", + "on-scroll-down": "~/.config/hypr/scripts/RunCMD.sh brightness --dec", "smooth-scrolling-threshold": 1, }, @@ -367,10 +367,10 @@ "ignored-sinks": ["Easy Effects Sink"], }, "scroll-step": 5.0, - "on-click": "~/.config/hypr/scripts/Volume.sh --toggle", + "on-click": "~/.config/hypr/scripts/RunCMD.sh volume --toggle", "on-click-right": "pavucontrol -t 3", - "on-scroll-up": "~/.config/hypr/scripts/Volume.sh --inc", - "on-scroll-down": "~/.config/hypr/scripts/Volume.sh --dec", + "on-scroll-up": "~/.config/hypr/scripts/RunCMD.sh volume --inc", + "on-scroll-down": "~/.config/hypr/scripts/RunCMD.sh volume --dec", "smooth-scrolling-threshold": 1, "tooltip-format": "{volume}%", }, @@ -379,10 +379,10 @@ "format": "{format_source}", "format-source": " {volume}%", "format-source-muted": "", - "on-click": "~/.config/hypr/scripts/Volume.sh --toggle-mic", + "on-click": "~/.config/hypr/scripts/RunCMD.sh volume --toggle-mic", "on-click-right": "pavucontrol -t 4", - "on-scroll-up": "~/.config/hypr/scripts/Volume.sh --mic-inc", - "on-scroll-down": "~/.config/hypr/scripts/Volume.sh --mic-dec", + "on-scroll-up": "~/.config/hypr/scripts/RunCMD.sh volume --mic-inc", + "on-scroll-down": "~/.config/hypr/scripts/RunCMD.sh volume --mic-dec", "tooltip-format":"{source_volume}%", "scroll-step": 5, }, @@ -395,10 +395,10 @@ "wireplumber": { "format": "{icon} {volume} %", "format-muted": " Mute", - "on-click": "~/.config/hypr/scripts/Volume.sh --toggle", + "on-click": "~/.config/hypr/scripts/RunCMD.sh volume --toggle", "on-click-right": "pavucontrol -t 3", - "on-scroll-up": "~/.config/hypr/scripts/Volume.sh --inc", - "on-scroll-down": "~/.config/hypr/scripts/Volume.sh --dec", + "on-scroll-up": "~/.config/hypr/scripts/RunCMD.sh volume --inc", + "on-scroll-down": "~/.config/hypr/scripts/RunCMD.sh volume --dec", "format-icons": ["", "", "󰕾", ""], }, @@ -410,8 +410,8 @@ "on-click-middle": "playerctl previous", "on-click-right": "playerctl next", "scroll-step": 5.0, - "on-scroll-up": "~/.config/hypr/scripts/Volume.sh --inc", - "on-scroll-down": "~/.config/hypr/scripts/Volume.sh --dec", + "on-scroll-up": "~/.config/hypr/scripts/RunCMD.sh volume --inc", + "on-scroll-down": "~/.config/hypr/scripts/RunCMD.sh volume --dec", "smooth-scrolling-threshold": 1, "player-icons": { "chromium": "", @@ -621,8 +621,8 @@ "on-click-middle": "", "on-click-right": "", "on-update": "", - "on-scroll-up": "~/.config/hypr/scripts/Brightness.sh --inc", - "on-scroll-down": "~/.config/hypr/scripts/Brightness.sh --dec", + "on-scroll-up": "~/.config/hypr/scripts/RunCMD.sh brightness --inc", + "on-scroll-down": "~/.config/hypr/scripts/RunCMD.sh brightness --dec", "smooth-scrolling-threshold": 1, "tooltip-format": "{percent}%", }, @@ -677,10 +677,10 @@ "ignored-sinks": ["Easy Effects Sink"], }, "scroll-step": 5.0, - "on-click": "~/.config/hypr/scripts/Volume.sh --toggle", + "on-click": "~/.config/hypr/scripts/RunCMD.sh volume --toggle", "on-click-right": "pavucontrol -t 3", - "on-scroll-up": "~/.config/hypr/scripts/Volume.sh --inc", - "on-scroll-down": "~/.config/hypr/scripts/Volume.sh --dec", + "on-scroll-up": "~/.config/hypr/scripts/RunCMD.sh volume --inc", + "on-scroll-down": "~/.config/hypr/scripts/RunCMD.sh volume --dec", "tooltip-format":"{volume}%", "smooth-scrolling-threshold": 1, }, @@ -690,9 +690,9 @@ "format-source": "󰍬", "format-source-muted": "󰍭", "on-click-right": "pavucontrol", - "on-click": "~/.config/hypr/scripts/Volume.sh --toggle-mic", - "on-scroll-up": "~/.config/hypr/scripts/Volume.sh --mic-inc", - "on-scroll-down": "~/.config/hypr/scripts/Volume.sh --mic-dec", + "on-click": "~/.config/hypr/scripts/RunCMD.sh volume --toggle-mic", + "on-scroll-up": "~/.config/hypr/scripts/RunCMD.sh volume --mic-inc", + "on-scroll-down": "~/.config/hypr/scripts/RunCMD.sh volume --mic-dec", "max-volume": 100, "tooltip": true, "tooltip-format": "{volume}%", @@ -703,7 +703,7 @@ "custom/power_vertical": { "format": "⏻", "exec": "echo ; echo 󰟡 power // blur", - "on-click-right": "~/.config/hypr/scripts/ChangeBlur.sh", + "on-click-right": "~/.config/hypr/scripts/RunCMD.sh blur", "on-click":"~/.config/hypr/scripts/RunCMD.sh powermenu", "interval": 86400, // once every day "tooltip": false,