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
# Awesome window manager framework version 4.0 changes
Awesome 4.0 is the first release of the v4 API level, breaking the proven
v3.5 API level after 4 years. This requires to port existing user
configuration and extensions to the new API.
This document offer an overview of the new features and required changes for
existing users.
## New features
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
-- 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({})
-- Only map alt-f4.
c.keys = {awful.key({ "Mod1", }, "F4", function (c) c:kill() end)}
end
-- 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())
-- 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
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
#!/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" \