gmenu2x searches opks in /mnt/*/*opk; launcher now stored in /mnt/FunKey/Launchers/launcher.txt

This commit is contained in:
Vincent-FK
2021-01-11 12:07:40 +01:00
parent a77c5e67d9
commit 8a62ff605e
12 changed files with 72 additions and 45 deletions

View File

@@ -12,19 +12,20 @@ fi
# Lock file (necessary since fbgrab must run in bg not to block the buttons while gaming)
LOCK_FILE="/var/lock/snap.lock"
if [ -f "${LOCK_FILE}" ]; then
#echo "${LOCK_FILE} already exists"
echo "${LOCK_FILE} already exists"
exit 1
fi
touch "${LOCK_FILE}"
# Increment name and save snapshot
SNAPSHOT_DIR=/mnt/funkey/snapshots
SNAPSHOT_EXT=PNG
SNAPSHOT_DIR=$HOME/snapshots
mkdir -p "${SNAPSHOT_DIR}"
last=$(cd ${SNAPSHOT_DIR}; ls IMG_*.PNG 2> /dev/null | tail -1 | sed 's/^IMG_0*\([0-9]\+\)\.PNG$/\1/')
last=$(cd ${SNAPSHOT_DIR}; ls IMG_*.${SNAPSHOT_EXT} 2> /dev/null | tail -1 | sed 's/^IMG_0*\([0-9]\+\)\.'${SNAPSHOT_EXT}'$/\1/')
let last=${last}+1
snapshot_file=$(printf "IMG_%04d.PNG" $last)
notif_set 2 " NEW SCREEENSHOT ${snapshot_file}"
fbgrab "${SNAPSHOT_DIR}/${snapshot_file}" &
snapshot_file=$(printf "IMG_%04d.${SNAPSHOT_EXT}" $last)
notif_set 2 " SCREEENSHOT ${snapshot_file}"
fbgrab "${SNAPSHOT_DIR}/${snapshot_file}" >/dev/null 2>&1 &
# Remove lock file
rm -f "${LOCK_FILE}"

View File

@@ -20,16 +20,21 @@ while true; do
if [ ${perform} -eq 1 ]; then
# Compute stats
cpu=$(printf "%.1f\n" $(mpstat -P ALL $UPDATE_PERIOD 1 | tail -1 | awk '{print 100-$12}'))
ram_mem=$(printf "%.1f\n" $(free | grep Mem | awk '{print $3/$2 * 100.0}'))
ram_swap=$(printf "%.1f\n" $(free | grep Swap | awk '{print $3/$2 * 100.0}'))
cpu=$(printf "%.0f\n" $(mpstat -P ALL $UPDATE_PERIOD 1 | tail -1 | awk '{print 100-$12}'))
ram_mem=$(printf "%.0f\n" $(free | grep Mem | awk '{print $3/$2 * 100.0}'))
ram_swap=$(printf "%.0f\n" $(free | grep Swap | awk '{print $3/$2 * 100.0}'))
ip_addr=$(ifconfig usb0 | grep "inet " | awk -F'[: ]+' '{ print $4 }')
# Notif
if [ ${notif_dirty} -eq 1 ]; then
notif_clear
notif_dirty=0
else
notif_set 0 "CPU:${cpu}%% RAM:${ram_mem}%% SWAP:${ram_swap}%%"
if [ "x${ip_addr}" != "x" ]; then
notif_set 0 " CPU:${cpu}%% RAM:${ram_mem}%% SWAP:${ram_swap}%%^IP:${ip_addr}"
else
notif_set 0 " CPU:${cpu}%% RAM:${ram_mem}%% SWAP:${ram_swap}%%"
fi
fi
else
sleep ${UPDATE_PERIOD}