summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2024-05-18 19:10:00 +0800
committerlittleblack111 <littleblack11111@gmail.com>2024-05-18 19:10:00 +0800
commit865961a698ba0cce4943cf08d03d0017048cd67e (patch)
tree0710fd8fa3f865ebe772ac6d7b87b23a57ca3ad2
parentc0bad17912fe48e0b8719f8c42e9193a0bc6f71f (diff)
updates
-rwxr-xr-xidle.sh49
-rw-r--r--logs/wallpapertrans.log37
-rwxr-xr-xpolybar-temp-autofix.sh14
-rwxr-xr-xrunsharewifi.sh3
-rwxr-xr-xupdate.sh2
5 files changed, 83 insertions, 22 deletions
diff --git a/idle.sh b/idle.sh
index 2d301bf..cb72a7e 100755
--- a/idle.sh
+++ b/idle.sh
@@ -6,7 +6,9 @@
#trap "kill $$" SIGINT
# sys vars
-lockpath="/tmp/lock"
+tmplockpath="/var/lock"
+lockname="idle"
+lockpath="$tmplockpath/$lockname"
lockfile="idle.lck"
pidfile="idle.pid"
@@ -16,9 +18,18 @@ 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 /sbin/mkdir -vp $lockpath || /sbin/echo "Failed to create lock path at $lockpath"
+fi
+
function idle() {
+ if [[ -f $lockpath/$disablelockfile ]]; then
+ /sbin/echo "idle: Idle is disabled"
+ fi
printf "User is idle(afk) in %s\n" "$(date)"
- sudo /sbin/touch $lockpath/$lockfile
+ /sbin/echo "Creating lock file"
+ sudo /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%
@@ -38,16 +49,19 @@ function idle() {
NekoMC --pause &
fi
# re-cache neofetch
- script -c "$HOME/scripts/neofetchCache.sh" "$HOME"/scripts/logs/neofetchCache.log -a --force
+ # 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
+ # 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 &
+ # freezeapp &
}
function stopidle() {
+ if [[ -f $lockpath/$disablelockfile ]]; then
+ /sbin/echo "stopidle: Idle is disabled"
+ fi
printf "User is back from idle(afk) in %s\n", "$(date)"
#if [ $mutev ] && [ $soundlevel ]; then
# amixer set Master $soundlevel
@@ -56,28 +70,29 @@ function stopidle() {
# notify-send "ERROR: \$soundlevel is not set, unknown sound level..."
#fi
# Re-enable mouse
- xinput --enable 12
+ xinput --enable 12 &
if [ $mutev ] && [[ $(pactl get-sink-mute @DEFAULT_SINK@) == "Mute: yes" ]]; then
- amixer set Master unmute
+ 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"
+ 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@)"
+ notify-send -u critical "Unable to get volume(sound) status: $(pactl get-sink-mute @DEFAULT_SINK@)" &
fi
- /sbin/killall update.sh yay
- unfreezeapp &
+ /sbin/killall update.sh yay &
+ # unfreezeapp &
if [ $pmusic ] && [ "$m" ]; then
NekoMC --play &
unset m
fi
- sudo /sbin/rm -f $lockpath/$lockfile
+ /sbin/echo "Removing lock file"
+ sudo /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/printf "PID: "
- /sbin/echo $$ | sudo /sbin/tee $lockpath/$pidfile
+ /sbin/echo $$ | sudo /sbin/tee $lockpath/$pidfile || echo "PID Grab failed"
else
/sbin/printf "An instance of this program is dectected, please close that instance in order to launch another\n"
fi
@@ -101,7 +116,13 @@ if [ "$1" ]; then
exit 0
elif [[ "$1" == '--continue' || "$1" == '--stopidle' ]]; then
#/sbin/kill -s 4 $(/sbin/cat $lockpath/$pidfile)
- stopidle
+ sudo /sbin/touch $lockpath/$lockfile
+ exit 0
+ elif [[ "$1" == '--disable' || "$1" == '-dis' ]]; then
+ sudo /sbin/touch $lockpath/$disablelockfile
+ exit 0
+ elif [[ "$1" == '--enable' || "$1" == '-en' ]]; then
+ sudo /sbin/rm -f $lockpath/$disablelockfile
exit 0
fi
fi
diff --git a/logs/wallpapertrans.log b/logs/wallpapertrans.log
index ececbaa..e47c15d 100644
--- a/logs/wallpapertrans.log
+++ b/logs/wallpapertrans.log
@@ -11029,3 +11029,40 @@ See 'feh --help' or 'man feh' for detailed usage information
0
脚本完成于 2023-08-14 16:13:21+08:00 [COMMAND_EXIT_CODE="0"]
+Script started on 2024-05-18 18:57:50+08:00 [COMMAND="/home/system/scripts/wallpapertrans.sh" <not executed on terminal>]
+feh WARNING: /tmp/transition1.jpg does not exist - skipping
+feh: No loadable images specified.
+See 'feh --help' or 'man feh' for detailed usage information
+feh WARNING: /tmp/transition2.jpg does not exist - skipping
+feh: No loadable images specified.
+See 'feh --help' or 'man feh' for detailed usage information
+feh WARNING: /tmp/transition3.jpg does not exist - skipping
+feh: No loadable images specified.
+See 'feh --help' or 'man feh' for detailed usage information
+feh WARNING: /tmp/transition4.jpg does not exist - skipping
+feh: No loadable images specified.
+See 'feh --help' or 'man feh' for detailed usage information
+feh WARNING: /tmp/transition5.jpg does not exist - skipping
+feh: No loadable images specified.
+See 'feh --help' or 'man feh' for detailed usage information
+feh WARNING: /tmp/transition6.jpg does not exist - skipping
+feh: No loadable images specified.
+See 'feh --help' or 'man feh' for detailed usage information
+feh WARNING: /tmp/transition7.jpg does not exist - skipping
+feh: No loadable images specified.
+See 'feh --help' or 'man feh' for detailed usage information
+feh WARNING: /tmp/transition8.jpg does not exist - skipping
+feh: No loadable images specified.
+See 'feh --help' or 'man feh' for detailed usage information
+feh WARNING: /tmp/transition9.jpg does not exist - skipping
+feh: No loadable images specified.
+See 'feh --help' or 'man feh' for detailed usage information
+feh WARNING: /tmp/transition10.jpg does not exist - skipping
+feh: No loadable images specified.
+See 'feh --help' or 'man feh' for detailed usage information
+feh WARNING: /tmp/transition11.jpg does not exist - skipping
+feh: No loadable images specified.
+See 'feh --help' or 'man feh' for detailed usage information
+rm: cannot remove '/tmp/transition*.jpg': No such file or directory
+
+Script done on 2024-05-18 18:57:51+08:00 [COMMAND_EXIT_CODE="0"]
diff --git a/polybar-temp-autofix.sh b/polybar-temp-autofix.sh
index e18a77a..e34a20d 100755
--- a/polybar-temp-autofix.sh
+++ b/polybar-temp-autofix.sh
@@ -1,13 +1,13 @@
#!/usr/bin/bash
-if [[ -e /sys/devices/platform/coretemp.0/hwmon/hwmon3 && $(grep -i "hwmon-path = /sys/devices/platform/coretemp.0/hwmon/hwmon4/temp1_input" /home/system/.config/polybar/modules.ini) ]]; then
- printf "fixing hwmon4 to hwmon3\n"
- sed -i 's#hwmon-path = /sys/devices/platform/coretemp.0/hwmon/hwmon4/temp1_input#hwmon-path = /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp1_input#g' /home/system/.config/polybar/modules.ini
+if [[ -e /sys/devices/platform/coretemp.0/hwmon/hwmon5 && $(grep -i "hwmon-path = /sys/devices/platform/coretemp.0/hwmon/hwmon4/temp1_input" /home/system/.config/polybar/modules.ini) ]]; then
+ printf "fixing hwmon4 to hwmon5\n"
+ sed -i 's#hwmon-path = /sys/devices/platform/coretemp.0/hwmon/hwmon4/temp1_input#hwmon-path = /sys/devices/platform/coretemp.0/hwmon/hwmon5/temp1_input#g' /home/system/.config/polybar/modules.ini
exit 0
-elif [[ -e /sys/devices/platform/coretemp.0/hwmon/hwmon4 && $(grep -i "hwmon-path = /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp1_input" /home/system/.config/polybar/modules.ini) ]]; then
- printf "fixing hwmon3 to hwmon4\n"
- sed -i 's#hwmon-path = /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp1_input#hwmon-path = /sys/devices/platform/coretemp.0/hwmon/hwmon4/temp1_input#g' /home/system/.config/polybar/modules.ini
+elif [[ -e /sys/devices/platform/coretemp.0/hwmon/hwmon4 && $(grep -i "hwmon-path = /sys/devices/platform/coretemp.0/hwmon/hwmon5/temp1_input" /home/system/.config/polybar/modules.ini) ]]; then
+ printf "fixing hwmon5 to hwmon4\n"
+ sed -i 's#hwmon-path = /sys/devices/platform/coretemp.0/hwmon/hwmon5/temp1_input#hwmon-path = /sys/devices/platform/coretemp.0/hwmon/hwmon4/temp1_input#g' /home/system/.config/polybar/modules.ini
exit 0
-elif [[ -e /sys/devices/platform/coretemp.0/hwmon/hwmon3 && $(grep -i "hwmon-path = /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp1_input" /home/system/.config/polybar/modules.ini) || -e /sys/devices/platform/coretemp.0/hwmon/hwmon4 && $(grep -i "hwmon-path = /sys/devices/platform/coretemp.0/hwmon/hwmon4/temp1_input" /home/system/.config/polybar/modules.ini) ]]; then
+elif [[ -e /sys/devices/platform/coretemp.0/hwmon/hwmon5 && $(grep -i "hwmon-path = /sys/devices/platform/coretemp.0/hwmon/hwmon5/temp1_input" /home/system/.config/polybar/modules.ini) || -e /sys/devices/platform/coretemp.0/hwmon/hwmon4 && $(grep -i "hwmon-path = /sys/devices/platform/coretemp.0/hwmon/hwmon4/temp1_input" /home/system/.config/polybar/modules.ini) ]]; then
printf "Nothing left to fix\n"
exit 0
else
diff --git a/runsharewifi.sh b/runsharewifi.sh
new file mode 100755
index 0000000..67c54fb
--- /dev/null
+++ b/runsharewifi.sh
@@ -0,0 +1,3 @@
+#!/usr/bin/bash
+
+script -c "sudo /home/system/.local/bin/openwifipass -s Jhome-Guest -k 12345677Jj" $HOME/scripts/logs/openwifipass.log &
diff --git a/update.sh b/update.sh
index 7d6a7ba..74312fd 100755
--- a/update.sh
+++ b/update.sh
@@ -10,5 +10,5 @@ if [ -f /var/lib/pacman/db.lck ]; then
fi
fi
-tldr --update & sudo npm update -g & nix-env -u & /usr/local/linuxbrew/bin/brew update & blck=$! & yay -Sl > /tmp/yaySl & yay -Ss > /tmp/yaySs & yay --noconfirm --disable-download-timeout & wait $blck && /usr/local/linuxbrew/bin/brew upgrade || sudo /sbin/touch /tmp/lock/updatefail.lock # notify-send -u critical "Auto-Updater" "Update Faild!" # pipx upgrade-all
+tldr --update & sudo npm update -g & nix-env -u & /usr/local/linuxbrew/bin/brew update & blck=$! & yay -Sl > /tmp/yaySl & yay -Ss > /tmp/yaySs & yay --noconfirm --disable-download-timeout & wait $blck && /opt/homebrew/bin/brew upgrade || sudo /sbin/touch /tmp/lock/updatefail.lock # notify-send -u critical "Auto-Updater" "Update Faild!" # pipx upgrade-all
#notify-send "Auto-Updater" "Update in progress, please don't poweroff the computer" && sudo npm update -g & nix-env -u & /usr/local/linuxbrew/bin/brew update & /usr/local/linuxbrew/bin/brew upgrade & yay -Sl > /tmp/yaySl & yay -Ss > /tmp/yaySs & yay -Syu --noconfirm --disable-download-timeout && notify-send -u low "Auto-Updater" "Update Successfully!" || notify-send -u critical "Auto-Updater" "Update Faild!" # pipx upgrade-all