Audible or Visual warning if the batttery is about to give out

Hey guys,

Having great fun playing with the gameshell however just got a little miffed when I just completed a boss fight and was about to save when the battery gave out. Arrrg

So is there a chance that there can be some sort of audible warning or a quick flash on screen when the battery is say 10% or 5% and needs charging sooner not later?

Would certainly cut down on frustration , trust me. :slight_smile:

Thanks for such a compelling product.

PS. I did post this as a git issue first cause I completely forgot about the forum. Doh! my bad… and I can remove it from git if you want.

1 Like

There’s a thread on here for some Git code to display a battery indicator. You could put this kind of update into that thread. For me I don’t think it’ll work as I use the battery indicator but the console just turned off at a fairly high percentage. The first time it turned off about 19%. It’s likely my battery needing charged more as I never gave it a long charge but still have a look for the thread and that might help.

You could try this: [APP] Battery status on emulators

1 Like

Perfect. That should be installed and run by default I think and toggled off if you want to.

On the new version you can toggle it on and off but I haven´t released that version

Edit:2019-10-19T22:00:00Z BatMon - Battery Status on emulators for Clockwork OS v0.3

Good to know. Really helps to see the battery level when I start a game, you’d be surprised how quickly you forget you are playing.

Cheers,

Yeah, and your question why isnt by default installed is because its not an app from clockwork, they were trying their own option I think, on update 1.22 but something went wrong and they reverted that update

In launcher after 1.22
we switch TWM to Awesome for global notification window and prevent focus-stealing and maybe other features

This is an introduction to the pre-trial. if you are not good at linux console
Later, there will be an official release.
So do it on your own risk

:wink:

Manually, you need ssh into gameshell

make sure you have launcher >= 1.21 running with bluetooth support(sudo apt-get install bluez bluetooth)

Upgrade launcher

currently there is no release hash for launcher ,so you just need to

cd /home/cpi/apps/launcher
git pull

then move launcher out of /home/cpi/apps/ to /home/cpi/

The launcher will become more independent so that we can backup the user data easier in the future

mkdir /home/cpi/apps/Menu

Create a folder named Menu , this folder is for games/apps

