Skip to content

Instantly share code, notes, and snippets.

View farhaven's full-sized avatar
🦄
I'm a unicorn.

Gregor Best farhaven

🦄
I'm a unicorn.
View GitHub Profile
print("new window: class=\"" .. (c.class and c.class or "none") .. "\", instance=\"" .. (c.instance and c.instance or "none") .. "\", name=\"" .. (c.name and c.name or "none") .. "\"")
if c.name and c.name:find("OpenOffice.org Impress") then
print("new ooimpress window managed")
-- press F5 to immediately start presentation mode
root.fake_input("key_press", "71")
root.fake_input("key_release", "71")
elseif c.class and c.class:find("OpenOffice") then
print("new oo window managed")
c.ontop = true
@farhaven
farhaven / gist:816410
Created February 8, 2011 13:03
this one works :D
_NET_WM_STATE(ATOM) =
_PIDGIN_UNSEEN_COUNT(CARDINAL) = 0
_NET_WM_DESKTOP(CARDINAL) = 1
WM_STATE(WM_STATE):
window state: Normal
icon window: 0x0
WM_HINTS(WM_HINTS):
Client accepts input or input focus: True
Initial state is Normal State.
bitmap id # to use for icon: 0x140c99d
@farhaven
farhaven / gist:816408
Created February 8, 2011 13:02
this one doesn't work
_NET_WM_DESKTOP(CARDINAL) = 4
WM_STATE(WM_STATE):
window state: Normal
icon window: 0x0
WM_HINTS(WM_HINTS):
Client accepts input or input focus: True
Initial state is Normal State.
bitmap id # to use for icon: 0x160009a
bitmap id # of mask for icon: 0x160009b
window id # of group leader: 0x1600001
@farhaven
farhaven / gist:816407
Created February 8, 2011 13:01
This one fails
_NET_WM_STATE(ATOM) =
_PIDGIN_UNSEEN_COUNT(CARDINAL) = 0
_NET_WM_DESKTOP(CARDINAL) = 1
WM_STATE(WM_STATE):
window state: Normal
icon window: 0x0
WM_HINTS(WM_HINTS):
Client accepts input or input focus: True
Initial state is Normal State.
bitmap id # to use for icon: 0x140b8a0
#define _POSIX_SOURCE
#define _BSD_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <netinet/ip.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <errno.h>
-- Environment
local awful = require('awful')
local capi = {
tag = tag,
mouse = mouse,
screen = screen,
keygrabber = keygrabber,
client = client
}
local ipairs = ipairs
-- local have_strict, strict = pcall(require, 'strict') -- strict checking for unassigned variables, like perl's use strict
require('awful')
require('awful.autofocus')
require('beautiful')
require('naughty') -- Naughtyfications
require('wibox')
local have_obvious, obvious = pcall(require, 'obvious') -- Obvious widget library, get it from git://git.mercenariesguild.net/obvious.git
local have_tagger, tagger = pcall(require, 'tagger') -- Dynamic Tagging
-- {{{ Functions
client.add_signal("manage", function (c, startup)
if client_destination[c.pid] == nil then return end
local s = client_destination[c.pid][1]
local t = client_destination[c.pid][2]
c.screen = s
c:tags({ t })
end)
function run_target(promptbox)
return awful.prompt.run({ prompt = promptbox.prompt },
promptbox.widget,
function (...)
local result = awful.util.spawn(...)
if type(result) == "string" then
promptbox.widget:set_text(result)
elseif type(result) == "number" then
client_destination[result] = { mouse.screen, awful.tag.selected() }
end
for s = 1, screen.count() do
awful.tag.attached_add_signal(s, "property::selected", function(tag)
if not tag.selected then return end
local idx = nil
for i, v in pairs(screen[s]:tags()) do
if v == tag then
idx = i
break
end