up su Gitea

This commit is contained in:
2026-04-19 17:07:18 +02:00
parent e78ce720bb
commit fe54b28378
298 changed files with 23460 additions and 0 deletions
@@ -0,0 +1,53 @@
import QtQuick
import QtQuick.Controls
import Quickshell
import qs.Commons
import qs.Modules.Bar.Extras
import qs.Modules.Panels.Settings
import qs.Services.Hardware
import qs.Services.UI
import qs.Widgets
import "./Services"
Item {
id: root
property var pluginApi: null
property ShellScreen screen
// Widget properties passed from Bar.qml for per-instance settings
property string widgetId: ""
property string section: ""
property int sectionWidgetIndex: -1
property int sectionWidgetsCount: 0
// Explicit screenName property ensures reactive binding when screen changes
readonly property string screenName: screen ? screen.name : ""
implicitWidth: pill.width
implicitHeight: pill.height
visible: !hideIfNoDeviceConnected ? true : KDEConnect.anyDevicesConnected;
opacity: (!hideIfNoDeviceConnected ? true : KDEConnect.anyDevicesConnected) ? 1.0 : 0.0;
property bool hideIfNoDeviceConnected: !(root.pluginApi?.mainInstance?.hideIfNoDeviceConnected ?? false)
BarPill {
id: pill
screen: root.screen
oppositeDirection: BarService.getPillDirection(root)
customIconColor: Color.resolveColorKeyOptional(root.iconColorKey)
customTextColor: Color.resolveColorKeyOptional(root.textColorKey)
icon: KDEConnectUtils.getConnectionStateIcon(KDEConnect.mainDevice, KDEConnect.daemonAvailable)
autoHide: false // Important to be false so we can hover as long as we want
text: !KDEConnect.daemonAvailable || KDEConnect.mainDevice === null || KDEConnect.mainDevice.battery === -1 ? "" : (KDEConnect.mainDevice.battery + "%")
tooltipText: pluginApi?.tr("bar.tooltip")
onClicked: {
if (pluginApi) {
pluginApi.openPanel(root.screen, this);
}
}
}
}
@@ -0,0 +1,27 @@
import QtQuick
import Quickshell
import qs.Widgets
import "./Services"
NIconButtonHot {
property ShellScreen screen
property var pluginApi: null
function getTooltip(device) {
const batteryLabel = pluginApi?.tr("panel.card.battery") || "Battery";
const stateLabel = pluginApi?.tr("control_center.state-label") || "State";
const batteryLine = (device !== null && device.reachable && device.paired && device.battery !== -1) ? (batteryLabel + ": " + device.battery + "%\n") : "";
const stateKey = KDEConnectUtils.getConnectionStateKey(device, KDEConnect.daemonAvailable);
const stateValue = pluginApi?.tr(stateKey) || "Unknown";
const stateLine = stateLabel + ": " + stateValue;
return batteryLine + stateLine;
}
icon: KDEConnectUtils.getConnectionStateIcon(KDEConnect.mainDevice, KDEConnect.daemonAvailable)
tooltipText: getTooltip(KDEConnect.mainDevice)
onClicked: pluginApi?.togglePanel(screen, this)
}
+339
View File
@@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.
+24
View File
@@ -0,0 +1,24 @@
import QtQuick
import Quickshell.Io
import qs.Services.UI
import qs.Commons
import "./Services"
Item {
property var pluginApi: null
onPluginApiChanged: {
KDEConnect.setMainDevice(pluginApi?.pluginSettings?.mainDeviceId || "")
}
IpcHandler {
target: "plugin:kde-connect"
function toggle() {
if (pluginApi) {
pluginApi.withCurrentScreen(screen => {
pluginApi.openPanel(screen);
});
}
}
}
}
+767
View File
@@ -0,0 +1,767 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import qs.Commons
import qs.Services.UI
import qs.Widgets
import "./Services"
import Quickshell
// Panel Component
Item {
id: root
// Plugin API (injected by PluginPanelSlot)
property var pluginApi: null
// SmartPanel
readonly property var geometryPlaceholder: panelContainer
property real contentPreferredWidth: 440 * Style.uiScaleRatio
property real contentPreferredHeight: 360 * Style.uiScaleRatio * Settings.data.ui.fontDefaultScale
readonly property bool allowAttach: true
property bool deviceSwitcherOpen: false
anchors.fill: parent
Component.onCompleted: {
if (pluginApi) {
Logger.i("KDEConnect", "Panel initialized");
}
}
Rectangle {
id: panelContainer
anchors.fill: parent
color: "transparent"
ColumnLayout {
id: deviceData
function getBatteryIcon(percentage, isCharging) {
if (percentage < 0) return "battery-exclamation"
if (isCharging) return "battery-charging-2"
if (percentage < 5) return "battery"
if (percentage < 25) return "battery-1"
if (percentage < 50) return "battery-2"
if (percentage < 75) return "battery-3"
return "battery-4"
}
function getCellularTypeIcon(type) {
switch (type) {
case "5G":
return "signal-5g"
case "LTE":
return "signal-4g"
case "HSPA":
return "signal-h"
case "UMTS":
return "signal-3g"
case "EDGE":
return "signal-e"
case "GPRS":
return "signal-g"
case "GSM":
return "signal-2g"
case "CDMA":
return "signal-3g"
case "CDMA2000":
return "signal-3g"
case "iDEN":
return "signal-2g"
default:
return "wave-square"
}
}
function getCellularStrengthIcon(strength) {
switch (strength) {
case 0:
return "antenna-bars-1"
case 1:
return "antenna-bars-2"
case 2:
return "antenna-bars-3"
case 3:
return "antenna-bars-4"
case 4:
return "antenna-bars-5"
default:
return "antenna-bars-off"
}
}
function getSignalStrengthText(strength) {
switch (strength) {
case 0:
return pluginApi?.tr("panel.signal.very-weak")
case 1:
return pluginApi?.tr("panel.signal.weak")
case 2:
return pluginApi?.tr("panel.signal.fair")
case 3:
return pluginApi?.tr("panel.signal.good")
case 4:
return pluginApi?.tr("panel.signal.excellent")
default:
return pluginApi?.tr("panel.unknown")
}
}
anchors {
fill: parent
margins: Style.marginL
}
spacing: Style.marginL
NBox {
id: headerBox
Layout.fillWidth: true
implicitHeight: headerRow.implicitHeight + (Style.marginXL)
RowLayout {
id: headerRow
anchors.fill: parent
anchors.margins: Style.marginM
spacing: Style.marginM
NIcon {
icon: "device-mobile"
pointSize: Style.fontSizeXXL
color: Color.mPrimary
}
NText {
text: pluginApi?.tr("panel.title")
pointSize: Style.fontSizeL
font.weight: Style.fontWeightBold
color: Color.mOnSurface
}
NIconButton {
readonly property bool multipleDevices: KDEConnect.devices.length > 1
icon: "swipe"
tooltipText: multipleDevices ? pluginApi?.tr("panel.other-devices") : ""
baseSize: Style.baseWidgetSize * 0.8
onClicked: {
deviceSwitcherOpen = !deviceSwitcherOpen
}
enabled: KDEConnect.daemonAvailable && multipleDevices
opacity: multipleDevices ? 1.0 : 0.0
}
Item {
Layout.fillWidth: true
}
NIconButton {
icon: "close"
tooltipText: I18n.tr("common.close")
baseSize: Style.baseWidgetSize * 0.8
onClicked: {
if (pluginApi)
pluginApi.withCurrentScreen(s => pluginApi.closePanel(s));
}
}
}
}
Loader {
Layout.fillWidth: true
Layout.fillHeight: true
active: true
sourceComponent: (KDEConnect.busctlCmd === null || KDEConnect.busctlCmd === "") ? busctlNotFoundCard :
(!KDEConnect.daemonAvailable) ? kdeConnectDaemonNotRunningCard :
(deviceSwitcherOpen) ? deviceSwitcherCard :
(KDEConnect.mainDevice !== null && !KDEConnect.mainDevice.reachable) ? deviceNotReachableCard :
(KDEConnect.mainDevice !== null && KDEConnect.mainDevice.paired) ? deviceConnectedCard :
(KDEConnect.mainDevice !== null && !KDEConnect.mainDevice.paired) ? noDevicePairedCard :
(KDEConnect.devices.length === 0) ? noDevicesAvailableCard :
null
}
Component {
id: deviceConnectedCard
Rectangle {
Layout.fillWidth: true
color: Color.mSurfaceVariant
radius: Style.radiusM
Component.onCompleted: {
root.contentPreferredHeight = headerBox.height + contentLayout.implicitHeight + (Style.marginL * 8)
}
Component.onDestruction: {
root.contentPreferredHeight = 360 * Style.uiScaleRatio * Settings.data.ui.fontDefaultScale
}
ColumnLayout {
id: contentLayout
anchors {
fill: parent
margins: Style.marginL
}
spacing: Style.marginL
RowLayout {
NText {
text: KDEConnect.mainDevice.name
pointSize: Style.fontSizeXXL
font.weight: Style.fontWeightBold
color: Color.mOnSurface
Layout.fillWidth: true
}
NFilePicker {
id: shareFilePicker
title: pluginApi?.tr("panel.send-file-picker")
selectionMode: "files"
initialPath: Quickshell.env("HOME")
nameFilters: ["*"]
onAccepted: paths => {
if (paths.length > 0) {
for (const path of paths) {
KDEConnect.shareFile(KDEConnect.mainDevice.id, path)
}
}
}
}
NIconButton {
icon: "device-mobile-search"
tooltipText: pluginApi?.tr("panel.browse-device")
onClicked: {
KDEConnect.browseFiles(KDEConnect.mainDevice.id)
}
}
NIconButton {
icon: "device-mobile-share"
tooltipText: pluginApi?.tr("panel.send-file")
onClicked: {
shareFilePicker.open()
}
}
NIconButton {
icon: "radar"
tooltipText: pluginApi?.tr("panel.find-device")
onClicked: {
KDEConnect.triggerFindMyPhone(KDEConnect.mainDevice.id)
}
}
}
// Device Status
Loader {
Layout.fillWidth: true
Layout.fillHeight: true
active: KDEConnect.mainDevice !== null
sourceComponent: deviceStatsWithPhone
}
}
Component {
id: deviceStatsWithPhone
RowLayout {
spacing: Style.marginM
Rectangle {
width: 100 * Style.uiScaleRatio
color: "transparent"
Layout.fillHeight: true
Layout.alignment: Qt.AlignCenter
PhoneDisplay {
Layout.alignment: Qt.AlignCenter
backgroundImage: ""
onClicked: KDEConnect.wakeUpDevice(KDEConnect.mainDevice.id)
}
}
Item {
width: Style.marginL
}
// Stats Grid
GridLayout {
Layout.fillWidth: true
Layout.alignment: Qt.AlignTop
columns: 1
rowSpacing: Style.marginL
// Battery Section
RowLayout {
spacing: Style.marginM
NIcon {
icon: deviceData.getBatteryIcon(KDEConnect.mainDevice.battery, KDEConnect.mainDevice.charging)
pointSize: Style.fontSizeXXXL
applyUiScale: true
color: Color.mOnSurface
}
ColumnLayout {
spacing: 2 * Style.uiScaleRatio
NText {
text: pluginApi?.tr("panel.card.battery")
pointSize: Style.fontSizeS
color: Color.mOnSurface
}
NText {
text: KDEConnect.mainDevice.battery < 0 ? pluginApi?.tr("panel.unknown") : (KDEConnect.mainDevice.battery + "%")
pointSize: Style.fontSizeL
font.weight: Style.fontWeightMedium
color: Color.mOnSurface
}
}
}
// Network Type Section
RowLayout {
spacing: Style.marginM
NIcon {
icon: deviceData.getCellularTypeIcon(KDEConnect.mainDevice.cellularNetworkType)
pointSize: Style.fontSizeXXXL
applyUiScale: true
color: Color.mOnSurface
}
ColumnLayout {
spacing: 2 * Style.uiScaleRatio
NText {
text: pluginApi?.tr("panel.card.network")
pointSize: Style.fontSizeS
color: Color.mOnSurface
}
NText {
text: KDEConnect.mainDevice.cellularNetworkType || pluginApi?.tr("panel.unknown")
pointSize: Style.fontSizeL
font.weight: Style.fontWeightMedium
color: Color.mOnSurface
}
}
}
// Signal Strength Section
RowLayout {
spacing: Style.marginM
NIcon {
icon: deviceData.getCellularStrengthIcon(KDEConnect.mainDevice.cellularNetworkStrength)
pointSize: Style.fontSizeXXXL
applyUiScale: true
color: Color.mOnSurface
}
ColumnLayout {
spacing: 2 * Style.uiScaleRatio
NText {
text: pluginApi?.tr("panel.card.signal-strength")
pointSize: Style.fontSizeS
color: Color.mOnSurface
}
NText {
text: deviceData.getSignalStrengthText(KDEConnect.mainDevice.cellularNetworkStrength)
pointSize: Style.fontSizeL
font.weight: Style.fontWeightMedium
color: Color.mOnSurface
}
}
}
// Notifications Section
RowLayout {
spacing: Style.marginM
NIcon {
icon: "notification"
pointSize: Style.fontSizeXXXL
applyUiScale: true
color: Color.mOnSurface
}
ColumnLayout {
spacing: 2 * Style.uiScaleRatio
NText {
text: pluginApi?.tr("panel.card.notifications")
pointSize: Style.fontSizeS
color: Color.mOnSurface
}
NText {
text: KDEConnect.mainDevice.notificationIds.length
pointSize: Style.fontSizeL
font.weight: Style.fontWeightMedium
color: Color.mOnSurface
}
}
}
}
}
}
}
}
Component {
id: noDevicePairedCard
Rectangle {
Layout.fillWidth: true
Layout.fillHeight: true
color: Color.mSurfaceVariant
radius: Style.radiusM
ColumnLayout {
anchors {
fill: parent
margins: Style.marginL
}
spacing: Style.marginL
RowLayout {
NText {
text: KDEConnect.mainDevice.name
pointSize: Style.fontSizeXXL
font.weight: Style.fontWeightBold
color: Color.mOnSurface
Layout.fillWidth: true
}
}
Rectangle {
Layout.fillWidth: true
Layout.fillHeight: true
color: "transparent"
ColumnLayout {
anchors.fill: parent
anchors.margins: Style.marginM
spacing: Style.marginM
NButton {
text: pluginApi?.tr("panel.pair")
Layout.alignment: Qt.AlignHCenter
enabled: !KDEConnect.mainDevice.pairRequested
onClicked: {
KDEConnect.requestPairing(KDEConnect.mainDevice.id)
KDEConnect.mainDevice.pairRequested = true
KDEConnect.refreshDevices()
}
}
RowLayout {
Layout.alignment: Qt.AlignHCenter
spacing: Style.marginM
NIcon {
icon: "key"
pointSize: Style.fontSizeXL
color: Color.mOnSurface
Layout.alignment: Qt.AlignHCenter
opacity: KDEConnect.mainDevice.pairRequested ? 1.0 : 0.0
}
NText {
text: KDEConnect.mainDevice.verificationKey
Layout.alignment: Qt.AlignHCenter
pointSize: Style.fontSizeL
font.weight: Style.fontWeightBold
color: Color.mOnSurface
opacity: KDEConnect.mainDevice.pairRequested ? 1.0 : 0.0
}
}
NBusyIndicator {
Layout.alignment: Qt.AlignHCenter
opacity: KDEConnect.mainDevice.pairRequested ? 1.0 : 0.0
size: Style.baseWidgetSize * 0.5
running: KDEConnect.mainDevice.pairRequested
}
}
}
}
}
}
Component {
id: noDevicesAvailableCard
Rectangle {
Layout.fillWidth: true
Layout.fillHeight: true
color: Color.mSurfaceVariant
radius: Style.radiusM
ColumnLayout {
id: emptyState
anchors.fill: parent
anchors.margins: Style.marginM
spacing: Style.marginM
Item {
Layout.fillHeight: true
}
NIcon {
icon: "device-mobile-off"
pointSize: 48 * Style.uiScaleRatio
color: Color.mOnSurfaceVariant
Layout.alignment: Qt.AlignHCenter
}
Item {}
NText {
text: pluginApi?.tr("panel.kdeconnect-error.no-devices")
pointSize: Style.fontSizeL
color: Color.mOnSurfaceVariant
Layout.alignment: Qt.AlignCenter
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
wrapMode: Text.WordWrap
}
Item {
Layout.fillHeight: true
}
}
}
}
Component {
id: deviceNotReachableCard
Rectangle {
Layout.fillWidth: true
Layout.fillHeight: true
color: Color.mSurfaceVariant
radius: Style.radiusM
ColumnLayout {
id: emptyState
anchors.fill: parent
anchors.margins: Style.marginM
spacing: Style.marginM
Item {
Layout.fillHeight: true
}
NIcon {
icon: "device-mobile-off"
pointSize: 48 * Style.uiScaleRatio
color: Color.mOnSurfaceVariant
Layout.alignment: Qt.AlignHCenter
}
Item {}
NText {
text: pluginApi?.tr("panel.kdeconnect-error.device-unavailable")
pointSize: Style.fontSizeL
color: Color.mOnSurfaceVariant
Layout.alignment: Qt.AlignCenter
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
wrapMode: Text.WordWrap
}
Item {
}
NButton {
text: pluginApi?.tr("panel.unpair")
Layout.alignment: Qt.AlignHCenter
onClicked: {
KDEConnect.unpairDevice(KDEConnect.mainDevice.id)
}
}
Item {
Layout.fillHeight: true
}
}
}
}
Component {
id: busctlNotFoundCard
Rectangle {
Layout.fillWidth: true
Layout.fillHeight: true
color: Color.mSurfaceVariant
radius: Style.radiusM
ColumnLayout {
id: emptyState
anchors.fill: parent
anchors.margins: Style.marginM
spacing: Style.marginM
Item {
Layout.fillHeight: true
}
NIcon {
icon: "exclamation-circle"
pointSize: 48 * Style.uiScaleRatio
color: Color.mOnSurfaceVariant
Layout.alignment: Qt.AlignHCenter
}
Item {}
NText {
text: pluginApi?.tr("panel.busctl-error.unavailable-title")
pointSize: Style.fontSizeL
color: Color.mOnSurfaceVariant
Layout.alignment: Qt.AlignCenter
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
NText {
text: pluginApi?.tr("panel.busctl-error.unavailable-desc")
pointSize: Style.fontSizeS
color: Color.mOnSurfaceVariant
Layout.alignment: Qt.AlignCenter
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
wrapMode: Text.WordWrap
Layout.fillWidth: true
}
Item {
Layout.fillHeight: true
}
}
}
}
Component {
id: kdeConnectDaemonNotRunningCard
Rectangle {
Layout.fillWidth: true
Layout.fillHeight: true
color: Color.mSurfaceVariant
radius: Style.radiusM
ColumnLayout {
id: emptyState
anchors.fill: parent
anchors.margins: Style.marginM
spacing: Style.marginM
Item {
Layout.fillHeight: true
}
NIcon {
icon: "exclamation-circle"
pointSize: 48 * Style.uiScaleRatio
color: Color.mOnSurfaceVariant
Layout.alignment: Qt.AlignHCenter
}
Item {}
NText {
text: pluginApi?.tr("panel.kdeconnect-error.unavailable-title")
pointSize: Style.fontSizeL
color: Color.mOnSurfaceVariant
Layout.alignment: Qt.AlignCenter
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
NText {
text: pluginApi?.tr("panel.kdeconnect-error.unavailable-desc")
pointSize: Style.fontSizeS
color: Color.mOnSurfaceVariant
Layout.alignment: Qt.AlignCenter
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
wrapMode: Text.WordWrap
Layout.fillWidth: true
}
Item {
Layout.fillHeight: true
}
}
}
}
Component {
id: deviceSwitcherCard
Rectangle {
Layout.fillWidth: true
Layout.fillHeight: true
color: Color.mSurfaceVariant
radius: Style.radiusM
NScrollView{
horizontalPolicy: ScrollBar.AlwaysOff
verticalPolicy: ScrollBar.AsNeeded
contentWidth: parent.width
reserveScrollbarSpace: false
gradientColor: Color.mSurface
ColumnLayout {
id: emptyState
anchors.fill: parent
anchors.margins: Style.marginM
spacing: Style.marginM
Repeater {
model: KDEConnect.devices
Layout.fillWidth: true
NButton {
required property var modelData
text: modelData.name
Layout.fillWidth: true
backgroundColor: modelData.id === KDEConnect.mainDevice.id ? Color.mSecondary : Color.mPrimary
onClicked: {
KDEConnect.setMainDevice(modelData.id);
deviceSwitcherOpen = false;
pluginApi.pluginSettings.mainDeviceId = modelData.id;
pluginApi.saveSettings();
}
}
}
Item {
Layout.fillHeight: true
}
}
}
}
}
}
}
}
@@ -0,0 +1,125 @@
import QtQuick
import QtQuick.Layouts
import QtQuick.Effects
import qs.Commons
import qs.Widgets
Rectangle {
id: phoneRoot
property string backgroundImage: "" // Path to background image
height: parent ? parent.height : 235
width: (height / 235) * 115
readonly property real scaleFactor: Math.min(width / 115, height / 235)
radius: 20 * scaleFactor
color: "#1c1c1e"
signal clicked;
MultiEffect {
source: phoneRect
anchors.fill: phoneRect
shadowEnabled: true
shadowBlur: phoneRect.scale > 0.97 ? 0.8 : 0.3
shadowVerticalOffset: phoneRect.scale > 0.97 ? 8 : 2
shadowColor: "#80000000"
Behavior on shadowBlur { NumberAnimation { duration: 100 } }
Behavior on shadowVerticalOffset { NumberAnimation { duration: 100 } }
}
RectangularShadow {
anchors.fill: phoneRect
radius: phoneRoot.radius
blur: 15
spread: 1
}
// Bezel/frame
Rectangle {
id: phoneRect
Behavior on scale {
NumberAnimation { duration: 100; easing.type: Easing.OutCubic }
}
MouseArea {
anchors.fill: parent
hoverEnabled: true
onEntered: phoneRect.scale = 1.02
onExited: phoneRect.scale = 1.0
onPressed: phoneRect.scale = 0.99
onReleased: phoneRect.scale = containsMouse ? 1.02 : 1.0
onClicked: phoneRoot.clicked();
}
anchors {
fill: parent
margins: 2 * phoneRoot.scaleFactor
}
radius: 18 * phoneRoot.scaleFactor
color: "black"
// Screen
Rectangle {
id: screen
anchors {
fill: parent
margins: 1 * phoneRoot.scaleFactor
}
radius: 17 * phoneRoot.scaleFactor
color: "black"
clip: true
// Background wallpaper
Image {
anchors.fill: parent
source: phoneRoot.backgroundImage
fillMode: Image.PreserveAspectCrop
visible: phoneRoot.backgroundImage !== ""
// Fallback gradient if no image
Rectangle {
anchors.fill: parent
visible: phoneRoot.backgroundImage === ""
gradient: Gradient {
GradientStop { position: 0.0; color: "#2c3e50" }
GradientStop { position: 1.0; color: "#34495e" }
}
}
}
// Dynamic Island
Rectangle {
id: dynamicIsland
anchors {
top: parent.top
horizontalCenter: parent.horizontalCenter
topMargin: 6 * phoneRoot.scaleFactor
}
width: 48 * phoneRoot.scaleFactor
height: 10 * phoneRoot.scaleFactor
radius: 5 * phoneRoot.scaleFactor
color: "black"
}
// Home indicator (bottom gesture bar)
Rectangle {
anchors {
bottom: parent.bottom
horizontalCenter: parent.horizontalCenter
bottomMargin: 6 * phoneRoot.scaleFactor
}
width: 40 * phoneRoot.scaleFactor
height: 4 * phoneRoot.scaleFactor
radius: 2 * phoneRoot.scaleFactor
color: "white"
opacity: 0.4
}
}
}
}
+28
View File
@@ -0,0 +1,28 @@
# Noctalia KDE Connect
A Plugin integrating your mobile devices into a panel using KDEConnect
> [!IMPORTANT]
> Please submit any Pull Requests to https://github.com/WerWolv/noctalia-kde-connect and **NOT** to the noctalia-plugins repository!
## Features
- Support for multiple devices
- Panel to manage all devices
- Current battery charge and if the device is plugged in
- Mobile network connection state
- Number of notifications
- Wake up the device from the panel
- Browse files on the device
- Send files to the device
- Make the device ring
## Requirements
- `kdeconnectd` needs to be running which can be installed by setting up the official KDE Connect app
- In case it's not getting started by default, you might need to configure a systemd service for it
- Certain functionality will only work when enabling the right plugins on the device. Otherwise, they might not work or simply display "Unknown"
- The "Browse files" option mounts the device over SFTP using sshfs. Make sure you have `libfuse` and `sshfs` installed
- If clicking the button just opens the file browser without displaying anything, make sure you have the option enabled on your phone and that your file browser has permissions to access that path.
- If your file browser is sandboxed (e.g. when installed as a Flatpak or Snap), it's possible that it won't have access. Install it through the package manager instead
- On some systems kdeconnect's URL handler isn't configured properly and the button will instead just open your web browser
- In that case you can override the file handler by running `xdg-mime default org.kde.dolphin.desktop x-scheme-handler/kdeconnect`
@@ -0,0 +1,457 @@
pragma Singleton
import QtQuick
import Quickshell
import Quickshell.Io
import qs.Commons
QtObject {
id: root
property list<var> devices: []
property bool daemonAvailable: false
property int pendingDeviceCount: 0
property list<var> pendingDevices: []
property var mainDevice: null
property string mainDeviceId: ""
property string busctlCmd: ""
property bool anyDevicesConnected: false;
onDevicesChanged: {
setMainDevice(root.mainDeviceId)
}
Component.onCompleted: {
checkDaemon();
}
// Check if KDE Connect daemon is available
function checkDaemon(): void {
detectBusctlProc.running = true;
}
// Refresh the list of devices
function refreshDevices(): void {
getDevicesProc.running = true;
}
function setMainDevice(deviceId: string): void {
root.mainDeviceId = deviceId;
updateMainDevice(false);
}
function updateMainDevice(checkReachable) {
let newMain;
if (checkReachable) {
newMain = devices.find((device) => device.id === root.mainDeviceId && device.reachable);
if (newMain === undefined)
newMain = devices.find((device) => device.reachable);
if (newMain === undefined)
newMain = devices.length === 0 ? null : devices[0];
} else {
newMain = devices.find((device) => device.id === root.mainDeviceId);
if (newMain === undefined)
newMain = devices.length === 0 ? null : devices[0];
}
if (root.mainDevice !== newMain) {
root.mainDevice = newMain;
}
anyDevicesConnected = devices.find((device) => device.reachable) !== undefined;
}
function triggerFindMyPhone(deviceId: string): void {
const proc = findMyPhoneComponent.createObject(root, { deviceId: deviceId });
proc.running = true;
}
function browseFiles(deviceId: string): void {
const proc = browseFilesComponent.createObject(root, { deviceId: deviceId });
proc.running = true;
}
// Share a file with a device
function shareFile(deviceId: string, filePath: string): void {
var proc = shareComponent.createObject(root, {
deviceId: deviceId,
filePath: filePath
});
proc.running = true;
}
function requestPairing(deviceId: string): void {
const proc = requestPairingComponent.createObject(root, { deviceId: deviceId });
proc.running = true;
}
function unpairDevice(deviceId: string): void {
const proc = unpairingComponent.createObject(root, { deviceId: deviceId });
proc.running = true;
}
function wakeUpDevice(deviceId: string): void {
const proc = wakeUpDeviceComponent.createObject(root, { deviceId: deviceId });
proc.running = true;
}
function busctlCall(obj, itf, method, params = []) {
let result = [ root.busctlCmd, "--user", "call", "--json=short", "org.kde.kdeconnect", obj, itf, method ];
return result.concat(params);
}
function busctlGet(obj, itf, prop) {
return [ root.busctlCmd, "--user", "get-property", "--json=short", "org.kde.kdeconnect", obj, itf, prop ];
}
function busctlData(text) {
if (text === "")
return "";
try {
let result = JSON.parse(text)?.data;
if (Array.isArray(result) && Array.isArray(result[0]))
return result[0]
else
return result;
} catch (e) {
Logger.e("KDEConnect", "Failed to parse busctl response: ", text)
return null;
}
}
property Process detectBusctlProc: Process {
command: ["which", "busctl"]
stdout: StdioCollector {
onStreamFinished: {
if (root.busctlCmd !== "") {
root.daemonCheckProc.running = true
return
}
let location = text.trim()
if (location !== "") {
root.busctlCmd = location
root.daemonCheckProc.running = true
Logger.i("KDEConnect", "Found busctl command:", location)
}
}
}
}
// Check daemon
property Process daemonCheckProc: Process {
command: [root.busctlCmd, "--user", "status", "org.kde.kdeconnect"]
onExited: (exitCode, exitStatus) => {
root.daemonAvailable = exitCode == 0;
if (root.daemonAvailable) {
forceOnNetworkChange.running = true;
} else {
root.devices = []
root.mainDevice = null
}
}
}
property Process forceOnNetworkChange: Process {
command: busctlCall("/modules/kdeconnect", "org.kde.kdeconnect.daemon", "forceOnNetworkChange")
stdout: StdioCollector {
onStreamFinished: {
getDevicesProc.running = true;
}
}
}
// Get device list
property Process getDevicesProc: Process {
command: busctlCall("/modules/kdeconnect", "org.kde.kdeconnect.daemon", "devices")
stdout: StdioCollector {
onStreamFinished: {
const deviceIds = busctlData(text);
root.pendingDevices = [];
root.pendingDeviceCount = deviceIds.length;
deviceIds.forEach(deviceId => {
const loader = deviceLoaderComponent.createObject(root, { deviceId: deviceId });
loader.start();
});
}
}
}
// Component that loads all info for a single device
property Component deviceLoaderComponent: Component {
QtObject {
id: loader
property string deviceId: ""
property var deviceData: ({
id: deviceId,
name: "",
reachable: false,
paired: false,
pairRequested: false,
verificationKey: "",
charging: false,
battery: -1,
cellularNetworkType: "",
cellularNetworkStrength: -1,
notificationIds: []
})
function start() {
nameProc.running = true
}
property Process nameProc: Process {
command: busctlGet("/modules/kdeconnect/devices/" + loader.deviceId, "org.kde.kdeconnect.device", "name")
stdout: StdioCollector {
onStreamFinished: {
loader.deviceData.name = busctlData(text);
reachableProc.running = true;
}
}
}
property Process reachableProc: Process {
command: busctlGet("/modules/kdeconnect/devices/" + loader.deviceId, "org.kde.kdeconnect.device", "isReachable")
stdout: StdioCollector {
onStreamFinished: {
loader.deviceData.reachable = busctlData(text);
pairingRequestedProc.running = true;
}
}
}
property Process pairingRequestedProc: Process {
command: busctlGet("/modules/kdeconnect/devices/" + loader.deviceId, "org.kde.kdeconnect.device", "isPairRequested")
stdout: StdioCollector {
onStreamFinished: {
loader.deviceData.pairRequested = busctlData(text);
verificationKeyProc.running = true;
}
}
}
property Process verificationKeyProc: Process {
command: busctlGet("/modules/kdeconnect/devices/" + loader.deviceId, "org.kde.kdeconnect.device", "verificationKey")
stdout: StdioCollector {
onStreamFinished: {
loader.deviceData.verificationKey = busctlData(text);
pairedProc.running = true;
}
}
}
property Process pairedProc: Process {
command: busctlGet("/modules/kdeconnect/devices/" + loader.deviceId, "org.kde.kdeconnect.device", "isPaired")
stdout: StdioCollector {
onStreamFinished: {
loader.deviceData.paired = busctlData(text);
if (loader.deviceData.paired)
activeNotificationsProc.running = true;
else
finalize()
}
}
}
property Process activeNotificationsProc: Process {
command: busctlCall("/modules/kdeconnect/devices/" + loader.deviceId + "/notifications", "org.kde.kdeconnect.device.notifications", "activeNotifications");
stdout: StdioCollector {
onStreamFinished: {
let ids = busctlData(text);
loader.deviceData.notificationIds = ids
cellularNetworkTypeProc.running = true;
}
}
}
property Process cellularNetworkTypeProc: Process {
command: busctlGet("/modules/kdeconnect/devices/" + loader.deviceId + "/connectivity_report", "org.kde.kdeconnect.device.connectivity_report", "cellularNetworkType")
stdout: StdioCollector {
onStreamFinished: {
loader.deviceData.cellularNetworkType = busctlData(text);
cellularNetworkStrengthProc.running = true;
}
}
}
property Process cellularNetworkStrengthProc: Process {
command: busctlGet("/modules/kdeconnect/devices/" + loader.deviceId + "/connectivity_report", "org.kde.kdeconnect.device.connectivity_report", "cellularNetworkStrength")
stdout: StdioCollector {
onStreamFinished: {
const strength = busctlData(text);
loader.deviceData.cellularNetworkStrength = strength;
isChargingProc.running = true;
}
}
}
property Process isChargingProc: Process {
command: busctlGet("/modules/kdeconnect/devices/" + loader.deviceId + "/battery", "org.kde.kdeconnect.device.battery", "isCharging")
stdout: StdioCollector {
onStreamFinished: {
loader.deviceData.charging = busctlData(text);
batteryProc.running = true;
}
}
}
property Process batteryProc: Process {
command: busctlGet("/modules/kdeconnect/devices/" + loader.deviceId + "/battery", "org.kde.kdeconnect.device.battery", "charge")
stdout: StdioCollector {
onStreamFinished: {
const charge = busctlData(text);
if (!isNaN(charge)) {
loader.deviceData.battery = charge;
}
finalize();
}
}
}
function finalize() {
root.pendingDevices = root.pendingDevices.concat([loader.deviceData]);
if (root.pendingDevices.length === root.pendingDeviceCount) {
let newDevices = root.pendingDevices
newDevices.sort((a, b) => a.name.localeCompare(b.name))
let prevMainDevice = root.devices.find((device) => device.id === root.mainDeviceId);
let newMainDevice = newDevices.find((device) => device.id === root.mainDeviceId);
let deviceNotReachableAnymore =
prevMainDevice === undefined ||
(
(prevMainDevice?.reachable ?? false) &&
!(newMainDevice?.reachable ?? false)
) ||
(
(prevMainDevice?.paired ?? false) &&
!(newMainDevice?.paired ?? false)
)
root.devices = newDevices
root.pendingDevices = []
updateMainDevice(deviceNotReachableAnymore);
}
loader.destroy();
}
}
}
// FindMyPhone component
property Component findMyPhoneComponent: Component {
Process {
id: proc
property string deviceId: ""
command: busctlCall("/modules/kdeconnect/devices/" + deviceId + "/findmyphone", "org.kde.kdeconnect.device.findmyphone", "ring")
stdout: StdioCollector {
onStreamFinished: proc.destroy()
}
}
}
// SFTP Browse component
property Component browseFilesComponent: Component {
Process {
id: mountProc
property string deviceId: ""
command: busctlCall("/modules/kdeconnect/devices/" + deviceId + "/sftp", "org.kde.kdeconnect.device.sftp", "mountAndWait")
stdout: StdioCollector {
onStreamFinished: rootDirProc.running = true
}
property Process rootDirProc: Process {
command: busctlCall("/modules/kdeconnect/devices/" + mountProc.deviceId + "/sftp", "org.kde.kdeconnect.device.sftp", "getDirectories")
stdout: StdioCollector {
onStreamFinished: {
const dirs = busctlData(text);
const path = Object.keys(dirs[0])[0];
if (!Qt.openUrlExternally("file://" + path)) {
Logger.e("KDEConnect", "Failed to open file manager for path:", path);
}
mountProc.destroy();
}
}
}
}
}
// Request Pairing Component
property Component requestPairingComponent: Component {
Process {
id: proc
property string deviceId: ""
command: busctlCall("/modules/kdeconnect/devices/" + deviceId, "org.kde.kdeconnect.device", "requestPairing")
stdout: StdioCollector {
onStreamFinished: proc.destroy()
}
}
}
// Unpairing Component
property Component unpairingComponent: Component {
Process {
id: proc
property string deviceId: ""
command: busctlCall("/modules/kdeconnect/devices/" + deviceId, "org.kde.kdeconnect.device", "unpair")
stdout: StdioCollector {
onStreamFinished: {
KDEConnect.refreshDevices()
proc.destroy()
}
}
}
}
// Wake up Device Component
property Component wakeUpDeviceComponent: Component {
Process {
id: proc
property string deviceId: ""
command: busctlCall("/modules/kdeconnect/devices/" + deviceId + "/remotecontrol", "org.kde.kdeconnect.device.remotecontrol", "sendCommand", [ "a{sv}", "1", "singleclick", "b", "true" ])
stdout: StdioCollector {
onStreamFinished: {
KDEConnect.refreshDevices()
proc.destroy()
}
}
}
}
// Share file component
property Component shareComponent: Component {
Process {
id: proc
property string deviceId: ""
property string filePath: ""
command: busctlCall("/modules/kdeconnect/devices/" + deviceId + "/share", "org.kde.kdeconnect.device.share", "shareUrl", [ "file://" + filePath ])
stdout: StdioCollector {
onStreamFinished: {
proc.destroy()
}
}
}
}
// Periodic refresh timer
property Timer refreshTimer: Timer {
interval: 5000
running: true
repeat: true
onTriggered: root.checkDaemon()
}
}
@@ -0,0 +1,40 @@
pragma Singleton
import QtQuick
QtObject {
function getConnectionStateIcon(device, daemonAvailable) {
if (!daemonAvailable)
return "exclamation-circle";
if (device === null || !device.reachable)
return "device-mobile-off";
if (device.battery >= 0 && device.battery < 10)
return "device-mobile-exclamation"
if (device.notificationIds.length > 0)
return "device-mobile-message";
else if (device.charging)
return "device-mobile-bolt";
else
return "device-mobile";
}
// Returns raw state keys for translation
function getConnectionStateKey(device, daemonAvailable) {
if (!daemonAvailable)
return "control_center.state.unavailable";
if (device === null)
return "control_center.state.no-device";
if (!device.reachable)
return "control_center.state.disconnected";
if (!device.paired)
return "control_center.state.not-paired";
return "control_center.state.connected";
}
}
@@ -0,0 +1,2 @@
singleton KDEConnect 1.0 KDEConnect.qml
singleton KDEConnectUtils 1.0 KDEConnectUtils.qml
+44
View File
@@ -0,0 +1,44 @@
import QtQuick
import QtQuick.Layouts
import qs.Commons
import qs.Widgets
ColumnLayout {
id: root
property var pluginApi: null
property var cfg: pluginApi?.pluginSettings || ({})
property var defaults: pluginApi?.manifest?.metadata?.defaultSettings || ({})
property bool hideIfNoDeviceConnected: pluginApi?.mainInstance?.hideIfNoDeviceConnected ?? (pluginApi?.pluginSettings?.hideIfNoDeviceConnected ?? false)
spacing: Style.marginL
ColumnLayout {
spacing: Style.marginM
Layout.fillWidth: true
NToggle {
label: pluginApi?.tr("settings.no-device-connected-hide.label")
description: pluginApi?.tr("settings.no-device-connected-hide.description")
checked: root.hideIfNoDeviceConnected
onToggled: function(checked) {
root.hideIfNoDeviceConnected = checked
}
}
}
function saveSettings() {
if (!pluginApi) {
Logger.e("KDEConnect", "Cannot save settings: pluginApi is null");
return;
}
pluginApi.pluginSettings.hideIfNoDeviceConnected = root.hideIfNoDeviceConnected;
pluginApi.saveSettings();
Logger.d("KDEConnect", "Settings saved successfully");
}
}
+55
View File
@@ -0,0 +1,55 @@
{
"panel": {
"title": "Verbundene Geräte",
"signal": {
"very-weak": "Sehr schwach",
"weak": "Schwach",
"fair": "Okay",
"good": "Gut",
"excellent": "Ausgezeichnet"
},
"unknown": "Unbekannt",
"card": {
"battery": "Akkustand",
"network": "Netzwerk",
"signal-strength": "Signalstärke",
"notifications": "Benachrichtigungen"
},
"other-devices": "Andere Geräte",
"send-file-picker": "Datei zum Senden an Gerät auswählen",
"send-file": "Datei senden",
"browse-files": "Dateien auf Gerät durchsuchen",
"find-device": "Mein Gerät suchen",
"pair": "Mit Gerät koppeln",
"unpair": "Gerät entkoppeln",
"kdeconnect-error": {
"no-devices": "Kein Gerät mit KDE Connect gefunden",
"unavailable-title": "kdeconnectd scheint nicht zu laufen!",
"unavailable-desc": "Sicherstellen, dass die KDE Connect-Anwendung auf Ihrem System installiert ist und dass der kdeconnectd-Daemon gestartet wurde",
"device-unavailable": "Das Gerät ist derzeit nicht verfügbar."
},
"busctl-error": {
"unavailable-title": "busctl kann nicht gefunden werden!",
"unavailable-desc": "Stelle sicher, dass busctl (teil von systemd) auf deinem System installiert ist"
}
},
"bar": {
"tooltip": "Verbundene Geräte"
},
"control_center": {
"state-label": "Status",
"state": {
"connected": "Verbunden",
"disconnected": "Getrennt",
"unavailable": "Nicht verfügbar",
"no-device": "Kein Gerät",
"not-paired": "Nicht gekoppelt"
}
},
"settings": {
"no-device-connected-hide": {
"label": "Verstecken wenn nicht verbunden",
"description": "Verstecke den Knopf in der Leiste, wenn kein Gerät verbunden ist"
}
}
}
+55
View File
@@ -0,0 +1,55 @@
{
"panel": {
"title": "Connected Devices",
"signal": {
"very-weak": "Very Weak",
"weak": "Weak",
"fair": "Fair",
"good": "Good",
"excellent": "Excellent"
},
"unknown": "Unknown",
"card": {
"battery": "Battery",
"network": "Network",
"signal-strength": "Signal Strength",
"notifications": "Notifications"
},
"other-devices": "Other Devices",
"send-file-picker": "Pick file to send to device",
"send-file": "Send File",
"browse-device": "Browse Device Files",
"find-device": "Find my Device",
"pair": "Pair with Device",
"unpair": "Unpair Device",
"kdeconnect-error": {
"no-devices": "No device running KDE Connect found",
"unavailable-title": "kdeconnectd does not seem to be running!",
"unavailable-desc": "Make sure you've installed the KDE Connect Application on your system and that it has started the kdeconnectd daemon",
"device-unavailable": "Device is currently unavailable"
},
"busctl-error": {
"unavailable-title": "busctl cannot be found!",
"unavailable-desc": "Make sure busctl (part of systemd) is installed on your system"
}
},
"bar": {
"tooltip": "Connected Devices"
},
"control_center": {
"state-label": "State",
"state": {
"connected": "Connected",
"disconnected": "Disconnected",
"unavailable": "Unavailable",
"no-device": "No device",
"not-paired": "Not paired"
}
},
"settings": {
"no-device-connected-hide": {
"label": "Hide if unavailable",
"description": "Hide the bar button entirely if no device is connected"
}
}
}
+44
View File
@@ -0,0 +1,44 @@
{
"panel": {
"title": "Appareils connectés",
"signal": {
"very-weak": "Très faible",
"weak": "Faible",
"fair": "Moyen",
"good": "Bon",
"excellent": "Excellent"
},
"unknown": "Inconnu",
"card": {
"battery": "Batterie",
"network": "Réseau",
"signal-strength": "Force du signal",
"notifications": "Notifications"
},
"other-devices": "Autres appareils",
"send-file-picker": "Choisir un fichier à envoyer à l'appareil",
"send-file": "Envoyer un fichier",
"find-device": "Trouver mon appareil",
"pair": "Coupler avec l'appareil",
"unpair": "Découpler l'appareil",
"kdeconnect-error": {
"no-devices": "Aucun appareil exécutant KDE Connect trouvé",
"unavailable-title": "kdeconnectd ne semble pas être en cours d'exécution !",
"unavailable-desc": "Assurez-vous d'avoir installé l'application KDE Connect sur votre système et qu'elle a démarré le démon kdeconnectd",
"device-unavailable": "L'appareil est actuellement indisponible"
}
},
"bar": {
"tooltip": "Appareils connectés"
},
"control_center": {
"state-label": "État",
"state": {
"connected": "Connecté",
"disconnected": "Déconnecté",
"unavailable": "Indisponible",
"no-device": "Aucun appareil",
"not-paired": "Non couplé"
}
}
}
+48
View File
@@ -0,0 +1,48 @@
{
"panel": {
"title": "Dispositivos Conectados",
"signal": {
"very-weak": "Muito Fraco",
"weak": "Fraco",
"fair": "Justo",
"good": "Bom",
"excellent": "Excelente"
},
"unknown": "Desconhecido",
"card": {
"battery": "Bateria",
"network": "Rede",
"signal-strength": "Intensidade do Signal",
"notifications": "Notificações"
},
"other-devices": "Outros Dispositivos",
"send-file-picker": "Selecione o arquivo para enviar ao dispositivo",
"send-file": "Enviar Arquivo",
"find-device": "Encontrar meu Dispositivo",
"pair": "Emparelhar meu Dispositivo",
"unpair": "Desemparelhar meu dispositivo",
"kdeconnect-error": {
"no-devices": "Nenhum dispositivo executando o KDE Connect encontrado",
"unavailable-title": "O kdeconnectd parece não estar em execução!",
"unavailable-desc": "Certifique-se de ter instalado o aplicativo KDE Connect em seu sistema e de que o daemon kdeconnectd esteja em execução",
"device-unavailable": "O dispositivo está indisponível no momento"
},
"busctl-error": {
"unavailable-title": "O busctl não foi encontrado!",
"unavailable-desc": "Certifique-se de que o busctl esteja instalado em seu sistema"
}
},
"bar": {
"tooltip": "Dispositivos conectados"
},
"control_center": {
"state-label": "Estado",
"state": {
"connected": "Conectado",
"disconnected": "Desconectado",
"unavailable": "Indisponível",
"no-device": "Nenhum dispositivo",
"not-paired": "Não pareado"
}
}
}
+49
View File
@@ -0,0 +1,49 @@
{
"panel": {
"title": "Подключённые устройства",
"signal": {
"very-weak": "Очень слабое",
"weak": "Слабое",
"fair": "Среднее",
"good": "Хорошее",
"excellent": "Отличное"
},
"unknown": "Неизвестно",
"card": {
"battery": "Батарея",
"network": "Сеть",
"signal-strength": "Качество сигнала",
"notifications": "Уведомления"
},
"other-devices": "Другие устройства",
"send-file-picker": "Выберите файл для отправки на устройство",
"send-file": "Отправить файл",
"browse-device": "Просмотреть файлы на устройстве",
"find-device": "Найти моё устройство",
"pair": "Сопрячь устройство",
"unpair": "Разорвать сопряжение",
"kdeconnect-error": {
"no-devices": "Устройства с KDE Connect не обнаружены",
"unavailable-title": "Похоже, kdeconnectd не запущен!",
"unavailable-desc": "Убедитесь, что KDE Connect установлен в системе и служба kdeconnectd работает.",
"device-unavailable": "Устройство сейчас недоступно"
},
"busctl-error": {
"unavailable-title": "Не удаётся найти busctl!",
"unavailable-desc": "Убедитесь, что busctl установлен в вашей системе"
}
},
"bar": {
"tooltip": "Подключённые устройства"
},
"control_center": {
"state-label": "Статус",
"state": {
"connected": "Подключено",
"disconnected": "Не подключено",
"unavailable": "Недоступно",
"no-device": "Нет устройства",
"not-paired": "Нет сопряжения"
}
}
}
@@ -0,0 +1,30 @@
{
"id": "kde-connect",
"name": "KDE Connect",
"version": "1.2.1",
"minNoctaliaVersion": "4.4.0",
"author": "WerWolv",
"official": false,
"license": "GPLv2",
"repository": "https://github.com/WerWolv/noctalia-kde-connect",
"description": "A Plugin integrating your mobile devices into a panel using KDEConnect",
"tags": [
"Bar",
"Panel",
"Utility",
"System"
],
"entryPoints": {
"main": "Main.qml",
"barWidget": "BarWidget.qml",
"controlCenterWidget": "ControlCenterWidget.qml",
"panel": "Panel.qml",
"settings": "Settings.qml"
},
"dependencies": {
"plugins": []
},
"metadata": {
"defaultSettings": {}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 480 KiB