diff --git a/build.sh b/build.sh index 1410e39..aacfc67 100755 --- a/build.sh +++ b/build.sh @@ -1,6 +1,20 @@ #!/bin/sh +# check we have all dependencies + +echo "Checking dependencies..." + +if ! which uxnasm || ! which uxnemu || ! which crystal || ! which mseq ; then + echo "dependencies are not met - we need:" + echo "- uxnasm" + echo "- uxnemu" + echo "- crystal" + echo "- mblaze" + exit 1 +fi + # build config into crystal constants + echo "Generating config.cr" . ./config @@ -15,12 +29,8 @@ READER_PROG = "${READER_PROG}" COMPOSE_PROG = "${COMPOSE_PROG}" END -if ! which ${UXN_EMU}; then - echo "${UXN_EMU} is not in PATH! Beware..." - sleep 1 -fi - # build + echo "Building taro-ls" uxnasm taro-ls.tal taro-ls echo "Building taro-ctl" @@ -28,16 +38,21 @@ crystal build --release --no-debug -s taro-ctl.cr # setup TARO_LIB -if [ ${TARO_LIB} != ${PWD} ]; then - mkdir -p ${TARO_LIB} - for x in "taro-ls taro-reader lesskey .theme font.icn taro-ctl taro.svg"; do +if [ "${TARO_LIB}" != "${PWD}" ]; then + mkdir -p "${TARO_LIB}" + for x in taro-ls taro-reader lesskey .theme font.icn taro-ctl taro.svg; do if [ -e ${x} ]; then - cp ${x} ${TARO_LIB} + cp ${x} "${TARO_LIB}" fi done - echo "TARO_LIB is in ${TARO_LIB}; add it to your PATH or you can just copy taro-ctl there." + echo "TARO_LIB is in ${TARO_LIB}; you can either" + echo "- add it to your PATH" + echo "- or copy taro-ctl into your PATH" fi +cp "$(which uxnemu)" "${TARO_LIB}/${UXN_EMU}" + +# optionally, fill out desktopfile with proper variables and install it if [ "$1" = "desktopfile" ]; then sed -e "s#TARO_LIB#${TARO_LIB}#g" -e "s#UXN_EMU#${UXN_EMU}#g" taro.desktop > ~/.local/share/applications/taro.desktop -fi \ No newline at end of file +fi diff --git a/config b/config index e54d7e3..2fdd252 100644 --- a/config +++ b/config @@ -1,16 +1,16 @@ # where your maildir folders live MBOX_ROOT=${HOME}/lib/mail/zoho -# where runtime files live (probably this git repo for simplicity) -TARO_LIB=${PWD} +# where runtime files live +TARO_LIB=${HOME}/lib/taro # where attachments are saved to TARO_DOWNLOADS=${HOME}/tmp -# name of your uxnemu executable; it must be in PATH; i copy mine to "taro" so it gets the _NET_WM_CLASS=taro - there may be a better way to do this in the future +# uxnemu will be copied to TARO_LIB/UXN_EMU to give it the right _NET_WM_CLASS UXN_EMU=taro # any custom env you want to set for reader/compose wins TARO_ENV="PINENTRY_USER_DATA=taro" # reader and compose progs - I use st, you may use your own terminal although the command line options may differ so read the manual -READER_PROG="${TARO_ENV} TARO_DOWNLOADS=${TARO_DOWNLOADS} LESSKEYIN=${TARO_LIB}/lesskey st -c taro -n taro -t taro-reader -e ${TARO_LIB}/taro-reader" -COMPOSE_PROG="${TARO_ENV} st -c taro -n taro -t taro-compose -e mcom" +READER_PROG="${TARO_ENV} TARO_DOWNLOADS=\\\"${TARO_DOWNLOADS}\\\" LESSKEYIN=\\\"${TARO_LIB}/lesskey\\\" st -c ${UXN_EMU} -n ${UXN_EMU} -t taro-reader -e \\\"${TARO_LIB}/taro-reader\\\"" +COMPOSE_PROG="${TARO_ENV} st -c ${UXN_EMU} -n ${UXN_EMU} -t taro-compose -e mcom" diff --git a/taro-ctl.cr b/taro-ctl.cr index 34f7886..2f93db7 100644 --- a/taro-ctl.cr +++ b/taro-ctl.cr @@ -81,14 +81,11 @@ module Taro @stdin_r, @stdin_w = IO.pipe @lifetime = Channel(UInt8).new - uxnrom : String = "" - - uxnargs = ["-s", "1", "#{TARO_LIB}/#{uxnrom}.rom"] case w when WinType::LIST then spawn do Process.run( - command: UXN_EMU, + command: "#{TARO_LIB}/#{UXN_EMU}", args: [ "-s", "1", "taro-ls" ], chdir: TARO_LIB, input: @stdin_r, diff --git a/taro-ls.tal b/taro-ls.tal index f607334..a232131 100644 --- a/taro-ls.tal +++ b/taro-ls.tal @@ -438,6 +438,8 @@ JMP2r &back STHk LB_SELECT_IDX LDZ2 #0000 NEQ2 ,&can_go_back JCN STHkr LB_LEN LDZ2 #0001 SUB2 STHkr LB_SELECT_IDX STZ2 + ( if number of entries is less than height, don't scroll to bottom ) + STHkr LB_LEN LDZ2 #0001 SUB2 #00 STHkr LB_HEIGHT LDZ LTH2 ,&end JCN STHkr LB_LEN LDZ2 #00 STHkr LB_HEIGHT LDZ SUB2 STHkr LB_TOP STZ2 ,&end JMP &can_go_back