Compare commits

...

13 Commits

Author SHA1 Message Date
Krishan
6f83708511 Release v3.2.1 2023-11-01 21:53:00 +11:00
Andrew Davidson
a63365b6b9 fixing directory path in README.md (#228)
the path in the build instructions was not quite correct.
2023-11-01 21:44:12 +11:00
renovate[bot]
c4a79926c7 fix(deps): update rust crate serde_json to 1.0.108 (#231)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-11-01 21:43:01 +11:00
renovate[bot]
64f2ce11a4 chore(deps): update tauri-apps/tauri-action action to v0.4.4 (#232)
* chore(deps): update tauri-apps/tauri-action action to v0.4.4

* Update tauri.yml

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Krishan <33421343+kfiven@users.noreply.github.com>
2023-11-01 21:41:53 +11:00
renovate[bot]
226f65b0e4 fix(deps): update rust crate serde to 1.0.190 (#230)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-11-01 21:40:30 +11:00
Krishan
3c22636bdf Release v3.2.0 2023-10-31 21:25:27 +11:00
renovate[bot]
e9c6369b2b fix(deps): update tauri monorepo (#219)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-27 23:06:48 +11:00
Krishan
32e9805abd Release v3.1.0 2023-10-27 22:18:42 +11:00
Krishan
ecb6984b2f Merge branch 'main' of https://github.com/cinnyapp/cinny-desktop 2023-10-21 22:04:21 +11:00
Krishan
2a4d7da8df Release v3.0.0 2023-10-21 22:04:11 +11:00
StevenDoesStuffs
095b8fc561 Add system tray support (#166)
* Added sytem tray with hide/show buttons

* Split tray into separate module

* Fix persistent console window

* Show/hide window on tray icon click

---------

Co-authored-by: serxka <serxka@protonmail.com>
Co-authored-by: Milo <40355097+serxka@users.noreply.github.com>
Co-authored-by: greentore <117551249+greentore@users.noreply.github.com>
2023-10-21 21:34:32 +11:00
dependabot[bot]
ba8d255eb7 Bump actions/checkout from 3.3.0 to 3.5.3 (#169)
Bumps [actions/checkout](https://github.com/actions/checkout) from 3.3.0 to 3.5.3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3.3.0...v3.5.3)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-13 09:31:40 +10:00
dependabot[bot]
aaf1ca4772 Bump cla-assistant/github-action from 2.2.1 to 2.3.0 (#144)
Bumps [cla-assistant/github-action](https://github.com/cla-assistant/github-action) from 2.2.1 to 2.3.0.
- [Release notes](https://github.com/cla-assistant/github-action/releases)
- [Commits](https://github.com/cla-assistant/github-action/compare/v2.2.1...v2.3.0)

---
updated-dependencies:
- dependency-name: cla-assistant/github-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-12 21:41:19 +10:00
14 changed files with 1571 additions and 271 deletions

View File

@@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3.3.0
uses: actions/checkout@v3.5.3
with:
submodules: true
- name: Create zip including submodules

View File

@@ -12,7 +12,7 @@ jobs:
- name: 'CLA Assistant'
if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have read the CLA Document and I hereby sign the CLA') || github.event_name == 'pull_request_target'
# Beta Release
uses: cla-assistant/github-action@v2.2.1
uses: cla-assistant/github-action@v2.3.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# the below token should have repo scope and must be manually added by you in the repository's secret

View File

@@ -14,7 +14,7 @@ jobs:
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v3.3.0
uses: actions/checkout@v3.5.3
- name: NPM Lockfile Changes
uses: codepunkt/npm-lockfile-changes@b40543471c36394409466fdb277a73a0856d7891
with:

View File

@@ -9,7 +9,7 @@ jobs:
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3.3.0
uses: actions/checkout@v3.5.3
with:
submodules: true
- name: Get release
@@ -31,7 +31,7 @@ jobs:
- name: Install tauri dependencies
run: npm ci
- name: Build desktop app with Tauri
uses: tauri-apps/tauri-action@v0.3.1
uses: tauri-apps/tauri-action@v0.4.4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
@@ -70,7 +70,7 @@ jobs:
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@v3.3.0
uses: actions/checkout@v3.5.3
with:
submodules: true
- name: Get release
@@ -90,13 +90,13 @@ jobs:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf
- name: Install cinny dependencies
run: cd cinny && npm ci
- name: Install tauri dependencies
run: npm ci
- name: Build desktop app with Tauri
uses: tauri-apps/tauri-action@v0.3.1
uses: tauri-apps/tauri-action@v0.4.4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
@@ -129,7 +129,7 @@ jobs:
runs-on: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3.3.0
uses: actions/checkout@v3.5.3
with:
submodules: true
- name: Get release
@@ -151,7 +151,7 @@ jobs:
- name: Install tauri dependencies
run: npm ci
- name: Build desktop app with Tauri
uses: tauri-apps/tauri-action@v0.3.1
uses: tauri-apps/tauri-action@v0.4.4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
@@ -181,7 +181,7 @@ jobs:
# runs-on: macos-12
# steps:
# - name: Checkout repository
# uses: actions/checkout@v3.3.0
# uses: actions/checkout@v3.5.3
# with:
# submodules: true
# - name: Get release
@@ -243,7 +243,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3.3.0
uses: actions/checkout@v3.5.3
- name: Install dependencies
run: npm ci
- name: Run release.json

View File

@@ -13,7 +13,7 @@ jobs:
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout repository
uses: actions/checkout@v3.3.0
uses: actions/checkout@v3.5.3
with:
submodules: true
- name: Setup node
@@ -35,6 +35,6 @@ jobs:
- name: Install tauri dependencies
run: npm ci
- name: Build desktop app with Tauri
uses: tauri-apps/tauri-action@v0.3.1
uses: tauri-apps/tauri-action@v0.4.4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -27,7 +27,7 @@ Firstly, to setup Rust, NodeJS and build tools follow [Tauri documentation](http
Now, to setup development locally run the following commands:
* `git clone --recursive https://github.com/cinnyapp/cinny-desktop.git`
* `cd cinny`
* `cd cinny-desktop/cinny`
* `npm ci`
* `cd ..`
* `npm ci`

2
cinny

Submodule cinny updated: f6694031a1...9ecb233763

109
package-lock.json generated
View File

@@ -1,19 +1,19 @@
{
"name": "cinny",
"version": "2.2.6",
"version": "3.2.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "cinny",
"version": "2.2.6",
"version": "3.2.1",
"license": "AGPL-3.0-only",
"dependencies": {
"@tauri-apps/api": "1.2.0"
"@tauri-apps/api": "1.5.1"
},
"devDependencies": {
"@actions/github": "5.1.1",
"@tauri-apps/cli": "1.2.2",
"@tauri-apps/cli": "1.5.6",
"node-fetch": "3.3.0"
},
"engines": {
@@ -173,9 +173,9 @@
}
},
"node_modules/@tauri-apps/api": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@tauri-apps/api/-/api-1.2.0.tgz",
"integrity": "sha512-lsI54KI6HGf7VImuf/T9pnoejfgkNoXveP14pVV7XarrQ46rOejIVJLFqHI9sRReJMGdh2YuCoI3cc/yCWCsrw==",
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/@tauri-apps/api/-/api-1.5.1.tgz",
"integrity": "sha512-6unsZDOdlXTmauU3NhWhn+Cx0rODV+rvNvTdvolE5Kls5ybA6cqndQENDt1+FS0tF7ozCP66jwWoH6a5h90BrA==",
"engines": {
"node": ">= 14.6.0",
"npm": ">= 6.6.0",
@@ -187,9 +187,9 @@
}
},
"node_modules/@tauri-apps/cli": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/@tauri-apps/cli/-/cli-1.2.2.tgz",
"integrity": "sha512-D8zib3A0vWCvPPSyYLxww/OdDlVcY7fpcDVBH6qUvheOjj2aCyU7H9AYMRBwpgCfz8zY5+vomee+laLeB0H13w==",
"version": "1.5.6",
"resolved": "https://registry.npmjs.org/@tauri-apps/cli/-/cli-1.5.6.tgz",
"integrity": "sha512-k4Y19oVCnt7WZb2TnDzLqfs7o98Jq0tUoVMv+JQSzuRDJqaVu2xMBZ8dYplEn+EccdR5SOMyzaLBJWu38TVK1A==",
"dev": true,
"bin": {
"tauri": "tauri.js"
@@ -202,21 +202,22 @@
"url": "https://opencollective.com/tauri"
},
"optionalDependencies": {
"@tauri-apps/cli-darwin-arm64": "1.2.2",
"@tauri-apps/cli-darwin-x64": "1.2.2",
"@tauri-apps/cli-linux-arm-gnueabihf": "1.2.2",
"@tauri-apps/cli-linux-arm64-gnu": "1.2.2",
"@tauri-apps/cli-linux-arm64-musl": "1.2.2",
"@tauri-apps/cli-linux-x64-gnu": "1.2.2",
"@tauri-apps/cli-linux-x64-musl": "1.2.2",
"@tauri-apps/cli-win32-ia32-msvc": "1.2.2",
"@tauri-apps/cli-win32-x64-msvc": "1.2.2"
"@tauri-apps/cli-darwin-arm64": "1.5.6",
"@tauri-apps/cli-darwin-x64": "1.5.6",
"@tauri-apps/cli-linux-arm-gnueabihf": "1.5.6",
"@tauri-apps/cli-linux-arm64-gnu": "1.5.6",
"@tauri-apps/cli-linux-arm64-musl": "1.5.6",
"@tauri-apps/cli-linux-x64-gnu": "1.5.6",
"@tauri-apps/cli-linux-x64-musl": "1.5.6",
"@tauri-apps/cli-win32-arm64-msvc": "1.5.6",
"@tauri-apps/cli-win32-ia32-msvc": "1.5.6",
"@tauri-apps/cli-win32-x64-msvc": "1.5.6"
}
},
"node_modules/@tauri-apps/cli-darwin-arm64": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-darwin-arm64/-/cli-darwin-arm64-1.2.2.tgz",
"integrity": "sha512-W+Cp2weUMlvmGkRJeUjypbz9Lpl6o98xkgKAtobZSum5SNwpsBQfawJTESakNoD+FXyVg/snIk5sRdHge+tAaA==",
"version": "1.5.6",
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-darwin-arm64/-/cli-darwin-arm64-1.5.6.tgz",
"integrity": "sha512-NNvG3XLtciCMsBahbDNUEvq184VZmOveTGOuy0So2R33b/6FDkuWaSgWZsR1mISpOuP034htQYW0VITCLelfqg==",
"cpu": [
"arm64"
],
@@ -230,9 +231,9 @@
}
},
"node_modules/@tauri-apps/cli-darwin-x64": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-darwin-x64/-/cli-darwin-x64-1.2.2.tgz",
"integrity": "sha512-vmVAqt+ECH2d6cbcGJ7ddcCAZgmKe5xmxlL5r4xoaphu7OqU4gnv4VFURYkVltOfwzIFQVOPVSqwYyIDToCYNQ==",
"version": "1.5.6",
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-darwin-x64/-/cli-darwin-x64-1.5.6.tgz",
"integrity": "sha512-nkiqmtUQw3N1j4WoVjv81q6zWuZFhBLya/RNGUL94oafORloOZoSY0uTZJAoeieb3Y1YK0rCHSDl02MyV2Fi4A==",
"cpu": [
"x64"
],
@@ -246,9 +247,9 @@
}
},
"node_modules/@tauri-apps/cli-linux-arm-gnueabihf": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-arm-gnueabihf/-/cli-linux-arm-gnueabihf-1.2.2.tgz",
"integrity": "sha512-yYTdQurgi4QZR8z+fANjl522jdQz/VtesFpw+C/A0+zXg7tiRjicsywBDdPsvNzCqFeGKKkmTR+Lny5qxhGaeQ==",
"version": "1.5.6",
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-arm-gnueabihf/-/cli-linux-arm-gnueabihf-1.5.6.tgz",
"integrity": "sha512-z6SPx+axZexmWXTIVPNs4Tg7FtvdJl9EKxYN6JPjOmDZcqA13iyqWBQal2DA/GMZ1Xqo3vyJf6EoEaKaliymPQ==",
"cpu": [
"arm"
],
@@ -262,9 +263,9 @@
}
},
"node_modules/@tauri-apps/cli-linux-arm64-gnu": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-arm64-gnu/-/cli-linux-arm64-gnu-1.2.2.tgz",
"integrity": "sha512-ZSOVT6Eq1ay2+27B8KfA0MnpO7KYzONU6TjenH7DNcQki6eWGG5JoNu8QQ9Mdn3dAzY0XBP9i1ZHQOFu4iPtEg==",
"version": "1.5.6",
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-arm64-gnu/-/cli-linux-arm64-gnu-1.5.6.tgz",
"integrity": "sha512-QuQjMQmpsCbzBrmtQiG4uhnfAbdFx3nzm+9LtqjuZlurc12+Mj5MTgqQ3AOwQedH3f7C+KlvbqD2AdXpwTg7VA==",
"cpu": [
"arm64"
],
@@ -278,9 +279,9 @@
}
},
"node_modules/@tauri-apps/cli-linux-arm64-musl": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-arm64-musl/-/cli-linux-arm64-musl-1.2.2.tgz",
"integrity": "sha512-/NHSkqNQ+Pr4PshvyD1CeNFaPCaCpe1OeuAQgVi0rboSecC9fXN96G5dQbSBoxOUcCo6f8aTVE7zkZ4WchFVog==",
"version": "1.5.6",
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-arm64-musl/-/cli-linux-arm64-musl-1.5.6.tgz",
"integrity": "sha512-8j5dH3odweFeom7bRGlfzDApWVOT4jIq8/214Wl+JeiNVehouIBo9lZGeghZBH3XKFRwEvU23i7sRVjuh2s8mg==",
"cpu": [
"arm64"
],
@@ -294,9 +295,9 @@
}
},
"node_modules/@tauri-apps/cli-linux-x64-gnu": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-x64-gnu/-/cli-linux-x64-gnu-1.2.2.tgz",
"integrity": "sha512-4YTmfPuyvlHsvCkATDMwhklfuQm3HKxYXv/IOW9H0ra6pS9efVhrFYIC9Vfv6XaKN85Vnn/FYTEGMJLwCxZw2Q==",
"version": "1.5.6",
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-x64-gnu/-/cli-linux-x64-gnu-1.5.6.tgz",
"integrity": "sha512-gbFHYHfdEGW0ffk8SigDsoXks6USpilF6wR0nqB/JbWzbzFR/sBuLVNQlJl1RKNakyJHu+lsFxGy0fcTdoX8xA==",
"cpu": [
"x64"
],
@@ -310,9 +311,9 @@
}
},
"node_modules/@tauri-apps/cli-linux-x64-musl": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-x64-musl/-/cli-linux-x64-musl-1.2.2.tgz",
"integrity": "sha512-wr46tbscwFuCcA931R+ItOiUTT0djMmgKLd1HFCmFF82V9BKE2reIjr6O9l0NCXCo2WeD4pe3jA/Pt1dxDu+JA==",
"version": "1.5.6",
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-x64-musl/-/cli-linux-x64-musl-1.5.6.tgz",
"integrity": "sha512-9v688ogoLkeFYQNgqiSErfhTreLUd8B3prIBSYUt+x4+5Kcw91zWvIh+VSxL1n3KCGGsM7cuXhkGPaxwlEh1ug==",
"cpu": [
"x64"
],
@@ -325,10 +326,26 @@
"node": ">= 10"
}
},
"node_modules/@tauri-apps/cli-win32-arm64-msvc": {
"version": "1.5.6",
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-win32-arm64-msvc/-/cli-win32-arm64-msvc-1.5.6.tgz",
"integrity": "sha512-DRNDXFNZb6y5IZrw+lhTTA9l4wbzO4TNRBAlHAiXUrH+pRFZ/ZJtv5WEuAj9ocVSahVw2NaK5Yaold4NPAxHog==",
"cpu": [
"arm64"
],
"dev": true,
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">= 10"
}
},
"node_modules/@tauri-apps/cli-win32-ia32-msvc": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-win32-ia32-msvc/-/cli-win32-ia32-msvc-1.2.2.tgz",
"integrity": "sha512-6VmbVJOWUZJK5/JKhb3mNFKrKGfq0KV7lJGumfN95WJgkHeyL61p8bZit+o6ZgUGUhrOabkAawhDkrRY+ZQhIw==",
"version": "1.5.6",
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-win32-ia32-msvc/-/cli-win32-ia32-msvc-1.5.6.tgz",
"integrity": "sha512-oUYKNR/IZjF4fsOzRpw0xesl2lOjhsQEyWlgbpT25T83EU113Xgck9UjtI7xemNI/OPCv1tPiaM1e7/ABdg5iA==",
"cpu": [
"ia32"
],
@@ -342,9 +359,9 @@
}
},
"node_modules/@tauri-apps/cli-win32-x64-msvc": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-win32-x64-msvc/-/cli-win32-x64-msvc-1.2.2.tgz",
"integrity": "sha512-YRPJguJma+zSuRZpFoSZqls6+laggG1vqG0FPQWQTi+ywATgMpai2b2RZnffDlpHKp9mt4V/s2dtqOy6bpGZHg==",
"version": "1.5.6",
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-win32-x64-msvc/-/cli-win32-x64-msvc-1.5.6.tgz",
"integrity": "sha512-RmEf1os9C8//uq2hbjXi7Vgz9ne7798ZxqemAZdUwo1pv3oLVZSz1/IvZmUHPdy2e6zSeySqWu1D0Y3QRNN+dg==",
"cpu": [
"x64"
],

