~dinkocar


#235 Rework the way we pickup/discard 2 months ago

Comment by ~dinkocar on ~mil/sxmo-tickets

Interesting. I did not know that when using volume buttons sxmo_screenlock is used without command line parameters. I am using hotcorners for locking, so I always have command line parameters :) and it saves the buttons.

#235 Rework the way we pickup/discard 2 months ago

Comment by ~dinkocar on ~mil/sxmo-tickets

I must say I am looking forward to this next release. I see a lot of work done on phone answering, sms problem with international characters is fixed (when new modemmonitor gets merged), and hardware button hooks added. It is really looking great.

But back on topic. If I got it right, when call is incoming, and screen is locked, phone will be unlocked (screen on) only when moved (picked up). But then it is missing my basic use case for incoming call, which is: phone on table, face up. Call comes in, and I just glance at it quickly without picking it up (especially if my hands are dirty) and decide weather to answer right away or call back later. I would suggest to unlock it only based on proximity sensor, and if call is not answered to put it back to sleep, crust or display only based on previous state. And you can get previous state from sxmo_screenlock command line parameter, as you are already checking for sxmo_screenlock to see if it is locked. SCREENLOCKARG=$(ps | grep sxmo_screenlock | grep -v grep | awk '{ print $5 }') Of course if call is answered, screen is not locked after the call.

#235 Rework the way we pickup/discard 2 months ago

Comment by ~dinkocar on ~mil/sxmo-tickets

Actually, I was also thinking about implementing call menu in dmenu (in fact just today). And here are some ideas that I had, I don't know how feasible it is. First problem which is obvious is what if dmenu is already opened when call comes in. If you kill existing dmenu, you have to be sure that the script which has started it will behave in predictable manner, which basically means that it has to close, without doing anything. If the script is poorly written it can actually execute some action, which can then interfere with the call, or do something unexpected. So the idea that I had, which would be least intrusive, and I had inspiration in i3, which I use daily (I have dwm only on pinephone) is to open new workspace (I don't know if dwm calls it workspace, but the thing which is numbered with numbers 1,2,3,4), maybe give it the name "Call" (i3 can give names to workspaces, not only numbers) and open dmenu for call there. After call ends this new workspace is closed, as it will be empty. And user can switch between "Call" workspace and any other workspace during call, if needed. Open questions for me in this scenario are (I haven't investigated, so I don't know):

  1. can dwm open new workspace, which is not configured during compile time (can it have name or only number, this is not very important)
  2. can dmenu be opened twice (if it is already opened by user before call, you don't need to close it in this case).

So, these are just some preliminary ideas which I had, maybe they can be of some use :)

#236 Enable compositor (new FR) 2 months ago

Ticket created by ~dinkocar on ~mil/sxmo-tickets

I have been playing with picom today, and it looks cool when enabled. It adds some cool 3D effects (shadows, fade in/out). So I will share my config files, needed to enable picom. Of course, picom needs to be installed first :)

picom.conf (located in .config dir)


# Shadow
shadow = true;
detect-rounded-corners = true;
shadow-radius = 5;
shadow-offset-x = 1;
shadow-offset-y = 1;
shadow-opacity = .3;
shadow-ignore-shaped = false;
shadow-exclude = [
	"name = 'Notification'", 
# workaround for conky until it provides window properties:
	"override_redirect = 1 && !WM_CLASS@:s",
#    "class_g ?= 'Dmenu'",
#	"class_g ?= 'Dunst'",
# disable shadows for hidden windows:
	"_NET_WM_STATE@:32a *= '_NET_WM_STATE_HIDDEN'",
# disables shadows on sticky windows:
#	"_NET_WM_STATE@:32a *= '_NET_WM_STATE_STICKY'",
#	Disable for Firefox elements
	"class_g = 'firefox' && argb",
	"_GTK_FRAME_EXTENTS@:c"
];

# shadow-exclude-reg = "x10+0+0";
# xinerama-shadow-crop = true;

