Hi Mike,
Awesome to be experimenting with extensions!
You are also using quite an old style of extension with the plist and the separate Python script in a package.
Because you posted it as quoted text rather than code, it was difficult for me to read the Python directly.
I won’t engage with the Python since I’m crap at Python anyway.
There is an easier and more modern way of doing things, which is to use a javascript snippet, which I’ll demonstrate below:
// #popclip
// name: Toggle Bullets
// icon: symbol:list.bullet
// requirements: [text, paste]
// language: javascript
// after: paste-result
const marker = /^(\s*)(?:[•*-]|\d+\.)\s+/;
const lines = popclip.input.text.split(/\r?\n/);
const nonBlank = lines.filter((line) => line.trim());
const removeBullets =
nonBlank.length > 0 && nonBlank.every((line) => marker.test(line));
return lines
.map((line) => {
if (!line.trim()) return line;
if (removeBullets) {
return line.replace(marker, "$1");
}
if (marker.test(line)) {
return line;
}
return line.replace(/^(\s*)/, "$1• ");
})
.join("\n");
(The above block is an extension snippet — select it then click “Install Extension” in PopClip.)
I can’t claim credit for the actual code above because I had Codex 5.5 write it. It’s a nice bit of code though!