{"id":15064081,"url":"https://github.com/ivan-the-terrible/bloodsugar-cursor","last_synced_at":"2025-07-13T18:35:59.071Z","repository":{"id":252870269,"uuid":"841704896","full_name":"ivan-the-terrible/bloodsugar-cursor","owner":"ivan-the-terrible","description":"A cool way to update your cursor to reflect your blood sugar values.","archived":false,"fork":false,"pushed_at":"2024-09-26T22:04:28.000Z","size":340,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-20T04:41:55.351Z","etag":null,"topics":["autohotkey","cursor","powershell","type1diabetes"],"latest_commit_sha":null,"homepage":"","language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ivan-the-terrible.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-12T22:59:06.000Z","updated_at":"2024-10-14T07:15:50.000Z","dependencies_parsed_at":"2024-10-13T00:02:52.271Z","dependency_job_id":"61f4fc59-c2de-480b-a692-416c63a74e19","html_url":"https://github.com/ivan-the-terrible/bloodsugar-cursor","commit_stats":null,"previous_names":["ivan-the-terrible/bloodsugar-cursor"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivan-the-terrible%2Fbloodsugar-cursor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivan-the-terrible%2Fbloodsugar-cursor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivan-the-terrible%2Fbloodsugar-cursor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivan-the-terrible%2Fbloodsugar-cursor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ivan-the-terrible","download_url":"https://codeload.github.com/ivan-the-terrible/bloodsugar-cursor/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225769466,"owners_count":17521258,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["autohotkey","cursor","powershell","type1diabetes"],"created_at":"2024-09-25T00:11:18.890Z","updated_at":"2024-11-21T17:06:54.701Z","avatar_url":"https://github.com/ivan-the-terrible.png","language":"PowerShell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bloodsugar-cursor\n\nA cool way to update your cursor to reflect your blood sugar values.\n\nThe main idea here is to poll against your Nightscout API every 5 minutes and update the color of your mouse cursor to help indicate your current level.\n\nFor right now, the colors are:\n\n- green = in range\n- yellow = high\n- red = low\n\nIncluded are the cursor files that will be loaded based on this status.\nYou can run this via AutoHotkey and PowerShell for right now, and is very Windows centric.\n\nA known issue is how the cursor is rendered when running the PowerShell script. It's currently quite blurry and there seems to be a need to activate something to kick in better rendering. AutoHotkey doesn't have this problem.\n\nI HIGHLY recommend using this with AutoHotkey since PowerShell has so many issues (from the blurry cursor to the inability to have a decent Cron job implementation).\n\u003chttps://www.autohotkey.com/\u003e\n\n## Technical Details\n\nWindows has certain APIs available to update the cursor. Mainly, `LoadCursorFromFile` and `SetSystemCursor` are leveraged.\n\n\u003chttps://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setsystemcursor\u003e\n\u003chttps://learn.microsoft.com/en-us/windows/win32/menurc/about-cursors\u003e\n\u003chttp://www.jasinskionline.com/windowsapi/ref/s/setsystemcursor.html\u003e\n\nEach value below is a DWORD value, which identifies a cursor.\n\n- 32512 = NORMAL\n- 32513 = IBEAM\n- 32514 = WAIT\n- 32515 = CROSS\n- 32516 = UP\n- 32631 = PEN\n- 32642 = SIZENWSE\n- 32643 = SIZENESW\n- 32644 = SIZEWE\n- 32645 = SIZENS\n- 32646 = SIZEALL\n- 32648 = NO\n- 32649 = HAND\n- 32650 = APPSTARTING\n- 32651 = HELP\n- 32671 = PIN\n- 32672 = PERSON\n\n### Registry Keys\n\nWithin the Registry Editor, a couple places control mouse/cursor settings:\n\n- Computer/HKEY_CURRENT_USER\n  - Control Panel\n    - Cursors\n    - Mouse\n  - Software/Microsoft/Accessibility\n\nYou can see values corresponding to some defaults, which seem to be linked to the\naccessibility settings.\n\n\"Cursor Size\" in Settings/Accessibility/Mouse pointer and touch is linked to\nControl Panel/Cursors -\u003e CursorBaseSize in the Registry:\n3 = 64\n4 = 80\n\n\"Mouse pointer speed\" in Settings/Bluetooth \u0026 devices/Mouse is linked to\nControl Panel/Mouse -\u003e MouseSensitivity. The values are equivalent.\n\nAnd finally \"Mouse pointer style\" in Settings/Accessibility/Mouse pointer and touch is linked to\nSoftware/Microsoft/Accessibility\n\nThere are four registry keys here:\n\n- CursorColor\n- CursorSize\n- CursorType\n- TextScaleFactor\n\nThe color can be seen to change from:\nGreen = 12582656 (0x00bfff00)\nYellow = 64250      (0x0000fafa)\n\nBack at the Control Panel/Cursors entries, the file path for Arrow is this string:\n\"C:\\\\Users\\\\[YOUR_USERNAME]\\\\AppData\\\\Local\\\\Microsoft\\\\Windows\\\\Cursors\\\\arrow_eoa.cur\"\n\nGoing to that directory, we can find these cursor files. If we change the color in Settings now, we can see these files get updated.\n\n### AutoHotkey\n\nThis topic helped tremendously in doing this in AutoHotkey (v1):\n\u003chttps://www.autohotkey.com/boards/viewtopic.php?t=81652\u003e\n\nNo major changes to the logic, other than updating the script to v2 syntax.\n\n### PowerShell\n\nThe PowerShell script is written in a way that is to be leveraged by Task Scheduler.\nThis doesn't really work well with Task Scheduler because of this issue: \u003chttps://github.com/PowerShell/PowerShell/issues/3028\u003e.\n\nThe stupid PowerShell window keeps appearing and causing whatever window I'm on to lose focus.\n\nThe DLL is also called in a little bit of an odd way...\n\n\u003chttps://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/add-type?view=powershell-5.1#example-4-call-native-windows-apis\u003e\n\nThe above reference shows how you can leverage the `Add-Type` utility to add a Microsoft .NET class to a PowerShell session.\nSince .NET can make the DLL call, we have this nested logic of a DLL call within a .NET string defined within PowerShell. Yikes.\n\nIt's probably worth it to create an actual .NET solution for this instead of scripting it through PowerShell. So much for a PoC for PowerShell.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivan-the-terrible%2Fbloodsugar-cursor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fivan-the-terrible%2Fbloodsugar-cursor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivan-the-terrible%2Fbloodsugar-cursor/lists"}