#menu-opacity = 0.95;
inactive-opacity = 0.93;
active-opacity = 1;
#alpha-step = 0.01;
#inactive-dim = 0.0;
#blur-background = false;
#blur-kern = "3x3box";

fading = true;
fade-delta = 1;
fade-in-step = 0.03;
fade-out-step = 0.03;
fade-exclude = [ ];

#backend = "xrender";
backend = "glx";
glx-no-stencil = true;
glx-no-rebind-pixmap = true;
mark-wmwin-focused = true;
use-ewmh-active-win = true;
mark-ovredir-focused = true;
detect-client-opacity = true;
unredir-if-possible = true;
refresh-rate = 0;
vsync = true;
dbe = false;
focus-exclude = [
  "class_g = 'Cairo-clock'",
#  "class_i = 'dmenu'",
  "class_i = 'dwm'"
];
detect-transient = true;
detect-client-leader = true;
invert-color-include = [ ];
use-damage = true;

#opacity-rule = [ 
#"99:name *?= 'Call'", 
#"99:class_g = 'Chromium'", 
#"99:name *?= 'Conky'", 
#"99:class_g = 'Darktable'", 
#"50:class_g = 'Dmenu'", 
#"99:name *?= 'Event'", 
#"99:class_g = 'Firefox'", 
#"99:class_g = 'GIMP'", 
#"99:name *?= 'Image'",
#"99:class_g = 'Lazpaint'", 
#"99:class_g = 'Midori'", 
#"99:name *?= 'Minitube'", 
#"99:class_g = 'Mousepad'",
#"99:name *?= 'MuseScore'", 
#"90:name *?= 'Page Info'", 
#"99:name *?= 'Pale Moon'", 
#"90:name *?= 'Panel'", 
#"99:class_g = 'Pinta'", 
#"90:name *?= 'Restart'", 
#"99:name *?= 'sudo'", 
#"99:name *?= 'Screenshot'", 
#"99:class_g = 'Viewnior'", 
#"99:class_g = 'VirtualBox'", 
#"99:name *?= 'VLC'", 
#"99:name *?= 'Write'", 
#"93:class_g = 'URxvt' && !_NET_WM_STATE@:32a", 
#"0:_NET_WM_STATE@:32a *= '_NET_WM_STATE_HIDDEN'", 
#"96:_NET_WM_STATE@:32a *= '_NET_WM_STATE_STICKY'" 
#];
#opacity-rule = [
#    "99:I3_FLOATING_WINDOW@:c && focused",
#    "60:I3_FLOATING_WINDOW@:c && !focused"
#];

wintypes : 
{
  tooltip = 
  {
    fade = true;
    shadow = false;
    opacity = 0.85;
    focus = true;
  };
  desktop = 
  {
    fade = true;
    shadow = false;
    opacity = 1;
    focus = true;
  };
  dock = 
  {
    fade = true;
    shadow = false;
    opacity = 1;
    focus = true;
  };
  notification = 
  {
    fade = true;
    shadow = true;
    opacity = 0.7;
    focus = true;
  };
};

conky.conf needs to be updated (the important part is own_window*):


conky.config = {
    alignment = 'middle_middle',
    background = false,
    border_width = 0.5,
    cpu_avg_samples = 4,
    default_color = 'white',
    default_outline_color = 'grey',
    default_shade_color = 'black',
    draw_borders = true,
    draw_graph_borders = true,
    draw_outline = false,
    draw_shades = true,
    use_xft = true,
    font = 'Bitstream Vera Sans:size=8',
    gap_x = 5,
    gap_y = 50,
    minimum_height = 5,
    minimum_width = 5,
    net_avg_samples = 2,
    double_buffer = true,
    out_to_console = false,
    out_to_stderr = false,
    extra_newline = false,
    own_window = false,
    stippled_borders = 1,
    cpu_avg_samples = 2,
    update_interval = 3,
    uppercase = false,
    use_spacer = 'none',
    show_graph_scale = false,
    show_graph_range = false,
    own_window = true,
    own_window_type = 'override',
    own_window_transparent = true
}

