Skip to content

Commit d7d975c

Browse files
refactor: Use msg_* helpers consistently
Replace echo with emoji (❌, ⚠️, ✓) with msg_* functions. Added msg_* to omarchy-looking-glass-install.
1 parent c348339 commit d7d975c

7 files changed

+193
-177
lines changed

bin/omarchy-gpu-passthrough-bind

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ check_gpu_processes() {
7878
echo ""
7979
sudo fuser -v /dev/nvidia* 2>&1 | grep -iE "Hyprland|USER" | head -10
8080
echo ""
81-
msg_warn "Solution: Run from TTY or SSH"
81+
msg_warning "Solution: Run from TTY or SSH"
8282
echo " 1. Switch to TTY (Ctrl+Alt+F2) or SSH from another machine"
8383
echo " 2. Run: omarchy-gpu-passthrough mode vm"
8484
echo " 3. Start VM from there"
@@ -157,7 +157,7 @@ check_gpu_processes() {
157157
echo ""
158158
fi
159159

160-
msg_warn "GPU is bound to vfio-pci and in use (likely by running VM)"
160+
msg_warning "GPU is bound to vfio-pci and in use (likely by running VM)"
161161
echo ""
162162
echo "To unbind GPU:"
163163
echo " 1. Stop your VM: omarchy-windows-vm stop"
@@ -253,7 +253,7 @@ check_display_safety() {
253253
echo ""
254254
msg_error "Detected $connected_displays monitor(s) on $gpu_drm_card - unbind will cause BLACKSCREEN!"
255255
echo ""
256-
msg_warn "Solution:"
256+
msg_warning "Solution:"
257257
echo " 1. Move monitor cable to iGPU port (motherboard HDMI/DP)"
258258
echo " 2. Set BIOS: Primary Display = IGD"
259259
echo " 3. Reboot and run: omarchy-gpu-passthrough setup"
@@ -651,7 +651,7 @@ cmd_unbind() {
651651
log_warn "Failed to update state marker (continuing anyway)"
652652
fi
653653
else
654-
msg_warn "Unbound but driver not auto-loaded (current: ${current_driver:-none})"
654+
msg_warning "Unbound but driver not auto-loaded (current: ${current_driver:-none})"
655655
msg_info "Manual reload: sudo modprobe -i $GPU_DRIVER_ORIGINAL"
656656
log_warn "=== UNBIND PARTIAL: driver not loaded (${current_driver:-none}) ==="
657657

bin/omarchy-gpu-passthrough-info

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ verify_hardware_requirements() {
4242
fi
4343
[[ "$quiet" != "true" ]] && msg_success " $GPU_COUNT GPUs detected$iommu_status"
4444
elif [[ "$GPU_COUNT" -eq 1 ]]; then
45-
[[ "$quiet" != "true" ]] && msg_warn " Only 1 GPU detected (need 2+ for passthrough)"
45+
[[ "$quiet" != "true" ]] && msg_warning " Only 1 GPU detected (need 2+ for passthrough)"
4646
if [[ "$is_configured" == "true" ]]; then
4747
((errors++))
4848
fi
@@ -125,7 +125,7 @@ verify_kernel_config() {
125125
if echo "$limine_params" | grep -qE "amd_iommu=on|intel_iommu=on"; then
126126
msg_success " IOMMU parameters present ✓"
127127
else
128-
msg_warn " IOMMU parameters NOT in config - run setup to reconfigure"
128+
msg_warning " IOMMU parameters NOT in config - run setup to reconfigure"
129129
fi
130130
fi
131131

@@ -237,7 +237,7 @@ verify_setup() {
237237
msg_success "$status_msg (ready for VM) ✓"
238238
((vfio_gpus++))
239239
elif [[ "$driver" == "none" ]]; then
240-
msg_warn "$status_msg (no driver)"
240+
msg_warning "$status_msg (no driver)"
241241
else
242242
if [[ "$type" == "integrated" ]]; then
243243
msg_info "$status_msg (host display)"
@@ -263,7 +263,7 @@ verify_setup() {
263263
[[ -n "$renderer" ]] && msg_success " Renderer: $renderer"
264264
[[ -n "$version" ]] && echo " OpenGL: $version"
265265
else
266-
msg_warn " Unable to query OpenGL info"
266+
msg_warning " Unable to query OpenGL info"
267267
fi
268268
fi
269269

@@ -282,9 +282,9 @@ verify_setup() {
282282
msg_success "Status: Ready for GPU passthrough! ✓"
283283
echo ""
284284
echo "GPU passthrough is properly configured:"
285-
echo "$vfio_gpus GPU(s) bound to vfio-pci"
286-
echo "IOMMU enabled and configured"
287-
echo "Kernel parameters active"
285+
msg_success "$vfio_gpus GPU(s) bound to vfio-pci"
286+
msg_success "IOMMU enabled and configured"
287+
msg_success "Kernel parameters active"
288288
elif [[ "$total_errors" -eq 0 ]] && [[ "$vfio_gpus" -eq 0 ]]; then
289289
# Detect current GPU mode (dynamic binding design supports 3 states)
290290
local gpu_mode="unknown"
@@ -298,8 +298,8 @@ verify_setup() {
298298
msg_success "Status: GPU in boot state (dynamic binding) ✓"
299299
echo ""
300300
echo "GPU is blacklisted and inactive (by design)."
301-
echo "IOMMU enabled and configured"
302-
echo "Kernel parameters active"
301+
msg_success "IOMMU enabled and configured"
302+
msg_success "Kernel parameters active"
303303
echo ""
304304
echo "To use GPU:"
305305
echo " • For VM: omarchy-gpu-passthrough mode vm"
@@ -309,15 +309,15 @@ verify_setup() {
309309
msg_success "Status: GPU bound to native driver ✓"
310310
echo ""
311311
echo "GPU is available for host use (CUDA/compute)."
312-
echo "IOMMU enabled and configured"
313-
echo "GPU bound to native driver"
312+
msg_success "IOMMU enabled and configured"
313+
msg_success "GPU bound to native driver"
314314
echo ""
315315
echo "To use GPU in VM:"
316316
echo " • Run: omarchy-gpu-passthrough mode vm"
317317
;;
318318
*)
319319
# Unknown state (shouldn't happen, but keep old message as fallback)
320-
msg_warn "Status: Configured (GPU mode: $gpu_mode)"
320+
msg_warning "Status: Configured (GPU mode: $gpu_mode)"
321321
echo ""
322322
echo "Configuration exists. GPU not bound to vfio-pci."
323323
echo " Hint: Use 'omarchy-gpu-passthrough mode vm' to bind for VM"
@@ -715,7 +715,7 @@ cmd_detect() {
715715
if check_iommu_support; then
716716
msg_success "IOMMU: Enabled"
717717
else
718-
msg_warn "IOMMU: Not detected (enable in BIOS)"
718+
msg_warning "IOMMU: Not detected (enable in BIOS)"
719719
fi
720720
}
721721

@@ -727,7 +727,7 @@ cmd_status() {
727727
if ! load_gpu_config 2>/dev/null; then
728728
# Not configured - show helpful message
729729
echo ""
730-
msg_warn "GPU passthrough not configured"
730+
msg_warning "GPU passthrough not configured"
731731
echo ""
732732
echo "Next steps:"
733733
echo " 1. omarchy-gpu-passthrough setup"

bin/omarchy-gpu-passthrough-setup

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ create_backup_snapshot() {
4848

4949
# Validate user_home before using in path
5050
if [[ -z "$user_home" ]]; then
51-
msg_warn "Cannot determine home directory for user $real_user"
51+
msg_warning "Cannot determine home directory for user $real_user"
5252
log_warn "Skipping Hyprland config backup - user home not found"
5353
elif [[ -f "$user_home/.config/hypr/hyprland.conf" ]]; then
5454
sudo cp -a "$user_home/.config/hypr/hyprland.conf" "$snapshot_dir/hyprland.conf" 2>/dev/null && files_backed_up+=("hyprland.conf")
@@ -148,7 +148,7 @@ configure_omarchy_limine() {
148148
echo ""
149149
msg_error "Conflicting IOMMU parameter detected (iommu=off)"
150150
msg_info "Found IOMMU explicitly disabled in kernel parameters"
151-
msg_warn "Please edit $LIMINE_DEFAULT and remove iommu=off parameter"
151+
msg_warning "Please edit $LIMINE_DEFAULT and remove iommu=off parameter"
152152
echo ""
153153
log_error "Setup aborted: Conflicting IOMMU parameter (iommu=off) found in Limine config"
154154
return 1
@@ -191,7 +191,7 @@ configure_gpu_blacklist() {
191191
1002) gpu_vendor="amdgpu" ;;
192192
8086) gpu_vendor="i915" ;;
193193
*)
194-
msg_warn "Unknown GPU vendor: $vendor_id"
194+
msg_warning "Unknown GPU vendor: $vendor_id"
195195
return 1
196196
;;
197197
esac
@@ -287,7 +287,7 @@ EOF
287287
msg_info "Adding user to kvm group..."
288288
if sudo usermod -aG kvm "$USER"; then
289289
msg_success "User added to kvm group"
290-
msg_warning "You must LOG OUT and LOG BACK IN for group changes to take effect"
290+
msg_warninging "You must LOG OUT and LOG BACK IN for group changes to take effect"
291291
else
292292
msg_error "Failed to add user to kvm group"
293293
msg_info " Run manually: sudo usermod -aG kvm $USER"
@@ -301,7 +301,7 @@ EOF
301301

302302
configure_vfio_modules_mkinitcpio() {
303303
if [[ ! -f "$MKINITCPIO_CONF" ]]; then
304-
msg_warn "$MKINITCPIO_CONF not found"
304+
msg_warning "$MKINITCPIO_CONF not found"
305305
return 1
306306
fi
307307

@@ -364,7 +364,7 @@ configure_system_environment() {
364364

365365
if [[ -z "$igpu_card_path" ]]; then
366366
# DRM device not yet available - skip configuration but don't fail
367-
msg_warn "Cannot resolve DRM device for iGPU ($igpu_pci) yet"
367+
msg_warning "Cannot resolve DRM device for iGPU ($igpu_pci) yet"
368368
msg_info " This is normal on first setup (iGPU driver may not be loaded)"
369369
msg_info " Configuration will be applied automatically after reboot"
370370
msg_info " If black screen persists, run setup again after reboot"
@@ -419,7 +419,7 @@ configure_hyprland_igpu() {
419419

420420
local hypr_conf="$user_home/.config/hypr/hyprland.conf"
421421
if [[ ! -f "$hypr_conf" ]]; then
422-
msg_warn "Hyprland config not found - skipping Hyprland configuration"
422+
msg_warning "Hyprland config not found - skipping Hyprland configuration"
423423
log_info "Hyprland config not found at $hypr_conf - user may not use Hyprland"
424424
return 0
425425
fi
@@ -454,7 +454,7 @@ configure_hyprland_igpu() {
454454

455455
if [[ -z "$igpu_card_path" ]]; then
456456
# DRM device not yet available - skip configuration but don't fail
457-
msg_warn "Cannot resolve DRM device for iGPU ($igpu_pci) yet"
457+
msg_warning "Cannot resolve DRM device for iGPU ($igpu_pci) yet"
458458
msg_info " This is normal on first setup (iGPU driver may not be loaded)"
459459
msg_info " Hyprland config will be updated automatically after reboot"
460460
msg_info " If black screen persists, run setup again after reboot"
@@ -637,10 +637,10 @@ check_passthrough_feasibility() {
637637
echo ""
638638
echo "Detected virtualization: $VIRTUALIZATION_TYPE"
639639
echo ""
640-
msg_warn "GPU passthrough requires bare metal (physical hardware)"
640+
msg_warning "GPU passthrough requires bare metal (physical hardware)"
641641
echo ""
642642
echo "This tool is for:"
643-
echo "Physical Omarchy installations (bare metal)"
643+
msg_success "Physical Omarchy installations (bare metal)"
644644
echo " ✗ NOT for Omarchy running inside a VM"
645645
echo ""
646646
echo "If you want to use GPU inside a VM:"
@@ -775,7 +775,7 @@ validate_gpu_selection() {
775775
# Warn if selecting iGPU
776776
if [[ "$type" == "integrated" ]]; then
777777
msg_error "WARNING: iGPU selected - NOT recommended!"
778-
msg_warn "Linux will have no display after passthrough"
778+
msg_warning "Linux will have no display after passthrough"
779779
echo ""
780780

781781
gum confirm "Continue anyway?" || return 1
@@ -808,7 +808,7 @@ validate_gpu_selection() {
808808

809809
# Display monitor connection instructions
810810
echo ""
811-
msg_warn "After reboot, dedicated GPU ($selected_gpu_name) will be INACTIVE!"
811+
msg_warning "After reboot, dedicated GPU ($selected_gpu_name) will be INACTIVE!"
812812
echo ""
813813
echo "For host display:"
814814
echo " • Connect monitor(s) to MOTHERBOARD ports (HDMI/DP on back panel)"
@@ -868,8 +868,8 @@ validate_gpu_selection() {
868868
if [[ "$igpu_monitor_count" -eq 0 ]] && [[ "$dgpu_monitor_count" -gt 0 ]]; then
869869
msg_error "CRITICAL: No monitors on iGPU, but monitors detected on dedicated GPU!"
870870
echo ""
871-
msg_warn "After reboot, ALL your monitors will go BLANK (dedicated GPU blacklisted)."
872-
msg_warn "You MUST connect at least one monitor to motherboard ports!"
871+
msg_warning "After reboot, ALL your monitors will go BLANK (dedicated GPU blacklisted)."
872+
msg_warning "You MUST connect at least one monitor to motherboard ports!"
873873
echo ""
874874
log_warn "Critical: No iGPU monitors, $dgpu_monitor_count monitor(s) on dGPU - user at risk of black screen"
875875

@@ -879,7 +879,7 @@ validate_gpu_selection() {
879879
}
880880
elif [[ "$dgpu_monitor_count" -gt 0 ]] && [[ "$igpu_monitor_count" -gt 0 ]]; then
881881
msg_success "Good: $igpu_monitor_count monitor(s) on iGPU (will work after reboot)"
882-
msg_warn "Note: $dgpu_monitor_count monitor(s) on dedicated GPU will go blank after reboot"
882+
msg_warning "Note: $dgpu_monitor_count monitor(s) on dedicated GPU will go blank after reboot"
883883
echo ""
884884
log_info "User has $igpu_monitor_count iGPU monitors + $dgpu_monitor_count dGPU monitors"
885885

@@ -896,7 +896,7 @@ validate_gpu_selection() {
896896
return 1
897897
}
898898
else
899-
msg_warn "Cannot detect monitor connections - asking user to confirm"
899+
msg_warning "Cannot detect monitor connections - asking user to confirm"
900900
log_warn "Cannot detect monitor connections"
901901

902902
gum confirm "At least one monitor is connected to motherboard ports?" || {
@@ -929,15 +929,15 @@ cmd_setup() {
929929
echo " • BIOS: Set Primary Display = IGD or Auto (recommended)"
930930
echo " • Monitor: Connect to motherboard ports (iGPU), not GPU ports"
931931
echo ""
932-
msg_warn "Important: Dedicated GPU will be blacklisted (mode=none at boot)"
932+
msg_warning "Important: Dedicated GPU will be blacklisted (mode=none at boot)"
933933
echo " Use 'omarchy-gpu-passthrough mode vm' to bind for VM"
934934
echo " Use 'omarchy-gpu-passthrough mode host' to bind for host use (optional)"
935935
echo ""
936936

937937
gum confirm "Continue with setup?" || exit 0
938938

939939
echo ""
940-
msg_warn "WARNING: This will modify critical system configuration!"
940+
msg_warning "WARNING: This will modify critical system configuration!"
941941
echo ""
942942
echo "What will be changed:"
943943
echo " • Kernel boot parameters (/etc/default/limine)"
@@ -980,11 +980,11 @@ cmd_setup() {
980980
;;
981981
esac
982982
echo ""
983-
msg_warn "If not enabled, GPU passthrough will NOT work!"
983+
msg_warning "If not enabled, GPU passthrough will NOT work!"
984984
echo ""
985985

986986
gum confirm "Have you enabled these settings in BIOS?" || {
987-
msg_warn "Please enable IOMMU in BIOS first, then run setup again"
987+
msg_warning "Please enable IOMMU in BIOS first, then run setup again"
988988
exit 0
989989
}
990990
echo ""
@@ -1042,7 +1042,7 @@ cmd_setup() {
10421042
case "$vendor_id" in
10431043
10de) # NVIDIA
10441044
if ! command -v nvidia-smi &>/dev/null; then
1045-
msg_warn " NVIDIA GPU detected but nvidia-smi not found"
1045+
msg_warning " NVIDIA GPU detected but nvidia-smi not found"
10461046
msg_info " GPU: $name"
10471047
msg_info " This is OK if you haven't installed NVIDIA drivers yet"
10481048
driver_warnings=$((driver_warnings + 1))
@@ -1054,7 +1054,7 @@ cmd_setup() {
10541054
if [[ "$driver" == "amdgpu" ]]; then
10551055
msg_success " AMD GPU using amdgpu driver"
10561056
elif [[ "$driver" == "none" ]]; then
1057-
msg_warn " AMD GPU detected but no driver loaded"
1057+
msg_warning " AMD GPU detected but no driver loaded"
10581058
msg_info " GPU: $name"
10591059
msg_info " This is OK if you haven't installed AMD drivers yet"
10601060
driver_warnings=$((driver_warnings + 1))
@@ -1084,7 +1084,7 @@ cmd_setup() {
10841084
# IOMMU not detected - warn but allow to continue
10851085
if [[ "$feasibility_errors" -gt 0 ]]; then
10861086
echo ""
1087-
msg_warn "IOMMU not currently detected - you will need to:"
1087+
msg_warning "IOMMU not currently detected - you will need to:"
10881088
msg_info " 1. Complete this setup to configure kernel parameters"
10891089
msg_info " 2. Enable IOMMU in BIOS (AMD-Vi or Intel VT-d)"
10901090
msg_info " 3. Reboot"
@@ -1206,8 +1206,8 @@ cmd_setup() {
12061206
exit 1
12071207
}
12081208
else
1209-
msg_warn "No iGPU detected, skipping Hyprland/environment configuration"
1210-
msg_warn "You may need to manually configure your compositor"
1209+
msg_warning "No iGPU detected, skipping Hyprland/environment configuration"
1210+
msg_warning "You may need to manually configure your compositor"
12111211
fi
12121212

12131213
# Rebuild initramfs with new configuration (Omarchy uses limine-mkinitcpio)
@@ -1248,7 +1248,7 @@ cmd_setup() {
12481248
log_info "GPU configured: $name ($pci)"
12491249
log_info "Next step: REBOOT REQUIRED"
12501250

1251-
msg_warn "SYSTEM REBOOT REQUIRED"
1251+
msg_warning "SYSTEM REBOOT REQUIRED"
12521252
echo ""
12531253
msg_info "Kernel parameters require reboot to take effect"
12541254
echo ""
@@ -1262,7 +1262,7 @@ cmd_setup() {
12621262
msg_info "No driver will be loaded until you manually bind it."
12631263
echo ""
12641264
echo ""
1265-
msg_warn "⚠️ IF YOU SEE BLACK SCREEN AFTER REBOOT:"
1265+
msg_warning "⚠️ IF YOU SEE BLACK SCREEN AFTER REBOOT:"
12661266
echo ""
12671267
echo "This can happen on first setup if iGPU driver wasn't loaded yet."
12681268
echo ""
@@ -1299,7 +1299,7 @@ cmd_uninstall() {
12991299
fi
13001300

13011301
echo ""
1302-
msg_warn "This will remove ALL GPU passthrough configuration!"
1302+
msg_warning "This will remove ALL GPU passthrough configuration!"
13031303
echo ""
13041304
echo "What will be removed:"
13051305
echo " • Kernel parameters (amd_iommu, iommu=pt)"
@@ -1352,12 +1352,12 @@ cmd_uninstall() {
13521352
echo " • /etc/mkinitcpio.conf.backup.uninstall.*"
13531353
echo " • ~/.config/hypr/hyprland.conf.backup.uninstall.*"
13541354
echo ""
1355-
msg_warn "REBOOT REQUIRED"
1355+
msg_warning "REBOOT REQUIRED"
13561356
echo ""
13571357
echo "After reboot:"
1358-
echo "Your GPU will be available to Linux"
1359-
echo "GPU drivers (nvidia/amdgpu) will load normally"
1360-
echo "You can use your GPU for gaming, rendering, etc."
1358+
msg_success "Your GPU will be available to Linux"
1359+
msg_success "GPU drivers (nvidia/amdgpu) will load normally"
1360+
msg_success "You can use your GPU for gaming, rendering, etc."
13611361
echo ""
13621362
msg_info "To reboot now: sudo reboot"
13631363
}

0 commit comments

Comments
 (0)