Skip to content

Instantly share code, notes, and snippets.

💎
Cookin up some Sketch plugins

Kevin Gutowski KevinGutowski

💎
Cookin up some Sketch plugins
Block or report user

Report or block KevinGutowski

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@KevinGutowski
KevinGutowski / menus.js
Created Jul 19, 2019
Toggling Sketch menu items
View menus.js
let menu = NSApplication.sharedApplication().mainMenu()
let pluginsMenu = menu.itemWithTitle('Plugins').submenu()
let baseAlignPluginMenuItem = pluginsMenu.itemWithTitle('BaseAlign'))
baseAlignPluginMenuItem.setEnabled(false)
baseAlignPluginMenuItem.setState(true)
@KevinGutowski
KevinGutowski / notification.js
Created Jul 19, 2019
Create a notification within a sketch plugin
View notification.js
let notification = NSUserNotification.alloc().init()
let randomNumber = Math.random()
notification.setIdentifier("com.kevin.testNotification" + randomNumber)
notification.setTitle("Hi there")
notification.setSubtitle("What about this?")
notification.setInformativeText("Your symbol")
notification.setSoundName = NSUserNotificationDefaultSoundName
let notificationCenter = NSUserNotificationCenter.defaultUserNotificationCenter()
notificationCenter.deliverNotification(notification)
@KevinGutowski
KevinGutowski / blurAnimation.js
Created Jun 23, 2019
Animating the background blur of a NSView that is layer backed
View blurAnimation.js
let threadDictionary = NSThread.mainThread().threadDictionary()
let panelID = "com.betterTypePanel.panel"
if (threadDictionary[panelID]) {
let panel = threadDictionary[panelID]
panel.close()
threadDictionary.removeObjectForKey(panelID)
}
var panelWidth = 312
@KevinGutowski
KevinGutowski / moveCALayer.js
Created Jun 12, 2019
Getting a CALayer to animate implicitly
View moveCALayer.js
let threadDictionary = NSThread.mainThread().threadDictionary()
let panelID = "com.betterTypePanel.panel"
if (threadDictionary[panelID]) {
let panel = threadDictionary[panelID]
panel.close()
threadDictionary.removeObjectForKey(panelID)
}
var panelWidth = 312
@KevinGutowski
KevinGutowski / panelAnimationExploration.js
Created Jun 12, 2019
Trying to get NSPanel to expand downward.
View panelAnimationExploration.js
let threadDictionary = NSThread.mainThread().threadDictionary()
let panelID = "com.betterTypePanel.panel"
if (threadDictionary[panelID]) {
let panel = threadDictionary[panelID]
panel.close()
threadDictionary.removeObjectForKey(panelID)
}
var panelWidth = 312
@KevinGutowski
KevinGutowski / moveBox.js
Created Jun 12, 2019
Testing how to animate a NSBox on the screen.
View moveBox.js
let threadDictionary = NSThread.mainThread().threadDictionary()
let panelID = "com.betterTypePanel.panel"
if (threadDictionary[panelID]) {
let panel = threadDictionary[panelID]
panel.close()
threadDictionary.removeObjectForKey(panelID)
}
var panelWidth = 312
View SubstringFontReporting.js
let sketch = require('sketch')
let settingsAttribute = getSettingsAttributeForKey_Value(kLowerCaseType, kLowerCaseSmallCapsSelector)
applySubstringFontModification()
//getFontAttributesForSelectedRange()
function applySubstringFontModification() {
let document = sketch.getSelectedDocument()
let textLayer = document.selectedLayers.layers[0]
View updateSubstringFontAttributes.js
var sketch = require('sketch')
var document = sketch.getSelectedDocument()
var text = document.selectedLayers.layers[0].sketchObject
let textView = text.editingDelegate().textView()
let selectedRange = textView.selectedRange()
let textStorage = textView.textStorage()
let settingsAttribute = getSettingsAttributeForKey_Value(kLowerCaseType, kLowerCaseSmallCapsSelector)
function getSettingsAttributeForKey_Value(key, value) {
@KevinGutowski
KevinGutowski / AppDelegate.m
Last active May 24, 2019
Trying to render a tableview
View AppDelegate.m
//
// AppDelegate.m
// Tableview3
//
// Created by Kevin Gutowski on 5/23/19.
// Copyright © 2019 Kevin. All rights reserved.
//
#import "AppDelegate.h"
View MochaJSDelegate.js
//
// MochaJSDelegate.js
// MochaJSDelegate
//
// Created by Matt Curtis
// Copyright (c) 2015. All rights reserved.
//
function MochaJSDelegate(selectorHandlerDict){
var uniqueClassName = "MochaJSDelegate_DynamicClass_" + NSUUID.UUID().UUIDString();
You can’t perform that action at this time.