Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
korapp committed Sep 4, 2023
0 parents commit 4552a94
Show file tree
Hide file tree
Showing 16 changed files with 1,295 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ko_fi: korapp
liberapay: korapp
custom: ["revolut.me/korapp"]
62 changes: 62 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: "Release"
on:
push:
branches:
- master

jobs:
bump:
name: "Bump"
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
new_version: ${{ steps.tag_version.outputs.new_version }}
new_tag: ${{ steps.tag_version.outputs.new_tag }}
changelog: ${{ steps.tag_version.outputs.changelog }}
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Bump version and push tag
id: tag_version
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
default_bump: false

release:
name: "Release"
needs: bump
runs-on: ubuntu-latest
permissions:
contents: write
if: ${{ needs.bump.outputs.new_tag != null }}
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set env
run: |
echo "ASSET_DIR=package" >> $GITHUB_ENV
echo "ASSET_BASE_NAME=${{ github.event.repository.name }}" >> $GITHUB_ENV
echo "RELEASE_VERSION=${{ needs.bump.outputs.new_version }}" >> $GITHUB_ENV
echo "RELEASE_VERSION_TAG=${{ needs.bump.outputs.new_tag }}" >> $GITHUB_ENV
# Sets new X-KDE-PluginInfo-Version in metadata.json
- name: Update plasmoid version
run: echo "`jq '.KPlugin.Version="'$RELEASE_VERSION'"' $ASSET_DIR/metadata.json`" > $ASSET_DIR/metadata.json

# Creates plasmoid package
- name: Package
run: |
cd $ASSET_DIR
zip -r ../$ASSET_BASE_NAME-$RELEASE_VERSION.plasmoid *
cd ..
- uses: ncipollo/release-action@v1
with:
artifacts: "*.plasmoid"
tag: ${{ env.RELEASE_VERSION_TAG }}
body: ${{ needs.bump.outputs.changelog }}
token: ${{ secrets.GITHUB_TOKEN }}
23 changes: 23 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Close inactive issues
on:
schedule:
- cron: "* * */7 * *"

jobs:
close-issues:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/stale@v8
with:
days-before-issue-stale: 30
days-before-issue-close: 14
stale-issue-label: "stale"
stale-issue-message: "This issue is stale because it has been open for 30 days with no activity."
close-issue-message: "This issue was closed because it has been inactive for 14 days since being marked as stale."
any-of-issue-labels: "question"
days-before-pr-stale: -1
days-before-pr-close: -1
repo-token: ${{ secrets.GITHUB_TOKEN }}
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

68 changes: 68 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Cloudflare WARP Plasmoid

