Skip to content

Commit

Permalink
no roads
Browse files Browse the repository at this point in the history
  • Loading branch information
Anthony Templeton committed Nov 21, 2023
1 parent 56b8d6d commit f5edfdd
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 36 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "swaddle"
version = "0.1.0"
version = "0.1.2"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
30 changes: 11 additions & 19 deletions PKGBUILD
Original file line number Diff line number Diff line change
@@ -1,32 +1,24 @@
pkgname=swaddle
pkgver=0.1.1
pkgver=0.1.2
pkgrel=1
pkgdesc="Swayidle inhibitor when watching content or listening to audio"
arch=('x86_64')
license=('GPL')
depends=('dbus' 'openssl')
makedepends=('cargo' 'rust')
source=("$pkgname-$pkgver.tar.gz::https://github.com/attron/$pkgname/archive/v$pkgver.tar.gz"
"$pkgname.service")
sha256sums=('SKIP'
'SKIP')

url="https://github.com/ATTron/swaddle"
license=('MIT')
source=("$url/archive/$pkgver.tar.gz")
sha256sums=('SKIP')

build() {
cd "$srcdir/$pkgname-$pkgver"
cargo build --release --locked
cargo build --release
}

package() {
cd "$srcdir/$pkgname-$pkgver"
install -Dm755 "target/release/$pkgname" "$pkgdir/usr/bin/$pkgname"
install -Dm644 "$srcdir/$pkgname.service" "$pkgdir/usr/lib/systemd/system/$pkgname.service"
}

post_install() {
systemctl daemon-reload
}
install -Dm755 "target/release/swaddle" "$pkgdir/usr/local/bin/swaddle"

post_upgrade() {
post_install
# Post-install instructions
echo "Swaddle has been installed. To integrate it with Sway, add the following line to your Sway configuration:"
echo "exec_always --no-startup-id /usr/local/bin/swaddle &"
echo "Then reload your Sway configuration or restart Sway."
}
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@

**note**
**right now this has only been tested with firefox, not sure how well it will work with chrome based browsers at this time**
## Installation

Swaddle can be installed from the AUR:

```sh
yay -S swaddle
```

## Post-Install
To integrate swaddle with Sway, add the following line to your Sway configuration:
`exec_always --no-startup-id /usr/bin/swaddle &`
Then reload your Sway configuration or restart Sway.

## Overview

The main function of this project is to keep swayWM from going into an idle state when watching Youtube videos. This Rust project includes a D-Bus Runner (`DBusRunner`) and an Idle Application (`IdleApp`). It is designed to interface with D-Bus for message handling, particularly for managing media playback statuses, and to execute commands based on these statuses.
Expand Down
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ impl DBusRunner {

impl DBusInterface for DBusRunner {
fn add_match(&self) -> Result<(), Box<dyn Error>> {
let m_rule = MatchRule::new()
let rule = MatchRule::new()
.with_interface(INTERFACE_NAME)
.with_namespaced_path(DBUS_NAMESPACE);

let sending_clone = Arc::clone(&self.good_to_send);
self.connection.add_match(m_rule, move |_: (), _, msg| {
self.connection.add_match(rule, move |_: (), _, msg| {
let items: HashMap<String, Variant<Box<dyn RefArg>>> =
msg.read3::<String, HashMap<_, _>, Vec<String>>().unwrap().1;
if let Some(playback_status) = items.get("PlaybackStatus") {
Expand Down
13 changes: 0 additions & 13 deletions swaddle.service

This file was deleted.

0 comments on commit f5edfdd

Please sign in to comment.