{"id":21483348,"url":"https://github.com/cybershadow/hax11","last_synced_at":"2025-10-06T22:59:41.740Z","repository":{"id":46586365,"uuid":"50388460","full_name":"CyberShadow/hax11","owner":"CyberShadow","description":"Hackbrary to Hook and Augment X11 protocol calls","archived":false,"fork":false,"pushed_at":"2025-04-29T08:16:48.000Z","size":253,"stargazers_count":127,"open_issues_count":1,"forks_count":10,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-10-06T00:42:26.362Z","etag":null,"topics":["ld-preload","x11"],"latest_commit_sha":null,"homepage":"","language":"C","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/CyberShadow.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,"zenodo":null}},"created_at":"2016-01-25T23:27:13.000Z","updated_at":"2025-10-05T10:34:48.000Z","dependencies_parsed_at":"2025-04-12T21:28:25.154Z","dependency_job_id":"cdf1e3d8-97d6-4c6b-b5bb-0b0a2f29cbe5","html_url":"https://github.com/CyberShadow/hax11","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/CyberShadow/hax11","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CyberShadow%2Fhax11","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CyberShadow%2Fhax11/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CyberShadow%2Fhax11/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CyberShadow%2Fhax11/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CyberShadow","download_url":"https://codeload.github.com/CyberShadow/hax11/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CyberShadow%2Fhax11/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278692924,"owners_count":26029405,"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-10-06T02:00:05.630Z","response_time":65,"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":["ld-preload","x11"],"created_at":"2024-11-23T12:46:33.439Z","updated_at":"2025-10-06T22:59:41.691Z","avatar_url":"https://github.com/CyberShadow.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hax11\n\nHackbrary to **H**ook and **A**ugment **X11** protocol calls.\n\nAllows customizing the behavior of and fix common annoyances of X11 applications:\n\n- exclusively grabbing the mouse or keyboard\n- forcibly pausing the game when the window loses focus\n- forcibly changing the screen resolution\n- not restricting the mouse cursor to its window/monitor\n\nAdditionally, attempts to fix game and full-screen application issues on Linux, such as:\n\n- starting on the wrong monitor\n- spanning too many monitors\n- spanning one half of a tiled (MST) monitor (such as some 4K/5K/8K monitors)\n- refusing to allow selecting a desired resolution\n\nSee the [configuration](#configuration) section for more details.\n\n## Building\n\nBuild the library:\n```bash\n$ make\n```\n\nThe Makefile assumes you have a 64-bit system. You will need gcc-multilib to build the 32-bit version.\n\n## Usage\n\nTo try this library, build this library as above, then in the same directory, run the following in a shell:\n\n```bash\n$ export LD_PRELOAD=`pwd`/\\$LIB/hax11.so\n```\n\nThen, from the same shell session, start the desired game or application.\n\nTo temporarily disable hax11, unset `LD_PRELOAD` before running a program, e.g.:\n```bash\n$ LD_PRELOAD= xrandr\n```\n\n## Configuration\n\nBy default, this library will not do anything.\n\nFor every application using the affected API, it will create an empty configuration file\nunder `$HOME/.config/hax11/profiles/`. Each file corresponds to one program, and will be named\nafter the program executable's absolute path, but with forward slashes `/` substituted with backslashes `\\`.\n\nAdditionally, a `default` configuration file (in the same directory as above) will be loaded before the program's.\n\nThe syntax is one `Name=Value` pair per line.\n\nSupported configuration options:\n\nName                  | Values  | Description\n--------------------- | ------- | ---------------------------------\n`Enable`              | `0`/`1` | Boolean - Intercept the X11 connection (required for any other settings to have any effect)\n`JoinMST`             | `0`/`1` | Boolean - For monitors which present each half as one MST panel, join them and present them as one monitor to the application\n`MaskOtherMonitors`   | `0`/`1` | Boolean - Whether to hide the presence of other monitors from the application\n`ResizeWindows`       | `0`/`1` | Boolean - Whether to forcibly change the size of windows whose width is equal to `DesktopW`\n`ResizeAll`           | `0`/`1` | Boolean - Resize (stretch) all windows, not just those matching the size of one MST panel\n`MoveWindows`         | `0`/`1` | Boolean - Whether to forcibly move windows created at (0,0) to the primary monitor\n`Fork`                | `0`/`1` | Boolean - Move processing to a separate forked process.\n`FilterFocus`         | `0`/`1` | Boolean - Filter out `FocusOut` events, making games think they always have focus.\n`NoMouseGrab`         | `0`/`1` | Boolean - Filter out `GrabPointer` requests, preventing games from exclusively grabbing the mouse pointer.\n`NoKeyboardGrab`      | `0`/`1` | Boolean - Filter out `GrabKeyboard` requests, preventing games from exclusively grabbing the keyboard, and thus disabling global hotkeys.\n`ConfineMouse`        | `0`/`1` | Boolean - Confine the mouse to the program's window while it is focused. Focus must then be changed with the keyboard.\n`NoPrimarySelection`  | `0`/`1` | Boolean - Disable getting (pasting) or setting (copying) the `PRIMARY` X selection (usually done by middle clicks).\n`NoResolutionChange`  | `0`/`1` | Boolean - Disable setting screen resolution.\n`NoMinSize`           | `0`/`1` | Boolean - Disable minimum window size restriction.\n`NoMaxSize`           | `0`/`1` | Boolean - Disable maximum window size restriction.\n`NoWindowStackMove`   | `0`/`1` | Boolean - Disable moving windows through the window stack. Prevents moving windows to the top or bottom.\n`NoWMRaise`           | `0`/`1` | Boolean - Filter out `_NET_ACTIVE_WINDOW` requests, prevents asking the window manager to raise windows to the top. \n`FakeScreenW`/`H`     | Integer | Fake the reported resolution of all X11 screens to the application on X11 handshake. Active when non zero\n`FakeScreenDimW`/`H`  | Integer | Fake the reported dimensions in millimeters of all X11 screens to the application on X11 handshake. Active when non zero\n`MainX`/`Y`           | Integer | The X11 coordinates of your primary monitor (or left-top-most monitor to be used for games)\n`MainW`/`H`           | Integer | The resolution of your primary monitor (or total resolution of monitors to be used for games)\n`DesktopW`/`H`        | Integer | The resolution of your desktop (all monitors combined)\n`Debug`               | Integer | Log level - Non-zero enables debugging output to stderr and `/tmp/hax11.log`\n`LogTimestamp`        | `0`/`1` | Boolean - Enable timestamp logging\n`MSTnX`/`Y`/`W`/`H`   | Integer | Coordinates and sizes of additional MST monitors (`n` can be `2`, `3` or `4`).\n`MapK`/`B`*integer*   | Key     | Map keys or buttons - see below\n\nBeware that your window manager and shell use the same APIs,\nthus having other options enabled for such programs may make other monitors unusable.\n\nA sensible configuration is to have `JoinMST=1` and the `Main*` / `Desktop*` settings in the `default` profile,\nand per-game settings in their executables' profiles.\n\n### Example\n\nHere is an example configuration for a two-monitor system.\nOn the left is a 1920x1200 monitor; on the right, a 4K monitor which presents itself as two 1920x2160 panels.\nThe goal is to have games running full-screen on the 4K monitor.\n\nIn `~/.config/hax11/profiles/default`:\n\n```\nJoinMST=1\n\n# Top-left coordinate of your main (4K) screen\nMainX=1920\nMainY=0\n\n# Width and height of the 4K screen\nMainW=3840\nMainH=2160\n```\n\nThen, in `~/.config/hax11/profiles/path\\to\\game\\binary`:\n\n```\nEnable=1\n\n# If this is insufficient, you can also try:\n# ResizeWindows=1\n# MoveWindows=1\n# ResizeAll=1\n# Check the status section for example configurations for some games.\n```\n\n### Key / button mapping\n\nYou can map a key or mouse button to one or more keys / mouse buttons using configuration lines in the form `Map` ( `K` | `B` ) *integer* `=` ( `K` | `B` ) *integer*.\nThe integer is the key or button code, and can be found using e.g. the `xev` utility.\nDefining the same key or button on the left side of `=` allows mapping it to multiple keys / buttons.\nThe original key / button event is suppressed. To include it, map the key / button to itself.\n\nExample - reverse the Left and Right arrow keys:\n```\nMapK113=K114\nMapK114=K113\n```\n\nExample - making the left mouse button click also generate an F4 key press (in addition to sending itself):\n```\nMapB1=B1\nMapB1=K70\n```\n\n## Installation\n\nYou can install this library system-wide, so that it is loaded into all applications on start-up.\n\n**Warning**! This project may or may not be compatible with your system. Installing this library system-wide *may* put your system into an unusable state.\nBefore installation, make sure you're capable of uninstalling this library if X, your desktop environment, etc. refuses to start.\n\nThis will install the libraries under `/usr/local/lib{32,64}`, and a script under `/etc/profile.d`:\n```bash\n$ make install\n```\n\nLog out and back in (or reboot) to apply the hack to all applications.\n\n## Status\n\nThe following table represents the results of testing this library on the author's machine, consisting of a 1920x1200 monitor at (0,0),\nand a 4K monitor in MST mode (thus presenting itself as two 1920x2160 panels) at (1920,0). The 4K monitor is the primary one.\n\nThe desired result (and solution listed to achieve said result) is to launch the game in full-screen on the 4K monitor,\nat 4K resolution if the game supports it.\n\n\u003cdetails\u003e\n\nGame                            | Status\n------------------------------- | -----------------------------------------------\n10,000,000                      | Works (`MoveWindows` + `ResizeWindows`)\n140                             | Works (Unity - `MoveWindows`)\n3089                            | Java. Resolution selector is completely broken, throws NullPointerException\nAdventures of Shuggy            | Works (not needed)\nAnd Yet It Moves                | Works (`MoveWindows` + `ResizeWindows`, then set `\u003cResolution\u003e`...`\u003c/Resolution\u003e` in `~/.Broken Rules/And Yet It Moves/common/commonConfig.xml`)\nAnodyne                         | Adobe Air version doesn't start (exits with code 5); standalone (.swf) version can't get past the calibration screen\nAntichamber                     | Works (not needed)\nAquaria (Steam)                 | Works (`ResizeWindows`, then set `resx` and `resy` in `~/.Aquaria/preferences/usersettings.xml`)\nAquaria (tarball)               | Works (as above)\nAvadon: The Black Fortress      | Works (`MoveWindows` + `ResizeWindows`)\nBad Hotel                       | Works (`ResizeWindows` + `ResizeAll`)\nThe Binding of Isaac: Rebirth   | Works (not needed)\nBIT.TRIP RUNNER                 | Does not actually have a Linux port on Steam\nBlueberry Garden                | Works (`ResizeWindows`)\nBridge Constructor Playground   | Works (Unity - `MoveWindows`)\nCard City Nights                | Works (Unity - `MoveWindows`)\nCrimsonland                     | Works (`ResizeWindows`, then change the resolution)\nDarwinia                        | Works (`MoveWindows` + `ResizeWindows`, change the resolution to fix AR)\nDEFCON                          | Works (`MoveWindows` + `ResizeWindows`, then change the resolution)\nDota 2                          | Works (`ResizeWindows` + \"Use my monitor's current resolution\")\nDungeons of Dredmor             | Works (`MoveWindows` + `ResizeWindows`, set resolution in the launcher)\nDust: An Elysian Tail           | Works (`ResizeWindows`, then change the resolution)\nDynamite Jack                   | Works (`MoveWindows` + `ResizeWindows`, then change the resolution)\nEscape Goat                     | Works (`ResizeWindows` + `ResizeAll`)\nEversion                        | Works (not needed)\nFaerie Solitaire [Beta]         | Works (`ResizeWindows`)\nGarry's Mod                     | Works (Source - `ResizeWindows`, then change the resolution)\nGigantic Army                   | Works (not needed)\nGone Home                       | Doesn't start at all on my machine\nGuacamelee! Gold Edition        | Works (`ResizeWindows`, then change the resolution)\nHalf-Life 2: Deathmatch         | Works (Source - `ResizeWindows`, then change the resolution)\nHeavy Bullets                   | Works (not needed)\nHexcells                        | Works (Unity - `MoveWindows`)\nHyperRogue                      | Works (`MoveWindows` + `ResizeWindows`, then set the resolution on the first line of `~/.hyperrogue.ini`)\nIntrusion 2                     | Works (not needed)\nJazzpunk                        | Works (`MoveWindows`)\nLugaru HD                       | Works (`ResizeWindows`, then set the resolution in `~/.lugaru/Data/config.txt`)\nLume                            | Works (`ResizeWindows`, then `Ctrl+F` to exit full screen, drag to correct monitor, `Ctrl+F` to enter full screen)\nThe Magic Circle                | Works (`MoveWindows`)\nMultiwinia                      | Crashes after the splash screen on my machine\nOsmos                           | Works (not needed)\nOutlast                         | Works (`ResizeWindows`, then change the resolution)\nPapers, Please                  | Works (not needed)\nPerfection.                     | TODO - Queries resolution via proprietary NVIDIA protocol extension\nPsychonauts                     | Works (`MoveWindows` + `ResizeWindows`, then set the resolution on the first line of `$XDG_DATA_HOME/Psychonauts/DisplaySettings.ini`)\nQuest of Dungeons               | Works (`ResizeWindows`)\nRisk of Rain                    | Works (not needed)\nSatazius                        | Works (not needed)\nShatter                         | Works (`ResizeWindows`)\nSigils of Elohim                | Doesn't seem to have a full-screen mode. Works otherwise\nSnuggle Truck                   | Works (Unity - `MoveWindows`)\nSoul Axiom                      | Works (Unity - `MoveWindows`)\nStarbound                       | Works (`MoveWindows` + `ResizeWindows`)\nSunless Sea                     | Works (`MoveWindows` + `ResizeWindows` + `ResizeAll`, then set the resolution to 1920x1080)\nSuper Hexagon                   | Works (`MoveWindows` + `ResizeWindows`)\nSuperfrog HD                    | TODO - Wrong scaling\nTeleglitch: DME                 | Works (not needed)\nTerraria                        | Works (not needed)\nTeslagrad                       | Works (Unity - `MoveWindows`)\nThey Bleed Pixels               | Works (`ResizeWindows`)\nTiki Man                        | Works (Unity - `MoveWindows`)\nTIS-100                         | Works (`MoveWindows`)\nUplink                          | Works (`MoveWindows` + `ResizeWindows` + `ResizeAll`)\nVoxatron                        | Works (`ResizeWindows`), though the KDE panel remains on top for some reason.\nVVVVVV                          | Works (not needed)\nWorld of Goo                    | Works (`MoveWindows` + `ResizeWindows`, then copy `.../World of Goo/properties/config.txt` to `~/.WorldOfGoo/config.txt` and set `screen_width`/`screen_height`)\n\n\u003c/details\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcybershadow%2Fhax11","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcybershadow%2Fhax11","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcybershadow%2Fhax11/lists"}