Skip to content
Tech Master Tech Master

OneStopTechnical Forum

  • Books
  • AI
  • Networking
  • Windows
  • Linux
  • Cloud
  • Mac
  • Active Directory
  • Azure
  • Cloud
  • Exchange
  • M365
  • Server 2025
  • Storage
  • Vsphere
  • Website
  • Database
  • Security
  • Knowledge Base
  • VPN
Tech Master
Tech Master

OneStopTechnical Forum

macOS GUI-based automation using Shortcuts, Automator, and Hammerspoon! 🚀

blog.payperitem.com, March 30, 2025April 2, 2025

🔹 1. macOS Shortcuts for Quick Automation (Best for GUI-Based Tasks)

🎯 A. Auto-Enable Focus Mode When Opening Specific Apps

🔹 Example: Turn on “Gaming Focus” when Steam is launched.

1️⃣ Open Shortcuts → Click New Shortcut
2️⃣ Add “Open App” → Select Steam
3️⃣ Add “Set Focus Mode” → Choose Gaming

✅ Now, every time Steam opens, your Focus Mode will automatically activate.


🔥 B. Auto-Toggle Dark Mode Based on Time

🔹 Switches to dark mode after 6 PM and back to light mode at 6 AM.

1️⃣ Create a New Shortcut
2️⃣ Add “If Time of Day is 6:00 PM” → Set Dark Mode: On
3️⃣ Add “If Time of Day is 6:00 AM” → Set Dark Mode: Off

📌 How to Automate:

  • Go to Shortcuts Settings → Automations → Set it to run daily.

🤖 2. Automator for Advanced Workflows (Best for File & System Automations)

📂 A. Auto-Organize Downloads Folder

🔹 Moves screenshots to “Screenshots” folder, PDFs to “Documents,” etc.

1️⃣ Open Automator → Choose Folder Action
2️⃣ Set the Target Folder to Downloads
3️⃣ Add “Filter Finder Items”

  • Condition: Kind is Image
    4️⃣ Add “Move Finder Items”
  • Destination: Screenshots Folder
    5️⃣ Repeat for PDFs, ZIPs, etc.

✅ Now, every time you download files, they will be automatically sorted.


🖥 B. Auto-Switch Display Resolutions for Gaming vs. Work

🔹 Changes resolution to 1080p when Steam opens, 4K when it closes.

1️⃣ Open Automator → Create Application
2️⃣ Add “Run Shell Script”
3️⃣ Paste this script:

bash
if pgrep -x "Steam" > /dev/null; then
cscreen -x 1920 -y 1080
else
cscreen -x 3840 -y 2160
fi

4️⃣ Save and set it to run automatically when Steam opens.

✅ Now, your Mac will switch resolutions based on activity.


🛠 3. Hammerspoon for Ultimate macOS Automation

🔹 (Best for Keyboard Shortcuts, Window Management, and Custom Workflows)

🎭 A. Create a Hyper Key (Caps Lock → Cmd+Ctrl+Option+Shift)

🔹 Turns Caps Lock into a super modifier key for custom shortcuts.

1️⃣ Install Hammerspoon

css
brew install --cask hammerspoon

2️⃣ Open ~/.hammerspoon/init.lua and add:

luaCopyEdiths.hotkey.bind({"cmd", "ctrl", "alt", "shift"}, "T", function()
    hs.alert.show("Hyper Key Activated!")
end)

3️⃣ Reload Hammerspoon → Now, Caps Lock + T triggers an alert.

✅ Customize it to launch apps, resize windows, or trigger workflows.


📌 B. Auto-Tile Windows for Productivity

🔹 Arrange windows automatically when you open apps like VS Code & Safari.

lua
hs.window.animationDuration = 0
local laptopScreen = hs.screen.primaryScreen()

function arrangeWindows()
local apps = {
{ "Safari", hs.geometry.unitrect(0, 0, 0.5, 1) }, -- Left half
{ "Visual Studio Code", hs.geometry.unitrect(0.5, 0, 0.5, 1) } -- Right half
}

