▲ 10 r/bash

Help scripting Caps lock on off status

Hey everyone. I have been using linux mint since a year and loved it. It just works without manual tinkering. But now, captivated by the tiling managers, i jumped to Cachy hyprland. It's interesting but doesn't have many basic functionalities like alerting user about Caps lock key status through sound. I took help of ai but it somehow spikes my cpu usage and i have to reboot to make it normal again. Here is the Script :

#!/bin/bash

# Target the specific caps lock directory (adjust if you have a specific one like input3::capslock)

LED_PATH=$(ls -d /sys/class/leds/*::capslock | head -n 1)

# Fallback paths for the sounds

SOUND_ON="/usr/share/sounds/freedesktop/stereo/dialog-information.oga"

SOUND_OFF="/usr/share/sounds/freedesktop/stereo/dialog-warning.oga"

# Read initial state

last_state=$(cat "$LED_PATH/brightness")

while true; do

# Instant raw read of the file system

current_state=$(cat "$LED_PATH/brightness")

if [ "$current_state" != "$last_state" ]; then

if [ "$current_state" -eq 1 ]; then

# Using pw-play or paplay with low-latency flags

pw-play "$SOUND_ON" &

else

pw-play "$SOUND_OFF" &

fi

last_state=$current_state

fi

# 20ms polling rate (0.02s) gives instant human response time

# without hurting CPU performance

sleep 0.02

done

Can you guys please help me out.

reddit.com
u/Landkisabzee — 21 hours ago

Help me configuring Yazi

I am trying to set it up for like 2 hours but failed. Please help me out. I want to setup GwenView for image viewing, Celluloid for video viewing and nano for text filing editing. What modifications are needed here? What other things can i modify/get to get complete experience of Yazi?

u/Landkisabzee — 3 days ago

Home screen shows lock screen elements

I installed hyprland today on cachy and though it would be resolved after applying ml4w dotfiles but it didn't. Does anyone face same problem or know how to resolve it?

u/Landkisabzee — 15 days ago