0

I am currently trying to add the following script to a eww-button-widget (with :onclick):

#!/bin/bash
selected=$(echo -e "balanced\npower-saver\nperformance" | dmenu -i -p "Select Power-Profile")
powerprofilesctl set ${selected}

I am calling it in my eww.yuck like so:

(defwidget battery []
    (button :onclick "./scripts/battery_profile_dmenu" ...)
)

The script is definetly being executed (I am getting the dmenu prompt) yet nothing past the selected=... part is getting executed.

I've already managed getting other scripts to run (e.g. redshift), only dmenu scripts seem not to be working (networkmanager_dmenu doesn't work this way either).

Note: dmenu also seems to return just fine, piping the result into a file (echo ... | dmenu ... > test.txt) writes the selected field into the file as expected.

  • not an answer to your question (i known nothing about eww-widget) but you should use `printf` rather than `echo`. e.g. `printf '%s\n' balanced power-saver performance | dmenu -i -p "Select Power-Profile"`. See [Why is printf better than echo?](https://unix.stackexchange.com/questions/65803/why-is-printf-better-than-echo). – cas Nov 25 '22 at 03:00

0 Answers0