{"id":30203804,"url":"https://github.com/ventto/mons","last_synced_at":"2025-08-13T12:06:33.316Z","repository":{"id":40321356,"uuid":"63877835","full_name":"Ventto/mons","owner":"Ventto","description":"POSIX Shell script to quickly manage monitors on X","archived":false,"fork":false,"pushed_at":"2024-03-16T11:20:14.000Z","size":146,"stargazers_count":643,"open_issues_count":29,"forks_count":37,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-04-13T01:32:49.688Z","etag":null,"topics":["arch-linux","display","laptop","linux","manage","monitor","posix","projector","screen","ubuntu","xrandr"],"latest_commit_sha":null,"homepage":"","language":"Shell","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/Ventto.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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":"2016-07-21T14:48:35.000Z","updated_at":"2025-03-31T22:20:13.000Z","dependencies_parsed_at":"2023-01-17T18:45:40.539Z","dependency_job_id":"26d1a7fc-8592-454c-9a0a-d61dda5db047","html_url":"https://github.com/Ventto/mons","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/Ventto/mons","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ventto%2Fmons","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ventto%2Fmons/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ventto%2Fmons/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ventto%2Fmons/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Ventto","download_url":"https://codeload.github.com/Ventto/mons/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ventto%2Fmons/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270236464,"owners_count":24550204,"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-13T02:00:09.904Z","response_time":66,"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":["arch-linux","display","laptop","linux","manage","monitor","posix","projector","screen","ubuntu","xrandr"],"created_at":"2025-08-13T12:06:28.019Z","updated_at":"2025-08-13T12:06:33.284Z","avatar_url":"https://github.com/Ventto.png","language":"Shell","funding_links":["https://paypal.me/tvenries"],"categories":[],"sub_categories":[],"readme":"Mons\n====\n\n[![License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)](https://github.com/Ventto/mons/blob/master/LICENSE)\n[![Language (XRandR)](https://img.shields.io/badge/powered_by-XRandR-brightgreen.svg)](https://www.x.org/archive/X11R7.5/doc/man/man1/xrandr.1.html)\n[![Vote for mons](https://img.shields.io/badge/AUR-Vote_for-yellow.svg)](https://aur.archlinux.org/packages/mons/)\n[![Donate](https://img.shields.io/badge/Donate-paypal-orange.svg)](https://paypal.me/tvenries)\n\n\n*\"Mons is a Shell script to quickly manage 2-monitors display using xrandr.\"*\n\n## Perks\n\n* [x] **No requirement**: POSIX-compliant (minimal: *xorg-xrandr*)\n* [x] **Useful**: Perfectly fit for laptops, quick and daily use\n* [x] **Well known**: Laptop mode, projector mode, duplicate, mirror and extend\n* [x] **More**:  Select one or two monitors over several others\n* [x] **Extra**: Cycle through every mode with only one shortcut\n* [x] **Auto**: Daemon mode to automatically reset display\n\n# Installation\n\n* Package (AUR)\n\n```\n$ pacaur -S mons\n```\n\n* Package (FreeBSD)\n\n```\n# pkg install mons\n```\n\n* Manual\n\n```bash\n$ git clone --recursive https://github.com/Ventto/mons.git\n$ cd mons\n$ sudo make install\n```\n\u003e Note: `--recursive` is needed for git submodule\n\n# Usage\n\n```\nWithout argument, it prints connected monitors list with their names and ids.\nOptions are exclusive and can be used in conjunction with extra options.\n\nInformation:\n  -h    Prints this help and exits.\n  -v    Prints version and exits.\n\nTwo monitors:\n  -o    Primary monitor only.\n  -s    Second monitor only.\n  -d    Duplicates the primary monitor.\n  -m    Mirrors the primary monitor.\n  -e \u003cside\u003e\n         Extends the primary monitor to the selected side\n         [ top | left | right | bottom ].\n  -n \u003cside\u003e\n         This mode selects the previous ones, one after another. The argument\n         sets the side for the extend mode.\n\nMore monitors:\n  -O \u003cmon\u003e\n        Only enables the monitor with a specified id.\n  -S \u003cmon1\u003e,\u003cmon2\u003e:\u003cpos\u003e\n        Only enables two monitors with specified ids. The specified position\n        places the second monitor on the right (R) or at the top (T).\n\nDaemon mode:\n  -a    Performs an automatic display if it detects only one monitor.\n  -x \u003cscript\u003e\n        Must be used in conjunction with the -a option. Every time the number\n        of connected monitors changes, mons calls the given script with the\n        MONS_NUMBER environment variable.\n\nExtra (in-conjunction or alone):\n  --dpi \u003cdpi\u003e\n        Set the DPI, a strictly positive value within the range [0 ; 27432].\n  --primary \u003cmon_name\u003e\n        Select a connected monitor as the primary output. Run the script\n        without argument to print monitors information, the names are in the\n        second column between ids and status. The primary monitor is marked\n        by an asterisk.\n```\n\n# Examples\n\n## Two monitors\n\nDisplays monitor list:\n\n```\n$ mons\n0: LVDS-1   (enabled)\n5: VGA-1\n```\n\nYou have an enabled one, you want to extends the second one on the right:\n\n```\n$ mons -e right\n```\n\nYou want to only display the second one:\n\n```\n$ mons -s\n```\n\nWith the `-n` option, go through every 2-mons mode consecutively:\n\n1. Primary monitor only\n1. Second monitor only\n1. Extend mode whose the side is set with `-n \u003cside\u003e`\n1. Mirror\n1. Duplicate\n\nThis mode is useful if you want to switch to every mode with only one shortcut.\n\n![alt 2-monitors modes](img/raw-body.png)\n\n```bash\n# Now in 'Second monitor mode'\n$ mons -n right # -\u003e 'Extend mode'\n# Now in 'Extend mode'\n$ mons -n right # -\u003e 'Mirror mode'\n```\n\n## Three monitors (selection mode)\n\n\nDisplays monitor list:\n\n```\n$ mons\nMonitors: 3\nMode: Selection\n0:* LVDS-1   (enabled)\n1: DP-1      (enabled)\n5: VGA-1\n```\n\nYou may need to display only the third one:\n\n```\n$ mons -O 5\n```\n\nYou may need to display the first and the third one on the right:\n\n```\n$ mons -S 0,5:R\n```\n\nLike above but you want to inverse the placement:\n\n```\n$ mons -S 5,0:R\n```\n\n## DPI value\n\nYou might want to switch mode and set the DPI value.\nUse the `--dpi \u003cdpi\u003e` option in conjunction with all others options.\n\n```\n$ mons [OPTIONS] --dpi \u003cdpi\u003e\n```\n\n## Primary monitor\n\nYou might choose one of your monitors as the main one.\nYou can use the `--primary \u003cmon_name\u003e` option alone or in conjunction with all\nothers options.\n`\u003cmon_name\u003e` refers to the monitor name that appears in the list of connected\nmonitors (ex: `LVDS-1` or `VGA-1`):\n\n```\n$ mons\nMonitors: 3\nMode: Primary\n0:* LVDS-1   (enabled)\n5:  VGA-1\n```\n\nThe `*` character means that the monitor is the primary one:\n\n```\n$ mons --primary VGA-1\nMonitors: 3\nMode: Primary\n0:  LVDS-1   (enabled)\n5:* VGA-1\n```\n\n## Daemon mode\n\nThis mode is useful for laptops. After unplugging all monitors except the last\none, *mons*'s \"daemon\" mode will reset the display and enable the latter.\n\nUse case: *\"I connect a monitor to my laptop and I only want to work with that\none, so I disable the native one. After a while, I will unplug the\nadditional monitor and I need reset my display to re-activate the native one.\"*\n\n* Run it as following:\n\n```bash\n$ nohup mons -a \u003e /dev/null 2\u003e\u00261 \u0026  (all shells)\n$ mons -a \u0026!                        (zsh)\n$ mons -a \u0026; disown                 (bash)\n```\n\n* You can handle N-monitors on your own by using the `-x` option. *mons* will\nexport the `${MONS_NUMBER}` environment variable and run the given Shell script\neverytime the number of connected monitors changes:\n\n```bash\n$ mons -a -x \"\u003cpath\u003e/generic-handler.sh\"\n\n# Use it as configuration profiles:\n$ mons -a -x \"\u003cpath\u003e/home-profile.sh\"\n$ mons -a -x \"\u003cpath\u003e/work-profile.sh\"\n```\n\n* Example of `script.sh`:\n\n```bash\n#!/bin/sh\n\ncase ${MONS_NUMBER} in\n    1)\n        mons -o\n        feh --no-fehbg --bg-fill \"${HOME}/wallpapers/a.jpg\"\n        ;;\n    2)\n        mons -e top\n        feh --no-fehbg --bg-fill \"${HOME}/wallpapers/a.jpg\" \\\n                       --bg-fill \"${HOME}/wallpapers/b.jpg\"\n        ;;\n    *)\n        # Handle it manually\n        ;;\nesac\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fventto%2Fmons","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fventto%2Fmons","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fventto%2Fmons/lists"}