Skip to content

Commit 8765cbf

Browse files
author
marttcw
committed
v0.0.4 RELEASE: Removed daemon option+usaged. Updated README.
REMOVED: Daemonization. Daemonization causes the counter to not work, therefore it is removed. README: Updated for v0.0.4 release.
1 parent 2fdeaa8 commit 8765cbf

File tree

6 files changed

+23
-61
lines changed

6 files changed

+23
-61
lines changed

Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,3 @@ tokio = { version = "1", features = ["full"] }
2020
futures = "0.3"
2121
a2s = { git = "https://github.com/rumblefrog/a2s-rs.git" }
2222

23-
[target.'cfg(unix)'.dependencies]
24-
daemonize = "0.4.1"
25-

README.md

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
11
# steamcountsnotifyd
22
SteamCountsNotifyD is a notification daemon written in Rust that notifies you when your selected game(s) gets some player activity
33

4-
* Development release: v0.0.4 - Alpha
5-
* Current release: v0.0.2 - Alpha
4+
* Current release: v0.0.4 - Alpha
5+
* (In-Development) Next release: v0.0.5 - Alpha
66

77
## License
88
SteamCountsNotifyD is released under a the [GNU General Public License v3.0](https://www.gnu.org/licenses/gpl-3.0.html) a free software copyleft license.
99

1010
## Dependencies
11+
* serde, serde\_json, toml, dirs-next, notify-rust, clap, reqwest, tokio, futures, a2s
12+
* All apart from a2s are available on [crates.io](https://crates.io/)
13+
* a2s: [a2s-rs repo](https://github.com/rumblefrog/a2s-rs)
1114

1215
## Requirements to build
13-
* [rust](https://www.rust-lang.org/)
16+
* [Rust](https://www.rust-lang.org/)
17+
* Just install with the instructions straight from the site. The compiler and cargo should be provided by default.
1418

1519
## Instructions
16-
### Compile
17-
* `cd steamcountsnotifyd`
18-
* `cargo build`
19-
### Install
20-
* `cargo install`
20+
### Compile and Install
21+
* `cargo install --path .`
2122
### Uninstall
2223
* `cargo uninstall`
2324

@@ -27,6 +28,7 @@ SteamCountsNotifyD is released under a the [GNU General Public License v3.0](htt
2728
## Configuration
2829
* Uses xdg directory: `$HOME/.config/steamcountsnotifyd/config.toml`
2930
* Program will generate the configuration file if user requested via `--generate-config` and is not available
31+
3032
### Parameters
3133
CLI | Name | Description
3234
---|---|---
@@ -35,8 +37,7 @@ CLI | Name | Description
3537
`-c` | `connection_timeout` | How long in seconds the connection stay puts.
3638
`-n` | `notify_timeout` | How long in seconds the notification stays shown.
3739
`-a` | `action_type` | Which type of clickable notification should use: 0 - click, 1 - button
38-
`-d` | `daemonize` | This flag makes the program daemonize
39-
`-g` | `generate` | Generates configuration file at default directory
40+
4041
### Example
4142
```
4243
interval = 1
@@ -63,16 +64,19 @@ threshold = 0
6364
### systemd
6465
* Use the systemd daemon as under user control, more information: [systemd/User - ArchWiki](https://wiki.archlinux.org/index.php/systemd/User)
6566

66-
## TODO (Possible future features)
67-
* SOON: Per server notification
67+
## TODO
68+
* Edit configuration via the CLI
6869
* Improving on the Windows port
6970
* Better documentation and comments
7071
* Making it work with systemd properly
7172
* Support reload function
7273
* Support runit and openrc also, sysvinit won't be however
74+
* Configuration: More controls can be given for per game/server
75+
* EX: Give interval for each game/server
7376

7477
## Releases
75-
### v0.0.4 Alpha (Rust Rewrite)
78+
### v0.0.4 Alpha (First Version of Rust Rewrite)
79+
* 2021-03-01: Daemon option and forking/daemonization process removed
7680
* Using [a2s-rs](https://github.com/rumblefrog/a2s-rs) library to do Source A2S Queries
7781
* Can now query from each server
7882
* Roughly working and ported to Windows 10
@@ -82,10 +86,12 @@ threshold = 0
8286
* NOTE: Daemon is there but counter notification not working and CLI flag different/switched
8387
* Non-daemon is by default
8488
* 2021-02-22: Initial rewrite to Rust
89+
8590
### v0.0.3 Alpha (Final C++ Version, Unreleased)
8691
* Notification hint set to "resident", meaning the game launcher is clickable even if after the notification goes away
8792
* However only usable if only "default" (default anyway) is set
8893
* Notifies that the daemon started up
94+
8995
### v0.0.2 Alpha
9096
* counts to count (grammar fix)
9197
* systemd service file available, but buggy at the moment (need `restart` after a `start`)
@@ -94,6 +100,7 @@ threshold = 0
94100
* Added the ability to launch the game (`default` or `clicked` options available)
95101
* Added `actiontype` to configuration and command-line paramter
96102
* 0 = default, 1 = clicked
103+
97104
### v0.0.1 Alpha
98105
* First release
99106
* Basic daemon implementation implemented

src/cli.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@ use clap::Clap;
33
#[derive(Clap, Debug)]
44
#[clap(version = "0.0.4 Alpha", author = "mtcw <[email protected]>")]
55
pub struct Opts {
6-
/// Run the program in daemonized/background mode
7-
#[clap(short, long)]
8-
pub daemonize: bool,
9-
106
/// Generate default configuration file (if not available)
117
#[clap(long)]
128
pub generate_config: bool,

src/count.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,5 +109,7 @@ pub async fn main_loop(cfg: &config::Config) -> Result<(), Box<dyn std::error::E
109109
}
110110

111111
join_all(tasks).await;
112+
112113
Ok(())
113114
}
115+

src/main.rs

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -8,34 +8,6 @@ use futures::executor::block_on;
88
use std::fs::{create_dir, File};
99
use std::io::prelude::*;
1010

11-
#[cfg(unix)]
12-
use daemonize::Daemonize;
13-
14-
#[cfg(unix)]
15-
fn daemonize() {
16-
let stdout = File::create("/tmp/steamcountsnotifyd.out").unwrap();
17-
let stderr = File::create("/tmp/steamcountsnotifyd.err").unwrap();
18-
19-
let daemonize = Daemonize::new()
20-
.pid_file("/tmp/steamcountsnotifyd.pid")
21-
.chown_pid_file(true)
22-
.working_directory("/tmp")
23-
.umask(0o777)
24-
.stdout(stdout)
25-
.stderr(stderr);
26-
27-
match daemonize.start() {
28-
Ok(_) => {
29-
println!("Running in daemonize mode...");
30-
notify::daemon_startup();
31-
}
32-
Err(why) => eprintln!("ERROR: Cannot daemonize: {}", why),
33-
}
34-
}
35-
36-
#[cfg(windows)]
37-
fn daemonize() {}
38-
3911
#[tokio::main]
4012
async fn main() -> std::io::Result<()> {
4113
let opts: cli::Opts = cli::parse();
@@ -89,10 +61,6 @@ async fn main() -> std::io::Result<()> {
8961
}
9062
}
9163

92-
if opts.daemonize {
93-
daemonize();
94-
}
95-
9664
match block_on(count::main_loop(&cfg)) {
9765
Err(_) => {
9866
eprintln!("ERROR: An error in the main loop occured.");
@@ -101,3 +69,4 @@ async fn main() -> std::io::Result<()> {
10169
Ok(_) => Ok(()),
10270
}
10371
}
72+

src/notify.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,3 @@ pub fn server(info: &Info, timeout: u32, address: &str, action_type: ActionType)
109109
});
110110
}
111111

112-
#[cfg(unix)]
113-
pub fn daemon_startup() {
114-
Notification::new()
115-
.summary("steamcountsnotifyd")
116-
.body("steamcountsnotifyd daemon started up")
117-
.timeout(5000)
118-
.show()
119-
.unwrap();
120-
}

0 commit comments

Comments
 (0)