Closed melihcoban closed 4 years ago
I looked into it, and line 56 echo "${devices::-1}"
, will show that error only if $devices
is empty.
Can you check, and give me the output of qdbus --literal org.kde.kdeconnect /modules/kdeconnect org.kde.kdeconnect.daemon.devices
?
output = {"292fb7c7f4f0b5d7"} I found out that qt5tools wasn't installed in my system because qdbus was giving me "comment not found", installing the tools fixed that issue. However, when I click the icon on polybar I can see my device name written "ASUS" but ping/find device etc is not working.
I am using i3-gaps on Arch Linux, seems like problem is on my end but I can't get it to work. Thanks in advance.
I will add qt5tools to the dependency list.
To test ping, try this in terminal qdbus org.kde.kdeconnect /modules/kdeconnect/devices/292fb7c7f4f0b5d7/ping org.kde.kdeconnect.device.ping.sendPing
And have you enabled the plugins in the Android App and KDE Connect Settings?
qdbus org.kde.kdeconnect /modules/kdeconnect/devices/292fb7c7f4f0b5d7/ping org.kde.kdeconnect.device.ping.sendPing
This works just fine, I can see the ping on my phone.
Plugins are enabled in the android application and KDE connect settings. However I still can't ping from the polybar script
That's very strange. The command I gave you was copied from the script. Can you please send me a screenshot of the rofi menu opened
Here is the screenshot : imgur. Device name is correct in here
What happened when you press 'Enter' on Ping, and on Send File? The Send File should open Zenity window.
When I press Enter on Ping rofi screen closes and nothing happens. Send File opens this screen but as far as I tried selecting file doesn't send it to phone as well.
Edit : My battery is %45 right now and polybar icon turned to red as expected
I wrote a small test script, copying lines from the main script, removing functions and adding some debugging lines.
#!/usr/bin/env bash
for device in $(qdbus --literal org.kde.kdeconnect /modules/kdeconnect org.kde.kdeconnect.daemon.devices); do
deviceid=$(echo "$device" | awk -F'["|"]' '{print $2}')
echo deviceId: $deviceid
devicename=$(qdbus org.kde.kdeconnect /modules/kdeconnect/devices/$deviceid org.kde.kdeconnect.device.name)
echo deviceName: $devicename
isreach="$(qdbus org.kde.kdeconnect /modules/kdeconnect/devices/$deviceid org.kde.kdeconnect.device.isReachable)"
istrust="$(qdbus org.kde.kdeconnect /modules/kdeconnect/devices/$deviceid org.kde.kdeconnect.device.isTrusted)"
echo isReachable: $isreach, isTrusted: $istrust
if [ "$isreach" = "true" ] && [ "$istrust" = "true" ]
then
battery="$(qdbus org.kde.kdeconnect /modules/kdeconnect/devices/$deviceid org.kde.kdeconnect.device.battery.charge)"
echo battery: $battery
echo loadedPlugins: "$(qdbus org.kde.kdeconnect /modules/kdeconnect/devices/$deviceid org.kde.kdeconnect.device.loadedPlugins)"
qdbus org.kde.kdeconnect /modules/kdeconnect/devices/$deviceid/ping org.kde.kdeconnect.device.ping.sendPing
fi
echo -------------------------
done
Execute it in your terminal, and it should send ping to all connected devices. It will also output information about hte devices.
Also, can you test the v1 of this module. It had much simpler script, and I believe it used kdeconnect-cli instead of qt5-tools.
First of, my bash knowledge is funky at best.
Your test script works fine.
The show_menu
function in polybar-kdeconnect.sh
seems to not get the device id (or maybe a wrong one, idk).
To test it I added the variable deviceid2=MYID
and replace $2
with it. Ping and find my device are working this way.
In case its important Linux 5.0.4-arch
@den747 If the test script works, the main should work as well, they use the same code. I think you didn't put the space
between .
and /path
in your config file. Check the note in Usage section of README
Hey, don't mean to hijack but i'm also getting the original issue with "/home/username/.config/polybar/scripts/polybar-kdeconnect.sh: line 56: -1: substring expression < 0" showing up in the bar.
I'm running Ubuntu 18.04 and do not have qt5tools installed, nor can I find a version of it for Ubuntu. I found this for Arch- https://www.archlinux.org/packages/extra/x86_64/qt5-tools/ but i have no idea how to install in Ubuntu, or if it's even compatible.
Can you assist?
Hey, don't mean to hijack but i'm also getting the original issue with "/home/username/.config/polybar/scripts/polybar-kdeconnect.sh: line 56: -1: substring expression < 0" showing up in the bar.
I'm running Ubuntu 18.04 and do not have qt5tools installed, nor can I find a version of it for Ubuntu. I found this for Arch- https://www.archlinux.org/packages/extra/x86_64/qt5-tools/ but i have no idea how to install in Ubuntu, or if it's even compatible.
Can you assist?
On Ubuntu, I am running 20.04, you have to install qdbus-qt5
instead.
sudo apt install -y rofi kdeconnect zenity qdbus-qt5
This should install all the necessary dependencies on Ubuntu.
Hey, don't mean to hijack but i'm also getting the original issue with "/home/username/.config/polybar/scripts/polybar-kdeconnect.sh: line 56: -1: substring expression < 0" showing up in the bar. I'm running Ubuntu 18.04 and do not have qt5tools installed, nor can I find a version of it for Ubuntu. I found this for Arch- https://www.archlinux.org/packages/extra/x86_64/qt5-tools/ but i have no idea how to install in Ubuntu, or if it's even compatible. Can you assist?
On Ubuntu, I am running 20.04, you have to install
qdbus-qt5
instead.sudo apt install -y rofi kdeconnect zenity qdbus-qt5
This should install all the necessary dependencies on Ubuntu.
Awesome! It works now.
When I run the polybar I see this status in my polybar "/home/username/.config/polybar/scripts/polybar-kdeconnect.sh: line 56: -1: substring expression < 0
my polybar config: [module/kdeconnect] type = custom/script exec = ". ~/.config/polybar/scripts/polybar-kdeconnect.sh; show_devices" tail = true
all dependencies installed and kdeconnect works fine on my laptop. looking forward to hear from you.