How do I enable both Wi‑Fi and hotspot at the same time when using a Realtek card?

The channels keep changing every now and then, so I feel like this is a better solution, but it’s CLI-based. If anyone can make this a GUI widget or something, feel free to do so cuz I’d love that, but I’m just using this as a place to keep all my tiny mods so that when I need to reinstall Fedora, I can copy and paste it.:sweat_smile:

Need to install wihotspot from Fedora COPR tho, it’s on that guy’s GitHub.

#!/bin/bash

# --- CONFIGURATION ---
WIFI_IFACE="wlo1"
SSID="wifiname"
PASSWORD="password"
# ---------------------

if [ "$EUID" -ne 0 ]; then
  echo "Please run as root: sudo hotspot"
  exit
fi

echo "=========================================="
echo "       UNIVERSAL HOTSPOT LAUNCHER         "
echo "=========================================="

# 1. Detect Upstream
UPSTREAM_IFACE=$(ip route get 1.1.1.1 | grep -oP 'dev \K\S+')

if [ -z "$UPSTREAM_IFACE" ]; then
    echo "!! No internet connection found."
    exit 1
fi

echo ">> Internet Source: $UPSTREAM_IFACE"

# 2. Logic: Configure Channel
# We use '-c' (short flag) because the Fedora version rejects '--channel'
if [ "$UPSTREAM_IFACE" == "$WIFI_IFACE" ]; then
    echo ">> Mode: Wi-Fi Repeater"
    
    FREQ=$(iw dev $WIFI_IFACE link | grep -oP 'freq: \K[0-9]+')
    if [ -z "$FREQ" ]; then
        echo "!! Error: Could not detect upstream Wi-Fi frequency."
        exit 1
    fi

    if [ "$FREQ" -gt 5000 ]; then
        CHANNEL=$(( (FREQ - 5000) / 5 ))
    else
        CHANNEL=$(( (FREQ - 2407) / 5 ))
    fi
    
    echo ">> Syncing Channel: $CHANNEL"
else
    echo ">> Mode: Wired Sharing"
    CHANNEL=1
    echo ">> Setting Channel: 1 (Safe Default)"
fi

echo "=========================================="
echo "Starting Hotspot... (Press Ctrl+C to Stop)"
echo "Logs will appear below:"
echo "------------------------------------------"

# 3. Run create_ap
# FIXES: 
# - Used '-c' instead of '--channel'
# - Removed '--freq-band' (inferred from channel)

exec create_ap -c $CHANNEL --no-haveged $WIFI_IFACE $UPSTREAM_IFACE "$SSID" "$PASSWORD"