• This repository has been archived on 21/Dec/2020
  • Stars
    star
    77
  • Rank 401,317 (Top 9 %)
  • Language
    C
  • License
    GNU General Publi...
  • Created almost 10 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Simple devilspie-like program for window manipulation, with Lua.

KPie

KPie is a simple window manipulation tool, modeled after devil's pie, with a Lua-based configuration file.

Usage is:

 kpie [options] [lua-config-file.lua]

Options are currently limited to:

--config   - Explicitly specify a configuration file.
--debug    - Show debugging information.
--single   - Process each window once, then exit.
--version  - Show the version number.

NOTE: This application is essentially obsolete as of 2020, as GNU/Linux desktops are running Wayland instead of X.org.

Overview

A 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.

Unless 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.

By default kpie looks for ~/.kpie.lua, but you may choose another file when you start kpie via:

$ kpie ~/.config/kpie.lua

As 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:

--
-- If Xine is launched it should be "always on top"
--
if ( window_class() == "xine" ) then
    above()
end

--
-- The xlogo program is so cool it should be visible on all
-- workspaces
--
if ( window_title() == "xlogo" ) then
    pin()
end

The kpie.lua sample configuration file contains this code, as well as some more examples of Lua scripting. You can find more specialized example configuration files included in the samples/ directory.

The 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.

For 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).

Configuration Generator

Included 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.

Simply run:

$ ./kpie ./samples/dump.lua

This will output chunks of config which you can edit or save:

-- Screen width : 1920
-- Screen height: 1080
if ( ( window_title() == "feeds" ) and
     ( window_class() == "Pidgin" ) ) then
        xy(0,0)
        size(1438,1023 )
        workspace(2)
end
if ( ( window_title() == "Buddy List" ) and
     ( window_class() == "Pidgin" ) ) then
     xy(1438,0 )
     size(482,1023 )
     workspace(2)
end

As 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.

Installation

You can install binary packages for Debian GNU/Linux from the authors repository:

If 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:

  • libglib2.0-dev
  • libgtk2.0-dev
  • liblua5.1-0-dev
  • libwnck-dev
  • libx11-dev
  • x11proto-core-dev

Upon a Debian GNU/Linux system these may be installed via:

  sudo apt-get install libglib2.0-dev libgtk2.0-dev libwnck-dev libx11-dev liblua5.1-0-dev x11proto-core-dev

With the dependencies in-place you should be able to compile the binary by running:

 ./configure
 make

If you're building from a git checkout, rather than a named release, you'll need to run this instead:

 autoreconf --install
 ./configure
 make

Primitives

The following primitives are available:

  • Information
    • window_title - Get the title of the new window.
    • window_type - Get the type of the window.
      • "WINDOW_NORMAL", "WINDOW_TOOLBAR", etc.
    • window_application - Get the application which created the window.
    • window_class - Get the class of the new window.
    • window_id - Get the ID of the new window.
      • This may be empty.
    • window_xid - Get the XID of the new window.
      • This may be empty.
    • window_pid - Get the PID of the new window.
      • This may be zero on error.
    • window_role - Get the role of the new window, via WM_WINDOW_ROLE.
      • This may return an empty string.
    • screen_height - Get the size of the screen.
    • screen_width - Get the size of the screen.
  • Depth
    • activate - Make the window appear in the foreground and give focus.
    • above - Make the window "always on top".
    • below - Remove the "always on top" flag.
    • bottom - Make the window "always below".
    • unbottom - Remove the "always below" flag.
  • Max/Min
    • maximize - Maximize the window.
    • maximize_horizontally - Maximize horizontally.
    • maximize_vertically - Maximize vertically.
    • fullscreen - Make the window "fullscreen".
    • focus - Focus the window.
    • is_focussed - Is the window focussed?
    • is_maximized - Is the window maximized?
    • is_fullscreen - Is the window fullscreen?
  • Workspace
    • pin - Pin on all workspaces.
    • unpin - Don't pin on all workspaces.
  • Movement
    • xy - Get/Set the X/Y coordinates of a window.
    • size - Get/Set the width/height of a window.
  • Workspaces
    • activate_workspace - Change to the given workspace/virtual-desktop.
    • workspace - Get/set the workspace the window is active on.
      • The return value may be -1 if the window is pinned, or invisible.
    • workspaces - Get/set the number of workspaces/virtual-desktops.
  • Misc
    • decoration - Set/Unset the decorations for the window.
    • exists - Does the given file/directory exist?
    • kill - Close the window, forcibly.
    • pointer - Get/Set the position of the mouse pointer.
    • readdir - Read the contents of a directory.
  • Variables
    • DEBUG will be declared as a boolean false value, unless you launch kpie with the --debug flag.
      • This can be used to control whether you output debugging information.
    • CONFIG will be defined as the path to the configuration file loaded.
    • VERSION will be an integer containing the kpie release.