conky.text = [[
  ${font Latin Modern Mono Caps:size=60}${alignc}${exec date +"%H:%M"}$font
  ${font Latin Modern Mono Caps:size=10}${alignc}${exec date +"%d %b %Y"}$font
  ${voffset 20}${goto 40}${font Bitstream Vera Sans:bold:size=8}CPU$alignr$cpu%$font
  ${voffset 5}${goto 40}${top name 1}$alignr${top cpu 1}%
  ${goto 40}${top name 2}$alignr${top cpu 2}%
  ${goto 40}${top name 3}$alignr${top cpu 3}%
  ${goto 40}${top name 4}$alignr${top cpu 4}%
  ${voffset 10}${goto 40}${font Bitstream Vera Sans:bold:size=8}RAM$alignr$mem$font
  ${goto 40}${voffset 5}${top_mem name 1}$alignr${top_mem mem_res 1}
  ${goto 40}${top_mem name 2}$alignr${top_mem mem_res 2}
  ${goto 40}${top_mem name 3}$alignr${top_mem mem_res 3}
  ${goto 40}${top_mem name 4}$alignr${top_mem mem_res 4}
  ${voffset 20}${goto 40}${font Bitstream Vera Sans:bold:size=8}CPUtemp$alignr${hwmon 2 temp 1}°C$font
  ${goto 40}GPU0temp$alignr$color${hwmon 3 temp 1}°C
  ${goto 40}GPU1temp$alignr$color${hwmon 4 temp 1}°C
  ${voffset 20}${goto 40}${font Bitstream Vera Sans:bold:size=8}Battery$alignr${exec cat /sys/class/power_supply/axp20x-battery/capacity}%$font
]]

Most of the upper config is combination of sxmo default config and manjaro i3 linux config.

And this needs to be added to xinit hook:


# Start compositor picom
picom -b

# Set a pretty wallpaper
feh --bg-fill /usr/share/sxmo/background.jpg

# Start Conky
conky -c $HOME/.config/sxmo/conky24h.conf -d

After restart 3d compositing should be working, and you will have shadows below your dmenus, giving cool 3d efect (you can play with settings and have stronger shadows if you want). The only drawback which I found is that Firefox scrolling is a little les responsive, but still completely usable.

#235 Rework the way we pickup/discard 2 months ago

Comment by ~dinkocar on ~mil/sxmo-tickets

It is implemented in gesture hook script, here it is:


#!/usr/bin/env sh
WMCLASS="$1"
ACTION="$2"

finish() {
	echo "$1">&2
	notify-send "$1"
	exit 1
}

modem_n() {
	MODEMS="$(mmcli -L)"
	echo "$MODEMS" | grep -qoE 'Modem\/([0-9]+)' || finish "Couldn't find modem - is your modem enabled?"
	echo "$MODEMS" | grep -oE 'Modem\/([0-9]+)' | cut -d'/' -f2
}

case "$ACTION" in
	"callpickup")
		VOICECALLID="$(
			mmcli -m "$(modem_n)" --voice-list-calls -a |
			grep -Eo '[0-9]+ incoming \(ringing-in\)' |
			grep -Eo '[0-9]+'
		)"
		setsid -f sh -c "sxmo_modemcall.sh pickup $VOICECALLID"
		exit 0
		;;
	"callhangup")
		VOICECALLID="$(
			mmcli -m "$(modem_n)" --voice-list-calls -a |
			grep -Eo '[0-9]+ incoming \(ringing-in\)' |
			grep -Eo '[0-9]+'
		)"
		setsid -f sh -c "sxmo_modemcall.sh hangup $VOICECALLID"
		exit 0
		;;
esac

if [ "$WMCLASS" = "st-256color" ]; then
	case "$ACTION" in
		"scrollup_short")
			xdotool key --clearmodifiers Ctrl+Shift+b
			exit 0
			;;
		"scrolldown_short")
			xdotool key --clearmodifiers Ctrl+Shift+f
			exit 0
			;;
	esac
fi
exit 1

#235 Rework the way we pickup/discard 2 months ago

