bakkeby / dwm-flexipatch

A dwm build with preprocessor directives to decide which patches to include during build time
MIT License
1.18k stars 239 forks source link

AUTOSTART_PATCH open terminal in 1st tag #405

Closed spavlovich001 closed 9 months ago

spavlovich001 commented 11 months ago

If I activate AUTOSTART_PATCH and make install clean and run dwm - I have opened terminal in 1st tag. 9869c22

#!/usr/bin/env bash
# set -x

DIR_OUT="${HOME}/media/source_code"
PATH_FINALIZER='flexipatch-finalizer'
PATH_FINALIZER_IN='dwm-flexipatch'
PATH_FINALIZER_OUT='dwm-flexipatch-out'

# initial make and copy clear patches.h
make >/dev/null 2>&1 && make clean >/dev/null 2>&1
cp -prf patches.def.h patches.h

# enable\disable patches
PATCH_OUT_FILE='patches.h'
PATCH_ENABLE=(
    BAR_SYSTRAY_PATCH
    BAR_TITLE_LEFT_PAD_PATCH
    BAR_NO_COLOR_EMOJI_PATCH
    AUTOSTART_PATCH
    CFACTS_PATCH
    CYCLELAYOUTS_PATCH
    FOCUSONCLICK_PATCH
    MONITOR_RULES_PATCH
    NOBORDER_PATCH
    PERTAG_PATCH
    PUSH_PATCH
    SHIFTVIEW_PATCH
    COLUMNS_LAYOUT
    VIEW_HISTORY_PATCH
    ZOOMSWAP_PATCH
)
PATCH_DISABLE=()

for i in "${PATCH_ENABLE[@]}"; do
   sed -i -e "s/${i} 0/${i} 1/g" "${PATCH_OUT_FILE}"
done

# flexipatch-finalizer
cd ..
if [[ -d "${PATH_FINALIZER}" ]]; then
    rm -rf "${DIR_OUT}/${PATH_FINALIZER_OUT}"
    echo "start finalizer"
    cd "${PATH_FINALIZER}"
    mkdir -p "${DIR_OUT}/${PATH_FINALIZER_OUT}"
    ./flexipatch-finalizer.sh -r -d ../"${PATH_FINALIZER_IN}" -o "${DIR_OUT}/${PATH_FINALIZER_OUT}"
    echo "finalizer done"
else
    echo "flexipatch-finalizer not found"
fi
bakkeby commented 11 months ago

Yes.

In your case you are using a script to enable patches and your sed command will replace "AUTOSTART_PATCH 0" with "AUTOSTART_PATCH 1", which also matches and enables this patch:

/* Allow dwm to execute commands from autostart array in your config.h file. When dwm exits
 * then all processes from autostart array will be killed.
 * https://dwm.suckless.org/patches/cool_autostart/
 */
#define COOL_AUTOSTART_PATCH 0

The cool autostart patch will automatically start st as an example.

If you include "define " in your sed expression then it should only enable the intended patch.

spavlovich001 commented 11 months ago

If you include "define " in your sed expression then it should only enable the intended patch.

sed -i -e "s/\b${i} 0/${i} 1/g" "${PATCH_OUT_FILE}"  # fix this problem

Thanks =)