Compare commits

...

70 commits
1.1.0 ... main

Author SHA1 Message Date
DashieTM f229ed7dea Update nix packages
Some checks failed
Rust-build / Build (push) Has been cancelled
2025-02-15 16:17:06 +01:00
DashieTM f09ed75581 Use nix CI
Some checks failed
Rust-build / Build (push) Has been cancelled
2024-12-03 23:31:22 +01:00
DashieTM 6c1291bd19 debian: fix recommendations and dependencies 2024-06-13 15:14:29 +02:00
DashieTM a369356b49 chore: Bump version 2024-06-13 14:38:16 +02:00
DashieTM ee7129009a chore: Update todos 2024-06-12 23:52:09 +02:00
DashieTM e7c0995aa3 init: store true if daemon is already started 2024-06-12 19:46:11 +02:00
DashieTM 0b12d95c83 readme: Add plugin confirmation 2024-06-12 17:21:02 +02:00
DashieTM e4971391be readme: Add installation guide mention 2024-06-12 10:50:24 +02:00
DashieTM d36e79614c readme: Add exact binary names 2024-06-12 10:38:48 +02:00
DashieTM 7532c1e065 chore: Bump version in all files 2024-06-11 20:32:22 +02:00
DashieTM a9ee1b7bc3 flatpak: Change name to ReSet case 2024-06-11 15:09:34 +02:00
takotori 77c53a3efc change active language color 2024-06-11 13:09:40 +02:00
DashieTM 2b0898b809 CI/CD: update dependencies on distros 2024-06-11 12:49:07 +02:00
DashieTM 69d131282c chore: Bump version and deps 2024-06-10 16:22:51 +02:00
DashieTM 5e8241bf11 flatpak: Change name to ReSet case 2024-06-10 16:19:39 +02:00
DashieTM 390099fbc0 nix: use new name 2024-06-07 02:29:23 +02:00
DashieTM 778952d887 flatpak: rename reset 2024-06-07 02:13:15 +02:00
DashieTM 9fde38ca2d chore: rename ReSet.desktop 2024-06-07 01:48:05 +02:00
DashieTM 563aa16f80 pkgbuild: fixup names 2024-06-07 01:39:45 +02:00
DashieTM 35dfec596d chore: Bump version in packages 2024-06-07 01:33:10 +02:00
DashieTM 5f1fad8154 chore: Bump version 2024-06-07 01:32:37 +02:00
DashieTM ab266dddb6 chore: Rename only bin to ReSet 2024-06-07 01:31:05 +02:00
DashieTM 56f77f767f chore: update cargo.lock 2024-06-07 00:39:32 +02:00
DashieTM 1a1753f551 chore: chagne name of program 2024-06-07 00:38:11 +02:00
DashieTM 51d01cadba readme: update to new name 2024-06-07 00:32:58 +02:00
DashieTM d75c9aa78d chore: Bump version 2024-06-07 00:30:18 +02:00
DashieTM b7151f1feb chore: change name to ReSet to avoid conflicts 2024-06-07 00:28:40 +02:00
DashieTM 8ddaea9a7d CI/CD: move lib to bin 2024-06-06 23:21:31 +02:00
DashieTM 12bd13f3e1 CI/CD: generate debian structure 2024-06-06 22:37:22 +02:00
DashieTM 452eac3209 deps: Bump version 2024-06-06 22:24:10 +02:00
DashieTM c297717ca6 deb: update includes 2024-06-06 21:54:45 +02:00
DashieTM cc3e6647b4 pkgbuild: bump version 2024-06-06 20:37:50 +02:00
DashieTM 8ddd91bf93 chore: update cargo.lock 2024-06-06 19:07:45 +02:00
DashieTM 7c2a4e7934 chore: Bump version 2024-06-06 19:04:12 +02:00
DashieTM e384a4e5e4 CI/CD: add postinstall for debian 2024-06-06 19:03:49 +02:00
DashieTM b76a718f52 readme: add plugins 2024-06-06 18:55:38 +02:00
DashieTM 56155d29b3 readme: add nix 2024-06-06 18:52:34 +02:00
DashieTM e839a2572f nix: use recursive update to merge toml 2024-06-06 15:41:35 +02:00
DashieTM 26ccb90688 nix: use mkMerge as function 2024-06-06 15:40:08 +02:00
DashieTM a50f28dbe6 nix: merge attr sets 2024-06-06 15:39:21 +02:00
DashieTM 404198be3d chore: update cargo lock 2024-06-06 15:37:15 +02:00
DashieTM 9832fc3ea9 deps: use latest daemon 2024-06-06 15:36:16 +02:00
DashieTM d88affa6c8 nix: change toml additions 2024-06-06 15:33:03 +02:00
DashieTM dcc9de9230 startup: Add spinloop until deamon is ready 2024-06-05 00:43:23 +02:00
DashieTM 918bf9c70a startup: Add spinloop until daemon is ready 2024-06-04 23:37:15 +02:00
DashieTM 6a605f1d08 fix: move to 10 seconds for the daemon to start 2024-06-03 22:15:07 +02:00
DashieTM f1ee049e17 nix: improve plugin installation 2024-06-03 14:30:54 +02:00
takotori 93131a185a
Merge pull request #102 from Xetibo/ina
add frontend tests
2024-06-01 14:28:36 +02:00
takotori 1e4ca9f73a add frontend tests 2024-06-01 14:26:28 +02:00
DashieTM fe85ff3c70 chore: Bump version 2024-05-31 18:48:12 +02:00
DashieTM d49523f69e deps: Bump version of daemon 2024-05-31 18:47:56 +02:00
DashieTM 4220726ea8 flatpak: add debug version 2024-05-31 18:38:44 +02:00
DashieTM c9d3ac9317 nix: Allow definition of further toml values 2024-05-31 14:24:54 +02:00
DashieTM 073e88ab4f nix: Allow definition of further toml values 2024-05-31 14:22:19 +02:00
DashieTM 40beca475f nix: rename plugins with underscore 2024-05-30 21:27:35 +02:00
DashieTM 14cfcc16b0 nix: rename plugins 2024-05-30 21:24:57 +02:00
DashieTM 84bfad134a packages: bump version 2024-05-30 21:22:41 +02:00
DashieTM 7f8b9bd101 packages: bump version 2024-05-30 21:21:21 +02:00
DashieTM 1df2c3a369 nix: add plugin_path 2024-05-30 21:03:46 +02:00
DashieTM 3a31a4ce3b nix: test without toml values 2024-05-30 19:40:43 +02:00
DashieTM 9f34ffeb9c nix: fix toml conversion 2024-05-30 19:39:36 +02:00
DashieTM f729310502 nix: fix toml conversion 2024-05-30 19:38:55 +02:00
DashieTM f5d0eae840 nix: add plugin entry 2024-05-30 19:30:01 +02:00
takotori ecfaf2badd
Merge pull request #101 from Xetibo/ina2
add color to keyboard layouts
2024-05-26 13:24:39 +02:00
takotori a8d2e4c2ce add color to keyboard layouts 2024-05-26 13:24:16 +02:00
DashieTM 3cb7cd2d7f chore: rustup nightly breaks nixos with ldd -> rollback version of rust 2024-05-20 22:07:35 +02:00
DashieTM 397c48ae43 nix: use flake 2024-05-20 21:23:58 +02:00
DashieTM 84660083f9 chore: bump versions of dependencies, small refactor on errors -> use macros 2024-05-06 20:47:26 +02:00
DashieTM 822a6a7146 chore: Bump Cargo.lock 2024-04-24 11:59:47 +02:00
DashieTM 4a93fac141 chore: Bump version 2024-04-24 11:55:42 +02:00
47 changed files with 4347 additions and 673 deletions