Comment by ~dinkocar on ~mil/sxmo-tickets

I agree. That is why I have implemented some automation during ringing. I will paste my ring, pickup and lisgdstart scripts here just as an idea. So, what it does is, when call is incoming, first it checks if phone is locked and then it checks proximity sensor. If there is nothing close to phone (screen is uncovered and phone is not in pocket or in a bag) screen is unlocked and turned on, and lisgd is restarted with special configuration for answering the phone (two fingers swipe up answers, two fingers swipe down rejects). After call is answered or rejected lisgd is restarted in normal mode. If call is missed, screen is returned in previous state (locked if it was locked, crust if it was in crust). Also during call proximity sensor is checked and when something is close (phone near ear) display is locked and off, and when proximity sensor is uncovered (user looking in screen), display is unlocked, turned on, and audio is routed to speaker. Also I am using mpv with ipc-server enabled, for ringing, because I am also using mpv for streaming internet radio, so this way, when I am listening to radio, and call comes in, radio is stopped and ringing starts. It can be used for any media actually, but currently I don't use any other media. Anyway, you can use this as starting point :) I have made only basic testing, so some bugs are expected. Also this implementation does not cover call waiting, and I have never tested what will happen if calls comes when one call is already in progress.

Ring script:


#!/usr/bin/env sh

# include common definitions
# shellcheck source=scripts/core/sxmo_common.sh
COMMON=$(which sxmo_common.sh)
. "$COMMON"

trap stopringing EXIT
trap 'exit 0' KILL TERM INT
trap 'LOCKED=false; MPVSTATE=closed' USR1

MPVDIR="$HOME/.config/mpv"
RINGTONE="/home/rade/.config/sxmo/ringtones/phone_ring.mp3"

LOCKED=false
[[ -n "$(pgrep sxmo_screenlock)" ]] && LOCKED=true
SCREENLOCKARG=$(ps | grep sxmo_screenlock | grep -v grep | awk '{ print $5 }')

finish() {
	echo "$1">&2
	notify-send "$1"
	exit 1
}

stopringing() {
    if [ "$MPVSTATE" = "running" ]; then
	    playradio.sh continue
    else
	    mpvctl.sh stop
    fi
    kill $VIBRATEPID
    sleep 1
    if [ -n "$MPVPID" ] && [ -n "$(ps | grep $MPVPID)" ]; then
        kill $MPVPID
    fi
    sxmo_lisgdstart.sh
    [[ "$LOCKED" == "true" ]] && sxmo_lock.sh $SCREENLOCKARG &
}

incallmonitor() {
    CALLRINGING=$(mmcli -m "$(modem_n)" --voice-list-calls)
    if [ "$CALLRINGING" = "No calls were found" ]; then
	exit 1
    fi
}

modem_n() {
    MODEMS="$(mmcli -L)"
    echo "$MODEMS" | grep -qoE 'Modem\/([0-9]+)' || finish "Couldn't find modem - is your modem enabled?"
    echo "$MODEMS" | grep -oE 'Modem\/([0-9]+)' | cut -d'/' -f2
}

getproximity() {
	echo $(cat /sys/bus/iio/devices/iio:device1/in_proximity_raw)
}

isuncovered() {
	if [ $(getproximity) -lt 20 ]; then
		echo true
	else
		echo false
	fi
}

socat -u OPEN:/dev/null UNIX-CONNECT:$MPVDIR/socket &> /dev/null
if [ "$?" = "0" ]; then
	MPVSTATE="running"
else
	MPVSTATE="closed"
fi

# sxmo_audioout.sh Speaker
# amixer sset 'Line Out' 100%
if [ "$MPVSTATE" = "closed" ]; then
	mpv --input-ipc-server=$MPVDIR/socket --loop --no-video "$RINGTONE" &
	MPVPID=$!
else
	mpvctl.sh loadfileloop "$RINGTONE"
fi

if [ "$LOCKED" = "true" ]; then
    if [ "$(isuncovered)" = "true" ]; then
        pkill sxmo_screenlock
    fi
