diff options
| -rwxr-xr-x | audio-autoAdjust.sh | 40 | ||||
| -rwxr-xr-x | bin/gamepad | bin | 0 -> 15880 bytes | |||
| -rwxr-xr-x | ddcutil-client.sh | 19 | ||||
| -rwxr-xr-x[-rw-r--r--] | escapeEnv.py | 0 | ||||
| -rwxr-xr-x | flipper-ac.py | 27 | ||||
| -rwxr-xr-x | hypridle.sh | 146 | ||||
| -rwxr-xr-x | hyprsunset.sh | 10 | ||||
| -rwxr-xr-x | idle.sh | 217 | ||||
| -rwxr-xr-x | sysutil.sh | 63 | ||||
| -rwxr-xr-x | walls/hyprlax.sh | 57 | ||||
| -rwxr-xr-x | walls/swww.sh | 6 |
11 files changed, 341 insertions, 244 deletions
diff --git a/audio-autoAdjust.sh b/audio-autoAdjust.sh index 398cf68..4036b9a 100755 --- a/audio-autoAdjust.sh +++ b/audio-autoAdjust.sh @@ -33,25 +33,29 @@ if [ "$1" ]; then /sbin/echo -e "Usage: $0 [OPTION]\n\nOptions:\n\t-l|--lower\tTo lower music volume\n\t-n|--normal\tTo set music volume to normal" exit 0 elif [[ "$1" == '--daemon' || "$1" == '-d' ]]; then + while true; do + if [[ "$(systemctl is-system-running)" == "running" || "$(systemctl is-system-running)" == "degraded" ]]; then + break + fi + sleep 1 + done while true; do - if [[ "$(systemctl is-system-running)" == "running" || "$(systemctl is-system-running)" == "degraded" ]]; then - if [[ $(playerctl status -p firefox) == "Playing" ]]; then - if [ $STATE -eq 0 ]; then - STATE=1 - echo VideoDetected - lower_music - fi - elif [[ $(playerctl status -p spotify) == "Playing" ]]; then - if [ $STATE -eq 1 ]; then - STATE=0 - echo VideoGone - normal_music - fi - else - sleep 5 - fi - sleep 1 - fi + if [[ $(playerctl status -p firefox) == "Playing" ]]; then + if [ $STATE -eq 0 ]; then + STATE=1 + echo VideoDetected + lower_music + fi + elif [[ $(playerctl status -p spotify) == "Playing" ]]; then + if [ $STATE -eq 1 ]; then + STATE=0 + echo VideoGone + normal_music + fi + else + sleep 5 + fi + sleep 1 done exit 0 elif [[ "$1" == '--lower' || "$1" == '-l' ]]; then diff --git a/bin/gamepad b/bin/gamepad Binary files differnew file mode 100755 index 0000000..d067634 --- /dev/null +++ b/bin/gamepad diff --git a/ddcutil-client.sh b/ddcutil-client.sh new file mode 100755 index 0000000..1cbce1f --- /dev/null +++ b/ddcutil-client.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +set -e +dir="${XDG_CACHE_HOME:-$HOME/.cache}" +file="$dir/brightness" +mkdir -p "$dir" +if [[ -f $file ]]; then + val=$(<"$file") +else + val=100 +fi +case "$1" in +--inc) new=$((val + 5)) ;; +--dec) new=$((val - 5)) ;; +*) exit 1 ;; +esac +((new > 100)) && new=100 +((new < 0)) && new=0 +ddcutil-client setvcp 10 "$new" & +echo "$new" >"$file" diff --git a/escapeEnv.py b/escapeEnv.py index 9ff4f84..9ff4f84 100644..100755 --- a/escapeEnv.py +++ b/escapeEnv.py diff --git a/flipper-ac.py b/flipper-ac.py index 9c3ab96..19c0328 100755 --- a/flipper-ac.py +++ b/flipper-ac.py @@ -14,10 +14,9 @@ class status_t(Enum): TURNING_OFF = "" ac_open = [3538,1661,502,392,474,1257,475,390,450,413,450,414,449,414,449,415,449,413,450,413,475,389,475,389,475,388,475,391,475,1257,474,391,472,391,471,392,470,395,468,420,444,419,444,423,444,1288,443,1289,444,1289,443,419,444,423,443,1290,444,419,444,419,444,419,444,420,444,419,444,419,444,419,444,421,443,419,444,419,444,419,444,420,444,419,444,419,444,420,443,421,443,419,444,420,443,419,444,421,443,420,443,420,443,420,443,421,443,420,443,420,443,420,443,421,443,420,443,423,444,1288,443,1290,444,420,443,420,443,420,443,421,443,423,443,9965,3483,1722,443,423,443,1290,442,421,443,420,443,420,443,420,443,422,442,421,442,421,442,420,443,422,442,421,442,424,443,1290,442,422,442,421,442,421,442,421,442,422,442,421,442,425,442,1289,442,1291,442,1291,441,421,442,425,441,1292,442,421,442,421,442,422,441,423,441,422,441,422,441,422,441,422,442,422,441,422,441,422,441,423,441,425,442,1291,442,422,441,422,441,1290,441,1290,441,1291,442,423,441,422,441,426,441,1290,442,1293,441,426,441,1291,440,1292,441,423,441,422,441,423,440,423,440,424,440,423,440,423,440,423,440,423,440,1291,441,1292,441,423,440,425,439,427,440,1292,439,1293,440,425,439,424,439,425,438,449,414,450,414,449,414,449,414,449,414,450,414,449,414,449,414,449,414,450,414,449,414,450,413,449,414,451,414,450,413,453,413,1318,414,1319,413,1319,414,450,413,450,413,451,413,450,413,451,412,450,413,452,412,451,412,454,413,1319,413,1320,413,1320,412,451,412,451,412,453,411,452,411,452,411,452,411,454,410,453,410,453,410,478,385,479,385,478,385,478,385,478,385,479,385,482,385,1347,385,1348,385,480,384,478,385,479,384,479,385,479,384,1348,385,479,384,479,384,481,383,483,384,1349,384,483,383,1349,384,1349,384,483,383,1350,383,481,383,481,382,482,382,481,358,506,358,534,332,1375,358,531,332,531,332,1375,358,535,331,1400,332,1402,332,533,332] +ac_max = [3550,1651,506,387,479,1226,507,384,480,382,481,383,479,384,478,386,478,385,478,385,478,386,477,387,477,387,475,391,475,1257,475,392,472,392,470,393,470,394,469,395,470,394,469,398,469,1263,469,1264,468,1264,469,395,468,398,469,1265,469,394,469,395,468,395,468,396,468,395,468,395,468,395,468,396,468,395,468,395,468,395,468,396,468,395,468,395,468,395,468,396,468,395,468,395,468,395,468,396,469,395,468,395,468,396,467,397,467,396,467,396,467,396,467,397,467,419,444,400,467,1265,467,1267,467,419,444,420,443,396,468,420,444,399,468,9969,3489,1717,443,423,444,1289,444,421,443,420,443,420,443,420,443,421,443,420,443,420,444,420,443,421,444,420,443,423,444,1290,443,421,443,420,444,420,443,420,443,421,444,420,443,424,443,1289,443,1290,443,1290,443,421,442,424,443,1291,443,421,443,420,443,420,443,422,442,421,442,421,442,421,442,422,442,421,442,421,442,421,442,422,443,424,443,1291,442,421,442,421,443,1289,443,1290,442,1291,442,422,442,421,442,421,442,421,442,422,443,421,442,425,442,1291,442,423,442,421,442,421,442,421,442,422,442,422,442,421,442,421,442,422,441,1290,442,1291,442,422,441,423,442,425,441,1290,442,1290,442,1292,442,422,441,422,441,422,441,423,441,422,441,422,441,422,442,424,440,423,440,423,440,423,440,424,440,423,440,423,440,423,440,424,440,424,439,427,440,1292,440,1293,440,1294,439,424,439,425,438,427,438,425,438,450,413,450,413,451,413,451,412,454,413,1319,413,1320,413,1320,413,451,412,451,412,453,412,452,411,452,411,452,412,454,410,479,384,479,384,479,384,480,384,480,383,480,383,480,383,482,382,485,357,1374,383,1350,382,483,357,533,330,534,329,534,329,535,328,1404,329,535,328,561,302,564,300,592,274,1432,301,593,273,1433,301,1459,273,622,216,1489,245] ac_close = [3519,1714,451,417,450,1281,452,414,450,413,450,413,450,414,449,414,450,413,450,412,451,412,451,413,451,412,451,416,475,1256,477,389,475,389,473,392,470,417,445,419,445,419,444,423,443,1288,443,1289,444,1289,444,419,444,423,443,1290,444,420,443,420,443,419,444,421,443,419,444,420,443,420,443,421,443,420,443,420,443,420,443,421,443,420,443,420,443,420,443,421,443,420,443,420,443,420,443,421,443,420,443,421,442,420,443,421,443,421,442,420,443,421,442,422,442,421,442,424,443,1289,442,1292,442,421,442,421,442,421,442,422,442,424,442,9969,3484,1720,440,426,441,1292,440,424,440,423,440,422,441,423,440,424,441,422,441,422,441,422,441,424,441,422,441,426,441,1292,441,424,441,422,441,423,440,423,440,424,440,423,440,426,440,1292,439,1293,440,1293,440,423,440,427,440,1294,439,424,440,424,439,423,440,449,415,448,415,448,415,448,415,449,415,448,415,448,415,425,438,449,415,448,415,448,415,448,415,448,415,1316,415,1317,414,1318,415,450,415,448,415,451,416,1317,415,1319,415,451,416,1292,440,1292,442,422,443,420,444,420,443,419,444,420,444,419,444,419,444,419,444,419,444,1288,444,1288,444,419,444,420,444,422,445,1287,445,1288,445,419,445,418,445,394,470,394,469,395,469,394,469,394,469,393,470,394,471,393,470,393,470,393,470,394,470,393,470,393,470,393,470,394,470,393,470,397,470,1262,469,1263,470,1263,470,394,470,393,470,395,469,394,469,394,469,394,469,395,470,394,469,397,470,1263,469,1264,469,1264,469,394,470,394,469,395,469,394,469,394,469,394,470,395,469,394,469,394,469,395,468,396,469,395,468,395,468,395,468,396,468,422,445,1263,469,1264,469,396,468,396,468,419,444,419,444,395,468,1288,445,419,444,395,468,420,444,422,445,1289,444,423,444,1289,443,1289,444,422,445,1289,444,420,445,419,444,419,444,419,444,420,445,419,444,419,444,419,444,419,444,1289,444,423,444,1288,444,1290,444,421,444] -flipper = PyFlipper(com="/dev/serial/by-id/usb-Flipper_Devices_Inc._Flipper_Helper_flip_Helper-if00") - def reloadWaybar(): system("pkill -RTMIN+6 waybar") @@ -55,26 +54,36 @@ def main(): def on(): writeStatus(status_t.TURNING_ON) - with suppress(Exception): - flipper.ir.tx_raw(frequency=38000, duty_cycle=0.33, samples=ac_open) + # with suppress(Exception): + PyFlipper(com="/dev/serial/by-id/usb-Flipper_Devices_Inc._Helper_flip_Helper-if00").ir.tx_raw(frequency=38000, duty_cycle=0.33, samples=ac_open) + writeStatus(status_t.ON) + return True + +def max(): + writeStatus(status_t.TURNING_ON) + # with suppress(Exception): + PyFlipper(com="/dev/serial/by-id/usb-Flipper_Devices_Inc._Helper_flip_Helper-if00").ir.tx_raw(frequency=38000, duty_cycle=0.33, samples=ac_max) writeStatus(status_t.ON) return True def off(): writeStatus(status_t.TURNING_OFF) - with suppress(Exception): - flipper.ir.tx_raw(frequency=38000, duty_cycle=0.33, samples=ac_close) + # with suppress(Exception): + PyFlipper(com="/dev/serial/by-id/usb-Flipper_Devices_Inc._Helper_flip_Helper-if00").ir.tx_raw(frequency=38000, duty_cycle=0.33, samples=ac_close) writeStatus(status_t.OFF) return False -def statusBool() -> status_t: +def statusRaw() -> status_t: return status_t[getStatusFd().read().strip()] +def statusBool() -> bool: + return statusRaw() == status_t.ON or statusRaw() == status_t.TURNING_ON + def status() -> str: - return statusBool().value + return statusRaw().value def toggle(): - if statusBool() == status_t.ON or statusBool() == status_t.TURNING_ON: + if statusRaw() == status_t.ON or statusRaw() == status_t.TURNING_ON: off() else: # status() == status_t.OFF or status() == status_t.TURNING_OFF: on() diff --git a/hypridle.sh b/hypridle.sh index 20ff623..d2f25d3 100755 --- a/hypridle.sh +++ b/hypridle.sh @@ -11,91 +11,91 @@ XDG_CACHE_HOME=${XDG_CACHE_HOME:-$HOME/.cache} #trap "kill $$" SIGINT # usr-def vars -mutev=true # stop volume/sound(mute) - comment or un-comment +mutev=true # stop volume/sound(mute) - comment or un-comment pmusic=true # stop/start music from playing - command or un-comment function idle() { - /sbin/echo "User is idle(afk) in $(date)" + /sbin/echo "User is idle(afk) in $(date)" - # script -c "$HOME/scripts/update.sh" /var/log/sysupdate.log -a --force - # script -c 'topgrade -y --no-retry' /var/log/sysupdate.log -a --force - # topgrade -y --no-retry & - checkupdates --download & - # killall -STOP hyprpaper.sh - # killall -STOP swww.sh - brillo -O - brillo -S 0 - # turn off debug overlay just in case we forget - hyprctl keyword debug:overlay false - killall -STOP mpvpaper.sh mpvpaper $(pgrep -P $(pgrep mpvpaper.sh)) + # script -c "$HOME/scripts/update.sh" /var/log/sysupdate.log -a --force + # script -c 'topgrade -y --no-retry' /var/log/sysupdate.log -a --force + # topgrade -y --no-retry & + checkupdates --download & + # killall -STOP hyprpaper.sh + # killall -STOP swww.sh + brillo -O + brillo -S 0 + # turn off debug overlay just in case we forget + hyprctl keyword debug:overlay false + killall -STOP mpvpaper.sh mpvpaper $(pgrep -P $(pgrep mpvpaper.sh)) video-guard video-guard-helper - # sleep 30 - if [ $mutev ] && [[ "$(wpctl get-volume @DEFAULT_AUDIO_SINK@)" != *"[MUTED]" ]]; then - wpctl set-mute @DEFAULT_AUDIO_SINK@ 1 - elif [ $mutev ] && [[ "$(wpctl get-volume @DEFAULT_AUDIO_SINK@)" == *"[MUTED]" ]]; then - notify-send "Warning: Volume is already muted" - elif [ $mutev ]; then - notify-send -u critical "Unable to get volume(sound) status: $(wpctl get-volume @DEFAULT_AUDIO_SINK@)" - fi + # sleep 30 + if [ $mutev ] && [[ "$(wpctl get-volume @DEFAULT_AUDIO_SINK@)" != *"[MUTED]" ]]; then + wpctl set-mute @DEFAULT_AUDIO_SINK@ 1 + elif [ $mutev ] && [[ "$(wpctl get-volume @DEFAULT_AUDIO_SINK@)" == *"[MUTED]" ]]; then + notify-send "Warning: Volume is already muted" + elif [ $mutev ]; then + notify-send -u critical "Unable to get volume(sound) status: $(wpctl get-volume @DEFAULT_AUDIO_SINK@)" + fi - if [ $pmusic ]; then - PLAYERS_FILE="$XDG_CACHE_HOME/players" - > "$PLAYERS_FILE" # Clear/create the file - for player in $(playerctl --list-all); do - if [[ $(playerctl -p "$player" status 2>/dev/null) == "Playing" ]]; then - echo "$player" >> "$PLAYERS_FILE" - fi - done - playerctl --all-players pause - fi + if [ $pmusic ]; then + PLAYERS_FILE="$XDG_CACHE_HOME/players" + >"$PLAYERS_FILE" # Clear/create the file + for player in $(playerctl --list-all); do + if [[ $(playerctl -p "$player" status 2>/dev/null) == "Playing" ]]; then + echo "$player" >>"$PLAYERS_FILE" + fi + done + playerctl --all-players pause + fi } function stopidle() { - /sbin/echo "User is back from idle(afk) in $(date)" - #if [ $mutev ] && [ $soundlevel ]; then - # amixer set Master $soundlevel - # unset $soundlevel - #elif [ $mutev ] && [ ! $soundlevel ]; then - # notify-send "ERROR: \$soundlevel is not set, unknown sound level..." - #fi - # killall wallust mpvpaper.sh & $HOME/scripts/mpvpaper.sh & - killall wallust & - killall -CONT mpvpaper.sh mpvpaper $(pgrep -P $(pgrep mpvpaper.sh)) - if [ $mutev ] && [[ $(pactl get-sink-mute @DEFAULT_SINK@) == "Mute: yes" ]]; then - wpctl set-mute @DEFAULT_AUDIO_SINK@ 0 & - # elif [ $mutev ] && [[ $(pactl get-sink-mute @DEFAULT_SINK@) == "Mute: no" ]]; then - # notify-send -e -u critical "ERROR: Volume is not muted" & - # elif [ $mutev ] && [[ ! $(pactl get-sink-mute @DEFAULT_SINK@) == "Mute: no" ]] && [[ ! $(pactl get-sink-mute @DEFAULT_SINK@) == "Mute: yes" ]]; then - # notify-send -e -u critical "Unable to get volume status: $(pactl get-sink-mute @DEFAULT_SINK@)" & - fi - /sbin/killall update.sh yay & - if [ $pmusic ]; then - PLAYERS_FILE="$XDG_CACHE_HOME/players" - if [ -f "$PLAYERS_FILE" ]; then - while IFS= read -r player; do - playerctl -p "$player" play 2>/dev/null - done < "$PLAYERS_FILE" - rm -f "$PLAYERS_FILE" - fi - fi - # killall -CONT hyprpaper.sh || $HOME/scripts/hyprpaper.sh & - # killall -CONT swww.sh || $HOME/scripts/swww.sh & - rm -f $XDG_CACHE_HOME/playing-music - brillo -I - if [[ "$(swaync-client --get-dnd)" == "true" ]]; then - # notify-send -e 'Do not Disturb' 'Do not Disturb is still enabled' - hyprctl notify 2 3000 0 "Do not Disturb is still enabled" - fi + /sbin/echo "User is back from idle(afk) in $(date)" + #if [ $mutev ] && [ $soundlevel ]; then + # amixer set Master $soundlevel + # unset $soundlevel + #elif [ $mutev ] && [ ! $soundlevel ]; then + # notify-send "ERROR: \$soundlevel is not set, unknown sound level..." + #fi + # killall wallust mpvpaper.sh & $HOME/scripts/mpvpaper.sh & + killall wallust & + killall -CONT mpvpaper.sh mpvpaper $(pgrep -P $(pgrep mpvpaper.sh)) video-guard video-guard-helper + if [ $mutev ] && [[ $(pactl get-sink-mute @DEFAULT_SINK@) == "Mute: yes" ]]; then + wpctl set-mute @DEFAULT_AUDIO_SINK@ 0 & + # elif [ $mutev ] && [[ $(pactl get-sink-mute @DEFAULT_SINK@) == "Mute: no" ]]; then + # notify-send -e -u critical "ERROR: Volume is not muted" & + # elif [ $mutev ] && [[ ! $(pactl get-sink-mute @DEFAULT_SINK@) == "Mute: no" ]] && [[ ! $(pactl get-sink-mute @DEFAULT_SINK@) == "Mute: yes" ]]; then + # notify-send -e -u critical "Unable to get volume status: $(pactl get-sink-mute @DEFAULT_SINK@)" & + fi + /sbin/killall update.sh yay & + if [ $pmusic ]; then + PLAYERS_FILE="$XDG_CACHE_HOME/players" + if [ -f "$PLAYERS_FILE" ]; then + while IFS= read -r player; do + playerctl -p "$player" play 2>/dev/null + done <"$PLAYERS_FILE" + rm -f "$PLAYERS_FILE" + fi + fi + # killall -CONT hyprpaper.sh || $HOME/scripts/hyprpaper.sh & + # killall -CONT swww.sh || $HOME/scripts/swww.sh & + rm -f $XDG_CACHE_HOME/playing-music + brillo -I + if [[ "$(swaync-client --get-dnd)" == "true" ]]; then + # notify-send -e 'Do not Disturb' 'Do not Disturb is still enabled' + hyprctl notify 2 3000 0 "Do not Disturb is still enabled" + fi } if [ "$1" ]; then - if [[ "$1" == '--pause' || "$1" == '--idle' ]]; then - idle - exit 0 - elif [[ "$1" == '--continue' || "$1" == '--stopidle' ]]; then - stopidle - exit 0 - fi + if [[ "$1" == '--pause' || "$1" == '--idle' ]]; then + idle + exit 0 + elif [[ "$1" == '--continue' || "$1" == '--stopidle' ]]; then + stopidle + exit 0 + fi fi /sbin/echo -e "Un-recornized option: '$@', Please use options:\n\t-d|--daemon\tTo start daemon(auto idle actions)\n\t--idle|--pause\tTo call \`idle\` function\n\t--continue|--stopidle\tTo call \`stopidle\` function" diff --git a/hyprsunset.sh b/hyprsunset.sh index 47bced8..07a5aa1 100755 --- a/hyprsunset.sh +++ b/hyprsunset.sh @@ -3,8 +3,9 @@ renice -n 19 $$ ionice -c 3 -p $$ -NIGHT_GAMMA=95 -NIGHT_TEMP=6000 +# NIGHT_GAMMA=95 +NIGHT_TEMP=5500 +NORMAL_TEMP=6000 SUNRISE_HOUR=6 SUNSET_HOUR=20 @@ -13,11 +14,12 @@ apply_settings() { if [ $current_hour -ge $SUNRISE_HOUR -a $current_hour -lt $SUNSET_HOUR ]; then echo "Applying day settings" - hyprctl hyprsunset identity + # hyprctl hyprsunset identity + hyprctl hyprsunset temperature $NORMAL_TEMP else echo "Applying night settings" + # hyprctl hyprsunset gamma $NIGHT_GAMMA hyprctl hyprsunset temperature $NIGHT_TEMP - hyprctl hyprsunset gamma $NIGHT_GAMMA fi } @@ -16,134 +16,135 @@ lockfile="idle.lck" pidfile="idle.pid" # usr-def vars -mutev=true # stop volume/sound(mute) - comment or un-comment +mutev=true # stop volume/sound(mute) - comment or un-comment pmusic=true # stop/start music from playing - command or un-comment IDLETIME=1800000 IDLEBACKTIME=100 if [ ! -d $lockpath ]; then - /sbin/echo "Lock path does not exist, creating it" - sudo -n /sbin/mkdir -vp $lockpath || /sbin/echo "Failed to create lock path at $lockpath" + /sbin/echo "Lock path does not exist, creating it" + sudo -n /sbin/mkdir -vp $lockpath || /sbin/echo "Failed to create lock path at $lockpath" fi function cleanup() { - /sbin/echo "Cleaning up..." - sudo -n /sbin/rm -rf $lockpath || /sbin/echo "Failed removing locks at $lockpath" - /sbin/echo "Exiting..." - exit 0 + /sbin/echo "Cleaning up..." + sudo -n /sbin/rm -rf $lockpath || /sbin/echo "Failed removing locks at $lockpath" + /sbin/echo "Exiting..." + exit 0 } trap cleanup SIGINT SIGTERM function idle() { - if [[ -f $lockpath/$disablelockfile ]]; then - /sbin/echo "idle: Idle is disabled" - fi - /sbin/echo "User is idle(afk) in $(date)" - /sbin/echo "Creating lock file" - sudo -n /sbin/touch $lockpath/$lockfile || /sbin/echo "Failed to create lock file at $lockpath/$lockfile" - #if [ $mutev ]; then - # soundlevel=$(awk -F"[][]" '/Left:/ { print $2 }' <(amixer sget Master)) - # amixer set Master 0% - #fi - if [ $mutev ] && [[ $(pactl get-sink-mute @DEFAULT_SINK@) == "Mute: no" ]]; then - amixer set Master mute - elif [ $mutev ] && [[ $(pactl get-sink-mute @DEFAULT_SINK@) == "Mute: yes" ]]; then - notify-send "Warning: Volume is already muted" - elif [ $mutev ] && [[ ! $(pactl get-sink-mute @DEFAULT_SINK@) == "Mute: no" ]] && [[ ! $(pactl get-sink-mute @DEFAULT_SINK@) == "Mute: yes" ]]; then - notify-send -u critical "Unable to get volume(sound) status: $(pactl get-sink-mute @DEFAULT_SINK@)" - fi - # script -c "$HOME/scripts/update.sh" /var/log/sysupdate.log -a --force - script -c 'topgrade -y --no-retry' /var/log/sysupdate.log -a --force + if [[ -f $lockpath/$disablelockfile ]]; then + /sbin/echo "idle: Idle is disabled" + fi + /sbin/echo "User is idle(afk) in $(date)" + /sbin/echo "Creating lock file" + sudo -n /sbin/touch $lockpath/$lockfile || /sbin/echo "Failed to create lock file at $lockpath/$lockfile" + #if [ $mutev ]; then + # soundlevel=$(awk -F"[][]" '/Left:/ { print $2 }' <(amixer sget Master)) + # amixer set Master 0% + #fi + if [ $mutev ] && [[ $(pactl get-sink-mute @DEFAULT_SINK@) == "Mute: no" ]]; then + amixer set Master mute + elif [ $mutev ] && [[ $(pactl get-sink-mute @DEFAULT_SINK@) == "Mute: yes" ]]; then + notify-send "Warning: Volume is already muted" + elif [ $mutev ] && [[ ! $(pactl get-sink-mute @DEFAULT_SINK@) == "Mute: no" ]] && [[ ! $(pactl get-sink-mute @DEFAULT_SINK@) == "Mute: yes" ]]; then + notify-send -u critical "Unable to get volume(sound) status: $(pactl get-sink-mute @DEFAULT_SINK@)" + fi + # script -c "$HOME/scripts/update.sh" /var/log/sysupdate.log -a --force + script -c 'topgrade -y --no-retry' /var/log/sysupdate.log -a --force - if [ $pmusic ]; then - if [[ $(playerctl status -p spotify) == "Playing" ]]; then - m=true - fi - fi - if [ $pmusic ]; then - playerctl --all-players pause - fi - # re-cache neofetch - # script -c "$HOME/scripts/neofetchCache.sh" "$HOME"/scripts/logs/neofetchCache.log -a --force - # clean clipboard history - # script -c "$HOME/scripts/clearcliphis.sh" "$HOME"/scripts/logs/clearcliphis.log -a --force - #/sbin/killall picom; bspcomp & # paused in freezeapp and unfreezeapp - # Disable mouse just in case accidental awake for high DPI rate mouse - # xinput --disable 12 - freezeapp & + if [ $pmusic ]; then + if [[ $(playerctl status -p spotify) == "Playing" ]]; then + m=true + fi + fi + if [ $pmusic ]; then + playerctl --all-players pause + fi + # re-cache neofetch + # script -c "$HOME/scripts/neofetchCache.sh" "$HOME"/scripts/logs/neofetchCache.log -a --force + # clean clipboard history + # script -c "$HOME/scripts/clearcliphis.sh" "$HOME"/scripts/logs/clearcliphis.log -a --force + #/sbin/killall picom; bspcomp & # paused in freezeapp and unfreezeapp + # Disable mouse just in case accidental awake for high DPI rate mouse + # xinput --disable 12 + freezeapp & } function stopidle() { - if [[ -f $lockpath/$disablelockfile ]]; then - /sbin/echo "stopidle: Idle is disabled" - fi - /sbin/echo "User is back from idle(afk) in $(date)" - #if [ $mutev ] && [ $soundlevel ]; then - # amixer set Master $soundlevel - # unset $soundlevel - #elif [ $mutev ] && [ ! $soundlevel ]; then - # notify-send "ERROR: \$soundlevel is not set, unknown sound level..." - #fi - # Re-enable mouse - xinput --enable 12 & - if [ $mutev ] && [[ $(pactl get-sink-mute @DEFAULT_SINK@) == "Mute: yes" ]]; then - amixer set Master unmute & - elif [ $mutev ] && [[ $(pactl get-sink-mute @DEFAULT_SINK@) == "Mute: no" ]]; then - notify-send -u critical "ERROR: Volume(sound) is not muted" & - elif [ $mutev ] && [[ ! $(pactl get-sink-mute @DEFAULT_SINK@) == "Mute: no" ]] && [[ ! $(pactl get-sink-mute @DEFAULT_SINK@) == "Mute: yes" ]]; then - notify-send -u critical "Unable to get volume(sound) status: $(pactl get-sink-mute @DEFAULT_SINK@)" & - fi - /sbin/killall update.sh yay & - unfreezeapp & - if [ $pmusic ] && [ "$m" ]; then - playerctl play -p spotify - unset m - fi - /sbin/echo "Removing lock file" - sudo -n /sbin/rm -f $lockpath/$lockfile || /sbin/echo "Failed removing lock file at $lockpath/$lockfile" + if [[ -f $lockpath/$disablelockfile ]]; then + /sbin/echo "stopidle: Idle is disabled" + fi + /sbin/echo "User is back from idle(afk) in $(date)" + #if [ $mutev ] && [ $soundlevel ]; then + # amixer set Master $soundlevel + # unset $soundlevel + #elif [ $mutev ] && [ ! $soundlevel ]; then + # notify-send "ERROR: \$soundlevel is not set, unknown sound level..." + #fi + # Re-enable mouse + $HOME/scripts/flipper-ac.py on & + xinput --enable 12 & + if [ $mutev ] && [[ $(pactl get-sink-mute @DEFAULT_SINK@) == "Mute: yes" ]]; then + amixer set Master unmute & + elif [ $mutev ] && [[ $(pactl get-sink-mute @DEFAULT_SINK@) == "Mute: no" ]]; then + notify-send -u critical "ERROR: Volume(sound) is not muted" & + elif [ $mutev ] && [[ ! $(pactl get-sink-mute @DEFAULT_SINK@) == "Mute: no" ]] && [[ ! $(pactl get-sink-mute @DEFAULT_SINK@) == "Mute: yes" ]]; then + notify-send -u critical "Unable to get volume(sound) status: $(pactl get-sink-mute @DEFAULT_SINK@)" & + fi + /sbin/killall update.sh yay & + unfreezeapp & + if [ $pmusic ] && [ "$m" ]; then + playerctl play -p spotify + unset m + fi + /sbin/echo "Removing lock file" + sudo -n /sbin/rm -f $lockpath/$lockfile || /sbin/echo "Failed removing lock file at $lockpath/$lockfile" } if [ "$1" ]; then - if [[ "$1" == '-d' || "$1" == '--daemon' ]]; then - if ! pgrep "$0"; then - /sbin/echo -n "PID: " - /sbin/echo $$ | sudo -n /sbin/tee $lockpath/$pidfile || echo "PID Grab failed" - else - /sbin/echo "An instance of this program is dectected, please close that instance in order to launch another" - fi - while true; do - if [[ "$(systemctl is-system-running)" == "running" || "$(systemctl is-system-running)" == "degraded" ]]; then - if [[ "$(xprintidle)" -gt $IDLETIME && ! -f $lockpath/$lockfile && $1 ]]; then # Changed from 600000 (10 minutes) to 3600000 (1 hour) - idle - continue - elif [[ ! -f $lockpath/$lockfile && $1 ]]; then - sleep 10 - continue - fi - if [[ "$(xprintidle)" -le $IDLEBACKTIME && -f $lockpath/$lockfile ]]; then - stopidle - continue - else - continue - fi - fi - done - elif [[ "$1" == '--pause' || "$1" == '--idle' ]]; then - #/sbin/kill -s 3 $(/sbin/cat $lockpath/$pidfile) - idle - exit 0 - elif [[ "$1" == '--continue' || "$1" == '--stopidle' ]]; then - #/sbin/kill -s 4 $(/sbin/cat $lockpath/$pidfile) - sudo -n /sbin/touch $lockpath/$lockfile - exit 0 - elif [[ "$1" == '--disable' || "$1" == '-dis' ]]; then - sudo -n /sbin/touch $lockpath/$disablelockfile - exit 0 - elif [[ "$1" == '--enable' || "$1" == '-en' ]]; then - sudo -n /sbin/rm -f $lockpath/$disablelockfile - exit 0 - fi + if [[ "$1" == '-d' || "$1" == '--daemon' ]]; then + if ! pgrep "$0"; then + /sbin/echo -n "PID: " + /sbin/echo $$ | sudo -n /sbin/tee $lockpath/$pidfile || echo "PID Grab failed" + else + /sbin/echo "An instance of this program is dectected, please close that instance in order to launch another" + fi + while true; do + if [[ "$(systemctl is-system-running)" == "running" || "$(systemctl is-system-running)" == "degraded" ]]; then + if [[ "$(xprintidle)" -gt $IDLETIME && ! -f $lockpath/$lockfile && $1 ]]; then # Changed from 600000 (10 minutes) to 3600000 (1 hour) + idle + continue + elif [[ ! -f $lockpath/$lockfile && $1 ]]; then + sleep 10 + continue + fi + if [[ "$(xprintidle)" -le $IDLEBACKTIME && -f $lockpath/$lockfile ]]; then + stopidle + continue + else + continue + fi + fi + done + elif [[ "$1" == '--pause' || "$1" == '--idle' ]]; then + #/sbin/kill -s 3 $(/sbin/cat $lockpath/$pidfile) + idle + exit 0 + elif [[ "$1" == '--continue' || "$1" == '--stopidle' ]]; then + #/sbin/kill -s 4 $(/sbin/cat $lockpath/$pidfile) + sudo -n /sbin/touch $lockpath/$lockfile + exit 0 + elif [[ "$1" == '--disable' || "$1" == '-dis' ]]; then + sudo -n /sbin/touch $lockpath/$disablelockfile + exit 0 + elif [[ "$1" == '--enable' || "$1" == '-en' ]]; then + sudo -n /sbin/rm -f $lockpath/$disablelockfile + exit 0 + fi fi /sbin/echo -e "Un-recornized option: '$@', Please use options:\n\t-d|--daemon\tTo start daemon(auto idle actions)\n\t--idle|--pause\tTo call \`idle\` function\n\t--continue|--stopidle\tTo call \`stopidle\` function" @@ -3,62 +3,63 @@ XDG_CACHE_HOME=${XDG_CACHE_HOME:-$HOME/.cache} function prepsound() { - tDIR=$XDG_CACHE_HOME/stoggle + tDIR=$XDG_CACHE_HOME/stoggle - if [ ! -d $tDIR ]; then - mkdir -p $tDIR || exit 1 - fi - sDIR=/usr/share/sounds/freedesktop/stereo + if [ ! -d $tDIR ]; then + mkdir -p $tDIR || exit 1 + fi + sDIR=/usr/share/sounds/freedesktop/stereo } function playSound() { - if [ ! $sDIR ]; then - echo Warning: Sound directory not set, setting to default - prepsound - fi - pw-play $sDIR/$1 || paplay $sDIR/$1 + if [ ! $sDIR ]; then + echo Warning: Sound directory not set, setting to default + prepsound + fi + pw-play $sDIR/$1 || paplay $sDIR/$1 } function getSound() { - prepsound - if [ -f $tDIR/$1 ]; then - return 1 - else - return 0 - fi + prepsound + if [ -f $tDIR/$1 ]; then + return 1 + else + return 0 + fi } function setSound() { - prepsound + prepsound - if [ ! -d $sDIR ]; then - mkdir -p $sDIR || exit 1 - fi - if [ -f $sDIR/$1 ]; then - rm $sDIR/$1 - else - touch $sDIR/$1 - fi + if [ ! -d $sDIR ]; then + mkdir -p $sDIR || exit 1 + fi + if [ -f $sDIR/$1 ]; then + rm $sDIR/$1 + else + touch $sDIR/$1 + fi } # if $(getSound screenshot); then - # echo "Screenshot sound is enabled" +# echo "Screenshot sound is enabled" # else - # echo "Screenshot sound is disabled" +# echo "Screenshot sound is disabled" # fi function screenshot() { - $HOME/scripts/hyprshot $@ + $HOME/scripts/hyprshot $@ } function volume() { - $HOME/scripts/hyprvol $@ + $HOME/scripts/hyprvol $@ } function brightness() { - $HOME/scripts/hyprbri $@ + # $HOME/scripts/hyprbri $@ + $HOME/scripts/ddcutil-client.sh $@ } if [ "$1" ]; then - $@ + $@ fi diff --git a/walls/hyprlax.sh b/walls/hyprlax.sh new file mode 100755 index 0000000..6065f00 --- /dev/null +++ b/walls/hyprlax.sh @@ -0,0 +1,57 @@ +#!/bin/bash + +XDG_PICTURES_DIR="${XDG_PICTURES_DIR:-$HOME/Pictures}" +XDG_CACHE_HOME="${XDG_CACHE_HOME:-$HOME/.cache}" +XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}" +WALLPAPERS="$XDG_PICTURES_DIR/wallpapers/" + +# colors +RED='\033[0;31m' +GREEN='\033[0;32m' +NC='\033[0m' + +DELAY=1800 + +while true; do + wallpappath=$(find "$WALLPAPERS" | shuf -n 1) + if ! [ $current_bg ]; then + echo -e "${RED}current.bg not set, setting it to $wallpappath${NC}" + echo $wallpappath > $XDG_CACHE_HOME/current.bg + echo -e "${GREEN}Regenerating wallpappath${NC}" + wallpappath=$(find "$WALLPAPERS" | shuf -n 1) + fi + current_bg="$(cat $XDG_CACHE_HOME/current.bg)" + + # wallust run --skip-sequences $(cat $XDG_CACHE_HOME/current.bg) + # wallust run --backend kmeans --skip-sequences $(cat $XDG_CACHE_HOME/current.bg) & # using cache now + (hyprlax ctl clear && hyprlax ctl add $current_bg) || hyprlax $current_bg --config $XDG_CONFIG_HOME/hyprlax/hyprlax.toml + # if hyprlax-ctl clear; then + # hyprlax-ctl add $current_bg + # else + # hyprlax --layer $current_bg --config $XDG_CONFIG_HOME/hyprlax/parallax.conf + # fi + + wallust run --backend full --skip-sequences $(cat $XDG_CACHE_HOME/current.bg) & + # (sleep 0.1; pgrep -f wallust && wallust run --backend kmeans --skip-sequences $(cat $XDG_CACHE_HOME/current.bg)) & + + # tell hypr* where is bg + echo "\$bg = $current_bg" > "$XDG_CONFIG_HOME/hypr/bg.conf" + + # reload hyprland + hyprctl reload config-only & + + swaync-client --reload-css + + # gdbus call --session --dest com.mitchellh.ghostty --object-path /com/mitchellh/ghostty --method org.gtk.Actions.Activate reload-config [] [] & + # kitten @ action load_config_file + # kitty @ set-colors --all --configured ~/.config/kitty/colors.conf + killall -SIGUSR1 kitty + + echo $wallpappath > $XDG_CACHE_HOME/current.bg + # update hyprlock + killall -SIGUSR2 hyprlock + + nice -n 20 wallust run --backend full --skip-templates --skip-sequences $wallpappath + + sleep $DELAY +done diff --git a/walls/swww.sh b/walls/swww.sh index c5022a4..29d00d7 100755 --- a/walls/swww.sh +++ b/walls/swww.sh @@ -27,7 +27,7 @@ while true; do # wallust run --skip-sequences $(cat $XDG_CACHE_HOME/current.bg) # wallust run --backend kmeans --skip-sequences $(cat $XDG_CACHE_HOME/current.bg) & # using cache now swww img $current_bg $swwwarg - wallust run --backend full --skip-sequences $(cat $XDG_CACHE_HOME/current.bg) & + wallust run --backend full --skip-sequences $(cat $XDG_CACHE_HOME/current.bg) # (sleep 0.1; pgrep -f wallust && wallust run --backend kmeans --skip-sequences $(cat $XDG_CACHE_HOME/current.bg)) & # tell hypr* where is bg @@ -36,6 +36,10 @@ while true; do # reload hyprland hyprctl reload config-only & + # reload hx + pkill -USR1 hx + pkill -USR1 kitty + swaync-client --reload-css # gdbus call --session --dest com.mitchellh.ghostty --object-path /com/mitchellh/ghostty --method org.gtk.Actions.Activate reload-config [] [] & |
