Search This Blog

2019-08-12

the tablet.rasi for the children's rofi (draft)

* {
font: "Bitstream Vera Sans Mono 12";
background-color: black;
foreground-color: white;
text-color: silver;
}
window {
border: 1px 5px 5px 1px;
border-color: gold;
border-radius: 3px;
margin: 62px 0px 0px 0px;
width: 50%;
}
listview {
cycle: false;
dynamic: true;
fixed-height: false;
lines: 16;
margin: 7px;
scrollbar: true;
}
element {
background-color: #111111;
margin: 1px;
padding: 10px 10px;
}
element selected {
background-color: dimgray;
text-color: black;
}
element selected.active {
background-color: white;
text-color: black;
}
scrollbar {
handle-color: dimgray;
handle-width: 64px;
padding: 0px;
}
inputbar {
margin: 14px;
}
prompt {
text-color: gold;
}

textbox {
font: "Bitstream Vera Sans Mono 7";
padding: 5px 20px 5px 20px;
border: 1px 0px 1px 0px;
border-color: dimgray;
}

and it actually works daily... :)

yet another run-time fully recompile-able editable x interface... yet just another "proof of concept"... looks great... and it does work better than it already looks... :) ... feels like ~ ... kind of and editable ide... that also runs other applications... :) ... while someone else still lives in the past... :( ...

... and lol :: don't download that torrent... worthless quality!

2019-08-11

dwell now works well... :)

... and goes well with xmobar... :)

  Run CommandReader "/path/to/x-touch .5 2 3 1 @" "touch"

our first alpha code craft of a dwell... that works quite well... in chromium overridden... but that's ok... lol

- - - - - - -
#!/bin/sh

x_touch ()

# usage: [ dwell=0 [ touch3=0 [ touch2=0
#          [ show=0|1|2|3|4|5 [xchar=@] ]
#        ] ] ]

#   dwell: timeout in seconds,
#          disable with: 0 | [0].0

#   touch3: touched fingers count for click 3,
#           disable with: 0, sugested: 2

#   touch2: touched fingers count for click 2,
#           disable with: 0, sugested: 3

#   show: output population, disable with: 0

#     0 ) quiet
#     @ stdout:
#       1 ) xmobar: gold, orangered, transparent
#       2 ) events: TIMING, LOCKED, UNLOCKED
#       3 ) extra: + KILLED
#     @ stderr:
#       4 ) show: + EVENT lines
#     >=5 ) debug: + event descriptions

#   xchar: string to use in xmobar mode

{ xinput test-xi2 --root | {

local dwell=yes d=${1:-0} \
  t3=${2:-0} t2=${3:-0} s=${4:-1} x=${5:-X} ;

[ $d = 0 -o $d = .0 -o $d = 0.0 ] &&
{ d=0 ; dwell=no ; }

[ $d = 0 -a $t3 -eq 0 -a $t2 -eq 0 ] && {
echo 'Nothing to do... :(' >&2 ;
return 1 ;
} ;

local last_event=none color= ;
event () { [ $s -gt 0 -a "$*" != "$last_event" ] && {
if [ $s -eq 1 ] ; then
local color=
case $1 in
T* ) color=darkred ;;
L* )
case $2 in
2 ) color=gold ;;
3 ) if [ "$3" = dwell ] ;
then color=limegreen ;
else color=green ;
fi ;
esac ;
;;
U* ) color=#222222 ;;
esac;
echo "$x" ;
else echo $* ;
fi ;
last_event="$*";
} ; } ;

show () { [ $s -gt 3 ] && echo "$@" >&2 ; } ;

local line=

while read line ; do
case "$line" in
*TouchScreen*slave*pointer* )
show $line ;
break ;
esac ;
done ;

to_after_empty ()
{
local line ;
while read line ; do
  [ -z "$line" ] && break ; done ;
} ;

to_after_empty ;

click () { /usr/bin/xdotool click ${1:-3} ; } ;

local dwelling=yes \
  LOCK=/tmp/x-touch-dwell.ing"$DISPLAY" \
  lock= touched=0 ;

thouched ()
{
touched=$(( $touched + 1 )) ;
[ $touched -eq 1 -a $dwell = yes ] && {
dwelling=yes ;
{
sleep $d ;
touch $LOCK ;
event LOCKED 3 dwell ;
} &
pid=$! ;
event TIMIMG $d @ $pid
} ;
} ;

local dwelling=no ;

undwell ()  # click?
{
[ $dwelling = yes ] && {  # dwelling?
dwelling=no ;
if [ -e $LOCK ] ; then # locked?
rm $LOCK ;
[ "$1" = yes ] &&  # click?
click ;
else
kill $pid ;
[ $s -gt 2 ] && event KILLED $pid ;
fi ;
} ;
} ;

unlock ()  # click?
{
touched=0 ;
[ $dwell = yes ] && undwell $1 ;
event UNLOCKED;
} ;

# delete any previous lock
[ -e $LOCK ] && rm $LOCK ;
# for xmonad: first event
if [ $s -eq 1 ] ; then
# sleep 1s ;
event UNLOCKED ;
else last_event=UNLOCKED ;
fi;

local line= showing=yes touching=0 ;
while read line ; do
case "$line" in EVENT* )
showing=no
case "$line" in
# *22* ) show $line ;;  # RawTouchBegin
*18* )  # TouchBegin
show $line $touching touching ;
touching=$(( $touching + 1 )) ;
thouched ;
case $touched in
$t3 ) undwell ; event LOCKED 3 ;;
$t2 ) undwell ; event LOCKED 2 ;;
* ) [ $touched -gt $t3 -o $touched -gt $t2 ] &&
  event UNLOCKED ;;
esac ;
showing=yes ;
;;
# *24* ) show $line ;;  # RawTouchEnd
*20* )  # TouchEnd
show $line $touching touching ;
touching=$(( $touching - 1 )) ;
if [ $touching -eq 0 ] ; then
case $touched in
1 ) unlock yes ;
continue ;
;;
$t3 ) click ;;
$t2 ) click 2 ;;
esac ;
unlock ;
fi ;
showing=yes ;
;;
*19* )  # TouchUpdate
show $line $touching touching ;
unlock ;
;;
*Touch* )
show $line ;
showing=yes ;
esac ;
;;
* ) [ $showing = yes -a $s -gt 4 ] &&
  show ::\\t"$line" ;
esac ;
done ;
} ; } ;

x_touch "$@" ;