Fix audit findings, replace wlogout with moonset
Bug fixes from quality and security audits: - moonarch-capsnote: use value[0] instead of value[2] - moonarch-btnote: guard empty PER_INT before integer comparison - moonarch-clipboard + niri config: use XDG_RUNTIME_DIR instead of UID 1000 - moonarch-waybar-hidpp: use charging icon when charging - moonarch-waybar-gpustat: find gpu_busy_percent dynamically across hwmon* - post-install/transform: use systemctl --user cat for service detection - post-install/transform: install paru from [extra] instead of AUR clone Replace wlogout with moonset in niri keybind and waybar on-click. Remove moonarch-session (dead code, replaced by moonset) and wlogout layout config.
This commit is contained in:
@@ -11,7 +11,7 @@ for d in $(upower -e); do
|
||||
PER_INT=$(echo "${PERCENTAGE//%}")
|
||||
DEVICE_NAME=$(echo $DEVICE_DATA | grep -Po '(?<=(model: )).*(?= serial)')
|
||||
|
||||
if [ ! -z "$DEVICE_NAME" ] && [ "$PER_INT" -lt "$NOTIFY_AT_PERCENTAGE" ]; then
|
||||
if [ -n "$DEVICE_NAME" ] && [ -n "$PER_INT" ] && [ "$PER_INT" -lt "$NOTIFY_AT_PERCENTAGE" ]; then
|
||||
notify-send -t 5000 -e "Low battery $DEVICE_NAME $PER_INT%" -i "$ICON" \
|
||||
-h string:x-canonical-private-synchronous:battery \
|
||||
-h int:value:"$PER_INT" -u critical
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
|
||||
sleep 0.2
|
||||
|
||||
value=($(cat /sys/class/leds/input*::capslock/brightness | cut -f1 -d,))
|
||||
value=($(cat /sys/class/leds/input*::capslock/brightness 2>/dev/null | cut -f1 -d,))
|
||||
|
||||
if [ ${value[2]} == 1 ]; then
|
||||
if [ "${value[0]:-0}" == 1 ]; then
|
||||
icon_name="capslock-enabled-symbolic"
|
||||
output="caps lock on"
|
||||
else
|
||||
@@ -16,4 +16,4 @@ fi
|
||||
|
||||
notify-send -e "$output" -i "$icon_name" \
|
||||
-h string:x-canonical-private-synchronous:state \
|
||||
-h boolean:value:"${value[2]}" -r 555
|
||||
-h boolean:value:"${value[0]:-0}" -r 555
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# ABOUTME: Rofi-based clipboard history manager using cliphist and wl-copy.
|
||||
# ABOUTME: Lists clipboard entries and copies the selected one.
|
||||
|
||||
CLIPHIST_DB="/run/user/1000/cliphist/db"
|
||||
CLIPHIST_DB="${XDG_RUNTIME_DIR:-/run/user/$(id -u)}/cliphist/db"
|
||||
|
||||
function start_rofi() {
|
||||
local content="$1"
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# ABOUTME: Rofi-based session menu with horizontal icon layout.
|
||||
# ABOUTME: Replaces wlogout — provides lock, logout, suspend, hibernate, reboot, shutdown.
|
||||
|
||||
declare -A actions
|
||||
declare -a order
|
||||
|
||||
order=("lock" "logout" "suspend" "hibernate" "reboot" "shutdown")
|
||||
|
||||
actions[lock]="gtklock"
|
||||
actions[logout]="niri msg action quit"
|
||||
actions[suspend]="systemctl suspend"
|
||||
actions[hibernate]="systemctl hibernate"
|
||||
actions[reboot]="systemctl reboot"
|
||||
actions[shutdown]="systemctl poweroff"
|
||||
|
||||
# GTK icon theme names
|
||||
declare -A icons
|
||||
icons[lock]="system-lock-screen"
|
||||
icons[logout]="system-log-out"
|
||||
icons[suspend]="system-suspend"
|
||||
icons[hibernate]="system-suspend-hibernate"
|
||||
icons[reboot]="system-reboot"
|
||||
icons[shutdown]="system-shutdown"
|
||||
|
||||
# Build menu — use rofi icon protocol
|
||||
menu=""
|
||||
for key in "${order[@]}"; do
|
||||
[[ -n "$menu" ]] && menu+="\n"
|
||||
menu+="${key}\x00icon\x1f${icons[$key]}"
|
||||
done
|
||||
|
||||
selected=$(echo -e "$menu" | rofi -dmenu \
|
||||
-theme /etc/xdg/rofi/themes/session.rasi \
|
||||
-show-icons \
|
||||
-p "")
|
||||
|
||||
[[ -z "$selected" ]] && exit 0
|
||||
|
||||
# Execute the selected action
|
||||
if [[ -n "${actions[$selected]+x}" ]]; then
|
||||
eval "${actions[$selected]}"
|
||||
fi
|
||||
@@ -4,7 +4,8 @@
|
||||
|
||||
while :
|
||||
do
|
||||
GPU_STAT=$(cat /sys/class/hwmon/hwmon5/device/gpu_busy_percent 2>/dev/null || echo "0")
|
||||
GPU_STAT=$(cat /sys/class/hwmon/hwmon*/device/gpu_busy_percent 2>/dev/null | head -1 || echo "0")
|
||||
GPU_STAT="${GPU_STAT:-0}"
|
||||
ICON="<span color='#69ff94' size='8pt' rise='1.5pt'>▁</span>"
|
||||
|
||||
if [ "$GPU_STAT" -lt 10 ]; then
|
||||
|
||||
@@ -28,7 +28,7 @@ for dev in /sys/class/power_supply/hidpp_battery_*; do
|
||||
fi
|
||||
|
||||
if [ "$status" = "Charging" ]; then
|
||||
text="${capacity}% "
|
||||
text="${capacity}% "
|
||||
else
|
||||
text="${capacity}% "
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user