feat(scripts): Removed Scripts which I don't use.
This commit is contained in:
1 parent
72b6efc817
commit
a05fbd8b2d
8 files changed
+303
-361
No files matched your search
@@ -30,14 +30,10 @@ exec-once = udiskie &
|
|||||||
#exec-once = blueman-applet &
|
#exec-once = blueman-applet &
|
||||||
exec-once = bluetoothctl power off &
|
exec-once = bluetoothctl power off &
|
||||||
|
|
||||||
#clipboard manager
|
# clipboard manager
|
||||||
exec-once = wl-paste --type text --watch cliphist store
|
exec-once = wl-paste --type text --watch cliphist store
|
||||||
exec-once = wl-paste --type image --watch cliphist store
|
exec-once = wl-paste --type image --watch cliphist store
|
||||||
|
|
||||||
|
|
||||||
# Welcome Message
|
|
||||||
#exec-once = $RunCMD welcome
|
|
||||||
|
|
||||||
# Rainbow borders
|
# Rainbow borders
|
||||||
#exec-once = $RunCMD rainbow_border
|
#exec-once = $RunCMD rainbow_border
|
||||||
|
|
||||||
|
|||||||
@@ -43,10 +43,7 @@ bind = ALT, E, exec, $RunCMD edit
|
|||||||
bind = $mainMod, W, exec, $RunCMD select_wall
|
bind = $mainMod, W, exec, $RunCMD select_wall
|
||||||
bind = SHIFT_ALT,W, exec, $RunCMD random_wall
|
bind = SHIFT_ALT,W, exec, $RunCMD random_wall
|
||||||
bind = $mainMod, F1, exec, $RunCMD keybind
|
bind = $mainMod, F1, exec, $RunCMD keybind
|
||||||
bind = ALT_SHIFT, T, exec, $RunCMD todo
|
|
||||||
bind = ALT, T, exec, $RunCMD tmux
|
bind = ALT, T, exec, $RunCMD tmux
|
||||||
bind = ALT, B, exec, $RunCMD note
|
|
||||||
bind = ALT, C, exec, $RunCMD calc
|
|
||||||
bind = $mainMod, R, exec, $RunCMD sr
|
bind = $mainMod, R, exec, $RunCMD sr
|
||||||
bind = $mainMod_SHIFT, N, exec, swaync-client -C
|
bind = $mainMod_SHIFT, N, exec, swaync-client -C
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,12 @@ CONFIG_FILE=~/.config/hypr/scripts/Ref.sh
|
|||||||
source "$CONFIG_FILE"
|
source "$CONFIG_FILE"
|
||||||
|
|
||||||
|
|
||||||
# Toggle touchpad state. (SUPER SHIFT D)
|
######################################
|
||||||
|
# #
|
||||||
|
# Toggle touchpad state #
|
||||||
|
# #
|
||||||
|
######################################
|
||||||
|
|
||||||
toggle_touchpad() {
|
toggle_touchpad() {
|
||||||
local status_file="$STATUS_FILE"
|
local status_file="$STATUS_FILE"
|
||||||
local action
|
local action
|
||||||
@@ -22,8 +27,12 @@ toggle_touchpad() {
|
|||||||
hyprctl keyword "device:$HYPRLAND_DEVICE:enabled" "$(cat "$status_file")"
|
hyprctl keyword "device:$HYPRLAND_DEVICE:enabled" "$(cat "$status_file")"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
######################################
|
||||||
|
# #
|
||||||
|
# Toggle wifi state #
|
||||||
|
# #
|
||||||
|
######################################
|
||||||
|
|
||||||
# Toggle Wifi
|
|
||||||
toggle_wifi() {
|
toggle_wifi() {
|
||||||
wifi_status=$(nmcli radio wifi)
|
wifi_status=$(nmcli radio wifi)
|
||||||
if [ "$wifi_status" == "enabled" ]; then
|
if [ "$wifi_status" == "enabled" ]; then
|
||||||
@@ -35,7 +44,12 @@ toggle_wifi() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Toggle Bluetooth
|
######################################
|
||||||
|
# #
|
||||||
|
# Toggle bluetooth state #
|
||||||
|
# #
|
||||||
|
######################################
|
||||||
|
|
||||||
toggle_bluetooth() {
|
toggle_bluetooth() {
|
||||||
if [ "$bluetooth_status" == "no" ]; then
|
if [ "$bluetooth_status" == "no" ]; then
|
||||||
bluetoothctl power on
|
bluetoothctl power on
|
||||||
@@ -46,6 +60,12 @@ toggle_bluetooth() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
######################################
|
||||||
|
# #
|
||||||
|
# Enable/Disable Monitor #
|
||||||
|
# #
|
||||||
|
######################################
|
||||||
|
|
||||||
disable_edp1() {
|
disable_edp1() {
|
||||||
enable_edp1
|
enable_edp1
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
######################################
|
||||||
|
# #
|
||||||
|
# Music #
|
||||||
|
# #
|
||||||
|
######################################
|
||||||
|
|
||||||
music(){
|
music(){
|
||||||
# Directory for icons
|
# Directory for icons
|
||||||
iDIR="$HOME/.config/swaync/icons"
|
iDIR="$HOME/.config/swaync/icons"
|
||||||
@@ -42,7 +48,12 @@ play_music() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function for music controls
|
######################################
|
||||||
|
# #
|
||||||
|
# Music Control #
|
||||||
|
# #
|
||||||
|
######################################
|
||||||
|
|
||||||
music_controls() {
|
music_controls() {
|
||||||
local choice="$1"
|
local choice="$1"
|
||||||
|
|
||||||
@@ -78,7 +89,6 @@ play_pause() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Main function
|
|
||||||
# Main function
|
# Main function
|
||||||
main() {
|
main() {
|
||||||
local is_music_playing=$(playerctl --player=mpv status 2>/dev/null)
|
local is_music_playing=$(playerctl --player=mpv status 2>/dev/null)
|
||||||
@@ -93,6 +103,11 @@ main() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
######################################
|
||||||
|
# #
|
||||||
|
# Usage #
|
||||||
|
# #
|
||||||
|
######################################
|
||||||
|
|
||||||
while getopts "midnpks" flag; do
|
while getopts "midnpks" flag; do
|
||||||
case "${flag}" in
|
case "${flag}" in
|
||||||
|
|||||||
+82
-200
@@ -6,23 +6,12 @@ CONFIG_FILE=~/.config/hypr/scripts/Ref.sh
|
|||||||
source "$CONFIG_FILE"
|
source "$CONFIG_FILE"
|
||||||
|
|
||||||
|
|
||||||
# Todo List (SHIFT ALT T)
|
######################################
|
||||||
todo() {
|
# #
|
||||||
while cmd=$(rofi -dmenu -p "$prompt" -lines "$height" "$@" < "$file"); [ -n "$cmd" ]; do
|
# Calculator #
|
||||||
if grep -q "^$cmd\$" "$file"; then
|
# #
|
||||||
grep -v "^$cmd\$" "$file" > "$file.$$"
|
######################################
|
||||||
mv "$file.$$" "$file"
|
|
||||||
((height--))
|
|
||||||
else
|
|
||||||
echo "$cmd" >> "$file"
|
|
||||||
((height++))
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
exit 0
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# Function For Calculator (ALT C)
|
|
||||||
calc() {
|
calc() {
|
||||||
roficmd="rofi -dmenu -p Calc $@"
|
roficmd="rofi -dmenu -p Calc $@"
|
||||||
|
|
||||||
@@ -37,8 +26,12 @@ calc() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
######################################
|
||||||
|
# #
|
||||||
|
# Tmux Session #
|
||||||
|
# #
|
||||||
|
######################################
|
||||||
|
|
||||||
# Funtion for Tmux Sessions (ALT t)
|
|
||||||
tmux(){
|
tmux(){
|
||||||
tmux_sessions() {
|
tmux_sessions() {
|
||||||
tmux list-sessions | sed 's/: /| /' | column -t -s'|' -o' | '
|
tmux list-sessions | sed 's/: /| /' | column -t -s'|' -o' | '
|
||||||
@@ -74,96 +67,12 @@ main() {
|
|||||||
main
|
main
|
||||||
}
|
}
|
||||||
|
|
||||||
|
######################################
|
||||||
|
# #
|
||||||
|
# Clipboard Manager #
|
||||||
|
# #
|
||||||
|
######################################
|
||||||
|
|
||||||
# Take note (ALT B)
|
|
||||||
note() {
|
|
||||||
if [[ ! -d "${NOTES_FOLDER}" ]]; then
|
|
||||||
mkdir -p "$NOTES_FOLDER"
|
|
||||||
fi
|
|
||||||
get_notes() {
|
|
||||||
ls "${NOTES_FOLDER}"
|
|
||||||
}
|
|
||||||
edit_note() {
|
|
||||||
note_location=$1
|
|
||||||
$NOTES_EDITOR "$note_location"
|
|
||||||
}
|
|
||||||
delete_note() {
|
|
||||||
local note=$1
|
|
||||||
local action=$(echo -e "Yes\nNo" | rofi -dmenu -p "Are you sure you want to delete $note? ")
|
|
||||||
case $action in
|
|
||||||
"Yes")
|
|
||||||
rm "$NOTES_FOLDER/$note"
|
|
||||||
main
|
|
||||||
;;
|
|
||||||
"No")
|
|
||||||
main
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
note_context() {
|
|
||||||
local note=$1
|
|
||||||
local note_location="$NOTES_FOLDER/$note"
|
|
||||||
local action=$(echo -e "Edit\nDelete" | rofi -dmenu -p "$note > ")
|
|
||||||
case $action in
|
|
||||||
"Edit")
|
|
||||||
edit_note "$note_location"
|
|
||||||
exit 0;;
|
|
||||||
"Delete")
|
|
||||||
delete_note "$note"
|
|
||||||
exit 0;;
|
|
||||||
esac
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
new_note() {
|
|
||||||
local title=$(echo -e "Cancel" | rofi -dmenu -p "Input title: ")
|
|
||||||
|
|
||||||
case "$title" in
|
|
||||||
"Cancel")
|
|
||||||
main
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
local file=$(echo "$title" | sed 's/ /_/g;s/\(.*\)/\L\1/g')
|
|
||||||
local template=$(cat <<- END
|
|
||||||
---
|
|
||||||
title: $title
|
|
||||||
date: $(date --rfc-3339=seconds)
|
|
||||||
author: $AUTHOR
|
|
||||||
---
|
|
||||||
|
|
||||||
# $title
|
|
||||||
END
|
|
||||||
)
|
|
||||||
note_location="$NOTES_FOLDER/$file.md"
|
|
||||||
if [ "$title" != "" ]; then
|
|
||||||
echo "$template" > "$note_location" | edit_note "$note_location"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
main()
|
|
||||||
{
|
|
||||||
local all_notes="$(get_notes)"
|
|
||||||
local first_menu="New"
|
|
||||||
if [ "$all_notes" ];then
|
|
||||||
first_menu="New\n${all_notes}"
|
|
||||||
fi
|
|
||||||
local note=$(echo -e "$first_menu" | rofi -dmenu -p " Notes")
|
|
||||||
case $note in
|
|
||||||
"New")
|
|
||||||
new_note
|
|
||||||
;;
|
|
||||||
"")
|
|
||||||
exit 1;;
|
|
||||||
*)
|
|
||||||
note_context "$note" && exit 0 # handle esc key in note_context
|
|
||||||
esac
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
main
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# Clipboard Manager. This script uses cliphist, rofi, and wl-copy. (SHIFT ALT C)
|
|
||||||
clip() {
|
clip() {
|
||||||
while true; do
|
while true; do
|
||||||
result=$(rofi -dmenu -kb-custom-1 "Control-Delete" -kb-custom-2 "Alt-Delete" -p "CTRL Del - Cliphist del || Alt Del - cliphist wipe" -config ~/.config/rofi/config-long.rasi < <(cliphist list))
|
result=$(rofi -dmenu -kb-custom-1 "Control-Delete" -kb-custom-2 "Alt-Delete" -p "CTRL Del - Cliphist del || Alt Del - cliphist wipe" -config ~/.config/rofi/config-long.rasi < <(cliphist list))
|
||||||
@@ -178,7 +87,12 @@ clip() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Rofi menu for Quick Edit / View of Settings (SUPER E)
|
######################################
|
||||||
|
# #
|
||||||
|
# Quick Edit #
|
||||||
|
# #
|
||||||
|
######################################
|
||||||
|
|
||||||
edit() {
|
edit() {
|
||||||
menu() {
|
menu() {
|
||||||
options=("Env-variables" "Window-Rules" "Startup_Apps" "User-Keybinds" "Monitors" "Laptop-Keybinds" "User-Settings" "Default-Settings" "Default-Keybinds")
|
options=("Env-variables" "Window-Rules" "Startup_Apps" "User-Keybinds" "Monitors" "Laptop-Keybinds" "User-Settings" "Default-Settings" "Default-Keybinds")
|
||||||
@@ -195,7 +109,12 @@ edit() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Powermenu (SUPER X)
|
######################################
|
||||||
|
# #
|
||||||
|
# Powermenu #
|
||||||
|
# #
|
||||||
|
######################################
|
||||||
|
|
||||||
powermenu() {
|
powermenu() {
|
||||||
uptime_info=$(uptime -p | sed -e 's/up //g')
|
uptime_info=$(uptime -p | sed -e 's/up //g')
|
||||||
host=$(hostnamectl hostname)
|
host=$(hostnamectl hostname)
|
||||||
@@ -223,35 +142,48 @@ powermenu() {
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
# Keybinds (SUPER F1 )
|
######################################
|
||||||
|
# #
|
||||||
|
# Keybinds #
|
||||||
|
# #
|
||||||
|
######################################
|
||||||
|
|
||||||
keybind() {
|
keybind() {
|
||||||
CONFIG=$(rofi -show file-browser-extended -file-browser-stdout -file-browser-dir "$HOME"/.config/keyb/bindings -config ~/.config/rofi/config-long.rasi)
|
CONFIG=$(rofi -show file-browser-extended -file-browser-stdout -file-browser-dir "$HOME"/.config/keyb/bindings -config ~/.config/rofi/config-long.rasi)
|
||||||
|
|
||||||
hyprctl dispatch exec "[float;size 45% 80%;center 1] kitty keyb -k '$CONFIG'"
|
hyprctl dispatch exec "[float;size 45% 80%;center 1] kitty keyb -k '$CONFIG'"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Emoji (ALT SLASH)
|
######################################
|
||||||
|
# #
|
||||||
|
# Emoji #
|
||||||
|
# #
|
||||||
|
######################################
|
||||||
|
|
||||||
emoji() {
|
emoji() {
|
||||||
A="$(rofi -dmenu -p "Emoji:" -config ~/.config/rofi/config-long.rasi < "$HOME/.config/hypr/configs/emojis" | cut -d ' ' -f 1 | tr -d '\n')"
|
A="$(rofi -dmenu -p "Emoji:" -config ~/.config/rofi/config-long.rasi < "$HOME/.config/hypr/configs/emojis" | cut -d ' ' -f 1 | tr -d '\n')"
|
||||||
[[ -n "$A" ]] && wl-copy -- "$A"
|
[[ -n "$A" ]] && wl-copy -- "$A"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
######################################
|
||||||
|
# #
|
||||||
|
# Bluetooth #
|
||||||
|
# #
|
||||||
|
######################################
|
||||||
|
|
||||||
bluetooth(){
|
bluetooth(){
|
||||||
|
divider="—————————————————————————————————————————————————————————"
|
||||||
goback=" Back"
|
goback=" Back"
|
||||||
theme=~/.config/rofi/config-long.rasi
|
theme=~/.config/rofi/config-long.rasi
|
||||||
|
|
||||||
# Checks if bluetooth controller is powered on
|
power_on() { # Checks if bluetooth controller is powered on
|
||||||
power_on() {
|
|
||||||
if bluetoothctl show | grep -q "Powered: yes"; then
|
if bluetoothctl show | grep -q "Powered: yes"; then
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
toggle_power() { # Toggles power state
|
||||||
# Toggles power state
|
|
||||||
toggle_power() {
|
|
||||||
if power_on; then
|
if power_on; then
|
||||||
bluetoothctl power off
|
bluetoothctl power off
|
||||||
show_menu
|
show_menu
|
||||||
@@ -263,9 +195,7 @@ toggle_power() {
|
|||||||
show_menu
|
show_menu
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
scan_on() { # Checks if controller is scanning for new devices
|
||||||
# Checks if controller is scanning for new devices
|
|
||||||
scan_on() {
|
|
||||||
if bluetoothctl show | grep -q "Discovering: yes"; then
|
if bluetoothctl show | grep -q "Discovering: yes"; then
|
||||||
echo " Scan: ON"
|
echo " Scan: ON"
|
||||||
return 0
|
return 0
|
||||||
@@ -274,9 +204,7 @@ scan_on() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
toggle_scan() { # Toggles scanning state
|
||||||
# Toggles scanning state
|
|
||||||
toggle_scan() {
|
|
||||||
if scan_on; then
|
if scan_on; then
|
||||||
kill $(pgrep -f "bluetoothctl scan on")
|
kill $(pgrep -f "bluetoothctl scan on")
|
||||||
bluetoothctl scan off
|
bluetoothctl scan off
|
||||||
@@ -288,9 +216,7 @@ toggle_scan() {
|
|||||||
show_menu
|
show_menu
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
pairable_on() { # Checks if controller is able to pair to devices
|
||||||
# Checks if controller is able to pair to devices
|
|
||||||
pairable_on() {
|
|
||||||
if bluetoothctl show | grep -q "Pairable: yes"; then
|
if bluetoothctl show | grep -q "Pairable: yes"; then
|
||||||
echo " Pairable: ON"
|
echo " Pairable: ON"
|
||||||
return 0
|
return 0
|
||||||
@@ -299,9 +225,7 @@ pairable_on() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
toggle_pairable() { # Toggles pairable state
|
||||||
# Toggles pairable state
|
|
||||||
toggle_pairable() {
|
|
||||||
if pairable_on; then
|
if pairable_on; then
|
||||||
bluetoothctl pairable off
|
bluetoothctl pairable off
|
||||||
show_menu
|
show_menu
|
||||||
@@ -310,9 +234,7 @@ toggle_pairable() {
|
|||||||
show_menu
|
show_menu
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
discoverable_on() { # Checks if controller is discoverable by other devices
|
||||||
# Checks if controller is discoverable by other devices
|
|
||||||
discoverable_on() {
|
|
||||||
if bluetoothctl show | grep -q "Discoverable: yes"; then
|
if bluetoothctl show | grep -q "Discoverable: yes"; then
|
||||||
echo " Discoverable: ON"
|
echo " Discoverable: ON"
|
||||||
return 0
|
return 0
|
||||||
@@ -321,9 +243,7 @@ discoverable_on() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
toggle_discoverable() { # Toggles discoverable state
|
||||||
# Toggles discoverable state
|
|
||||||
toggle_discoverable() {
|
|
||||||
if discoverable_on; then
|
if discoverable_on; then
|
||||||
bluetoothctl discoverable off
|
bluetoothctl discoverable off
|
||||||
show_menu
|
show_menu
|
||||||
@@ -332,9 +252,7 @@ toggle_discoverable() {
|
|||||||
show_menu
|
show_menu
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
device_connected() { # Checks if a device is connected
|
||||||
# Checks if a device is connected
|
|
||||||
device_connected() {
|
|
||||||
device_info=$(bluetoothctl info "$1")
|
device_info=$(bluetoothctl info "$1")
|
||||||
if echo "$device_info" | grep -q "Connected: yes"; then
|
if echo "$device_info" | grep -q "Connected: yes"; then
|
||||||
return 0
|
return 0
|
||||||
@@ -342,9 +260,7 @@ device_connected() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
toggle_connection() { # Toggles device connection
|
||||||
# Toggles device connection
|
|
||||||
toggle_connection() {
|
|
||||||
if device_connected $1; then
|
if device_connected $1; then
|
||||||
bluetoothctl disconnect $1
|
bluetoothctl disconnect $1
|
||||||
device_menu "$device"
|
device_menu "$device"
|
||||||
@@ -353,9 +269,7 @@ toggle_connection() {
|
|||||||
device_menu "$device"
|
device_menu "$device"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
device_paired() { # Checks if a device is paired
|
||||||
# Checks if a device is paired
|
|
||||||
device_paired() {
|
|
||||||
device_info=$(bluetoothctl info "$1")
|
device_info=$(bluetoothctl info "$1")
|
||||||
if echo "$device_info" | grep -q "Paired: yes"; then
|
if echo "$device_info" | grep -q "Paired: yes"; then
|
||||||
echo "Paired: "
|
echo "Paired: "
|
||||||
@@ -365,9 +279,7 @@ device_paired() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
toggle_paired() { # Toggles device paired state
|
||||||
# Toggles device paired state
|
|
||||||
toggle_paired() {
|
|
||||||
if device_paired $1; then
|
if device_paired $1; then
|
||||||
bluetoothctl remove $1
|
bluetoothctl remove $1
|
||||||
device_menu "$device"
|
device_menu "$device"
|
||||||
@@ -376,9 +288,7 @@ toggle_paired() {
|
|||||||
device_menu "$device"
|
device_menu "$device"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
device_trusted() { # Checks if a device is trusted
|
||||||
# Checks if a device is trusted
|
|
||||||
device_trusted() {
|
|
||||||
device_info=$(bluetoothctl info "$1")
|
device_info=$(bluetoothctl info "$1")
|
||||||
if echo "$device_info" | grep -q "Trusted: yes"; then
|
if echo "$device_info" | grep -q "Trusted: yes"; then
|
||||||
echo "Trusted: "
|
echo "Trusted: "
|
||||||
@@ -388,9 +298,7 @@ device_trusted() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
toggle_trust() { # Toggles device connection
|
||||||
# Toggles device connection
|
|
||||||
toggle_trust() {
|
|
||||||
if device_trusted $1; then
|
if device_trusted $1; then
|
||||||
bluetoothctl untrust $1
|
bluetoothctl untrust $1
|
||||||
device_menu "$device"
|
device_menu "$device"
|
||||||
@@ -399,10 +307,7 @@ toggle_trust() {
|
|||||||
device_menu "$device"
|
device_menu "$device"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
print_status() { # Prints a short string with the current bluetooth status
|
||||||
# Prints a short string with the current bluetooth status
|
|
||||||
# Useful for status bars like polybar, etc.
|
|
||||||
print_status() {
|
|
||||||
if power_on; then
|
if power_on; then
|
||||||
printf ''
|
printf ''
|
||||||
|
|
||||||
@@ -427,30 +332,23 @@ print_status() {
|
|||||||
echo ""
|
echo ""
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
device_menu() { # A submenu for a specific device that allows connecting, pairing, and trusting
|
||||||
# A submenu for a specific device that allows connecting, pairing, and trusting
|
|
||||||
device_menu() {
|
|
||||||
device=$1
|
device=$1
|
||||||
|
device_name=$(echo $device | cut -d ' ' -f 3-) # Get device name and mac address
|
||||||
# Get device name and mac address
|
|
||||||
device_name=$(echo $device | cut -d ' ' -f 3-)
|
|
||||||
mac=$(echo $device | cut -d ' ' -f 2)
|
mac=$(echo $device | cut -d ' ' -f 2)
|
||||||
|
if device_connected $mac; then # Build options
|
||||||
# Build options
|
|
||||||
if device_connected $mac; then
|
|
||||||
connected="Connected: "
|
connected="Connected: "
|
||||||
else
|
else
|
||||||
connected="Connected: "
|
connected="Connected: "
|
||||||
fi
|
fi
|
||||||
paired=$(device_paired $mac)
|
paired=$(device_paired $mac)
|
||||||
trusted=$(device_trusted $mac)
|
trusted=$(device_trusted $mac)
|
||||||
options="$connected\n$paired\n$trusted\n$goback\n Exit"
|
options="$connected\n$paired\n$trusted\n$divider\n$goback\n Exit"n
|
||||||
|
chosen="$(echo -e "$options" | $rofi_command "$device_name")" # Open rofi menu, read chosen optio
|
||||||
# Open rofi menu, read chosen option
|
case $chosen in # Match chosen option to command
|
||||||
chosen="$(echo -e "$options" | $rofi_command "$device_name")"
|
"" | $divider)
|
||||||
|
echo "No option chosen."
|
||||||
# Match chosen option to command
|
;;
|
||||||
case $chosen in
|
|
||||||
$connected)
|
$connected)
|
||||||
toggle_connection $mac
|
toggle_connection $mac
|
||||||
;;
|
;;
|
||||||
@@ -465,34 +363,23 @@ device_menu() {
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
show_menu() { # Opens a rofi menu with current bluetooth status and options to connect
|
||||||
# Opens a rofi menu with current bluetooth status and options to connect
|
if power_on; then # Get menu options
|
||||||
show_menu() {
|
|
||||||
# Get menu options
|
|
||||||
if power_on; then
|
|
||||||
power=" Power: ON"
|
power=" Power: ON"
|
||||||
|
devices=$(bluetoothctl devices | grep Device | cut -d ' ' -f 3-)s # Human-readable names of devices, one per line. If scan is off, will only list paired devices
|
||||||
# Human-readable names of devices, one per line
|
scan=$(scan_on) # Get controller flag
|
||||||
# If scan is off, will only list paired devices
|
|
||||||
devices=$(bluetoothctl devices | grep Device | cut -d ' ' -f 3-)
|
|
||||||
|
|
||||||
# Get controller flags
|
|
||||||
scan=$(scan_on)
|
|
||||||
pairable=$(pairable_on)
|
pairable=$(pairable_on)
|
||||||
discoverable=$(discoverable_on)
|
discoverable=$(discoverable_on)
|
||||||
|
options="$devices\n$divider\n$power\n$scan\n$pairable\n$discoverable\n Exit" # Options passed to rofi
|
||||||
# Options passed to rofi
|
|
||||||
options="$devices\n$power\n$scan\n$pairable\n$discoverable\n Exit"
|
|
||||||
else
|
else
|
||||||
power=" Power: OFF"
|
power=" Power: OFF"
|
||||||
options="$power\n Exit"
|
options="$power\n Exit"
|
||||||
fi
|
fi
|
||||||
|
chosen="$(echo -e "$options" | $rofi_command " Bluetooth")" # Open rofi menu, read chosen option
|
||||||
# Open rofi menu, read chosen option
|
case $chosen in # Match chosen option to command
|
||||||
chosen="$(echo -e "$options" | $rofi_command " Bluetooth")"
|
"" | $divider)
|
||||||
|
echo "No option chosen."
|
||||||
# Match chosen option to command
|
;;
|
||||||
case $chosen in
|
|
||||||
$power)
|
$power)
|
||||||
toggle_power
|
toggle_power
|
||||||
;;
|
;;
|
||||||
@@ -507,15 +394,11 @@ show_menu() {
|
|||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
device=$(bluetoothctl devices | grep "$chosen")
|
device=$(bluetoothctl devices | grep "$chosen")
|
||||||
# Open a submenu if a device is selected
|
if [[ $device ]]; then device_menu "$device"; fi # Open a submenu if a device is selected
|
||||||
if [[ $device ]]; then device_menu "$device"; fi
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
rofi_command="rofi -dmenu -no-fixed-num-lines -yoffset -100 -i -theme $theme -p" # Rofi command to pipe into, can add any options here
|
||||||
# Rofi command to pipe into, can add any options here
|
|
||||||
rofi_command="rofi -dmenu -no-fixed-num-lines -yoffset -100 -i -theme $theme -p"
|
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
--status)
|
--status)
|
||||||
print_status
|
print_status
|
||||||
@@ -524,5 +407,4 @@ case "$1" in
|
|||||||
show_menu
|
show_menu
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
}
|
||||||
}
|
|
||||||
@@ -1,6 +1,11 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
source ~/.config/hypr/scripts/Ref.sh
|
source ~/.config/hypr/scripts/Ref.sh
|
||||||
|
|
||||||
|
######################################
|
||||||
|
# #
|
||||||
|
# Rofi Option for Xmenu #
|
||||||
|
# #
|
||||||
|
######################################
|
||||||
|
|
||||||
_confirm_rofi() {
|
_confirm_rofi() {
|
||||||
rofi -theme-str 'window {location: center; anchor: center; fullscreen: false; width: 250px;}' \
|
rofi -theme-str 'window {location: center; anchor: center; fullscreen: false; width: 250px;}' \
|
||||||
@@ -21,6 +26,13 @@ _need_confirm() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
######################################
|
||||||
|
# #
|
||||||
|
# Power & Reboot #
|
||||||
|
# #
|
||||||
|
######################################
|
||||||
|
|
||||||
sys_reboot() {
|
sys_reboot() {
|
||||||
if _need_confirm "Reboot system?"; then
|
if _need_confirm "Reboot system?"; then
|
||||||
reboot
|
reboot
|
||||||
@@ -32,7 +44,12 @@ sys_poweroff() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Reload Waybar, Rofi, Swaync, and Rainbowborder.sh (SHIFT ALT R)
|
#######################################################
|
||||||
|
# #
|
||||||
|
# Reload Waybar, Rofi, Swaync #
|
||||||
|
# #
|
||||||
|
#######################################################
|
||||||
|
# (SHIFT ALT R)
|
||||||
reload_all() {
|
reload_all() {
|
||||||
file_exists() {
|
file_exists() {
|
||||||
[ -e "$1" ]
|
[ -e "$1" ]
|
||||||
@@ -52,6 +69,13 @@ reload_all() {
|
|||||||
sleep 0.5
|
sleep 0.5
|
||||||
swaync > /dev/null 2>&1 &
|
swaync > /dev/null 2>&1 &
|
||||||
}
|
}
|
||||||
|
|
||||||
|
######################################
|
||||||
|
# #
|
||||||
|
# Reload Waybar #
|
||||||
|
# #
|
||||||
|
######################################
|
||||||
|
|
||||||
reload_waybar() {
|
reload_waybar() {
|
||||||
_ps=(waybar rofi)
|
_ps=(waybar rofi)
|
||||||
for _prs in "${_ps[@]}"; do
|
for _prs in "${_ps[@]}"; do
|
||||||
@@ -65,17 +89,37 @@ reload_waybar() {
|
|||||||
if [[ -z $1 ]]; then
|
if [[ -z $1 ]]; then
|
||||||
waybar &
|
waybar &
|
||||||
fi
|
fi
|
||||||
$notif "Reload Waybar"
|
notify-send -u low -i $notif "Reload Waybar"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
######################################
|
||||||
|
# #
|
||||||
|
# Update Waybar #
|
||||||
|
# #
|
||||||
|
######################################
|
||||||
|
|
||||||
update_waybar() {
|
update_waybar() {
|
||||||
pkill -RTMIN+4 waybar
|
pkill -RTMIN+4 waybar
|
||||||
notify-send -u low -i $notif 'Refresh Waybar'
|
notify-send -u low -i $notif 'Refresh Waybar'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
######################################
|
||||||
|
# #
|
||||||
|
# Reload Hyprland #
|
||||||
|
# #
|
||||||
|
######################################
|
||||||
|
|
||||||
reload_hypr() {
|
reload_hypr() {
|
||||||
hyprctl reload
|
hyprctl reload
|
||||||
notify-send -u low -i $notif 'Reload Hyprland'
|
notify-send -u low -i $notif 'Reload Hyprland'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
######################################
|
||||||
|
# #
|
||||||
|
# lockscreen(swaylock) #
|
||||||
|
# #
|
||||||
|
######################################
|
||||||
|
|
||||||
lock_screen() {
|
lock_screen() {
|
||||||
LOCKCONFIG="$HOME/.config/swaylock/config"
|
LOCKCONFIG="$HOME/.config/swaylock/config"
|
||||||
sleep 0.5s
|
sleep 0.5s
|
||||||
@@ -84,7 +128,12 @@ lock_screen() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Volume Controller
|
######################################
|
||||||
|
# #
|
||||||
|
# Volume Controller #
|
||||||
|
# #
|
||||||
|
######################################
|
||||||
|
|
||||||
volume() {
|
volume() {
|
||||||
get_volume() {
|
get_volume() {
|
||||||
volume=$(pamixer --get-volume)
|
volume=$(pamixer --get-volume)
|
||||||
@@ -94,7 +143,6 @@ volume() {
|
|||||||
echo "$volume%"
|
echo "$volume%"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
get_icon() {
|
get_icon() {
|
||||||
current=$(get_volume)
|
current=$(get_volume)
|
||||||
if [[ "$current" == "Muted" ]]; then
|
if [[ "$current" == "Muted" ]]; then
|
||||||
@@ -107,7 +155,6 @@ volume() {
|
|||||||
echo "$iDIR/volume-high.png"
|
echo "$iDIR/volume-high.png"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
notify_user() {
|
notify_user() {
|
||||||
if [[ "$(get_volume)" == "Muted" ]]; then
|
if [[ "$(get_volume)" == "Muted" ]]; then
|
||||||
notify-send -e -h string:x-canonical-private-synchronous:volume_notif -u low -i "$(get_icon)" "Volume: Muted"
|
notify-send -e -h string:x-canonical-private-synchronous:volume_notif -u low -i "$(get_icon)" "Volume: Muted"
|
||||||
@@ -115,21 +162,18 @@ volume() {
|
|||||||
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)"
|
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
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
inc_volume() {
|
inc_volume() {
|
||||||
if [ "$(pamixer --get-mute)" == "true" ]; then
|
if [ "$(pamixer --get-mute)" == "true" ]; then
|
||||||
pamixer -u && notify_user
|
pamixer -u && notify_user
|
||||||
fi
|
fi
|
||||||
pamixer -i 5 && notify_user
|
pamixer -i 5 && notify_user
|
||||||
}
|
}
|
||||||
|
|
||||||
dec_volume() {
|
dec_volume() {
|
||||||
if [ "$(pamixer --get-mute)" == "true" ]; then
|
if [ "$(pamixer --get-mute)" == "true" ]; then
|
||||||
pamixer -u && notify_user
|
pamixer -u && notify_user
|
||||||
fi
|
fi
|
||||||
pamixer -d 5 && notify_user
|
pamixer -d 5 && notify_user
|
||||||
}
|
}
|
||||||
|
|
||||||
toggle_mute() {
|
toggle_mute() {
|
||||||
if [ "$(pamixer --get-mute)" == "false" ]; then
|
if [ "$(pamixer --get-mute)" == "false" ]; then
|
||||||
pamixer -m && notify-send -e -u low -i "$iDIR/volume-mute.png" "Volume Switched OFF"
|
pamixer -m && notify-send -e -u low -i "$iDIR/volume-mute.png" "Volume Switched OFF"
|
||||||
@@ -137,7 +181,6 @@ volume() {
|
|||||||
pamixer -u && notify-send -e -u low -i "$(get_icon)" "Volume Switched ON"
|
pamixer -u && notify-send -e -u low -i "$(get_icon)" "Volume Switched ON"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
toggle_mic() {
|
toggle_mic() {
|
||||||
if [ "$(pamixer --default-source --get-mute)" == "false" ]; then
|
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"
|
pamixer --default-source -m && notify-send -e -u low -i "$iDIR/microphone-mute.png" "Microphone Switched OFF"
|
||||||
@@ -145,7 +188,6 @@ volume() {
|
|||||||
pamixer -u --default-source u && notify-send -e -u low -i "$iDIR/microphone.png" "Microphone Switched ON"
|
pamixer -u --default-source u && notify-send -e -u low -i "$iDIR/microphone.png" "Microphone Switched ON"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
get_mic_icon() {
|
get_mic_icon() {
|
||||||
current=$(pamixer --default-source --get-volume)
|
current=$(pamixer --default-source --get-volume)
|
||||||
if [[ "$current" -eq "0" ]]; then
|
if [[ "$current" -eq "0" ]]; then
|
||||||
@@ -154,7 +196,6 @@ volume() {
|
|||||||
echo "$iDIR/microphone.png"
|
echo "$iDIR/microphone.png"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
get_mic_volume() {
|
get_mic_volume() {
|
||||||
volume=$(pamixer --default-source --get-volume)
|
volume=$(pamixer --default-source --get-volume)
|
||||||
if [[ "$volume" -eq "0" ]]; then
|
if [[ "$volume" -eq "0" ]]; then
|
||||||
@@ -163,27 +204,23 @@ volume() {
|
|||||||
echo "$volume%"
|
echo "$volume%"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
notify_mic_user() {
|
notify_mic_user() {
|
||||||
volume=$(get_mic_volume)
|
volume=$(get_mic_volume)
|
||||||
icon=$(get_mic_icon)
|
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"
|
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() {
|
inc_mic_volume() {
|
||||||
if [ "$(pamixer --default-source --get-mute)" == "true" ]; then
|
if [ "$(pamixer --default-source --get-mute)" == "true" ]; then
|
||||||
pamixer --default-source -u && notify_mic_user
|
pamixer --default-source -u && notify_mic_user
|
||||||
fi
|
fi
|
||||||
pamixer --default-source -i 5 && notify_mic_user
|
pamixer --default-source -i 5 && notify_mic_user
|
||||||
}
|
}
|
||||||
|
|
||||||
dec_mic_volume() {
|
dec_mic_volume() {
|
||||||
if [ "$(pamixer --default-source --get-mute)" == "true" ]; then
|
if [ "$(pamixer --default-source --get-mute)" == "true" ]; then
|
||||||
pamixer --default-source -u && notify_mic_user
|
pamixer --default-source -u && notify_mic_user
|
||||||
fi
|
fi
|
||||||
pamixer --default-source -d 5 && notify_mic_user
|
pamixer --default-source -d 5 && notify_mic_user
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ "$1" == "--get" ]]; then
|
if [[ "$1" == "--get" ]]; then
|
||||||
get_volume
|
get_volume
|
||||||
elif [[ "$1" == "--inc" ]]; then
|
elif [[ "$1" == "--inc" ]]; then
|
||||||
@@ -207,8 +244,12 @@ volume() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
######################################
|
||||||
|
# #
|
||||||
|
# ScreenShot #
|
||||||
|
# #
|
||||||
|
######################################
|
||||||
|
|
||||||
# ScreenShot
|
|
||||||
screenshot() {
|
screenshot() {
|
||||||
notify_cmd_shot="notify-send -h string:x-canonical-private-synchronous:shot-notify -u low -i ${iDIR}/picture.png"
|
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")
|
time=$(date "+%d-%b_%H-%M-%S")
|
||||||
@@ -221,29 +262,24 @@ screenshot() {
|
|||||||
[[ "$1" == "active" && ! -e "${active_window_path}" ]] && msg="Screenshot NOT Saved."
|
[[ "$1" == "active" && ! -e "${active_window_path}" ]] && msg="Screenshot NOT Saved."
|
||||||
${notify_cmd_shot} "$msg"
|
${notify_cmd_shot} "$msg"
|
||||||
}
|
}
|
||||||
|
|
||||||
countdown() {
|
countdown() {
|
||||||
for ((sec = $1; sec > 0; sec--)); do
|
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"
|
notify-send -h string:x-canonical-private-synchronous:shot-notify -t 1000 -i "$iDIR"/timer.png "Taking shot in: $sec"
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
take_shot() {
|
take_shot() {
|
||||||
cd "${dir}" && grim - | tee "$file" | wl-copy
|
cd "${dir}" && grim - | tee "$file" | wl-copy
|
||||||
sleep 2
|
sleep 2
|
||||||
notify_view "$1"
|
notify_view "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
shotnow() { take_shot; }
|
shotnow() { take_shot; }
|
||||||
shot_timer() { countdown "$1"; sleep 1 && take_shot; }
|
shot_timer() { countdown "$1"; sleep 1 && take_shot; }
|
||||||
shot5() { shot_timer 5; }
|
shot5() { shot_timer 5; }
|
||||||
shot10() { shot_timer 10; }
|
shot10() { shot_timer 10; }
|
||||||
|
|
||||||
shotarea() {
|
shotarea() {
|
||||||
tmpfile=$(mktemp)
|
tmpfile=$(mktemp)
|
||||||
area="$(slurp)"
|
area="$(slurp)"
|
||||||
|
|
||||||
[[ -z "$area" ]] && { notify-send -u low -i "$iDIR/picture.png" 'No area selected'; rm; "$tmpfile": return;}
|
[[ -z "$area" ]] && { notify-send -u low -i "$iDIR/picture.png" 'No area selected'; rm; "$tmpfile": return;}
|
||||||
grim -g "$area" - > "$tmpfile" && [[ -s "$tmpfile" ]] && {
|
grim -g "$area" - > "$tmpfile" && [[ -s "$tmpfile" ]] && {
|
||||||
wl-copy < "$tmpfile"
|
wl-copy < "$tmpfile"
|
||||||
@@ -252,11 +288,8 @@ screenshot() {
|
|||||||
}
|
}
|
||||||
rm "$tmpfile"
|
rm "$tmpfile"
|
||||||
}
|
}
|
||||||
|
|
||||||
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"; }
|
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"
|
[[ ! -d "$dir" ]] && mkdir -p "$dir"
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
--now) shotnow ;;
|
--now) shotnow ;;
|
||||||
--in5) shot5 ;;
|
--in5) shot5 ;;
|
||||||
@@ -265,23 +298,24 @@ screenshot() {
|
|||||||
--active) shotactive ;;
|
--active) shotactive ;;
|
||||||
*) echo -e "Available Options: --now --in5 --in10 --area --active"
|
*) echo -e "Available Options: --now --in5 --in10 --area --active"
|
||||||
esac
|
esac
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Brightness Controller
|
############################################################
|
||||||
|
# #
|
||||||
|
# Brightness Controller both keyboard & screen #
|
||||||
|
# #
|
||||||
|
############################################################
|
||||||
|
|
||||||
brightness() {
|
brightness() {
|
||||||
notification_timeout=1000
|
notification_timeout=1000
|
||||||
|
|
||||||
get_backlight() {
|
get_backlight() {
|
||||||
echo $(brightnessctl -m | cut -d, -f4)
|
echo $(brightnessctl -m | cut -d, -f4)
|
||||||
}
|
}
|
||||||
|
|
||||||
get_kbd_backlight() {
|
get_kbd_backlight() {
|
||||||
brightnessctl -d '*::kbd_backlight' -m | cut -d, -f4 | tr -d '%'
|
brightnessctl -d '*::kbd_backlight' -m | cut -d, -f4 | tr -d '%'
|
||||||
}
|
}
|
||||||
|
|
||||||
get_icon() {
|
get_icon() {
|
||||||
current=$(get_backlight | sed 's/%//')
|
current=$(get_backlight | sed 's/%//')
|
||||||
[ "$current" -le "20" ] && icon="$iDIR/brightness-20.png" ||
|
[ "$current" -le "20" ] && icon="$iDIR/brightness-20.png" ||
|
||||||
@@ -290,19 +324,15 @@ get_icon() {
|
|||||||
[ "$current" -le "80" ] && icon="$iDIR/brightness-80.png" ||
|
[ "$current" -le "80" ] && icon="$iDIR/brightness-80.png" ||
|
||||||
icon="$iDIR/brightness-100.png"
|
icon="$iDIR/brightness-100.png"
|
||||||
}
|
}
|
||||||
|
|
||||||
notify_user() {
|
notify_user() {
|
||||||
notify-send -e -h string:x-canonical-private-synchronous:brightness_notif -h int:value:$current -u low -i "$icon" "Brightness: $current%"
|
notify-send -e -h string:x-canonical-private-synchronous:brightness_notif -h int:value:$current -u low -i "$icon" "Brightness: $current%"
|
||||||
}
|
}
|
||||||
|
|
||||||
change_backlight() {
|
change_backlight() {
|
||||||
brightnessctl set "$1" && get_icon && notify_user
|
brightnessctl set "$1" && get_icon && notify_user
|
||||||
}
|
}
|
||||||
|
|
||||||
change_kbd_backlight() {
|
change_kbd_backlight() {
|
||||||
brightnessctl -d '*::kbd_backlight' set "$1" && get_icon && notify_user
|
brightnessctl -d '*::kbd_backlight' set "$1" && get_icon && notify_user
|
||||||
}
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
"--get")
|
"--get")
|
||||||
get_backlight
|
get_backlight
|
||||||
@@ -328,54 +358,54 @@ case "$1" in
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
######################################
|
||||||
|
# #
|
||||||
|
# Battery Notifer #
|
||||||
|
# #
|
||||||
|
######################################
|
||||||
|
|
||||||
battery_notify() {
|
battery_notify() {
|
||||||
last="NONE" # Possible values: NONE, FULL, LOW, CRITICAL, CHARGING
|
last="NONE" # Possible values: NONE, FULL, LOW, CRITICAL, CHARGING
|
||||||
# Default values for LOW/CRITICAL status
|
# Default values for LOW/CRITICAL status
|
||||||
low=40
|
low=40
|
||||||
critical=20
|
critical=20
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
# If battery is plugged, do stuff
|
# If battery is plugged, do stuff
|
||||||
battery="/sys/class/power_supply/BAT0"
|
battery="/sys/class/power_supply/BAT0"
|
||||||
if [ -d $battery ]; then
|
if [ -d $battery ]; then
|
||||||
capacity=$(cat $battery/capacity)
|
capacity=$(cat $battery/capacity)
|
||||||
status=$(cat $battery/status)
|
status=$(cat $battery/status)
|
||||||
|
|
||||||
# If battery full and not already warned about that
|
# If battery full and not already warned about that
|
||||||
if [ "$last" != "FULL" ] && [ "$status" = "Full" ]; then
|
if [ "$last" != "FULL" ] && [ "$status" = "Full" ]; then
|
||||||
notify-send -u normal -i "$iDIR/battery-full.png" "Battery full" "Remove the adapter! $capacity%"
|
notify-send -u normal -i "$iDIR/battery-full.png" "Battery full" "Remove the adapter! $capacity%"
|
||||||
last="FULL"
|
last="FULL"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If low and discharging
|
# If low and discharging
|
||||||
if [ "$last" != "LOW" ] && [ "$status" = "Discharging" ] && [ $capacity -le $low ]; then
|
if [ "$last" != "LOW" ] && [ "$status" = "Discharging" ] && [ $capacity -le $low ]; then
|
||||||
notify-send -u normal -i "$iDIR/battery-low.png" "Battery low" "Plug in the adapter! $capacity%"
|
notify-send -u normal -i "$iDIR/battery-low.png" "Battery low" "Plug in the adapter! $capacity%"
|
||||||
last="LOW"
|
last="LOW"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If critical and discharging
|
# If critical and discharging
|
||||||
if [ "$status" = "Discharging" ] && [ $capacity -le $critical ]; then
|
if [ "$status" = "Discharging" ] && [ $capacity -le $critical ]; then
|
||||||
notify-send -u critical -i "$iDIR/battery-low.png" "Battery very low" "Plug in the adapter!!! $capacity%"
|
notify-send -u critical -i "$iDIR/battery-low.png" "Battery very low" "Plug in the adapter!!! $capacity%"
|
||||||
last="CRITICAL"
|
last="CRITICAL"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If charging and not already notified
|
# If charging and not already notified
|
||||||
if [ "$last" != "CHARGING" ] && [ "$status" = "Charging" ]; then
|
if [ "$last" != "CHARGING" ] && [ "$status" = "Charging" ]; then
|
||||||
notify-send -u low -i "$iDIR/battery-charging.png" "Charger connected" "Battery is charging $capacity%"
|
notify-send -u low -i "$iDIR/battery-charging.png" "Charger connected" "Battery is charging $capacity%"
|
||||||
last="CHARGING"
|
last="CHARGING"
|
||||||
fi
|
|
||||||
|
|
||||||
# If unplugged and not already notified
|
|
||||||
if [ "$last" != "UNPLUGGED" ] && [ "$status" = "Discharging" ] && [ "$capacity" != "Full" ]; then
|
|
||||||
notify-send -u normal -i "$iDIR/battery-notcharging.png" "Charger unplugged" "Battery is not charging! $capacity%"
|
|
||||||
last="UNPLUGGED"
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
sleep 0.1
|
sleep 0.1
|
||||||
done
|
done
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
######################################
|
||||||
|
# #
|
||||||
|
# Polkit #
|
||||||
|
# #
|
||||||
|
######################################
|
||||||
|
|
||||||
polkit_(){
|
polkit_(){
|
||||||
polkit=(
|
polkit=(
|
||||||
"/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1"
|
"/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1"
|
||||||
@@ -385,9 +415,7 @@ polkit_(){
|
|||||||
"/usr/lib/x86_64-linux-gnu/libexec/polkit-kde-authentication-agent-1"
|
"/usr/lib/x86_64-linux-gnu/libexec/polkit-kde-authentication-agent-1"
|
||||||
"/usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1"
|
"/usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1"
|
||||||
)
|
)
|
||||||
|
|
||||||
executed=false # Flag to track if a file has been executed
|
executed=false # Flag to track if a file has been executed
|
||||||
|
|
||||||
# Loop through the list of files
|
# Loop through the list of files
|
||||||
for file in "${polkit[@]}"; do
|
for file in "${polkit[@]}"; do
|
||||||
if [ -e "$file" ]; then
|
if [ -e "$file" ]; then
|
||||||
@@ -397,7 +425,6 @@ for file in "${polkit[@]}"; do
|
|||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# If none of the files were found, you can add a fallback command here
|
# If none of the files were found, you can add a fallback command here
|
||||||
if [ "$executed" == false ]; then
|
if [ "$executed" == false ]; then
|
||||||
echo "None of the specified files were found. Install a Polkit"
|
echo "None of the specified files were found. Install a Polkit"
|
||||||
|
|||||||
@@ -5,7 +5,12 @@ CONFIG_FILE=~/.config/hypr/scripts/Ref.sh
|
|||||||
source "$CONFIG_FILE"
|
source "$CONFIG_FILE"
|
||||||
|
|
||||||
|
|
||||||
# Change blur (SUPER SHIFT Q)
|
######################################
|
||||||
|
# #
|
||||||
|
# Toggle Blur #
|
||||||
|
# #
|
||||||
|
######################################
|
||||||
|
|
||||||
toggle_blur (){
|
toggle_blur (){
|
||||||
STATE=$(hyprctl -j getoption decoration:blur:passes | jq ".int")
|
STATE=$(hyprctl -j getoption decoration:blur:passes | jq ".int")
|
||||||
|
|
||||||
@@ -20,6 +25,12 @@ toggle_blur (){
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
######################################
|
||||||
|
# #
|
||||||
|
# Toggle Animation #
|
||||||
|
# #
|
||||||
|
######################################
|
||||||
|
|
||||||
toggle_animation() {
|
toggle_animation() {
|
||||||
STATE=$(hyprctl -j getoption animations:enabled | jq ".int")
|
STATE=$(hyprctl -j getoption animations:enabled | jq ".int")
|
||||||
if [ "${STATE}" = "1" ]; then
|
if [ "${STATE}" = "1" ]; then
|
||||||
@@ -32,21 +43,30 @@ toggle_animation() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
######################################
|
||||||
|
# #
|
||||||
|
# Rainbow Border #
|
||||||
|
# #
|
||||||
|
######################################
|
||||||
|
|
||||||
rainbow_border() {
|
rainbow_border() {
|
||||||
function random_hex() {
|
function random_hex() {
|
||||||
random_hex=("0xff$(openssl rand -hex 3)")
|
random_hex=("0xff$(openssl rand -hex 3)")
|
||||||
echo $random_hex
|
echo $random_hex
|
||||||
}
|
}
|
||||||
|
|
||||||
hyprctl keyword general:col.active_border $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) 270deg
|
hyprctl keyword general:col.active_border $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) 270deg
|
||||||
|
|
||||||
hyprctl keyword general:col.inactive_border $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) 270deg
|
hyprctl keyword general:col.inactive_border $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) 270deg
|
||||||
}
|
}
|
||||||
|
|
||||||
# Change layout to master & dwindle (SUPER SPACE)
|
################################################
|
||||||
|
# #
|
||||||
|
# Change Layout Master to Dwindle #
|
||||||
|
# #
|
||||||
|
################################################
|
||||||
|
|
||||||
change_layout() {
|
change_layout() {
|
||||||
LAYOUT=$(hyprctl -j getoption general:layout | jq -r '.str')
|
LAYOUT=$(hyprctl -j getoption general:layout | jq -r '.str')
|
||||||
|
|
||||||
case $LAYOUT in
|
case $LAYOUT in
|
||||||
"master")
|
"master")
|
||||||
hyprctl keyword general:layout dwindle
|
hyprctl keyword general:layout dwindle
|
||||||
@@ -71,7 +91,11 @@ change_layout() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Script for Random Wallpaper ( SHIFT ALT W)
|
######################################
|
||||||
|
# #
|
||||||
|
# Random Wallpaper #
|
||||||
|
# #
|
||||||
|
######################################
|
||||||
|
|
||||||
random_wall() {
|
random_wall() {
|
||||||
swww query || swww init
|
swww query || swww init
|
||||||
@@ -87,23 +111,28 @@ random_wall() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Change Wallpaper automatically after 30min
|
######################################
|
||||||
|
# #
|
||||||
|
# Auto Wallpaper Changer #
|
||||||
|
# #
|
||||||
|
######################################
|
||||||
|
|
||||||
auto_wall() {
|
auto_wall() {
|
||||||
INTERVAL=1800 # This controls (in seconds) when to switch to the next image
|
INTERVAL=1800 # This controls (in seconds) when to switch to the next image
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
find "$wallDIR" -type f \( -name "*.jpg" -o -name "*.jpeg" -o -name "*.png" -o -name "*.gif" \) -print0 \
|
find "$wallDIR" -type f \( -name "*.jpg" -o -name "*.jpeg" -o -name "*.png" -o -name "*.gif" \) -print0 \
|
||||||
| shuf -z -n 1 \
|
| shuf -z -n 1 \
|
||||||
| xargs -0 -I {} swww img "{}" ${SWWW_PARAMS} && $linker
|
| xargs -0 -I {} swww img "{}" ${SWWW_PARAMS} && $linker
|
||||||
|
|
||||||
sleep $INTERVAL
|
sleep $INTERVAL
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
######################################
|
||||||
|
# #
|
||||||
|
# Wallpaper Selector #
|
||||||
|
# #
|
||||||
|
######################################
|
||||||
|
|
||||||
|
|
||||||
# selecting wallpapers (SUPER W)
|
|
||||||
select_wall() {
|
select_wall() {
|
||||||
build_theme() {
|
build_theme() {
|
||||||
rows="$1"
|
rows="$1"
|
||||||
@@ -115,10 +144,8 @@ select_wall() {
|
|||||||
echo "Error: Wallpaper directory not found." >&2
|
echo "Error: Wallpaper directory not found." >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
images=$(find "$wallDIR" -maxdepth 1 -type f -printf "%f\x00icon\x1f$wallDIR/%f\n" | sort -n)
|
images=$(find "$wallDIR" -maxdepth 1 -type f -printf "%f\x00icon\x1f$wallDIR/%f\n" | sort -n)
|
||||||
choice=$(echo -en "$images\nRandom Choice" | rofi -dmenu -i -show-icons -theme-str "$(build_theme 3 5 6)" -config ~/.config/rofi/config-wallpaper.rasi)
|
choice=$(echo -en "$images\nRandom Choice" | rofi -dmenu -i -show-icons -theme-str "$(build_theme 3 5 6)" -config ~/.config/rofi/config-wallpaper.rasi)
|
||||||
|
|
||||||
if [ -n "$choice" ]; then
|
if [ -n "$choice" ]; then
|
||||||
if [ "$choice" = "Random Choice" ]; then
|
if [ "$choice" = "Random Choice" ]; then
|
||||||
choice=$(find "$wallDIR" -type f -maxdepth 1 -printf "%f\n" | shuf -n1)
|
choice=$(find "$wallDIR" -type f -maxdepth 1 -printf "%f\n" | shuf -n1)
|
||||||
@@ -131,7 +158,12 @@ select_wall() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Waybar Layout (ALT W)
|
######################################
|
||||||
|
# #
|
||||||
|
# Waybar Layout #
|
||||||
|
# #
|
||||||
|
######################################
|
||||||
|
|
||||||
waybar_layout() {
|
waybar_layout() {
|
||||||
menu() {
|
menu() {
|
||||||
find "$config_dir" -maxdepth 1 -type f -exec basename {} \; | sort
|
find "$config_dir" -maxdepth 1 -type f -exec basename {} \; | sort
|
||||||
@@ -161,7 +193,11 @@ restart_waybar_if_needed() {
|
|||||||
main
|
main
|
||||||
}
|
}
|
||||||
|
|
||||||
# Toggle animations (SUPER SHIFT A)
|
######################################
|
||||||
|
# #
|
||||||
|
# GameMode #
|
||||||
|
# #
|
||||||
|
######################################)
|
||||||
gamemode() {
|
gamemode() {
|
||||||
status=$(hyprctl getoption animations:enabled -j | jq ".int")
|
status=$(hyprctl getoption animations:enabled -j | jq ".int")
|
||||||
if [[ $status -eq 1 ]]; then
|
if [[ $status -eq 1 ]]; then
|
||||||
@@ -175,6 +211,12 @@ gamemode() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
######################################
|
||||||
|
# #
|
||||||
|
# Toggle Opaque #
|
||||||
|
# #
|
||||||
|
######################################
|
||||||
|
|
||||||
enable_opaque() {
|
enable_opaque() {
|
||||||
sleep 0.2
|
sleep 0.2
|
||||||
hyprctl setprop address:$(hyprctl -j activewindow | jq -r -c ".address") forceopaque 0 lock
|
hyprctl setprop address:$(hyprctl -j activewindow | jq -r -c ".address") forceopaque 0 lock
|
||||||
@@ -184,15 +226,11 @@ disable_opaque() {
|
|||||||
hyprctl setprop address:$(hyprctl -j activewindow | jq -r -c ".address") forceopaque 1 lock
|
hyprctl setprop address:$(hyprctl -j activewindow | jq -r -c ".address") forceopaque 1 lock
|
||||||
}
|
}
|
||||||
|
|
||||||
welcome() {
|
######################################
|
||||||
sleep 1
|
# Keyboard Layout Switcher #
|
||||||
|
# #
|
||||||
|
######################################
|
||||||
|
|
||||||
name=$(whoami)
|
|
||||||
|
|
||||||
notify-send "Hello" "${name}?,you're back? welcome what will we do today!"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Switch Keyboard Layout (ALT F1)
|
|
||||||
kb_changer() {
|
kb_changer() {
|
||||||
if [ ! -f "$layout_f" ]; then
|
if [ ! -f "$layout_f" ]; then
|
||||||
default_layout=$(grep 'kb_layout=' "$settings_file" | cut -d '=' -f 2 | cut -d ',' -f 1 2>/dev/null)
|
default_layout=$(grep 'kb_layout=' "$settings_file" | cut -d '=' -f 2 | cut -d ',' -f 1 2>/dev/null)
|
||||||
@@ -220,34 +258,26 @@ echo "$new_layout" > "$layout_f"
|
|||||||
notify-send -u low -i "$notif" "Keyboad Layout Changed to $new_layout"
|
notify-send -u low -i "$notif" "Keyboad Layout Changed to $new_layout"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Symbolic link for wallpaper
|
######################################
|
||||||
|
# #
|
||||||
|
# Symbolic Linker for Wallpaper #
|
||||||
|
# #
|
||||||
|
######################################
|
||||||
|
|
||||||
linker() {
|
linker() {
|
||||||
# Define the path to the swww cache directory
|
cache_dir="$HOME/.cache/swww/" # Define the path to the swww cache directory
|
||||||
cache_dir="$HOME/.cache/swww/"
|
monitor_outputs=("$cache_dir"/*) # Get a list of monitor outputs
|
||||||
|
ln_success=false # Initialize a flag to determine if the ln command was executed
|
||||||
# Get a list of monitor outputs
|
for cache_file in "${monitor_outputs[@]}"; do # Loop through monitor outputs
|
||||||
monitor_outputs=("$cache_dir"/*)
|
if [ -f "$cache_file" ]; then # Check if the cache file exists for the current monitor output
|
||||||
|
wallpaper_path=$(<"$cache_file") # Get the wallpaper path from the cache file
|
||||||
# Initialize a flag to determine if the ln command was executed
|
if ln -sf "$wallpaper_path" "$HOME/.config/rofi/.current_wallpaper"; then # Copy the wallpaper to the location Rofi can access
|
||||||
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
|
ln_success=true # Set the flag to true upon successful execution
|
||||||
break # Exit the loop after processing the first found monitor output
|
break # Exit the loop after processing the first found monitor output
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
if $ln_success; then # Add a message indicating whether the ln command was successful
|
||||||
# Add a message indicating whether the ln command was successful
|
|
||||||
if $ln_success; then
|
|
||||||
echo "Wallpaper linked successfully."
|
echo "Wallpaper linked successfully."
|
||||||
else
|
else
|
||||||
echo "Failed to link wallpaper."
|
echo "Failed to link wallpaper."
|
||||||
@@ -255,13 +285,18 @@ fi
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
caway() {
|
######################################
|
||||||
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM
|
# #
|
||||||
|
# Cava visulizer #
|
||||||
|
# #
|
||||||
|
######################################
|
||||||
|
|
||||||
|
caway() {
|
||||||
|
|
||||||
|
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM
|
||||||
BARS=8;
|
BARS=8;
|
||||||
FRAMERATE=60;
|
FRAMERATE=60;
|
||||||
EQUILIZER=1;
|
EQUILIZER=1;
|
||||||
|
|
||||||
# Get script options
|
# Get script options
|
||||||
while getopts 'b:f:m:eh' flag; do
|
while getopts 'b:f:m:eh' flag; do
|
||||||
case "${flag}" in
|
case "${flag}" in
|
||||||
@@ -280,28 +315,21 @@ while getopts 'b:f:m:eh' flag; do
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
bar="▁▂▃▄▅▆▇█"
|
bar="▁▂▃▄▅▆▇█"
|
||||||
dict="s/;//g;"
|
dict="s/;//g;"
|
||||||
|
i=0 # creating "dictionary" to replace char with bar + thin space " "
|
||||||
# creating "dictionary" to replace char with bar + thin space " "
|
|
||||||
i=0
|
|
||||||
while [ $i -lt ${#bar} ]
|
while [ $i -lt ${#bar} ]
|
||||||
do
|
do
|
||||||
dict="${dict}s/$i/${bar:$i:1} /g;"
|
dict="${dict}s/$i/${bar:$i:1} /g;"
|
||||||
i=$((i=i+1))
|
i=$((i=i+1))
|
||||||
done
|
done
|
||||||
|
dict="${dict}s/.$//;" # Remove last extra thin space
|
||||||
# Remove last extra thin space
|
|
||||||
dict="${dict}s/.$//;"
|
|
||||||
|
|
||||||
clean_create_pipe() {
|
clean_create_pipe() {
|
||||||
if [ -p $1 ]; then
|
if [ -p $1 ]; then
|
||||||
unlink $1
|
unlink $1
|
||||||
fi
|
fi
|
||||||
mkfifo $1
|
mkfifo $1
|
||||||
}
|
}
|
||||||
|
|
||||||
kill_pid_file() {
|
kill_pid_file() {
|
||||||
if [[ -f $1 ]]; then
|
if [[ -f $1 ]]; then
|
||||||
while read pid; do
|
while read pid; do
|
||||||
@@ -309,16 +337,10 @@ kill_pid_file() {
|
|||||||
done < $1
|
done < $1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
cava_waybar_pid="/tmp/cava_waybar_pid" # PID of the cava process and while loop launched from the script
|
||||||
# PID of the cava process and while loop launched from the script
|
cava_waybar_pipe="/tmp/cava_waybar.fifo" # Clean pipe for cava
|
||||||
cava_waybar_pid="/tmp/cava_waybar_pid"
|
|
||||||
|
|
||||||
# Clean pipe for cava
|
|
||||||
cava_waybar_pipe="/tmp/cava_waybar.fifo"
|
|
||||||
clean_create_pipe $cava_waybar_pipe
|
clean_create_pipe $cava_waybar_pipe
|
||||||
|
cava_waybar_config="/tmp/cava_waybar_config" # Custom cava config
|
||||||
# Custom cava config
|
|
||||||
cava_waybar_config="/tmp/cava_waybar_config"
|
|
||||||
echo "
|
echo "
|
||||||
[general]
|
[general]
|
||||||
mode = normal
|
mode = normal
|
||||||
@@ -332,40 +354,22 @@ data_format = ascii
|
|||||||
ascii_max_range = 7
|
ascii_max_range = 7
|
||||||
" > $cava_waybar_config
|
" > $cava_waybar_config
|
||||||
|
|
||||||
# Clean pipe for playerctl
|
playerctl_waybar_pipe="/tmp/playerctl_waybar.fifo" # Clean pipe for playerctl
|
||||||
playerctl_waybar_pipe="/tmp/playerctl_waybar.fifo"
|
|
||||||
clean_create_pipe $playerctl_waybar_pipe
|
clean_create_pipe $playerctl_waybar_pipe
|
||||||
|
playerctl -a metadata --format '{"tooltip": "{{playerName}} : {{markup_escape(artist)}} - {{markup_escape(title)}}", "alt": "{{status}}", "class": "{{status}}"}' -F > "$playerctl_waybar_pipe" & # playerctl output into playerctl_waybar_pipe
|
||||||
# playerctl output into playerctl_waybar_pipe
|
while read -r line; do # Read the playerctl o/p via its fifo pipe
|
||||||
playerctl -a metadata --format '{"tooltip": "{{playerName}} : {{markup_escape(artist)}} - {{markup_escape(title)}}", "alt": "{{status}}", "class": "{{status}}"}' -F > "$playerctl_waybar_pipe" &
|
kill_pid_file $cava_waybar_pid # Kill the cava process to stop the input to cava_waybar_pipe
|
||||||
|
|
||||||
# Read the playerctl o/p via its fifo pipe
|
|
||||||
while read -r line; do
|
|
||||||
# Kill the cava process to stop the input to cava_waybar_pipe
|
|
||||||
kill_pid_file $cava_waybar_pid
|
|
||||||
|
|
||||||
echo "$line" | jq --unbuffered --compact-output
|
echo "$line" | jq --unbuffered --compact-output
|
||||||
|
|
||||||
# If the class says "Playing" and equilizer is enabled
|
# If the class says "Playing" and equilizer is enabled
|
||||||
# then show the cava equilizer
|
# then show the cava equilizer
|
||||||
if [[ $EQUILIZER == 1 && $(echo $line | jq -r '.class') == 'Playing' ]]; then
|
if [[ $EQUILIZER == 1 && $(echo $line | jq -r '.class') == 'Playing' ]]; then
|
||||||
# Show the playing title for 2 seconds
|
sleep 2 # Show the playing title for 2 seconds
|
||||||
sleep 2
|
cava -p $cava_waybar_config >$cava_waybar_pipe & # cava output into cava_waybar_pipe
|
||||||
|
echo $! > $cava_waybar_pid # Save the PID of child process
|
||||||
# cava output into cava_waybar_pipe
|
while read -r cmd2; do # Read the cava o/p via its fifo pipe
|
||||||
cava -p $cava_waybar_config >$cava_waybar_pipe &
|
echo "$line" | jq --arg a $(echo $cmd2 | sed "$dict") '.text = $a' --unbuffered --compact-output # Change the "text" key to bars
|
||||||
|
|
||||||
# Save the PID of child process
|
|
||||||
echo $! > $cava_waybar_pid
|
|
||||||
|
|
||||||
# Read the cava o/p via its fifo pipe
|
|
||||||
while read -r cmd2; do
|
|
||||||
# Change the "text" key to bars
|
|
||||||
echo "$line" | jq --arg a $(echo $cmd2 | sed "$dict") '.text = $a' --unbuffered --compact-output
|
|
||||||
done < $cava_waybar_pipe & # Do this fifo read in background
|
done < $cava_waybar_pipe & # Do this fifo read in background
|
||||||
|
echo $! >> $cava_waybar_pid # Save the while loop PID into the file as well
|
||||||
# Save the while loop PID into the file as well
|
|
||||||
echo $! >> $cava_waybar_pid
|
|
||||||
fi
|
fi
|
||||||
done < $playerctl_waybar_pipe
|
done < $playerctl_waybar_pipe
|
||||||
}
|
}
|
||||||
@@ -10,7 +10,6 @@ source "$CONFIG_FILE"
|
|||||||
# Define menu options as an associative array
|
# Define menu options as an associative array
|
||||||
declare -A menu_options=(
|
declare -A menu_options=(
|
||||||
|
|
||||||
|
|
||||||
#waybar
|
#waybar
|
||||||
["wbt ToggleWaybar"]="killall -SIGUSR1 waybar"
|
["wbt ToggleWaybar"]="killall -SIGUSR1 waybar"
|
||||||
["wbl WaybarLayout"]="$RunCMD waybar_layout"
|
["wbl WaybarLayout"]="$RunCMD waybar_layout"
|
||||||
@@ -32,12 +31,10 @@ declare -A menu_options=(
|
|||||||
#RunCMD
|
#RunCMD
|
||||||
["; Launcher"]="rofi -show drun -modi drun,filebrowser,run,window -theme $HOME/.config/rofi/launcher.rasi"
|
["; Launcher"]="rofi -show drun -modi drun,filebrowser,run,window -theme $HOME/.config/rofi/launcher.rasi"
|
||||||
["cb Clipboard"]="$RunCMD clip"
|
["cb Clipboard"]="$RunCMD clip"
|
||||||
["rmc RunCMDMusic"]="$RunCMD music -m"
|
["rm RunCMDMusic"]="$RunCMD music -m"
|
||||||
["emj RunCMDEmoji"]="$RunCMD emoji"
|
["emj RunCMDEmoji"]="$RunCMD emoji"
|
||||||
["cc Calculator"]="$RunCMD calc"
|
["cc Calculator"]="$RunCMD calc"
|
||||||
["td Todo"]="$RunCMD todo"
|
|
||||||
["tx Tmux"]="$RunCMD tmux"
|
["tx Tmux"]="$RunCMD tmux"
|
||||||
["nt Note"]="$RunCMD note"
|
|
||||||
["kb Kebinds"]="$RunCMD keybind"
|
["kb Kebinds"]="$RunCMD keybind"
|
||||||
["qe Edits"]="$RunCMD edit"
|
["qe Edits"]="$RunCMD edit"
|
||||||
#System
|
#System
|
||||||
@@ -45,18 +42,22 @@ declare -A menu_options=(
|
|||||||
["rr Reboot"]="$RunCMD sys_reboot"
|
["rr Reboot"]="$RunCMD sys_reboot"
|
||||||
["pm Powermenu"]="$RunCMD powermenu"
|
["pm Powermenu"]="$RunCMD powermenu"
|
||||||
["cn Close Notifactions"]="swaync-client -C"
|
["cn Close Notifactions"]="swaync-client -C"
|
||||||
["dm0"]="$RunCMD enable_edp1"
|
["dm0 disable monitor"]="$RunCMD disable_edp1"
|
||||||
["dm1"]="$RunCMD enable_edp1"
|
["dm1 enable monitor"]="$RunCMD enable_edp1"
|
||||||
["tt Touchpad"]="$RunCMD toggle_touchpad"
|
["tt Touchpad"]="$RunCMD toggle_touchpad"
|
||||||
|
["tbt Bluetooth"]="$RunCMD toggle_bluetooth"
|
||||||
["tw Wifi"]="$RunCMD toggle_wifi"
|
["tw Wifi"]="$RunCMD toggle_wifi"
|
||||||
["kb Keyboard switcher"]="$RunCMD kb_changer"
|
["kb Keyboard switcher"]="$RunCMD kb_changer"
|
||||||
|
["bt Bluetooth"]="$RunCMD bluetooth"
|
||||||
#Misc
|
#Misc
|
||||||
["ff Firefox"]="firefox"
|
["ff Firefox"]="firefox"
|
||||||
|
["ffp Firefox"]="firefox --private-window"
|
||||||
|
["dd Discord"]="discord"
|
||||||
["sr ScreenRecord"]="$RunCMD sr"
|
["sr ScreenRecord"]="$RunCMD sr"
|
||||||
["lg Lazygit"]="kitty lazygit"
|
["lg Lazygit"]="kitty lazygit"
|
||||||
["vi Nvim"]="kitty nvim"
|
["vi Nvim"]="kitty nvim"
|
||||||
["yz Yazi"]="kitty yazi"
|
["yz Yazi"]="kitty yazi"
|
||||||
["cd Codium"]="codium"
|
["cd Codium"]="codium --disable-gpu"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Main function
|
# Main function
|
||||||
|
|||||||
Reference in new issue
Block a user