{"id":15043845,"url":"https://github.com/pixtron/electron-traywindow-positioner","last_synced_at":"2025-04-23T18:08:47.935Z","repository":{"id":23923560,"uuid":"100139959","full_name":"pixtron/electron-traywindow-positioner","owner":"pixtron","description":"Positions a custom electron tray window ","archived":false,"fork":false,"pushed_at":"2024-08-07T08:34:45.000Z","size":329,"stargazers_count":28,"open_issues_count":0,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-23T18:08:42.230Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/pixtron.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2017-08-12T22:03:14.000Z","updated_at":"2025-03-08T10:33:53.000Z","dependencies_parsed_at":"2024-06-18T19:47:18.473Z","dependency_job_id":"b0c2d406-1426-45a0-8bf0-0270432fd9f3","html_url":"https://github.com/pixtron/electron-traywindow-positioner","commit_stats":{"total_commits":32,"total_committers":3,"mean_commits":"10.666666666666666","dds":0.09375,"last_synced_commit":"223d146fc7e38f0c2b0ef835bb6cbf6476e329a7"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pixtron%2Felectron-traywindow-positioner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pixtron%2Felectron-traywindow-positioner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pixtron%2Felectron-traywindow-positioner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pixtron%2Felectron-traywindow-positioner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pixtron","download_url":"https://codeload.github.com/pixtron/electron-traywindow-positioner/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250487528,"owners_count":21438612,"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-09-24T20:49:40.527Z","updated_at":"2025-04-23T18:08:47.916Z","avatar_url":"https://github.com/pixtron.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# electron-traywindow-positioner\n\nHelps to position a electron window as a custom tray menu window.\nOn Windows and OSX the tray bar location is calculated and the window is  \npositioned based on the tray bar location.\n\nOn linux the position is calculated based on the current cursor position, because `Tray.getBounds()`\nalways returns a `Rectangle` with all values set to zero.\n\n## Installation\n\n```\nnpm install --save electron-traywindow-positioner\n```\n\n## Usage\n\n```\nconst positioner = require('electron-traywindow-positioner');\n\npositioner.position(trayWindow, trayBounds);\n```\n\n* `trayWindow` must be an instance of a [`BrowserWindow`](https://github.com/electron/electron/blob/master/docs/api/browser-window.md#wingetbounds).\n* `trayBounds` must be an instance  of [`Rectangle`](https://github.com/electron/electron/blob/master/docs/api/structures/rectangle.md) returned from [`tray.getBounds()`](https://github.com/electron/electron/blob/master/docs/api/tray.md#traygetbounds-macos-windows)\n\n### Only calculate the postion without positioning the window\n\n```\nconst positioner = require('electron-traywindow-positioner');\n\npositioner.calculate(windowBounds, trayBounds);\n\n```\n\n* `windowBounds` must be an instance of [`Rectangle`](https://github.com/electron/electron/blob/master/docs/api/structures/rectangle.md) returned from [`BrowserWindow.getBounds()`]().\n* `trayBounds` must be an instance  of [`Rectangle`](https://github.com/electron/electron/blob/master/docs/api/structures/rectangle.md)  returned from [`tray.getBounds()`](https://github.com/electron/electron/blob/master/docs/api/tray.md#traygetbounds-macos-windows)\n\n\n\n### Custom alignment\n\n```\nconst alignment = {x: 'left', y: 'up'};\n\nconst positioner = require('electron-traywindow-positioner');\n\npositioner.position(trayWindow, trayBounds, alignment);\n\n// or\n\npositioner.calculate(windowBounds, trayBounds, alignment);\n```\n\n* `alignmet.x` alignment on x axis relative to tray icon when tray bar is top or bottom.\nThe value can be one of `left`, `center` or `right`, default is `center`.\n\n* `alignmet.y` alignment on y axis relative to tray icon when tray bar is left or right.\nThe value can be one of `up`, `center` or `down`, default is `down`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpixtron%2Felectron-traywindow-positioner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpixtron%2Felectron-traywindow-positioner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpixtron%2Felectron-traywindow-positioner/lists"}