Add get_desktop_environment, set_wallpaper

This commit is contained in:
Dillon DuPont
2025-10-24 16:27:58 -07:00
parent 28a46c6011
commit fb174d6aa4
9 changed files with 186 additions and 28 deletions

View File

@@ -314,6 +314,10 @@ export abstract class BaseComputerInterface {
abstract getScreenSize(): Promise<ScreenSize>;
abstract getCursorPosition(): Promise<CursorPosition>;
// Desktop Actions
abstract getDesktopEnvironment(): Promise<string>;
abstract setWallpaper(path: string): Promise<void>;
// Clipboard Actions
abstract copyToClipboard(): Promise<string>;
abstract setClipboard(text: string): Promise<void>;

View File

@@ -3,8 +3,8 @@
*/
import type { ScreenSize } from '../types';
import { BaseComputerInterface } from './base';
import type { AccessibilityNode, CursorPosition, MouseButton } from './base';
import { BaseComputerInterface } from './base';
export class MacOSComputerInterface extends BaseComputerInterface {
// Mouse Actions
@@ -212,6 +212,29 @@ export class MacOSComputerInterface extends BaseComputerInterface {
return response.position as CursorPosition;
}
// Desktop Actions
/**
* Get the current desktop environment string (e.g., 'xfce4', 'gnome', 'kde', 'mac', 'windows').
*/
async getDesktopEnvironment(): Promise<string> {
const response = await this.sendCommand('get_desktop_environment');
if (!response.success) {
throw new Error((response.error as string) || 'Failed to get desktop environment');
}
return (response.environment as string) || 'unknown';
}
/**
* Set the desktop wallpaper image.
* @param path Absolute path to the image file on the VM
*/
async setWallpaper(path: string): Promise<void> {
const response = await this.sendCommand('set_wallpaper', { path });
if (!response.success) {
throw new Error((response.error as string) || 'Failed to set wallpaper');
}
}
// Clipboard Actions
/**
* Copy current selection to clipboard and return the content.