We can put our games/apps, which was previously needed to place in the /home/cpi/apps/launcher/Menu/GameShell , into this directory (not belong to launcher`s)

and the games/apps folder is the all-in-one style
the icon ,the startup script, and others be in one simple folder, no need to put icon and script apart like before(
scripts in /home/cpi/apps/launcher/Menu/GameShell and icons in /home/cpi/apps/launcher/skin/default/Menu/GameShell/)

games/apps folder examples:

All of the above examples come from the forum players, thank you all, I just borrowed , I hope you wouldn’t mind

:slight_smile:

Then change the bottom of /home/cpi/.bashrc to point X to use new .xinitrc inside launcher

if [ -f /tmp/autologin ]
then
        rm -f /tmp/autologin
        mpd ~/.mpd.conf
        startx /home/cpi/launcher/.xinitrc -- -nocursor > /dev/null 2>&1 
fi

.xinitrc

feh --bg-center ~/launcher/sys.py/gameshell/wallpaper/loading.png 
exec ~/launcher/load.sh &
exec ~/launcher/sys.py/gsnotify/gsnotify-arm &
exec awesome -c ~/launcher/awesome/rc.lua

Here is , new .xinitrc invoked a small widget called gsnotify

gsnotify

Though the readme of gsnotify ,there are 3 examples
one of them is the battery notify script

#!/bin/bash

BAT_PNT=`upower -i $(upower -e | grep 'battery') | grep -E "state|to\ full|percentage" | awk '/perc/{print $2}' | cut -d % -f1 `

if [ "$BAT_PNT" -lt "20" ]; then
	if [ "$BAT_PNT" -lt "15" ]; then
			echo '{"type":"once","content":"Power<15%"}'
	fi

	if [ "$BAT_PNT" -lt "10" ]; then
		echo "keydown" | socat - UNIX-CONNECT:/tmp/gameshell
		echo '{"type":"repeat","content":"Power<10%,will poweroff soon"}'
	fi

	echo "keydown" | socat - UNIX-CONNECT:/tmp/gameshell
	echo '{"type":"once","content":"Power<20%"}'

else
	echo $BAT_PNT
fi

the script use upower to check the battery ,get percent
and use socat to communicate launcher’s unix socket under /tmp/ to light the screen if the screen is in dark
and of cause ,print the message to gsnotify to show up

you can put the script into /home/cpi/launcher/sys.py/gsnotify/Jobs now

The gsnotify will do a round-robin check every 30s for the scripts under /home/cpi/launcher/sys.py/gsnotify/Jobs directory in simple json return formatted and
show a small window that slides down from the top, reminding the battery that it is nearly exhausted, etc.
and freely configurable

Install awesome and upower

sudo apt-get install awesome socat upower

--reboot--

Fix RetroArch issue

Even All is done ,you will not see any notifications while retroarch is running,because
the retroarch in GS ,is kind a wild window for X11 currently now
so change config to fix this issue by two lines:

in top of /home/cpi/.config/retroarch/retroarch.cfg

video_fullscreen = "false"
...
video_windowed_fullscreen = "true"

–reboot–

Options

upgrade to debian buster to get newer software

in /etc/apt/source.list
change all source to buster
then upgrade the debian system

sudo apt-get update
sudo apt-get upgrade

sudo apt-get install awesome socat upower

--reboot--

At end:

In the new launcher , we use Awesome to deal on-top windows ,even the battery monitor widget can work better , no need to kill and re-launch it time by time

I apologize for my bad English. If you have any accidents during the actual operation or do not understand my explanation, please let me know, let’s do more tests together.

4 Likes

Currently the limitations of the battery widget come from the twm limitations, cant wait for awesome :smiley:

no need to kill and re-launch it time by time

In a version that I haven´t released yet, I dealt with that but lost transparency. It has a solid background.

Edit: Released BatMon - Battery Status on emulators

Glad to hear that you like it

you can try awesome , the new launcher now

:slight_smile:

I tried following the step by step until I got to the above instruction. I could not figure out what had to change to buster. So I carefully backtracked and returned everything to it’s previous state. Thank goodness I’m good at that! Back to normal…

yeah,that seems a risk

Though it’s ok to upgrade to buster, I’ve tested already

I found out that debian buster has python 3.6.5+,which is a requirement for
http://arcade.academy/

but Even not with buster, all steps and the launcher should works ,too

Change above instruction now, thanks @lasvegas

What do we change to buster in source.list? This is what I couldn’t figure out.

I’m stuck at the loading screen. :frowning:

Have done all the recent steps, added the line to .bashrc, checked .xinitrc (looks like your’s, upgraded my system like you told and moved the launcher.

Have any idea how to figure out what’s going wrong?

you can still ssh into gs right now,right?

if you can see the loading screen, means X is up ,that’s a good news

the lines in .bashrc should be replaced ,not add

and you can test the launcher by ssh if the launcher did not up,find out the reason

cpi@clockworkpi:~$ cd /home/cpi/launcher  
cpi@clockworkpi:~$ DISPLAY=:0 ./load.sh

Yes, that’s no problem. If I run your command, it says:

cpi@clockworkpi:~$ cd /home/cpi/launcher
cpi@clockworkpi:~/launcher$ DISPLAY=:0 ./load.sh
Traceback (most recent call last):
  File "run.py", line 526, in <module>
setup_dbus()
  File "/home/cpi/launcher/sys.py/libs/DBUS/__init__.py", line 49, in setup_dbus
proxy_obj = bus.get_object("org.bluez", "/")
  File "/usr/lib/python2.7/dist-packages/dbus/bus.py", line 241, in get_object
follow_name_owner_changes=follow_name_owner_changes)
  File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 248, in __init__
self._named_service = conn.activate_name_owner(bus_name)
  File "/usr/lib/python2.7/dist-packages/dbus/bus.py", line 180, in activate_name_owner
self.start_service_by_name(bus_name)
  File "/usr/lib/python2.7/dist-packages/dbus/bus.py", line 278, in start_service_by_name
'su', (bus_name, flags)))
  File "/usr/lib/python2.7/dist-packages/dbus/connection.py", line 651, in call_blocking
message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.ServiceUnknown: The name org.bluez was not provided by any .service files

it seems that there is no bluetooth on your GS

Sorry for that
I forgot to explicitly mention Bluetooth support in above instruction

did u update the kernel to support bluetooth?

anyway

sudo apt-get install bluez bluetooth

Install bluez to get the launcher up and running

But I suggest see wiki to enable bluetooth

and auto setup bluetooth script:

1 Like

Okay, that’s it. Thansk! Now I’m stuck with updating kernel and ulmage. ._.

well
if you don’t know how to update kernel ,you can leave it alone
just don’t get into bluetooth
I think the rest will work as same

soon will be an image contains new kernel and etc

Try here The GameShell runs debian.