View File

@@ -1,6 +1,6 @@
{
"name": "cinny",
"version": "2.2.6",
"version": "3.2.1",
"description": "Yet another matrix client",
"main": "index.js",
"engines": {
@@ -14,11 +14,11 @@
"author": "Ajay Bura",
"license": "AGPL-3.0-only",
"dependencies": {
"@tauri-apps/api": "1.2.0"
"@tauri-apps/api": "1.5.1"
},
"devDependencies": {
"@actions/github": "5.1.1",
"@tauri-apps/cli": "1.2.2",
"@tauri-apps/cli": "1.5.6",
"node-fetch": "3.3.0"
}
}

1557
src-tauri/Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -2,7 +2,7 @@
[package]
name = "cinny"
version = "2.2.6"
version = "3.2.1"
description = "Yet another matrix client"
authors = ["Ajay Bura"]
license = "AGPL-3.0-only"
@@ -12,12 +12,12 @@ edition = "2021"
rust-version = "1.61"
[build-dependencies]
tauri-build = { version = "1.2.1", features = [] }
tauri-build = { version = "1.5.0", features = [] }
[dependencies]
serde_json = "1.0.91"
serde = { version = "1.0.152", features = ["derive"] }
tauri = { version = "1.2.3", features = ["api-all", "devtools", "updater"] }
serde_json = "1.0.108"
serde = { version = "1.0.190", features = ["derive"] }
tauri = { version = "1.5.2", features = ["api-all", "devtools", "system-tray", "updater"] }
[features]
# by default Tauri runs in production mode

View File

@@ -1,18 +1,32 @@
#![cfg_attr(
all(not(debug_assertions), target_os = "windows"),
windows_subsystem = "windows"
all(not(debug_assertions), target_os = "windows"),
windows_subsystem = "windows"
)]
#[cfg(target_os = "macos")]
mod menu;
mod tray;
fn main() {
let builder = tauri::Builder::default();
let builder = tauri::Builder::default();
#[cfg(target_os = "macos")]
let builder = builder.menu(menu::menu());
#[cfg(target_os = "macos")]
let builder = builder.menu(menu::menu());
builder
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
let builder = builder
.system_tray(tray::system_tray())
.on_system_tray_event(tray::system_tray_handler);
builder
.build(tauri::generate_context!())
.expect("error while building tauri application")
.run(run_event_handler)
}
fn run_event_handler<R: tauri::Runtime>(app: &tauri::AppHandle<R>, event: tauri::RunEvent) {
match event {
tauri::RunEvent::WindowEvent { label, event, .. } => {
tray::window_event_handler(app, &label, &event);
}
_ => {}
}
}

87
src-tauri/src/tray.rs Normal file
View File

@@ -0,0 +1,87 @@
use tauri::{
CustomMenuItem, Manager, SystemTray, SystemTrayEvent, SystemTrayMenu,
SystemTrayMenuItem, WindowEvent, SystemTrayHandle, Window,
};
const TRAY_LABEL: &'static str = "main-tray";
pub fn window_event_handler<R: tauri::Runtime>(
app: &tauri::AppHandle<R>,
label: &str,
event: &WindowEvent,
) {
match event {
// Prevent Cinny from closing, instead hide it and let it be
// reopened through the tray.
WindowEvent::CloseRequested { api, .. } => {
api.prevent_close();
app.get_window(&label).unwrap().hide().unwrap();
app.tray_handle_by_id(TRAY_LABEL)
.unwrap()
.get_item("toggle")
.set_title("Show Cinny")
.unwrap();
}
_ => {}
}
}
/// Build the system tray object
pub fn system_tray() -> SystemTray {
let toggle = CustomMenuItem::new("toggle".to_owned(), "Hide Cinny");
let quit = CustomMenuItem::new("quit".to_owned(), "Quit");
let menu = SystemTrayMenu::new()
.add_item(toggle)
.add_native_item(SystemTrayMenuItem::Separator)
.add_item(quit);
tauri::SystemTray::new()
.with_menu(menu)
.with_id(TRAY_LABEL.to_owned())
}
pub fn toggle_window_state<R: tauri::Runtime>(window: Window<R>, tray_handle: SystemTrayHandle<R>) {
// Hide the window if it's visible, show it if not
// `is_visible` returns true for minimized state for whatever reason
if window.is_visible().unwrap() {
window.hide().unwrap();
tray_handle
.get_item("toggle")
.set_title("Show Cinny")
.unwrap();
} else {
window.unminimize().unwrap();
window.show().unwrap();
window.set_focus().unwrap();
tray_handle
.get_item("toggle")
.set_title("Hide Cinny")
.unwrap();
};
}
pub fn system_tray_handler<R: tauri::Runtime>(app: &tauri::AppHandle<R>, event: SystemTrayEvent) {
let tray_handle = match app.tray_handle_by_id(TRAY_LABEL) {
Some(h) => h,
None => return,
};
let window = app.get_window("main").unwrap();
match event {
SystemTrayEvent::LeftClick { .. } => {
toggle_window_state(window, tray_handle);
}
SystemTrayEvent::MenuItemClick { id, .. } => {
match id.as_str() {
"quit" => {
app.exit(0);
}
"toggle" => {
toggle_window_state(window, tray_handle)
}
_ => {}
}
}
_ => {}
}
}

View File

@@ -1,7 +1,7 @@
{
"package": {
"productName": "Cinny",
"version": "2.2.6"
"version": "3.2.1"
},
"build": {
"distDir": "../cinny/dist",
@@ -72,6 +72,11 @@
],
"security": {
"csp": "script-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self'"
},
"systemTray": {
"iconPath": "icons/32x32.png",
"iconAsTemplate": true,
"menuOnLeftClick": false
}
}
}