{"id":21713739,"url":"https://github.com/blurstudio/casement","last_synced_at":"2025-04-12T18:47:56.804Z","repository":{"id":53676276,"uuid":"196468713","full_name":"blurstudio/casement","owner":"blurstudio","description":"Useful functionality for managing Microsoft Windows.","archived":false,"fork":false,"pushed_at":"2025-04-07T19:34:33.000Z","size":50,"stargazers_count":12,"open_issues_count":1,"forks_count":3,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-07T20:34:24.056Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/blurstudio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2019-07-11T21:43:36.000Z","updated_at":"2024-09-16T23:11:39.000Z","dependencies_parsed_at":"2024-06-17T22:53:57.153Z","dependency_job_id":"5f209620-d794-4fc9-827d-e37cf58d3b58","html_url":"https://github.com/blurstudio/casement","commit_stats":{"total_commits":18,"total_committers":2,"mean_commits":9.0,"dds":0.2222222222222222,"last_synced_commit":"812ecc4c4c26e06ad1c99d838582a92dfd2d3250"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blurstudio%2Fcasement","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blurstudio%2Fcasement/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blurstudio%2Fcasement/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blurstudio%2Fcasement/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/blurstudio","download_url":"https://codeload.github.com/blurstudio/casement/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248617848,"owners_count":21134197,"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":[],"created_at":"2024-11-26T00:20:12.524Z","updated_at":"2025-04-12T18:47:56.782Z","avatar_url":"https://github.com/blurstudio.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Casement\n\nA Python library that provides useful functionality for managing Microsoft Windows systems.\n\n## Features\n\n* App Model Id management for shortcuts and inside python applications to allow for taskbar grouping.\n* Finding, creating and moving shortcuts.\n* Pinning shortcuts to the taskbar and start menu.\n* Flashing a window to get a users attention.\n* Windows Registry reading and modification.\n* Windows environment variable interface via registry allowing for permanent modification.\n\n## Shortcut management\n\nA interface for manipulating Windows shortcut files including pinned.\n\nPinning shortcuts to the start menu and task bar in windows is extremely complicated.\nYou can find and edit shortcuts in the User Pinned directory for for all users, but\nadding, modifying or removing those shortcuts does not affect the pinned shortcuts.\nYou need to point to a copy of the pinned shortcut, and run windows verbs on that\nshortcut.\n\nHere is a example of pinning a shortcut to the start menu:\n```python\nfrom casement.shortcut import Shortcut\nwith Shortcut(r'C:\\Users\\Public\\Desktop\\My Shortcut.lnk') as sc:\n    sc.pin_to_start_menu()\n```\n### Command line interface\n\nThe features of this class can be used from the command line using ``casement shortcut\n[command] [arguments]``.\n\nTo find shortcuts in common places with a given name:\n```\n    C:\\blur\\dev\\casement\u003ecasement shortcut list \"VLC media player.lnk\"\n    c:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\VideoLAN\\VLC media player.lnk\n    c:\\Users\\Public\\Desktop\\VLC media player.lnk\n```\n\nPinning/unpinning a shortcut to the taskbar:\n```\n    C:\\blur\\dev\\casement\u003ecasement shortcut pin \"C:\\Users\\Public\\Desktop\\My Shortcut.lnk\" -t\n    C:\\blur\\dev\\casement\u003ecasement shortcut unpin \"C:\\Users\\Public\\Desktop\\My Shortcut.lnk\" -t\n```\n\n# Environment Variables\n\nAccess and modify environment variables stored in the registry using\n`casement.env_var.EnvVar`. This lets you access the raw un-expanded file registry\nvalues unlike what you see with os.environ. You can permanently modify the\nenvironment variables for the system.\n```python\nfrom casement.env_var import EnvVar\n\nuser_env = EnvVar(system=False)\nuser_env['VARIABLE_A'] = 'C:\\\\PROGRA~1'\nexpanded = user_env.normalize_path(user_env['VARIABLE_A'], tilde=False)\nassert expanded == 'C:\\\\Program Files'\nif 'VARIABLE_A' in user_env:\n    del user_env['VARIABLE_A']\n```\n\n# Windows Registry\n\nRead and modify registry keys with `casement.registry.RegKey`.\n```py\nfrom casement.registry import RegKey\n\nreg = RegKey('HKLM', 'Software\\\\Autodesk\\\\Maya')\nfor ver in reg.child_names():\n    # Attempt to access a specific sub-key that exists if ver is an version key\n    child = reg.child('{}\\\\Setup\\\\InstallPath'.format(ver))\n    if child.exists():\n        print(ver, child.entry('MAYA_INSTALL_LOCATION').value())\n```\n\nThere is a map of common registry locations like environment variables and classes.\n\n```python\nfrom casement.registry import RegKey, REG_LOCATIONS\n\n# Access to the user and system keys driving `HKEY_CLASSES_ROOT`\nclasses_system = RegKey(*REG_LOCATIONS['system']['classes'])\nclasses_user = RegKey(*REG_LOCATIONS['user']['classes'])\n\n# Access to the user and system key controlling persistent Environment Variables\nenv_var_system = RegKey(*REG_LOCATIONS['system']['env_var'])\nenv_var_user = RegKey(*REG_LOCATIONS['user']['env_var'])\n\n# Uninstall key for \"Add/Remove Programs\"\nuninstall_system = RegKey(*REG_LOCATIONS['system']['uninstall'])\n```\n\n# Installing\n\nCasement can be installed by the standard pip command `pip install casement`.\nThere is also an optional extras_require option `pip install casement[pil]` to\nallow creating shortcut icons by converting image files to .ico files.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblurstudio%2Fcasement","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblurstudio%2Fcasement","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblurstudio%2Fcasement/lists"}