[![plasma](https://img.shields.io/static/v1?message=KDE%20Store&color=54a3d8&logo=kde&logoColor=FFFFFF&label=)][kdestore]
[![downloads](https://img.shields.io/github/downloads/korapp/plasma-cloudflare-warp/total)][releases]
[![release](https://img.shields.io/github/v/release/korapp/plasma-cloudflare-warp)][releases]

Plasmoid for the official [Cloudflare WARP client][warp].

![Plasmoid preview](preview.png)

## Features

* Connection status information as the icon color and a tooltip
* Quick connect/disconnect by middle click on the icon
* Connection stats after expand
* Status change notifications

## Requirements

* [Cloudflare WARP][warp]
* Qt >= 5.14, KDE Frameworks >= 5.73, KDE Plasma >= 5.19 (Kubuntu 20.10 and newer)

## Installation

The preferred and easiest way to install is to use Plasma Discover or KDE Get New Stuff and search for *Cloudflare WARP*.

### From file

Download the latest version of plasmoid from [KDE Store][kdestore] or [release page][releases]

#### A) Plasma UI

1. Right click on panel or desktop
2. Select *Add Widgets > Get New Widgets > Install From Local File*
3. Choose downloaded plasmoid file

#### B) Terminal

```sh
plasmapkg2 -i plasma-cloudflare-warp-*.plasmoid
```

### From GitHub

Clone repository and go to the project directory

```sh
git clone https://github.com/korapp/plasma-cloudflare-warp.git
cd plasma-cloudflare-warp
```

Install

```sh
plasmapkg2 -i package
```

## Support

Say thank you with coffee ☕ if you'd like.

[![liberapay](https://liberapay.com/assets/widgets/donate.svg)](https://liberapay.com/korapp/donate)
[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/korapp)
[<img src="https://img.shields.io/badge/Revolut-white?logo=Revolut&logoColor=black" height="30"/>](https://revolut.me/korapp)

[kdestore]: https://store.kde.org/p/2081104/
[releases]: https://github.com/korapp/plasma-cloudflare-warp/releases
[warp]: https://developers.cloudflare.com/cloudflare-one/connections/connect-devices/warp/download-warp/#linux
10 changes: 10 additions & 0 deletions package/contents/config/config.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import QtQuick 2.0
import org.kde.plasma.configuration 2.0

ConfigModel {
ConfigCategory {
name: i18n("General")
icon: "preferences-desktop-plasma"
source: "ConfigGeneral.qml"
}
}
19 changes: 19 additions & 0 deletions package/contents/config/main.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name=""/>

<group name="General">
<entry name="toggleConnectionOnMiddleButton" type="Bool">
<default>true</default>
</entry>
<entry name="showNotifications" type="Bool">
<default>true</default>
</entry>
<entry name="hideWhenDisconnected" type="Bool">
<default>false</default>
</entry>
</group>
</kcfg>
36 changes: 36 additions & 0 deletions package/contents/ui/CompactRepresentation.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import QtQuick 2.0

import org.kde.plasma.core 2.0 as PlasmaCore

Icon {
source: plasmoid.icon
active: mouseArea.containsMouse
opacity: client.isConnected ? 1 : 0.5

MouseArea {
id: mouseArea
hoverEnabled: true
acceptedButtons: Qt.LeftButton | Qt.MiddleButton
anchors.fill: parent

onClicked: {
if (plasmoid.configuration.toggleConnectionOnMiddleButton && mouse.button === Qt.MiddleButton) {
toggleConnection()
} else {
toggleExpanded()
}
}
}

function toggleConnection() {
client.isConnected ? client.disconnect() : client.connect()
}

function toggleExpanded() {
plasmoid.expanded = !plasmoid.expanded
}

Accessible.name: plasmoid.title
Accessible.description: plasmoid.toolTipSubText
Accessible.role: Accessible.Button
}
25 changes: 25 additions & 0 deletions package/contents/ui/ConfigGeneral.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import QtQuick 2.0
import QtQuick.Controls 2.0

import org.kde.kirigami 2.3 as Kirigami

Kirigami.FormLayout {
property alias cfg_toggleConnectionOnMiddleButton: toggleConnectionOnMiddleButton.checked
property alias cfg_hideWhenDisconnected: hideWhenDisconnected.checked
property alias cfg_showNotifications: showNotifications.checked

CheckBox {
id: toggleConnectionOnMiddleButton
Kirigami.FormData.label: i18n("Toggle connection on middle mouse button")
}

CheckBox {
id: hideWhenDisconnected
Kirigami.FormData.label: i18n("Hide icon when disconnected")
}

CheckBox {
id: showNotifications
Kirigami.FormData.label: i18n("Show notifications")
}
}
55 changes: 55 additions & 0 deletions package/contents/ui/DetailsText.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import QtQuick 2.0

import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 3.0 as PlasmaComponents3

Column {
property alias model: repeater.model

Repeater {
id: repeater
property int contentHeight: 0
property int longestString: 0

Item {
anchors {
left: parent.left
right: parent.right
}
height: Math.max(detailNameLabel.height, detailValueLabel.height)

PlasmaComponents3.Label {
id: detailNameLabel

anchors {
left: parent.left
leftMargin: repeater.longestString - paintedWidth + Math.round(PlasmaCore.Units.gridUnit / 2)
}

horizontalAlignment: Text.AlignRight
text: modelData[0] + ": "
opacity: 0.6

Component.onCompleted: {
if (paintedWidth > repeater.longestString) {
repeater.longestString = paintedWidth
}
}
}

PlasmaComponents3.Label {
id: detailValueLabel

anchors {
left: parent.left
right: parent.right
leftMargin: repeater.longestString + Math.round(PlasmaCore.Units.gridUnit / 2)
}

elide: Text.ElideRight
text: modelData[1]
textFormat: Text.PlainText
}
}
}
}
62 changes: 62 additions & 0 deletions package/contents/ui/FullRepresentation.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import QtQuick 2.0
import QtQuick.Layouts 1.0

import org.kde.plasma.components 3.0 as PlasmaComponents3
import org.kde.plasma.extras 2.0 as PlasmaExtras
import org.kde.plasma.core 2.0 as PlasmaCore

PlasmaComponents3.Page {
readonly property var appletInterface: plasmoid.self

readonly property string mainText: client.status || client.errorMessage
readonly property string icon: client.errorMessage ? "error" : plasmoid.icon

Layout.preferredWidth: PlasmaCore.Units.gridUnit * 24
Layout.preferredHeight: PlasmaCore.Units.gridUnit * 24

ColumnLayout {
spacing: PlasmaCore.Units.largeSpacing
width: parent.width
enabled: !client.isBusy
anchors.centerIn: parent

Icon {
opacity: 0.5
source: icon
readonly property int size: Math.round(PlasmaCore.Units.iconSizes.huge * 1.5)
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: size
Layout.preferredHeight: size
}

PlasmaExtras.Heading {
text: mainText
type: PlasmaExtras.Heading.Primary
horizontalAlignment: Qt.AlignHCenter
wrapMode: Text.WordWrap
Layout.fillWidth: true
}

DetailsText {
id: details
visible: client.isConnected
model: client.stats
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: 300
Layout.maximumWidth: parent.width
}

PlasmaComponents3.Button {
action: client.isConnected ? actionDisconnect : actionConnect
visible: client.isServiceRunning
Layout.alignment: Qt.AlignHCenter
Layout.topMargin: PlasmaCore.Units.gridUnit
}
}

PlasmaComponents3.BusyIndicator {
running: client.isBusy
visible: running
anchors.centerIn: parent
}
}
Loading

0 comments on commit 4552a94

Please sign in to comment.