Skip to content

Instantly share code, notes, and snippets.

View smeech's full-sized avatar

Stephen Meech smeech

View GitHub Profile
@smeech
smeech / rti.yml
Last active January 31, 2025 16:57
[Rich text images] HTML and Markdown examples, including the injection of images +/- text #espanso #html #markdown
# Espanso Html and Markdown examples, including the injection of images:
# Define a variable containing the location of the home directory
global_vars:
- name: home
type: script
params:
args:
- python
- -c
- print(__import__('os').path.expanduser('~'))
@smeech
smeech / chk.yml
Last active January 31, 2025 16:04
[Check-boxes] Using characters #espanso
# Espanso check-boxes
matches:
- trigger: :test
replace: "{{form1.flag}}"
vars:
- name: form1
type: form
params:
layout: "Option A: [[flag]]"
fields:
@smeech
smeech / clipman.yml
Last active November 23, 2025 05:17
[Clipboard manipulation] Espanso clipboard manipulation, to select relevant script line using the choice extension id: parameters. #espanso #bash
# Espanso clipboard manipulation, new version to select relevant script
# line using the choice extension id: parameters.
# To use, copy the text in question and type ":case".
- trigger: :case
label: Modify and paste copied text
replace: '{{Output}}'
vars:
- name: Clipb
@smeech
smeech / ftext.yml
Last active May 3, 2025 21:10
[Add text from file] #espanso #python
# From https://github.com/espanso/espanso/discussions/1908
matches:
- trigger: :test
replace: "{{output}}"
vars:
- name: output
type: script
params:
args:
- python
@smeech
smeech / espanso_add.py
Last active August 2, 2025 22:12
[Espanso add] Python script to add Espanso `trigger:`/`replace:` pairs, checking for duplicate triggers #espanso
# Python script to add Espanso trigger:/replace: pairs
# Usage: python espanso_add.py <trigger> <replace> [filename]
import subprocess
import sys
import os
def append_to_file(trigger, replace, filename):
# Set default filename if not provided
if not filename:
@smeech
smeech / backend.yml
Last active January 31, 2025 16:09
[Injection methods] Tests for Espanso clipboard & inject (keys) injection methods #espanso
matches:
- trigger: :testclip
replace: something
force_mode: clipboard
# If this one works, you'll probably need an app-specific configuration
# for the filter_class:, _exec: or _title: (in that order of preference)
# specifying "backend: clipboard"
- trigger: :testinject
@smeech
smeech / osvar.yml
Last active January 31, 2025 16:08
[OSVar] OS-independent variable setting #espanso #python
# Set an Espanso global variable for the system "HOME" directory, regardless of OS
# to avoid the need to use `filter_os:`, as Espanso can only use ONE app-specific
# configuration at a time.
# Requires Python
global_vars:
- name: home
type: script
params:
args: [python, -c, print(__import__('os').path.expanduser('~'))]
@smeech
smeech / offset_date_bash.yml
Last active June 26, 2025 19:14
[Date offsets] Espanso snippets to return offset date from today - various versions. #espanso #python #powershell #bash #regex #javascript #ruby
# Espanso snippets to return offset date from today
# It was pointed out that my v1 didn't allow for different length months and years.
# Thanks to @StewCam on Discord https://discord.com/channels/884163483409731584/1013914627886817372/1251704970080944189
# Here are five updated versions which do.
# Pick one and type e.g.: +2w, -3m etc.
# Bash version for Linux. For macOS Bash or Zsh see the discussion below
- regex: (?P<Offset>[+-]\d+)(?P<Unit>[dwmy])
replace: "{{Output}}"
label: Bash Offset date
@smeech
smeech / oasis.yml
Last active January 10, 2025 14:17
[OASIS-IS] My take on https://github.com/espanso/hub/pull/123 #espanso
# yaml-language-server: https://github.com/espanso/espanso/blob/dev/schemas/match.schema.json
# OASIS-IS ChatGPT framework Form. OASIS-IS stands for : O-bjective, A-rchtype, -S-etting, I-llustrations, S-tyle, - , I-nterpretation, S-pecification.
# After those steps are Evalute - How good was the response, give your chatbot feedback, and then Banter - Continue the conversation.
# Paid ChatGPT users can use the current list of models avaialble while unpaid can use the default model.
# The frameworks spreadsheet can be found here: http://3dmkf.com/pace-oasis
# This first one, is meant to generate a prompt. Run :oasis from a URL in a web browser, fill out the form and submit it, then press enter. It wiss pass the prompt to ChatGPT.
global_vars:
@smeech
smeech / date_time.yml
Last active October 13, 2025 09:49
[Date_Time] Espanso trigger to output time and date in another timezone. Requires Python and its pytz library. Somewhat redundant from Espanso v2.3.0. #espanso #python
# Espanso trigger to output time and date in another timezone
# Requires Python and its pytz library
matches:
- trigger: :tzdate
replace: '{{output}}'
vars:
- name: zones
type: script
params: