Huge Update
This commit is contained in:
1 parent
0867aa7fca
commit
6cbe2a886f
19 files changed
+551
-846
No files matched your search
@@ -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
|
||||
@@ -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]}"\"}"
|
||||
}
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
Executable
+336
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
@@ -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
|
||||
@@ -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
|
||||
}
|
||||
@@ -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
|
||||
Reference in new issue
Block a user