Skip to content

Instantly share code, notes, and snippets.

@Ptujec
Ptujec / toggle dark mode for specific app.applescript
Created April 13, 2023 19:04
Quick Applescript that toggles dark mode for a selected app in LaunchBar
on open (_file)
try
set bID to bundle identifier of (info for (_file))
set currentState to do shell script "defaults read " & bID & " NSRequiresAquaSystemAppearance"
if currentState is "1" then
do shell script "defaults write " & bID & " NSRequiresAquaSystemAppearance -bool no"
else
do shell script "defaults write " & bID & " NSRequiresAquaSystemAppearance -bool yes"
end if
@Ptujec
Ptujec / default.js
Last active February 21, 2023 19:24
Menu Bar Item Navigation in LaunchBar
/*
Menu Bar Items Action for LaunchBar
using executable from Alfred Workflow: https://github.com/BenziAhamed/Menu-Bar-Search
I acutally forked it and made some changes: https://github.com/Ptujec/Menu-Bar-Search
by Christian Bender (@ptujec)
2023-02-17
*/
function run() {
@Ptujec
Ptujec / javascript.json
Last active June 23, 2022 07:45
My Snippets for LaunchBar Actions in VS Code
{
// LaunchBar Snippets
"LaunchBar alert": {
"prefix": "lAlert",
"body": "LaunchBar.alert($1);",
"description": "Creates a LaunchBar alert code"
},
"LaunchBar alert with response": {
"prefix": "lAlertResponse",
"body": [
@Ptujec
Ptujec / nearbyContacts.swift
Created May 7, 2022 21:35
Trying to display contacts in LaunchBar sorted by distance … but struggle with async part
#!/usr/bin/env swift
/*
Contacts Location Action for LaunchBar
by Christian Bender (@ptujec)
2022-05-05
Copyright see: https://github.com/Ptujec/LaunchBar/blob/master/LICENSE
*/
@Ptujec
Ptujec / readinglist.js
Last active February 23, 2023 18:50
I tried my hand on a LB action to show, open and remove items from Safaris Reading List. Show and open them is not a problem. I also managed to remove items from the plist (row 61-65). It works temporarily. But something is missing.
// LaunchBar Action Script
function run() {
var plist = File.readPlist('~/Library/Safari/Bookmarks.plist')
var listItems = plist.Children[3].Children
var result = []
for (var i = 0; i < listItems.length; i++) {