1
.direnv/flake-profile Symbolic link
View file

@ -0,0 +1 @@
flake-profile-4-link

View file

@ -0,0 +1 @@
/nix/store/30prmd5nyydss0bcs7d578grjav6i7x3-nix-shell-env

2
.envrc
View file

@ -1,2 +1,2 @@
#!/usr/bin/env bash
use nix
use flake

View file

@ -18,4 +18,4 @@ jobs:
uses: softprops/action-gh-release@v1
with:
files: |
reset-${{github.ref_name}}-0-x86_64.pkg.tar.zst
ReSet-${{github.ref_name}}-0-x86_64.pkg.tar.zst

View file

@ -1,7 +1,6 @@
on:
release:
types: [ created ]
types: [created]
jobs:
release:
runs-on: [self-hosted, ubuntu]
@ -13,23 +12,26 @@ jobs:
profile: minimal
toolchain: nightly
- name: Build rust package
run: cargo build --release --verbose
- name: Build Flatpak
run: |
cd flatpak
python3 flatpak-generator.py ../Cargo.lock -o cargo-sources.json
flatpak-builder build org.Xetibo.ReSet.json --force-clean
flatpak build-export export build
flatpak build-bundle export reset.flatpak org.Xetibo.ReSet
cargo build --release --verbose
- name: Build Flatpak
run: "cd flatpak\npython3 flatpak-generator.py ../Cargo.lock -o cargo-sources.json \nflatpak-builder build org.Xetibo.ReSet.json --force-clean \nflatpak build-export export build\nflatpak build-bundle export reset.flatpak org.Xetibo.ReSet\n"
- name: Build Ubuntu package
run: |
cp ./target/release/reset ./debian/.
mkdir -p ./debian/usr
mkdir -p ./debian/usr/bin
mkdir -p ./debian/usr/share
mkdir -p ./debian/usr/share/applications
mkdir -p ./debian/usr/share/pixmaps
cp ./target/release/ReSet ./debian/usr/bin/ReSet
cp ./ReSet.desktop ./debian/usr/share/applications/.
cp ./src/resources/icons/ReSet.svg ./debian/usr/share/pixmaps/.
dpkg-deb --build debian
mv debian.deb reset.deb
mv debian.deb ReSet.deb
- name: Release
uses: softprops/action-gh-release@v1
with:
files: |
target/release/reset
target/release/ReSet
flatpak/reset.flatpak
reset.deb
ReSet.deb

View file

@ -1,25 +1,33 @@
name: Rust
# inspired by https://github.com/danth/stylix/blob/master/.github/workflows/docs.yml
name: Rust-build
on:
push:
branches: [ "main" ]
branches: ["main"]
pull_request:
branches: [ "main" ]
env:
CARGO_TERM_COLOR: always
branches: ["main"]
jobs:
build:
runs-on: [self-hosted, ubuntu]
name: Build
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: nightly-rust
uses: actions-rs/toolchain@v1
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
with:
profile: minimal
toolchain: nightly
github-token: ${{ secrets.GITHUB_TOKEN }}
extra-conf: |
extra-experimental-features = nix-command flakes
- name: Set up cache
uses: DeterminateSystems/magic-nix-cache-action@main
- name: action
uses: cachix/install-nix-action@v25
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: cache
uses: cachix/cachix-action@v14
with:
name: reset
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- name: Build
run: cargo build --verbose
- name: Run clippy
run: cargo clippy --fix
run: nix -L build github:${{ github.repository }}/${{ github.sha }} --no-write-lock-file

71
Cargo.lock generated
View file

