Skip to content
View awesome-bnote.lua
bnote = function(s, naughty_args)
-- local level = level or 1
-- if not bdebug_level or bdebug_level < level then
-- return
-- end
local args = awful.util.table.join({
timeout = 10,
text = tostring(s),
-- font = "monospace 8"
}, naughty_args)
View tag-screen-debug.lua
local tag_screen_debug = function(c, t)
local t = t or c:tags()[1]
if not t then return end
if c.screen == awful.tag.getscreen(t) then return end
local msg = debug.traceback("Client got tagged with wrong tag:\n"
.. "c.screen: " .. tostring(c.screen)
.. ", c.transient_for.screen: " .. (c.transient_for and c.transient_for.screen or "not transient")
.. ", awful.tag.getscreen(t): " .. awful.tag.getscreen(t)
.. ", c " .. tostring(c)
.. ", c.name " .. c.name
View awesome-xev-bypass-keys.lua
-- Do not grab global / client keys when the xev event tester window is focused.
do
local saved = {}
function xev_globalkeys_focus(c)
if c.name == 'Event Tester' then
saved.root, saved.client = root.keys(), c:keys()
root.keys({})
c:keys({})
end
end
View batwidget.lua
-- Battery widget(s) per battery (there might be BAT0 and BAT1). Interval: 61. {{{
local batwidgets = {}
for _, batnr in ipairs({'0', '1'}) do
local bat = "BAT" .. batnr
local batwidget_notification = {}
local notification_dismissed
local notification_percent = 20
local notification_always_percent = 5
local batwidget = mybasewidget(awful.widget.progressbar())
View awesome-swap-back-and-forth.lua
-- Generic back and forth switching between master and client. {{{
-- Bind it like this:
-- awful.key({ modkey, "Control" }, "Return", function (c) my_swap_back_and_forth.run(c, awful.client.getmaster) end),
local my_swap_back_and_forth = {
previous_by_tag_and_f = {}
}
my_swap_back_and_forth.run = function (c, swapf)
local f = swapf or awful.client.getmaster
local prev = my_swap_back_and_forth.previous_by_tag_and_f
View myrc.lua
local spawn_with_props = function(cmd, props)
local pid, snid = awful.util.spawn(cmd)
if not snid then
bnote("ASSERTION FAILURE (spawn_with_props): no snid")
else
snid_props_cb[snid] = props
end
end
View awesome-notification-property-changes.lua
-- Notifications for property changes (number of masters, master width factor). {{{
-- local prev_tag_vals = {['property::nmaster']={}, ['property::mwfact']={}}
local prev_tag_vals, prop_notification_id = {}, nil
for s = 1, capi.screen.count() do
for sig, name in pairs({['property::nmaster'] = 'nmaster',
['property::ncol'] = 'ncol',
['property::windowfact'] = 'windowfact',
['property::mwfact'] = 'mwfact'}) do
awful.tag.attached_connect_signal(s, sig, function(t)
if not prev_tag_vals[sig] then
View awesome-borders-config.lua
-- Fine grained borders and floaters control {{{
local client_border_color = function (c)
if awful.client.ismarked(c) then
if c == capi.client.focus and beautiful.border_marked_focus then
c.border_color = beautiful.border_marked_focus
else
c.border_color = beautiful.border_marked
end
elseif c == capi.client.focus then
c.border_color = beautiful.border_focus
View logout.sh
#!/bin/sh
# close stdin
exec <&-
# ACTION=$(zenity --title "Select logout action" --text "How to quit?" --height=250 --list \
# --hide-header --hide-column=1 --column=action --column=desc \
# suspend "Suspend" \
# hybrid-sleep "Hybrid sleep" \
# hibernate "Hibernate" \
View test_django_data_migration.py
"""
Test (data) migrations in Django.
This uses py.test/pytest-django (the `transactional_db` fixture comes from there),
but could be easily adopted for Django's testrunner:
from django.test.testcases import TransactionTestCase
class FooTestcase(TransactionTestCase):
def test_with_django(self):
Something went wrong with that request. Please try again.