Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

invalid substitution type #7

Closed
timonson opened this issue Nov 21, 2019 · 4 comments
Closed

invalid substitution type #7

timonson opened this issue Nov 21, 2019 · 4 comments

Comments

@timonson
Copy link

Hi Ventto, thank you for this repo because I have used batify on my arch os for a long time. Unfortunately as of recently I see the following messages in my journalctl -p 3 -xb output. Do you have an idea how I could fix that? Thank you very much!

Nov 21 03:17:24 user systemd-udevd[307]: /etc/udev/rules.d/99-batify.rules:8 Invalid value "/bin/su $env{XUSER} -c '/usr/bin/notify-send -a batify -u critical Discharging:$attr{capacity}%'" for RUN (char 95: invalid substitution type), ignoring, but please fix it.
Nov 21 03:17:24 user systemd-udevd[307]: /etc/udev/rules.d/99-batify.rules:15 Invalid value "/bin/su $env{XUSER} -c '/usr/bin/notify-send -a batify -u critical Discharging:$attr{capacity}%'" for RUN (char 95: invalid substitution type), ignoring, but please fix it.
@Ventto
Copy link
Owner

Ventto commented Jan 7, 2020

Hi @timonson,
Thanks for the feedback.

  • Try to remove every % characters at the end of shell command (ex: Discharging:$attr{capacity}%'").

  • Then reload the rules:

$ sudo udevadm control --reload-rules
  • Finally, trigger the rules with the following command:
$ sudo udevadm trigger --action=change --subsystem-match=power_supply

Tell me if it works.

Ventto pushed a commit that referenced this issue Jan 7, 2020
@timonson
Copy link
Author

timonson commented Jan 7, 2020

@Ventto It works, thank you very much for coming back to this topic!

@timonson timonson closed this as completed Jan 9, 2020
@yuceltoluyag
Copy link

same problem ,I tried your solution but failed @Ventto

/etc/udev/rules.d/99-batify.rules:6 I>
Mar 18 18:14:34 jason systemd-udevd[347]: /etc/udev/rules.d/99-batify.rules:13

/etc/udev/rules.d/99-batify.rules

ACTION=="change", KERNEL=="BAT0", \
SUBSYSTEM=="power_supply", \
ATTR{status}=="Discharging", \
ATTR{capacity}=="[0-9]", \
IMPORT{program}="/usr/bin/xpub", \
RUN+="/bin/su $env{XUSER} -c 'notify-send -u critical Discharging:$attr{capacity}%'"

ACTION=="change", KERNEL=="BAT0", \
SUBSYSTEM=="power_supply", \
ATTR{status}=="Discharging", \
ATTR{capacity}=="1[0-9]", \
IMPORT{program}="/usr/bin/xpub", \
RUN+="/bin/su $env{XUSER} -c 'notify-send -u normal Discharging:$attr{capacity}%'"

SUBSYSTEM=="power_supply", ACTION=="change", \
ENV{POWER_SUPPLY_ONLINE}=="0", ENV{POWER}="off", \
OPTIONS+="last_rule", \
IMPORT{program}="/usr/bin/xpub", \
RUN+="/bin/su $env{XUSER} -c 'notify-send -u low UnPlugged'"

SUBSYSTEM=="power_supply", ACTION=="change", \
ENV{POWER_SUPPLY_ONLINE}=="1", ENV{POWER}="on", \
OPTIONS+="last_rule", \
IMPORT{program}="/usr/bin/xpub", \
RUN+="/bin/su $env{XUSER} -c 'notify-send -u low PluggedIn'"

@timonson
Copy link
Author

timonson commented Mar 20, 2020

@yuceltoluyag try this branch: https://github.com/Ventto/batify/tree/fix_invalid_substitution because @Ventto has not merged this commit to master yet.
Otherwise I would recommend to open a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants