{"id":13578269,"url":"https://github.com/skx/kpie","last_synced_at":"2025-12-16T19:28:17.572Z","repository":{"id":18827548,"uuid":"22042826","full_name":"skx/kpie","owner":"skx","description":"Simple devilspie-like program for window manipulation, with Lua.","archived":true,"fork":false,"pushed_at":"2020-12-21T06:32:59.000Z","size":125,"stargazers_count":79,"open_issues_count":2,"forks_count":13,"subscribers_count":12,"default_branch":"master","last_synced_at":"2024-11-05T15:49:48.445Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/skx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"skx","custom":"https://steve.fi/donate/"}},"created_at":"2014-07-20T20:36:06.000Z","updated_at":"2024-05-21T11:29:25.000Z","dependencies_parsed_at":"2022-08-05T02:01:55.202Z","dependency_job_id":null,"html_url":"https://github.com/skx/kpie","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skx%2Fkpie","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skx%2Fkpie/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skx%2Fkpie/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skx%2Fkpie/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/skx","download_url":"https://codeload.github.com/skx/kpie/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247366516,"owners_count":20927527,"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-08-01T15:01:28.951Z","updated_at":"2025-12-16T19:28:12.513Z","avatar_url":"https://github.com/skx.png","language":"C","funding_links":["https://github.com/sponsors/skx","https://steve.fi/donate/"],"categories":["C","资源","Resources"],"sub_categories":["Scriptable by Lua"],"readme":"KPie\n----\n\nKPie is a simple window manipulation tool, modeled after devil's pie, with a Lua-based configuration file.\n\nUsage is:\n\n     kpie [options] [lua-config-file.lua]\n\nOptions are currently limited to:\n\n    --config   - Explicitly specify a configuration file.\n    --debug    - Show debugging information.\n    --single   - Process each window once, then exit.\n    --version  - Show the version number.\n\n\n**NOTE**: This application is essentially obsolete as of 2020, as GNU/Linux desktops are running Wayland instead of X.org.\n\n\nOverview\n--------\n\nA single Lua configuration file will be parsed and executed for every window on your system, including invisible windows, and windows in different workspaces/virtual-desktops.\n\nUnless you're running `kpie --single` then the configuration file will be invoked for each window that is opened in the future, until you terminate `kpie`.\n\nBy default `kpie` looks for `~/.kpie.lua`, but you may choose another file when you start `kpie` via:\n\n    $ kpie ~/.config/kpie.lua\n\nAs noted the configuration file is Lua with the addition of some window-related primitives.  To give you a flavour this is a sample configuration file:\n\n    --\n    -- If Xine is launched it should be \"always on top\"\n    --\n    if ( window_class() == \"xine\" ) then\n        above()\n    end\n\n    --\n    -- The xlogo program is so cool it should be visible on all\n    -- workspaces\n    --\n    if ( window_title() == \"xlogo\" ) then\n        pin()\n    end\n\nThe [kpie.lua](kpie.lua) sample configuration file contains this code,\nas well as some more examples of Lua scripting.  You can find more\nspecialized example configuration files included in the `samples/` directory.\n\nThe key thing to understand is that the **same** configuration file will be invoked for **every** window on your system, on the basis that you'll limit your actions to specific windows via the matching options.\n\nFor example if you had a configuration file which read merely \"`maximize()`\" your desktop would become very odd, as **all** the windows would be maximized, including your panel(s).\n\n\n\nConfiguration Generator\n-----------------------\n\nIncluded within the repository is a sample configuration file `samples/dump.lua` which is designed to be a helpful starting point if you wish to script the manipulation of your windows.\n\nSimply run:\n\n    $ ./kpie ./samples/dump.lua\n\nThis will output chunks of config which you can edit or save:\n\n    -- Screen width : 1920\n    -- Screen height: 1080\n    if ( ( window_title() == \"feeds\" ) and\n         ( window_class() == \"Pidgin\" ) ) then\n            xy(0,0)\n            size(1438,1023 )\n            workspace(2)\n    end\n    if ( ( window_title() == \"Buddy List\" ) and\n         ( window_class() == \"Pidgin\" ) ) then\n         xy(1438,0 )\n         size(482,1023 )\n         workspace(2)\n    end\n\nAs you can see this has iterated over all existing windows, and shown you their current state - this is perfect if you wish to reproduce a complex layout interactively.\n\n\n\nInstallation\n------------\n\nYou can install binary packages for Debian GNU/Linux from the authors repository:\n\n* http://packages.steve.org.uk/kpie/\n   * The package will also add an entry to your system-menu at \"`System Tools | Preferences | Startup Applications`\"\n\nIf you prefer to build from source you can do so providing you have the dependencies installed.  Beyond the necessities, a compiler and `make`, you'll need:\n\n* `libglib2.0-dev`\n* `libgtk2.0-dev`\n* `liblua5.1-0-dev`\n* `libwnck-dev`\n* `libx11-dev`\n* `x11proto-core-dev`\n\nUpon a Debian GNU/Linux system these may be installed via:\n\n      sudo apt-get install libglib2.0-dev libgtk2.0-dev libwnck-dev libx11-dev liblua5.1-0-dev x11proto-core-dev\n\nWith the dependencies in-place you should be able to compile the binary by\nrunning:\n\n     ./configure\n     make\n\nIf you're building from a git checkout, rather than a named release, you'll need to run this instead:\n\n     autoreconf --install\n     ./configure\n     make\n\n\nPrimitives\n----------\n\nThe following primitives are available:\n\n* Information\n    * `window_title` - Get the title of the new window.\n    * `window_type` - Get the type of the window.\n        * `\"WINDOW_NORMAL\"`, `\"WINDOW_TOOLBAR\"`, etc.\n    * `window_application` - Get the application which created the window.\n    * `window_class` - Get the class of the new window.\n    * `window_id` - Get the ID of the new window.\n        * This may be empty.\n    * `window_xid` - Get the XID of the new window.\n        * This may be empty.\n    * `window_pid` - Get the PID of the new window.\n        * This may be zero on error.\n    * `window_role` - Get the role of the new window, via `WM_WINDOW_ROLE`.\n        * This may return an empty string.\n    * `screen_height` - Get the size of the screen.\n    * `screen_width` - Get the size of the screen.\n* Depth\n    * `activate` - Make the window appear in the foreground and give focus.\n    * `above` - Make the window \"always on top\".\n    * `below` - Remove the \"always on top\" flag.\n    * `bottom` - Make the window \"always below\".\n    * `unbottom` - Remove the \"always below\" flag.\n* Max/Min\n    * `maximize` - Maximize the window.\n    * `maximize_horizontally` - Maximize horizontally.\n    * `maximize_vertically` - Maximize vertically.\n    * `fullscreen` - Make the window \"fullscreen\".\n    * `focus` - Focus the window.\n    * `is_focussed` - Is the window focussed?\n    * `is_maximized` - Is the window maximized?\n    * `is_fullscreen` - Is the window fullscreen?\n* Workspace\n    * `pin` - Pin on all workspaces.\n    * `unpin` - Don't pin on all workspaces.\n* Movement\n    * `xy` - Get/Set the X/Y coordinates of a window.\n    * `size` - Get/Set the width/height of a window.\n* Workspaces\n    * `activate_workspace` - Change to the given workspace/virtual-desktop.\n    * `workspace` - Get/set the workspace the window is active on.\n       * The return value may be -1 if the window is pinned, or invisible.\n    * `workspaces` - Get/set the number of workspaces/virtual-desktops.\n* Misc\n    * `decoration` - Set/Unset the decorations for the window.\n    * `exists` - Does the given file/directory exist?\n       * See [samples/includes.lua](samples/includes.lua)\n    * `kill` - Close the window, forcibly.\n    * `pointer` - Get/Set the position of the mouse pointer.\n    * `readdir` - Read the contents of a directory.\n       * See [samples/includes.lua](samples/includes.lua)\n* Variables\n    * `DEBUG` will be declared as a boolean false value, unless you launch `kpie` with the `--debug` flag.\n       * This can be used to control whether you output debugging information.\n    * `CONFIG` will be defined as the path to the configuration file loaded.\n    * `VERSION` will be an integer containing the `kpie` release.\n\nSome of these primitives are [documented in the sample-scripts](samples/).\n\nSteve\n--\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskx%2Fkpie","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fskx%2Fkpie","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskx%2Fkpie/lists"}