Skip to content

Instantly share code, notes, and snippets.

@Sebas-h
Sebas-h / hyper_plus.lua
Last active September 3, 2019 10:41
Hammerspoon... spoon. Binds Hyper+Key to switch to a particular app and when pressed again switches between the windows of that app (across spaces). Cycle order between windows is determined by the order of focus received, most recently first. To use: place file in .hammerspoon directory and add 'require("hyper_plus")' to 'init.lua'
--------------------------
-- DEFINE YOUR APP + SHORTCUT KEY COMBINATIONS
--------------------------
shortcut_key_and_app = {
{ 'f', 'Firefox' }, -- "F" for "Browser"
{ 'e', 'Code' }, -- "E" for "Editor"
{ 'v', 'Finder' }, -- "V" for "Finder"
{ 't', 'iTerm2' }, -- "T" for "Terminal"
}
@Sebas-h
Sebas-h / mdbook-page-toc.js
Created October 28, 2021 07:44
Userscript - mdBook Page ToC
function populatePageToc() {
// Source: https://github.com/JorelAli/mdBook-pagetoc
// Modified:
// Un-active everything when you click it
Array.prototype.forEach.call(document.getElementsByClassName("pagetoc")[0].children, function (el) {
el.addEventHandler("click", function () {
Array.prototype.forEach.call(document.getElementsByClassName("pagetoc")[0].children, function (el) {
el.classList.remove("active");
});
@Sebas-h
Sebas-h / wofi-emoji-paster
Last active March 6, 2024 17:23
Sway emoji picker - Extended to insert emoji immediately after choosing it, similar behavior as macOS
#!/usr/bin/env bash
################################################################################
################################################################################
# Forked from: https://github.com/dln/wofi-emoji
# which presents a wofi menu to choose an emoji and put it into the clipboard
#
# This script:
# - Stores the clipboard's current top item before overwriting it with the emoji
# - Emulates `ctrl+v` to paste the emoji