{"id":28150661,"url":"https://github.com/liupold/pidswallow","last_synced_at":"2025-08-12T18:12:39.975Z","repository":{"id":119223424,"uuid":"273506528","full_name":"Liupold/pidswallow","owner":"Liupold","description":"A swallower script using process hierarchy.","archived":false,"fork":false,"pushed_at":"2020-08-18T03:43:10.000Z","size":188,"stargazers_count":42,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-09T00:45:50.388Z","etag":null,"topics":["bspwm","de","gnome","herbstluftwm","i3wm","kde","openbox","plasma","plasma5","process","pstree","swallowing","terminal","toggle","window","wm","wms","xdo","xdotoo","xdotool"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Liupold.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}},"created_at":"2020-06-19T13:57:00.000Z","updated_at":"2025-05-17T07:58:57.000Z","dependencies_parsed_at":"2024-01-22T00:02:41.662Z","dependency_job_id":null,"html_url":"https://github.com/Liupold/pidswallow","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/Liupold/pidswallow","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Liupold%2Fpidswallow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Liupold%2Fpidswallow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Liupold%2Fpidswallow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Liupold%2Fpidswallow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Liupold","download_url":"https://codeload.github.com/Liupold/pidswallow/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Liupold%2Fpidswallow/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270109923,"owners_count":24528933,"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","status":"online","status_checked_at":"2025-08-12T02:00:09.011Z","response_time":80,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["bspwm","de","gnome","herbstluftwm","i3wm","kde","openbox","plasma","plasma5","process","pstree","swallowing","terminal","toggle","window","wm","wms","xdo","xdotoo","xdotool"],"created_at":"2025-05-15T03:14:32.324Z","updated_at":"2025-08-12T18:12:39.917Z","avatar_url":"https://github.com/Liupold.png","language":"Shell","readme":"# A stupid simple swallower 😉.\n### (Based on Process hierarchy)\n\nSuper easy to config. Uses `xdo` WM/DE independent.\n\n[![PKGBUILD-STATUS](https://github.com/Liupold/pidswallow/workflows/PKBUILD/badge.svg)](https://github.com/Liupold/pidswallow/actions?query=workflow%3A%22PKBUILD%22)\n[![SHELLCHECK-STATUS](https://github.com/Liupold/pidswallow/workflows/shellcheck/badge.svg)](https://github.com/Liupold/pidswallow/actions?query=workflow%3A%22shellcheck%22)\n[![license](https://img.shields.io/github/license/liupold/pidswallow.svg)](https://github.com/liupold/pidswallow/blob/master/LICENSE)\n## Features\n* Based on process hierarchy (don't care about window focus).\n* cli like options. (super easy to use within scripts).\n* Window Managers and Desktop Environment Independent.\n\n```shell\npidswallow (pid swallow WM/DE independent)\nHides terminal window automatically, so that you don't have to\n\npidswallow [OPTION ...]\n\nOPTIONS:\n        -h  --help              Show this message\n        -s  --swallow \u003cCWID\u003e    Hides parent window of the given child window id.\n        -v  --vomit \u003cCWID\u003e      Unhides parent window of the given child window id.\n        -t  --toggle \u003cCWID\u003e     toggle between swallow and vomit. (default)\n        -g  --glue              treat if parent and child window are same. (recommended)\n        -l  --loop              listen and hide / unhide window on launch / remove.\n        -V  --verbose           Shows useful information.\n\nbugs/issues: https://github.com/liupold/pidswallow.\n```\n* POSIX compliant shell script.\n* Just pass in the window id of the swallower.\n* Work on a toggle mode. (swallow if not swallowed else vomit).\n* Super fast. (Really!) (28.0ms). (using `dash`).\n\n```sh\nBenchmark #1: pidswallow -s 0x02A00003\n  Time (mean ± σ):      28.0 ms ±   4.3 ms    [User: 13.8 ms, System: 18.0 ms]\n  Range (min … max):    24.1 ms …  48.0 ms    74 runs\n```\n\n## Demo\n\n[![Demo](https://yt-embed.herokuapp.com/embed?v=R6A_JHJ7ob8)](https://www.youtube.com/watch?v=R6A_JHJ7ob8 \"Demo for pidswallow.\")\n\n\n## How it works\n\n```shell\ntakes wid as as arg --\u003e gets process tree --\u003e check blacklist --\u003e hide parent.\n```\n## Dependencies\n1) xdo\n2) xprop (`--loop` and `--glue`).\n3) xev (`--glue`).\n4) xdotool (cross-workspace `--glue`, optional).\n\n## Installation\n\n### Using AUR\n* stable release. (Currently on 2.0)\n\n```bash\nyay -S pidswallow\n```\n\n* dev (git)\n```bash\nyay -S pidswallow-dev-git\n```\n### Manual\n Add `pidswallow` to your path.\n\n### Autostart\n1) Launch when WM/DE starts (Example: .xinitrc, i3-config, bspwrc)\n\n```bash\npgrep -fl 'pidswallow -gl' || pidswallow -gl\n```\n\n2) Add the following to your `bashrc`, `zshrc` or shell init script. This step isn't strictly necessary, but it fixes problems with daemon-based terminals and also improves the performance of pidswallow.\n**Note:** You might want to skip this step if you use Alacritty (see [Known Issues](#known-issues)).\n**Note:** Your window manager has to focus new terminals as soon as they are spawned for this to work correctly.\n\n```\n[ -n \"$DISPLAY\" ]  \u0026\u0026 command -v xdo \u003e/dev/null 2\u003e\u00261 \u0026\u0026 xdo id \u003e /tmp/term-wid-\"$$\"\ntrap \"( rm -f /tmp/term-wid-\"$$\" )\" EXIT HUP\n```\n\n3) Restart wm and terminals.\n\n## Additional Configuration\nEnvironment variables can be exported to change the behavior of pidswallow.\n\nThe following ones accept lists of space separated process names.\n* `PIDSWALLOW_SHELL`: your shell(s) (e.g `bash`). Default: Taken from `$SHELL`\n* `PIDSWALLOW_TERMINAL`: your terminal(s), as fallback if shell is not used (and if terminal supports it). Default: `$TERMINAL`\n* `PIDSWALLOW_BLACKLIST`: parent cannot be swallowed, (if you launch one term from another you might want to add it to blacklist). Default: same as `$PIDSWALLOW_TERMINAL`\n* `PIDSWALLOW_GLUE_BLACKLIST`: not touched by `--glue`. Default: empty\n\nThe ones following are executed in a subshell (`/bin/sh`) and support the special strings `$pwid` and `$cwid`, holding the parent and child window IDs, respectively.\n* `PIDSWALLOW_SWALLOW_COMMAND`: used to swallow (hide) windows. Default: `xdo hide $pwid`\n* `PIDSWALLOW_VOMIT_COMMAND`: used to vomit (unhide) windows. Default: `xdo show $pwid`\n* `PIDSWALLOW_PREGLUE_HOOK`: executed before swallowing new child window when using `--glue`. Useful for floating windows in tiled WMs. Default: empty\n\n## Tested on\n*(If you did please let me know, If it dosent work create a issue).*\n\n* [bspwm](https://github.com/baskerville/bspwm)\n* [i3](https://i3wm.org/)\n* [gnome](https://www.gnome.org/gnome-3/)\n* [openbox](http://openbox.org/wiki/Main_Page)\n* [plasma](https://kde.org/announcements/plasma5.0/)\n* [Xfce](https://www.xfce.org/)\n* [herbstluftwm](https://herbstluftwm.org/) (by [cbf305](https://github.com/cbf305))\n\n## Known Issues\n* \u003cb\u003esxiv\u003c/b\u003e doesn't support this (as of now). https://github.com/muennich/sxiv/issues/398\n    - Solution: https://github.com/elkowar/sxiv/tree/set_net_wm_pid (use this).\n* mpv (window incorrect size)\n    - Solution: use `--no-keepaspect-window` flag when launching.\n* Alacritty won't work with the shell based approach if your shell init script is sourced too quickly. See [this](https://github.com/alacritty/alacritty/issues/2817) issue.\n    - Solution: fall back to terminal based approach, by skipping [Autostart step 2](#autostart)\n\n## Tricks\n### Manual swallow (toggle)\n\n1) Add `pidswallow` to your path.\n2) run this and click on the child window (not the term) to swallow.\n```\n xwininfo | awk '/Window id:/{print $4}' | pidswallow -gt\n```\n3) or pass the window-id via keyboard shortcut. (Eg: sxhkd toggle).\n\n```\nsuper + v\n    xdo id | pidswallow -gt\n```\n\n### Launch a program from term wihout being swallowed.\n```\nsetsid -f \u003ccommand\u003e  # this will not swallow the terminal.\n```\n\n## WM specific recommendations.\n### bspwm\nAdd each set of lines to your `bspwmrc`, right before running pidswallow.\n* Let bspwm handle window hiding.\n\n```bash\nexport PIDSWALLOW_SWALLOW_COMMAND='bspc node $pwid --flag hidden=on'\nexport PIDSWALLOW_VOMIT_COMMAND='bspc node $pwid --flag hidden=off'\n```\nThis way bspwm will remember window positions and won't lose track of swallowed windows.\n\n* Follow `floating` state of parent (when using `--glue`).\n\n```bash\nexport PIDSWALLOW_PREGLUE_HOOK='bspc query -N -n $pwid.floating \u003e/dev/null \u0026\u0026 bspc node $cwid --state floating'\n```\nCheck if parent window state is `floating` and apply the same to the child if that's the case.\nThis example should work in most cases, but feel free to add more complex hooks to your setup. (e.g. to mimic more properties of the parent).\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliupold%2Fpidswallow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fliupold%2Fpidswallow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliupold%2Fpidswallow/lists"}