You are not logged in.
Hello there, I have been writing an Openbox configuration for the passing few days and I noticed some commands can not be executed when you write them inside rc.xml. I checked their documentation (http://openbox.org/wiki/Help:Actions#Execute) and couldn't find much about my problem. The commands run perfectly under the shell environment. I tested each of them. For example:
<keybind key="W-A-d">
<action name="Execute">
<startupnotify>
<enabled>true</enabled>
<name>notify-send</name>
</startupnotify>
<command>notify-send "$(date +%H:%M)" "$(date +%d) $(date +%m) $(date +%Y) - $(date +%A)"</command>
</action>
</keybind>
Returns the string "$(date +%H:%M) - $(date +%d) $(date +%m) $(date +%Y) - $(date +%A)" instead of actually giving the time and date.
And these two:
<keybind key="C-Print">
<action name="Execute">
<startupnotify>
<enabled>true</enabled>
<name>maim</name>
</startupnotify>
<command>maim -s -u | xclip -selection clipboard -t image/png -i</command>
</action>
</keybind>
<keybind key="W-u">
<action name="Execute">
<startupnotify>
<enabled>true</enabled>
<name>sh</name>
</startupnotify>
<command>sh ; packages="$(yay -Qu | wc -l)";case "$packages" in 0)notify-send "yay" "System is up to Date";;1)notify-send "yay" "1 Package needs update";;*)notify-send "yay" "$packages Packages needs update";;esac</command>
</action>
</keybind>
Returns nothing except for making the mouse cursor do the loading sign. I assume Openbox can not handle piping from these two examples, is there a way to make it work? Also before you ask, even after pressing those buttons and restarting Openbox ~/.cache/openbox/openbox.log is empty, so no use there.
Last edited by xanrer (2022-01-21 13:44:47)
Offline
Please use code tags for pasting outputs: https://bbs.archlinux.org/help.php#bbcode
You use shell constructs while not being in a shell, which the documentation you link mentions is not going to happen.
The "~" tilde character will be expanded to your home directory, but no other shell expansions or scripting syntax may be used in the command unless they are passed to the sh command
Actually execute those with bash e.g.
bash -c 'notify-send "$(date +%H:%M)" "$(date +%d) $(date +%m) $(date +%Y) - $(date +%A)"'
You try it in the last action but the syntax for that would be wrong, you'd use sh -c '$insertlongcommandhere'
Last edited by V1del (2022-01-21 13:49:26)
Offline
Thank you very much! Also, you forgot the last double quote after the command before the single quote. In case someone else wants to try it.
Offline
Whoops incomplete c'n'p, fixed.
Offline