#!/bin/bash

# archypr:summary=Overwrite the user configs for the Walker application launcher (which also powers the Omarchy Menu) and restart the services.

mkdir -p ~/.config/autostart/
cp $ARCHYPR_PATH/default/walker/walker.desktop ~/.config/autostart/

# And restarts if it crashes or is killed
mkdir -p ~/.config/systemd/user/app-walker@autostart.service.d/
cp $ARCHYPR_PATH/default/walker/restart.conf ~/.config/systemd/user/app-walker@autostart.service.d/restart.conf

systemctl --user daemon-reload

# Refresh configs
archypr-efresh-config walker/config.toml
archypr-efresh-config elephant/calc.toml
archypr-efresh-config elephant/desktopapplications.toml

# Link all elephant menus
mkdir -p ~/.config/elephant/menus
for menu in $ARCHYPR_PATH/default/elephant/*.lua; do
  ln -snf "$menu" ~/.config/elephant/menus/"$(basename "$menu")"
done

# Restart service
archypr-estart-walker
