mirror of
https://github.com/xsghetti/HyprCrux.git
synced 2025-07-03 05:40:38 -04:00
hyprpm/hyprlock
This commit is contained in:
parent
d4376c8ddf
commit
e973ebbc15
39 changed files with 2500 additions and 7 deletions
|
@ -27,7 +27,7 @@ exec-once = /usr/lib/polkit-kde-authentication-agent-1
|
||||||
exec-once = nm-applet --indicator
|
exec-once = nm-applet --indicator
|
||||||
exec-once = $discord
|
exec-once = $discord
|
||||||
exec-once = wal -r
|
exec-once = wal -r
|
||||||
exec-once = pypr
|
exec-once = swaync
|
||||||
|
|
||||||
# Source a file (multi-file configs)
|
# Source a file (multi-file configs)
|
||||||
# source = ~/.config/hypr/myColors.conf
|
# source = ~/.config/hypr/myColors.conf
|
||||||
|
@ -214,6 +214,7 @@ bind = $mainMod SHIFT, F, fullscreen
|
||||||
bind = $mainMod CTRL, F, exec, hyprctl dispatch workspaceopt allfloat
|
bind = $mainMod CTRL, F, exec, hyprctl dispatch workspaceopt allfloat
|
||||||
bind = $mainMod, B, exec, pypr expose
|
bind = $mainMod, B, exec, pypr expose
|
||||||
bind = $mainMod, N, exec, swaync-client -t -sw
|
bind = $mainMod, N, exec, swaync-client -t -sw
|
||||||
|
bind = $mainMod, L, exec, hyprlock
|
||||||
|
|
||||||
# Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more
|
# Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more
|
||||||
bind = $mainMod, T, exec, $terminal
|
bind = $mainMod, T, exec, $terminal
|
||||||
|
@ -297,11 +298,8 @@ bindl = , XF86AudioPrev, exec, playerctl previous
|
||||||
|
|
||||||
bind = $mainMod ALT, G, exec, $scrPath/gamemode.sh # disable hypr effects for gamemode
|
bind = $mainMod ALT, G, exec, $scrPath/gamemode.sh # disable hypr effects for gamemode
|
||||||
bind = $mainMod ALT, right, exec, /home/crux/.config/hypr/scripts/wallpaper.sh # next wallpaper
|
bind = $mainMod ALT, right, exec, /home/crux/.config/hypr/scripts/wallpaper.sh # next wallpaper
|
||||||
bind = $mainMod ALT, left, exec, $scrPath/swwwallpaper.sh -p # previous wallpaper
|
|
||||||
bind = $mainMod ALT, up, exec, $scrPath/wbarconfgen.sh n # next waybar mode
|
|
||||||
bind = $mainMod ALT, down, exec, $scrPath/wbarconfgen.sh p # previous waybar mode
|
|
||||||
bind = $mainMod SHIFT, D, exec, $scrPath/wallbashtoggle.sh # toggle wallbash on/off
|
|
||||||
bind = $mainMod SHIFT, T, exec, pkill -x rofi || $scrPath/themeselect.sh # theme select menu
|
|
||||||
bind = $mainMod SHIFT, A, exec, pkill -x rofi || $scrPath/rofiselect.sh # rofi style select menu
|
bind = $mainMod SHIFT, A, exec, pkill -x rofi || $scrPath/rofiselect.sh # rofi style select menu
|
||||||
bind = $mainMod SHIFT, W, exec, pkill -x rofi || $scrPath/swwwallselect.sh # rofi wall select menu
|
bind = $mainMod SHIFT, W, exec, pkill -x rofi || $scrPath/swwwallselect.sh # rofi wall select menu
|
||||||
bind = $mainMod, V, exec, pkill -x rofi || $scrPath/cliphist.sh c # open Pasteboard in screen center
|
bind = $mainMod, V, exec, pkill -x rofi || $scrPath/cliphist.sh c # open Pasteboard in screen center
|
||||||
|
@ -310,3 +308,41 @@ bind = $mainMod, K, exec, $scrPath/keyboardswitch.sh # change keyboard layout
|
||||||
# Blur Waybar
|
# Blur Waybar
|
||||||
layerrule=blur, rofi
|
layerrule=blur, rofi
|
||||||
layerrule=blur, waybar
|
layerrule=blur, waybar
|
||||||
|
|
||||||
|
|
||||||
|
# When entering overview mode, you can use left-button to jump, right-button to kill or use keybind
|
||||||
|
|
||||||
|
# If you are installing hycov with hyprpm, you should comment out this
|
||||||
|
# plugin = /usr/lib/libhycov.so
|
||||||
|
|
||||||
|
# If you are installing hycov by manually compile , you should comment out this
|
||||||
|
exec-once = hyprpm reload
|
||||||
|
|
||||||
|
# bind key to toggle overview (normal)
|
||||||
|
bind = ALT,tab,hycov:toggleoverview
|
||||||
|
|
||||||
|
# bind key to toggle overview (force mode, not affected by `only_active_workspace` or `only_active_monitor`)
|
||||||
|
bind = ALT,grave,hycov:toggleoverview,forceall #grave key is the '~' key
|
||||||
|
|
||||||
|
# bind key to toggle overview (shows all windows in one monitor, not affected by `only_active_workspace` or `only_active_monitor`)
|
||||||
|
bind = ALT,g,hycov:toggleoverview,forceallinone
|
||||||
|
|
||||||
|
# The key binding for directional switch mode.
|
||||||
|
# Calculate the window closest to the direction to switch focus.
|
||||||
|
# This keybind is applicable not only to the overview, but also to the general layout.
|
||||||
|
bind=ALT,left,hycov:movefocus,l
|
||||||
|
bind=ALT,right,hycov:movefocus,r
|
||||||
|
bind=ALT,up,hycov:movefocus,u
|
||||||
|
bind=ALT,down,hycov:movefocus,d
|
||||||
|
|
||||||
|
# if you want that focusmove can cross monitor, use this
|
||||||
|
bind=ALT,left,hycov:movefocus,leftcross
|
||||||
|
bind=ALT,right,hycov:movefocus,rightcross
|
||||||
|
bind=ALT,up,hycov:movefocus,upcross
|
||||||
|
bind=ALT,down,hycov:movefocus,downcross
|
||||||
|
|
||||||
|
plugin {
|
||||||
|
hyprtrails {
|
||||||
|
color = rgba(9a8ca3ff)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
83
.config/hypr/hyprlock.conf
Normal file
83
.config/hypr/hyprlock.conf
Normal file
|
@ -0,0 +1,83 @@
|
||||||
|
# Hyprlock
|
||||||
|
|
||||||
|
general {
|
||||||
|
hide_cursor = true
|
||||||
|
disable_loading_bar = false
|
||||||
|
grace = 1
|
||||||
|
no_fade_in = false
|
||||||
|
}
|
||||||
|
|
||||||
|
background {
|
||||||
|
monitor =
|
||||||
|
path = /home/crux/.config/wallpapers/wallhaven-o5jv65.png
|
||||||
|
color = rgba(20, 20, 20, 0.9)
|
||||||
|
|
||||||
|
# Blur
|
||||||
|
|
||||||
|
blur_passes = 1 # 0 disables blurring
|
||||||
|
blur_size = 3
|
||||||
|
noise = 0.0117
|
||||||
|
contrast = 0.8916
|
||||||
|
brightness = 0.8172
|
||||||
|
vibrancy = 0.1696
|
||||||
|
vibrancy_darkness = 0.0
|
||||||
|
}
|
||||||
|
|
||||||
|
input-field {
|
||||||
|
monitor = DP-1
|
||||||
|
size = 200, 50
|
||||||
|
outline_thickness = 0
|
||||||
|
dots_size = 0.33 # Scale of input-field height, 0.2 - 0.8
|
||||||
|
dots_spacing = 0.15 # Scale of dots' absolute size, 0.0 - 1.0
|
||||||
|
dots_center = true
|
||||||
|
outer_color = rgba(20, 20, 20, 0.3)
|
||||||
|
inner_color = rgb(200, 200, 200)
|
||||||
|
font_color = rgb(20, 20, 20)
|
||||||
|
fade_on_empty = false
|
||||||
|
placeholder_text = <span color="black">Password</span> # Text rendered in the input box when it's empty.
|
||||||
|
hide_input = false
|
||||||
|
|
||||||
|
position = 0, -20
|
||||||
|
halign = center
|
||||||
|
valign = center
|
||||||
|
}
|
||||||
|
|
||||||
|
# Labels
|
||||||
|
|
||||||
|
label {
|
||||||
|
monitor = DP-1
|
||||||
|
text = Welcome back, <span foreground="SkyBlue1" style="italic">$USER</span>! The void eagerly awaits your command.
|
||||||
|
color = rgba(200, 200, 200, 1)
|
||||||
|
font_size = 25
|
||||||
|
font_family = Inter
|
||||||
|
|
||||||
|
position = 0, 80
|
||||||
|
halign = center
|
||||||
|
valign = center
|
||||||
|
}
|
||||||
|
|
||||||
|
label {
|
||||||
|
monitor =
|
||||||
|
text = $TIME
|
||||||
|
color = rgb(200, 200, 200)
|
||||||
|
font_family = Inter bold
|
||||||
|
font_size = 40
|
||||||
|
|
||||||
|
position = 0, -150
|
||||||
|
halign = center
|
||||||
|
valign = top
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
label {
|
||||||
|
monitor =
|
||||||
|
text = <br/>
|
||||||
|
color = rgb(19, 200, 206)
|
||||||
|
font_size = 40
|
||||||
|
font_family = Inter bold
|
||||||
|
|
||||||
|
position = -100, -150
|
||||||
|
halign = center
|
||||||
|
valign = top
|
||||||
|
}
|
83
.config/hypr/scripts/amdgpu.py
Executable file
83
.config/hypr/scripts/amdgpu.py
Executable file
|
@ -0,0 +1,83 @@
|
||||||
|
import pyamdgpuinfo
|
||||||
|
import json
|
||||||
|
|
||||||
|
def format_frequency(frequency_hz: int) -> str:
|
||||||
|
"""
|
||||||
|
Takes a frequency (in Hz) and normalizes it: `Hz`, `MHz`, or `GHz`
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
str: frequency string with the appropriate suffix applied
|
||||||
|
"""
|
||||||
|
return (
|
||||||
|
format_size(frequency_hz, binary=False)
|
||||||
|
.replace("B", "Hz")
|
||||||
|
.replace("bytes", "Hz")
|
||||||
|
)
|
||||||
|
|
||||||
|
def format_size(size: int, binary=True) -> str:
|
||||||
|
"""
|
||||||
|
Format size in bytes to a human-readable format.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
size (int): Size in bytes.
|
||||||
|
binary (bool): If True, use binary (base 1024) units.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
str: Formatted size string.
|
||||||
|
"""
|
||||||
|
suffixes = ["B", "KiB", "MiB", "GiB", "TiB"] if binary else ["B", "KB", "MB", "GB", "TB"]
|
||||||
|
base = 1024 if binary else 1000
|
||||||
|
index = 0
|
||||||
|
|
||||||
|
while size >= base and index < len(suffixes) - 1:
|
||||||
|
size /= base
|
||||||
|
index += 1
|
||||||
|
|
||||||
|
return f"{size:.0f} {suffixes[index]}"
|
||||||
|
|
||||||
|
def main():
|
||||||
|
# Detect the number of GPUs available
|
||||||
|
n_devices = pyamdgpuinfo.detect_gpus()
|
||||||
|
|
||||||
|
if n_devices == 0:
|
||||||
|
print("No AMD GPUs detected.")
|
||||||
|
return
|
||||||
|
|
||||||
|
# Get GPU information for the first GPU (index 0)
|
||||||
|
first_gpu = pyamdgpuinfo.get_gpu(0)
|
||||||
|
|
||||||
|
try:
|
||||||
|
# Query GPU temperature
|
||||||
|
temperature = first_gpu.query_temperature()
|
||||||
|
temperature = f"{temperature:.0f}°C" # Format temperature to 2 digits with "°C"
|
||||||
|
|
||||||
|
# Query GPU core clock
|
||||||
|
core_clock_hz = first_gpu.query_sclk() # In Hz
|
||||||
|
formatted_core_clock = format_frequency(core_clock_hz)
|
||||||
|
|
||||||
|
# Query GPU power consumption
|
||||||
|
power_usage = first_gpu.query_power()
|
||||||
|
|
||||||
|
# Query GPU load
|
||||||
|
gpu_load = first_gpu.query_load()
|
||||||
|
formatted_gpu_load = f"{gpu_load:.1f}%" # Format GPU load to 1 decimal place
|
||||||
|
|
||||||
|
# Create a dictionary with the GPU information
|
||||||
|
gpu_info = {
|
||||||
|
"GPU Temperature": temperature,
|
||||||
|
"GPU Load": formatted_gpu_load,
|
||||||
|
"GPU Core Clock": formatted_core_clock,
|
||||||
|
"GPU Power Usage": f"{power_usage} Watts"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Convert the dictionary to a JSON string, ensure_ascii=False to prevent escaping
|
||||||
|
json_output = json.dumps(gpu_info, ensure_ascii=False)
|
||||||
|
|
||||||
|
# Print the JSON string
|
||||||
|
print(json_output)
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Error: {str(e)}")
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
270
.config/hypr/scripts/batterynotify.sh
Executable file
270
.config/hypr/scripts/batterynotify.sh
Executable file
|
@ -0,0 +1,270 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
ConfDir="${XDG_CONFIG_HOME:-$HOME/.config}"
|
||||||
|
batterynotify_conf=$ConfDir/hypr/hyprdots-ctl/batterynotify.conf
|
||||||
|
config_info() {
|
||||||
|
cat << EOF
|
||||||
|
|
||||||
|
Edit $batterynotify_conf for options.
|
||||||
|
|
||||||
|
STATUS THRESHOLD INTERVAL
|
||||||
|
Full $battery_full_threshold $notify Minutes
|
||||||
|
Critical $battery_critical_threshold $timer Seconds then '$execute_critical'
|
||||||
|
Low $battery_low_threshold $interval Percent then '$execute_low'
|
||||||
|
Unplug $unplug_charger_threshold $interval Percent then '$execute_unplug'
|
||||||
|
|
||||||
|
Charging: $execute_charging
|
||||||
|
Discharging: $execute_discharging
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
is_laptop() { # Check if the system is a laptop
|
||||||
|
if grep -q "Battery" /sys/class/power_supply/BAT*/type; then
|
||||||
|
return 0 # It's a laptop
|
||||||
|
else
|
||||||
|
echo "Cannot Detect a Battery. If this seems an error please report an issue to https://github.com/prasanthrangan/hyprdots."
|
||||||
|
exit 0 # It's not a laptop
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
fn_verbose () {
|
||||||
|
if $verbose; then
|
||||||
|
cat << VERBOSE
|
||||||
|
=============================================
|
||||||
|
Battery Status: $battery_status
|
||||||
|
Battery Percentage: $battery_percentage
|
||||||
|
=============================================
|
||||||
|
VERBOSE
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
fn_notify () { # Send notification
|
||||||
|
|
||||||
|
notify-send -a "Power" $1 -u $2 "$3" "$4" -p # Call the notify-send command with the provided arguments \$1 is the flags \$2 is the urgency \$3 is the title \$4 is the message
|
||||||
|
}
|
||||||
|
fn_percentage () {
|
||||||
|
if [[ "$battery_percentage" -ge "$unplug_charger_threshold" ]] && [[ "$battery_status" != "Discharging" ]] && [[ "$battery_status" != "Full" ]] && (( (battery_percentage - last_notified_percentage) >= $interval )); then if $verbose; then echo "Prompt:UNPLUG: $battery_unplug_threshold $battery_status $battery_percentage" ; fi
|
||||||
|
fn_notify "-t 5000 " "CRITICAL" "Battery Charged" "Battery is at $battery_percentage%. You can unplug the charger!"
|
||||||
|
last_notified_percentage=$battery_percentage
|
||||||
|
elif [[ "$battery_percentage" -le "$battery_critical_threshold" ]]; then
|
||||||
|
count=$(( timer > $mnt ? timer : $mnt )) # reset count
|
||||||
|
while [ $count -gt 0 ] && [[ $battery_status == "Discharging"* ]]; do
|
||||||
|
for battery in /sys/class/power_supply/BAT*; do battery_status=$(< "$battery/status") ; done
|
||||||
|
if [[ $battery_status != "Discharging" ]] ; then break ; fi
|
||||||
|
fn_notify "-t 5000 -r 69 " "CRITICAL" "Battery Critically Low" "$battery_percentage% is critically low. Device will execute $execute_critical in $((count/60)):$((count%60)) ."
|
||||||
|
count=$((count-1))
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
[ $count -eq 0 ] && fn_action
|
||||||
|
elif [[ "$battery_percentage" -le "$battery_low_threshold" ]] && [[ "$battery_status" == "Discharging" ]] && (( (last_notified_percentage - battery_percentage) >= $interval )); then if $verbose; then echo "Prompt:LOW: $battery_low_threshold $battery_status $battery_percentage" ; fi
|
||||||
|
fn_notify "-t 5000 " "CRITICAL" "Battery Low" "Battery is at $battery_percentage%. Connect the charger."
|
||||||
|
last_notified_percentage=$battery_percentage
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
fn_action () { #handles the $execute_critical command #? This is special as it will try to execute always
|
||||||
|
count=$(( timer > $mnt ? timer : $mnt )) # reset count
|
||||||
|
nohup $execute_critical
|
||||||
|
}
|
||||||
|
|
||||||
|
fn_status () {
|
||||||
|
if [[ $battery_percentage -ge $battery_full_threshold ]] && [[ "$battery_status" != *"Discharging"* ]]; then echo "Full and $battery_status"
|
||||||
|
battery_status="Full" ;fi
|
||||||
|
case "$battery_status" in # Handle the power supply status
|
||||||
|
"Discharging") if $verbose; then echo "Case:$battery_status Level: $battery_percentage" ;fi
|
||||||
|
if [[ "$prev_status" != "Discharging" ]] || [[ "$prev_status" == "Full" ]] ; then
|
||||||
|
prev_status=$battery_status
|
||||||
|
urgency=$([[ $battery_percentage -le "$battery_low_threshold" ]] && echo "CRITICAL" || echo "NORMAL")
|
||||||
|
fn_notify "-t 5000 -r 54321 " "$urgency" "Charger Plug OUT" "Battery is at $battery_percentage%."
|
||||||
|
$execute_discharging
|
||||||
|
fi
|
||||||
|
fn_percentage
|
||||||
|
;;
|
||||||
|
"Not"*|"Charging") if $verbose; then echo "Case:$battery_status Level: $battery_percentage" ;fi
|
||||||
|
if [[ "$prev_status" == "Discharging" ]] || [[ "$prev_status" == "Not"* ]] ; then
|
||||||
|
prev_status=$battery_status
|
||||||
|
count=$(( timer > $mnt ? timer : $mnt )) # reset count
|
||||||
|
urgency=$([[ "$battery_percentage" -ge $unplug_charger_threshold ]] && echo "CRITICAL" || echo "NORMAL")
|
||||||
|
fn_notify "-t 5000 -r 54321 " "$urgency" "Charger Plug In" "Battery is at $battery_percentage%."
|
||||||
|
$execute_charging
|
||||||
|
fi
|
||||||
|
fn_percentage
|
||||||
|
;;
|
||||||
|
"Full") if $verbose; then echo "Case:$battery_status Level: $battery_percentage" ;fi
|
||||||
|
if [[ $battery_status != "Discharging" ]]; then
|
||||||
|
now=$(date +%s)
|
||||||
|
if [[ "$prev_status" == *"harging"* ]] || ((now - lt >= $((notify*60)) )); then
|
||||||
|
fn_notify "-t 5000 -r 54321" "CRITICAL" "Battery Full" "Please unplug your Charger"
|
||||||
|
prev_status=$battery_status lt=$now
|
||||||
|
$execute_charging
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
if [[ ! -f "/tmp/hyprdots.batterynotify.status.fallback.$battery_status-$$" ]]; then
|
||||||
|
echo "Status: '==>> "$battery_status" <<==' Script on Fallback mode,Unknown power supply status.Please copy this line and raise an issue to the Github Repo.Also run 'ls /tmp/hyprdots.batterynotify' to see the list of lock files.*"
|
||||||
|
touch "/tmp/hyprdots.batterynotify.status.fallback.$battery_status-$$"
|
||||||
|
fi
|
||||||
|
fn_percentage
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
get_battery_info() { #? Might change this if we can get an effective way to parse dbus.
|
||||||
|
total_percentage=0 battery_count=0
|
||||||
|
for battery in /sys/class/power_supply/BAT*; do
|
||||||
|
battery_status=$(<"$battery/status") battery_percentage=$(<"$battery/capacity")
|
||||||
|
total_percentage=$((total_percentage + battery_percentage))
|
||||||
|
battery_count=$((battery_count + 1))
|
||||||
|
done
|
||||||
|
battery_percentage=$((total_percentage / battery_count)) #? For Multiple Battery
|
||||||
|
}
|
||||||
|
|
||||||
|
fn_status_change () { # Handle when status changes
|
||||||
|
get_battery_info
|
||||||
|
# Add these two lines at the beginning of the function
|
||||||
|
local executed_low=false
|
||||||
|
local executed_unplug=false
|
||||||
|
|
||||||
|
|
||||||
|
if [ "$battery_status" != "$last_battery_status" ] || [ "$battery_percentage" != "$last_battery_percentage" ]; then
|
||||||
|
last_battery_status=$battery_status
|
||||||
|
last_battery_percentage=$battery_percentage # Check if battery status or percentage has changed
|
||||||
|
fn_verbose
|
||||||
|
fn_percentage
|
||||||
|
|
||||||
|
if [[ "$battery_percentage" -le "$battery_low_threshold" ]] && ! $executed_low; then $execute_low
|
||||||
|
executed_low=true executed_unplug=false
|
||||||
|
fi
|
||||||
|
if [[ "$battery_percentage" -ge "$unplug_charger_threshold" ]] && ! $executed_unplug; then $execute_unplug
|
||||||
|
executed_unplug=true executed_low=false
|
||||||
|
fi
|
||||||
|
|
||||||
|
if $undock; then fn_status echo yes ; fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
resume_processes() { for pid in $pids ; do if [ "$pid" -ne "$current_pid" ] ; then kill -CONT $pid ; notify-send -a "Battery Notify" -t 2000 -r 9889 -u "CRITICAL" "Debugging ENDED, Resuming Regular Process" ; fi ; done }
|
||||||
|
|
||||||
|
main() { # Main function
|
||||||
|
if is_laptop; then
|
||||||
|
rm -fr /tmp/hyprdots.batterynotify* # Cleaning the lock file
|
||||||
|
battery_full_threshold=${battery_full_threshold:-100}
|
||||||
|
battery_critical_threshold=${battery_critical_threshold:-5}
|
||||||
|
unplug_charger_threshold=${unplug_charger_threshold:-80}
|
||||||
|
battery_low_threshold=${battery_low_threshold:-20}
|
||||||
|
timer=${timer:-120}
|
||||||
|
notify=${notify:-1140}
|
||||||
|
interval=${interval:-5}
|
||||||
|
execute_critical=${execute_critical:-"systemctl suspend"}
|
||||||
|
execute_low=${execute_low:-}
|
||||||
|
execute_unplug=${execute_unplug:-}
|
||||||
|
|
||||||
|
config_info
|
||||||
|
if $verbose; then for line in "Verbose Mode is ON..." "" "" "" "" ; do echo $line ; done;
|
||||||
|
current_pid=$$
|
||||||
|
pids=$(pgrep -f "/bin/bash $HOME/.config/hypr/scripts/batterynotify.sh" )
|
||||||
|
for pid in $pids ; do if [ "$pid" -ne $current_pid ] ;then kill -STOP "$pid" ;notify-send -a "Battery Notify" -t 2000 -r 9889 -u "CRITICAL" "Debugging STARTED, Pausing Regular Process" ;fi ; done ; trap resume_processes SIGINT ; fi
|
||||||
|
get_battery_info # initiate the function
|
||||||
|
last_notified_percentage=$battery_percentage
|
||||||
|
prev_status=$battery_status
|
||||||
|
|
||||||
|
dbus-monitor --system "type='signal',interface='org.freedesktop.DBus.Properties',path='$(upower -e | grep battery)'" 2> /dev/null | while read -r battery_status_change; do fn_status_change ; done
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
verbose=false undock=false
|
||||||
|
if [ ! -f "$batterynotify_conf" ]; then
|
||||||
|
mkdir -p "$(dirname "$batterynotify_conf")"
|
||||||
|
touch "$batterynotify_conf"
|
||||||
|
echo "[CREATED] $batterynotify_conf"
|
||||||
|
echo "
|
||||||
|
#? Full battery threshold (default: 100%)
|
||||||
|
battery_full_threshold=100
|
||||||
|
#? Critical battery threshold (default: 10%)
|
||||||
|
battery_critical_threshold=10
|
||||||
|
#? Low battery threshold (default: 20%)
|
||||||
|
battery_low_threshold=20
|
||||||
|
#? 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=5
|
||||||
|
#? Shows Battery Plug In/Out/Full Notification
|
||||||
|
undock=false
|
||||||
|
#? 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=\"\"
|
||||||
|
#? Command/script to execute when battery is charging, Required undock=true
|
||||||
|
execute_charging=\"\"
|
||||||
|
" > "$batterynotify_conf"
|
||||||
|
fi
|
||||||
|
|
||||||
|
source "$batterynotify_conf"
|
||||||
|
case "$1" in
|
||||||
|
--modify)
|
||||||
|
EDITOR="${EDITOR:-code}" #* Use VS Code as the default editor
|
||||||
|
echo -e "[Editor]: $EDITOR \n To change editor, run 'export EDITOR=prefered-editor' \n[Modifying]: $batterynotify_conf \nPress Any Key if done editing"
|
||||||
|
#kitty -o allow_remote_control=yes -o listen_on=unix:/tmp/mykitty $(which $EDITOR) "$batterynotify_conf" > /dev/null 2>&1 &
|
||||||
|
kitty "$(which $EDITOR)" "$batterynotify_conf" > /dev/null 2>&1 &
|
||||||
|
LAST_MD5SUM=$(md5sum "$batterynotify_conf")
|
||||||
|
while true; do CURRENT_MD5SUM=$(md5sum "$batterynotify_conf")
|
||||||
|
if [ "$CURRENT_MD5SUM" != "$LAST_MD5SUM" ]; then
|
||||||
|
notify-send "Config Changed: Needs reboot or restart $0"
|
||||||
|
LAST_MD5SUM="$CURRENT_MD5SUM"
|
||||||
|
fi ; read -t 2 -n 1 > /dev/null && break #? loop every 2 seconds
|
||||||
|
done
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
--info)
|
||||||
|
config_info
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
--reset)
|
||||||
|
rm -r "$batterynotify_conf"
|
||||||
|
echo "[RESET] Batterynotify configuration"
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
--verbose)
|
||||||
|
verbose=true
|
||||||
|
;;
|
||||||
|
-h|--help)
|
||||||
|
cat << HELP
|
||||||
|
Usage: $0 [options]
|
||||||
|
|
||||||
|
[--modify] Modify configuration file
|
||||||
|
[--info] Display configuration information
|
||||||
|
[--reset] Reset configuration
|
||||||
|
[--verbose] Debugging mode
|
||||||
|
[-h|--help] This Message
|
||||||
|
HELP
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
mnc=2 mxc=50 mnl=10 mxl=80 mnu=50 mxu=100 mnt=60 mxt=1000 mnf=80 mxf=100 mnn=1 mxn=1140 mni=1 mxi=10 #Defaults Ranges
|
||||||
|
check_range() {
|
||||||
|
local var=$1 min=$2 max=$3 error_message=$4
|
||||||
|
if [[ $var =~ ^[0-9]+$ ]] && (( var >= min && var <= max )); then
|
||||||
|
var=$var ; shift 2
|
||||||
|
else
|
||||||
|
echo "$1 ERROR: $error_message must be $min - $max." >&2 ; exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
check_range "$battery_full_threshold" $mnf $mxf "Full Threshold"
|
||||||
|
check_range "$battery_critical_threshold" $mnc $mxc "Critical Threshold"
|
||||||
|
check_range "$battery_low_threshold" $mnl $mxl "Low Threshold"
|
||||||
|
check_range "$unplug_charger_threshold" $mnu $mxu "Unplug Threshold"
|
||||||
|
check_range "$timer" $mnt $mxt "Timer"
|
||||||
|
check_range "$notify" $mnn $mxn "Notify"
|
||||||
|
check_range "$interval" $mni $mxi "Interval"
|
||||||
|
|
||||||
|
trap resume_processes SIGINT
|
||||||
|
|
||||||
|
main
|
45
.config/hypr/scripts/brightnesscontrol.sh
Executable file
45
.config/hypr/scripts/brightnesscontrol.sh
Executable file
|
@ -0,0 +1,45 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
ScrDir=`dirname "$(realpath "$0")"`
|
||||||
|
source $ScrDir/globalcontrol.sh
|
||||||
|
|
||||||
|
function print_error
|
||||||
|
{
|
||||||
|
cat << "EOF"
|
||||||
|
./brightnesscontrol.sh <action>
|
||||||
|
...valid actions are...
|
||||||
|
i -- <i>ncrease brightness [+5%]
|
||||||
|
d -- <d>ecrease brightness [-5%]
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
function send_notification {
|
||||||
|
brightness=`brightnessctl info | grep -oP "(?<=\()\d+(?=%)" | cat`
|
||||||
|
brightinfo=$(brightnessctl info | awk -F "'" '/Device/ {print $2}')
|
||||||
|
angle="$(((($brightness + 2) / 5) * 5))"
|
||||||
|
ico="~/.config/dunst/icons/vol/vol-${angle}.svg"
|
||||||
|
bar=$(seq -s "." $(($brightness / 15)) | sed 's/[0-9]//g')
|
||||||
|
dunstify "t2" -i $ico -a "$brightness$bar" "$brightinfo" -r 91190 -t 800
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_brightness {
|
||||||
|
brightnessctl -m | grep -o '[0-9]\+%' | head -c-2
|
||||||
|
}
|
||||||
|
|
||||||
|
case $1 in
|
||||||
|
i) # increase the backlight by 5%
|
||||||
|
brightnessctl set +5%
|
||||||
|
send_notification ;;
|
||||||
|
d) # decrease the backlight by 5%
|
||||||
|
if [[ $(get_brightness) -lt 5 ]] ; then
|
||||||
|
# avoid 0% brightness
|
||||||
|
brightnessctl set 1%
|
||||||
|
else
|
||||||
|
# decrease the backlight by 5%
|
||||||
|
brightnessctl set 5%-
|
||||||
|
fi
|
||||||
|
send_notification ;;
|
||||||
|
*) # print error
|
||||||
|
print_error ;;
|
||||||
|
esac
|
||||||
|
|
86
.config/hypr/scripts/cliphist.sh
Executable file
86
.config/hypr/scripts/cliphist.sh
Executable file
|
@ -0,0 +1,86 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
ScrDir=`dirname "$(realpath "$0")"`
|
||||||
|
source $ScrDir/globalcontrol.sh
|
||||||
|
roconf="~/.config/rofi/clipboard.rasi"
|
||||||
|
|
||||||
|
|
||||||
|
# set position
|
||||||
|
x_offset=-15 #* Cursor spawn position on clipboard
|
||||||
|
y_offset=210 #* To point the Cursor to the 1st and 2nd latest word
|
||||||
|
#!base on $HOME/.config/rofi/clipboard.rasi
|
||||||
|
clip_h=$(cat "${XDG_CONFIG_HOME:-$HOME/.config}/rofi/clipboard.rasi" | awk '/window {/,/}/' | awk '/height:/ {print $2}' | awk -F "%" '{print $1}')
|
||||||
|
clip_w=$(cat "${XDG_CONFIG_HOME:-$HOME/.config}/rofi/clipboard.rasi" | awk '/window {/,/}/' | awk '/width:/ {print $2}' | awk -F "%" '{print $1}')
|
||||||
|
#clip_h=55 #! Modify limits for size of the Clipboard
|
||||||
|
#clip_w=20 #! This values are transformed per cent(100)
|
||||||
|
#? Monitor resolution , scale and rotation
|
||||||
|
x_mon=$(hyprctl -j monitors | jq '.[] | select(.focused==true) | .width')
|
||||||
|
y_mon=$(hyprctl -j monitors | jq '.[] | select(.focused==true) | .height')
|
||||||
|
#? Rotated monitor?
|
||||||
|
monitor_rot=$(hyprctl -j monitors | jq '.[] | select(.focused==true) | .transform')
|
||||||
|
if [ "$monitor_rot" == "1" ] || [ "$monitor_rot" == "3" ]; then # if rotated 270 deg
|
||||||
|
tempmon=$x_mon
|
||||||
|
x_mon=$y_mon
|
||||||
|
y_mon=$tempmon
|
||||||
|
#! For rotated monitors
|
||||||
|
fi
|
||||||
|
#? Scaled monitor Size
|
||||||
|
monitor_scale=$(hyprctl -j monitors | jq '.[] | select (.focused == true) | .scale' | sed 's/\.//')
|
||||||
|
x_mon=$((x_mon * 100 / monitor_scale ))
|
||||||
|
y_mon=$((y_mon * 100 / monitor_scale))
|
||||||
|
#? monitor position
|
||||||
|
x_pos=$(hyprctl -j monitors | jq '.[] | select(.focused==true) | .x')
|
||||||
|
y_pos=$(hyprctl -j monitors | jq '.[] | select(.focused==true) | .y')
|
||||||
|
#? cursor position
|
||||||
|
x_cur=$(hyprctl -j cursorpos | jq '.x')
|
||||||
|
y_cur=$(hyprctl -j cursorpos | jq '.y')
|
||||||
|
# Ignore position
|
||||||
|
x_cur=$(( x_cur - x_pos))
|
||||||
|
y_cur=$(( y_cur - y_pos))
|
||||||
|
#Limiting
|
||||||
|
# Multiply before dividing to avoid losing precision due to integer division
|
||||||
|
clip_w=$(( x_mon*clip_w/100 ))
|
||||||
|
clip_h=$(( y_mon*clip_h/100 ))
|
||||||
|
max_x=$((x_mon - clip_w - 5 )) #offset of 5 for gaps
|
||||||
|
max_y=$((y_mon - clip_h - 15 )) #offset of 15 for gaps
|
||||||
|
x_cur=$((x_cur - x_offset))
|
||||||
|
y_cur=$((y_cur - y_offset))
|
||||||
|
#
|
||||||
|
x_cur=$(( x_cur < min_x ? min_x : ( x_cur > max_x ? max_x : x_cur)))
|
||||||
|
y_cur=$(( y_cur < min_y ? min_y : ( y_cur > max_y ? max_y : y_cur)))
|
||||||
|
|
||||||
|
pos="window {location: north west; x-offset: ${x_cur}px; y-offset: ${y_cur}px;}" #! I just Used the old pos function
|
||||||
|
#pos="window {location: $y_rofi $x_rofi; $x_offset $y_offset}"
|
||||||
|
|
||||||
|
# read hypr theme border
|
||||||
|
|
||||||
|
wind_border=$(( hypr_border * 3/2 ))
|
||||||
|
elem_border=`[ $hypr_border -eq 0 ] && echo "5" || echo $hypr_border`
|
||||||
|
r_override="window {border: ${hypr_width}px; border-radius: ${wind_border}px;} entry {border-radius: ${elem_border}px;} element {border-radius: ${elem_border}px;}"
|
||||||
|
|
||||||
|
|
||||||
|
# read hypr font size
|
||||||
|
|
||||||
|
fnt_override=`gsettings get org.gnome.desktop.interface monospace-font-name | awk '{gsub(/'\''/,""); print $NF}'`
|
||||||
|
fnt_override="configuration {font: \"JetBrainsMono Nerd Font ${fnt_override}\";}"
|
||||||
|
|
||||||
|
|
||||||
|
# clipboard action
|
||||||
|
|
||||||
|
case $1 in
|
||||||
|
c) cliphist list | rofi -dmenu -theme-str "entry { placeholder: \"Copy...\";} ${pos} ${r_override}" -theme-str "${fnt_override}" -config $roconf | cliphist decode | wl-copy
|
||||||
|
;;
|
||||||
|
d) cliphist list | rofi -dmenu -theme-str "entry { placeholder: \"Delete...\";} ${pos} ${r_override}" -theme-str "${fnt_override}" -config $roconf | cliphist delete
|
||||||
|
;;
|
||||||
|
w) if [ `echo -e "Yes\nNo" | rofi -dmenu -theme-str "entry { placeholder: \"Clear Clipboard History?\";} ${pos} ${r_override}" -theme-str "${fnt_override}" -config $roconf` == "Yes" ] ; then
|
||||||
|
cliphist wipe
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*) echo -e "cliphist.sh [action]"
|
||||||
|
echo "c : cliphist list and copy selected"
|
||||||
|
echo "d : cliphist list and delete selected"
|
||||||
|
echo "w : cliphist wipe database"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
5
.config/hypr/scripts/dontkillsteam.sh
Executable file
5
.config/hypr/scripts/dontkillsteam.sh
Executable file
|
@ -0,0 +1,5 @@
|
||||||
|
if [[ $(hyprctl activewindow -j | jq -r ".class") == "Steam" ]]; then
|
||||||
|
xdotool windowunmap $(xdotool getactivewindow)
|
||||||
|
else
|
||||||
|
hyprctl dispatch killactive ""
|
||||||
|
fi
|
59
.config/hypr/scripts/gamelauncher.sh
Executable file
59
.config/hypr/scripts/gamelauncher.sh
Executable file
|
@ -0,0 +1,59 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# set variables
|
||||||
|
ScrDir=`dirname "$(realpath "$0")"`
|
||||||
|
source $ScrDir/globalcontrol.sh
|
||||||
|
ThemeSet="${XDG_CONFIG_HOME:-$HOME/.config}/hypr/themes/theme.conf"
|
||||||
|
RofiConf="${XDG_CONFIG_HOME:-$HOME/.config}/rofi/steam/gamelauncher_${1}.rasi"
|
||||||
|
|
||||||
|
|
||||||
|
# set steam library
|
||||||
|
SteamLib="${XDG_DATA_HOME:-$HOME/.local/share}/Steam/config/libraryfolders.vdf"
|
||||||
|
SteamThumb="${XDG_DATA_HOME:-$HOME/.local/share}/Steam/appcache/librarycache"
|
||||||
|
|
||||||
|
if [ ! -f $SteamLib ] || [ ! -d $SteamThumb ] || [ ! -f $RofiConf ] ; then
|
||||||
|
dunstify "t1" -a "Steam library not found!" -r 91190 -t 2200
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# check steam mount paths
|
||||||
|
SteamPaths=`grep '"path"' $SteamLib | awk -F '"' '{print $4}'`
|
||||||
|
ManifestList=`find $SteamPaths/steamapps/ -type f -name "appmanifest_*.acf" 2>/dev/null`
|
||||||
|
|
||||||
|
|
||||||
|
# set rofi override
|
||||||
|
elem_border=$(( hypr_border * 2 ))
|
||||||
|
icon_border=$(( elem_border - 3 ))
|
||||||
|
r_override="element{border-radius:${elem_border}px;} element-icon{border-radius:${icon_border}px;}"
|
||||||
|
|
||||||
|
|
||||||
|
# read intalled games
|
||||||
|
GameList=$(echo "$ManifestList" | while read acf
|
||||||
|
do
|
||||||
|
appid=`grep '"appid"' $acf | cut -d '"' -f 4`
|
||||||
|
if [ -f ${SteamThumb}/${appid}_library_600x900.jpg ] ; then
|
||||||
|
game=`grep '"name"' $acf | cut -d '"' -f 4`
|
||||||
|
echo "$game|$appid"
|
||||||
|
else
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
done | sort)
|
||||||
|
|
||||||
|
|
||||||
|
# launch rofi menu
|
||||||
|
RofiSel=$( echo "$GameList" | while read acf
|
||||||
|
do
|
||||||
|
appid=`echo $acf | cut -d '|' -f 2`
|
||||||
|
game=`echo $acf | cut -d '|' -f 1`
|
||||||
|
echo -en "$game\x00icon\x1f${SteamThumb}/${appid}_library_600x900.jpg\n"
|
||||||
|
done | rofi -dmenu -theme-str "${r_override}" -config $RofiConf)
|
||||||
|
|
||||||
|
|
||||||
|
# launch game
|
||||||
|
if [ ! -z "$RofiSel" ] ; then
|
||||||
|
launchid=`echo "$GameList" | grep "$RofiSel" | cut -d '|' -f 2`
|
||||||
|
steam -applaunch "${launchid} [gamemoderun %command%]" &
|
||||||
|
dunstify "t1" -a "Launching ${RofiSel}..." -i ${SteamThumb}/${launchid}_header.jpg -r 91190 -t 2200
|
||||||
|
fi
|
||||||
|
|
14
.config/hypr/scripts/gamemode.sh
Executable file
14
.config/hypr/scripts/gamemode.sh
Executable file
|
@ -0,0 +1,14 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
HYPRGAMEMODE=$(hyprctl getoption animations:enabled | sed -n '2p' | awk '{print $2}')
|
||||||
|
if [ $HYPRGAMEMODE = 1 ] ; then
|
||||||
|
hyprctl --batch "\
|
||||||
|
keyword animations:enabled 0;\
|
||||||
|
keyword decoration:drop_shadow 0;\
|
||||||
|
keyword decoration:blur:enabled 0;\
|
||||||
|
keyword general:gaps_in 0;\
|
||||||
|
keyword general:gaps_out 0;\
|
||||||
|
keyword general:border_size 1;\
|
||||||
|
keyword decoration:rounding 0"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
hyprctl reload
|
60
.config/hypr/scripts/globalcontrol.sh
Executable file
60
.config/hypr/scripts/globalcontrol.sh
Executable file
|
@ -0,0 +1,60 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# wallpaper var
|
||||||
|
EnableWallDcol=0
|
||||||
|
ConfDir="${XDG_CONFIG_HOME:-$HOME/.config}"
|
||||||
|
CloneDir="$HOME/Hyprdots"
|
||||||
|
ThemeCtl="$ConfDir/hypr/theme.ctl"
|
||||||
|
cacheDir="$HOME/.cache/hyprdots"
|
||||||
|
|
||||||
|
# theme var
|
||||||
|
gtkTheme=`gsettings get org.gnome.desktop.interface gtk-theme | sed "s/'//g"`
|
||||||
|
gtkMode=`gsettings get org.gnome.desktop.interface color-scheme | sed "s/'//g" | awk -F '-' '{print $2}'`
|
||||||
|
|
||||||
|
# hypr var
|
||||||
|
hypr_border=`hyprctl -j getoption decoration:rounding | jq '.int'`
|
||||||
|
hypr_width=`hyprctl -j getoption general:border_size | jq '.int'`
|
||||||
|
|
||||||
|
# notification var
|
||||||
|
#ncolor="-h string:bgcolor:#191724 -h string:fgcolor:#faf4ed -h string:frcolor:#56526e"
|
||||||
|
#
|
||||||
|
#if [ "${gtkMode}" == "light" ] ; then
|
||||||
|
# ncolor="-h string:bgcolor:#f4ede8 -h string:fgcolor:#9893a5 -h string:frcolor:#908caa"
|
||||||
|
#fi
|
||||||
|
|
||||||
|
# pacman fns
|
||||||
|
pkg_installed()
|
||||||
|
{
|
||||||
|
local PkgIn=$1
|
||||||
|
|
||||||
|
if pacman -Qi $PkgIn &> /dev/null
|
||||||
|
then
|
||||||
|
#echo "${PkgIn} is already installed..."
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
#echo "${PkgIn} is not installed..."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
get_aurhlpr()
|
||||||
|
{
|
||||||
|
if pkg_installed yay
|
||||||
|
then
|
||||||
|
aurhlpr="yay"
|
||||||
|
elif pkg_installed paru
|
||||||
|
then
|
||||||
|
aurhlpr="paru"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
check(){
|
||||||
|
local Pkg_Dep=$(for PkgIn in "$@"; do ! pkg_installed $PkgIn && echo "$PkgIn"; done)
|
||||||
|
|
||||||
|
if [ -n "$Pkg_Dep" ]; then echo -e "$0 Dependencies:\n$Pkg_Dep"
|
||||||
|
read -p "ENTER to install (Other key: Cancel): " ans
|
||||||
|
if [ -z "$ans" ]; then get_aurhlpr ; $aurhlpr -S $Pkg_Dep
|
||||||
|
else echo "Skipping installation of packages" ;exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
89
.config/hypr/scripts/gpuinfo.sh
Executable file
89
.config/hypr/scripts/gpuinfo.sh
Executable file
|
@ -0,0 +1,89 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Check for NVIDIA GPU using nvidia-smi
|
||||||
|
nvidia_gpu=$(nvidia-smi --query-gpu=gpu_name --format=csv,noheader,nounits | head -n 1)
|
||||||
|
|
||||||
|
# Function to execute the AMD GPU Python script and use its output
|
||||||
|
execute_amd_script() {
|
||||||
|
local amd_output
|
||||||
|
amd_output=$(python3 ~/.config/hypr/scripts/amdgpu.py)
|
||||||
|
echo "$amd_output"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to get Intel GPU temperature from 'sensors'
|
||||||
|
get_intel_gpu_temperature() {
|
||||||
|
local temperature
|
||||||
|
temperature=$(sensors | grep "Package id 0" | awk '{print $4}' | sed 's/+//;s/°C//;s/\.0//')
|
||||||
|
echo "$temperature"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to define emoji based on temperature
|
||||||
|
get_temperature_emoji() {
|
||||||
|
local temperature="$1"
|
||||||
|
if [ "$temperature" -lt 60 ]; then
|
||||||
|
echo "❄️" # Ice emoji for less than 60°C
|
||||||
|
else
|
||||||
|
echo "🔥" # Fire emoji for 60°C or higher
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Check if primary GPU is NVIDIA
|
||||||
|
if [ -n "$nvidia_gpu" ]; then
|
||||||
|
# if nvidia-smi failed, format and exit.
|
||||||
|
if [[ $nvidia_gpu == *"NVIDIA-SMI has failed"* ]]; then
|
||||||
|
# Print the formatted information in JSON
|
||||||
|
echo "{\"text\":\"N/A\", \"tooltip\":\"Primary GPU: Not found\"}"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
primary_gpu="NVIDIA GPU"
|
||||||
|
# Collect GPU information for NVIDIA
|
||||||
|
gpu_info=$(nvidia-smi --query-gpu=temperature.gpu,utilization.gpu,clocks.current.graphics,clocks.max.graphics,power.draw,power.max_limit --format=csv,noheader,nounits)
|
||||||
|
# Split the comma-separated values into an array
|
||||||
|
IFS=',' read -ra gpu_data <<< "$gpu_info"
|
||||||
|
# Extract individual values
|
||||||
|
temperature="${gpu_data[0]// /}"
|
||||||
|
utilization="${gpu_data[1]// /}"
|
||||||
|
current_clock_speed="${gpu_data[2]// /}"
|
||||||
|
max_clock_speed="${gpu_data[3]// /}"
|
||||||
|
power_usage="${gpu_data[4]// /}"
|
||||||
|
power_limit="${gpu_data[5]// /}"
|
||||||
|
|
||||||
|
# Get emoji based on temperature
|
||||||
|
emoji=$(get_temperature_emoji "$temperature")
|
||||||
|
|
||||||
|
# Print the formatted information in JSON
|
||||||
|
echo "{\"text\":\"$temperature°C\", \"tooltip\":\"Primary GPU: $primary_gpu\n$emoji Temperature: $temperature°C\n Utilization: $utilization%\n Clock Speed: $current_clock_speed/$max_clock_speed MHz\n Power Usage: $power_usage/$power_limit W\"}"
|
||||||
|
else
|
||||||
|
# Execute the AMD GPU Python script and use its output
|
||||||
|
amd_output=$(execute_amd_script)
|
||||||
|
# Extract GPU Temperature, GPU Load, GPU Core Clock, and GPU Power Usage from amd_output
|
||||||
|
temperature=$(echo "$amd_output" | jq -r '.["GPU Temperature"]' | sed 's/°C//')
|
||||||
|
gpu_load=$(echo "$amd_output" | jq -r '.["GPU Load"]' | sed 's/%//')
|
||||||
|
core_clock=$(echo "$amd_output" | jq -r '.["GPU Core Clock"]' | sed 's/ GHz//;s/ MHz//')
|
||||||
|
power_usage=$(echo "$amd_output" | jq -r '.["GPU Power Usage"]' | sed 's/ Watts//')
|
||||||
|
|
||||||
|
# Get emoji based on temperature
|
||||||
|
emoji=$(get_temperature_emoji "$temperature")
|
||||||
|
|
||||||
|
# Print the formatted information in JSON
|
||||||
|
if [ -n "$temperature" ]; then
|
||||||
|
primary_gpu="AMD GPU"
|
||||||
|
echo "{\"text\":\"$temperature°C\", \"tooltip\":\"Primary GPU: $primary_gpu\n$emoji Temperature: $temperature°C\n Utilization: $gpu_load%\n Clock Speed: $core_clock MHz\n Power Usage: $power_usage W\"}"
|
||||||
|
else
|
||||||
|
# Check for Intel GPU
|
||||||
|
primary_gpu="Intel GPU"
|
||||||
|
intel_gpu=$(lspci -nn | grep -i "VGA compatible controller" | grep -i "Intel Corporation" | awk -F' ' '{print $1}')
|
||||||
|
if [ -n "$intel_gpu" ]; then
|
||||||
|
temperature=$(get_intel_gpu_temperature)
|
||||||
|
emoji=$(get_temperature_emoji "$temperature")
|
||||||
|
# Print the formatted information in JSON
|
||||||
|
echo "{\"text\":\"$temperature°C\", \"tooltip\":\"Primary GPU: $primary_gpu\n$emoji Temperature: $temperature°C\"}"
|
||||||
|
else
|
||||||
|
primary_gpu="Not found"
|
||||||
|
gpu_info=""
|
||||||
|
# Print the formatted information in JSON
|
||||||
|
echo "{\"text\":\"N/A\", \"tooltip\":\"Primary GPU: $primary_gpu\"}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
296
.config/hypr/scripts/keybinds_hint.sh
Normal file
296
.config/hypr/scripts/keybinds_hint.sh
Normal file
|
@ -0,0 +1,296 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
pkill -x rofi && exit
|
||||||
|
ConfDir="${XDG_CONFIG_HOME:-$HOME/.config}"
|
||||||
|
keyConfDir="$ConfDir/hypr"
|
||||||
|
keyConf="$keyConfDir/hyprland.conf $keyConfDir/keybindings.conf $keyConfDir/userprefs.conf $*"
|
||||||
|
tmpMapDir="/tmp"
|
||||||
|
tmpMap="$tmpMapDir/hyprdots-keybinds.jq"
|
||||||
|
|
||||||
|
. $HOME/.config/hypr/scripts/globalcontrol.sh
|
||||||
|
roDir="$ConfDir/rofi"
|
||||||
|
roconf="$roDir/Keybinds_Hint.rasi"
|
||||||
|
|
||||||
|
# read hypr theme border
|
||||||
|
wind_border=$((hypr_border * 3))
|
||||||
|
elem_border=$([ $hypr_border -eq 0 ] && echo "10" || echo $((hypr_border * 2)))
|
||||||
|
r_override="window {border: ${hypr_width}px; border-radius: ${wind_border}px;} element {border-radius: ${elem_border}px;}"
|
||||||
|
|
||||||
|
# read hypr font size
|
||||||
|
fnt_override=$(gsettings get org.gnome.desktop.interface font-name | awk '{gsub(/'\''/,""); print $NF}')
|
||||||
|
fnt_override="configuration {font: \"JetBrainsMono Nerd Font ${fnt_override}\";}"
|
||||||
|
|
||||||
|
# read hypr theme icon
|
||||||
|
icon_override=$(gsettings get org.gnome.desktop.interface icon-theme | sed "s/'//g")
|
||||||
|
icon_override="configuration {icon-theme: \"${icon_override}\";}"
|
||||||
|
|
||||||
|
keyVars="$(grep -h '^ *\$' $keyConf | awk -F ' = ' '{gsub(/^ *\$| *$/, "", $1); gsub(/^ *| *$/, "", $2); print $1 "='\''"$2"'\''"}')"
|
||||||
|
keyVars+="
|
||||||
|
"
|
||||||
|
keyVars+="HOME=$HOME"
|
||||||
|
# echo "$keyVars"
|
||||||
|
|
||||||
|
substitute_vars() {
|
||||||
|
local s="$1"
|
||||||
|
local IFS=$'\n'
|
||||||
|
for var in $keyVars; do
|
||||||
|
varName="${var%%=*}"
|
||||||
|
varValue="${var#*=}"
|
||||||
|
varValue="${varValue#\'}"
|
||||||
|
varValue="${varValue%\'}"
|
||||||
|
s="${s//\$$varName/$varValue}"
|
||||||
|
done
|
||||||
|
IFS=$' \t\n'
|
||||||
|
echo "$s"
|
||||||
|
}
|
||||||
|
#? Other accurate but risky option
|
||||||
|
# eval "$keyVars"
|
||||||
|
# substitute_vars() {
|
||||||
|
# local s="$1"
|
||||||
|
# local IFS=$'\n'
|
||||||
|
# for var in $keyVars; do
|
||||||
|
# varName="${var%%=*}"
|
||||||
|
# s="${s//\$$varName/${!varName}}"
|
||||||
|
# done
|
||||||
|
# IFS=$' \t\n'
|
||||||
|
# echo "$s"
|
||||||
|
# }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# scrPath='~/.config/hypr/scripts'
|
||||||
|
# comments=$(awk -v scrPath="$scrPath" -F ',' '!/^#/ && /bind*/ && $3 ~ /exec/ && NF && $4 !~ /^ *$/ {gsub(/\$scrPath/, scrPath, $4); print $4}' $keyConf | sed "s#\"#'#g" )
|
||||||
|
comments=$(awk -F ',' '!/^#/ && /bind*/ && $3 ~ /exec/ && NF && $4 !~ /^ *$/ { print $4}' $keyConf | sed "s#\"#'#g" )
|
||||||
|
comments=$(substitute_vars "$comments" | awk -F'#' '{gsub(/^ */, "", $1); gsub(/ *$/, "", $1); split($2, a, " "); a[1] = toupper(substr(a[1], 1, 1)) substr(a[1], 2); $2 = a[1]; for(i=2; i<=length(a); i++) $2 = $2" "a[i]; gsub(/^ */, "", $2); gsub(/ *$/, "", $2); if (length($1) > 0) print "\""$1"\" : \""(length($2) > 0 ? $2 : $1)"\","}'|
|
||||||
|
awk '!seen[$0]++')
|
||||||
|
# echo "$comments"
|
||||||
|
# exit
|
||||||
|
cat << EOF > $tmpMap
|
||||||
|
# hyprdots-keybinds.jq
|
||||||
|
def executables_mapping: { #? Derived from .args to parse scripts to be Readable
|
||||||
|
#? Auto Generated Comment Conversion
|
||||||
|
$comments
|
||||||
|
#? Defaults
|
||||||
|
" empty " : "Empty",
|
||||||
|
"r+1" : "Relative Right",
|
||||||
|
"r-1" : "Relative Left",
|
||||||
|
"e+1" : "Next",
|
||||||
|
"e-1" : "Previous",
|
||||||
|
"movewindow" : "Move window",
|
||||||
|
"resizewindow" : "Resize window",
|
||||||
|
"d" : "Down",
|
||||||
|
"l" : "Left",
|
||||||
|
"r" : "Right",
|
||||||
|
"u" : "Up",
|
||||||
|
};
|
||||||
|
EOF
|
||||||
|
|
||||||
|
#? Script to re Modify hyprctl json output
|
||||||
|
#! This is Our Translator for some binds #Khing!
|
||||||
|
jsonData="$(hyprctl binds -j | jq -L "$tmpMapDir" -c '
|
||||||
|
include "hyprdots-keybinds";
|
||||||
|
|
||||||
|
def modmask_mapping: { #? Define mapping for modmask numbers represents bitmask
|
||||||
|
"64": " ", #? SUPER
|
||||||
|
# "32" : "ERROR:32", #* Dont know
|
||||||
|
# "16": "Err:16", #* Dont know
|
||||||
|
"8": "ALT",
|
||||||
|
"4": "CTRL",
|
||||||
|
#! "2": "SHIFT", # Wrong dunno yet
|
||||||
|
"1": "SHIFT",
|
||||||
|
"0": " ",
|
||||||
|
};
|
||||||
|
def key_mapping: { #?Define mappings for .keys to be readable symbols
|
||||||
|
"mouse_up" : "",
|
||||||
|
"mouse_down" : "",
|
||||||
|
"mouse:272" : "",
|
||||||
|
"mouse:273" : "",
|
||||||
|
"UP" : "",
|
||||||
|
"DOWN" : "",
|
||||||
|
"LEFT" : "",
|
||||||
|
"RIGHT" : "",
|
||||||
|
"XF86AudioLowerVolume" : "",
|
||||||
|
"XF86AudioMicMute" : "",
|
||||||
|
"XF86AudioMute" : "",
|
||||||
|
"XF86AudioNext" : "",
|
||||||
|
"XF86AudioPause" : "",
|
||||||
|
"XF86AudioPlay" : "",
|
||||||
|
"XF86AudioPrev" : "",
|
||||||
|
"XF86AudioRaiseVolume" : "",
|
||||||
|
"XF86MonBrightnessDown" : "",
|
||||||
|
"XF86MonBrightnessUp" : "",
|
||||||
|
"switch:on:Lid Switch" : "",
|
||||||
|
"backspace" : ""
|
||||||
|
};
|
||||||
|
def category_mapping: { #? Define Category Names, derive from Dispatcher
|
||||||
|
"exec" : "Execute a Command:",
|
||||||
|
"global": "Global:",
|
||||||
|
"exit" : "Exit Hyprland Session",
|
||||||
|
"fullscreen" : "Toggle Functions",
|
||||||
|
"mouse" : "Mouse functions",
|
||||||
|
"movefocus" : "Window functions",
|
||||||
|
"movewindow" : "Window functions",
|
||||||
|
"resizeactive" : "Window functions",
|
||||||
|
"togglefloating" : "Toggle Functions",
|
||||||
|
"togglegroup" : "Toggle Functions",
|
||||||
|
"togglespecialworkspace" : "Toggle Functions",
|
||||||
|
"togglesplit" : "Toggle Functions",
|
||||||
|
"workspace" : "Navigate Workspace",
|
||||||
|
"movetoworkspace" : "Navigate Workspace",
|
||||||
|
"movetoworkspacesilent" : "Navigate Workspace",
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
def arg_mapping: { #! Do not Change this used for Demo only... As this will change .args! will be fatal
|
||||||
|
"arg2": "mapped_arg2",
|
||||||
|
};
|
||||||
|
|
||||||
|
def description_mapping: { #? Derived from dispatcher and Gives Description for Dispatchers; Basically translates dispatcher.
|
||||||
|
"movefocus": "Move Focus",
|
||||||
|
"resizeactive": "Resize Active Floting Window",
|
||||||
|
"exit" : "End Hyprland Session",
|
||||||
|
"movetoworkspacesilent" : "Silently Move to Workspace",
|
||||||
|
"movewindow" : "Move Window",
|
||||||
|
"exec" : "" , #? Remove exec as execuatable will give the Description from separate function
|
||||||
|
"movetoworkspace" : "Move To Workspace:",
|
||||||
|
"workspace" : "Navigate to Workspace:",
|
||||||
|
"togglefloating" : "Toggle Floating",
|
||||||
|
"fullscreen" : "Toggle Fullscreen",
|
||||||
|
"togglegroup" : "Toggle Group",
|
||||||
|
"togglesplit" : "Toggle Split",
|
||||||
|
"togglespecialworkspace" : "Toggle Special Workspace",
|
||||||
|
"mouse" : "Use Mouse"
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
def get_keys: #? Funtions to Convert modmask into Keys, There should be a beter math for this but Im lazy
|
||||||
|
if . == 0 then
|
||||||
|
""
|
||||||
|
elif . >= 64 then
|
||||||
|
. -= 64 | modmask_mapping["64"] + " " + get_keys
|
||||||
|
elif . >= 32 then
|
||||||
|
. -= 32 | modmask_mapping["32"] + " " + get_keys
|
||||||
|
elif . >= 16 then
|
||||||
|
. -= 16 | modmask_mapping["16"] + " " + get_keys
|
||||||
|
elif . >= 8 then
|
||||||
|
. -= 8 | modmask_mapping["8"] + " " + get_keys
|
||||||
|
elif . >= 4 then
|
||||||
|
. -= 4 | modmask_mapping["4"] + " " + get_keys
|
||||||
|
elif . >= 2 then
|
||||||
|
. -= 2 | modmask_mapping["2"] + " " + get_keys
|
||||||
|
elif . >= 1 then
|
||||||
|
. -= 1 | modmask_mapping["1"] + " " + get_keys
|
||||||
|
else
|
||||||
|
.
|
||||||
|
end;
|
||||||
|
.[] |
|
||||||
|
|
||||||
|
.dispatcher as $dispatcher | .description = $dispatcher |
|
||||||
|
.dispatcher as $dispatcher | .category = $dispatcher |
|
||||||
|
.arg as $arg | .executables = $arg |
|
||||||
|
|
||||||
|
.modmask |= (get_keys | ltrimstr(" ")) |
|
||||||
|
.key |= (key_mapping[.] // .) |
|
||||||
|
|
||||||
|
.keybind = (.modmask | tostring // "") + (.key // "") |
|
||||||
|
|
||||||
|
.flags = " locked=" + (.locked | tostring) + " mouse=" + (.mouse | tostring) + " release=" + (.release | tostring) + " repeat=" + (.repeat | tostring) + " non_consuming=" + (.non_consuming | tostring) |
|
||||||
|
|
||||||
|
.category |= (category_mapping[.] // .) |
|
||||||
|
|
||||||
|
#!if .modmask and .modmask != " " and .modmask != "" then .modmask |= (split(" ") | map(select(length > 0)) | if length > 1 then join(" + ") else .[0] end) else .modmask = "" end |
|
||||||
|
if .keybind and .keybind != " " and .keybind != "" then .keybind |= (split(" ") | map(select(length > 0)) | if length > 1 then join(" + ") else .[0] end) else .keybind = "" end |
|
||||||
|
|
||||||
|
|
||||||
|
.arg |= (arg_mapping[.] // .) |
|
||||||
|
#! .executables |= gsub(".sh"; "") | #? Usefull soon
|
||||||
|
|
||||||
|
.executables |= (executables_mapping[.] // .) |
|
||||||
|
.description |= (description_mapping[.] // .)
|
||||||
|
|
||||||
|
' #? <---- There is a ' do not delete this'
|
||||||
|
)"
|
||||||
|
|
||||||
|
#? Now we have the metadata we can Group it accordingly
|
||||||
|
GROUP() {
|
||||||
|
awk -F '!=!' '
|
||||||
|
{
|
||||||
|
category = $1
|
||||||
|
binds[category] = binds[category] ? binds[category] "\n" $0 : $0
|
||||||
|
}
|
||||||
|
|
||||||
|
END {
|
||||||
|
n = asorti(binds, b)
|
||||||
|
for (i = 1; i <= n; i++) {
|
||||||
|
print b[i] # Print the header name
|
||||||
|
gsub(/\[.*\] =/, "", b[i])
|
||||||
|
split(binds[b[i]], lines, "\n")
|
||||||
|
for (j in lines) {
|
||||||
|
line = substr(lines[j], index(lines[j], "=") + 2)
|
||||||
|
print line
|
||||||
|
}
|
||||||
|
for (j = 1; j <= 68; j++) printf "━"
|
||||||
|
printf "\n"
|
||||||
|
}
|
||||||
|
}'
|
||||||
|
}
|
||||||
|
|
||||||
|
#? Here we we format the output into a desirable format we want.
|
||||||
|
DISPLAY() { awk -F '!=!' '{if ($0 ~ /=/ && $6 != "") printf "%-25s > %-30s\n", $5, $6; else if ($0 ~ /=/) printf "%-25s\n", $5; else print $0}' ;}
|
||||||
|
|
||||||
|
#? Extra design use for distiction
|
||||||
|
header="$(printf "%-35s %-1s %-20s\n" " Keybinds" "" "Description")"
|
||||||
|
line="$(printf '%.0s━' $(seq 1 68) "")"
|
||||||
|
|
||||||
|
|
||||||
|
# echo "$jsonData"
|
||||||
|
metaData="$(echo "$jsonData" | jq -r '"\(.category) !=! \(.modmask) !=! \(.key) !=! \(.dispatcher) !=! \(.arg) !=! \(.keybind) !=! \(.description) \(.executables) !=! \(.flags)"' | tr -s ' ' | sort -k 1 )" #! this Part Gives extra laoding time as I don't have efforts to make all spaces on each class only 1
|
||||||
|
# echo "$metaData"
|
||||||
|
|
||||||
|
display="$(echo "$metaData" | GROUP | DISPLAY )"
|
||||||
|
|
||||||
|
# output=$(echo -e "${header}\n${line}\n${primMenu}\n${line}\n${display}")
|
||||||
|
output=$(echo -e "${header}\n${line}\n${display}")
|
||||||
|
|
||||||
|
#? will display on the terminal if rofi is not found
|
||||||
|
if ! command -v rofi &> /dev/null
|
||||||
|
then
|
||||||
|
echo "$output"
|
||||||
|
echo "rofi not detected. Displaying on terminal instead"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
#? Actions to do when selected
|
||||||
|
selected=$(echo "$output" | rofi -dmenu -p -i -theme-str "${fnt_override}" -theme-str "${r_override}" -theme-str "${icon_override}" -config "${roconf}" | sed 's/.*\s*//')
|
||||||
|
if [ -z "$selected" ]; then exit 0; fi
|
||||||
|
|
||||||
|
sel_1=$(echo "$selected" | cut -d '>' -f 1 | awk '{$1=$1};1')
|
||||||
|
sel_2=$(echo "$selected" | cut -d '>' -f 2 | awk '{$1=$1};1')
|
||||||
|
run="$(echo "$metaData" | grep "$sel_1" | grep "$sel_2" )"
|
||||||
|
|
||||||
|
run_flg="$(echo "$run" | awk -F '!=!' '{print $8}')"
|
||||||
|
run_sel="$(echo "$run" | awk -F '!=!' '{gsub(/^ *| *$/, "", $5); if ($5 ~ /[[:space:]]/ && $5 !~ /^[0-9]+$/ && substr($5, 1, 1) != "-") print $4, "\""$5"\""; else print $4, $5}')"
|
||||||
|
# echo "$run_sel" ; echo "$run_flg"
|
||||||
|
|
||||||
|
#?
|
||||||
|
RUN() { case "$(eval "hyprctl dispatch $run_sel")" in *"Not enough arguments"*) exec $0 ;; esac }
|
||||||
|
|
||||||
|
#? If flag is repeat then repeat rofi if not then just execute once
|
||||||
|
if [ -n "$run_sel" ] && [ "$(echo "$run_sel" | wc -l)" -eq 1 ]; then
|
||||||
|
eval "$run_flg"
|
||||||
|
if [ "$repeat" = true ]; then
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
repeat_command=$(echo -e "Repeat" | rofi -dmenu -no-custom -p "[Enter] repeat; [ESC] exit") #? Needed a separate Rasi ? Dunno how to make; Maybe Something like comfirmation rasi for buttons Yes and No then the -p will be the Question like Proceed? Repeat?
|
||||||
|
|
||||||
|
if [ "$repeat_command" = "Repeat" ]; then
|
||||||
|
# Repeat the command here
|
||||||
|
RUN
|
||||||
|
else
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
else RUN
|
||||||
|
fi
|
||||||
|
else exec $0
|
||||||
|
fi
|
13
.config/hypr/scripts/keyboardswitch.sh
Executable file
13
.config/hypr/scripts/keyboardswitch.sh
Executable file
|
@ -0,0 +1,13 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
ScrDir=`dirname "$(realpath "$0")"`
|
||||||
|
source $ScrDir/globalcontrol.sh
|
||||||
|
|
||||||
|
hyprctl devices -j | jq -r '.keyboards[].name' | while read keyName
|
||||||
|
do
|
||||||
|
hyprctl switchxkblayout "$keyName" next
|
||||||
|
done
|
||||||
|
|
||||||
|
layMain=$(hyprctl -j devices | jq '.keyboards' | jq '.[] | select (.main == true)' | awk -F '"' '{if ($2=="active_keymap") print $4}')
|
||||||
|
dunstify "t1" -i ~/.config/dunst/icons/keyboard.svg -a "$layMain" -r 91190 -t 800
|
||||||
|
|
61
.config/hypr/scripts/logoutlaunch.sh
Executable file
61
.config/hypr/scripts/logoutlaunch.sh
Executable file
|
@ -0,0 +1,61 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# Check if wlogout is already running
|
||||||
|
if pgrep -x "wlogout" > /dev/null
|
||||||
|
then
|
||||||
|
pkill -x "wlogout"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# set file variables
|
||||||
|
ScrDir=`dirname "$(realpath "$0")"`
|
||||||
|
source $ScrDir/globalcontrol.sh
|
||||||
|
wLayout="${XDG_CONFIG_HOME:-$HOME/.config}/wlogout/layout_$1"
|
||||||
|
wlTmplt="${XDG_CONFIG_HOME:-$HOME/.config}/wlogout/style_$1.css"
|
||||||
|
|
||||||
|
if [ ! -f $wLayout ] || [ ! -f $wlTmplt ] ; then
|
||||||
|
echo "ERROR: Config $1 not found..."
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
# detect monitor res
|
||||||
|
x_mon=$(hyprctl -j monitors | jq '.[] | select(.focused==true) | .width')
|
||||||
|
y_mon=$(hyprctl -j monitors | jq '.[] | select(.focused==true) | .height')
|
||||||
|
hypr_scale=$(hyprctl -j monitors | jq '.[] | select (.focused == true) | .scale' | sed 's/\.//')
|
||||||
|
|
||||||
|
|
||||||
|
# scale config layout and style
|
||||||
|
case $1 in
|
||||||
|
1) wlColms=6
|
||||||
|
export mgn=$(( y_mon * 28 / hypr_scale ))
|
||||||
|
export hvr=$(( y_mon * 23 / hypr_scale )) ;;
|
||||||
|
2) wlColms=2
|
||||||
|
export x_mgn=$(( x_mon * 35 / hypr_scale ))
|
||||||
|
export y_mgn=$(( y_mon * 25 / hypr_scale ))
|
||||||
|
export x_hvr=$(( x_mon * 32 / hypr_scale ))
|
||||||
|
export y_hvr=$(( y_mon * 20 / hypr_scale )) ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# scale font size
|
||||||
|
export fntSize=$(( y_mon * 2 / 100 ))
|
||||||
|
|
||||||
|
# detect gtk system theme
|
||||||
|
export BtnCol=`[ "$gtkMode" == "dark" ] && ( echo "white" ) || ( echo "black" )`
|
||||||
|
export WindBg=`[ "$gtkMode" == "dark" ] && ( echo "rgba(0,0,0,0.5)" ) || ( echo "rgba(255,255,255,0.5)" )`
|
||||||
|
|
||||||
|
if [ "$EnableWallDcol" -eq 1 ] ; then
|
||||||
|
export wbarTheme="Wall-Dcol"
|
||||||
|
else
|
||||||
|
export wbarTheme="${gtkTheme}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# eval hypr border radius
|
||||||
|
export active_rad=$(( hypr_border * 5 ))
|
||||||
|
export button_rad=$(( hypr_border * 8 ))
|
||||||
|
|
||||||
|
# eval config files
|
||||||
|
wlStyle=`envsubst < $wlTmplt`
|
||||||
|
|
||||||
|
# launch wlogout
|
||||||
|
wlogout -b $wlColms -c 0 -r 0 -m 0 --layout $wLayout --css <(echo "$wlStyle") --protocol layer-shell
|
||||||
|
|
69
.config/hypr/scripts/quickapps.sh
Executable file
69
.config/hypr/scripts/quickapps.sh
Executable file
|
@ -0,0 +1,69 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# set variables
|
||||||
|
|
||||||
|
ScrDir=`dirname "$(realpath "$0")"`
|
||||||
|
source $ScrDir/globalcontrol.sh
|
||||||
|
roconf="~/.config/rofi/quickapps.rasi"
|
||||||
|
|
||||||
|
if [ $# -ge 1 ] ; then
|
||||||
|
dockWidth=$(( (70 * $#) - $# ))
|
||||||
|
else
|
||||||
|
echo "usage: ./quickapps.sh <app1> <app2> ... <app[n]>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# set position
|
||||||
|
|
||||||
|
x_mon=$( cat /sys/class/drm/*/modes | head -1 )
|
||||||
|
y_mon=$( echo $x_mon | cut -d 'x' -f 2 )
|
||||||
|
x_mon=$( echo $x_mon | cut -d 'x' -f 1 )
|
||||||
|
|
||||||
|
x_cur=$(hyprctl cursorpos | sed 's/ //g')
|
||||||
|
y_cur=$( echo $x_cur | cut -d ',' -f 2 )
|
||||||
|
x_cur=$( echo $x_cur | cut -d ',' -f 1 )
|
||||||
|
|
||||||
|
if [ ${x_cur} -le $(( x_mon/3 )) ] ; then
|
||||||
|
x_rofi="west"
|
||||||
|
x_offset="x-offset: 20px;"
|
||||||
|
elif [ ${x_cur} -ge $(( x_mon/3*2 )) ] ; then
|
||||||
|
x_rofi="east"
|
||||||
|
x_offset="x-offset: -20px;"
|
||||||
|
else
|
||||||
|
unset x_rofi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ${y_cur} -le $(( y_mon/3 )) ] ; then
|
||||||
|
y_rofi="north"
|
||||||
|
y_offset="y-offset: 20px;"
|
||||||
|
elif [ ${y_cur} -ge $(( y_mon/3*2 )) ] ; then
|
||||||
|
y_rofi="south"
|
||||||
|
y_offset="y-offset: -20px;"
|
||||||
|
else
|
||||||
|
unset y_rofi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -z $x_rofi ] || [ ! -z $y_rofi ] ; then
|
||||||
|
pos="window {location: $y_rofi $x_rofi; $x_offset $y_offset}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# read hypr theme border
|
||||||
|
|
||||||
|
wind_border=$(( hypr_border * 3/2 ))
|
||||||
|
elem_border=`[ $hypr_border -eq 0 ] && echo "5" || echo $hypr_border`
|
||||||
|
r_override="window{width:$dockWidth;border-radius:${wind_border}px;} listview{columns:$#;} element{border-radius:${elem_border}px;}"
|
||||||
|
|
||||||
|
|
||||||
|
# launch rofi menu
|
||||||
|
|
||||||
|
RofiSel=$( for qapp in "$@"
|
||||||
|
do
|
||||||
|
Lkp=`grep "$qapp" /usr/share/applications/* | grep 'Exec=' | awk -F ':' '{print $1}' | head -1`
|
||||||
|
Ico=`grep 'Icon=' $Lkp | awk -F '=' '{print $2}' | head -1`
|
||||||
|
echo -en "${qapp}\x00icon\x1f${Ico}\n"
|
||||||
|
done | rofi -no-fixed-num-lines -dmenu -theme-str "${r_override}" -theme-str "${pos}" -config $roconf)
|
||||||
|
|
||||||
|
$RofiSel &
|
||||||
|
|
12
.config/hypr/scripts/resetxdgportal.sh
Executable file
12
.config/hypr/scripts/resetxdgportal.sh
Executable file
|
@ -0,0 +1,12 @@
|
||||||
|
#!/bin/bash
|
||||||
|
sleep 1
|
||||||
|
killall xdg-desktop-portal-hyprland
|
||||||
|
killall xdg-desktop-portal-gnome
|
||||||
|
killall xdg-desktop-portal-kde
|
||||||
|
killall xdg-desktop-portal-lxqt
|
||||||
|
killall xdg-desktop-portal-wlr
|
||||||
|
killall xdg-desktop-portal
|
||||||
|
sleep 1
|
||||||
|
/usr/lib/xdg-desktop-portal-hyprland &
|
||||||
|
sleep 2
|
||||||
|
/usr/lib/xdg-desktop-portal &
|
45
.config/hypr/scripts/rofilaunch.sh
Executable file
45
.config/hypr/scripts/rofilaunch.sh
Executable file
|
@ -0,0 +1,45 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
ScrDir=`dirname "$(realpath "$0")"`
|
||||||
|
source $ScrDir/globalcontrol.sh
|
||||||
|
roconf="~/.config/rofi/config.rasi"
|
||||||
|
|
||||||
|
|
||||||
|
# rofi action
|
||||||
|
|
||||||
|
case $1 in
|
||||||
|
d) r_mode="drun" ;;
|
||||||
|
w) r_mode="window" ;;
|
||||||
|
f) r_mode="filebrowser" ;;
|
||||||
|
h) echo -e "rofilaunch.sh [action]\nwhere action,"
|
||||||
|
echo "d : drun mode"
|
||||||
|
echo "w : window mode"
|
||||||
|
echo "f : filebrowser mode,"
|
||||||
|
exit 0 ;;
|
||||||
|
*) r_mode="drun" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
# read hypr theme border
|
||||||
|
|
||||||
|
wind_border=$(( hypr_border * 3 ))
|
||||||
|
elem_border=`[ $hypr_border -eq 0 ] && echo "10" || echo $(( hypr_border * 2 ))`
|
||||||
|
r_override="window {border: ${hypr_width}px; border-radius: ${wind_border}px;} element {border-radius: ${elem_border}px;}"
|
||||||
|
|
||||||
|
|
||||||
|
# read hypr font size
|
||||||
|
|
||||||
|
fnt_override=`gsettings get org.gnome.desktop.interface font-name | awk '{gsub(/'\''/,""); print $NF}'`
|
||||||
|
fnt_override="configuration {font: \"JetBrainsMono Nerd Font ${fnt_override}\";}"
|
||||||
|
|
||||||
|
|
||||||
|
# read hypr theme icon
|
||||||
|
|
||||||
|
icon_override=`gsettings get org.gnome.desktop.interface icon-theme | sed "s/'//g"`
|
||||||
|
icon_override="configuration {icon-theme: \"${icon_override}\";}"
|
||||||
|
|
||||||
|
|
||||||
|
# launch rofi
|
||||||
|
|
||||||
|
rofi -show $r_mode -theme-str "${fnt_override}" -theme-str "${r_override}" -theme-str "${icon_override}" -config "${roconf}"
|
||||||
|
|
36
.config/hypr/scripts/rofiselect.sh
Executable file
36
.config/hypr/scripts/rofiselect.sh
Executable file
|
@ -0,0 +1,36 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# set variables
|
||||||
|
ScrDir=`dirname "$(realpath "$0")"`
|
||||||
|
source $ScrDir/globalcontrol.sh
|
||||||
|
RofiConf="${XDG_CONFIG_HOME:-$HOME/.config}/rofi/themeselect.rasi"
|
||||||
|
RofiStyle="${XDG_CONFIG_HOME:-$HOME/.config}/rofi/styles"
|
||||||
|
RofiAssets="${XDG_CONFIG_HOME:-$HOME/.config}/rofi/assets"
|
||||||
|
Rofilaunch="${XDG_CONFIG_HOME:-$HOME/.config}/rofi/config.rasi"
|
||||||
|
|
||||||
|
|
||||||
|
# scale for monitor x res
|
||||||
|
x_monres=$(hyprctl -j monitors | jq '.[] | select(.focused==true) | .width')
|
||||||
|
monitor_scale=$(hyprctl -j monitors | jq '.[] | select (.focused == true) | .scale' | sed 's/\.//')
|
||||||
|
x_monres=$(( x_monres * 18 / monitor_scale ))
|
||||||
|
|
||||||
|
|
||||||
|
# set rofi override
|
||||||
|
elem_border=$(( hypr_border * 5 ))
|
||||||
|
icon_border=$(( elem_border - 5 ))
|
||||||
|
r_override="listview{columns:4;} element{orientation:vertical;border-radius:${elem_border}px;} element-icon{border-radius:${icon_border}px;size:${x_monres}px;} element-text{enabled:false;}"
|
||||||
|
|
||||||
|
|
||||||
|
# launch rofi menu
|
||||||
|
RofiSel=$( ls ${RofiStyle}/style_*.rasi | awk -F '/' '{print $NF}' | cut -d '.' -f 1 | while read rstyle
|
||||||
|
do
|
||||||
|
echo -en "$rstyle\x00icon\x1f${RofiAssets}/${rstyle}.png\n"
|
||||||
|
done | rofi -dmenu -theme-str "${r_override}" -config $RofiConf)
|
||||||
|
|
||||||
|
|
||||||
|
# apply rofi style
|
||||||
|
if [ ! -z $RofiSel ] ; then
|
||||||
|
cp "${RofiStyle}/${RofiSel}.rasi" "${Rofilaunch}"
|
||||||
|
dunstify "t1" -a " ${RofiSel} applied..." -i "$RofiAssets/$RofiSel.png" -r 91190 -t 2200
|
||||||
|
fi
|
||||||
|
|
48
.config/hypr/scripts/screenshot.sh
Executable file
48
.config/hypr/scripts/screenshot.sh
Executable file
|
@ -0,0 +1,48 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
if [ -z "$XDG_PICTURES_DIR" ] ; then
|
||||||
|
XDG_PICTURES_DIR="$HOME/Pictures"
|
||||||
|
fi
|
||||||
|
|
||||||
|
ScrDir=`dirname "$(realpath "$0")"`
|
||||||
|
source $ScrDir/globalcontrol.sh
|
||||||
|
swpy_dir="${XDG_CONFIG_HOME:-$HOME/.config}/swappy"
|
||||||
|
save_dir="${2:-$XDG_PICTURES_DIR/Screenshots}"
|
||||||
|
save_file=$(date +'%y%m%d_%Hh%Mm%Ss_screenshot.png')
|
||||||
|
temp_screenshot="/tmp/screenshot.png"
|
||||||
|
|
||||||
|
mkdir -p $save_dir
|
||||||
|
mkdir -p $swpy_dir
|
||||||
|
echo -e "[Default]\nsave_dir=$save_dir\nsave_filename_format=$save_file" > $swpy_dir/config
|
||||||
|
|
||||||
|
function print_error
|
||||||
|
{
|
||||||
|
cat << "EOF"
|
||||||
|
./screenshot.sh <action>
|
||||||
|
...valid actions are...
|
||||||
|
p : print all screens
|
||||||
|
s : snip current screen
|
||||||
|
sf : snip current screen (frozen)
|
||||||
|
m : print focused monitor
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
case $1 in
|
||||||
|
p) # print all outputs
|
||||||
|
grimblast copysave screen $temp_screenshot && swappy -f $temp_screenshot ;;
|
||||||
|
s) # drag to manually snip an area / click on a window to print it
|
||||||
|
grimblast copysave area $temp_screenshot && swappy -f $temp_screenshot ;;
|
||||||
|
sf) # frozen screen, drag to manually snip an area / click on a window to print it
|
||||||
|
grimblast --freeze copysave area $temp_screenshot && swappy -f $temp_screenshot ;;
|
||||||
|
m) # print focused monitor
|
||||||
|
grimblast copysave output $temp_screenshot && swappy -f $temp_screenshot ;;
|
||||||
|
*) # invalid option
|
||||||
|
print_error ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
rm "$temp_screenshot"
|
||||||
|
|
||||||
|
if [ -f "$save_dir/$save_file" ] ; then
|
||||||
|
dunstify "t1" -a "saved in $save_dir" -i "$save_dir/$save_file" -r 91190 -t 2200
|
||||||
|
fi
|
||||||
|
|
19
.config/hypr/scripts/sddmwall.sh
Executable file
19
.config/hypr/scripts/sddmwall.sh
Executable file
|
@ -0,0 +1,19 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
sddmback="/usr/share/sddm/themes/corners/backgrounds/bg.png"
|
||||||
|
sddmconf="/usr/share/sddm/themes/corners/theme.conf"
|
||||||
|
slnkwall="${XDG_CONFIG_HOME:-$HOME/.config}/swww/wall.set"
|
||||||
|
|
||||||
|
if [ "$(getfacl -p /home/${USER} | grep user:sddm | awk '{print substr($0,length)}')" != "x" ] ; then
|
||||||
|
echo "granting sddm execution access to /home/${USER}..."
|
||||||
|
setfacl -m u:sddm:x /home/${USER}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$(grep "Background=" "${sddmconf}")" == "Background=\"${slnkwall}\"" ] ; then
|
||||||
|
echo "setting static sddm background..."
|
||||||
|
sed -i "/^Background=/c\Background=\"${sddmback}\"" "${sddmconf}"
|
||||||
|
else
|
||||||
|
echo "setting dynamic sddm background..."
|
||||||
|
sed -i "/^Background=/c\Background=\"${slnkwall}\"" "${sddmconf}"
|
||||||
|
fi
|
||||||
|
|
31
.config/hypr/scripts/spotifyvolumecontrol.sh
Executable file
31
.config/hypr/scripts/spotifyvolumecontrol.sh
Executable file
|
@ -0,0 +1,31 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# define the name of the player
|
||||||
|
PLAYER="spotify"
|
||||||
|
|
||||||
|
# function to increase Spotify volume
|
||||||
|
increase_volume() {
|
||||||
|
playerctl --player="$PLAYER" volume 0.05+
|
||||||
|
VOLUME=$(playerctl volume --player $PLAYER)
|
||||||
|
dunstify -a Spotify -r 2 -t 1500 -i /usr/share/icons/Tela-circle-black/scalable/apps/com.spotify.Client.svg "Volume increased" "$VOLUME"
|
||||||
|
}
|
||||||
|
|
||||||
|
# function to decrease Spotify volume
|
||||||
|
decrease_volume() {
|
||||||
|
playerctl --player="$PLAYER" volume 0.05-
|
||||||
|
VOLUME=$(playerctl volume --player $PLAYER)
|
||||||
|
dunstify -a Spotify -r 2 -t 1500 -i /usr/share/icons/Tela-circle-black/scalable/apps/com.spotify.Client.svg "Volume decreased" "$VOLUME"
|
||||||
|
}
|
||||||
|
|
||||||
|
# check for the argument and perform the corresponding action
|
||||||
|
case "$1" in
|
||||||
|
"up")
|
||||||
|
increase_volume
|
||||||
|
;;
|
||||||
|
"down")
|
||||||
|
decrease_volume
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
114
.config/hypr/scripts/swwwallbash.sh
Executable file
114
.config/hypr/scripts/swwwallbash.sh
Executable file
|
@ -0,0 +1,114 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# set variables
|
||||||
|
|
||||||
|
export ScrDir=`dirname "$(realpath "$0")"`
|
||||||
|
source $ScrDir/globalcontrol.sh
|
||||||
|
dcoDir="${XDG_CONFIG_HOME:-$HOME/.config}/hypr/wallbash"
|
||||||
|
input_wall="$1"
|
||||||
|
export cacheImg=$(basename "${input_wall}")
|
||||||
|
|
||||||
|
if [ -z "${input_wall}" ] || [ ! -f "${input_wall}" ] ; then
|
||||||
|
echo "Error: Input wallpaper not found!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# color conversion functions
|
||||||
|
|
||||||
|
hex_conv() {
|
||||||
|
rgb_val=$(echo "$1" | sed 's/[-srgb()%]//g ; s/,/ /g')
|
||||||
|
red=$(echo "$rgb_val * 255 / 100" | awk '{printf "%d", $1}')
|
||||||
|
green=$(echo "$rgb_val * 255 / 100" | awk '{printf "%d", $2}')
|
||||||
|
blue=$(echo "$rgb_val * 255 / 100" | awk '{printf "%d", $3}')
|
||||||
|
printf "%02X%02X%02X\n" "$red" "$green" "$blue"
|
||||||
|
}
|
||||||
|
|
||||||
|
dark_light () {
|
||||||
|
inCol="$1"
|
||||||
|
red=$(printf "%d" "0x${inCol:1:2}")
|
||||||
|
green=$(printf "%d" "0x${inCol:3:2}")
|
||||||
|
blue=$(printf "%d" "0x${inCol:5:2}")
|
||||||
|
brightness=$((red + green + blue))
|
||||||
|
[ "$brightness" -lt 300 ]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# extract 3 dominant colors from input wall
|
||||||
|
|
||||||
|
if [ ! -f "${cacheDir}/${gtkTheme}/${cacheImg}.dcol" ] ; then
|
||||||
|
mkdir -p "${cacheDir}/${gtkTheme}"
|
||||||
|
dcol=(`magick "${input_wall}" -colors 3 -define histogram:unique-colors=true -format "%c" histogram:info: | awk '{print substr($3,2,6)}' | awk '{printf "%d %s\n", "0x"$1, $0}' | sort -n | awk '{print $2}'`)
|
||||||
|
for (( i = 1; i < 3; i++ )) ; do
|
||||||
|
[ -z "${dcol[i]}" ] && dcol[i]=${dcol[i-1]}
|
||||||
|
done
|
||||||
|
|
||||||
|
# generate palette based on 3 primary color
|
||||||
|
|
||||||
|
for (( j = 0; j < 3; j++ )) ; do
|
||||||
|
r_swatch=$(echo "#${dcol[j]}" | sed 's/#//g')
|
||||||
|
echo "dcol_pry${j}=\"${r_swatch}\"" >> "${cacheDir}/${gtkTheme}/${cacheImg}.dcol"
|
||||||
|
r_swatch=$(hex_conv `convert xc:"#${dcol[j]}" -negate -format "%c" histogram:info: | awk '{print $4}'`)
|
||||||
|
echo "dcol_txt${j}=\"${r_swatch}\"" >> "${cacheDir}/${gtkTheme}/${cacheImg}.dcol"
|
||||||
|
z=0
|
||||||
|
|
||||||
|
if dark_light "#${dcol[j]}" ; then
|
||||||
|
#echo "Generate accent colors for lighter shades..."
|
||||||
|
for t in 30 50 70 90 ; do
|
||||||
|
z=$(( z + 1 ))
|
||||||
|
r_swatch=$(hex_conv `convert xc:"#${dcol[j]}" -modulate 200,"$(awk "BEGIN {print $t * 1.5}")",$(( 100 - (2*z) )) -channel RGB -evaluate multiply 1.$t -format "%c" histogram:info: | awk '{print $4}'`)
|
||||||
|
echo "dcol_${j}xa${z}=\"${r_swatch}\"" >> "${cacheDir}/${gtkTheme}/${cacheImg}.dcol"
|
||||||
|
done
|
||||||
|
else
|
||||||
|
#echo "Generate accent colors for darker shades..."
|
||||||
|
for t in 15 35 55 75 ; do
|
||||||
|
z=$(( z + 1 ))
|
||||||
|
r_swatch=$(hex_conv `convert xc:"#${dcol[j]}" -modulate 80,"$(awk "BEGIN {print $t * 1.5}")",$(( 100 + (2*z) )) -channel RGB -evaluate multiply 1.$t -format "%c" histogram:info: | awk '{print $4}'`)
|
||||||
|
echo "dcol_${j}xa${z}=\"${r_swatch}\"" >> "${cacheDir}/${gtkTheme}/${cacheImg}.dcol"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# wallbash fn to apply colors to templates
|
||||||
|
|
||||||
|
fn_wallbash () {
|
||||||
|
local tplt="${1}"
|
||||||
|
eval target=$(head -1 "${tplt}" | awk -F '|' '{print $1}')
|
||||||
|
eval appexe=$(head -1 "${tplt}" | awk -F '|' '{print $2}')
|
||||||
|
source "${ScrDir}/globalcontrol.sh"
|
||||||
|
source "${cacheDir}/${gtkTheme}/${cacheImg}.dcol"
|
||||||
|
|
||||||
|
sed '1d' "${tplt}" > "${target}"
|
||||||
|
sed -i "s/<wallbash_pry0>/${dcol_pry0}/g
|
||||||
|
s/<wallbash_txt0>/${dcol_txt0}/g
|
||||||
|
s/<wallbash_0xa1>/${dcol_0xa1}/g
|
||||||
|
s/<wallbash_0xa2>/${dcol_0xa2}/g
|
||||||
|
s/<wallbash_0xa3>/${dcol_0xa3}/g
|
||||||
|
s/<wallbash_0xa4>/${dcol_0xa4}/g
|
||||||
|
s/<wallbash_pry1>/${dcol_pry1}/g
|
||||||
|
s/<wallbash_txt1>/${dcol_txt1}/g
|
||||||
|
s/<wallbash_1xa1>/${dcol_1xa1}/g
|
||||||
|
s/<wallbash_1xa2>/${dcol_1xa2}/g
|
||||||
|
s/<wallbash_1xa3>/${dcol_1xa3}/g
|
||||||
|
s/<wallbash_1xa4>/${dcol_1xa4}/g
|
||||||
|
s/<wallbash_pry2>/${dcol_pry2}/g
|
||||||
|
s/<wallbash_txt2>/${dcol_txt2}/g
|
||||||
|
s/<wallbash_2xa1>/${dcol_2xa1}/g
|
||||||
|
s/<wallbash_2xa2>/${dcol_2xa2}/g
|
||||||
|
s/<wallbash_2xa3>/${dcol_2xa3}/g
|
||||||
|
s/<wallbash_2xa4>/${dcol_2xa4}/g" "${target}"
|
||||||
|
|
||||||
|
if [ ! -z "${appexe}" ] ; then
|
||||||
|
"${appexe}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
export -f fn_wallbash
|
||||||
|
|
||||||
|
|
||||||
|
# exec wallbash fn in parallel
|
||||||
|
|
||||||
|
find "$dcoDir" -type f -name "*.dcol" | parallel -j 0 fn_wallbash
|
||||||
|
|
135
.config/hypr/scripts/swwwallpaper.sh
Executable file
135
.config/hypr/scripts/swwwallpaper.sh
Executable file
|
@ -0,0 +1,135 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# define functions
|
||||||
|
|
||||||
|
Wall_Update()
|
||||||
|
{
|
||||||
|
if [ ! -d "${cacheDir}/${curTheme}" ] ; then
|
||||||
|
mkdir -p "${cacheDir}/${curTheme}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
local x_wall="$1"
|
||||||
|
local x_update="${x_wall/$HOME/"~"}"
|
||||||
|
cacheImg=$(basename "$x_wall")
|
||||||
|
$ScrDir/swwwallbash.sh "$x_wall" &
|
||||||
|
|
||||||
|
if [ ! -f "${cacheDir}/${curTheme}/${cacheImg}" ] ; then
|
||||||
|
convert -strip "$x_wall" -thumbnail 500x500^ -gravity center -extent 500x500 "${cacheDir}/${curTheme}/${cacheImg}" &
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f "${cacheDir}/${curTheme}/${cacheImg}.rofi" ] ; then
|
||||||
|
convert -strip -resize 2000 -gravity center -extent 2000 -quality 90 "$x_wall" "${cacheDir}/${curTheme}/${cacheImg}.rofi" &
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f "${cacheDir}/${curTheme}/${cacheImg}.blur" ] ; then
|
||||||
|
convert -strip -scale 10% -blur 0x3 -resize 100% "$x_wall" "${cacheDir}/${curTheme}/${cacheImg}.blur" &
|
||||||
|
fi
|
||||||
|
|
||||||
|
wait
|
||||||
|
awk -F '|' -v thm="${curTheme}" -v wal="${x_update}" '{OFS=FS} {if($2==thm)$NF=wal;print$0}' "${ThemeCtl}" > "${ScrDir}/tmp" && mv "${ScrDir}/tmp" "${ThemeCtl}"
|
||||||
|
ln -fs "${x_wall}" "${wallSet}"
|
||||||
|
ln -fs "${cacheDir}/${curTheme}/${cacheImg}.rofi" "${wallRfi}"
|
||||||
|
ln -fs "${cacheDir}/${curTheme}/${cacheImg}.blur" "${wallBlr}"
|
||||||
|
}
|
||||||
|
|
||||||
|
Wall_Change()
|
||||||
|
{
|
||||||
|
local x_switch=$1
|
||||||
|
|
||||||
|
for (( i=0 ; i<${#Wallist[@]} ; i++ ))
|
||||||
|
do
|
||||||
|
if [ "${Wallist[i]}" == "${fullPath}" ] ; then
|
||||||
|
|
||||||
|
if [ $x_switch == 'n' ] ; then
|
||||||
|
nextIndex=$(( (i + 1) % ${#Wallist[@]} ))
|
||||||
|
elif [ $x_switch == 'p' ] ; then
|
||||||
|
nextIndex=$(( i - 1 ))
|
||||||
|
fi
|
||||||
|
|
||||||
|
Wall_Update "${Wallist[nextIndex]}"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
Wall_Set()
|
||||||
|
{
|
||||||
|
if [ -z $xtrans ] ; then
|
||||||
|
xtrans="grow"
|
||||||
|
fi
|
||||||
|
|
||||||
|
swww img "$wallSet" \
|
||||||
|
--transition-bezier .43,1.19,1,.4 \
|
||||||
|
--transition-type "$xtrans" \
|
||||||
|
--transition-duration 0.7 \
|
||||||
|
--transition-fps 60 \
|
||||||
|
--invert-y \
|
||||||
|
--transition-pos "$( hyprctl cursorpos )"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# set variables
|
||||||
|
|
||||||
|
ScrDir=`dirname "$(realpath "$0")"`
|
||||||
|
source $ScrDir/globalcontrol.sh
|
||||||
|
wallSet="${XDG_CONFIG_HOME:-$HOME/.config}/swww/wall.set"
|
||||||
|
wallBlr="${XDG_CONFIG_HOME:-$HOME/.config}/swww/wall.blur"
|
||||||
|
wallRfi="${XDG_CONFIG_HOME:-$HOME/.config}/swww/wall.rofi"
|
||||||
|
ctlLine=$(grep '^1|' ${ThemeCtl})
|
||||||
|
|
||||||
|
if [ `echo $ctlLine | wc -l` -ne "1" ] ; then
|
||||||
|
echo "ERROR : ${ThemeCtl} Unable to fetch theme..."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
curTheme=$(echo "$ctlLine" | awk -F '|' '{print $2}')
|
||||||
|
fullPath=$(echo "$ctlLine" | awk -F '|' '{print $NF}' | sed "s+~+$HOME+")
|
||||||
|
wallName=$(basename "$fullPath")
|
||||||
|
wallPath=$(dirname "$fullPath")
|
||||||
|
mapfile -d '' Wallist < <(find ${wallPath} -type f \( -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" \) -print0 | sort -z)
|
||||||
|
|
||||||
|
if [ ! -f "$fullPath" ] ; then
|
||||||
|
if [ -d "${XDG_CONFIG_HOME:-$HOME/.config}/swww/$curTheme" ] ; then
|
||||||
|
wallPath="${XDG_CONFIG_HOME:-$HOME/.config}/swww/$curTheme"
|
||||||
|
mapfile -d '' Wallist < <(find ${wallPath} -type f \( -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" \) -print0 | sort -z)
|
||||||
|
fullPath="${Wallist[0]}"
|
||||||
|
else
|
||||||
|
echo "ERROR: wallpaper $fullPath not found..."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# evaluate options
|
||||||
|
|
||||||
|
while getopts "nps" option ; do
|
||||||
|
case $option in
|
||||||
|
n ) # set next wallpaper
|
||||||
|
xtrans="grow"
|
||||||
|
Wall_Change n ;;
|
||||||
|
p ) # set previous wallpaper
|
||||||
|
xtrans="outer"
|
||||||
|
Wall_Change p ;;
|
||||||
|
s ) # set input wallpaper
|
||||||
|
shift $((OPTIND -1))
|
||||||
|
if [ -f "$1" ] ; then
|
||||||
|
Wall_Update "$1"
|
||||||
|
fi ;;
|
||||||
|
* ) # invalid option
|
||||||
|
echo "n : set next wall"
|
||||||
|
echo "p : set previous wall"
|
||||||
|
echo "s : set input wallpaper"
|
||||||
|
exit 1 ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
# check swww daemon and set wall
|
||||||
|
|
||||||
|
swww query
|
||||||
|
if [ $? -eq 1 ] ; then
|
||||||
|
swww init
|
||||||
|
fi
|
||||||
|
|
||||||
|
Wall_Set
|
||||||
|
|
45
.config/hypr/scripts/swwwallselect.sh
Executable file
45
.config/hypr/scripts/swwwallselect.sh
Executable file
|
@ -0,0 +1,45 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# set variables
|
||||||
|
ScrDir=`dirname "$(realpath "$0")"`
|
||||||
|
source $ScrDir/globalcontrol.sh
|
||||||
|
RofiConf="${XDG_CONFIG_HOME:-$HOME/.config}/rofi/themeselect.rasi"
|
||||||
|
|
||||||
|
ctlLine=`grep '^1|' "$ThemeCtl"`
|
||||||
|
if [ `echo $ctlLine | wc -l` -ne "1" ] ; then
|
||||||
|
echo "ERROR : $ThemeCtl Unable to fetch theme..."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
fullPath=$(echo "$ctlLine" | awk -F '|' '{print $NF}' | sed "s+~+$HOME+")
|
||||||
|
wallPath=$(dirname "$fullPath")
|
||||||
|
if [ ! -d "${wallPath}" ] && [ -d "${XDG_CONFIG_HOME:-$HOME/.config}/swww/${gtkTheme}" ] && [ ! -z "${gtkTheme}" ] ; then
|
||||||
|
wallPath="${XDG_CONFIG_HOME:-$HOME/.config}/swww/${gtkTheme}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# scale for monitor x res
|
||||||
|
x_monres=$(hyprctl -j monitors | jq '.[] | select(.focused==true) | .width')
|
||||||
|
monitor_scale=$(hyprctl -j monitors | jq '.[] | select (.focused == true) | .scale' | sed 's/\.//')
|
||||||
|
x_monres=$(( x_monres * 17 / monitor_scale ))
|
||||||
|
|
||||||
|
|
||||||
|
# set rofi override
|
||||||
|
elem_border=$(( hypr_border * 3 ))
|
||||||
|
r_override="element{border-radius:${elem_border}px;} listview{columns:6;spacing:100px;} element{padding:0px;orientation:vertical;} element-icon{size:${x_monres}px;border-radius:0px;} element-text{padding:20px;}"
|
||||||
|
|
||||||
|
|
||||||
|
# launch rofi menu
|
||||||
|
currentWall=`basename $fullPath`
|
||||||
|
RofiSel=$( find "${wallPath}" -type f \( -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" \) -exec basename {} \; | sort | while read rfile
|
||||||
|
do
|
||||||
|
echo -en "$rfile\x00icon\x1f${cacheDir}/${gtkTheme}/${rfile}\n"
|
||||||
|
done | rofi -dmenu -theme-str "${r_override}" -config "${RofiConf}" -select "${currentWall}")
|
||||||
|
|
||||||
|
|
||||||
|
# apply wallpaper
|
||||||
|
if [ ! -z "${RofiSel}" ] ; then
|
||||||
|
"${ScrDir}/swwwallpaper.sh" -s "${wallPath}/${RofiSel}"
|
||||||
|
dunstify "t1" -a " ${RofiSel}" -i "${cacheDir}/${gtkTheme}/${RofiSel}" -r 91190 -t 2200
|
||||||
|
fi
|
||||||
|
|
15
.config/hypr/scripts/sysmonlaunch.sh
Executable file
15
.config/hypr/scripts/sysmonlaunch.sh
Executable file
|
@ -0,0 +1,15 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# Define the list of commands to check in order of preference
|
||||||
|
commands_to_check=("htop" "btop" "top")
|
||||||
|
|
||||||
|
# Determine the terminal emulator to use
|
||||||
|
term=$(cat $HOME/.config/hypr/keybindings.conf | grep ^'$term' | cut -d '=' -f2)
|
||||||
|
|
||||||
|
# Try to execute the first available command in the specified terminal emulator
|
||||||
|
for command in "${commands_to_check[@]}"; do
|
||||||
|
if command -v "$command" &> /dev/null; then
|
||||||
|
$term -e "$command"
|
||||||
|
break # Exit the loop if the command executed successfully
|
||||||
|
fi
|
||||||
|
done
|
41
.config/hypr/scripts/systemupdate.sh
Executable file
41
.config/hypr/scripts/systemupdate.sh
Executable file
|
@ -0,0 +1,41 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Check release
|
||||||
|
if [ ! -f /etc/arch-release ] ; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# source variables
|
||||||
|
ScrDir=`dirname "$(realpath "$0")"`
|
||||||
|
source $ScrDir/globalcontrol.sh
|
||||||
|
|
||||||
|
# Check for updates
|
||||||
|
get_aurhlpr
|
||||||
|
aur=`${aurhlpr} -Qua | wc -l`
|
||||||
|
ofc=`checkupdates | wc -l`
|
||||||
|
|
||||||
|
# Check for flatpak updates
|
||||||
|
if pkg_installed flatpak ; then
|
||||||
|
fpk=`flatpak remote-ls --updates | wc -l`
|
||||||
|
fpk_disp="\n Flatpak $fpk"
|
||||||
|
fpk_exup="; flatpak update"
|
||||||
|
else
|
||||||
|
fpk=0
|
||||||
|
fpk_disp=""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Calculate total available updates
|
||||||
|
upd=$(( ofc + aur + fpk ))
|
||||||
|
|
||||||
|
# Show tooltip
|
||||||
|
if [ $upd -eq 0 ] ; then
|
||||||
|
echo "{\"text\":\"$upd\", \"tooltip\":\" Packages are up to date\"}"
|
||||||
|
else
|
||||||
|
echo "{\"text\":\"$upd\", \"tooltip\":\" Official $ofc\n AUR $aur$fpk_disp\"}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Trigger upgrade
|
||||||
|
if [ "$1" == "up" ] ; then
|
||||||
|
kitty --title systemupdate sh -c "${aurhlpr} -Syu $fpk_exup"
|
||||||
|
fi
|
||||||
|
|
91
.config/hypr/scripts/testrunner.sh
Executable file
91
.config/hypr/scripts/testrunner.sh
Executable file
|
@ -0,0 +1,91 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
ScrDir=`dirname "$(realpath "$0")"`
|
||||||
|
source $ScrDir/globalcontrol.sh
|
||||||
|
WalDir="${XDG_CONFIG_HOME:-$HOME/.config}/swww"
|
||||||
|
RofDir="${XDG_CONFIG_HOME:-$HOME/.config}/rofi"
|
||||||
|
|
||||||
|
roficn=0
|
||||||
|
wlogcn=1
|
||||||
|
|
||||||
|
while read loop_theme
|
||||||
|
do
|
||||||
|
themeName=`echo $loop_theme | cut -d '|' -f 2`
|
||||||
|
$ScrDir/themeswitch.sh -s $themeName &> /dev/null
|
||||||
|
sleep 0.2
|
||||||
|
|
||||||
|
hyprctl dispatch workspace empty
|
||||||
|
dolphin &> /dev/null &
|
||||||
|
sleep 0.21
|
||||||
|
kitty &> /dev/null &
|
||||||
|
sleep 1.4
|
||||||
|
hyprctl dispatch workspace empty
|
||||||
|
|
||||||
|
#walln=`ls -l $WalDir/$themeName | wc -l`
|
||||||
|
for (( i=1 ; i<3 ; i++ ))
|
||||||
|
do
|
||||||
|
# swww
|
||||||
|
sleep 0.2
|
||||||
|
$ScrDir/swwwallpaper.sh -n &> /dev/null
|
||||||
|
|
||||||
|
# rofiselect
|
||||||
|
$ScrDir/rofiselect.sh &> /dev/null &
|
||||||
|
sleep 0.7
|
||||||
|
pkill -x rofi
|
||||||
|
|
||||||
|
# rofi
|
||||||
|
if [ $roficn -lt 8 ] ; then
|
||||||
|
roficn=$(( roficn + 1 ))
|
||||||
|
else
|
||||||
|
roficn=1
|
||||||
|
fi
|
||||||
|
cp $RofDir/styles/style_$roficn.rasi $RofDir/config.rasi
|
||||||
|
$ScrDir/rofilaunch.sh &> /dev/null &
|
||||||
|
sleep 0.7
|
||||||
|
pkill -x rofi
|
||||||
|
|
||||||
|
# themeselect
|
||||||
|
$ScrDir/themeselect.sh &> /dev/null &
|
||||||
|
sleep 0.7
|
||||||
|
pkill -x rofi
|
||||||
|
|
||||||
|
# wlogout
|
||||||
|
if [ $wlogcn -eq 1 ] ; then
|
||||||
|
wlogcn=2
|
||||||
|
else
|
||||||
|
wlogcn=1
|
||||||
|
fi
|
||||||
|
$ScrDir/logoutlaunch.sh $wlogcn &> /dev/null &
|
||||||
|
sleep 0.7
|
||||||
|
pkill -x wlogout
|
||||||
|
|
||||||
|
# waybar
|
||||||
|
$ScrDir/wbarconfgen.sh n &> /dev/null
|
||||||
|
|
||||||
|
# quickapps
|
||||||
|
$ScrDir/quickapps.sh kitty firefox spotify code dolphin &> /dev/null &
|
||||||
|
sleep 0.7
|
||||||
|
pkill -x rofi
|
||||||
|
|
||||||
|
# cliphist
|
||||||
|
$ScrDir/cliphist.sh w &> /dev/null &
|
||||||
|
sleep 0.7
|
||||||
|
pkill -x rofi
|
||||||
|
|
||||||
|
# wallselect
|
||||||
|
$ScrDir/swwwallselect.sh &> /dev/null &
|
||||||
|
sleep 0.7
|
||||||
|
pkill -x rofi
|
||||||
|
|
||||||
|
# wallbash
|
||||||
|
$ScrDir/wallbashtoggle.sh
|
||||||
|
sleep 0.2
|
||||||
|
|
||||||
|
# volumecontrol
|
||||||
|
for (( i=1 ; i<=6 ; i++ )) ; do
|
||||||
|
[[ i -gt 3 ]] && vol="d" || vol="i"
|
||||||
|
$ScrDir/volumecontrol.sh -o $vol
|
||||||
|
done
|
||||||
|
done
|
||||||
|
done < "$ThemeCtl"
|
||||||
|
|
35
.config/hypr/scripts/themeselect.sh
Executable file
35
.config/hypr/scripts/themeselect.sh
Executable file
|
@ -0,0 +1,35 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# set variables
|
||||||
|
ScrDir=`dirname "$(realpath "$0")"`
|
||||||
|
source $ScrDir/globalcontrol.sh
|
||||||
|
RofiConf="${XDG_CONFIG_HOME:-$HOME/.config}/rofi/themeselect.rasi"
|
||||||
|
|
||||||
|
|
||||||
|
# scale for monitor x res
|
||||||
|
x_monres=$(hyprctl -j monitors | jq '.[] | select(.focused==true) | .width')
|
||||||
|
monitor_scale=$(hyprctl -j monitors | jq '.[] | select (.focused == true) | .scale' | sed 's/\.//')
|
||||||
|
x_monres=$(( x_monres * 17 / monitor_scale ))
|
||||||
|
|
||||||
|
|
||||||
|
# set rofi override
|
||||||
|
elem_border=$(( hypr_border * 5 ))
|
||||||
|
icon_border=$(( elem_border - 5 ))
|
||||||
|
r_override="element{border-radius:${elem_border}px;} element-icon{border-radius:${icon_border}px;size:${x_monres}px;}"
|
||||||
|
|
||||||
|
|
||||||
|
# launch rofi menu
|
||||||
|
ThemeSel=$( cat "$ThemeCtl" | while read line
|
||||||
|
do
|
||||||
|
thm=`echo $line | cut -d '|' -f 2`
|
||||||
|
wal=`echo $line | awk -F '/' '{print $NF}'`
|
||||||
|
echo -en "$thm\x00icon\x1f$cacheDir/${thm}/${wal}\n"
|
||||||
|
done | rofi -dmenu -theme-str "${r_override}" -config $RofiConf -select "${gtkTheme}")
|
||||||
|
|
||||||
|
|
||||||
|
# apply theme
|
||||||
|
if [ ! -z $ThemeSel ] ; then
|
||||||
|
"${ScrDir}/themeswitch.sh" -s $ThemeSel
|
||||||
|
dunstify "t1" -a " ${ThemeSel}" -i "~/.config/dunst/icons/hyprdots.png" -r 91190 -t 2200
|
||||||
|
fi
|
||||||
|
|
135
.config/hypr/scripts/themeswitch.sh
Executable file
135
.config/hypr/scripts/themeswitch.sh
Executable file
|
@ -0,0 +1,135 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# set variables
|
||||||
|
ScrDir=`dirname "$(realpath "$0")"`
|
||||||
|
source "${ScrDir}/globalcontrol.sh"
|
||||||
|
|
||||||
|
|
||||||
|
# evaluate options
|
||||||
|
while getopts "npst" option ; do
|
||||||
|
case $option in
|
||||||
|
|
||||||
|
n ) # set next theme
|
||||||
|
ThemeSet=`head -1 "$ThemeCtl" | cut -d '|' -f 2` #default value
|
||||||
|
flg=0
|
||||||
|
while read line
|
||||||
|
do
|
||||||
|
if [ $flg -eq 1 ] ; then
|
||||||
|
ThemeSet=`echo $line | cut -d '|' -f 2`
|
||||||
|
break
|
||||||
|
elif [ `echo $line | cut -d '|' -f 1` -eq 1 ] ; then
|
||||||
|
flg=1
|
||||||
|
fi
|
||||||
|
done < "$ThemeCtl"
|
||||||
|
export xtrans="grow" ;;
|
||||||
|
|
||||||
|
p ) # set previous theme
|
||||||
|
ThemeSet=`tail -1 "$ThemeCtl" | cut -d '|' -f 2` #default value
|
||||||
|
flg=0
|
||||||
|
while read line
|
||||||
|
do
|
||||||
|
if [ $flg -eq 1 ] ; then
|
||||||
|
ThemeSet=`echo $line | cut -d '|' -f 2`
|
||||||
|
break
|
||||||
|
elif [ `echo $line | cut -d '|' -f 1` -eq 1 ] ; then
|
||||||
|
flg=1
|
||||||
|
fi
|
||||||
|
done < <( tac "$ThemeCtl" )
|
||||||
|
export xtrans="outer" ;;
|
||||||
|
|
||||||
|
s ) # set selected theme
|
||||||
|
shift $((OPTIND -1))
|
||||||
|
ThemeSet=$1 ;;
|
||||||
|
|
||||||
|
t ) # display tooltip
|
||||||
|
echo ""
|
||||||
|
echo " Next/Previous Theme"
|
||||||
|
exit 0 ;;
|
||||||
|
|
||||||
|
* ) # invalid option
|
||||||
|
echo "n : set next theme"
|
||||||
|
echo "p : set previous theme"
|
||||||
|
echo "s : set theme from parameter"
|
||||||
|
echo "t : display tooltip"
|
||||||
|
exit 1 ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
# update theme control
|
||||||
|
if [ `cat "$ThemeCtl" | awk -F '|' -v thm=$ThemeSet '{if($2==thm) print$2}' | wc -w` -ne 1 ] ; then
|
||||||
|
echo "Unknown theme selected: $ThemeSet"
|
||||||
|
echo "Available themes are:"
|
||||||
|
cat "$ThemeCtl" | cut -d '|' -f 2
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "Selected theme: $ThemeSet"
|
||||||
|
sed -i "s/^1/0/g" "$ThemeCtl"
|
||||||
|
awk -F '|' -v thm=$ThemeSet '{OFS=FS} {if($2==thm) $1=1; print$0}' "$ThemeCtl" > "${ScrDir}/tmp" && mv "${ScrDir}/tmp" "$ThemeCtl"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# swwwallpaper
|
||||||
|
getWall=`grep '^1|' "$ThemeCtl" | awk -F '|' '{print $NF}'`
|
||||||
|
getWall=`eval echo "$getWall"`
|
||||||
|
getName=`basename "$getWall"`
|
||||||
|
ln -fs "$getWall" "$ConfDir/swww/wall.set"
|
||||||
|
ln -fs "$cacheDir/${ThemeSet}/${getName}.rofi" "$ConfDir/swww/wall.rofi"
|
||||||
|
ln -fs "$cacheDir/${ThemeSet}/${getName}.blur" "$ConfDir/swww/wall.blur"
|
||||||
|
"${ScrDir}/swwwallpaper.sh"
|
||||||
|
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
echo "ERROR: Unable to set wallpaper"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# code
|
||||||
|
if [ ! -z "$(grep '^1|' "$ThemeCtl" | awk -F '|' '{print $3}')" ] ; then
|
||||||
|
codex=$(grep '^1|' "$ThemeCtl" | awk -F '|' '{print $3}' | cut -d '~' -f 1)
|
||||||
|
if [ $(code --list-extensions | grep -iwc "${codex}") -eq 0 ] ; then
|
||||||
|
code --install-extension "${codex}" 2> /dev/null
|
||||||
|
fi
|
||||||
|
codet=$(grep '^1|' "$ThemeCtl" | awk -F '|' '{print $3}' | cut -d '~' -f 2)
|
||||||
|
jq --arg codet "${codet}" '.["workbench.colorTheme"] |= $codet' "$ConfDir/Code/User/settings.json" > tmpvsc && mv tmpvsc "$ConfDir/Code/User/settings.json"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# kitty
|
||||||
|
ln -fs $ConfDir/kitty/themes/${ThemeSet}.conf $ConfDir/kitty/themes/theme.conf
|
||||||
|
killall -SIGUSR1 kitty
|
||||||
|
|
||||||
|
|
||||||
|
# kvantum QT
|
||||||
|
kvantummanager --set "${ThemeSet}"
|
||||||
|
|
||||||
|
|
||||||
|
# qt5ct
|
||||||
|
sed -i "/^color_scheme_path=/c\color_scheme_path=$ConfDir/qt5ct/colors/${ThemeSet}.conf" $ConfDir/qt5ct/qt5ct.conf
|
||||||
|
IconSet=`awk -F "'" '$0 ~ /gsettings set org.gnome.desktop.interface icon-theme/{print $2}' $ConfDir/hypr/themes/${ThemeSet}.conf`
|
||||||
|
sed -i "/^icon_theme=/c\icon_theme=${IconSet}" $ConfDir/qt5ct/qt5ct.conf
|
||||||
|
|
||||||
|
|
||||||
|
# gtk3
|
||||||
|
sed -i "/^gtk-theme-name=/c\gtk-theme-name=${ThemeSet}" $ConfDir/gtk-3.0/settings.ini
|
||||||
|
sed -i "/^gtk-icon-theme-name=/c\gtk-icon-theme-name=${IconSet}" $ConfDir/gtk-3.0/settings.ini
|
||||||
|
|
||||||
|
|
||||||
|
# gtk4
|
||||||
|
rm $ConfDir/gtk-4.0
|
||||||
|
ln -s /usr/share/themes/$ThemeSet/gtk-4.0 $ConfDir/gtk-4.0
|
||||||
|
|
||||||
|
|
||||||
|
# flatpak GTK
|
||||||
|
flatpak --user override --env=GTK_THEME="${ThemeSet}"
|
||||||
|
flatpak --user override --env=ICON_THEME="${IconSet}"
|
||||||
|
|
||||||
|
|
||||||
|
# hyprland
|
||||||
|
ln -fs $ConfDir/hypr/themes/${ThemeSet}.conf $ConfDir/hypr/themes/theme.conf
|
||||||
|
hyprctl reload
|
||||||
|
|
||||||
|
|
||||||
|
# wallbash
|
||||||
|
"${ScrDir}/swwwallbash.sh" "$getWall"
|
||||||
|
|
77
.config/hypr/scripts/volumecontrol.sh
Executable file
77
.config/hypr/scripts/volumecontrol.sh
Executable file
|
@ -0,0 +1,77 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
ScrDir=`dirname "$(realpath "$0")"`
|
||||||
|
source $ScrDir/globalcontrol.sh
|
||||||
|
|
||||||
|
|
||||||
|
# define functions
|
||||||
|
|
||||||
|
function print_error
|
||||||
|
{
|
||||||
|
cat << "EOF"
|
||||||
|
./volumecontrol.sh -[device] <action>
|
||||||
|
...valid device are...
|
||||||
|
i -- [i]nput decive
|
||||||
|
o -- [o]utput device
|
||||||
|
...valid actions are...
|
||||||
|
i -- <i>ncrease volume [+5]
|
||||||
|
d -- <d>ecrease volume [-5]
|
||||||
|
m -- <m>ute [x]
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
function notify_vol
|
||||||
|
{
|
||||||
|
vol=`pamixer $srce --get-volume | cat`
|
||||||
|
angle="$(( (($vol+2)/5) * 5 ))"
|
||||||
|
ico="${icodir}/vol-${angle}.svg"
|
||||||
|
bar=$(seq -s "." $(($vol / 15)) | sed 's/[0-9]//g')
|
||||||
|
dunstify "t2" -a "$vol$bar" "$nsink" -i $ico -r 91190 -t 800
|
||||||
|
}
|
||||||
|
|
||||||
|
function notify_mute
|
||||||
|
{
|
||||||
|
mute=`pamixer $srce --get-mute | cat`
|
||||||
|
if [ "$mute" == "true" ] ; then
|
||||||
|
dunstify "t2" -a "muted" "$nsink" -i ${icodir}/muted-${dvce}.svg -r 91190 -t 800
|
||||||
|
else
|
||||||
|
dunstify "t2" -a "unmuted" "$nsink" -i ${icodir}/unmuted-${dvce}.svg -r 91190 -t 800
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# set device source
|
||||||
|
|
||||||
|
while getopts io SetSrc
|
||||||
|
do
|
||||||
|
case $SetSrc in
|
||||||
|
i) nsink=$(pamixer --list-sources | grep "_input." | head -1 | awk -F '" "' '{print $NF}' | sed 's/"//')
|
||||||
|
srce="--default-source"
|
||||||
|
dvce="mic" ;;
|
||||||
|
o) nsink=$(pamixer --get-default-sink | grep "_output." | awk -F '" "' '{print $NF}' | sed 's/"//')
|
||||||
|
srce=""
|
||||||
|
dvce="speaker" ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ $OPTIND -eq 1 ] ; then
|
||||||
|
print_error
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# set device action
|
||||||
|
|
||||||
|
shift $((OPTIND -1))
|
||||||
|
step="${2:-5}"
|
||||||
|
icodir="~/.config/dunst/icons/vol"
|
||||||
|
|
||||||
|
case $1 in
|
||||||
|
i) pamixer $srce -i ${step}
|
||||||
|
notify_vol ;;
|
||||||
|
d) pamixer $srce -d ${step}
|
||||||
|
notify_vol ;;
|
||||||
|
m) pamixer $srce -t
|
||||||
|
notify_mute ;;
|
||||||
|
*) print_error ;;
|
||||||
|
esac
|
||||||
|
|
14
.config/hypr/scripts/wallbashdunst.sh
Executable file
14
.config/hypr/scripts/wallbashdunst.sh
Executable file
|
@ -0,0 +1,14 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# set variables
|
||||||
|
|
||||||
|
ScrDir=`dirname "$(realpath "$0")"`
|
||||||
|
source $ScrDir/globalcontrol.sh
|
||||||
|
dstDir="${XDG_CONFIG_HOME:-$HOME/.config}/dunst"
|
||||||
|
|
||||||
|
# regen conf
|
||||||
|
|
||||||
|
cat "$dstDir/dunst.conf" "$dstDir/Wall-Dcol.conf" > "$dstDir/dunstrc"
|
||||||
|
killall dunst
|
||||||
|
dunst &
|
||||||
|
|
24
.config/hypr/scripts/wallbashkvm.sh
Executable file
24
.config/hypr/scripts/wallbashkvm.sh
Executable file
|
@ -0,0 +1,24 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# set variables
|
||||||
|
|
||||||
|
ScrDir=`dirname "$(realpath "$0")"`
|
||||||
|
source $ScrDir/globalcontrol.sh
|
||||||
|
hypDir="${XDG_CONFIG_HOME:-$HOME/.config}/hypr/themes"
|
||||||
|
|
||||||
|
# regen color conf
|
||||||
|
|
||||||
|
if [ "$EnableWallDcol" -eq 1 ] ; then
|
||||||
|
kvantummanager --set Wall-Dcol
|
||||||
|
else
|
||||||
|
kvantummanager --set $gtkTheme
|
||||||
|
fi
|
||||||
|
|
||||||
|
# reload dolphin
|
||||||
|
|
||||||
|
a_ws=$(hyprctl -j activeworkspace | jq '.id')
|
||||||
|
if [ "$(hyprctl -j clients | jq --arg wid "$a_ws" '.[] | select(.workspace.id == ($wid | tonumber)) | select(.class == "org.kde.dolphin") | .mapped')" == "true" ] ; then
|
||||||
|
pkill -x dolphin
|
||||||
|
dolphin &
|
||||||
|
fi
|
||||||
|
|
16
.config/hypr/scripts/wallbashrofi.sh
Executable file
16
.config/hypr/scripts/wallbashrofi.sh
Executable file
|
@ -0,0 +1,16 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# set variables
|
||||||
|
|
||||||
|
ScrDir=`dirname "$(realpath "$0")"`
|
||||||
|
source $ScrDir/globalcontrol.sh
|
||||||
|
rofThm="${XDG_CONFIG_HOME:-$HOME/.config}/rofi/themes"
|
||||||
|
|
||||||
|
# regen color conf
|
||||||
|
|
||||||
|
if [ "$EnableWallDcol" -ne 1 ] ; then
|
||||||
|
cp ${rofThm}/${gtkTheme}.rasi ${rofThm}/theme.rasi
|
||||||
|
else
|
||||||
|
cp ${rofThm}/Wall-Dcol.rasi ${rofThm}/theme.rasi
|
||||||
|
fi
|
||||||
|
|
27
.config/hypr/scripts/wallbashspotify.sh
Executable file
27
.config/hypr/scripts/wallbashspotify.sh
Executable file
|
@ -0,0 +1,27 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# set variables
|
||||||
|
|
||||||
|
ScrDir=`dirname "$(realpath "$0")"`
|
||||||
|
source $ScrDir/globalcontrol.sh
|
||||||
|
scol="${XDG_CONFIG_HOME:-$HOME/.config}/spicetify/Themes/Sleek/color.ini"
|
||||||
|
dcol="${XDG_CONFIG_HOME:-$HOME/.config}/spicetify/Themes/Sleek/Wall-Dcol.ini"
|
||||||
|
|
||||||
|
# regen conf
|
||||||
|
|
||||||
|
if pkg_installed spotify && pkg_installed spicetify-cli ; then
|
||||||
|
|
||||||
|
if [ "$(spicetify config | awk '{if ($1=="color_scheme") print $2}')" != "Wallbash" ] ; then
|
||||||
|
tar -xzf ${CloneDir}/Source/arcs/Spotify_Sleek.tar.gz -C ~/.config/spicetify/Themes/
|
||||||
|
spicetify config current_theme Sleek
|
||||||
|
spicetify config color_scheme Wallbash
|
||||||
|
fi
|
||||||
|
|
||||||
|
if pgrep -x spotify > /dev/null ; then
|
||||||
|
pkill -x spicetify
|
||||||
|
spicetify -q watch -s &
|
||||||
|
fi
|
||||||
|
|
||||||
|
cp "$dcol" "$scol"
|
||||||
|
fi
|
||||||
|
|
27
.config/hypr/scripts/wallbashtoggle.sh
Executable file
27
.config/hypr/scripts/wallbashtoggle.sh
Executable file
|
@ -0,0 +1,27 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# set variables
|
||||||
|
ScrDir=`dirname "$(realpath "$0")"`
|
||||||
|
DcoDir="${XDG_CONFIG_HOME:-$HOME/.config}/hypr/wallbash"
|
||||||
|
TgtScr=$ScrDir/globalcontrol.sh
|
||||||
|
source $ScrDir/globalcontrol.sh
|
||||||
|
|
||||||
|
# switch WallDcol variable
|
||||||
|
if [ $EnableWallDcol -eq 1 ] ; then
|
||||||
|
sed -i "/^EnableWallDcol/c\EnableWallDcol=0" $TgtScr
|
||||||
|
notif=" Wallbash disabled..."
|
||||||
|
else
|
||||||
|
sed -i "/^EnableWallDcol/c\EnableWallDcol=1" $TgtScr
|
||||||
|
notif=" Wallbash enabled..."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# reset the colors
|
||||||
|
grep -m 1 '.' $DcoDir/*.dcol | awk -F '|' '{print $2}' | while read wallbash
|
||||||
|
do
|
||||||
|
if [ ! -z "$wallbash" ] ; then
|
||||||
|
eval "${wallbash}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
dunstify "t1" -a "$notif" -i "~/.config/dunst/icons/hyprdots.png" -r 91190 -t 2200
|
||||||
|
|
16
.config/hypr/scripts/wallbashypr.sh
Executable file
16
.config/hypr/scripts/wallbashypr.sh
Executable file
|
@ -0,0 +1,16 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# set variables
|
||||||
|
|
||||||
|
ScrDir=`dirname "$(realpath "$0")"`
|
||||||
|
source $ScrDir/globalcontrol.sh
|
||||||
|
hypDir="${XDG_CONFIG_HOME:-$HOME/.config}/hypr/themes"
|
||||||
|
|
||||||
|
# regen color conf
|
||||||
|
|
||||||
|
if [ "$EnableWallDcol" -eq 1 ] ; then
|
||||||
|
cp ${hypDir}/Wall-Dcol.conf ${hypDir}/colors.conf
|
||||||
|
else
|
||||||
|
> ${hypDir}/colors.conf
|
||||||
|
fi
|
||||||
|
|
19
.config/hypr/scripts/wallpaper.sh
Executable file
19
.config/hypr/scripts/wallpaper.sh
Executable file
|
@ -0,0 +1,19 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
DIR=~/.config/wallpapers
|
||||||
|
PICS=($(ls ${DIR}))
|
||||||
|
|
||||||
|
RANDOMPICS=${PICS[ $RANDOM % ${#PICS[@]} ]}
|
||||||
|
|
||||||
|
if [[ $(pidof swaybg) ]]; then
|
||||||
|
pkill swaybg
|
||||||
|
fi
|
||||||
|
|
||||||
|
swww query || swww init
|
||||||
|
|
||||||
|
#change-wallpaper using swww
|
||||||
|
swww img ${DIR}/${RANDOMPICS} --transition-fps 60 --transition-type any --transition-duration 2
|
||||||
|
|
||||||
|
wal -i ~/.config/wallpapers
|
||||||
|
~/.config/.scripts/swww.sh
|
||||||
|
|
125
.config/hypr/scripts/wbarconfgen.sh
Executable file
125
.config/hypr/scripts/wbarconfgen.sh
Executable file
|
@ -0,0 +1,125 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
|
||||||
|
# read control file and initialize variables
|
||||||
|
|
||||||
|
ScrDir=`dirname "$(realpath "$0")"`
|
||||||
|
waybar_dir="${XDG_CONFIG_HOME:-$HOME/.config}/waybar"
|
||||||
|
modules_dir="$waybar_dir/modules"
|
||||||
|
conf_file="$waybar_dir/config.jsonc"
|
||||||
|
conf_ctl="$waybar_dir/config.ctl"
|
||||||
|
|
||||||
|
readarray -t read_ctl < $conf_ctl
|
||||||
|
num_files="${#read_ctl[@]}"
|
||||||
|
switch=0
|
||||||
|
|
||||||
|
|
||||||
|
# update control file to set next/prev mode
|
||||||
|
|
||||||
|
if [ $num_files -gt 1 ]
|
||||||
|
then
|
||||||
|
for (( i=0 ; i<$num_files ; i++ ))
|
||||||
|
do
|
||||||
|
flag=`echo "${read_ctl[i]}" | cut -d '|' -f 1`
|
||||||
|
if [ $flag -eq 1 ] && [ "$1" == "n" ] ; then
|
||||||
|
nextIndex=$(( (i + 1) % $num_files ))
|
||||||
|
switch=1
|
||||||
|
break;
|
||||||
|
|
||||||
|
elif [ $flag -eq 1 ] && [ "$1" == "p" ] ; then
|
||||||
|
nextIndex=$(( i - 1 ))
|
||||||
|
switch=1
|
||||||
|
break;
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $switch -eq 1 ] ; then
|
||||||
|
update_ctl="${read_ctl[nextIndex]}"
|
||||||
|
export reload_flag=1
|
||||||
|
sed -i "s/^1/0/g" $conf_ctl
|
||||||
|
awk -F '|' -v cmp="$update_ctl" '{OFS=FS} {if($0==cmp) $1=1; print$0}' $conf_ctl > $waybar_dir/tmp && mv $waybar_dir/tmp $conf_ctl
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# overwrite config from header module
|
||||||
|
|
||||||
|
export set_sysname=`hostnamectl hostname`
|
||||||
|
export w_position=`grep '^1|' $conf_ctl | cut -d '|' -f 3`
|
||||||
|
|
||||||
|
export w_height=`grep '^1|' $conf_ctl | cut -d '|' -f 2`
|
||||||
|
if [ -z $w_height ] ; then
|
||||||
|
y_monres=`cat /sys/class/drm/*/modes | head -1 | cut -d 'x' -f 2`
|
||||||
|
export w_height=$(( y_monres*2/100 ))
|
||||||
|
fi
|
||||||
|
|
||||||
|
export i_size=$(( w_height*6/10 ))
|
||||||
|
if [ $i_size -lt 12 ] ; then
|
||||||
|
export i_size="12"
|
||||||
|
fi
|
||||||
|
|
||||||
|
export i_theme=`gsettings get org.gnome.desktop.interface icon-theme | sed "s/'//g"`
|
||||||
|
export i_task=$(( w_height*6/10 ))
|
||||||
|
if [ $i_task -lt 16 ] ; then
|
||||||
|
export i_task="16"
|
||||||
|
fi
|
||||||
|
|
||||||
|
envsubst < $modules_dir/header.jsonc > $conf_file
|
||||||
|
|
||||||
|
|
||||||
|
# module generator function
|
||||||
|
|
||||||
|
gen_mod()
|
||||||
|
{
|
||||||
|
local pos=$1
|
||||||
|
local col=$2
|
||||||
|
local mod=""
|
||||||
|
|
||||||
|
mod=`grep '^1|' $conf_ctl | cut -d '|' -f ${col}`
|
||||||
|
mod="${mod//(/"custom/l_end"}"
|
||||||
|
mod="${mod//)/"custom/r_end"}"
|
||||||
|
mod="${mod//[/"custom/sl_end"}"
|
||||||
|
mod="${mod//]/"custom/sr_end"}"
|
||||||
|
mod="${mod//\{/"custom/rl_end"}"
|
||||||
|
mod="${mod//\}/"custom/rr_end"}"
|
||||||
|
mod="${mod// /"\",\""}"
|
||||||
|
|
||||||
|
echo -e "\t\"modules-${pos}\": [\"custom/padd\",\"${mod}\",\"custom/padd\"]," >> $conf_file
|
||||||
|
write_mod=`echo $write_mod $mod`
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# write positions for modules
|
||||||
|
|
||||||
|
echo -e "\n\n// positions generated based on config.ctl //\n" >> $conf_file
|
||||||
|
gen_mod left 4
|
||||||
|
gen_mod center 5
|
||||||
|
gen_mod right 6
|
||||||
|
|
||||||
|
|
||||||
|
# copy modules/*.jsonc to the config
|
||||||
|
|
||||||
|
echo -e "\n\n// sourced from modules based on config.ctl //\n" >> $conf_file
|
||||||
|
echo "$write_mod" | sed 's/","/\n/g ; s/ /\n/g' | awk -F '/' '{print $NF}' | awk -F '#' '{print $1}' | awk '!x[$0]++' | while read mod_cpy
|
||||||
|
do
|
||||||
|
|
||||||
|
# case ${w_position}-$(grep -E '"modules-left":|"modules-center":|"modules-right":' $conf_file | grep "$mod_cpy" | tail -1 | cut -d '"' -f 2 | cut -d '-' -f 2) in
|
||||||
|
# top-left) export mod_pos=1;;
|
||||||
|
# top-right) export mod_pos=2;;
|
||||||
|
# bottom-right) export mod_pos=3;;
|
||||||
|
# bottom-left) export mod_pos=4;;
|
||||||
|
# esac
|
||||||
|
|
||||||
|
if [ -f $modules_dir/$mod_cpy.jsonc ] ; then
|
||||||
|
envsubst < $modules_dir/$mod_cpy.jsonc >> $conf_file
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
cat $modules_dir/footer.jsonc >> $conf_file
|
||||||
|
|
||||||
|
|
||||||
|
# generate style and restart waybar
|
||||||
|
|
||||||
|
$ScrDir/wbarstylegen.sh
|
||||||
|
|
||||||
|
|
77
.config/hypr/scripts/wbarstylegen.sh
Executable file
77
.config/hypr/scripts/wbarstylegen.sh
Executable file
|
@ -0,0 +1,77 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
|
||||||
|
# detect hypr theme and initialize variables
|
||||||
|
|
||||||
|
ScrDir=`dirname "$(realpath "$0")"`
|
||||||
|
source $ScrDir/globalcontrol.sh
|
||||||
|
waybar_dir="${XDG_CONFIG_HOME:-$HOME/.config}/waybar"
|
||||||
|
modules_dir="$waybar_dir/modules"
|
||||||
|
in_file="$waybar_dir/modules/style.css"
|
||||||
|
out_file="$waybar_dir/style.css"
|
||||||
|
src_file="${XDG_CONFIG_HOME:-$HOME/.config}/hypr/themes/theme.conf"
|
||||||
|
|
||||||
|
if [ "$EnableWallDcol" -eq 1 ] ; then
|
||||||
|
ln -fs $waybar_dir/themes/Wall-Dcol.css $waybar_dir/themes/theme.css
|
||||||
|
reload_flag=1
|
||||||
|
elif [ $(readlink $waybar_dir/themes/theme.css) != "$waybar_dir/themes/${gtkTheme}.css" ] ; then
|
||||||
|
ln -fs $waybar_dir/themes/${gtkTheme}.css $waybar_dir/themes/theme.css
|
||||||
|
reload_flag=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# calculate height from control file or monitor res
|
||||||
|
|
||||||
|
b_height=`grep '^1|' $waybar_dir/config.ctl | cut -d '|' -f 2`
|
||||||
|
|
||||||
|
if [ -z $b_height ] || [ "$b_height" == "0" ]; then
|
||||||
|
y_monres=`cat /sys/class/drm/*/modes | head -1 | cut -d 'x' -f 2`
|
||||||
|
b_height=$(( y_monres*3/100 ))
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# calculate values based on height
|
||||||
|
|
||||||
|
export b_radius=$(( b_height*70/100 )) # block rad 70% of height (type1)
|
||||||
|
export c_radius=$(( b_height*25/100 )) # block rad 25% of height {type2}
|
||||||
|
export t_radius=$(( b_height*25/100 )) # tooltip rad 25% of height
|
||||||
|
export e_margin=$(( b_height*30/100 )) # block margin 30% of height
|
||||||
|
export e_paddin=$(( b_height*10/100 )) # block padding 10% of height
|
||||||
|
export g_margin=$(( b_height*14/100 )) # module margin 14% of height
|
||||||
|
export g_paddin=$(( b_height*15/100 )) # module padding 15% of height
|
||||||
|
export w_radius=$(( b_height*30/100 )) # workspace rad 30% of height
|
||||||
|
export w_margin=$(( b_height*10/100 )) # workspace margin 10% of height
|
||||||
|
export w_paddin=$(( b_height*10/100 )) # workspace padding 10% of height
|
||||||
|
export w_padact=$(( b_height*40/100 )) # workspace active padding 40% of height
|
||||||
|
export s_fontpx=$(( b_height*38/100 )) # font size 38% of height
|
||||||
|
|
||||||
|
if [ $b_height -lt 30 ] ; then
|
||||||
|
export e_paddin=0
|
||||||
|
fi
|
||||||
|
if [ $s_fontpx -lt 10 ] ; then
|
||||||
|
export s_fontpx=10
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# list modules and generate theme style
|
||||||
|
|
||||||
|
export modules_ls=$(grep -m 1 '".*.": {' --exclude="$modules_dir/footer.jsonc" $modules_dir/*.jsonc | cut -d '"' -f 2 | awk -F '/' '{ if($1=="custom") print "#custom-"$NF"," ; else print "#"$NF","}')
|
||||||
|
envsubst < $in_file > $out_file
|
||||||
|
|
||||||
|
|
||||||
|
# override rounded couners
|
||||||
|
|
||||||
|
hypr_border=`awk -F '=' '{if($1~" rounding ") print $2}' $src_file | sed 's/ //g'`
|
||||||
|
if [ "$hypr_border" == "0" ] ; then
|
||||||
|
sed -i "/border-radius: /c\ border-radius: 0px;" $out_file
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# restart waybar
|
||||||
|
|
||||||
|
if [ "$reload_flag" == "1" ] ; then
|
||||||
|
killall waybar
|
||||||
|
waybar > /dev/null 2>&1 &
|
||||||
|
# killall -SIGUSR2 waybar
|
||||||
|
fi
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue