new tool: wm-xdg-autostart

parent fa08b119
......@@ -7,6 +7,12 @@
## Description
The set of utilities used in Ximper Linux includes various tools that help speed up or automate processes that are not available by default in the system.
## Available utilities
### wm-xdg-autostart
Script for automatically starting applications that support XDG Autostart.
Necessary for window managers that do not support this specification.
## License
MIT License
......
#!/usr/bin/env bash
# The script created by RedBearAK(https://github.com/RedBearAK) was used as a basis.
send_log() {
echo "$1" | tee >(logger -p user.info)
}
send_log "Processing the contents of the XDG Autostart folders..."
autostart_dirs=(~/.config/autostart /etc/xdg/autostart)
for dir in "${autostart_dirs[@]}"; do
for entry in "$dir"/*.desktop; do
if [[ -f "$entry" ]]; then
cmd=$(grep '^Exec=' "$entry" | head -n 1 | sed 's/^Exec=//' | sed 's/%.//g')
send_log "Launching the desktop file: '$entry'"
# shellcheck disable=SC2086
$cmd > /dev/null 2>&1 &
elif [[ -x "$entry" ]]; then
send_log "Running an executable file: '$entry'"
"$entry" > /dev/null 2>&1 &
fi
done
done
send_log "The processing of the contents of the XDG Autostart folders has been completed."
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment