document.addEventListener('DOMContentLoaded', () => {
// Initialize desktop apps
const desktop = document.querySelector('desktop-shell');
// Create default windows
desktop.createWindow({
id: 'about',
title: 'About Me.txt',
content: `
Creative Technologist
Hello! I'm a creative technologist blending art, design, and technology to create immersive experiences.
Skills
- Interactive Installations
- Creative Coding
- WebGL & Three.js
- Physical Computing
Tools
- TouchDesigner
- Processing
- Arduino
- p5.js
`,
icon: 'user',
initialPosition: { x: 100, y: 100 }
});
desktop.createWindow({
id: 'projects',
title: 'Projects Explorer',
content: `
Featured Projects
Interactive Light Sculpture
Kinetic installation responding to sound
Generative Art Platform
Web-based tool for creating algorithmic art
AR Museum Experience
Augmented reality for cultural heritage
Data Visualization Suite
Interactive tools for complex datasets
`,
icon: 'folder',
initialPosition: { x: 300, y: 150 }
});
// Theme toggle
const themeToggle = document.getElementById('theme-toggle');
if (themeToggle) {
themeToggle.addEventListener('click', () => {
document.documentElement.classList.toggle('dark');
localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light');
});
}
});
class WindowManager {
constructor() {
this.windows = [];
this.zIndexCounter = 10;
}
createWindow(options) {
const existingWindow = document.querySelector(`custom-window[id="${options.id}"]`);
if (existingWindow) {
this.bringToFront(existingWindow);
return;
}
const windowElement = document.createElement('custom-window');
windowElement.setAttribute('id', options.id);
windowElement.setAttribute('title', options.title);
windowElement.setAttribute('icon', options.icon);
windowElement.setAttribute('initial-x', options.initialPosition.x);
windowElement.setAttribute('initial-y', options.initialPosition.y);
if (options.width) {
windowElement.style.width = `${options.width}px`;
}
if (options.height) {
windowElement.style.minHeight = `${options.height}px`;
}
windowElement.innerHTML = options.content;
document.querySelector('desktop-shell').appendChild(windowElement);
this.windows.push({
id: options.id,
element: windowElement,
minimized: false
});
this.bringToFront(windowElement);
}
bringToFront(windowElement) {
this.zIndexCounter += 1;
windowElement.style.zIndex = this.zIndexCounter;
}
minimizeWindow(windowId) {
const window = this.windows.find(w => w.id === windowId);
if (window) {
window.minimized = true;
window.element.classList.add('window-minimize');
setTimeout(() => {
window.element.style.display = 'none';
}, 300);
}
}
restoreWindow(windowId) {
const window = this.windows.find(w => w.id === windowId);
if (window) {
window.minimized = false;
window.element.style.display = 'block';
window.element.classList.add('window-restore');
setTimeout(() => {
window.element.classList.remove('window-restore');
}, 300);
this.bringToFront(window.element);
}
}
closeWindow(windowId) {
const windowIndex = this.windows.findIndex(w => w.id === windowId);
if (windowIndex !== -1) {
this.windows[windowIndex].element.remove();
this.windows.splice(windowIndex, 1);
}
}
}
window.windowManager = new WindowManager();