Skip to content

Commit 5e10574

Browse files
authored
Merge pull request #9 from draphy/draphy/dro-64-test-draphyos-and-optimize
feat: [DRO-64] Auto VM detection
2 parents 8a42eb1 + 9814d19 commit 5e10574

3 files changed

Lines changed: 70 additions & 2 deletions

File tree

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,9 @@ Every tool in draphyOS was chosen with a purpose. Here's why:
233233
| `xdotool` | X11 automation |
234234
| `xclip` | Clipboard manager |
235235
| `fira-code-fonts` | Programming font |
236-
| `fontawesome4-fonts` | Icon font |
236+
| `google-noto-sans-mono-vf-fonts` | Fallback mono font |
237+
| `fontawesome-6-free-fonts` | Icon font (solid) |
238+
| `fontawesome-6-brands-fonts` | Icon font (brands) |
237239
| `mint-y-icons` | Icon theme |
238240
| `adwaita-cursor-theme` | Cursor theme |
239241

@@ -316,7 +318,9 @@ This will:
316318
<details>
317319
<summary><strong>Running in a VM? Display not refreshing?</strong></summary>
318320

319-
Picom's `glx` backend doesn't work well in virtual machines. Fix:
321+
**Note:** The installer auto-detects VM environments (VirtualBox, VMware, QEMU/KVM, Hyper-V) and applies these fixes automatically.
322+
323+
If not auto-detected or you need to apply manually, picom's `glx` backend doesn't work well in virtual machines. Fix:
320324

321325
1. Edit `~/.config/picom/picom.conf`:
322326
```ini

install.sh

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,65 @@ create_marker() {
551551
echo "Version: 1.0" >> "$MARKER_FILE"
552552
}
553553

554+
# Configure for VM environment (picom compatibility)
555+
configure_vm() {
556+
local is_vm=false
557+
local picom_config="$HOME/.config/picom/picom.conf"
558+
559+
# Auto-detect VM environment
560+
if command -v systemd-detect-virt &>/dev/null; then
561+
local virt_type
562+
virt_type=$(systemd-detect-virt 2>/dev/null || echo "none")
563+
if [ "$virt_type" != "none" ]; then
564+
is_vm=true
565+
print_step "VM detected: $virt_type"
566+
fi
567+
fi
568+
569+
# Fallback detection via DMI
570+
if [ "$is_vm" = false ]; then
571+
if grep -qiE "virtualbox|vmware|qemu|kvm|hyper-v|parallels" /sys/class/dmi/id/product_name 2>/dev/null; then
572+
is_vm=true
573+
print_step "VM detected via DMI"
574+
fi
575+
fi
576+
577+
# If not auto-detected, ask user
578+
if [ "$is_vm" = false ]; then
579+
echo -e "Are you installing in a ${YELLOW}virtual machine${NC}? (y/n)"
580+
read -r response </dev/tty || response="n"
581+
if [[ "$response" =~ ^[Yy]$ ]]; then
582+
is_vm=true
583+
fi
584+
fi
585+
586+
# Apply VM-specific picom settings
587+
if [ "$is_vm" = true ]; then
588+
print_step "Applying VM-optimized picom settings..."
589+
590+
if [ -f "$picom_config" ]; then
591+
# Change backend from glx to xrender
592+
sed -i 's/^backend = "glx";/backend = "xrender";/' "$picom_config" 2>/dev/null || true
593+
594+
# Disable corner radius (not supported with xrender)
595+
sed -i 's/^corner-radius = [0-9]*;/corner-radius = 0;/' "$picom_config" 2>/dev/null || true
596+
597+
# Disable vsync
598+
sed -i 's/^vsync = true;/vsync = false;/' "$picom_config" 2>/dev/null || true
599+
600+
# Disable use-damage
601+
sed -i 's/^use-damage = true;/use-damage = false;/' "$picom_config" 2>/dev/null || true
602+
603+
# Mark as VM install
604+
echo "VM_MODE=true" >> "$MARKER_FILE" 2>/dev/null || true
605+
606+
print_success "VM mode configured (xrender backend, no rounded corners)"
607+
else
608+
print_warning "Picom config not found, skipping VM optimization"
609+
fi
610+
fi
611+
}
612+
554613
# Main installation
555614
main() {
556615
print_header
@@ -572,6 +631,7 @@ main() {
572631
backup_configs
573632
install_configs
574633
configure_hardware
634+
configure_vm
575635
setup_fish
576636
configure_lightdm
577637
configure_battery_limit

uninstall.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,10 @@ main() {
290290
echo " - Wallpaper and cheatsheets"
291291
echo " - LightDM customization"
292292
echo " - Battery limit service (if set)"
293+
# Check for VM mode
294+
if [ -f "$MARKER_FILE" ] && grep -q "VM_MODE=true" "$MARKER_FILE" 2>/dev/null; then
295+
echo " - VM-optimized picom settings"
296+
fi
293297
echo ""
294298
echo "You will be asked about:"
295299
echo " - Reverting shell to bash"

0 commit comments

Comments
 (0)