cd /news/developer-tools/add-superpin-or-sticky-to-hyprland-a… · home topics developer-tools article
[ARTICLE · art-13236] src=gist.github.com ↗ pub= topic=developer-tools verified=true sentiment=· neutral

Add "superpin" or "sticky" to hyprland as super + grave (floating and tiled windows move with workspaces)

This Lua script adds a "superpin" feature to the Hyprland window manager, allowing users to toggle a window as "sticky" by pressing Super + Grave. When enabled, superpinned windows automatically move to follow the active workspace, and their original floating position and size are restored when the window updates its rules.

read1 min views24 publishedMay 24, 2026

superpin.lua

  This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.

Learn more about bidirectional Unicode characters

Show hidden characters
local superpin_windows = {}

---add or remove window from superpin list

---@param target_win HL.Window

local function toggle_superpin(target_win)

  if superpin_windows[target_win.address] then

    superpin_windows[target_win.address] = nil

    hl.notification.create({ text = "superpin off: " .. target_win.title, timeout = 2000 })

else

    superpin_windows[target_win.address] = {

      win = target_win,

      at   = target_win.at,

      size = target_win.size,

    }

    hl.notification.create({ text = "superpin on: " .. target_win.title, timeout = 2000 })

end

end

-- watch for workspace changes to ensure superpin windows follow

hl.on("workspace.active", function(ws)

  for _, stored in pairs(superpin_windows) do

    hl.dispatch(hl.dsp.window.move({ workspace = ws.id, window = stored.win }))

end

end)

-- clean up

hl.on("window.close", function(win)

  superpin_windows[win.address] = nil

end)

-- toggle superpin

hl.bind("SUPER + grave", function()

  local win = hl.get_active_window() --[[@as HL.Window]]

  toggle_superpin(win)

end)

-- helps restore original position and size

hl.on("window.update_rules", function(win)

  if win.floating then

    local stored = superpin_windows[win.address]

    if stored and stored.at and stored.size then

      hl.dispatch(hl.dsp.window.move({ x = stored.at.x, y = stored.at.y, window = win }))

      hl.dispatch(hl.dsp.window.resize({ x = stored.size.x, y = stored.size.y, window = win }))

    end

end

end)

── more in #developer-tools 4 stories · sorted by recency
── more on @hyprland 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/add-superpin-or-stic…] indexed:0 read:1min 2026-05-24 ·