for _, app in ipairs(apps) do
local appWindow = hs.application.get(app[1]):mainWindow()
if appWindow then
appWindow:move(app[2], laptopScreen)
end
end
end

hs.hotkey.bind({"cmd", "ctrl", "alt"}, "A", arrangeWindows)

✅ Now, press Cmd + Ctrl + Alt + A to instantly tile windows.


Want specific automations? I can customize:
✅ Gaming setups (eGPU switching, auto resolution tweaks)
✅ Pro workflows (window tiling, keyboard macros)
✅ Smart home control (Shortcuts + HomeKit)

Mac #Azure#BSOD#CentOS#CloudComputing#CloudHosting#Colocation#CyberSecurity#CyberSecurity #WindowsSecurity #PrivacyMatters #Firewall #EndpointSecurity#DataCenter#DDoSProtection#DebianServer#DedicatedServer#DirectX#ESXi#FibreChannel#Firewall#GameOptimization#HyperV#IntrusionDetection#iSCSI#ITInfrastructure#ITPro#KVM#LinuxServer#ManagedHosting#NASStorage#Networking#NVMe#PCGaming#PCIssues#PowerShell#Proxmox#RAID#RedHat#SANStorage#Server#ServerRoom#ServerSecurity#SIEM#SSDServers#SysAdmin#SysAdminLife#TaskScheduler#TechSupport#UbuntuServer#VMware#VPSHosting#vSAN#vSphere#WindowsAutomation#WindowsDebugging#WindowsFix#WindowsGaming#WindowsServerEnterprise & HostingSecurity & MonitoringStorage & Performance

Post navigation

Previous post
Next post

Related Posts

🤖 Essential macOS Automation Scripts

March 30, 2025April 2, 2025

🎯 1. Auto-Optimize macOS Performance Daily 🔹 Cleans junk files, flushes RAM, and empties logs every night bash#!/bin/bashecho “Cleaning up system…”sudo purgesudo rm -rf ~/Library/Caches/*sudo rm -rf /Library/Caches/*sudo find /private/var/log -type f -deleteecho “Done!” 📌 How to Automate: 🔋 2. Auto-Limit Battery Charge to 80% (Extends Lifespan) 🔹 Prevents overcharging,…

Read More

Real-time scenario-based questions and answers on MAC Os Part-2

March 30, 2025April 2, 2025

Scenario 9: MacBook Overheating Q: Your MacBook is getting extremely hot, and the fans are loud. What should you do?A: Scenario 10: USB Accessories Not Working Q: You plugged in a USB device (mouse, keyboard, flash drive), but it’s not recognized. What do you do?A: Scenario 11: Bluetooth Not Working…

Read More

eGPU setups, deep Terminal hacks, macOS customization, and automation scripts.

March 30, 2025April 2, 2025

🔥 eGPU Setup on macOS (For Intel & Apple Silicon Macs) 1. Check If Your Mac Supports eGPU 2. Best eGPU Enclosures for macOS 3. Install & Enable eGPU on macOS A. For macOS Catalina & Big Sur (Intel Macs) B. For macOS Monterey & Ventura (Intel Macs) C. eGPU…

Read More

Recent Posts

  • List of AD Schema Versions
  • OldNewExplorer Free Download For Windows 11, 10, 8 and 7 [Latest Version]
  • How to Get the Classic (old) Context Menu on Windows 11
  • BitLocker Recovery Keys
  • Active Directory and Server hardening

Recent Comments

No comments to show.
June 2025
M T W T F S S
 1
2345678
9101112131415
16171819202122
23242526272829
30  
« May    
Log in
©2025 Tech Master | WordPress Theme by SuperbThemes
  • Login
  • Sign Up
Forgot Password?
Lost your password? Please enter your username or email address. You will receive a link to create a new password via email.
body::-webkit-scrollbar { width: 7px; } body::-webkit-scrollbar-track { border-radius: 10px; background: #f0f0f0; } body::-webkit-scrollbar-thumb { border-radius: 50px; background: #dfdbdb }