Custom Commands for Developers
A professional-grade feature for developers to process and transform data effortlessly.
Why Custom Commands?
Ever found yourself searching for an online tool just to convert a timestamp or format a JSON string? Custom Commands bring those tools directly into your clipboard manager, keeping you in the flow.
Real-world Scenario
Imagine you're debugging logs and find a timestamp like 1735704110. You need to know the human-readable date but don't want to leave your terminal or IDE.
With a custom 'dt' command, you simply type:
It works both ways! Type a date, get the timestamp. You have total control.
Stay in the Flow
- Base64 encoders/decoders
- JSON & XML formatters
- URL shorteners or ID generators
- Text casing & regex transformations
Pro Tip
Any executable can be a command. Node, Python, Bash, binaries—you name it.
How to Create Commands
Custom Commands are language-agnostic. You can use Python, Node.js, Ruby, C++, Go, or even compiled binaries.
Configuration Breakdown
Name: A descriptive identifier for your script.
Trigger Prefix: The short command you'll type to activate it.
Interpreter Path: Path to your language runtime (e.g., /usr/bin/python3). Leave empty for binaries.
Script Path: The path to your script or executable file.
Practical Code Example (Python)
The following Python script illustrates how easy it is to implement the 'dt' logic yourself. Simply save this to a file and point the 'Script Path' to it.
#!/usr/bin/env python3
import sys
from datetime import datetime
DATE_FORMATS = [
"%Y-%m-%d",
"%Y-%m-%d %H:%M:%S",
"%Y/%m/%d",
"%Y/%m/%d %H:%M:%S"
]
def is_timestamp(s: str):
try:
float(s)
return True
except:
return False
def parse_date(s: str):
for fmt in DATE_FORMATS:
try:
return datetime.strptime(s, fmt)
except:
continue
return None
def convert(s: str):
if is_timestamp(s):
ts = float(s)
if ts > 1e12:
ts = ts / 1000
dt = datetime.fromtimestamp(ts)
return dt.strftime("%Y-%m-%d %H:%M:%S")
dt = parse_date(s)
if dt:
return int(dt.timestamp())
return f"Unrecognized format: {s}"
if __name__ == "__main__":
if len(sys.argv) < 2:
print("Parameter error")
sys.exit(1)
value = sys.argv[1]
print(convert(value))