else
    sxmo_lisgdstart.sh
fi

VOICECALLID="$(
	mmcli -m "$(modem_n)" --voice-list-calls -a |
	grep -Eo '[0-9]+ incoming \(ringing-in\)' |
	grep -Eo '[0-9]+'
)"

(
while true; do
    sxmo_vibratepine 1000
    sxmo_notificationwrite.sh \
        "$NOTIFDIR/incomingcall_${VOICECALLID}_notification" \
        "sxmo_modemcall.sh pickup $VOICECALLID" \
        none \
        "Pickup - $1" &
#    sxmo_notificationwrite.sh \
#        "$NOTIFDIR/incomingcall_${VOICECALLID}_notification_discard" \
#        "sxmo_modemcall.sh hangup $VOICECALLID" \
#        none \
#        "Discard - $1" &
    sleep 0.5
done
) &
VIBRATEPID=$!

while true; do    
#    dunstify -r 1669 $1
    incallmonitor
    if [ -n "$(pgrep sxmo_screenlock)"]; then
        if [ "$(isuncovered)" = "true" ]; then
            pkill sxmo_screenlock
        fi
    fi
done

Pickup script:


#!/usr/bin/env sh

trap gracefulexit KILL TERM INT

stopringing() {
	PID=$(ps -ef | grep sxmo/hooks/ring | grep -v grep | awk '{print $1}')
	if [[ -n "$PID" ]]; then
		kill -SIGUSR1 $PID
		kill $PID
	fi
}

unlock() {
	pkill sxmo_screenlock
}

lock() {
	sxmo_screenlock --screen-off &
}

gracefulexit() {
	stopringing
	unlock
	exit 0
}

getproximity() {
	echo $(cat /sys/bus/iio/devices/iio:device1/in_proximity_raw)
}

isuncovered() {
	if [ $(getproximity) -lt 15 ]; then
		echo true
	else
		echo false
	fi
}

audiospeakerphone() {
	[[ "$(sxmo_audiocurrentdevice.sh)" != "Line Out" ]] && sxmo_audioout.sh Speaker
	if [[ -n "$(pgrep sxmo_screenlock)" ]]; then
		LOCKED=true
	else
		LOCKED=false
	fi
	[[ "$LOCKED" == "true" ]] && unlock
}

audioearpiece() {
	[[ "$(sxmo_audiocurrentdevice.sh)" != "Earpiece" ]] && sxmo_audioout.sh Earpiece
	if [[ -n "$(pgrep sxmo_screenlock)" ]]; then
		LOCKED=true
	else
		LOCKED=false
	fi
	[[ "$LOCKED" == "false" ]] && lock
}

stopringing

TOGGLESPEAKER=false
while true; do
	if [[ "$(isuncovered)" == "true" ]]; then
		[[ "$TOGGLESPEAKER" == "true" ]] && audiospeakerphone
	else
		audioearpiece
		TOGGLESPEAKER=true
	fi
	sleep 1
done

Lisgdstart script


#!/usr/bin/env sh

if [ -z "$LISGD_THRESHOLD" ]; then
	LISGD_THRESHOLD=125
fi
if [ -z "$LISGD_THRESHOLD_PRESSED" ]; then
	LISGD_THRESHOLD_PRESSED=60
fi

modem_n() {
	MODEMS="$(mmcli -L)"
	echo "$MODEMS" | grep -oE 'Modem\/([0-9]+)' | cut -d'/' -f2
}

callmonitor() {
	CALLRINGING=$(mmcli -m "$(modem_n)" --voice-list-calls -a | grep -Eo '[0-9]+ incoming \(ringing-in\)')
	if [[ "$CALLRINGING" == "" ]]; then
		echo false
	else
		echo true
	fi
}


