Todoist Sync Shortcut v0.1.0

← Back to User Scripts

This user script adds a keyboard shortcut (Ctrl+S) to trigger the sync button in Todoist. This allows you to quickly sync your tasks without having to click the sync button manually.

Script Content

// ==UserScript==
// @name         Todoist: Sync Shortcut
// @namespace    https://www.timhilton.xyz/user-scripts
// @version      0.1.1
// @description  Add a keyboard shortcut to sync Todoist tasks
// @author       Tim Hilton using Copilot
// @match        https://app.todoist.com/app/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    const LOG_PREFIX = '[Todoist: Sync Shortcut]';
    
    console.debug(`${LOG_PREFIX} Script initialized`);

    // Add keyboard shortcut listener
    document.addEventListener('keydown', function(event) {
        // Check for Ctrl+S or Cmd+S
        if ((event.ctrlKey || event.metaKey) && event.key === 's') {
            event.preventDefault();
            
            console.debug(`${LOG_PREFIX} Sync shortcut triggered`);
            
            // Find and click the sync button
            const syncButton = document.querySelector('button[aria-label="Sync"]');
            if (syncButton) {
                syncButton.click();
                console.log(`${LOG_PREFIX} 🎉 Sync triggered successfully`);
            } else {
                console.log(`${LOG_PREFIX} ❌ Sync button not found`);
            }
        }
    });
})();