Huge Update

This commit is contained in:
sankalp committed 2024-01-24 20:15:59 +05:45
1 parent b3f41b52b1
commit 0867aa7fca
26 files changed
+1182 -124

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
#!/bin/bash
batterynotify_conf=$HOME/.config/hypr/scripts/batterynotify.conf
batterynotify_conf=$HOME/.config/hypr/configs/batterynotify.conf
config_info() {
cat << EOF
+2 -2
View File
@@ -39,10 +39,10 @@ case "$1" in
get_backlight
;;
"--inc")
change_backlight "+10%"
change_backlight "+5%"
;;
"--dec")
change_backlight "10%-"
change_backlight "5%-"
;;
"--get-kbd")
get_kbd_backlight
+52 -4
View File
@@ -25,16 +25,26 @@ touchpad() {
# Toggle Wifi
wifi() {
wifi="$(nmcli r wifi | awk 'FNR = 2 {print $1}')"
if [ -n "$wifi" ]; then
rfkill block all &
wifi_status=$(nmcli radio wifi)
if [ "$wifi_status" == "enabled" ]; then
nmcli radio wifi off
notify-send -u low -i "$notif" 'Airplane mode: OFF'
else
rfkill unblock all &
nmcli radio wifi on
notify-send -u low -i "$notif" 'Airplane mode: ON'
fi
}
# Toggle Bluetooth
bluetooth() {
if [ "$bluetooth_status" == "no" ]; then
bluetoothctl power on
notify-send -u low -i "$notif" 'Bluetooth ON'
else
bluetoothctl power off
notify-send -u low -i "$notif" 'Bluetooth OFF'
fi
}
# Reload Waybar, Rofi, Swaync, and Rainbowborder.sh (SHIFT ALT R)
reload() {
@@ -109,3 +119,41 @@ disable_edp1() {
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]}"\"}"
}
File diff suppressed because it is too large. Load diff
-65
View File
@@ -1,65 +0,0 @@
#!/bin/sh
#####################################
# #
# @author : 00xZ4CKX #
#  GitHub : @S4NKALP #
#  Developer : Sankalp Tharu #
# 﫥 Copyright : Sankalp Tharu #
# #
#####################################
# Select the right temperature file. #
for temp_dir in /sys/class/hwmon/*; do
[[ "$(< "${temp_dir}/name")" =~ (coretemp|fam15h_power|k10temp) ]] && {
temp_dirs=("$temp_dir"/temp*_input)
temp_dir=${temp_dirs[0]}
break
}
done
# Get CPU temp. #
[[ -f "$temp_dir" ]] && deg="$(($(< "$temp_dir") * 100 / 10000))"
# Add CPU temp to the output. #
if [[ "$cpu_temp" != "off" && "$deg" ]]; then
deg="${deg//.}"
# Convert to Fahrenheit if enabled
[[ "$cpu_temp" == "F" ]] && deg="$((deg * 90 / 50 + 320))"
deg_no_format="${deg/${deg: -1}}"
# Format the output
deg="${deg/${deg: -1}}°${cpu_temp:-C}"
fi
# from 0°C to 40°C print -> 
if [[ "$deg_no_format" -le 40 ]]
then
echo -e "$deg"
# from 40°C to 60°C print -> 
elif [[ "$deg_no_format" -le 60 ]]
then
echo -e "$deg"
# from 60°C to 85°C print -> 
elif [[ "$deg_no_format" -le 85 ]]
then
echo -e "$deg"
# from 85°C to +... print -> 
elif [[ "$deg_no_format" -gt 85 ]]
then
# the ' -n "%{F#FF0008}" ' -> red font as 85°C to +... is the default warn temperature
echo -e "${BRed}$deg"
fi
+6
View File
@@ -67,3 +67,9 @@ NOTES_EDITOR="kitty nvim"
# Misc
lock="$SCRIPTSDIR/device_cmd.sh lockscreen"
# For panel
theme="$HOME/.config/rofi/config-panel.rasi"
# For Bluetooth
bluetooth_status=$(bluetoothctl show | grep "Powered" | awk '{print $2}')
+5 -1
View File
@@ -209,4 +209,8 @@ CONFIG=$(rofi -show file-browser-extended -file-browser-stdout -file-browser-dir
hyprctl dispatch exec "[float;size 45% 80%;center 1] kitty keyb -k '$CONFIG'"
}
# Emoji (ALT SLASH)
emoji() {
A="$(rofi -dmenu -l 10 -p "Emoji:" -config ~/.config/rofi/config-long.rasi < "$HOME/.config/hypr/configs/emojis" | cut -d' ' -f1 | tr -d '\n')"
[[ -n "$A" ]] && wl-copy -- "$A"
}
+1
View File
@@ -4,6 +4,7 @@ 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/Music_cmd.sh
source ~/.config/hypr/scripts/Widget.sh
help() {
declare -F
+141
View File
@@ -0,0 +1,141 @@
#!/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
}
+1 -1
View File
@@ -32,7 +32,7 @@ declare -A menu_options=(
["; 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"
["emj RunCMDEmoji"]="$scriptsDir/Emoji.sh"
["emj RunCMDEmoji"]="$RunCMD emoji"
["cc Calculator"]="$RunCMD calc"
["td Todo"]="$RunCMD todo"
["tx Tmux"]="$RunCMD tmux"
-28
View File
@@ -1,28 +0,0 @@
#? Full battery threshold (default: 100%)
battery_full_threshold=100
#? Critical battery threshold (default: 10%)
battery_critical_threshold=20
#? Low battery threshold (default: 20%)
battery_low_threshold=40
#? Unplug charger threshold (default: 80%)
unplug_charger_threshold=80
#? Countdown timer before executing execute_critical (default: 120 seconds)
timer=120
#? Notify interval for Battery Full Status (default: 1140 mins/ 1 day)
notify=1140
#? Notify interval on LOW and UNPLUG Status (default: 5%)
interval=3
#? Shows Battery Plug In/Out/Full Notification
undock=true
#? Command/script to execute at minimum unplug_charger_threshold
execute_unplug=""
#? Command/script to execute at maximum battery_low_threshold
execute_low=""
#? Command/script to execute if battery on critical threshold (default: systemctl suspend)
execute_critical="systemctl suspend"
#? Command/script to execute when battery is discharging, Required undock=true
execute_discharging="Battery power save -ba"
#? Command/script to execute when battery is charging, Required undock=true
execute_charging="Battery power reset"