Skip to content
This repository has been archived by the owner on Feb 4, 2024. It is now read-only.

Commit

Permalink
⚡ modify emoji skin tone via the Workflow Configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
techouse committed Nov 22, 2023
1 parent 1755697 commit 0802569
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 31 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ sign.sh

.env
emojis.json
prefs.plist
20 changes: 9 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,15 @@ Either press `⌘Y` to Quick Look the result, or press `<enter>` copy it to your

### Set skin tone

To change the emoji skin tone of all the emojis that support it, set the `alfred_emoji_skin_tone` environment variable in Alfred.
Possible **integer** values are:

- n/a - *no* skin tone 👍,
- `1` - *light* skin tone 👍🏻,
- `2` - *medium-light* skin tone 👍🏼,
- `3` - *medium* skin tone 👍🏽,
- `4` - *medium-dark* skin tone 👍🏾,
- `5` - *dark* skin tone 👍🏿

![skin_tone_setup](skin_tone_setup.png)
To change the emoji skin tone of all the emojis that support it, configure the workflow.
Possible values are:

- *no* skin tone 👍,
- *light* skin tone 👍🏻,
- *medium-light* skin tone 👍🏼,
- *medium* skin tone 👍🏽,
- *medium-dark* skin tone 👍🏾,
- *dark* skin tone 👍🏿

### Notes

Expand Down
5 changes: 3 additions & 2 deletions bin/main.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'dart:io' show File, Platform, exitCode, stdout;
import 'dart:io' show File, exitCode, stdout;

import 'package:alfred_workflow/alfred_workflow.dart';
import 'package:algolia/algolia.dart';
Expand Down Expand Up @@ -43,8 +43,9 @@ void main(List<String> arguments) {
final String query =
args['query'].replaceAll(RegExp(r'\s+'), ' ').trim().toLowerCase();

final Map? userDefaults = await _workflow.getUserDefaults();
final int? toneIndex = int.tryParse(
Platform.environment['alfred_emoji_skin_tone'] ?? '',
userDefaults?['alfred_emoji_skin_tone'] as String? ?? '',
);
late final Fitzpatrick? tone;

Expand Down
4 changes: 2 additions & 2 deletions bin/src/services/emoji_downloader.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ class EmojiDownloader {

final String fileName = '${chars.join('-')}.png';
final String filePath =
_directoryPath != null && await Directory(_directoryPath!).exists()
? path.join(_directoryPath!, fileName)
_directoryPath != null && await Directory(_directoryPath).exists()
? path.join(_directoryPath, fileName)
: path.join(
path.dirname(Platform.script.toFilePath()),
'image_cache',
Expand Down
65 changes: 50 additions & 15 deletions info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -235,14 +235,15 @@ Either press `⌘Y` to Quick Look the result, or press `&lt;enter&gt;` copy it t
### Set skin tone
To change the emoji skin tone of all the emojis that support it, set the `alfred_emoji_skin_tone` environment variable in Alfred.
Possible **integer** values are:
To change the emoji skin tone of all the emojis that support it, configure the workflow.
Possible values are:
- `1` - *light* skin tone,
- `2` - *medium-light* skin tone,
- `3` - *medium* skin tone,
- `4` - *medium-dark* skin tone,
- `5` - *dark* skin tone</string>
- *no* skin tone 👍,
- *light* skin tone 👍🏻,
- *medium-light* skin tone 👍🏼,
- *medium* skin tone 👍🏽,
- *medium-dark* skin tone 👍🏾,
- *dark* skin tone 👍🏿</string>
<key>uidata</key>
<dict>
<key>20F33E0E-43A7-43D1-8B65-BFBC17B87136</key>
Expand Down Expand Up @@ -282,15 +283,49 @@ Possible **integer** values are:
</dict>
</dict>
<key>userconfigurationconfig</key>
<array/>
<key>variables</key>
<dict>
<key>alfred_emoji_skin_tone</key>
<string></string>
</dict>
<key>variablesdontexport</key>
<array>
<string>alfred_emoji_skin_tone</string>
<dict>
<key>config</key>
<dict>
<key>default</key>
<string>0</string>
<key>pairs</key>
<array>
<array>
<string>no skin tone 👍</string>
<string>0</string>
</array>
<array>
<string>light skin tone 👍🏻</string>
<string>1</string>
</array>
<array>
<string>medium-light skin tone 👍🏼</string>
<string>2</string>
</array>
<array>
<string>medium skin tone 👍🏽</string>
<string>3</string>
</array>
<array>
<string>medium-dark skin tone 👍🏾</string>
<string>4</string>
</array>
<array>
<string>dark skin tone 👍🏿</string>
<string>5</string>
</array>
</array>
</dict>
<key>description</key>
<string>Change the emoji skin tone of all the emojis that support it</string>
<key>label</key>
<string>Emoji skin tone</string>
<key>type</key>
<string>popupbutton</string>
<key>variable</key>
<string>alfred_emoji_skin_tone</string>
</dict>
</array>
<key>version</key>
<string></string>
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: Search for emojis and copy them to the clipboard easily.

publish_to: 'none'

version: 1.0.9
version: 1.1.0

environment:
sdk: '>=3.2.0 <4.0.0'
Expand Down
Binary file removed skin_tone_setup.png
Binary file not shown.

0 comments on commit 0802569

Please sign in to comment.