startnormal() {
	#-g format:
	#   fingers,swipe,edge,distance,command
	#order matters, only the first match gets executed
	lisgd "$@" -t "$LISGD_THRESHOLD" -T "$LISGD_THRESHOLD_PRESSED" \
		-g '1,DRUL,BR,*,sxmo_hotcorner.sh bottomright' \
		-g '1,DLUR,BL,*,sxmo_hotcorner.sh bottomleft' \
		-g '1,ULDR,TL,*,sxmo_hotcorner.sh topleft' \
		-g '1,URDL,TR,*,sxmo_hotcorner.sh topright' \
		-g '1,LR,B,L,sxmo_gesturehandler.sh enter' \
		-g '1,RL,B,L,sxmo_gesturehandler.sh back' \
		-g '1,LR,L,*,sxmo_gesturehandler.sh prevdesktop' \
		-g '1,RL,R,*,sxmo_gesturehandler.sh nextdesktop' \
		-g '1,DU,L,*,P,sxmo_gesturehandler.sh volup' \
		-g '1,UD,L,*,P,sxmo_gesturehandler.sh voldown' \
		-g '1,LR,T,*,P,sxmo_gesturehandler.sh brightnessup' \
		-g '1,RL,T,*,P,sxmo_gesturehandler.sh brightnessdown' \
		-g "1,DU,B,*,sxmo_gesturehandler.sh showkeyboard" \
		-g "1,UD,B,*,sxmo_gesturehandler.sh hidekeyboard" \
		-g "1,UD,T,*,sxmo_gesturehandler.sh showmenu" \
		-g "1,DU,T,*,sxmo_gesturehandler.sh hidemenu" \
		-g "2,UD,T,*,sxmo_gesturehandler.sh showsysmenu" \
		-g "2,UD,B,*,sxmo_gesturehandler.sh closewindow" \
		-g "3,UD,B,*,sxmo_gesturehandler.sh killwindow" \
		-g '2,RL,*,*,sxmo_gesturehandler.sh moveprevdesktop' \
		-g '2,LR,*,*,sxmo_gesturehandler.sh movenextdesktop' \
		-g '1,DU,R,*,P,sxmo_gesturehandler.sh scrollup_short' \
		-g '1,UD,R,*,P,sxmo_gesturehandler.sh scrolldown_short' \
		-g '1,LR,R,S,sxmo_gesturehandler.sh scrollright_short' \
		-g '1,RL,L,S,sxmo_gesturehandler.sh scrollleft_short' \
		&
}

startcall() {
	#-g format:
	#   fingers,swipe,edge,distance,command
	#order matters, only the first match gets executed
	lisgd "$@" -t "$LISGD_THRESHOLD" -T "$LISGD_THRESHOLD_PRESSED" \
		-g "2,DU,*,M,sxmo_gesturehandler.sh callpickup" \
		-g "2,UD,*,M,sxmo_gesturehandler.sh callhangup" \
		&
}

if [[ "$(callmonitor)" == "false" ]]; then
	startnormal "$@"
else
	startcall "$@"
fi

#230 Anbox start command 2 months ago

Ticket created by ~dinkocar on ~mil/sxmo-tickets

In sxmo_appmenu.sh command for starting anbox is simply "anbox". But when you run anbox without any parameters it just displays help page. Correct command for launching anbox is "anbox-launch".

#229 Top right hotcorner wrong lisgd config 2 months ago

Ticket created by ~dinkocar on ~mil/sxmo-tickets

In sxmo_lisgdstart.sh configuration for top right hotcorner is wrong. It should be:


-g '1,URDL,TR,*,sxmo_hotcorner.sh topright' \

#227 Bluetooth menu 2 months ago

Ticket created by ~dinkocar on ~mil/sxmo-tickets

In sxmo_appmenu.sh it is only checked if bluetoothctl exists. But bluetooth service should be running to use bluetoothctl. If service is not running bluetoothctl waits a long time (maybe forever, I haven't chacked) and menu is not shown, so it is confusing to user. In sxmo_bluetoothmenu.sh it should be checked if bluetooth service is running and if not, just show notification that bluetooth service is not running and quit.

#226 dmenu in landscape 2 months ago

Ticket created by ~dinkocar on ~mil/sxmo-tickets

dmenu size (number of lines) should be limited in landscape, because now on many menus top and bottom items can not be seen.