View Single Post
Old 06-05-2024, 03:41 PM   #1357
mullse01
Member
mullse01 began at the beginning.
 
Posts: 10
Karma: 10
Join Date: May 2024
Device: Kindle PW 3, Kobo Clara BW
Quote:
Originally Posted by hatuluang View Post
Yes, you are right the light level doesn't change between two stages, unfortunately.
I know I'm late to the party, but i found a solution to solve this issue: I've added a chain_always command after the dark mode toggle that runs a shell script:
Quote:
menu_item : reader : Toggle Dark Mode : nickel_setting : toggle : dark_mode
chain_always : cmd_spawn : quiet : exec /mnt/onboard/.adds/misc/DarkModeHelper.sh
And here's the script:

Quote:
#!/bin/sh

KOBO_CONF="/mnt/onboard/.kobo/Kobo/Kobo eReader.conf"

if grep '^DarkMode=true' "$KOBO_CONF"; then
ioctl /dev/ntx_io 241 -v 1
sed 's/^FrontLightLevel=.*/FrontLightLevel=1/g' <"$KOBO_CONF" >"$KOBO_CONF".tmp && mv "$KOBO_CONF".tmp "$KOBO_CONF"

elif grep '^DarkMode=false' "$KOBO_CONF"; then
ioctl /dev/ntx_io 241 -v 5
sed 's/^FrontLightLevel=.*/FrontLightLevel=5/g' <"$KOBO_CONF" >"$KOBO_CONF".tmp && mv "$KOBO_CONF".tmp "$KOBO_CONF"

fi
This way, every time you toggle Dark Mode, there is a check to determine whether dark mode has been turned on or off ; it then changes the level accordingly in ioctl AND in "Kobo eReader.conf", so that the level changes persist across reboots.
mullse01 is offline   Reply With Quote