feat: unify host detection and profile mapping
- Add host-profiles.conf for hostname-to-profile mapping
- Update symlinks script to use mapping and error early if unmapped
🤖 Generated with opencode
Co-Authored-By: opencode <noreply@opencode.ai>
This commit is contained in:
parent
f66b63354a
commit
a9e5ace080
3
host-profiles.conf
Normal file
3
host-profiles.conf
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# Map hostnames to device profiles
|
||||||
|
lousy-arch=desktop
|
||||||
|
archlaptop=laptop
|
||||||
@ -37,10 +37,17 @@ if [ -d "$CONFIG_DIR" ]; then
|
|||||||
echo "Linked .config/$baseitem"
|
echo "Linked .config/$baseitem"
|
||||||
done
|
done
|
||||||
|
|
||||||
# Device-specific symlinks for Hyprland and Waybar
|
# Device-specific symlinks for Hyprland and Waybar using host-profiles.conf
|
||||||
if [ -n "$DOTFILES_DEVICE" ]; then
|
|
||||||
# Hyprland monitors (hostname-based)
|
|
||||||
HOSTNAME=$(hostname)
|
HOSTNAME=$(hostname)
|
||||||
|
PROFILE=""
|
||||||
|
if [ -f "$DOTFILES_DIR/host-profiles.conf" ]; then
|
||||||
|
PROFILE=$(awk -F= -v h="$HOSTNAME" '$1==h{print $2}' "$DOTFILES_DIR/host-profiles.conf")
|
||||||
|
fi
|
||||||
|
if [ -z "$PROFILE" ]; then
|
||||||
|
echo "ERROR: No profile mapping found for hostname '$HOSTNAME' in $DOTFILES_DIR/host-profiles.conf"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
# Hyprland monitors
|
||||||
if [ -f "$CONFIG_DIR/hypr/includes/monitors-$HOSTNAME.conf" ]; then
|
if [ -f "$CONFIG_DIR/hypr/includes/monitors-$HOSTNAME.conf" ]; then
|
||||||
ln -sf "$CONFIG_DIR/hypr/includes/monitors-$HOSTNAME.conf" "$CONFIG_DIR/hypr/includes/monitors.conf"
|
ln -sf "$CONFIG_DIR/hypr/includes/monitors-$HOSTNAME.conf" "$CONFIG_DIR/hypr/includes/monitors.conf"
|
||||||
echo "Linked monitors-$HOSTNAME.conf as monitors.conf"
|
echo "Linked monitors-$HOSTNAME.conf as monitors.conf"
|
||||||
@ -48,11 +55,14 @@ if [ -d "$CONFIG_DIR" ]; then
|
|||||||
echo "Warning: No monitors config for hostname $HOSTNAME"
|
echo "Warning: No monitors config for hostname $HOSTNAME"
|
||||||
fi
|
fi
|
||||||
# Hyprland hypridle
|
# Hyprland hypridle
|
||||||
ln -sf "$CONFIG_DIR/hypr/includes/hypridle-$DOTFILES_DEVICE.conf" "$CONFIG_DIR/hypr/hypridle.conf"
|
if [ -f "$CONFIG_DIR/hypr/includes/hypridle-$PROFILE.conf" ]; then
|
||||||
echo "Linked hypridle-$DOTFILES_DEVICE.conf as hypridle.conf"
|
ln -sf "$CONFIG_DIR/hypr/includes/hypridle-$PROFILE.conf" "$CONFIG_DIR/hypr/hypridle.conf"
|
||||||
|
echo "Linked hypridle-$PROFILE.conf as hypridle.conf"
|
||||||
|
fi
|
||||||
# Waybar config
|
# Waybar config
|
||||||
ln -sf "$CONFIG_DIR/waybar/config-$DOTFILES_DEVICE" "$CONFIG_DIR/waybar/config"
|
if [ -f "$CONFIG_DIR/waybar/config-$PROFILE" ]; then
|
||||||
echo "Linked config-$DOTFILES_DEVICE as waybar config"
|
ln -sf "$CONFIG_DIR/waybar/config-$PROFILE" "$CONFIG_DIR/waybar/config"
|
||||||
|
echo "Linked config-$PROFILE as waybar config"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user