Skip to content

Instantly share code, notes, and snippets.

@Phixyn
Phixyn / iterm_spotify_now_playing.py
Last active January 24, 2022 10:39
iTerm Python script that adds a statusbar component which shows your current playing song and artist from Spotify.
"""iTerm script to fetch and display Spotify's current playing song
in a status bar component.
"""
__author__ = "Phixyn (Alpeche Pancha)"
__version__ = "1.1.0"
import iterm2
@Serneum
Serneum / MediaApplication.swift
Last active March 8, 2024 04:59
Swift media key event handling
import Cocoa
class MediaApplication: NSApplication {
override func sendEvent(event: NSEvent) {
if (event.type == .SystemDefined && event.subtype.rawValue == 8) {
let keyCode = ((event.data1 & 0xFFFF0000) >> 16)
let keyFlags = (event.data1 & 0x0000FFFF)
// Get the key state. 0xA is KeyDown, OxB is KeyUp
let keyState = (((keyFlags & 0xFF00) >> 8)) == 0xA
let keyRepeat = (keyFlags & 0x1)
@wandernauta
wandernauta / sp
Last active May 14, 2024 16:49
sp is a command-line client for Spotify's dbus interface. Play, pause, skip and search tracks from the comfort of your command line.
#!/usr/bin/env bash
#
# This is sp, the command-line Spotify controller. It talks to a running
# instance of the Spotify Linux client over dbus, providing an interface not
# unlike mpc.
#
# Put differently, it allows you to control Spotify without leaving the comfort
# of your command line, and without a custom client or Premium subscription.
#