xfce4-genmon-scripts icon indicating copy to clipboard operation
xfce4-genmon-scripts copied to clipboard

Dualshock 3/4 gamepad battery percentage support

Open xtonousou opened this issue 4 years ago • 8 comments

From @samuk190

Do you know where I can get stats from dualshock3/4 battery? I want to create a script to show dualshock battery.

With the help of some other devs I discovered how to get battery percentage:

upower -e  # to discover devices
upower -i /org/freedesktop/UPower/devices/gaming_input_sony_controller_battery_00o06of5obbo49o42

The approach with upower, I guess it is compatible with recent linux? An alternative approach:

cat /sys/class/power_supply/sony_controller_battery_<device_id>/capacity
cat /sys/class/power_supply  # (lists all controllers)

Just need to do something like a for loop to list all connected controllers and show their respective battery. Can you help doing the interface and the loop to get all connected controllers?

xtonousou avatar Oct 11 '20 11:10 xtonousou

A new branch was created for the development of the new feature @samuk190 please refer here

xtonousou avatar Oct 11 '20 11:10 xtonousou

Gamepad support has been added and it is ready to be tested.

The generic monitor command should be /path/to/xfce4-genmon-scripts/gamepad-panel.sh

Please test it while having multiple gamepads connected.

xtonousou avatar Oct 11 '20 16:10 xtonousou

Gamepad support has been added and it is ready to be tested.

The generic monitor command should be /path/to/xfce4-genmon-scripts/gamepad-panel.sh

Please test it while having multiple gamepads connected.

great, I tested here with 2 ds3 controllers its working very well thanks :) Just a suggestion, it need some padding between each 100% or make it like in rows to ocuppy less space and make it color red when less than 15% https://i.imgur.com/eu2PVP9.png

samuk190 avatar Oct 11 '20 20:10 samuk190

Well, the two "100%" strings shouldn't be there. My thought is:

  • Optionally define which device to display on panel
  • If no device is specified, the first is automatically selected (the first line of the command find)
  • All devices will be displayed in tooltip (name and battery percentage)

xtonousou avatar Oct 11 '20 20:10 xtonousou

Well, the two "100%" strings shouldn't be there. My thought is:

* Optionally define which device to display on panel

* If no device is specified, the first is automatically selected (the first line of the command `find`)

* All devices will be displayed in tooltip (name and battery percentage)

getting both displaying battery isnt bad, I thought it is good if show in a row, and 4-row column and other info at tooltip. Also if its going to show 100% strings, need a padding between it and the icon

samuk190 avatar Oct 11 '20 21:10 samuk190

Could you check again? I added a space between two battery percentages.

xtonousou avatar Oct 12 '20 19:10 xtonousou

Could you check again? I added a space between two battery percentages.

Sure! here the result, but I disliked it as it was too near the volume icon and too near the gamepad icon so I made a small change. https://i.imgur.com/ven4Kvs.png

Here the change(removed blank space at end and added at start): https://i.imgur.com/5hl95M4.png

here the result: https://i.imgur.com/M6Vr0Gd.png

samuk190 avatar Oct 12 '20 20:10 samuk190

to make it better I think it would be nice to add battery icon with % for every gamepad, https://i.imgur.com/6dGaqrL.png But that would be my work right? If you like I can try photoshop it

https://i.imgur.com/6dGaqrL.png example of ideas

  1. 4 icons one for fully charged, one for charging, one for half and one for low charge. or
  2. one icon with no color only "gamepad icon + battery" and percentage inside of it(idk if this is possible on bash script), and make another icon if charging.

Just a idea, to be more simple it could be one icon on top, percentage on bottom, and icon if its charging or not. Anyways great work, I can say now that my xfce desktop is complete

samuk190 avatar Oct 12 '20 20:10 samuk190