Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dualshock 3/4 gamepad battery percentage support #7

Open
xtonousou opened this issue Oct 11, 2020 · 8 comments
Open

Dualshock 3/4 gamepad battery percentage support #7

xtonousou opened this issue Oct 11, 2020 · 8 comments

Comments

@xtonousou
Copy link
Owner

xtonousou commented Oct 11, 2020

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
Copy link
Owner Author

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

@xtonousou
Copy link
Owner Author

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.

@samuk190
Copy link

samuk190 commented Oct 11, 2020

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

@xtonousou
Copy link
Owner Author

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)

@samuk190
Copy link

samuk190 commented Oct 11, 2020

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

@xtonousou
Copy link
Owner Author

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

@samuk190
Copy link

samuk190 commented Oct 12, 2020

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
Copy link

samuk190 commented Oct 12, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants