diff options
| author | tslil clingman <> | 2020-10-19 10:33:54 -0400 |
|---|---|---|
| committer | tslil clingman <> | 2020-10-19 10:35:56 -0400 |
| commit | 24fff7a3ceac1dfaa19518ba806f36a019e9273b (patch) | |
| tree | 69f619a5ca0b2c98366191c4111520b146fd2c34 /qubes-dwm-6.2/scripts/xdg_autostart | |
| parent | ae0602777a5739796f4bf7f2f8d47e5dfede7af4 (diff) | |
Tracking my Qubes DWM configuration
Diffstat (limited to 'qubes-dwm-6.2/scripts/xdg_autostart')
| -rwxr-xr-x | qubes-dwm-6.2/scripts/xdg_autostart | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/qubes-dwm-6.2/scripts/xdg_autostart b/qubes-dwm-6.2/scripts/xdg_autostart new file mode 100755 index 0000000..415cfa8 --- /dev/null +++ b/qubes-dwm-6.2/scripts/xdg_autostart @@ -0,0 +1,30 @@ +#!/bin/bash + +xdg_autostart() { + local config=$1 + shopt -s nullglob + if [[ -d "$config/autostart" ]]; then + local i + for i in $config/autostart/*.desktop; do + grep -q -E "^Hidden=true" "$i" && continue + if grep -q -E "^OnlyShowIn=" "$i"; then + # need to test twice, as lack of the line entirely means we still run it + grep -E "^OnlyShowIn=" "$i" | grep -q 'I3;' || continue + fi + grep -E "^NotShowIn=" "$i" | grep -q 'I3;' && continue + + local trycmd=$(grep -E "^TryExec=" "$i" | cut -d'=' -f2) + if [[ -n "$trycmd" ]]; then + which "$trycmd" >/dev/null 2>&1 || continue + fi + + local cmd=$(grep -E "^Exec=" "$i" | cut -d'=' -f2) + if [[ -n "$cmd" ]]; then + $cmd & + fi + done + fi +} + +xdg_autostart "${XDG_CONFIG_DIRS-/etc/xdg}" +xdg_autostart "${XDG_CONFIG_HOME-$HOME/.config}" |
