Глобальный рефактор скриптов

Скрипты необходимые в Waybar, Hyprland, Wlogout теперь сосредоточены в ~/retrilz-scripts
This commit is contained in:
retrilzzy committed 2025-10-20 20:25:19 +05:00
1 parent e62afd31f7
commit 3f75342aec
22 files changed
+91 -220

No files matched your search

+2 -2
View File
@@ -6,7 +6,7 @@ general {
listener {
timeout = 600
on-timeout = brightnessctl -s set 10%
on-timeout = brightnessctl -s set 20%
on-resume = brightnessctl -r
}
@@ -29,5 +29,5 @@ listener {
listener {
timeout = 1080
on-timeout = $HOME/.config/wlogout/current_wall.sh && systemctl suspend
on-timeout = ~/.config/retrilz-scripts/current-wall.sh && systemctl suspend
}
+2 -2
View File
@@ -5,7 +5,7 @@
exec-once = gnome-keyring-daemon --start --components=secrets
exec-once = uwsm app -- waypaper --random --folder ~/Pictures/Wallpapers
exec-once = uwsm app -- hypridle
exec-once = uwsm app -- waybar -c $HOME/.config/waybar/config.jsonc -s $HOME/.config/waybar/styles.css
exec-once = uwsm app -- waybar -c ~/.config/waybar/config.jsonc -s ~/.config/waybar/styles.css
exec-once = uwsm app -- nwg-look -a
exec-once = uwsm app -- swaync -c ~/.config/swaync/config.json
@@ -14,7 +14,7 @@ exec-once = uwsm app -- blueman-applet
exec-once = wl-paste --type text --watch cliphist -max-items 50 store
exec-once = wl-paste --type image --watch cliphist -max-items 50 store
exec-once = wl-clip-persist --clipboard regular --write-timeout 1000 --selection-size-limit 2097152 --all-mime-type-regex '(?i)^(?!(?:image|audio|video|font|model)/|x-kde-passwordManagerHint).+'
exec-once = wl-clip-persist --clipboard regular --write-timeout 1000 --selection-size-limit 2097152
exec-once = /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
+6 -5
View File
@@ -27,11 +27,6 @@ input {
################
# https://wiki.hyprland.org/Configuring/Variables/#gestures
gesture = 3, swipe, move,
gesture = 4, horizontal, workspace
gesture = 4, pinch, float
gesture = 4, up, special
gesture = 4, down, dispatcher, exec, $HOME/.config/waybar/scripts/logoutlaunch.sh 1
gestures {
workspace_swipe_distance = 600
workspace_swipe_cancel_ratio = 0.2
@@ -40,3 +35,9 @@ gestures {
workspace_swipe_direction_lock_threshold = 10
workspace_swipe_create_new = true
}
gesture = 3, swipe, move,
gesture = 4, horizontal, workspace
gesture = 4, pinch, float
gesture = 4, up, special
gesture = 4, down, dispatcher, exec, $HOME/.config/waybar/scripts/logout-launch.sh 1
+13 -13
View File
@@ -23,8 +23,8 @@ $mainMod = SUPER
bind = $mainMod, W, exec, $terminal
bind = $mainMod SHIFT, W, exec, [float; size 750 500; move 55% 10%] $terminal
bind = $mainMod, R, exec, rofi -show drun -theme $HOME/.config/rofi/launcher.rasi
bind = $mainMod, O, exec, $HOME/.config/hypr/scripts/oniux-launcher.sh
bind = $mainMod, R, exec, rofi -show drun -theme ~/.config/rofi/launcher.rasi
bind = $mainMod, O, exec, ~/.config/retrilz-scripts/oniux-launcher.sh
bind = $mainMod, E, exec, $fileManager
bind = $mainMod, C, exec, $editor
@@ -34,7 +34,7 @@ bind = $mainMod, K, exec, $passwordManager
bind = $mainMod SHIFT, P, exec, waypaper
bind = $mainMod SHIFT, E, exec, emote
bind = $mainMod, V, exec, cliphist list | rofi -dmenu -theme $HOME/.config/rofi/clipboard.rasi | cliphist decode | wl-copy
bind = $mainMod, V, exec, cliphist list | rofi -dmenu -theme ~/.config/rofi/clipboard.rasi | cliphist decode | wl-copy
bind = $mainMod, N, exec, swaync-client -t -sw
@@ -43,7 +43,7 @@ bind = $mainMod ALT, P, exec, waypaper --backend swww --random --folder ~/Pictur
bind = $mainMod SHIFT ALT, P, exec, waypaper --backend swww --random --folder ~/Pictures/Wallpapers_
# Toggle Waybar
bind = $mainMod, ESCAPE, exec, killall waybar || waybar -c $HOME/.config/waybar/config.jsonc -s $HOME/.config/waybar/styles.css
bind = $mainMod, ESCAPE, exec, killall waybar || waybar -c ~/.config/waybar/config.jsonc -s ~/.config/waybar/styles.css
# Toggle Microphone
bind = $mainMod, M, exec, bash -c 'pactl set-source-mute @DEFAULT_SOURCE@ toggle; mute=$(pactl get-source-mute @DEFAULT_SOURCE@); notify-send -t 1000 "Mircrophone" "$mute"'
@@ -65,21 +65,21 @@ bind = ALT, Tab, bringactivetotop,
# Sessions and power
bind = $mainMod, L, exec, $HOME/.config/wlogout/current_wall.sh && loginctl lock-session
bind = $mainMod, P, exec, $HOME/.config/waybar/scripts/logoutlaunch.sh 1
bind = $mainMod, L, exec, ~/.config/retrilz-scripts/current-wall.sh && loginctl lock-session
bind = $mainMod, P, exec, ~/.config/retrilz-scripts/logout-launch.sh 1
bindl = $mainMod ALT, D, exec, hyprctl dispatch dpms toggle # Toggle display
bindl = $mainMod ALT, S, exec, $HOME/.config/wlogout/current_wall.sh && systemctl suspend
bindl = $mainMod ALT, S, exec, ~/.config/retrilz-scripts/current-wall.sh && systemctl suspend
# Screenshots
bind = , Print, exec, grim -c - | wl-copy && wl-paste > ~/Pictures/Screen/$(date +%F_%H-%M-%S)_grim.png && notify-send "Grim" "Screenshot of whole screen taken." -t 2000
bind = SHIFT, Print, exec, hyprshot -m region -t 2000 -o ~/Pictures/Screen -f $(date +%F_%H-%M-%S)_hyprshot.png
bind = $mainMod SHIFT, F, exec, flameshot gui -r -p ~/Pictures/Screen | wl-copy --type image/png
bind = $mainMod, PRINT, exec, $HOME/.config/hypr/scripts/screenshot_to_zipline.sh
bind = $mainMod, PRINT, exec, ~/.config/retrilz-scripts/screenshot-zipline.sh
# Screen Recording
bind = $mainMod SHIFT, R, exec, ~/.config/hypr/scripts/wf-record.sh
bind = $mainMod SHIFT, R, exec, ~/.config/retrilz-scripts/record.sh
# Move focus with mainMod + arrow keys
@@ -145,12 +145,12 @@ bindm = $mainMod, mouse:273, resizewindow
# Laptop multimedia keys for volume and LCD brightness
bindel = ,XF86AudioRaiseVolume, exec, ~/.config/hypr/scripts/volumecontrol.sh -o i
bindel = ,XF86AudioLowerVolume, exec, ~/.config/hypr/scripts/volumecontrol.sh -o d
bindel = ,XF86AudioRaiseVolume, exec, ~/.config/retrilz-scripts/volume-control.sh -o i
bindel = ,XF86AudioLowerVolume, exec, ~/.config/retrilz-scripts/volume-control.sh -o d
bindel = ,XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle
bindel = ,XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle
bindel = ,XF86MonBrightnessUp, exec, ~/.config/hypr/scripts/brightnesscontrol.sh -o i
bindel = ,XF86MonBrightnessDown, exec, ~/.config/hypr/scripts/brightnesscontrol.sh -o d
bindel = ,XF86MonBrightnessUp, exec, ~/.config/retrilz-scripts/brightness-control.sh -o i
bindel = ,XF86MonBrightnessDown, exec, ~/.config/retrilz-scripts/brightness-control.sh -o d
# Requires playerctl
bindl = , XF86AudioNext, exec, playerctl next
@@ -1,5 +0,0 @@
# ChibiSafe URL for accessing your service
CHIBISAFE_URL=https://chibisafe.example
# ChibiSafe API key, which can be obtained from your account dashboard (https://chibisafe.example/dashboard/account)
CHIBISAFE_API_KEY=your_api_key
@@ -1,45 +0,0 @@
#!/bin/bash
# Print error message for invalid arguments
print_error() {
cat <<"EOF"
Usage: ./brightnesscontrol.sh <action>
Valid actions are:
i -- <i>ncrease brightness [+5%]
d -- <d>ecrease brightness [-5%]
EOF
}
brightness=$(brightnessctl -m | grep -o '[0-9]\+%' | head -c-2)
# Handle options
while getopts o: opt; do
case "${opt}" in
o)
case $OPTARG in
i) # Increase brightness
if [[ $brightness -lt 10 ]]; then
brightnessctl set +1%
else
brightnessctl set +5%
fi
;;
d) # Decrease brightness
if [[ $brightness -le 1 ]]; then
brightnessctl set 1%
elif [[ $brightness -le 10 ]]; then
brightnessctl set 1%-
else
brightnessctl set 5%-
fi
;;
*)
print_error
;;
esac
;;
*)
print_error
;;
esac
done
@@ -1,94 +0,0 @@
#!/bin/bash
# Define functions
print_error() {
cat <<"EOF"
Usage: ./volumecontrol.sh -[device] <actions>
...valid devices are...
i -- input device
o -- output device
p -- player application
...valid actions are...
i -- increase volume [+5]
d -- decrease volume [-5]
m -- mute [x]
EOF
exit 1
}
action_volume() {
case "${1}" in
i)
# Check current volume and increase only if below 100
current_vol=$(pactl get-sink-volume @DEFAULT_SINK@ | awk '{print $5}' | sed 's/%//')
if [ "$current_vol" -lt 100 ]; then
new_vol=$((current_vol + 5))
if [ "$new_vol" -gt 100 ]; then
new_vol=100
fi
pactl set-sink-volume @DEFAULT_SINK@ "${new_vol}%"
fi
;;
d)
# Decrease volume, ensuring it doesn't drop below 0%
current_vol=$(pactl get-sink-volume @DEFAULT_SINK@ | awk '{print $5}' | sed 's/%//')
new_vol=$((current_vol - 5))
if [ "$new_vol" -lt 0 ]; then
new_vol=0
fi
pactl set-sink-volume @DEFAULT_SINK@ "${new_vol}%"
;;
esac
}
select_output() {
if [ "$@" ]; then
desc="$*"
device=$(pactl list sinks | grep -C2 -F "Description: $desc" | grep Name | cut -d: -f2 | xargs)
if pactl set-default-sink "$device"; then
notify-send -r 91190 "Activated: $desc"
else
notify-send -r 91190 "Error activating $desc"
fi
else
pactl list sinks | grep -ie "Description:" | awk -F ': ' '{print $2}' | sort
fi
}
# Evaluate device option
while getopts iops: DeviceOpt; do
case "${DeviceOpt}" in
i)
nsink=$(pactl list sources short | awk '{print $2}')
[ -z "${nsink}" ] && echo "ERROR: Input device not found..." && exit 0
srce="--default-source"
;;
o)
nsink=$(pactl list sinks short | awk '{print $2}')
[ -z "${nsink}" ] && echo "ERROR: Output device not found..." && exit 0
srce=""
;;
p)
nsink=$(playerctl --list-all | grep -w "${OPTARG}")
[ -z "${nsink}" ] && echo "ERROR: Player ${OPTARG} not active..." && exit 0
# shellcheck disable=SC2034
srce="${nsink}"
;;
s)
# Select an output device
select_output "$@"
exit
;;
*) print_error ;;
esac
done
# Set default variables
shift $((OPTIND - 1))
# Execute action
case "${1}" in
i) action_volume i ;;
d) action_volume d ;;
*) print_error ;;
esac
@@ -0,0 +1,12 @@
# ChibiSafe URL for accessing your service
CHIBISAFE_URL=https://chibisafe.example
# ChibiSafe API key, which can be obtained from dashboard (https://chibisafe.example/dashboard/account)
CHIBISAFE_API_KEY=qwe123rty456
# Zipline URL for accessing your service
ZIPLINE_URL=https://zipline.example
# Zipline API key, which can be obtained from dashboard (https://zipline.example/dashboard/settings)
ZIPLINE_API_KEY=qwe123rty456
# Zipline folder ID for uploading files
ZIPLINE_FOLDER_ID=
@@ -0,0 +1,3 @@
*.env
.venv/
@@ -3,7 +3,7 @@
# Print error message for invalid arguments
print_error() {
cat <<"EOF"
Usage: ./brightnesscontrol.sh <action>
Usage: ./brightness-control.sh <action>
Valid actions are:
i -- <i>ncrease brightness [+5%]
d -- <d>ecrease brightness [-5%]
@@ -1,17 +1,17 @@
#!/bin/bash
# Get CPU clock speeds
freqlist=$(awk '/cpu MHz/ {print $4}' /proc/cpuinfo) # Extract clock speed in MHz
maxfreq=$(sed 's/...$//' /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq) # Max CPU frequency
frequency=$(echo "$freqlist" | tr ' ' '\n' | awk "{sum+=\$1} END {printf \"%.0f/$maxfreq MHz\", sum/NR}") # Average frequency
freqlist=$(awk '/cpu MHz/ {print $4}' /proc/cpuinfo) # Extract clock speed in MHz
maxfreq=$(sed 's/...$//' /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq) # Max CPU frequency
frequency=$(echo "$freqlist" | tr ' ' '\n' | awk "{sum+=\$1} END {printf \"%.0f/$maxfreq MHz\", sum/NR}") # Average frequency
# Get CPU temperature in Celsius
temp=$(sensors | awk '/Package id 0/ {print $4}' | awk -F '[+.]' '{print $2}') # Package temperature
temp=$(sensors | awk '/Package id 0/ {print $4}' | awk -F '[+.]' '{print $2}') # Package temperature
if [[ -z "$temp" ]]; then
temp=$(sensors | awk '/Tctl/ {print $2}' | tr -d '+°C') # Fallback to Tctl if Package id 0 is empty
temp=$(sensors | awk '/Tctl/ {print $2}' | tr -d '+°C') # Fallback to Tctl if Package id 0 is empty
fi
if [[ -z "$temp" ]]; then
temp="N/A" # If no temp found, set to N/A
temp="N/A" # If no temp found, set to N/A
fi
# Map icons based on temperature and utilization
@@ -20,10 +20,10 @@ eval_ico() {
local key="$1"
local value="$2"
map_ico=$(echo "$set_ico" | jq -r --arg aky "$key" --argjson avl "$value" '.[$aky] | keys_unsorted | map(tonumber) | map(select(. <= $avl)) | max')
echo "$set_ico" | jq -r --arg aky "$key" --arg avl "$map_ico" '.[$aky] | .[$avl]' # Get the corresponding icon
echo "$set_ico" | jq -r --arg aky "$key" --arg avl "$map_ico" '.[$aky] | .[$avl]' # Get the corresponding icon
}
thermo=$(eval_ico thermo "$temp") # Get temperature icon
thermo=$(eval_ico thermo "$temp") # Get temperature icon
tooltip="Clock Speed: ${frequency}"
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/bin/bash
PID_FILE="$HOME/.cache/idle_inhibit.pid"
@@ -8,7 +8,7 @@ toggle() {
rm -f "$PID_FILE"
else
systemd-inhibit --what=idle:sleep --why="Manual Idle Inhibit" sleep infinity &
echo $! > "$PID_FILE"
echo $! >"$PID_FILE"
fi
}
@@ -21,6 +21,6 @@ status_json() {
}
case "$1" in
--toggle) toggle ;;
*) status_json ;;
--toggle) toggle ;;
*) status_json ;;
esac
@@ -1,7 +1,7 @@
#!/bin/bash
# Check if wlogout is already running
if pgrep -x "wlogout" > /dev/null; then
if pgrep -x "wlogout" >/dev/null; then
pkill -x "wlogout"
exit 0
fi
@@ -28,33 +28,33 @@ hypr_scale=$(hyprctl -j monitors | jq '.[] | select(.focused == true) | .scale'
# Scale config layout and style
case "${wlogoutStyle}" in
1)
wlColms=6
export mgn=$(( y_mon * 38 / hypr_scale ))
export hvr=$(( y_mon * 33 / hypr_scale ))
;;
2)
wlColms=2
export x_mgn=$(( x_mon * 38 / hypr_scale ))
export y_mgn=$(( y_mon * 28 / hypr_scale ))
export x_hvr=$(( x_mon * 35 / hypr_scale ))
export y_hvr=$(( y_mon * 23 / hypr_scale ))
;;
1)
wlColms=6
export mgn=$((y_mon * 38 / hypr_scale))
export hvr=$((y_mon * 33 / hypr_scale))
;;
2)
wlColms=2
export x_mgn=$((x_mon * 38 / hypr_scale))
export y_mgn=$((y_mon * 28 / hypr_scale))
export x_hvr=$((x_mon * 35 / hypr_scale))
export y_hvr=$((y_mon * 23 / hypr_scale))
;;
esac
# Scale font size
export fntSize=$(( y_mon * 2 / 100 ))
export fntSize=$((y_mon * 2 / 100))
export BtnCol="white" # Default button color
export BtnCol="white" # Default button color
# Evaluate hypr border radius
hypr_border="$(hyprctl -j getoption decoration:rounding | jq '.int')"
export hypr_border
export active_rad=$(( hypr_border * 5 ))
export button_rad=$(( hypr_border * 8 ))
export active_rad=$((hypr_border * 5))
export button_rad=$((hypr_border * 8))
# Evaluate config files
wlStyle=$(envsubst < "$wlTmplt")
wlStyle=$(envsubst <"$wlTmplt")
# Launch wlogout
wlogout -b "${wlColms}" -c 0 -r 0 -m 0 --layout "${wLayout}" --css <(echo "${wlStyle}") --protocol layer-shell
@@ -1,4 +1,4 @@
#!/bin/env bash
#!/bin/bash
rofi -show drun \
-theme "$HOME/.config/rofi/launcher.rasi" \
@@ -1,4 +1,4 @@
#!/bin/env bash
#!/bin/bash
# Chibisafe
# https://chibisafe.app/
@@ -42,13 +42,13 @@ url=$(echo "$response" | jq -r '.url // empty')
if [[ -n "$url" ]]; then
echo "✅ File uploaded successfully."
echo "Response: $response"
send_notification "✅ File uploaded successfully"
copy_to_clipboard "$url"
else
echo "❌ Upload failed"
echo "Response: $response"
send_notification "❌ Upload failed"
exit 1
fi
@@ -1,4 +1,4 @@
#!/bin/env bash
#!/bin/bash
# Zipline
# https://zipline.diced.sh/
@@ -3,7 +3,7 @@
# Define functions
print_error() {
cat <<"EOF"
Usage: ./volumecontrol.sh -[device] <actions>
Usage: ./volume-control.sh -[device] <actions>
...valid devices are...
i -- input device
o -- output device
+12 -13
View File
@@ -2,7 +2,6 @@
"layer": "top",
"position": "top",
"mode": "dock",
// "height": 24, // uncomment to set fixed height
"exclusive": true,
"passthrough": false,
"gtk-layer-shell": true,
@@ -39,8 +38,8 @@
// Left modules
"custom/idle_inhibitor": {
"exec": "~/.config/waybar/scripts/idle-inhibitor.sh",
"on-click": "~/.config/waybar/scripts/idle-inhibitor.sh --toggle",
"exec": "~/.config/retrilz-scripts/idle-inhibitor.sh",
"on-click": "~/.config/retrilz-scripts/idle-inhibitor.sh --toggle",
"return-type": "json",
"tooltip": true,
"interval": 10,
@@ -84,7 +83,7 @@
// Central modules
"custom/cpu": {
"exec": "~/.config/waybar/scripts/cpuusage.sh",
"exec": "~/.config/retrilz-scripts/cpu-usage.sh",
"return-type": "json",
"tooltip": true,
"interval": 5,
@@ -92,7 +91,7 @@
"max-length": 6
},
"custom/cpuinfo": {
"exec": "~/.config/waybar/scripts/cpuinfo.sh",
"exec": "~/.config/retrilz-scripts/cpu-info.sh",
"return-type": "json",
"format": "{}",
"tooltip": true,
@@ -208,20 +207,20 @@
},
"tooltip": true,
"tooltip-format": "Device: {desc}",
"on-click": "~/.config/waybar/scripts/volumecontrol.sh -o m",
"on-scroll-up": "~/.config/waybar/scripts/volumecontrol.sh -o i",
"on-scroll-down": "~/.config/waybar/scripts/volumecontrol.sh -o d",
"on-click": "~/.config/retrilz-scripts/volume-control.sh -o m",
"on-scroll-up": "~/.config/retrilz-scripts/volume-control.sh -o i",
"on-scroll-down": "~/.config/retrilz-scripts/volume-control.sh -o d",
"min-length": 6,
"max-length": 6
},
"custom/backlight": {
"exec": "~/.config/waybar/scripts/brightnesscontrol.sh",
"exec": "~/.config/retrilz-scripts/brightness-control.sh",
"return-type": "json",
"format": "{}",
"tooltip": true,
"on-scroll-up": "~/.config/waybar/scripts/brightnesscontrol.sh -o i",
"on-scroll-down": "~/.config/waybar/scripts/brightnesscontrol.sh -o d",
"on-scroll-up": "~/.config/retrilz-scripts/brightness-control.sh -o i",
"on-scroll-down": "~/.config/retrilz-scripts/brightness-control.sh -o d",
"interval": 1,
"min-length": 6,
"max-length": 6
@@ -272,8 +271,8 @@
"custom/power": {
"format": " ",
"tooltip": false,
"on-click": "~/.config/waybar/scripts/logoutlaunch.sh 2",
"on-click-right": "~/.config/waybar/scripts/logoutlaunch.sh 1",
"on-click": "~/.config/retrilz-scripts/logout-launch.sh 2",
"on-click-right": "~/.config/retrilz-scripts/logout-launch.sh 1",
"interval": 86400
}
}
+3 -3
View File
@@ -1,6 +1,6 @@
{
"label": "lock",
"action": "~/.config/wlogout/current_wall.sh && loginctl lock-session",
"action": "~/.config/retrilz-scripts/current-wall.sh && loginctl lock-session",
"text": "Lock",
"keybind": "l"
}
@@ -14,7 +14,7 @@
{
"label": "suspend",
"action": "~/.config/wlogout/current_wall.sh && systemctl suspend",
"action": "~/.config/retrilz-scripts/current-wall.sh && systemctl suspend",
"text": "Suspend",
"keybind": "s"
}
@@ -28,7 +28,7 @@
{
"label": "hibernate",
"action": "~/.config/wlogout/current_wall.sh && systemctl hibernate",
"action": "~/.config/retrilz-scripts/current-wall.sh && systemctl hibernate",
"text": "Hibernate",
"keybind": "h"
}
+1 -1
View File
@@ -1,6 +1,6 @@
set autoindent
set linenumbers
set mouse
# set mouse
# set softwrap
##