MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / hasImageLinux

Function hasImageLinux

cli/src/utils/clipboard-image.ts:137–166  ·  view source on GitHub ↗

* Check if clipboard contains an image (Linux)

()

Source from the content-addressed store, hash-verified

135 * Check if clipboard contains an image (Linux)
136 */
137function hasImageLinux(): boolean {
138 try {
139 // Check available clipboard targets
140 const result = spawnSync('xclip', [
141 '-selection', 'clipboard',
142 '-t', 'TARGETS',
143 '-o',
144 ], { encoding: 'utf-8', timeout: 5000 })
145
146 if (result.status !== 0) {
147 // Try wl-paste for Wayland
148 const wlResult = spawnSync('wl-paste', ['--list-types'], {
149 encoding: 'utf-8',
150 timeout: 5000,
151 })
152 if (wlResult.status === 0) {
153 const output = wlResult.stdout || ''
154 return output.includes('image/')
155 }
156 return false
157 }
158
159 const output = result.stdout || ''
160 return output.includes('image/png') ||
161 output.includes('image/jpeg') ||
162 output.includes('image/tiff')
163 } catch {
164 return false
165 }
166}
167
168/**
169 * Read image from clipboard (Linux)

Callers 1

hasClipboardImageFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected