Skip to content

Instantly share code, notes, and snippets.

@MrEnder0
Created December 8, 2025 03:51
Show Gist options
  • Select an option

  • Save MrEnder0/20fd93387c9a78dd368ed42573eccf00 to your computer and use it in GitHub Desktop.

Select an option

Save MrEnder0/20fd93387c9a78dd368ed42573eccf00 to your computer and use it in GitHub Desktop.
Apple Music MiniPlayer Always on Top Script
# Apple Music MiniPlayer Always on Top Script
import win32gui
import win32con
import time
TARGET = "MiniPlayer"
def enum_handler(hwnd, results):
if TARGET.lower() in win32gui.GetWindowText(hwnd).lower():
results.append(hwnd)
def set_always_on_top(hwnd):
win32gui.SetWindowPos(
hwnd,
win32con.HWND_TOPMOST,
0, 0, 0, 0,
win32con.SWP_NOMOVE | win32con.SWP_NOSIZE
)
# Hide the console window
console_window = win32gui.GetForegroundWindow()
win32gui.ShowWindow(console_window, win32con.SW_HIDE)
while True:
found = []
win32gui.EnumWindows(enum_handler, found)
if found:
for hwnd in found:
set_always_on_top(hwnd)
print(f"Set {len(found)} window(s) on top.")
time.sleep(60)
else:
time.sleep(5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment