{"id":13638376,"url":"https://github.com/jnoortheen/xontrib-cmd-durations","last_synced_at":"2025-03-16T14:31:23.231Z","repository":{"id":43423384,"uuid":"307041703","full_name":"jnoortheen/xontrib-cmd-durations","owner":"jnoortheen","description":"Show long running commands durations in prompt with option to send notification when terminal is not focused.","archived":false,"fork":false,"pushed_at":"2024-05-17T16:03:03.000Z","size":813,"stargazers_count":17,"open_issues_count":2,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-12T05:46:14.887Z","etag":null,"topics":["bgnotify","done","xonsh","xontrib"],"latest_commit_sha":null,"homepage":"","language":"Python","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/jnoortheen.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":"2020-10-25T06:54:43.000Z","updated_at":"2025-01-04T15:14:01.000Z","dependencies_parsed_at":"2024-01-29T10:09:23.040Z","dependency_job_id":"5bcaf26c-015c-46bb-98e7-db457d29bd4d","html_url":"https://github.com/jnoortheen/xontrib-cmd-durations","commit_stats":{"total_commits":47,"total_committers":3,"mean_commits":"15.666666666666666","dds":0.276595744680851,"last_synced_commit":"69cca33a91afeeeee837699aa6ec95018b2a913b"},"previous_names":["jnoortheen/xontrib-cmd-done"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jnoortheen%2Fxontrib-cmd-durations","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jnoortheen%2Fxontrib-cmd-durations/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jnoortheen%2Fxontrib-cmd-durations/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jnoortheen%2Fxontrib-cmd-durations/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jnoortheen","download_url":"https://codeload.github.com/jnoortheen/xontrib-cmd-durations/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243819044,"owners_count":20352807,"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":["bgnotify","done","xonsh","xontrib"],"created_at":"2024-08-02T01:00:44.872Z","updated_at":"2025-03-16T14:31:22.402Z","avatar_url":"https://github.com/jnoortheen.png","language":"Python","funding_links":[],"categories":["Plugins"],"sub_categories":["Prompt tweaks"],"readme":"## Overview\n\n\u003cp align=\"center\"\u003e\nSend notification once long-running command is finished and also show the execution time.\n\u003c/p\u003e\n\n## Installation\n\nTo install use pip:\n\n``` bash\nxpip install xontrib-cmd-durations\n# or: xpip install -U git+https://github.com/jnoortheen/xontrib-cmd-durations\n```\n\n## Usage\n\nAdd the `long_cmd_duration` section to the [prompt fields](https://xon.sh/tutorial.html#customizing-the-prompt) and load the xontrib i.e.:\n\n``` bash\n$RIGHT_PROMPT = '{long_cmd_duration:⌛{}}{user:{{BOLD_RED}}🤖{}}{hostname:{{BOLD_#FA8072}}🖥{}}'\n$XONTRIB_CD_LONG_DURATION = 5  # default\nxontrib load cmd_done\n```\n\nIf the command is taking more than `$XONTRIB_CD_LONG_DURATION` seconds then `long_cmd_duration` returns the duration in human readable way:\n\n![](./images/2020-10-26-10-59-38.png)\n\nThe desktop notification is sent if the terminal is not focused:\n\n![](./images/2020-11-02-13-38-47.png)\n\nCurrently the focusing part requires `xdotool` to be installed.\n\n## Known issues\n\n### Notifications in Windows\nOn windows the notification will get triggered all the time. \n`Finding whether the terminal is focused` is not implemented for Windows yet and PRs are very welcome on that.\nSet `$XONTRIB_CD_TRIGGER_NOTIFICATION = False` to completely off the notification part.\n\n### Notifications in MacOS\n\nIf you want to change the app name in notification in MacOS you can use `$XONTRIB_CD_NOTIFICATION_APP_NAME` environment variable with [automatically replaced keywords](https://xon.sh/tutorial.html#customizing-the-prompt):\n```xsh\n$XONTRIB_CD_NOTIFICATION_APP_NAME = '{user}@{hostname}:{cwd}'\n$RIGHT_PROMPT = '{long_cmd_duration}'\nxontrib load cmd_done\n\nsleep 6\n# Switch to another window\n```\nResult:\n\n![](./images/notification-mac.png)\n\n\n## Credits\n\nThis package was created with [xontrib cookiecutter template](https://github.com/jnoortheen/xontrib-cookiecutter).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjnoortheen%2Fxontrib-cmd-durations","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjnoortheen%2Fxontrib-cmd-durations","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjnoortheen%2Fxontrib-cmd-durations/lists"}