Skip to content

Instantly share code, notes, and snippets.

View blueyed's full-sized avatar
💭
❤️ not eating nor abusing animals 🍀

Daniel Hahler blueyed

💭
❤️ not eating nor abusing animals 🍀
View GitHub Profile
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)
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
-- 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())
@blueyed
blueyed / vz-double-resources.sh
Created March 15, 2011 22:03
vz-double-resources, also works as vz-half-resources
#!/bin/bash
VZ="$1"
RESOURCE="$2"
if [ -z $VZ ] || [ -z $RESOURCE ]; then
echo "Usage: $0 VZ RESOURCE"
exit 1
fi
#!/bin/bash
cat .gitignore | egrep -v "^#|^$" | while read line; do
if [ -n "$line" ]; then
for ignored_file in $( git ls-files "$line" ); do
git rm --cached "$ignored_file"
done
fi
done
-- 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
<target name="run">
<exec executable="sh"
failifexecutionfails="true"
failonerror="true"
dir="${testnode.dir}">
<arg value="run.sh"/>
<arg value="start"/>
</exec>
</target>
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
-- 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
-- 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