Thread: Clara HD Display time when reading
View Single Post
Old 10-31-2018, 09:04 AM   #58
jackie_w
Grand Sorcerer
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 6,252
Karma: 16544692
Join Date: Sep 2009
Location: UK
Device: ClaraHD, Forma, Libra2, Clara2E, LibraCol, PBTouchHD3
Miniclock and NightMode hacks playing nicely together

With a lot of help from NiLuJe we finally got this working. I'm going to document it here in case anyone else is interested.

Method A: Miniclock's foreground/background colours automatically match those currently being used by the rest of the screen.
  1. In the NightMode config file (.kobo/nightmode.ini) you must enable the retainStateOverRestart option in the [state] section
    Code:
    [state]
    retainStateOverRestart = yes	# yes / no
    This is necessary so that the Miniclock hack will be able to tell whether your Kobo is currently displaying white-on-black or black-on-white.
  2. In the Miniclock config file (.addons/Miniclock/miniclock.cfg) leave the foreground/background colours at default
    Code:
    fg_color=BLACK
    bg_color=WHITE
  3. Using the code below, customise the file usr/local/miniClock/miniclock.sh and replace it in KoboRoot.tgz

    Manually change the default code
    Spoiler:
    Code:
    update() {
        sleep 0.1
        fbink -X "$cfg_offset_x" -Y "$cfg_offset_y" -F "$cfg_font" -S "$cfg_size" \
              -C "$cfg_fg_color" -B "$cfg_bg_color" \
              "$(date +"$cfg_format")"
    }

    to this
    Spoiler:
    Code:
    update() {
        sleep 0.1
        if grep -q "invertActive\s*=\s*yes" "/mnt/onboard/.kobo/nightmode.ini" ; then
            fbink -h -X "$cfg_offset_x" -Y "$cfg_offset_y" -F "$cfg_font" -S "$cfg_size" \
              -C "$cfg_fg_color" -B "$cfg_bg_color" \
              "$(date +"$cfg_format")"
        else
            fbink -X "$cfg_offset_x" -Y "$cfg_offset_y" -F "$cfg_font" -S "$cfg_size" \
              -C "$cfg_fg_color" -B "$cfg_bg_color" \
              "$(date +"$cfg_format")"
        fi
    }

  4. Reinstall the Miniclock hack using the newly customised KoboRoot.tgz. I think this will automatically cause a full reboot, which is necessary for the NightMode hack to detect the change made in step 1.

I also offer this as a slight variation ...

Method B: Miniclock will always display its time/date text in a more muted mid-grey. Its background will automatically match that currently being used by the rest of the screen.
  1. Same as Method A
  2. Same as Method A, but choose one of the mid-greys for foreground color, e.g.
    Code:
    fg_color=GRAY7
  3. Same as Method A, but use this as the replacement code instead
    Spoiler:
    Code:
    update() {
        sleep 0.1
        if grep -q "invertActive\s*=\s*yes" "/mnt/onboard/.kobo/nightmode.ini" ; then
            fbink -X "$cfg_offset_x" -Y "$cfg_offset_y" -F "$cfg_font" -S "$cfg_size" \
              -C "$cfg_fg_color" -B "BLACK" \
              "$(date +"$cfg_format")"
        else
            fbink -X "$cfg_offset_x" -Y "$cfg_offset_y" -F "$cfg_font" -S "$cfg_size" \
              -C "$cfg_fg_color" -B "WHITE" \
              "$(date +"$cfg_format")"
        fi
    }
  4. Same as Method A


And finally ... I think Methods A and B could probably be combined to auto-detect what the user wanted based on the config's fg_color setting. However, as my shell scripting skills are practically non-existent, I'll leave that for someone else to consider.

Last edited by jackie_w; 10-31-2018 at 09:08 AM.
jackie_w is offline   Reply With Quote