How to customize the small control strip of the macOS touchbar even further

Sadly, the small Control Strip the Touchbar of macOS shows is only customizable to a small degree. Buttons like Next and Previous cannot be added to show, when only the smaller size Control Strip is visible.

Bildschirmfoto 2017-01-09 um 17.46.59.png

However, you can easily edit the contents of the file at ~/Library/Preferences/ with e.g. Xcode:

Bildschirmfoto 2017-01-09 um 18.28.10.png

Just change the MiniCustomized Section to what you want to have in the small version of the Control Strip.

You can find all the possible values in the

/System/Library/CoreServices/ file:


This way, you can e.g. setup this Media Player Control Strip:

Touch Bar Bild 2017-01-09 um 18.41.58.png

After changing the file, save it and reboot to make your mac load the changes.


Use OR Operator in Mac OS X’s saved searches (smart folders)

By default, you can’t set Mac OS X’s saved searches to concatenate several queries using ‘or’ but only using ‘and’.

To change this, create a saved search using ‘and’ connectors, save the search and open it in a text editor.

Then, change all occurences of “&&” to “||”.

Make sure to not change the first occurence (true) &&


    <string>(true) &amp;&amp; (((kMDItemDisplayName = “*A*”cd) &amp;&amp; (kMDItemDisplayName = “*B*”cd)))</string>


    <string>(true) &amp;&amp; (((kMDItemDisplayName = “*A*”cd) || (kMDItemDisplayName = “*B*”cd)))</string>

Applescript to send the selected email as new mail

This applescript takes the subject and content of the selected mail and makes a new message:

tell application “Mail”
    set theSelection to selection
    set theMessage to item 1 of theSelection
    set theSubject to the subject of theMessage
    set theContent to the content of theMessage
    set newMessage to make new outgoing message with properties {visible:true, subject:theSubject, content:theContent}
end tell

A small tool to lock/unlock the Mac OS Dock

I wrote a small Applescript to prohibit the accidental modification of the dock contents by setting the right defaults values. Nothing complicated or sophisticated, but useful and here for my own documentation.

display dialog “Dock Locker” buttons {“Dock sperren”, “Dock entsprerren”, “Abbrechen”} default button 3
set the button_pressed to the button returned of the result
if the button_pressed is “Dock sperren” then
    do shell script “defaults write contents-immutable -bool yes; killall Dock”
else if the button_pressed is “Dock entsprerren” then
    do shell script “defaults write contents-immutable -bool no; killall Dock”
    — action for 3rd button goes here
end if

The tool can be found here.

add a search to instapaper and remove pagination

This is a bookmarklet to add a search to the unread folder of the free version of instapaper and to remove the pagination:

var search = document.createElement(“div”);
search.innerHTML = “<input
onChange=\"var items = document.getElementsByClassName('tableViewCell'); for(var j= 0; j ‘”;
document.getElementById(“left_column”).insertBefore(search, document.getElementById(“bookmark_list”));

var end = false;
var pagenum = 2;
var request = new XMLHttpRequest();“GET”, “; + pagenum, false); request.onreadystatechange = function() { var done = 4, ok = 200; if (request.readyState == done && request.status == ok) { if (request.responseText) {
if(!request.responseText.contains(“No articles saved.”)){
insta = document.createElement(“div”);
insta.innerHTML = request.responseText;
var entries = insta.getElementsByClassName(“tableViewCell”);
for (var i = 0; i < entries.length; i++){document.getElementById("bookmark_list").appendChild(entries[i]);}
} } };

it was tested in firefox only

Convert JPGs to a PDF on a Mac from the Terminal or the Services Menu

Lots of tasks in daily IT repeat themselves and are terribly boring. One of those tasks for me was converting jpgs (of a scanned magazine) to pdfs. You could of course do this with Mac OS X’s Preview Application, but I’ll cover more comfortable and cool ways to do it with Terminal or the Finder‘s Services Menu.

First commands for the Shell

So let’s start with using the Terminal App. Put all the jpgs in one Folder and navigate to it (you can very easily do that with this hint).

Basic command

Once you are inside the Folder in Terminal type:
convert *.jpg myPdf.pdf
and you are done.

Let’s improve it a bit

Ok, so that was easy.
But I said it would become more comfortable.

So, we’ll extend that command a bit. Try:
convert *.JPG "$(basename "$(pwd)").pdf"
and you get a pdf that is named like the parent folder of your jpgs.

How does that work?

In the Shell, code inside the parentheses after a $-Sign is executed first.
$(pwd) returns the current working directory.
The basename command returns the filename of its input (coming from $(pwd)), which, in this case, is the name of the parent directory. The quotes are necessary for the handling of blanks.

The Step to Automator

So how do we get our nice little command out of the Terminal?
The solution is Mac OS X’s Automator.

Fire it up from the Application Directory and choose New Service.

Then, set the Service to receive Folders in Finder.

Add the “Run Shell Script” Automator Action.

Set the Shell to “/bin/sh” and the input pass to “as arguments”.
Then, post the following code into the action:

# Change directory to the Folder
cd “$1”;

# Save Parent Directory Name to variable pdf_name
pdf_name=$(/usr/bin/basename “$(/bin/pwd)”);

# Run convert command
/usr/local/bin/convert *.jpg “$pdf_name.pdf;

and save the Service under a name like “Create PDF from jpgs within”.

Now, right click on the folder with your jpgs, select the new Service and you will get your named PDF.

Tagged , , , , , , , , , , ,