MaxVerevkin / swaystatus

Status command for i3bar/swaybar written in async rust. Based on i3status-rust.
https://maxverevkin.github.io/swaystatus
GNU General Public License v3.0
7 stars 2 forks source link

swaystatus should not be hard-linked to libnotmuch #16

Closed farwayer closed 2 years ago

farwayer commented 2 years ago
  = note: /usr/bin/ld: cannot find -lnotmuch
          collect2: error: ld returned 1 exit status

or the user will be forced to install notmuch even if he does not use this block

MaxVerevkin commented 2 years ago

I totally agree! However I don't know how to add a cfg attribute in the current define_blocks! macro. Just putting it before the block name gives this error:

error: no rules expected the token `#`
  --> src/blocks.rs:76:5
   |
24 | macro_rules! define_blocks {
   | -------------------------- when calling this macro
...
76 |     #[cfg(feature = "notmuch")]
   |     ^ no rules expected this token in macro call

I can't pass optional arguments to the macro too:

macro_rules! define_blocks {
    ($($block:ident ($cfg:literal)?),*) => { ... }
}
error: no rules expected the token `,`
  --> src/blocks.rs:52:8
   |
24 | macro_rules! define_blocks {
   | -------------------------- when calling this macro
...
52 |     apt,
   |        ^ no rules expected this token in macro call
MaxVerevkin commented 2 years ago

Implemented in https://github.com/greshake/i3status-rust/commit/d26c40af25a61507ab94c6c543581f50aaab0a5d