Some of these primitives are documented in the sample-scripts.

Steve

More Repositories

1

sysadmin-util

Tools for Linux/Unix sysadmins.
Perl
940
star
2

bookmarks.public

A template for self-hosted bookmarks using HTML & jQuery.
JavaScript
660
star
3

tunneller

Allow internal services, running on localhost, to be accessed over the internet..
Go
457
star
4

simple.vm

Simple virtual machine which interprets bytecode.
C
452
star
5

deployr

A simple golang application to automate the deployment of software releases.
Go
323
star
6

gobasic

A BASIC interpreter written in golang.
Go
311
star
7

go.vm

A simple virtual machine - compiler & interpreter - written in golang
Go
309
star
8

simple-vpn

A simple VPN allowing mesh-like communication between nodes, over websockets
Go
276
star
9

monkey

An interpreted language written in Go
Go
248
star
10

sysbox

sysadmin/scripting utilities, distributed as a single binary
Go
205
star
11

esp8266

Collection of projects for the WeMos Mini D1
C++
162
star
12

kilua

A minimal text-editor with lua scripting.
C++
158
star
13

sos

Simple Object Storage (I wish I could call it Steve's Simple Storage, or S3 ;)
Go
145
star
14

github-action-publish-binaries

Publish binaries when new releases are made.
Shell
134
star
15

evalfilter

A bytecode-based virtual machine to implement scripting/filtering support in your golang project.
Go
110
star
16

rss2email

Convert RSS feeds to emails
Go
104
star
17

e-comments

External comments for static HTML pages, a lightweight self-hosted disqus alternative.
JavaScript
101
star
18

linux-security-modules

A place to store my toy linux-security modules.
C
87
star
19

marionette

Something like puppet, for the localhost only.
Go
84
star
20

dhcp.io

Dynamic DNS - Via Redis, Perl, and Amazon Route53.
Perl
69
star
21

foth

Tutorial-style FORTH implementation written in golang
Go
67
star
22

overseer

A golang-based remote protocol tester for testing sites & service availability
Go
62
star
23

templer

A modular extensible static-site-generator written in perl.
Perl
62
star
24

math-compiler

A simple intel/AMD64 assembly-language compiler for mathematical operations
Go
58
star
25

assembler

Basic X86-64 assembler, written in golang
Go
56
star
26

lighthouse-of-doom

A simple text-based adventure game
C
56
star
27

node-reverse-proxy.js

A reverse HTTP-proxy in node.js
JavaScript
53
star
28

webmail

A golang webmail server.
Go
51
star
29

dotfiles

Yet another dotfile-repository
Emacs Lisp
50
star
30

github2mr

Export all your github repositories to a form suitable for 'myrepos' to work with.
Go
46
star
31

puppet-summary

The Puppet Summary is a web interface providing reporting features for Puppet, it replaces the Puppet Dashboard project
Go
45
star
32

org-worklog

A template for maintaining a work-log, via org-mode.
39
star
33

tweaked.io

The code behind http://tweaked.io/
JavaScript
36
star
34

rss2hook

POST to webhook(s) when new feed-items appear.
Go
35
star
35

pam_pwnd

A PAM module to test passwords against previous leaks at haveibeenpwned.com
C
34
star
36

alphavet

A golang linter to detect functions not in alphabetical order
Go
32
star
37

dns-api-go

The code behind https://dns-api.org/
Go
31
star
38

critical

A simple/minimal TCL interpreter, written in golang
Go
31
star
39

markdownshare.com

The code which was previously used at http://markdownshare.com/
Perl
29
star
40

github-action-tester

Run tests when pull-requests are opened, or commits pushed.
Shell
26
star
41

maildir-tools

Golang-based utility which can be used for scripting Maildir things, and also as a basic email client
Go
22
star
42

chronicle2

Chronicle is a simple blog compiler, written in Perl with minimal dependencies.
Perl
20
star
43

purppura

A server for receiving and processing alerts & events.
Go
20
star
44

implant

Simple utility for embedding files/resources inside golang binaries
Go
20
star
45

dns-api.org

The code which was previously used at https://dns-api.org/
Perl
19
star
46

bfcc

BrainFuck Compiler Challenge
Go
18
star
47

ephemeris

A static blog-compiler
Go
15
star
48

markdownshare

The code behind https://markdownshare.com/
Go
15
star
49

z80-examples

Z80 assembly-language programs.
Makefile
15
star
50

yal

Yet another lisp interpreter
Go
14
star
51

aws-utils

A small collection of AWS utilities, packaged as a single standalone binary.
Go
14
star
52

z80retroshield

Arduino library for driving the Z80 retro-shield.
Shell
12
star
53

Device-Osram-Lightify

Interface to the Osram Lightify system
Perl
12
star
54

github-action-build

Build a project, creating artifacts
Shell
12
star
55

webserver-attacks

Identify attacks against webservers via simple rules
Perl
12
star
56

predis

A redis-server written in Perl.
Perl
11
star
57

da-serverspec

ServerSpec.org configuration for the Debian-Administration cluster.
Ruby
10
star
58

docker-api-gateway

Trivial API-gateway for docker, via HAProxy
Go
10
star
59

http2xmpp

HTTP to XMPP (jabber) bridge.
Perl
9
star
60

nanoexec

Trigger commands over a nanomsg queue
C
9
star
61

go-experiments

Repository containing experiments as I learn about golang
Go
9
star
62

labeller

Script label addition/removal for gmail/gsuite email.
Go
8
star
63

golang-metrics

Automatic submission of system metrics to graphite, for golang applications
Go
8
star
64

ms-lite

A collection of plugins for a qpsmtpd-powered virtual-host aware SMTP system.
Perl
8
star
65

remotehttp

Magic wrapper to deny HTTP-requests to to "local" resources.
Go
8
star
66

dashboard

Redis & node.js powered dashboard skeleton
JavaScript
8
star
67

Buffalo-220-NAS

Installing NFS on a Buffalo 220 NAS device
Shell
8
star
68

asql

A toy utility to process Apache log files via SQL.
Perl
7
star
69

DockerFiles

Container for various dockerfiles.
Shell
6
star
70

yawns

Yet another weblog/news site
Perl
6
star
71

cidr_match.js

A simple module to test whether a given IPv4 address is within a particular CIDR range.
JavaScript
6
star
72

pass

password-store distribution, with plugins.
Shell
6
star
73

knownfs

A FUSE-based filesystem that exports ~/.ssh/known_hosts
Go
6
star
74

mpd-web

Simple HTTP view of an MPD server
Go
6
star
75

mod_writable

Disallow serving writable files under Apache 2.4.x
C
5
star
76

org-diary

Easily maintain a simple work-log / journal with the use of org-mode
Emacs Lisp
5
star
77

mod_blacklist

A simple Apache module to blacklist remote hosts.
C
5
star
78

arduino-mega-z80-simplest

The simplest possible project combining an Arduino Mega and a Zilog Z80 processor
C++
4
star
79

turtle

A simple turtle-implementation, using FORTH as a scripting-language
Go
4
star
80

purple

A simplified version of mauvealert
Perl
3
star
81

subcommands

Easy subcommand handling for a golang based command-line application
Go
3
star
82

thyme

A simple package-building system, using docker
Perl
2
star
83

httpd

Simple golang HTTP server
Go
2
star
84

edinburgh.io

Open pub database
JavaScript
2
star
85

run-directory

A simple application inspired by `run-parts`.
Go
2
star
86

Redis--SQLite

Redis-Compatible module which writes to SQLite
Perl
2
star
87

runme

A quick hack for running commands from README.md files
Go
2
star
88

devopswithdocker.com

Repository created for the Helsinki University course.
Dockerfile
2
star
89

aws-list

Export a dump of all running EC2 instances, along with AMI details, AMI age, etc, etc.
1
star
90

calibre-plugins

A small collection of calibre-plugins.
Python
1
star
91

WebService--Amazon--Route53--Caching

Perl module to cache the results of WebService::Amazon::Route53
Perl
1
star
92

lexing-parsing-linting-stuffs

Code to go with my talk
Python
1
star
93

Test--RemoteServer

The Perl module Test::RemoteServer
Perl
1
star
94

org-tag-cloud

Easily maintain a tag-cloud of org-mode tags.
Emacs Lisp
1
star
95

headerfile

Parse files with simple key:value headers, easily.
Go
1
star
96

z80-cpm-scripting-interpreter

A trivial I/O language, with repl, written in z80 assembler to run under CP/M.
Makefile
1
star