Skip to content

Commit

Permalink
Merge branch 'blizzrdof77-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
gillibrand committed Sep 10, 2018
2 parents ed3715e + 075c93a commit 64eb341
Show file tree
Hide file tree
Showing 14 changed files with 220 additions and 36 deletions.
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,28 @@
# Common
*.bak
ignore/

# OS Junk Files
Thumbs.db
Desktop.in
.DS_Store
__MACOSX/

# IDE Stuff
*.sublime-workspace
.idea/
.phpintel/
.vscode/

# Package Management
node_modules/

# Logs
*.log

# Private Files & Folders
private/
icons/

# Compiled
*.pyc
Binary file modified Change Case.alfredworkflow
Binary file not shown.
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
# Change Case — Workflow for Alfred

Changes the case of text on the clipboard to uppercase, lowercase, or title case.
Changes the case of text selected, provided, or on the clipboard to UPPERCASE, lowercase, Title Case, CamelCase, kebab-case, or snake_case.

[Download the workflow](https://github.com/gillibrand/alfred-change-case/raw/master/Change%20Case.alfredworkflow).
[Download the workflow](https://github.com/gillibrand/alfred-change-case/blob/master/Change%20Case.alfredworkflow).

![Screenshot](changecase.png)

## Usage

Change the case of text on the keyboard with the keyword `case`. All three styles are previewed as Alfred results. Select one to copy it to the clipboard and paste into in the current application.
Change the case of text on the keyboard with the keyword `case`. All six styles are previewed as Alfred results. Select one to copy it to the clipboard and paste into in the current application.

Optionally, any text typed after `case` will be changed instead of the clipboard.
Optionally, any text typed after `case` will be changed instead of the clipboard.

## Version History

### 9/9/2018

- Added CamelCase, kebab-case, and snake_case options
- Added additional keywords "tt" and "transform"

### 4/19/2013

- Always sorts the case styles in the same order now: lowercase, uppercase, then title case. (Removed the `uid` from results returned to Alfred as supported in Alfred 2.0.3.)
Expand All @@ -25,4 +30,5 @@ Optionally, any text typed after `case` will be changed instead of the clipboard
## Credits

- Workflow by Jay Gillibrand.
- `titlecase` module by [Stuart Colville](http://muffinresearch.co.uk).
- `titlecase` module by [Stuart Colville](http://muffinresearch.co.uk).
- `CamelCase`, `kebab-case`, and `snake_case` additions added by [Ben Wagner](https://blizzrdof77.com)
Binary file added camelcase.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified changecase.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 24 additions & 4 deletions changecase.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
#
import re, sys
from xml.sax.saxutils import escape
from titlecase import titlecase
Expand Down Expand Up @@ -29,24 +29,44 @@ def upcase(m):
variations = {
'lower': escape(text.lower(), {'"': '"', '\n': '
'} ),
'upper': escape(text.upper(), {'"': '"', '\n': '
'} ),
'title': escape(titlecase_plus(text), {'"': '"', '\n': '
'} )
'title': escape(titlecase_plus(text), {'"': '"', '\n': '
'} ),
'camel': escape(titlecase_plus(text), {'"': '"', '\n': '
'} ).replace(' ', ''),
'kebab': escape(text.lower(), {'"': '"', '\n': '
'} ).replace(' ', '-').replace('_', '-'),
'snake': escape(text.lower(), {'"': '"', '\n': '
'} ).replace(' ', '_').replace('-', '_')

}

print """<?xml version="1.0"?>
<items>
<item arg="%(lower)s">
<title>%(lower)s</title>
<subtitle>Lowercase</subtitle>
<subtitle>lowercase</subtitle>
<icon>lowercase.png</icon>
</item>
<item arg="%(upper)s">
<title>%(upper)s</title>
<subtitle>Uppercase</subtitle>
<subtitle>UPPERCASE</subtitle>
<icon>uppercase.png</icon>
</item>
<item arg="%(title)s">
<title>%(title)s</title>
<subtitle>Title Case</subtitle>
<icon>titlecase.png</icon>
</item>
<item arg="%(camel)s">
<title>%(camel)s</title>
<subtitle>CamelCase</subtitle>
<icon>camelcase.png</icon>
</item>
<item arg="%(kebab)s">
<title>%(kebab)s</title>
<subtitle>kebab-case</subtitle>
<icon>kebabcase.png</icon>
</item>
<item arg="%(snake)s">
<title>%(snake)s</title>
<subtitle>snake_case</subtitle>
<icon>snakecase.png</icon>
</item>
</items>""" % variations
Binary file modified icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified icons.acorn
Binary file not shown.
185 changes: 158 additions & 27 deletions info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
<dict>
<key>bundleid</key>
<string>gillibrand.jay.changecase</string>
<key>category</key>
<string>Tools</string>
<key>connections</key>
<dict>
<key>120913BE-7A34-4EA4-A8A1-BDCE5F034458</key>
<key>272A1B72-8F54-4B5F-831A-8787D7264102</key>
<array>
<dict>
<key>destinationuid</key>
Expand All @@ -15,17 +17,34 @@
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
<key>vitoclose</key>
<false/>
</dict>
</array>
<key>B6600E5C-BB57-4054-827B-5688E776AEE7</key>
<array>
<dict>
<key>destinationuid</key>
<string>48FA1057-4D68-48B5-BB44-CBC28130A414</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
<key>vitoclose</key>
<false/>
</dict>
</array>
<key>3EEC7A2D-486C-4756-A271-FAD9448441C8</key>
<key>CCBE2CE0-D301-463D-A9DC-36C98D2A7030</key>
<array>
<dict>
<key>destinationuid</key>
<string>120913BE-7A34-4EA4-A8A1-BDCE5F034458</string>
<string>48FA1057-4D68-48B5-BB44-CBC28130A414</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
<key>vitoclose</key>
<false/>
</dict>
</array>
</dict>
Expand All @@ -42,25 +61,96 @@
<dict>
<key>config</key>
<dict>
<key>action</key>
<key>alfredfiltersresults</key>
<false/>
<key>alfredfiltersresultsmatchmode</key>
<integer>0</integer>
<key>argumenttrimmode</key>
<integer>0</integer>
<key>argumenttype</key>
<integer>1</integer>
<key>escaping</key>
<integer>62</integer>
<key>keyword</key>
<string>tt</string>
<key>queuedelaycustom</key>
<integer>1</integer>
<key>queuedelayimmediatelyinitially</key>
<false/>
<key>queuedelaymode</key>
<integer>0</integer>
<key>queuemode</key>
<integer>1</integer>
<key>runningsubtext</key>
<string>transforming text case...</string>
<key>script</key>
<string>pbpaste | python changecase.py "{query}"</string>
<key>scriptargtype</key>
<integer>0</integer>
<key>scriptfile</key>
<string></string>
<key>subtext</key>
<string>Change the case to upper, lower, title, camel, kebab, or snake case.</string>
<key>title</key>
<string>Change/Transform Text Case</string>
<key>type</key>
<integer>0</integer>
<key>withspace</key>
<true/>
</dict>
<key>type</key>
<string>alfred.workflow.input.scriptfilter</string>
<key>uid</key>
<string>CCBE2CE0-D301-463D-A9DC-36C98D2A7030</string>
<key>version</key>
<integer>2</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>alfredfiltersresults</key>
<false/>
<key>alfredfiltersresultsmatchmode</key>
<integer>0</integer>
<key>argument</key>
<key>argumenttrimmode</key>
<integer>0</integer>
<key>argumenttype</key>
<integer>1</integer>
<key>escaping</key>
<integer>62</integer>
<key>keyword</key>
<string>case</string>
<key>queuedelaycustom</key>
<integer>1</integer>
<key>hotkey</key>
<integer>8</integer>
<key>hotmod</key>
<integer>393216</integer>
<key>hotstring</key>
<string>C</string>
<key>leftcursor</key>
<key>queuedelayimmediatelyinitially</key>
<false/>
<key>modsmode</key>
<key>queuedelaymode</key>
<integer>0</integer>
<key>queuemode</key>
<integer>1</integer>
<key>runningsubtext</key>
<string>transforming text case...</string>
<key>script</key>
<string>pbpaste | python changecase.py "{query}"</string>
<key>scriptargtype</key>
<integer>0</integer>
<key>scriptfile</key>
<string></string>
<key>subtext</key>
<string>Change the case to upper, lower, title, camel, kebab, or snake case...</string>
<key>title</key>
<string>Change/Transform Text Case</string>
<key>type</key>
<integer>0</integer>
<key>withspace</key>
<true/>
</dict>
<key>type</key>
<string>alfred.workflow.trigger.hotkey</string>
<string>alfred.workflow.input.scriptfilter</string>
<key>uid</key>
<string>3EEC7A2D-486C-4756-A271-FAD9448441C8</string>
<string>B6600E5C-BB57-4054-827B-5688E776AEE7</string>
<key>version</key>
<integer>2</integer>
</dict>
<dict>
<key>config</key>
Expand All @@ -69,27 +159,51 @@
<true/>
<key>clipboardtext</key>
<string>{query}</string>
<key>transient</key>
<false/>
</dict>
<key>type</key>
<string>alfred.workflow.output.clipboard</string>
<key>uid</key>
<string>48FA1057-4D68-48B5-BB44-CBC28130A414</string>
<key>version</key>
<integer>2</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>alfredfiltersresults</key>
<false/>
<key>alfredfiltersresultsmatchmode</key>
<integer>0</integer>
<key>argumenttrimmode</key>
<integer>0</integer>
<key>argumenttype</key>
<integer>1</integer>
<key>escaping</key>
<integer>62</integer>
<key>keyword</key>
<string>case</string>
<string>transform</string>
<key>queuedelaycustom</key>
<integer>1</integer>
<key>queuedelayimmediatelyinitially</key>
<false/>
<key>queuedelaymode</key>
<integer>0</integer>
<key>queuemode</key>
<integer>1</integer>
<key>runningsubtext</key>
<string>transforming text case...</string>
<key>script</key>
<string>pbpaste | python changecase.py "{query}"</string>
<key>scriptargtype</key>
<integer>0</integer>
<key>scriptfile</key>
<string></string>
<key>subtext</key>
<string>Change the case of text on the clipboard</string>
<string>Change the case to upper, lower, title, camel, kebab, or snake case...</string>
<key>title</key>
<string>Change Case</string>
<string>Change/Transform Text Case</string>
<key>type</key>
<integer>0</integer>
<key>withspace</key>
Expand All @@ -98,31 +212,48 @@
<key>type</key>
<string>alfred.workflow.input.scriptfilter</string>
<key>uid</key>
<string>120913BE-7A34-4EA4-A8A1-BDCE5F034458</string>
<string>272A1B72-8F54-4B5F-831A-8787D7264102</string>
<key>version</key>
<integer>2</integer>
</dict>
</array>
<key>readme</key>
<string>Change the case of text on the keyboard with the keyword case. All three styles are previewed as Alfred results. Select one to copy it to the clipboard and paste into in the current application.
<string>Change the case of text on the keyboard with the keyword case. All styles are previewed as Alfred results. Select one to copy it to the clipboard and paste into in the current application.
Optionally, any text type after case will be changed instead of the clipboard.</string>
Optionally, any text typed after `case` will be changed instead of the clipboard.</string>
<key>uidata</key>
<dict>
<key>120913BE-7A34-4EA4-A8A1-BDCE5F034458</key>
<key>272A1B72-8F54-4B5F-831A-8787D7264102</key>
<dict>
<key>xpos</key>
<integer>440</integer>
<key>ypos</key>
<real>130</real>
<integer>330</integer>
</dict>
<key>3EEC7A2D-486C-4756-A271-FAD9448441C8</key>
<key>48FA1057-4D68-48B5-BB44-CBC28130A414</key>
<dict>
<key>xpos</key>
<integer>710</integer>
<key>ypos</key>
<real>130</real>
<integer>220</integer>
</dict>
<key>48FA1057-4D68-48B5-BB44-CBC28130A414</key>
<key>B6600E5C-BB57-4054-827B-5688E776AEE7</key>
<dict>
<key>xpos</key>
<integer>440</integer>
<key>ypos</key>
<integer>220</integer>
</dict>
<key>CCBE2CE0-D301-463D-A9DC-36C98D2A7030</key>
<dict>
<key>xpos</key>
<integer>440</integer>
<key>ypos</key>
<real>130</real>
<integer>110</integer>
</dict>
</dict>
<key>version</key>
<string>1.1</string>
<key>webaddress</key>
<string>https://github.com/gillibrand/alfred-change-case</string>
</dict>
Expand Down
Binary file added kebabcase.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified lowercase.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added snakecase.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified titlecase.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified uppercase.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 64eb341

Please sign in to comment.