@ -204,27 +204,6 @@ dependencies = [
"tokio",
]
[[package]]
name = "directories-next"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "339ee130d97a610ea5a5872d2bbb130fdf68884ff09d3028b81bec8a1ac23bbc"
dependencies = [
"cfg-if",
"dirs-sys-next",
]
[[package]]
name = "dirs-sys-next"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d"
dependencies = [
"libc",
"redox_users",
"winapi",
]
[[package]]
name = "equivalent"
version = "1.0.1"
@ -396,17 +375,6 @@ dependencies = [
"system-deps",
]
[[package]]
name = "getrandom"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94b22e06ecb0110981051723910cbf0b5f5e09a2062dd7663334ee79a9d1286c"
dependencies = [
"cfg-if",
"libc",
"wasi",
]
[[package]]
name = "gimli"
version = "0.28.1"
@ -744,16 +712,6 @@ dependencies = [
"winapi",
]
[[package]]
name = "libredox"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d"
dependencies = [
"bitflags 2.5.0",
"libc",
]
[[package]]
name = "lock_api"
version = "0.4.11"
@ -968,19 +926,19 @@ dependencies = [
[[package]]
name = "re_set-lib"
version = "3.2.0"
version = "5.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "386bc67e1c4bce0c8fd01eb2999e60b34b83c86f635db38cbbc39890d1cb248f"
checksum = "69ec9fc4d9e919feb030e5382de1aa49447404a57ecc19361bf7710f1cf9063e"
dependencies = [
"dbus",
"dbus-crossroads",
"directories-next",
"gtk4",
"libloading",
"libpulse-binding",
"once_cell",
"serial_test",
"toml",
"xdg",
]
[[package]]
@ -992,20 +950,9 @@ dependencies = [
"bitflags 1.3.2",
]
[[package]]
name = "redox_users"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd283d9651eeda4b2a83a43c1c91b266c40fd76ecd39a50a8c630ae69dc72891"
dependencies = [
"getrandom",
"libredox",
"thiserror",
]
[[package]]
name = "reset"
version = "1.1.0"
version = "2.0.0"
dependencies = [
"dbus",
"fork",
@ -1021,9 +968,9 @@ dependencies = [
[[package]]
name = "reset_daemon"
version = "1.2.0"
version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9fa262cbdbb8408260b960764ed612d249b165bb9cde76633a5856c587ef5a21"
checksum = "f72dd51da41c2fc3ac37ae55fbdeb2670d32cad39cc85cc95a9ea25fc02b6086"
dependencies = [
"crossbeam",
"dbus",
@ -1479,3 +1426,9 @@ checksum = "f0c976aaaa0e1f90dbb21e9587cdaf1d9679a1cde8875c0d6bd83ab96a208352"
dependencies = [
"memchr",
]
[[package]]
name = "xdg"
version = "2.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "213b7324336b53d2414b2db8537e56544d981803139155afa84f76eeebb7a546"

View file

@ -1,16 +1,18 @@
[package]
name = "reset"
version = "1.1.0"
version = "2.0.0"
edition = "2021"
description = "A wip universal Linux settings application."
repository = "https://github.com/Xetibo/ReSet"
license = "GPL-3.0-or-later"
[[bin]]
name = "ReSet"
path = "src/main.rs"
[dependencies]
#reset_daemon = { git = "https://github.com/Xetibo/ReSet-Daemon", branch = "dashie" }
reset_daemon = "1.2.0"
#re_set-lib = { git = "https://github.com/Xetibo/ReSet-Lib" , branch = "audioobject"}
re_set-lib = "3.2.0"
reset_daemon = "2.2.0"
re_set-lib = "5.2.5"
adw = { version = "0.6.0", package = "libadwaita", features = ["v1_4"] }
dbus = "0.9.7"
gtk = { version = "0.8.1", package = "gtk4", features = ["v4_12"] }

View file

@ -1,12 +1,15 @@
# Maintainer: Fabio Lenherr <dashie@dashie.org>
pkgname=reset
pkgver=1.0.0
pkgname=ReSet
pkgver=2.0.0
pkgrel=0
arch=('x86_64')
pkgdir="/usr/bin/${pkgname}"
pkgdesc="A wip universal Linux settings application."
depends=('rust' 'gtk4' 'dbus')
depends=('gtk4' 'dbus' 'libadwaita')
optdepends=('pipewire-pulse' 'networkmanager' 'bluez')
makedepends=('rust')
build() {
cargo build --release
@ -16,5 +19,5 @@ package() {
cd ..
install -Dm755 target/release/"$pkgname" "$pkgdir"/usr/bin/"$pkgname"
install -Dm644 "$pkgname.desktop" "$pkgdir/usr/share/applications/$pkgname.desktop"
install -Dm644 "src/resources/icons/ReSet.svg" "$pkgdir/usr/share/pixmaps/ReSet.svg"
install -Dm644 "src/resources/icons/$pkgname.svg" "$pkgdir/usr/share/pixmaps/$pkgname.svg"
}

View file

@ -5,11 +5,11 @@
![Logo of ReSet](./assets/ReSet.png)
A window manager/compositor agnostic settings application for Linux written in rust and gtk4.
</div>
## Features
- Bluetooth via bluez
- Audio via PulseAudio
- Wi-Fi via NetworkManager
@ -23,31 +23,58 @@ A window manager/compositor agnostic settings application for Linux written in r
<img alt="Audio Screenshot of ReSet" src="./assets/reset_audio.png" width="80%">
### Wi-Fi
<img alt="Wi-Fi Screenshot of ReSet" src="./assets/reset_wifi.png" width="80%">
### Bluetooth
<img alt="Bluetooth Screenshot of ReSet" src="./assets/reset_bluetooth.png" width="80%">
</div>
## Plugins
ReSet features a plugin system by loading dynamic libraries for both the daemon and the ReSet graphical user interface.
A list of official plugins, installation guides and their documentation can be found at [ReSet-Plugins](https://github.com/Xetibo/ReSet-Plugins).
### Installation
Plugins are loaded either from `/usr/lib/reset` or `~/.config/reset/plugins`. In order to install the plugin, either install a distribution specific package that places the library into the specified system folder, or place the library in the plugins folder in your config directory.
Note, after installation, please move to confirmation.
### Confirmation
In order for your plugins to load, you have to define them in `.config/reset/ReSet.toml`.
This is done to avoid loading of arbitrary plugins that might be placed within this folder by accident.
```toml
plugins = ["libreset_monitors.so", "libreset_keyboard_plugin.so"]
```
## Packaging
ReSet is available with the following packaging solutions:
### Flatpak
We are currently not published on flatpak due to issues with permissions.
This is being worked on...
installation:
Download the flatpak package from the release and install with the terminal.
Installation:
Download the flatpak package (reset.flatpak) from the release and install with the terminal.
```
flatpak install --user reset.flatpak
```
### Arch Package
<!-- AUR: -->
<!-- ```paru -S ReSet``` -->
Manually:
Download the package from the releases tab and install it with pacman.
Download the package (ReSet-version-x86_64.pkg.tar.zst) from the releases tab and install it with pacman.
```
sudo pacman -U /path/to/reset
@ -55,31 +82,60 @@ sudo pacman -U /path/to/reset
### Debian Package(Ubuntu 23.04 dependencies)
Download the package from the releases tab and install it with apt.
Download the package (ReSet.deb) from the releases tab and install it with apt.
```
sudo apt install ./path/to/reset
```
### NixOS/Home-manager
ReSet offers a flake with a home-manager module which you can use to declaratively install ReSet and plugins.
Here is an example configuration:
```nix
#inputs
reset.url = "github:Xetibo/ReSet";
reset-plugins.url = "github:Xetibo/ReSet-Plugins";
#installation and configuration
programs.ReSet.enable = true;
programs.ReSet.config.plugins = [
inputs.reset-plugins.packages."x86_64-linux".monitor
inputs.reset-plugins.packages."x86_64-linux".keyboard
];
programs.ReSet.config.plugin_config = {
#custom toml config
Keyboard = {
path = "/home/user/.config/reset/keyboard.conf";
};
};
```
### crates
```
cargo install reset
```
### Compiled Binary
The compiled binary is provided in the releases.
## Usage
Besides starting the application itself, a standalone daemon version ([ReSet-Daemon](https://github.com/Xetibo/ReSet-Daemon)) also exists, which is what provides the functionality for ReSet.\
It is therefore possible to use a different application as well for interacting with the daemon.
By default, the daemon is integrated into ReSet and is started automatically if no other daemon is found.
## Roadmap
This application was developed as a semester project for the Eastern Switzerland University of Applied Sciences.
With potential advancements as a next project, due to this, no major development will happen until February 2024.
However, there is still a roadmap for this application.
## Roadmap and Notes
- Plugin System
- Accessibility Features
- Better Error handling
- Customizable shortcuts
- and more
### notes
This application was developed as a semester project/bachelor thesis for the Eastern Switzerland University of Applied Sciences.

View file

@ -2,7 +2,7 @@
Name=ReSet
GenericName=SettingsApplication
GenericName[de]=SettingsApplikation
Exec=reset
Exec=ReSet
Terminal=false
Type=Application
Keywords=settings;gtk;

View file

@ -1,5 +1,9 @@
Package: ReSet
Version: 0.1
Version: 2.0.0
Maintainer: DashieTM
Architecture: all
Description: A wip universal Linux settings application.
Homepage: https://github.com/Xetibo/ReSet
Build-Depends: rust
Depends: libadwaita-1-0, libgtk-4-1, dbus
Recommends: pipewire-pulse, network-manager, bluez

83
flake.lock Normal file
View file

@ -0,0 +1,83 @@
{
"nodes": {
"flake-parts": {
"inputs": {
"nixpkgs-lib": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1738453229,
"narHash": "sha256-7H9XgNiGLKN1G1CgRh0vUL4AheZSYzPm+zmZ7vxbJdo=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "32ea77a06711b758da0ad9bd6a844c5740a87abd",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1739446958,
"narHash": "sha256-+/bYK3DbPxMIvSL4zArkMX0LQvS7rzBKXnDXLfKyRVc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "2ff53fe64443980e139eaa286017f53f88336dd0",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1736320768,
"narHash": "sha256-nIYdTAiKIGnFNugbomgBJR+Xv5F1ZQU+HfaBqJKroC0=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "4bc9c909d9ac828a039f288cf872d16d38185db8",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-parts": "flake-parts",
"nixpkgs": "nixpkgs",
"rust-overlay": "rust-overlay"
}
},
"rust-overlay": {
"inputs": {
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1739586408,
"narHash": "sha256-UN9hRKRE1eLU8C0cioTZubaCZQTA8NDc8/4vCpS5pS0=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "3dbc0ce1c0690b83cfb9a9a51fbe90c3bc8f9916",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

62
flake.nix Normal file
View file

@ -0,0 +1,62 @@
{
description = "A wip universal Linux settings application.";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-parts = {
url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs";
};
rust-overlay.url = "github:oxalica/rust-overlay";
};
outputs = inputs @ { self, flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = [ "x86_64-linux" "aarch64-linux" ];
perSystem =
{ config
, self'
, inputs'
, pkgs
, system
, ...
}:
{
_module.args.pkgs = import self.inputs.nixpkgs {
inherit system;
overlays = [
(import
inputs.rust-overlay
)
];
};
devShells.default = pkgs.mkShell {
inputsFrom = builtins.attrValues self'.packages;
packages = with pkgs; [
# (rust-bin.selectLatestNightlyWith
# (toolchain: toolchain.default))
rust-bin.nightly."2024-05-10".default
rust-analyzer
clippy
];
};
packages =
let
lockFile = ./Cargo.lock;
in
rec {
ReSet = pkgs.callPackage ./nix/default.nix { inherit inputs lockFile; };
default = ReSet;
};
};
flake = _: rec {
nixosModules.home-manager = homeManagerModules.default;
homeManagerModules = rec {
ReSet = import ./nix/hm.nix inputs.self;
default = ReSet;
};
};
};
}

View file

@ -1,4 +1,3 @@
#! /bin/bash
python3 flatpak-generator.py ../Cargo.lock -o cargo-sources.json
flatpak-builder build org.Xetibo.ReSet.json --force-clean
flatpak build-export export build

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,15 +1,13 @@
{
"app-id": "org.Xetibo.ReSet",
"runtime": "org.gnome.Platform",
"runtime-version": "45",
"runtime-version": "46",
"sdk": "org.gnome.Sdk",
"sdk-extensions": [
"org.freedesktop.Sdk.Extension.rust-stable"
"org.freedesktop.Sdk.Extension.rust-nightly"
],
"command": "reset",
"command": "ReSet",
"finish-args": [
"--system-talk-name=org.freedesktop.NetworkManager",
"--system-talk-name=org.bluez",
"--socket=pulseaudio",
"--share=network",
"--share=ipc",
@ -17,10 +15,12 @@
"--socket=wayland",
"--device=dri",
"--device=all",
"--allow=bluetooth"
"--allow=bluetooth",
"--socket=system-bus",
"--socket=session-bus"
],
"build-options": {
"append-path": "/usr/lib/sdk/rust-stable/bin"
"append-path": "/usr/lib/sdk/rust-nightly/bin"
},
"modules": [
{
@ -33,8 +33,8 @@
},
"build-commands": [
"cargo --offline fetch --manifest-path Cargo.toml --verbose",
"cargo --offline build --release --verbose",
"install -Dm755 ./target/release/reset -t /app/bin/",
"cargo --offline build --verbose",
"install -Dm755 ./target/debug/ReSet -t /app/bin/",
"install -Dm644 ./src/resources/icons/ReSet.svg /app/share/icons/hicolor/scalable/apps/org.Xetibo.ReSet.svg",
"install -Dm644 ./flatpak/org.Xetibo.ReSet.desktop /app/share/applications/org.Xetibo.ReSet.desktop"
],

View file

@ -2,7 +2,7 @@
Name=ReSet
GenericName=SettingsApplication
GenericName[de]=SettingsApplikation
Exec=reset
Exec=ReSet
Terminal=false
Type=Application
Keywords=settings;gtk;

View file

@ -1,12 +1,12 @@
{
"app-id": "org.Xetibo.ReSet",
"runtime": "org.gnome.Platform",
"runtime-version": "45",
"runtime-version": "46",
"sdk": "org.gnome.Sdk",
"sdk-extensions": [
"org.freedesktop.Sdk.Extension.rust-stable"
"org.freedesktop.Sdk.Extension.rust-nightly"
],
"command": "reset",
"command": "ReSet",
"finish-args": [
"--socket=pulseaudio",
"--share=network",
@ -17,10 +17,11 @@
"--device=all",
"--allow=bluetooth",
"--socket=system-bus",
"--socket=session-bus"
"--socket=session-bus",
"--persist=~/.config/reset:create"
],
"build-options": {
"append-path": "/usr/lib/sdk/rust-stable/bin"
"append-path": "/usr/lib/sdk/rust-nightly/bin"
},
"modules": [
{
@ -34,7 +35,7 @@
"build-commands": [
"cargo --offline fetch --manifest-path Cargo.toml --verbose",
"cargo --offline build --release --verbose",
"install -Dm755 ./target/release/reset -t /app/bin/",
"install -Dm755 ./target/release/ReSet -t /app/bin/",
"install -Dm644 ./src/resources/icons/ReSet.svg /app/share/icons/hicolor/scalable/apps/org.Xetibo.ReSet.svg",
"install -Dm644 ./flatpak/org.Xetibo.ReSet.desktop /app/share/applications/org.Xetibo.ReSet.desktop"
],

69
nix/default.nix Normal file
View file

@ -0,0 +1,69 @@
{
rustPlatform,
rust-bin,
pulseaudio,
dbus,
gdk-pixbuf,
adwaita-icon-theme,
pkg-config,
wrapGAppsHook4,
gtk4,
libadwaita,
python312Packages,
flatpak,
flatpak-builder,
lib,
lockFile,
...
}: let
cargoToml = builtins.fromTOML (builtins.readFile ../Cargo.toml);
in
rustPlatform.buildRustPackage rec {
pname = "ReSet";
version = cargoToml.package.version;
src = ../.;
buildInputs = [
gtk4
libadwaita
pulseaudio
dbus
gdk-pixbuf
adwaita-icon-theme
python312Packages.aiohttp
python312Packages.toml
flatpak
flatpak-builder
];
cargoLock = {
inherit lockFile;
};
nativeBuildInputs = [
pkg-config
wrapGAppsHook4
rust-bin.nightly."2024-05-10".default
];
copyLibs = true;
postInstall = ''
install -D --mode=444 $src/${pname}.desktop $out/share/applications/${pname}.desktop
install -D --mode=444 $src/src/resources/icons/${pname}.svg $out/share/pixmaps/${pname}.svg
'';
# test is broken in nix for some reason
doInstallCheck = false;
doCheck = false;
meta = with lib; {
description = "A wip universal Linux settings application.";
homepage = "https://github.com/Xetibo/ReSet";
changelog = "https://github.com/Xetibo/ReSet/releases/tag/${version}";
license = licenses.gpl3;
maintainers = with maintainers; [DashieTM];
mainProgram = "ReSet";
};
}

80
nix/hm.nix Normal file
View file

@ -0,0 +1,80 @@
self: { config
, pkgs
, lib
, hm
, ...
}:
let
cfg = config.programs.ReSet;
defaultPackage = self.packages.${pkgs.stdenv.hostPlatform.system}.default;
in
{
meta.maintainers = with lib.maintainers; [ DashieTM ];
options.programs.ReSet = with lib; {
enable = mkEnableOption "ReSet";
package = mkOption {
type = with types; nullOr package;
default = defaultPackage;
defaultText = lib.literalExpression ''
ReSet.packages.''${pkgs.stdenv.hostPlatform.system}.default
'';
description = mdDoc ''
Package to run
'';
};
config = {
plugins = mkOption {
type = with types; listOf package;
default = null;
description = mdDoc ''
List of plugins to use, represented as a list of packages.
'';
};
plugin_config = mkOption {
type = with types; attrs;
default = { };
description = mdDoc ''
Toml values passed to the configuration for plugins to use.
'';
};
};
};
config =
let
fetchedPlugins =
if cfg.config.plugins == [ ]
then [ ]
else
builtins.map
(entry:
if lib.types.package.check entry
then "lib${lib.replaceStrings ["-"] ["_"] entry.pname}.so"
else "")
cfg.config.plugins;
in
lib.mkIf
cfg.enable
{
home.packages = lib.optional (cfg.package != null) cfg.package ++ cfg.config.plugins;
home.file = builtins.listToAttrs (builtins.map
(pkg: {
name = ".config/reset/plugins/lib${lib.replaceStrings ["-"] ["_"] pkg.pname}.so";
value = {
source = "${pkg}/lib/lib${lib.replaceStrings ["-"] ["_"] pkg.pname}.so";
};
})
cfg.config.plugins);
xdg.configFile."reset/ReSet.toml".source = (pkgs.formats.toml { }).generate "reset"
(lib.recursiveUpdate
{
plugins = fetchedPlugins;
}
cfg.config.plugin_config);
};
}

View file

@ -1,19 +0,0 @@
{ pkgs ? import <nixpkgs> { } }:
with pkgs;
mkShell {
nativeBuildInputs = [
pkg-config
wrapGAppsHook4
];
buildInputs = [
dbus
pulseaudio
gnome.adwaita-icon-theme
gtk4
libadwaita
gdk-pixbuf
];
}

View file

@ -15,8 +15,12 @@ use gtk::{
use re_set_lib::{
audio::audio_structures::{Card, TAudioObject, TAudioStreamObject},
signals::{TAudioEventRemoved, TAudioObjectEvent, TAudioStreamEvent},
ERROR,
};
#[cfg(debug_assertions)]
use re_set_lib::{utils::macros::ErrorLevel, write_log_to_file};
use crate::components::{
base::{card_entry::CardEntry, error_impl::ReSetErrorImpl, list_entry::ListEntry},
utils::{create_dropdown_label_factory, set_combo_row_ellipsis, BASE, DBUS_PATH},
@ -330,7 +334,7 @@ pub fn start_audio_box_listener<
get_default_name_function: &'static DBusFunction,
dummy_name: &'static str,
) -> Connection {
// TODO: make the failed logs generically sound -> deynamic output for both
// FUTURE TODO: make the failed logs generically sound -> deynamic output for both
let object_added =
ObjectAdded::match_rule(Some(&BASE.into()), Some(&Path::from(DBUS_PATH))).static_clone();
let object_changed =
@ -365,8 +369,7 @@ pub fn start_audio_box_listener<
>(object_added_box.clone(), ir, dummy_name)
});
if res.is_err() {
// TODO: handle this with the log/error macro
println!("fail on source add event");
ERROR!("fail on source add event", ErrorLevel::PartialBreakage);
return conn;
}
@ -384,7 +387,7 @@ pub fn start_audio_box_listener<
>(object_changed_box.clone(), ir, get_default_name_function)
});
if res.is_err() {
println!("fail on source change event");
ERROR!("fail on source change event", ErrorLevel::PartialBreakage);
return conn;
}
@ -402,7 +405,7 @@ pub fn start_audio_box_listener<
>(object_removed_box.clone(), ir, dummy_name)
});
if res.is_err() {
println!("fail on source remove event");
ERROR!("fail on source remove event", ErrorLevel::PartialBreakage);
return conn;
}
@ -420,7 +423,10 @@ pub fn start_audio_box_listener<
>(stream_added_box.clone(), ir)
});
if res.is_err() {
println!("fail on output stream add event");
ERROR!(
"fail on output stream add event",
ErrorLevel::PartialBreakage
);
return conn;
}
@ -438,7 +444,10 @@ pub fn start_audio_box_listener<
>(stream_changed_box.clone(), ir)
});
if res.is_err() {
println!("fail on output stream change event");
ERROR!(
"fail on output stream change event",
ErrorLevel::PartialBreakage
);
return conn;
}
@ -456,7 +465,10 @@ pub fn start_audio_box_listener<
>(stream_removed_box.clone(), ir)
});
if res.is_err() {
println!("fail on output stream remove event");
ERROR!(
"fail on output stream remove event",
ErrorLevel::PartialBreakage
);
return conn;
}

View file

@ -117,7 +117,7 @@ pub fn new_entry<
reset_box: Arc<AudioBox>,
) -> Arc<AudioEntry> {
let obj: Arc<AudioEntry> = Arc::new(Object::builder().build());
// TODO use event callback for progress bar -> this is the "im speaking" indicator
// FUTURE TODO: use event callback for progress bar -> this is the "im speaking" indicator
{
let imp = obj.entry_imp();
let slider_obj_ref = obj.clone();

View file

@ -91,7 +91,7 @@ pub fn new_stream_entry<
stream: StreamObject,
) -> Arc<AudioStream> {
let obj: Arc<AudioStream> = Arc::new(Object::builder().build());
// TODO use event callback for progress bar -> this is the "im speaking" indicator
// FUTURE TODO: use event callback for progress bar -> this is the "im speaking" indicator
let output_box_mute_ref = audio_box.clone();
let output_box_volume_ref = audio_box.clone();
let output_box_sink_ref = audio_box.clone();

View file

@ -24,7 +24,6 @@ impl ReSetError {
.imp()
.reset_error_button
.connect_clicked(clone!(@strong error => move |_| {
println!("pingpangpung");
error.popdown();
}));
error

View file

@ -54,7 +54,7 @@ pub fn show_error<T: ReSetErrorImpl + Send + Sync + 'static>(
parent: Arc<T>,
message: &'static str,
) {
// TODO: Add error to log
// FUTURE TODO: Add error to log
glib::spawn_future(async move {
glib::idle_add_once(move || {
let error = parent.error();

View file

@ -14,8 +14,14 @@ use glib::{clone, ControlFlow};
use gtk::glib::Variant;
use gtk::prelude::{ActionableExt, ButtonExt, ListBoxRowExt, WidgetExt};
use gtk::{gio, StringObject};
use re_set_lib::bluetooth::bluetooth_structures::{BluetoothAdapter, BluetoothDevice};
use re_set_lib::signals::{BluetoothDeviceAdded, BluetoothDeviceChanged, BluetoothDeviceRemoved};
use re_set_lib::{
bluetooth::bluetooth_structures::{BluetoothAdapter, BluetoothDevice},
signals::{BluetoothDeviceAdded, BluetoothDeviceChanged, BluetoothDeviceRemoved},
ERROR
};
#[cfg(debug_assertions)]
use re_set_lib::{utils::macros::ErrorLevel, write_log_to_file};
use crate::components::base::error_impl::{show_error, ReSetErrorImpl};
use crate::components::base::utils::Listeners;
@ -51,7 +57,7 @@ impl BluetoothBox {
}
}
// TODO
// FUTURE TODO:
// handle bonded -> this means saved but not connected
// handle rssi below x -> don't show device
@ -179,7 +185,6 @@ pub fn populate_connected_bluetooth_devices(
listeners: Arc<Listeners>,
bluetooth_box: Arc<BluetoothBox>,
) {
// TODO handle saved devices -> they also exist
gio::spawn_blocking(move || {
let ref_box = bluetooth_box.clone();
let adapters = get_bluetooth_adapters(ref_box.clone());
@ -318,7 +323,10 @@ pub fn start_bluetooth_listener(listeners: Arc<Listeners>, bluetooth_box: Arc<Bl
device_added_handler(device_added_box.clone(), ir)
});
if res.is_err() {
println!("fail on bluetooth device add event");
ERROR!(
"fail on bluetooth device add event",
ErrorLevel::PartialBreakage
);
return;
}
@ -326,7 +334,10 @@ pub fn start_bluetooth_listener(listeners: Arc<Listeners>, bluetooth_box: Arc<Bl
device_removed_handler(device_removed_box.clone(), ir)
});
if res.is_err() {
println!("fail on bluetooth device remove event");
ERROR!(
"fail on bluetooth device remove event",
ErrorLevel::PartialBreakage
);
return;
}
@ -334,7 +345,10 @@ pub fn start_bluetooth_listener(listeners: Arc<Listeners>, bluetooth_box: Arc<Bl
device_changed_handler(device_changed_box.clone(), ir)
});
if res.is_err() {
println!("fail on bluetooth device remove event");
ERROR!(
"fail on bluetooth device remove event",
ErrorLevel::PartialBreakage
);
return;
}

View file

@ -70,7 +70,7 @@ impl BluetoothEntry {
});
let gesture = GestureClick::new();
// paired is not what we think
// TODO implement paired
// FUTURE TODO: implement paired
gesture.connect_released(move |_, _, _, _| {
let imp = entry_ref.imp();
let borrow = imp.bluetooth_device.borrow();

View file

@ -69,7 +69,7 @@ pub fn device_removed_handler(
if list_entry.imp().bluetooth_device.borrow().connected {
imp.reset_bluetooth_connected_devices.remove(&*list_entry);
} else {
// TODO: is there a better way for this?
// FUTURE TODO: is there a better way for this?
imp.reset_bluetooth_available_devices.remove(&*list_entry);
imp.reset_bluetooth_saved_devices.remove(&*list_entry);
}

View file

@ -10,6 +10,9 @@ use glib::prelude::Cast;
use glib::Object;
use gtk::prelude::{GObjectPropertyExpressionExt, ListBoxRowExt, ListItemExt, WidgetExt};
use gtk::{Align, SignalListItemFactory, StringObject};
use re_set_lib::ERROR;
#[cfg(debug_assertions)]
use re_set_lib::{utils::macros::ErrorLevel, write_log_to_file};
pub const DBUS_PATH: &str = "/org/Xetibo/ReSet/Daemon";
pub const WIRELESS: &str = "org.Xetibo.ReSet.Network";
@ -91,7 +94,14 @@ pub fn set_action_row_ellipsis(element: ActionRow) {
pub fn get_capabilities() -> Vec<String> {
let conn = Connection::new_session().unwrap();
let proxy = conn.with_proxy(BASE, DBUS_PATH, Duration::from_millis(1000));
let proxy = conn.with_proxy(BASE, DBUS_PATH, Duration::from_millis(10000));
let res: Result<(Vec<String>,), Error> = proxy.method_call(BASE, "GetCapabilities", ());
if res.is_err() {
ERROR!(
"Could not call capabilities from daemon",
ErrorLevel::Critical
);
return Vec::new();
}
res.unwrap().0
}

View file

@ -55,7 +55,7 @@ impl SavedWifiEntry {
let entry_ref = entry.clone();
delete_button.connect_clicked(clone!(@weak wifi_box => move |_| {
delete_connection(entry_ref.imp().reset_connection_path.take());
// TODO handle error
// FUTURE TODO: handle error
wifi_box.reset_stored_wifi_list.remove(&*entry_ref);
}));

View file

@ -20,9 +20,15 @@ use glib::{clone, ControlFlow};
use gtk::glib::Variant;
use gtk::prelude::ActionableExt;
use gtk::{gio, StringList, StringObject};
use re_set_lib::network::network_structures::{AccessPoint, WifiDevice};
use re_set_lib::signals::{AccessPointAdded, WifiDeviceChanged, WifiDeviceReset};
use re_set_lib::signals::{AccessPointChanged, AccessPointRemoved};
use re_set_lib::{
network::network_structures::{AccessPoint, WifiDevice},
signals::{AccessPointAdded, WifiDeviceChanged, WifiDeviceReset},
signals::{AccessPointChanged, AccessPointRemoved},
ERROR,
};
#[cfg(debug_assertions)]
use re_set_lib::{utils::macros::ErrorLevel, write_log_to_file};
use crate::components::wifi::wifi_box_impl;
use crate::components::wifi::wifi_entry::WifiEntry;
@ -203,7 +209,7 @@ pub fn show_stored_connections(wifi_box: Arc<WifiBox>) {
glib::idle_add_once(move || {
let self_imp = wifibox_ref.imp();
for connection in connections {
// TODO include button for settings
// FUTURE TODO: include button for settings
let name =
&String::from_utf8(connection.1).unwrap_or_else(|_| String::from(""));
let entry = SavedWifiEntry::new(name, connection.0, self_imp);
@ -324,35 +330,50 @@ pub fn start_event_listener(listeners: Arc<Listeners>, wifi_box: Arc<WifiBox>) {
access_point_added_handler(added_ref.clone(), ir)
});
if res.is_err() {
println!("fail on access point add event");
ERROR!(
"fail on access point add event",
ErrorLevel::PartialBreakage
);
return;
}
let res = conn.add_match(access_point_removed, move |ir: AccessPointRemoved, _, _| {
access_point_removed_handler(removed_ref.clone(), ir)
});
if res.is_err() {
println!("fail on access point remove event");
ERROR!(
"fail on access point remove event",
ErrorLevel::PartialBreakage
);
return;
}
let res = conn.add_match(access_point_changed, move |ir: AccessPointChanged, _, _| {
access_point_changed_handler(changed_ref.clone(), ir)
});
if res.is_err() {
println!("fail on access point change event");
ERROR!(
"fail on access point change event",
ErrorLevel::PartialBreakage
);
return;
}
let res = conn.add_match(device_changed, move |ir: WifiDeviceChanged, _, _| {
wifi_device_changed_handler(wifi_changed_ref.clone(), ir)
});
if res.is_err() {
println!("fail on wifi device change event");
ERROR!(
"fail on wifi device change event",
ErrorLevel::PartialBreakage
);
return;
}
let res = conn.add_match(devices_reset, move |ir: WifiDeviceReset, _, _| {
wifi_device_reset_handler(wifi_reset_ref.clone(), ir)
});
if res.is_err() {
println!("fail on wifi device change event");
ERROR!(
"fail on wifi device change event",
ErrorLevel::PartialBreakage
);
return;
}

View file

@ -48,7 +48,7 @@ impl WifiEntry {
.build(),
);
// TODO handle encryption thing
// FUTURE TODO: handle encryption
let wifi_strength = Image::builder()
.icon_name(match strength {
WifiStrength::Excellent => "network-wireless-signal-excellent-symbolic",
@ -177,7 +177,7 @@ pub fn click_stored_network(entry: Arc<WifiEntry>) {
});
});
});
// TODO crate spinner animation and block UI
// FUTURE TODO: crate spinner animation and block UI
}
pub fn click_new_network(entry: Arc<WifiEntry>) {
@ -228,7 +228,7 @@ pub fn click_new_network(entry: Arc<WifiEntry>) {
});
});
});
// TODO crate spinner animation and block UI
// FUTURE TODO: crate spinner animation and block UI
};
let entry_imp = entry.imp();

View file

@ -72,7 +72,7 @@ pub fn access_point_changed_handler(wifi_box: Arc<WifiBox>, ir: AccessPointChang
let name = name_opt.as_str();
entry_imp.wifi_strength.set(strength);
entry.set_title(name);
// TODO handle encryption thing
// FUTURE TODO: handle encryption thing
entry_imp
.reset_wifi_strength
.borrow()

View file

@ -21,6 +21,7 @@ use crate::components::utils::get_capabilities;
use crate::components::window::handle_sidebar_click::*;
use crate::components::window::reset_window_impl;
use crate::components::window::sidebar_entry::SidebarEntry;
use crate::VERSION;
use super::consts::{
AUDIO_SIDEBAR, BLUETOOTH_SIDEBAR, CONNECTIVITY_SIDEBAR, SINK_SIDEBAR, SOURCE_SIDEBAR,
@ -144,11 +145,10 @@ impl ReSetWindow {
let mut plugin_sidebar_list = vec![];
unsafe {
for plugin in FRONTEND_PLUGINS.iter() {
let plugin_capabilities = &plugin.capabilities;
(plugin.frontend_startup)();
let (sidebar_info, plugin_boxes) = (plugin.frontend_data)();
let listeners = self_imp.listeners.clone();
@ -207,7 +207,6 @@ impl ReSetWindow {
.connect_row_activated(clone!(@ weak self_imp => move |_, _| {
self_imp.reset_search_entry.set_text("");
}));
// TODO: refactor this
let mut i = 0;
for info in sidebar_list {
if info.parent.is_none() && i != 0 {
@ -241,6 +240,17 @@ impl ReSetWindow {
})
.build();
let banner_action = ActionEntry::builder("banner")
.parameter_type(Some(&String::static_variant_type()))
.activate(move |window: &Self, _, text| {
let imp = window.imp();
if let Some(text) = text {
imp.reset_banner.set_title(&text.to_string());
}
imp.reset_banner.set_revealed(true);
})
.build();
let close_action = ActionEntry::builder("close")
.activate(move |window: &Self, _, _| {
window.close();
@ -306,7 +316,7 @@ impl ReSetWindow {
.license_type(gtk::License::Gpl30)
.website("https://github.com/Xetibo/ReSet")
.issue_url("https://github.com/Xetibo/ReSet/issues")
.version("1.0.0")
.version(VERSION)
.transient_for(window)
.modal(true)
.copyright("© 2022-2023 Xetibo")
@ -320,6 +330,7 @@ impl ReSetWindow {
self.add_action_entries([
search_action,
banner_action,
close_action,
about_action,
vim_up,
@ -385,6 +396,12 @@ fn setup_callback(window: Rc<ReSetWindow>) -> Rc<ReSetWindow> {
self_imp.reset_close.connect_clicked(move |_| {
close_ref.close();
});
self_imp.reset_banner.connect_button_clicked(|banner| {
banner.set_revealed(false);
banner.set_title("Info");
});
window
}

View file

@ -25,6 +25,8 @@ pub struct ReSetWindow {
#[template_child]
pub reset_main: TemplateChild<FlowBox>,
#[template_child]
pub reset_banner: TemplateChild<adw::Banner>,
#[template_child]
pub reset_sidebar_breakpoint: TemplateChild<Breakpoint>,
#[template_child]
pub reset_overlay_split_view: TemplateChild<OverlaySplitView>,
@ -36,6 +38,8 @@ pub struct ReSetWindow {
pub reset_sidebar_toggle: TemplateChild<Button>,
#[template_child]
pub reset_close: TemplateChild<Button>,
// #[template_child]
// pub reset_banner: TemplateChild<adw::Banner>,
pub sidebar_entries: SidebarEntries,
pub default_entry: RefCell<Option<Rc<SidebarEntry>>>,
pub listeners: Arc<Listeners>,
@ -81,14 +85,20 @@ impl WidgetImpl for ReSetWindow {
if width > 658 {
self.reset_main.set_margin_start(60);
self.reset_main.set_margin_end(60);
self.reset_banner.set_margin_start(60);
self.reset_banner.set_margin_end(60);
} else {
let div = (width - 540) / 2;
if div > 1 {
self.reset_main.set_margin_start(div);
self.reset_main.set_margin_end(div);
self.reset_banner.set_margin_start(div);
self.reset_banner.set_margin_end(div);
} else {
self.reset_main.set_margin_start(0);
self.reset_main.set_margin_end(0);
self.reset_banner.set_margin_start(0);
self.reset_banner.set_margin_end(0);
}
}
}

View file

@ -11,7 +11,7 @@ use crate::components::window::sidebar_entry;
#[derive(Default)]
pub enum Categories {
// TODO: are these ever used ?
// FUTURE TODO: are these ever used ?
// Connectivity,
// Audio,
// Peripherals,

View file

@ -1,3 +1,6 @@
use std::hint::{self};
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Arc;
use std::thread;
use std::time::Duration;
@ -11,12 +14,21 @@ use gtk::{gio, Application, CssProvider};
use reset_daemon::run_daemon;
mod components;
mod tests;
const APP_ID: &str = "org.Xetibo.ReSet";
/// Version of the current package.
/// Use this to avoid version mismatch conflicts.
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
#[tokio::main]
async fn main() {
tokio::task::spawn(daemon_check());
let ready = Arc::new(AtomicBool::new(false));
tokio::task::spawn(daemon_check(ready.clone()));
while !ready.load(std::sync::atomic::Ordering::SeqCst) {
hint::spin_loop();
}
gio::resources_register_include!("src.templates.gresource")
.expect("Failed to register resources.");
gio::resources_register_include!("src.icons.gresource").expect("Failed to register resources.");
@ -59,8 +71,8 @@ fn shutdown(_: &Application) {
});
}
async fn daemon_check() {
let handle = thread::spawn(|| {
async fn daemon_check(ready: Arc<AtomicBool>) {
let handle = thread::spawn(move || {
let conn = Connection::new_session().unwrap();
let proxy = conn.with_proxy(BASE, DBUS_PATH, Duration::from_millis(100));
let res: Result<(), Error> = proxy.method_call(BASE, "RegisterClient", ("ReSet",));
@ -68,6 +80,8 @@ async fn daemon_check() {
});
let res = handle.join();
if res.unwrap().is_err() {
run_daemon().await;
run_daemon(Some(ready)).await;
} else {
ready.store(true, Ordering::SeqCst);
}
}

View file

@ -63,14 +63,27 @@
<child>
<object class="GtkViewport">
<child>
<object class="GtkFlowBox" id="reset_main">
<property name="column-spacing">25</property>
<property name="hexpand">True</property>
<property name="hexpand-set">True</property>
<property name="margin-top">5</property>
<property name="row-spacing">25</property>
<property name="selection-mode">none</property>
<property name="valign">start</property>
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="AdwBanner" id="reset_banner">
<property name="button-label">Acknowledge</property>
<property name="css-classes">banner</property>
<property name="margin-bottom">5</property>
<property name="margin-top">5</property>
</object>
</child>
<child>
<object class="GtkFlowBox" id="reset_main">
<property name="column-spacing">25</property>
<property name="hexpand">True</property>
<property name="hexpand-set">True</property>
<property name="margin-top">5</property>
<property name="row-spacing">25</property>
<property name="selection-mode">none</property>
<property name="valign">start</property>
</object>
</child>
</object>
</child>
</object>

View file

@ -45,12 +45,10 @@
(3,40,"GtkScrolledWindow",None,18,None,None,None,1,None,None),
(3,41,"GtkViewport",None,40,None,None,None,None,None,None),
(3,42,"GtkListBox","reset_sidebar_list",41,None,None,None,None,None,None),
(3,43,"GtkScrolledWindow",None,3,None,None,None,1,None,None),
(3,44,"GtkViewport",None,43,None,None,None,None,None,None),
(3,45,"GtkFlowBox","reset_main",44,None,None,None,None,None,None),
(3,43,"GtkScrolledWindow",None,3,None,None,None,2,None,None),
(3,44,"GtkViewport",None,43,None,None,None,1,None,None),
(3,54,"(menu)","main_menu",None,None,None,None,None,None,None),
(3,59,"(external)","54",None,None,None,None,None,None,None),
(3,61,"(external)","59",None,None,None,None,None,None,None),
(3,63,"(external)","61",None,None,None,None,None,None,None),
(3,65,"(external)","63",None,None,None,None,None,None,None),
(3,69,"(external)","67",None,None,None,None,None,None,None),
@ -59,6 +57,9 @@
(3,74,"(external)","72",None,None,None,None,None,None,None),
(3,75,"(item)",None,54,None,None,None,2,None,None),
(3,76,"(external)","74",None,None,None,None,None,None,None),
(3,78,"GtkBox",None,44,None,None,None,-1,None,None),
(3,79,"AdwBanner","reset_banner",78,None,None,None,None,None,None),
(3,80,"GtkFlowBox","reset_main",78,None,None,None,1,None,None),
(4,7,"GtkBox","resetWifi",None,None,None,None,None,None,None),
(4,152,"AdwNavigationView","reset_wifi_navigation",7,None,None,None,1,None,None),
(4,153,"AdwNavigationPage",None,152,None,None,None,None,None,None),
@ -357,17 +358,22 @@
(3,42,"GtkWidget","css-name","resetList",None,None,None,None,None,None,None,None,None),
(3,42,"GtkWidget","width-request","150",None,None,None,None,None,None,None,None,None),
(3,43,"GtkScrolledWindow","propagate-natural-height","True",None,None,None,None,None,None,None,None,None),
(3,45,"GtkFlowBox","column-spacing","25",None,None,None,None,None,None,None,None,None),
(3,45,"GtkFlowBox","row-spacing","25",None,None,None,None,None,None,None,None,None),
(3,45,"GtkFlowBox","selection-mode","none",None,None,None,None,None,None,None,None,None),
(3,45,"GtkWidget","hexpand","True",None,None,None,None,None,None,None,None,None),
(3,45,"GtkWidget","hexpand-set","True",None,None,None,None,None,None,None,None,None),
(3,45,"GtkWidget","margin-top","5",None,None,None,None,None,None,None,None,None),
(3,45,"GtkWidget","valign","start",None,None,None,None,None,None,None,None,None),
(3,73,"(item)","action","win.about",None,None,None,None,None,None,None,None,None),
(3,73,"(item)","label","About",None,None,None,None,None,None,None,None,None),
(3,75,"(item)","action","win.show-help-overlay",None,None,None,None,None,None,None,None,None),
(3,75,"(item)","label","Shortcuts",None,None,None,None,None,None,None,None,None),
(3,78,"GtkOrientable","orientation","vertical",None,None,None,None,None,None,None,None,None),
(3,79,"AdwBanner","button-label","Acknowledge",None,None,None,None,None,None,None,None,None),
(3,79,"GtkWidget","css-classes","banner",None,None,None,None,None,None,None,None,None),
(3,79,"GtkWidget","margin-bottom","5",None,None,None,None,None,None,None,None,None),
(3,79,"GtkWidget","margin-top","5",None,None,None,None,None,None,None,None,None),
(3,80,"GtkFlowBox","column-spacing","25",None,None,None,None,None,None,None,None,None),
(3,80,"GtkFlowBox","row-spacing","25",None,None,None,None,None,None,None,None,None),
(3,80,"GtkFlowBox","selection-mode","none",None,None,None,None,None,None,None,None,None),
(3,80,"GtkWidget","hexpand","True",None,None,None,None,None,None,None,None,None),
(3,80,"GtkWidget","hexpand-set","True",None,None,None,None,None,None,None,None,None),
(3,80,"GtkWidget","margin-top","5",None,None,None,None,None,None,None,None,None),
(3,80,"GtkWidget","valign","start",None,None,None,None,None,None,None,None,None),
(4,7,"GtkOrientable","orientation","vertical",None,None,None,None,None,None,None,None,None),
(4,7,"GtkWidget","hexpand","True",None,None,None,None,None,None,None,None,None),
(4,7,"GtkWidget","hexpand-set","True",None,None,None,None,None,None,None,None,None),

View file

@ -27,4 +27,16 @@ row.audioRow {
notebook > stack > box, notebook > stack {
background-color: @window_bg_color;
}
banner {
border-radius: 5px;
}
row.selectedLanguage {
background-color: @dialog_bg_color;
}
row.activeLanguage {
background-color: @blue_2;
}

24
src/tests.rs Normal file
View file

@ -0,0 +1,24 @@
#[tokio::test]
#[cfg(test)]
async fn test_plugins() {
use crate::daemon_check;
use re_set_lib::utils::plugin::plugin_tests;
use re_set_lib::utils::plugin_setup::FRONTEND_PLUGINS;
use std::hint;
use std::sync::atomic::AtomicBool;
use std::sync::Arc;
let ready = Arc::new(AtomicBool::new(false));
let rc = tokio::runtime::Runtime::new().expect("Failed to create runtime");
rc.spawn(daemon_check(ready.clone()));
while !ready.load(std::sync::atomic::Ordering::SeqCst) {
hint::spin_loop();
}
unsafe {
for plugin in FRONTEND_PLUGINS.iter() {
let name = (plugin.frontend_name)();
let tests = (plugin.frontend_tests)();
plugin_tests(name, tests);
}
}
rc.shutdown_background();
}

1090
test_plugin/Cargo.lock generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -7,7 +7,7 @@ edition = "2021"
crate-type = ["dylib"]
[dependencies]
re_set-lib = { git = "https://github.com/Xetibo/ReSet-Lib" }
re_set-lib = "3.4.0"
gtk = { version = "0.8.1", package = "gtk4", features = ["v4_12"] }
dbus = "0.9.7"
glib = "0.19.3"

View file

@ -8,7 +8,7 @@ use gtk::prelude::{BoxExt, ButtonExt};
use re_set_lib::utils::plugin::{PluginCapabilities, PluginImplementation, PluginTestFunc, SidebarInfo};
pub const BASE: &str = "org.Xetibo.ReSet.Daemon";
pub const DBUS_PATH: &str = "/org/Xebito/ReSet/Plugins/test";
pub const DBUS_PATH: &str = "/org/Xetibo/ReSet/Plugins/test";
pub const INTERFACE: &str = "org.Xetibo.ReSet.TestPlugin";
#[no_mangle]