Skip to content

Commit

Permalink
update BundleID and AlternatingCase structure
Browse files Browse the repository at this point in the history
  • Loading branch information
pilotmoon committed May 10, 2024
1 parent f5183ce commit 3324c8e
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 68 deletions.
8 changes: 0 additions & 8 deletions source/AlternatingCase.popclipext/Config.json

This file was deleted.

45 changes: 45 additions & 0 deletions source/AlternatingCase.popclipext/Config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// #popclip
// name: Alternating Case
// identifier: com.pilotmoon.popclip.extension.alternating-case
// description: Change the text to AlTeRnAtInG CaSe, with optional randomness.
// icon: noun_sponge_575115.svg
// popclipVersion: 4225
// language: typescript
// module: true

/**
* Make characters alternately upper/lower case, with optional randomness sprinkled in.
*/
function alternatingCase (string: string, options?: {randomness?: boolean}): string {
function rnd (): number {
return options?.randomness === true ? Math.random() : 0
}
function start (): number {
return rnd() < 0.5 ? 0 : 1
}
function step (): number {
const x = rnd()
if (x < 0.8) return 2
if (x < 0.9) return 3
return 1
}
const characters = string.toLowerCase().split('')
for (let item = start(); item < characters.length; item += step()) {
characters[item] = characters[item].toUpperCase()
}
return characters.join('')
}

const extension: Extension = {
action: (selection, options) => {
popclip.pasteText(alternatingCase(selection.text, { randomness: options.randomness as boolean }))
},
options: [
{
identifier: 'randomness',
label: 'Add Randomness',
type: 'boolean'
}]
}
export default extension

42 changes: 0 additions & 42 deletions source/AlternatingCase.popclipext/alternating-case.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
// #popclip
// name: Bundle ID
// identifier: com.pilotmoon.popclip.extension.bundleid
// #identifier: com.pilotmoon.popclip.extension.bundleid
// description: Show the bundle identifier of the app.
// entitlements: [dynamic]
// requirements: []
// popclipVersion: 4225
// module: true
// language: typescript
// popclipVersion: 4151

export const actions: PopulationFunction = () => {
exports.actions = () => {
if (popclip.context.appIdentifier.length > 0) {
return [{
title: popclip.context.appIdentifier,
Expand Down
15 changes: 2 additions & 13 deletions source/BundleID.popclipext/Readme.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
# Bundle ID

Display the Bundle Identifier of the application.

Download: [BundleID.popclipextz](https://github.com/pilotmoon/PopClip-Extensions/raw/master/extensions/BundleID.popclipextz)

## Description

The extension display the macOS Bundle Identifier of the application, either when selecting text or when activating PopClip with long-press on an application.
The extension displays the macOS Bundle Identifier of the application, either when selecting text or when activating PopClip with long-press on an application.

The bundle ID appears in the text of the action's button. Clicking the button copies the bundle ID to the clipboard.

## About

This is an extension for [PopClip](https://pilotmoon.com/popclip/).
This is an extension for [PopClip](https://www.popclip.app/).

### Author

Expand All @@ -22,11 +16,6 @@ Nick Moore

Requires PopClip 2023.9 or later.

### Links

<!-- * [Forum Topic](#) -->
* [GitHub Source](https://github.com/pilotmoon/PopClip-Extensions/tree/master/source/BundleID.popclipext)

## Changelog

### 25 May 2022
Expand Down

0 comments on commit 3324c8e

Please sign in to comment.