{"slug": "add-superpin-or-sticky-to-hyprland-as-super-grave-floating-and-tiled-windows", "title": "Add \"superpin\" or \"sticky\" to hyprland as super + grave (floating and tiled windows move with workspaces)", "summary": "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.", "body_md": "superpin.lua\n\n      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.\n      \nLearn more about bidirectional Unicode characters\n\n \n    Show hidden characters\n\nlocal superpin_windows = {}\n\n---add or remove window from superpin list\n\n---@param target_win HL.Window\n\nlocal function toggle_superpin(target_win)\n\n  if superpin_windows[target_win.address] then\n\n    superpin_windows[target_win.address] = nil\n\n    hl.notification.create({ text = \"superpin off: \" .. target_win.title, timeout = 2000 })\n\n  else\n\n    superpin_windows[target_win.address] = {\n\n      win = target_win,\n\n      at   = target_win.at,\n\n      size = target_win.size,\n\n    }\n\n    hl.notification.create({ text = \"superpin on: \" .. target_win.title, timeout = 2000 })\n\n  end\n\nend\n\n-- watch for workspace changes to ensure superpin windows follow\n\nhl.on(\"workspace.active\", function(ws)\n\n  for _, stored in pairs(superpin_windows) do\n\n    hl.dispatch(hl.dsp.window.move({ workspace = ws.id, window = stored.win }))\n\n  end\n\nend)\n\n-- clean up\n\nhl.on(\"window.close\", function(win)\n\n  superpin_windows[win.address] = nil\n\nend)\n\n-- toggle superpin\n\nhl.bind(\"SUPER + grave\", function()\n\n  local win = hl.get_active_window() --[[@as HL.Window]]\n\n  toggle_superpin(win)\n\nend)\n\n-- helps restore original position and size\n\nhl.on(\"window.update_rules\", function(win)\n\n  if win.floating then\n\n    local stored = superpin_windows[win.address]\n\n    if stored and stored.at and stored.size then\n\n      hl.dispatch(hl.dsp.window.move({ x = stored.at.x, y = stored.at.y, window = win }))\n\n      hl.dispatch(hl.dsp.window.resize({ x = stored.size.x, y = stored.size.y, window = win }))\n\n    end\n\n  end\n\nend)", "url": "https://wpnews.pro/news/add-superpin-or-sticky-to-hyprland-as-super-grave-floating-and-tiled-windows", "canonical_source": "https://gist.github.com/majamin/d779fb1c1845e5ec3723f9c29d1df5e4", "published_at": "2026-05-24 00:15:32+00:00", "updated_at": "2026-05-24 06:04:42.341199+00:00", "lang": "en", "topics": ["developer-tools", "open-source"], "entities": ["Hyprland"], "alternates": {"html": "https://wpnews.pro/news/add-superpin-or-sticky-to-hyprland-as-super-grave-floating-and-tiled-windows", "markdown": "https://wpnews.pro/news/add-superpin-or-sticky-to-hyprland-as-super-grave-floating-and-tiled-windows.md", "text": "https://wpnews.pro/news/add-superpin-or-sticky-to-hyprland-as-super-grave-floating-and-tiled-windows.txt", "jsonld": "https://wpnews.pro/news/add-superpin-or-sticky-to-hyprland-as-super-grave-floating-and-tiled-windows.jsonld"}}