summaryrefslogtreecommitdiff
path: root/awesomerc
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2012-07-28 11:38:40 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2012-07-28 11:38:40 +0100
commit423ce84b1877b8efca404221b1fdb0488e6cb6db (patch)
tree4f47243e47f54cc571758af0ab66db6936af8585 /awesomerc
downloadresources-423ce84b1877b8efca404221b1fdb0488e6cb6db.tar.bz2
RES: Initial crud
Diffstat (limited to 'awesomerc')
-rw-r--r--awesomerc/rc-choose.lua57
-rw-r--r--awesomerc/rc-git/cal.lua121
-rw-r--r--awesomerc/rc-git/danburn/awesome-icon.pngbin0 -> 177 bytes
-rw-r--r--awesomerc/rc-git/danburn/layouts/dwindle.pngbin0 -> 196 bytes
-rw-r--r--awesomerc/rc-git/danburn/layouts/fairh.pngbin0 -> 191 bytes
-rw-r--r--awesomerc/rc-git/danburn/layouts/fairv.pngbin0 -> 193 bytes
-rw-r--r--awesomerc/rc-git/danburn/layouts/floating.pngbin0 -> 189 bytes
-rw-r--r--awesomerc/rc-git/danburn/layouts/fullscreen.pngbin0 -> 199 bytes
-rw-r--r--awesomerc/rc-git/danburn/layouts/magnifier.pngbin0 -> 191 bytes
-rw-r--r--awesomerc/rc-git/danburn/layouts/max.pngbin0 -> 276 bytes
-rw-r--r--awesomerc/rc-git/danburn/layouts/spiral.pngbin0 -> 196 bytes
-rw-r--r--awesomerc/rc-git/danburn/layouts/tile.pngbin0 -> 189 bytes
-rw-r--r--awesomerc/rc-git/danburn/layouts/tilebottom.pngbin0 -> 186 bytes
-rw-r--r--awesomerc/rc-git/danburn/layouts/tileleft.pngbin0 -> 188 bytes
-rw-r--r--awesomerc/rc-git/danburn/layouts/tiletop.pngbin0 -> 186 bytes
-rw-r--r--awesomerc/rc-git/danburn/taglist/squarefz.pngbin0 -> 168 bytes
-rw-r--r--awesomerc/rc-git/danburn/taglist/squarez.pngbin0 -> 171 bytes
-rw-r--r--awesomerc/rc-git/danburn/theme.lua127
-rw-r--r--awesomerc/rc-git/danburn/titlebar/close_focus.pngbin0 -> 211 bytes
-rw-r--r--awesomerc/rc-git/danburn/titlebar/close_normal.pngbin0 -> 370 bytes
-rw-r--r--awesomerc/rc-git/danburn/titlebar/floating_focus_active.pngbin0 -> 210 bytes
-rw-r--r--awesomerc/rc-git/danburn/titlebar/floating_focus_inactive.pngbin0 -> 339 bytes
-rw-r--r--awesomerc/rc-git/danburn/titlebar/floating_normal_active.pngbin0 -> 361 bytes
-rw-r--r--awesomerc/rc-git/danburn/titlebar/floating_normal_inactive.pngbin0 -> 328 bytes
-rw-r--r--awesomerc/rc-git/danburn/titlebar/maximized_focus_active.pngbin0 -> 202 bytes
-rw-r--r--awesomerc/rc-git/danburn/titlebar/maximized_focus_inactive.pngbin0 -> 337 bytes
-rw-r--r--awesomerc/rc-git/danburn/titlebar/maximized_normal_active.pngbin0 -> 369 bytes
-rw-r--r--awesomerc/rc-git/danburn/titlebar/maximized_normal_inactive.pngbin0 -> 349 bytes
-rw-r--r--awesomerc/rc-git/danburn/titlebar/ontop_focus_active.pngbin0 -> 188 bytes
-rw-r--r--awesomerc/rc-git/danburn/titlebar/ontop_focus_inactive.pngbin0 -> 333 bytes
-rw-r--r--awesomerc/rc-git/danburn/titlebar/ontop_normal_active.pngbin0 -> 349 bytes
-rw-r--r--awesomerc/rc-git/danburn/titlebar/ontop_normal_inactive.pngbin0 -> 334 bytes
-rw-r--r--awesomerc/rc-git/danburn/titlebar/sticky_focus_active.pngbin0 -> 199 bytes
-rw-r--r--awesomerc/rc-git/danburn/titlebar/sticky_focus_inactive.pngbin0 -> 330 bytes
-rw-r--r--awesomerc/rc-git/danburn/titlebar/sticky_normal_active.pngbin0 -> 361 bytes
-rw-r--r--awesomerc/rc-git/danburn/titlebar/sticky_normal_inactive.pngbin0 -> 329 bytes
-rw-r--r--awesomerc/rc-git/danburn/zenburn-background.pngbin0 -> 9477 bytes
-rw-r--r--awesomerc/rc-git/djas.lua47
-rw-r--r--awesomerc/rc-git/init-pre-shifty.lua391
-rw-r--r--awesomerc/rc-git/init.lua242
-rw-r--r--awesomerc/rc-git/keysetup.lua165
-rw-r--r--awesomerc/rc-git/naughtyaugment.lua49
-rw-r--r--awesomerc/rc-git/reloader.lua300
-rw-r--r--awesomerc/rc-git/shifty.lua845
-rw-r--r--awesomerc/rc-git/shiftyconfig.lua107
45 files changed, 2451 insertions, 0 deletions
diff --git a/awesomerc/rc-choose.lua b/awesomerc/rc-choose.lua
new file mode 100644
index 0000000..c30f52c
--- /dev/null
+++ b/awesomerc/rc-choose.lua
@@ -0,0 +1,57 @@
+-- Choose which RC to run based on what Awesome is running
+-- and also whether or not that RC crashed last time
+
+local rcgroup = "unknown"
+
+if awesome.release == "Smack" then
+ rcgroup = "3.4.9"
+else
+ if string.match(awesome.version, "%-g[0-9a-f]+$") then
+ rcgroup = "git"
+ end
+end
+
+-- For now, if we detect we're running 3.4.9 release then
+-- we force ourselves to choose to run the /etc/ RC file
+if rcgroup == "3.4.9" then
+ return assert(loadfile("/etc/xdg/awesome/rc.lua"))()
+end
+
+-- If we're running the GIT version then we have to
+-- consider where to find the default RC
+local defaultrc = "/usr/local/etc/xdg/awesome/rc.lua"
+local tracebackfilename = os.getenv("HOME") .. "/.config/awesome/rc-git-traceback.txt"
+
+-- If we find that we have a traceback then we run
+-- the default RC and then ensure we spawn an editor with it in.
+local tracebackfh = io.open(tracebackfilename, "r")
+if tracebackfh then
+ tracebackfh:close()
+ assert(loadfile(defaultrc))()
+ require("awful").util.spawn("gnome-open " .. tracebackfilename, false)
+ return
+end
+
+-- Otherwise we're going to try and run the main RC and failing that
+-- we're going to store the traceback and restart awesome.
+
+local function try_run_rc()
+ local homec = os.getenv("HOME") .. "/.resources/awesomerc/rc-" .. rcgroup
+ package.path = package.path .. ";" .. homec .. "/?.lua;" .. homec .. "/?/init.lua"
+ require("rc-" .. rcgroup)
+ -- TODO: Perform various sanity checks such as there being at least one tag
+ -- on each screen. For now, this'll do.
+end
+
+local ok, traceback = xpcall(try_run_rc, debug.traceback)
+
+if not ok then
+ tracebackfh = io.open(tracebackfilename, "w")
+ tracebackfh:write(traceback)
+ tracebackfh:close()
+ awesome.restart()
+end
+
+-- Either we were OK, or bad crud happened, either way, let awesome try
+-- and fall back however it might.
+
diff --git a/awesomerc/rc-git/cal.lua b/awesomerc/rc-git/cal.lua
new file mode 100644
index 0000000..50c533d
--- /dev/null
+++ b/awesomerc/rc-git/cal.lua
@@ -0,0 +1,121 @@
+-- original code made by Bzed and published on http://awesome.naquadah.org/wiki/Calendar_widget
+-- modified by Marc Dequènes (Duck) <Duck@DuckCorp.org> (2009-12-29), under the same licence,
+-- and with the following changes:
+-- + transformed to module
+-- + the current day formating is customizable
+-- modified by Jörg Thalheim (Mic92) <jthalheim@gmail.com> (2011), under the same licence,
+-- and with the following changes:
+-- + use tooltip instead of naughty.notify
+-- + rename it to cal
+--
+-- # How to Install #
+-- 1. Download the code and move it into your config directory
+-- wget --no-check-certificate https://github.com/Mic92/awesome-dotfiles/raw/master/cal.lua -O $XDG_CONFIG_HOME/awesome/cal.lua
+-- 2. require it in your rc.lua
+-- require("cal")
+-- 3. attach the calendar to a widget of your choice (ex mytextclock)
+-- cal.register(mytextclock)
+-- If you don't like the default current day formating you can change it as following
+-- cal.register(mytextclock, "<b>%s</b>") -- now the current day is bold instead of underlined
+--
+-- # How to Use #
+-- Just hover with your mouse over the widget, you register and the calendar popup.
+-- On clicking or by using the mouse wheel the displayed month changes.
+-- Pressing Shift + Mouse click change the year.
+
+local string = {format = string.format}
+local os = {date = os.date, time = os.time}
+local awful = require("awful")
+
+module("cal")
+
+local tooltip
+local state = {}
+local current_day_format = "<u>%s</u>"
+
+function displayMonth(month,year,weekStart)
+ local t,wkSt=os.time{year=year, month=month+1, day=0},weekStart or 1
+ local d=os.date("*t",t)
+ local mthDays,stDay=d.day,(d.wday-d.day-wkSt+1)%7
+
+ local lines = " "
+
+ for x=0,6 do
+ lines = lines .. os.date("%a ",os.time{year=2006,month=1,day=x+wkSt})
+ end
+
+ lines = lines .. "\n" .. os.date(" %V",os.time{year=year,month=month,day=1})
+
+ local writeLine = 1
+ while writeLine < (stDay + 1) do
+ lines = lines .. " "
+ writeLine = writeLine + 1
+ end
+
+ for d=1,mthDays do
+ local x = d
+ local t = os.time{year=year,month=month,day=d}
+ if writeLine == 8 then
+ writeLine = 1
+ lines = lines .. "\n" .. os.date(" %V",t)
+ end
+ if os.date("%Y-%m-%d") == os.date("%Y-%m-%d", t) then
+ x = string.format(current_day_format, d)
+ end
+ if d < 10 then
+ x = " " .. x
+ end
+ lines = lines .. " " .. x
+ writeLine = writeLine + 1
+ end
+ local header = os.date("%B %Y\n",os.time{year=year,month=month,day=1})
+
+ return header .. "\n" .. lines
+end
+
+function register(mywidget, custom_current_day_format)
+ if custom_current_day_format then current_day_format = custom_current_day_format end
+
+ if not tooltip then
+ tooltip = awful.tooltip({})
+ end
+ tooltip:add_to_object(mywidget)
+
+ mywidget:add_signal("mouse::enter", function()
+ local month, year = os.date('%m'), os.date('%Y')
+ state = {month, year}
+ tooltip:set_text(string.format('<span font_desc="monospace">%s</span>', displayMonth(month, year, 2)))
+ end)
+
+ mywidget:buttons(awful.util.table.join(
+ awful.button({ }, 1, function()
+ switchMonth(-1)
+ end),
+ awful.button({ }, 3, function()
+ switchMonth(1)
+ end),
+ awful.button({ }, 4, function()
+ switchMonth(-1)
+ end),
+ awful.button({ }, 5, function()
+ switchMonth(1)
+ end),
+ awful.button({ 'Shift' }, 1, function()
+ switchMonth(-12)
+ end),
+ awful.button({ 'Shift' }, 3, function()
+ switchMonth(12)
+ end),
+ awful.button({ 'Shift' }, 4, function()
+ switchMonth(-12)
+ end),
+ awful.button({ 'Shift' }, 5, function()
+ switchMonth(12)
+ end)))
+end
+
+function switchMonth(delta)
+ state[1] = state[1] + (delta or 1)
+ local text = string.format('<span font_desc="monospace">%s</span>', displayMonth(state[1], state[2], 2))
+ tooltip:set_text(text)
+end
diff --git a/awesomerc/rc-git/danburn/awesome-icon.png b/awesomerc/rc-git/danburn/awesome-icon.png
new file mode 100644
index 0000000..70978d3
--- /dev/null
+++ b/awesomerc/rc-git/danburn/awesome-icon.png
Binary files differ
diff --git a/awesomerc/rc-git/danburn/layouts/dwindle.png b/awesomerc/rc-git/danburn/layouts/dwindle.png
new file mode 100644
index 0000000..1aa4bf2
--- /dev/null
+++ b/awesomerc/rc-git/danburn/layouts/dwindle.png
Binary files differ
diff --git a/awesomerc/rc-git/danburn/layouts/fairh.png b/awesomerc/rc-git/danburn/layouts/fairh.png
new file mode 100644
index 0000000..e176bb3
--- /dev/null
+++ b/awesomerc/rc-git/danburn/layouts/fairh.png
Binary files differ
diff --git a/awesomerc/rc-git/danburn/layouts/fairv.png b/awesomerc/rc-git/danburn/layouts/fairv.png
new file mode 100644
index 0000000..7c0a92c
--- /dev/null
+++ b/awesomerc/rc-git/danburn/layouts/fairv.png
Binary files differ
diff --git a/awesomerc/rc-git/danburn/layouts/floating.png b/awesomerc/rc-git/danburn/layouts/floating.png
new file mode 100644
index 0000000..a399092
--- /dev/null
+++ b/awesomerc/rc-git/danburn/layouts/floating.png
Binary files differ
diff --git a/awesomerc/rc-git/danburn/layouts/fullscreen.png b/awesomerc/rc-git/danburn/layouts/fullscreen.png
new file mode 100644
index 0000000..a0c795c
--- /dev/null
+++ b/awesomerc/rc-git/danburn/layouts/fullscreen.png
Binary files differ
diff --git a/awesomerc/rc-git/danburn/layouts/magnifier.png b/awesomerc/rc-git/danburn/layouts/magnifier.png
new file mode 100644
index 0000000..bca6db9
--- /dev/null
+++ b/awesomerc/rc-git/danburn/layouts/magnifier.png
Binary files differ
diff --git a/awesomerc/rc-git/danburn/layouts/max.png b/awesomerc/rc-git/danburn/layouts/max.png
new file mode 100644
index 0000000..96a237a
--- /dev/null
+++ b/awesomerc/rc-git/danburn/layouts/max.png
Binary files differ
diff --git a/awesomerc/rc-git/danburn/layouts/spiral.png b/awesomerc/rc-git/danburn/layouts/spiral.png
new file mode 100644
index 0000000..8f5aeed
--- /dev/null
+++ b/awesomerc/rc-git/danburn/layouts/spiral.png
Binary files differ
diff --git a/awesomerc/rc-git/danburn/layouts/tile.png b/awesomerc/rc-git/danburn/layouts/tile.png
new file mode 100644
index 0000000..3fcc904
--- /dev/null
+++ b/awesomerc/rc-git/danburn/layouts/tile.png
Binary files differ
diff --git a/awesomerc/rc-git/danburn/layouts/tilebottom.png b/awesomerc/rc-git/danburn/layouts/tilebottom.png
new file mode 100644
index 0000000..dfe7832
--- /dev/null
+++ b/awesomerc/rc-git/danburn/layouts/tilebottom.png
Binary files differ
diff --git a/awesomerc/rc-git/danburn/layouts/tileleft.png b/awesomerc/rc-git/danburn/layouts/tileleft.png
new file mode 100644
index 0000000..c5decfd
--- /dev/null
+++ b/awesomerc/rc-git/danburn/layouts/tileleft.png
Binary files differ
diff --git a/awesomerc/rc-git/danburn/layouts/tiletop.png b/awesomerc/rc-git/danburn/layouts/tiletop.png
new file mode 100644
index 0000000..b251661
--- /dev/null
+++ b/awesomerc/rc-git/danburn/layouts/tiletop.png
Binary files differ
diff --git a/awesomerc/rc-git/danburn/taglist/squarefz.png b/awesomerc/rc-git/danburn/taglist/squarefz.png
new file mode 100644
index 0000000..0927720
--- /dev/null
+++ b/awesomerc/rc-git/danburn/taglist/squarefz.png
Binary files differ
diff --git a/awesomerc/rc-git/danburn/taglist/squarez.png b/awesomerc/rc-git/danburn/taglist/squarez.png
new file mode 100644
index 0000000..9b41c26
--- /dev/null
+++ b/awesomerc/rc-git/danburn/taglist/squarez.png
Binary files differ
diff --git a/awesomerc/rc-git/danburn/theme.lua b/awesomerc/rc-git/danburn/theme.lua
new file mode 100644
index 0000000..2db3717
--- /dev/null
+++ b/awesomerc/rc-git/danburn/theme.lua
@@ -0,0 +1,127 @@
+-------------------------------
+-- "Danburn" modification of --
+-- "Zenburn" awesome theme --
+-- By Adrian C. (anrxc) --
+-------------------------------
+
+-- Alternative icon sets and widget icons:
+-- * http://awesome.naquadah.org/wiki/Nice_Icons
+
+-- {{{ Main
+theme = {}
+theme.wallpaper_cmd = { "awsetbg " .. os.getenv("HOME") .. "/.resources/awesomerc/rc-git/danburn/zenburn-background.png" }
+-- }}}
+
+-- {{{ Styles
+theme.font = "Inconsolata 8.5"
+
+-- {{{ Colors
+theme.fg_normal = "#DCDCCC"
+theme.fg_focus = "#F0DFAF"
+theme.fg_urgent = "#CC9393"
+theme.bg_normal = "#3F3F3F"
+theme.bg_focus = "#1E2320"
+theme.bg_urgent = "#3F3F3F"
+theme.bg_systray = theme.bg_normal
+-- }}}
+
+-- {{{ Borders
+theme.border_width = 1
+theme.border_normal = "#3F3F3F"
+theme.border_focus = "#6F6F6F"
+theme.border_marked = "#CC9393"
+-- }}}
+
+-- {{{ Titlebars
+theme.titlebar_bg_focus = "#3F3F3F"
+theme.titlebar_bg_normal = "#3F3F3F"
+-- }}}
+
+-- There are other variable sets
+-- overriding the default one when
+-- defined, the sets are:
+-- [taglist|tasklist]_[bg|fg]_[focus|urgent]
+-- titlebar_[normal|focus]
+-- tooltip_[font|opacity|fg_color|bg_color|border_width|border_color]
+-- Example:
+--theme.taglist_bg_focus = "#CC9393"
+-- }}}
+
+-- {{{ Widgets
+-- You can add as many variables as
+-- you wish and access them by using
+-- beautiful.variable in your rc.lua
+--theme.fg_widget = "#AECF96"
+--theme.fg_center_widget = "#88A175"
+--theme.fg_end_widget = "#FF5656"
+--theme.bg_widget = "#494B4F"
+--theme.border_widget = "#3F3F3F"
+-- }}}
+
+-- {{{ Mouse finder
+theme.mouse_finder_color = "#CC9393"
+-- mouse_finder_[timeout|animate_timeout|radius|factor]
+-- }}}
+
+-- {{{ Menu
+-- Variables set for theming the menu:
+-- menu_[bg|fg]_[normal|focus]
+-- menu_[border_color|border_width]
+theme.menu_height = 15
+theme.menu_width = 100
+-- }}}
+
+-- {{{ Icons
+-- {{{ Taglist
+theme.taglist_squares_sel = os.getenv("HOME") .. "/.resources/awesomerc/rc-git/danburn/taglist/squarefz.png"
+theme.taglist_squares_unsel = os.getenv("HOME") .. "/.resources/awesomerc/rc-git/danburn/taglist/squarez.png"
+--theme.taglist_squares_resize = "false"
+-- }}}
+
+-- {{{ Misc
+theme.awesome_icon = os.getenv("HOME") .. "/.resources/awesomerc/rc-git/danburn/awesome-icon.png"
+theme.menu_submenu_icon = "/usr/local/share/awesome/themes/default/submenu.png"
+-- }}}
+
+-- {{{ Layout
+theme.layout_tile = os.getenv("HOME") .. "/.resources/awesomerc/rc-git/danburn/layouts/tile.png"
+theme.layout_tileleft = os.getenv("HOME") .. "/.resources/awesomerc/rc-git/danburn/layouts/tileleft.png"
+theme.layout_tilebottom = os.getenv("HOME") .. "/.resources/awesomerc/rc-git/danburn/layouts/tilebottom.png"
+theme.layout_tiletop = os.getenv("HOME") .. "/.resources/awesomerc/rc-git/danburn/layouts/tiletop.png"
+theme.layout_fairv = os.getenv("HOME") .. "/.resources/awesomerc/rc-git/danburn/layouts/fairv.png"
+theme.layout_fairh = os.getenv("HOME") .. "/.resources/awesomerc/rc-git/danburn/layouts/fairh.png"
+theme.layout_spiral = os.getenv("HOME") .. "/.resources/awesomerc/rc-git/danburn/layouts/spiral.png"
+theme.layout_dwindle = os.getenv("HOME") .. "/.resources/awesomerc/rc-git/danburn/layouts/dwindle.png"
+theme.layout_max = os.getenv("HOME") .. "/.resources/awesomerc/rc-git/danburn/layouts/max.png"
+theme.layout_fullscreen = os.getenv("HOME") .. "/.resources/awesomerc/rc-git/danburn/layouts/fullscreen.png"
+theme.layout_magnifier = os.getenv("HOME") .. "/.resources/awesomerc/rc-git/danburn/layouts/magnifier.png"
+theme.layout_floating = os.getenv("HOME") .. "/.resources/awesomerc/rc-git/danburn/layouts/floating.png"
+-- }}}
+
+-- {{{ Titlebar
+theme.titlebar_close_button_focus = os.getenv("HOME") .. "/.resources/awesomerc/rc-git/danburn/titlebar/close_focus.png"
+theme.titlebar_close_button_normal = os.getenv("HOME") .. "/.resources/awesomerc/rc-git/danburn/titlebar/close_normal.png"
+
+theme.titlebar_ontop_button_focus_active = os.getenv("HOME") .. "/.resources/awesomerc/rc-git/danburn/titlebar/ontop_focus_active.png"
+theme.titlebar_ontop_button_normal_active = os.getenv("HOME") .. "/.resources/awesomerc/rc-git/danburn/titlebar/ontop_normal_active.png"
+theme.titlebar_ontop_button_focus_inactive = os.getenv("HOME") .. "/.resources/awesomerc/rc-git/danburn/titlebar/ontop_focus_inactive.png"
+theme.titlebar_ontop_button_normal_inactive = os.getenv("HOME") .. "/.resources/awesomerc/rc-git/danburn/titlebar/ontop_normal_inactive.png"
+
+theme.titlebar_sticky_button_focus_active = os.getenv("HOME") .. "/.resources/awesomerc/rc-git/danburn/titlebar/sticky_focus_active.png"
+theme.titlebar_sticky_button_normal_active = os.getenv("HOME") .. "/.resources/awesomerc/rc-git/danburn/titlebar/sticky_normal_active.png"
+theme.titlebar_sticky_button_focus_inactive = os.getenv("HOME") .. "/.resources/awesomerc/rc-git/danburn/titlebar/sticky_focus_inactive.png"
+theme.titlebar_sticky_button_normal_inactive = os.getenv("HOME") .. "/.resources/awesomerc/rc-git/danburn/titlebar/sticky_normal_inactive.png"
+
+theme.titlebar_floating_button_focus_active = os.getenv("HOME") .. "/.resources/awesomerc/rc-git/danburn/titlebar/floating_focus_active.png"
+theme.titlebar_floating_button_normal_active = os.getenv("HOME") .. "/.resources/awesomerc/rc-git/danburn/titlebar/floating_normal_active.png"
+theme.titlebar_floating_button_focus_inactive = os.getenv("HOME") .. "/.resources/awesomerc/rc-git/danburn/titlebar/floating_focus_inactive.png"
+theme.titlebar_floating_button_normal_inactive = os.getenv("HOME") .. "/.resources/awesomerc/rc-git/danburn/titlebar/floating_normal_inactive.png"
+
+theme.titlebar_maximized_button_focus_active = os.getenv("HOME") .. "/.resources/awesomerc/rc-git/danburn/titlebar/maximized_focus_active.png"
+theme.titlebar_maximized_button_normal_active = os.getenv("HOME") .. "/.resources/awesomerc/rc-git/danburn/titlebar/maximized_normal_active.png"
+theme.titlebar_maximized_button_focus_inactive = os.getenv("HOME") .. "/.resources/awesomerc/rc-git/danburn/titlebar/maximized_focus_inactive.png"
+theme.titlebar_maximized_button_normal_inactive = os.getenv("HOME") .. "/.resources/awesomerc/rc-git/danburn/titlebar/maximized_normal_inactive.png"
+-- }}}
+-- }}}
+
+return theme
diff --git a/awesomerc/rc-git/danburn/titlebar/close_focus.png b/awesomerc/rc-git/danburn/titlebar/close_focus.png
new file mode 100644
index 0000000..02565b9
--- /dev/null
+++ b/awesomerc/rc-git/danburn/titlebar/close_focus.png
Binary files differ
diff --git a/awesomerc/rc-git/danburn/titlebar/close_normal.png b/awesomerc/rc-git/danburn/titlebar/close_normal.png
new file mode 100644
index 0000000..982da6c
--- /dev/null
+++ b/awesomerc/rc-git/danburn/titlebar/close_normal.png
Binary files differ
diff --git a/awesomerc/rc-git/danburn/titlebar/floating_focus_active.png b/awesomerc/rc-git/danburn/titlebar/floating_focus_active.png
new file mode 100644
index 0000000..63d900b
--- /dev/null
+++ b/awesomerc/rc-git/danburn/titlebar/floating_focus_active.png
Binary files differ
diff --git a/awesomerc/rc-git/danburn/titlebar/floating_focus_inactive.png b/awesomerc/rc-git/danburn/titlebar/floating_focus_inactive.png
new file mode 100644
index 0000000..461ab52
--- /dev/null
+++ b/awesomerc/rc-git/danburn/titlebar/floating_focus_inactive.png
Binary files differ
diff --git a/awesomerc/rc-git/danburn/titlebar/floating_normal_active.png b/awesomerc/rc-git/danburn/titlebar/floating_normal_active.png
new file mode 100644
index 0000000..9e6a239
--- /dev/null
+++ b/awesomerc/rc-git/danburn/titlebar/floating_normal_active.png
Binary files differ
diff --git a/awesomerc/rc-git/danburn/titlebar/floating_normal_inactive.png b/awesomerc/rc-git/danburn/titlebar/floating_normal_inactive.png
new file mode 100644
index 0000000..df28637
--- /dev/null
+++ b/awesomerc/rc-git/danburn/titlebar/floating_normal_inactive.png
Binary files differ
diff --git a/awesomerc/rc-git/danburn/titlebar/maximized_focus_active.png b/awesomerc/rc-git/danburn/titlebar/maximized_focus_active.png
new file mode 100644
index 0000000..834f106
--- /dev/null
+++ b/awesomerc/rc-git/danburn/titlebar/maximized_focus_active.png
Binary files differ
diff --git a/awesomerc/rc-git/danburn/titlebar/maximized_focus_inactive.png b/awesomerc/rc-git/danburn/titlebar/maximized_focus_inactive.png
new file mode 100644
index 0000000..55ff310
--- /dev/null
+++ b/awesomerc/rc-git/danburn/titlebar/maximized_focus_inactive.png
Binary files differ
diff --git a/awesomerc/rc-git/danburn/titlebar/maximized_normal_active.png b/awesomerc/rc-git/danburn/titlebar/maximized_normal_active.png
new file mode 100644
index 0000000..98f5522
--- /dev/null
+++ b/awesomerc/rc-git/danburn/titlebar/maximized_normal_active.png
Binary files differ
diff --git a/awesomerc/rc-git/danburn/titlebar/maximized_normal_inactive.png b/awesomerc/rc-git/danburn/titlebar/maximized_normal_inactive.png
new file mode 100644
index 0000000..a2d0ff1
--- /dev/null
+++ b/awesomerc/rc-git/danburn/titlebar/maximized_normal_inactive.png
Binary files differ
diff --git a/awesomerc/rc-git/danburn/titlebar/ontop_focus_active.png b/awesomerc/rc-git/danburn/titlebar/ontop_focus_active.png
new file mode 100644
index 0000000..776d586
--- /dev/null
+++ b/awesomerc/rc-git/danburn/titlebar/ontop_focus_active.png
Binary files differ
diff --git a/awesomerc/rc-git/danburn/titlebar/ontop_focus_inactive.png b/awesomerc/rc-git/danburn/titlebar/ontop_focus_inactive.png
new file mode 100644
index 0000000..f677f15
--- /dev/null
+++ b/awesomerc/rc-git/danburn/titlebar/ontop_focus_inactive.png
Binary files differ
diff --git a/awesomerc/rc-git/danburn/titlebar/ontop_normal_active.png b/awesomerc/rc-git/danburn/titlebar/ontop_normal_active.png
new file mode 100644
index 0000000..e70de36
--- /dev/null
+++ b/awesomerc/rc-git/danburn/titlebar/ontop_normal_active.png
Binary files differ
diff --git a/awesomerc/rc-git/danburn/titlebar/ontop_normal_inactive.png b/awesomerc/rc-git/danburn/titlebar/ontop_normal_inactive.png
new file mode 100644
index 0000000..754b9bb
--- /dev/null
+++ b/awesomerc/rc-git/danburn/titlebar/ontop_normal_inactive.png
Binary files differ
diff --git a/awesomerc/rc-git/danburn/titlebar/sticky_focus_active.png b/awesomerc/rc-git/danburn/titlebar/sticky_focus_active.png
new file mode 100644
index 0000000..1726f90
--- /dev/null
+++ b/awesomerc/rc-git/danburn/titlebar/sticky_focus_active.png
Binary files differ
diff --git a/awesomerc/rc-git/danburn/titlebar/sticky_focus_inactive.png b/awesomerc/rc-git/danburn/titlebar/sticky_focus_inactive.png
new file mode 100644
index 0000000..efc020f
--- /dev/null
+++ b/awesomerc/rc-git/danburn/titlebar/sticky_focus_inactive.png
Binary files differ
diff --git a/awesomerc/rc-git/danburn/titlebar/sticky_normal_active.png b/awesomerc/rc-git/danburn/titlebar/sticky_normal_active.png
new file mode 100644
index 0000000..c87f21a
--- /dev/null
+++ b/awesomerc/rc-git/danburn/titlebar/sticky_normal_active.png
Binary files differ
diff --git a/awesomerc/rc-git/danburn/titlebar/sticky_normal_inactive.png b/awesomerc/rc-git/danburn/titlebar/sticky_normal_inactive.png
new file mode 100644
index 0000000..0b24f37
--- /dev/null
+++ b/awesomerc/rc-git/danburn/titlebar/sticky_normal_inactive.png
Binary files differ
diff --git a/awesomerc/rc-git/danburn/zenburn-background.png b/awesomerc/rc-git/danburn/zenburn-background.png
new file mode 100644
index 0000000..1eb9437
--- /dev/null
+++ b/awesomerc/rc-git/danburn/zenburn-background.png
Binary files differ
diff --git a/awesomerc/rc-git/djas.lua b/awesomerc/rc-git/djas.lua
new file mode 100644
index 0000000..863b358
--- /dev/null
+++ b/awesomerc/rc-git/djas.lua
@@ -0,0 +1,47 @@
+module(..., package.seeall)
+
+function sprint(...)
+ local t = {...}
+ local n = select("#",...)
+ local out = {}
+ out[#out + 1] = (tostring(t[1]))
+ for i = 2,n do
+ out[#out + 1] = (tostring(t[i]))
+ end
+ return table.concat(out, "\t")
+end
+
+function print(...)
+ io.stderr:write(sprint(...))
+ io.stderr:write("\n")
+end
+
+function warpdir(c,d)
+ local tt = c:tags()[1]
+ local scr = screen[c.screen]
+ local alltags = scr:tags()
+ local t
+ for i = 1, #alltags do
+ if alltags[i] == tt then
+ t = i
+ end
+ end
+ t = t + d
+ if t == 0 then t = #alltags end
+ if t > #alltags then t = 1 end
+ c:tags { alltags[t] }
+ awful.tag.viewonly(alltags[t])
+end
+
+function warpprev(c)
+ warpdir(c, -1)
+end
+
+function warpnext(c)
+ warpdir(c, 1)
+end
+
+function nprint(...)
+ local s = sprint(...)
+ naughty.notify { text = "NPRINT: " .. s }
+end \ No newline at end of file
diff --git a/awesomerc/rc-git/init-pre-shifty.lua b/awesomerc/rc-git/init-pre-shifty.lua
new file mode 100644
index 0000000..a561736
--- /dev/null
+++ b/awesomerc/rc-git/init-pre-shifty.lua
@@ -0,0 +1,391 @@
+-- Standard awesome library
+require("awful")
+require("awful.autofocus")
+require("awful.rules")
+-- Widget and layout library
+require("wibox")
+-- Theme handling library
+require("beautiful")
+-- Notification library
+require("naughty")
+
+-- Handy locals
+local tjoin = awful.util.table.join
+
+-- {{{ Variable definitions
+-- Themes define colours, icons, and wallpapers
+beautiful.init("/usr/local/share/awesome/themes/default/theme.lua")
+
+-- This is used later as the default terminal and editor to run.
+terminal = "gnome-terminal"
+editor = os.getenv("EDITOR") or "nano"
+editor_cmd = terminal .. " -e " .. editor
+
+-- Default modkey.
+-- Usually, Mod4 is the key with a logo between Control and Alt.
+-- If you do not like this or do not have such a key,
+-- I suggest you to remap Mod4 to another key using xmodmap or other tools.
+-- However, you can use another modifier like Mod1, but it may interact with others.
+modkey = "Mod4"
+
+-- Table of layouts to cover with awful.layout.inc, order matters.
+layouts = {
+ awful.layout.suit.floating,
+ awful.layout.suit.tile,
+ awful.layout.suit.fair,
+-- awful.layout.suit.fair.horizontal,
+-- awful.layout.suit.max,
+-- awful.layout.suit.max.fullscreen,
+}
+-- }}}
+
+-- {{{ Tags
+-- Define a tag table which hold all screen tags.
+tags = {}
+for s = 1, screen.count() do
+ -- Each screen has its own tag table.
+ tags[s] = awful.tag({ 1, 2, 3, 4, 5, 6, 7, 8, 9 }, s, layouts[1])
+end
+-- }}}
+
+-- {{{ Menu
+-- Create a laucher widget and a main menu
+
+function sessionmethod(d)
+ awful.util.spawn("gnome-session-save " .. d, false)
+end
+
+myawesomemenu = {
+ { "manual", terminal .. " -e man awesome" },
+ { "edit config", editor_cmd .. " " .. awful.util.getdir("config") .. "/rc-new.lua" },
+ { "restart", awesome.restart },
+ { "quit", awesome.quit }
+}
+
+mymainmenu =
+ awful.menu({ items =
+ { { "awesome", myawesomemenu, beautiful.awesome_icon },
+ { "open terminal", terminal },
+ { "log out", function () sessionmethod "--logout-dialog" end },
+ { "shut down", function () sessionmethod "--shutdown-dialog" end },
+ }
+ })
+
+mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon,
+ menu = mymainmenu })
+-- }}}
+
+-- {{{ Wibox
+-- Create a textclock widget
+mytextclock = awful.widget.textclock()
+
+-- Create a wibox for each screen and add it
+mywibox = {}
+mypromptbox = {}
+mylayoutbox = {}
+mytaglist = {}
+mytaglist.buttons = tjoin(
+ awful.button({ }, 1, awful.tag.viewonly),
+ awful.button({ modkey }, 1, awful.client.movetotag),
+ awful.button({ }, 3, awful.tag.viewtoggle),
+ awful.button({ modkey }, 3, awful.client.toggletag),
+ awful.button({ }, 4, awful.tag.viewnext),
+ awful.button({ }, 5, awful.tag.viewprev)
+ )
+mytasklist = {}
+mytasklist.buttons =
+ tjoin(
+ awful.button({ }, 1, function (c)
+ if c == client.focus then
+ c.minimized = true
+ else
+ if not c:isvisible() then
+ awful.tag.viewonly(c:tags()[1])
+ end
+ -- This will also un-minimize
+ -- the client, if needed
+ client.focus = c
+ c:raise()
+ end
+ end),
+ awful.button({ }, 3, function ()
+ if instance then
+ instance:hide()
+ instance = nil
+ else
+ instance = awful.menu.clients({ width=250 })
+ end
+ end),
+ awful.button({ }, 4, function ()
+ awful.client.focus.byidx(1)
+ if client.focus then client.focus:raise() end
+ end),
+ awful.button({ }, 5, function ()
+ awful.client.focus.byidx(-1)
+ if client.focus then client.focus:raise() end
+ end))
+
+for s = 1, screen.count() do
+ -- Create a promptbox for each screen
+ mypromptbox[s] = awful.widget.prompt()
+ -- Create an imagebox widget which will contains an icon indicating which layout we're using.
+ -- We need one layoutbox per screen.
+ mylayoutbox[s] = awful.widget.layoutbox(s)
+ local function layout_button(n, m)
+ return awful.button({}, n, function () awful.layout.inc(layouts, m) end)
+ end
+ mylayoutbox[s]:buttons(tjoin(
+ layout_button(1, 1),
+ layout_button(3, -1),
+ layout_button(4, 1),
+ layout_button(4, -1)))
+ -- Create a taglist widget
+ mytaglist[s] =
+ awful.widget.taglist(s, awful.widget.taglist.filter.all, mytaglist.buttons)
+
+ -- Create a tasklist widget
+ mytasklist[s] =
+ awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons)
+
+ -- Create the wibox
+ mywibox[s] = awful.wibox({ position = "top", screen = s })
+
+ -- Widgets that are aligned to the left
+ local left_layout = wibox.layout.fixed.horizontal()
+ left_layout:add(mylauncher)
+ left_layout:add(mytaglist[s])
+ left_layout:add(mypromptbox[s])
+
+ -- Widgets that are aligned to the right
+ local right_layout = wibox.layout.fixed.horizontal()
+ if s == 1 then right_layout:add(wibox.widget.systray()) end
+ right_layout:add(mytextclock)
+ right_layout:add(mylayoutbox[s])
+
+ -- Now bring it all together (with the tasklist in the middle)
+ local layout = wibox.layout.align.horizontal()
+ layout:set_left(left_layout)
+ layout:set_middle(mytasklist[s])
+ layout:set_right(right_layout)
+
+ mywibox[s]:set_widget(layout)
+end
+-- }}}
+
+-- {{{ Mouse bindings
+root.buttons(tjoin(
+ awful.button({ }, 3, function () mymainmenu:toggle() end),
+ awful.button({ }, 4, awful.tag.viewnext),
+ awful.button({ }, 5, awful.tag.viewprev)
+ ))
+-- }}}
+
+-- {{{ Key bindings
+globalkeys =
+ tjoin(
+ awful.key({ modkey, }, "Left",
+ awful.tag.viewprev ),
+ awful.key({ modkey, }, "Right",
+ awful.tag.viewnext ),
+ awful.key({ modkey, }, "Escape",
+ awful.tag.history.restore),
+
+ awful.key({ modkey, }, "j",
+ function ()
+ awful.client.focus.byidx( 1)
+ if client.focus then client.focus:raise() end
+ end),
+ awful.key({ modkey, }, "k",
+ function ()
+ awful.client.focus.byidx(-1)
+ if client.focus then client.focus:raise() end
+ end),
+ awful.key({ modkey, }, "w",
+ function () mymainmenu:show({keygrabber=true}) end),
+
+ -- Layout manipulation
+ awful.key({ modkey, "Shift" }, "j",
+ function () awful.client.swap.byidx( 1) end),
+ awful.key({ modkey, "Shift" }, "k",
+ function () awful.client.swap.byidx( -1) end),
+ awful.key({ modkey, "Control" }, "j",
+ function () awful.screen.focus_relative( 1) end),
+ awful.key({ modkey, "Control" }, "k",
+ function () awful.screen.focus_relative(-1) end),
+ awful.key({ modkey, }, "u",
+ awful.client.urgent.jumpto),
+ awful.key({ modkey, }, "Tab",
+ function ()
+ awful.client.focus.history.previous()
+ if client.focus then
+ client.focus:raise()
+ end
+ end),
+
+ -- Standard program
+ awful.key({ modkey, }, "Return",
+ function () awful.util.spawn(terminal) end),
+ awful.key({ modkey, "Control" }, "r",
+ awesome.restart),
+ awful.key({ modkey, "Shift" }, "q",
+ awesome.quit),
+
+ awful.key({ modkey, }, "l",
+ function () awful.tag.incmwfact( 0.05) end),
+ awful.key({ modkey, }, "h",
+ function () awful.tag.incmwfact(-0.05) end),
+ awful.key({ modkey, "Shift" }, "h",
+ function () awful.tag.incnmaster( 1) end),
+ awful.key({ modkey, "Shift" }, "l",
+ function () awful.tag.incnmaster(-1) end),
+ awful.key({ modkey, "Control" }, "h",
+ function () awful.tag.incncol( 1) end),
+ awful.key({ modkey, "Control" }, "l",
+ function () awful.tag.incncol(-1) end),
+ awful.key({ modkey, }, "space",
+ function () awful.layout.inc(layouts, 1) end),
+ awful.key({ modkey, "Shift" }, "space",
+ function () awful.layout.inc(layouts, -1) end),
+
+ awful.key({ modkey, "Control" }, "n",
+ awful.client.restore),
+
+ -- Prompt
+ awful.key({ modkey }, "r",
+ function () mypromptbox[mouse.screen]:run() end),
+
+ awful.key({ modkey }, "x",
+ function ()
+ awful.prompt.run({ prompt = "Run Lua code: " },
+ mypromptbox[mouse.screen].widget,
+ awful.util.eval, nil,
+ awful.util.getdir("cache") .. "/history_eval")
+ end)
+ )
+
+clientkeys =
+ tjoin(
+ awful.key({ modkey, }, "f",
+ function (c) c.fullscreen = not c.fullscreen end),
+ awful.key({ modkey, "Shift" }, "c",
+ function (c) c:kill() end),
+ awful.key({ modkey, "Control" }, "space",
+ awful.client.floating.toggle ),
+ awful.key({ modkey, "Control" }, "Return",
+ function (c) c:swap(awful.client.getmaster()) end),
+ awful.key({ modkey, }, "o",
+ awful.client.movetoscreen ),
+ awful.key({ modkey, }, "t",
+ function (c) c.ontop = not c.ontop end),
+ awful.key({ modkey, }, "n",
+ function (c)
+ -- The client currently has the input focus, so it cannot be
+ -- minimized, since minimized clients can't have the focus.
+ c.minimized = true
+ end),
+ awful.key({ modkey, }, "m",
+ function (c)
+ c.maximized_horizontal = not c.maximized_horizontal
+ c.maximized_vertical = not c.maximized_vertical
+ end)
+ )
+
+-- Compute the maximum number of digit we need, limited to 9
+keynumber = 0
+for s = 1, screen.count() do
+ keynumber = math.min(9, math.max(#tags[s], keynumber));
+end
+
+-- Bind all key numbers to tags.
+-- Be careful: we use keycodes to make it works on any keyboard layout.
+-- This should map on the top row of your keyboard, usually 1 to 9.
+for i = 1, keynumber do
+ globalkeys = tjoin(globalkeys,
+ awful.key({ modkey }, "#" .. i + 9,
+ function ()
+ local screen = mouse.screen
+ if tags[screen][i] then
+ awful.tag.viewonly(tags[screen][i])
+ end
+ end),
+ awful.key({ modkey, "Control" }, "#" .. i + 9,
+ function ()
+ local screen = mouse.screen
+ if tags[screen][i] then
+ awful.tag.viewtoggle(tags[screen][i])
+ end
+ end),
+ awful.key({ modkey, "Shift" }, "#" .. i + 9,
+ function ()
+ if client.focus and tags[client.focus.screen][i] then
+ awful.client.movetotag(tags[client.focus.screen][i])
+ end
+ end),
+ awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
+ function ()
+ if client.focus and tags[client.focus.screen][i] then
+ awful.client.toggletag(tags[client.focus.screen][i])
+ end
+ end))
+end
+
+clientbuttons = tjoin(
+ awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
+ awful.button({ modkey }, 1, awful.mouse.client.move),
+ awful.button({ modkey }, 3, awful.mouse.client.resize))
+
+-- Set keys
+root.keys(globalkeys)
+-- }}}
+
+-- {{{ Rules
+awful.rules.rules = {
+ -- All clients will match this rule.
+ { rule = { },
+ properties = { border_width = beautiful.border_width,
+ border_color = beautiful.border_normal,
+ focus = true,
+ keys = clientkeys,
+ buttons = clientbuttons } },
+ { rule = { class = "MPlayer" },
+ properties = { floating = true } },
+ { rule = { class = "pinentry" },
+ properties = { floating = true } },
+ { rule = { class = "gimp" },
+ properties = { floating = true } },
+ -- Set Firefox to always map on tags number 2 of screen 1.
+ -- { rule = { class = "Firefox" },
+ -- properties = { tag = tags[1][2] } },
+}
+-- }}}
+
+-- {{{ Signals
+-- Signal function to execute when a new client appears.
+do
+ function ___(c, startup)
+ -- Enable sloppy focus
+ c:connect_signal("mouse::enter",
+ function(c)
+ if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
+ and awful.client.focus.filter(c) then
+ client.focus = c
+ end
+ end)
+
+ if not startup then
+ -- Set the windows at the slave,
+ -- i.e. put it at the end of others instead of setting it master.
+ -- awful.client.setslave(c)
+
+ -- Put windows in a smart way, only if they does not set an initial position.
+ if not c.size_hints.user_position and not c.size_hints.program_position then
+ awful.placement.no_overlap(c)
+ awful.placement.no_offscreen(c)
+ end
+ end
+ end
+client.connect_signal("manage", ___)
+end
+client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
+client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
+-- }}}
diff --git a/awesomerc/rc-git/init.lua b/awesomerc/rc-git/init.lua
new file mode 100644
index 0000000..0483e77
--- /dev/null
+++ b/awesomerc/rc-git/init.lua
@@ -0,0 +1,242 @@
+-- Standard awesome library
+require("awful")
+require("awful.autofocus")
+require("awful.rules")
+require "awful.layout"
+require "awful.layout.suit"
+-- Widget and layout library
+require("wibox")
+-- Theme handling library
+require("beautiful")
+-- Notification library
+require("naughty")
+-- Bring in 'shifty' (the nifty dynamic tags stuffs)
+require "shifty"
+-- Bring in my shifty configuration
+require "shiftyconfig"
+-- Bring in my handy utils
+require 'djas'
+-- My key setup
+require 'keysetup'
+-- Try bringing in the Debian menu config
+require 'debian.menu'
+-- Neat calendar widget
+require 'cal'
+-- Handy dandy state restoration booja
+require 'reloader'
+-- Pull the dbus augmentation for naughty in, so introspection doesn't fail
+require 'naughtyaugment'
+
+-- Handy locals
+local tjoin = awful.util.table.join
+
+-- {{{ Variable definitions
+-- Themes define colours, icons, and wallpapers
+--beautiful.init("/usr/local/share/awesome/themes/default/theme.lua")
+beautiful.init(os.getenv("HOME").."/.resources/awesomerc/rc-git/danburn/theme.lua")
+
+-- This is used later as the default terminal and editor to run.
+terminal = "gnome-terminal"
+editor = os.getenv("EDITOR") or "nano"
+editor_cmd = terminal .. " -e " .. editor
+
+-- Default modkey.
+-- Usually, Mod4 is the key with a logo between Control and Alt.
+-- If you do not like this or do not have such a key,
+-- I suggest you to remap Mod4 to another key using xmodmap or other tools.
+-- However, you can use another modifier like Mod1, but it may interact with others.
+modkey = "Mod4"
+
+-- Table of layouts to cover with awful.layout.inc, order matters.
+layouts = {
+ awful.layout.suit.floating,
+-- awful.layout.suit.tile,
+ awful.layout.suit.fair,
+}
+-- }}}
+
+
+-- {{{ Menu
+-- Create a laucher widget and a main menu
+
+function sessionmethod(d)
+ awful.util.spawn("gnome-session-quit " .. d, false)
+end
+
+myawesomemenu = {
+-- { "manual", terminal .. " -e man awesome" },
+-- { "edit config", editor_cmd .. " " .. awful.util.getdir("config") .. "/rc-new.lua" },
+ { "restart", awesome.restart },
+ { "quit", awesome.quit }
+}
+
+mymainmenu =
+ awful.menu({ items =
+ { { "awesome", myawesomemenu, beautiful.awesome_icon },
+ { "Debian", debian.menu.Debian_menu.Debian },
+ { "open terminal", terminal },
+ { "log out", function () sessionmethod "--logout" end },
+ { "shut down", function () sessionmethod "--power-off" end },
+ }
+ })
+
+mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon,
+ menu = mymainmenu })
+-- }}}
+
+-- {{{ Wibox
+-- Create a textclock widget
+mytextclock = awful.widget.textclock()
+-- Calendar tooltip currently doesn't render. Oddness
+--cal.register(mytextclock, "<b>%s</b>")
+
+-- Create a wibox for each screen and add it
+mywibox = {}
+mypromptbox = {}
+mylayoutbox = {}
+mytaglist = {}
+mytaglist.buttons = tjoin(
+ awful.button({ }, 1, awful.tag.viewonly),
+ awful.button({ modkey }, 1, awful.client.movetotag),
+ awful.button({ }, 3, awful.tag.viewtoggle),
+ awful.button({ modkey }, 3, awful.client.toggletag)
+ -- awful.button({ }, 4, awful.tag.viewnext),
+ -- awful.button({ }, 5, awful.tag.viewprev)
+ )
+mytasklist = {}
+mytasklist.buttons =
+ tjoin(
+ awful.button({ }, 1, function (c)
+ if c == client.focus then
+ c.minimized = true
+ else
+ if not c:isvisible() then
+ awful.tag.viewonly(c:tags()[1])
+ end
+ -- This will also un-minimize
+ -- the client, if needed
+ client.focus = c
+ c:raise()
+ end
+ end),
+ awful.button({ }, 3, function ()
+ if instance then
+ instance:hide()
+ instance = nil
+ else
+ instance = awful.menu.clients({ width=250 })
+ end
+ end),
+ awful.button({ }, 4, function ()
+ awful.client.focus.byidx(1)
+ if client.focus then client.focus:raise() end
+ end),
+ awful.button({ }, 5, function ()
+ awful.client.focus.byidx(-1)
+ if client.focus then client.focus:raise() end
+ end))
+
+for s = 1, screen.count() do
+ -- Create a promptbox for each screen
+ mypromptbox[s] = awful.widget.prompt()
+ -- Create an imagebox widget which will contains an icon indicating which layout we're using.
+ -- We need one layoutbox per screen.
+ mylayoutbox[s] = awful.widget.layoutbox(s)
+ local function layout_button(n, m)
+ return awful.button({}, n, function () awful.layout.inc(layouts, m) end)
+ end
+ mylayoutbox[s]:buttons(tjoin(
+ layout_button(1, 1),
+ layout_button(3, -1),
+ layout_button(4, 1),
+ layout_button(4, -1)))
+ -- Create a taglist widget
+ mytaglist[s] =
+ awful.widget.taglist(s, awful.widget.taglist.filter.all, mytaglist.buttons)
+
+ -- Create a tasklist widget
+ mytasklist[s] =
+ awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons)
+
+ -- Create the wibox
+ mywibox[s] = awful.wibox({ position = "top", screen = s })
+
+ -- Widgets that are aligned to the left
+ local left_layout = wibox.layout.fixed.horizontal()
+ left_layout:add(mylauncher)
+ left_layout:add(mytaglist[s])
+ left_layout:add(mypromptbox[s])
+
+ -- Widgets that are aligned to the right
+ local right_layout = wibox.layout.fixed.horizontal()
+ if s == 1 then right_layout:add(wibox.widget.systray()) end
+ right_layout:add(mytextclock)
+ right_layout:add(mylayoutbox[s])
+
+ -- Now bring it all together (with the tasklist in the middle)
+ local layout = wibox.layout.align.horizontal()
+ layout:set_left(left_layout)
+ layout:set_middle(mytasklist[s])
+ layout:set_right(right_layout)
+
+ mywibox[s]:set_widget(layout)
+end
+-- }}}
+
+-- {{{ Key bindings
+globalkeys = keysetup.globalkeys(modkey, mypromptbox)
+
+clientkeys = keysetup.clientkeys(modkey)
+
+clientbuttons = tjoin(
+ awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
+ awful.button({ modkey }, 1, awful.mouse.client.move),
+ awful.button({ modkey }, 3, awful.mouse.client.resize))
+
+-- Set keys
+root.keys(globalkeys)
+shifty.config.globalkeys = globalkeys
+shifty.config.clientkeys = clientkeys
+-- }}}
+
+shiftyconfig.go(modkey)
+
+shifty.layouts = layouts
+shifty.taglist = mytaglist
+shifty.init()
+
+
+
+-- {{{ Mouse bindings
+root.buttons(tjoin(
+ awful.button({ }, 3, function () mymainmenu:toggle() end)
+-- awful.button({ }, 4, awful.tag.viewnext),
+-- awful.button({ }, 5, awful.tag.viewprev)
+ ))
+-- }}}
+
+
+-- {{{ Signals
+-- Signal function to execute when a new client appears.
+do
+ function ___(c, startup)
+ -- Enable sloppy focus
+ reloader.try_place_client(c, startup)
+ c:connect_signal("mouse::enter",
+ function(c)
+ if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
+ and awful.client.focus.filter(c) then
+ client.focus = c
+ end
+ end)
+
+ end
+ client.connect_signal("manage", ___)
+end
+client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
+client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
+-- }}}
+
+-- Finally, let the reloader in on the game
+
+reloader.prepare_reload_state "/home/dsilvers/.config/awesome/client.state"
diff --git a/awesomerc/rc-git/keysetup.lua b/awesomerc/rc-git/keysetup.lua
new file mode 100644
index 0000000..bfe8e52
--- /dev/null
+++ b/awesomerc/rc-git/keysetup.lua
@@ -0,0 +1,165 @@
+module(..., package.seeall)
+
+local awful = require 'awful'
+local djas = require 'djas'
+local shifty = require 'shifty'
+
+local tjoin = awful.util.table.join
+
+local keyjoiner_methods = {}
+
+function keyjoiner_methods:oldact(mods, key, action)
+ if (mods ~= nil) then
+ self.keys =
+ tjoin(self.keys,
+ awful.key(mods, key, action))
+ end
+ return self.keys
+end
+
+function keyjoiner_methods:act(key, action)
+ if key ~= nil then
+ assert(action, "Unable to act if there's no action")
+ local mods = {}
+ local _
+ local map = {
+ C = "Control",
+ S = "Shift",
+ A = "Mod1",
+ M = self.modkey,
+ }
+ while key:match("^[CSMA]%-") do
+ _, _, prefix, key = key:find("^(.)%-(.+)$")
+ mods[#mods+1] = map[prefix]
+ end
+ if key:match("^[0-9]$") then
+ key = tonumber(key)
+ end
+ self.keys = tjoin(self.keys,
+ awful.key(mods, key, action))
+ end
+ return self.keys
+end
+
+local keyjoiner_meta = {
+ __index = keyjoiner_methods,
+ __call = keyjoiner_methods.oldact,
+}
+
+function keyjoiner_new(modkey)
+ return setmetatable({modkey = modkey, keys={}}, keyjoiner_meta)
+end
+
+function clientkeys(modkey)
+ local lockeys = keyjoiner_new(modkey)
+ lockeys:act("C-S-A-Left", djas.warpprev)
+ lockeys:act("C-S-A-Right", djas.warpnext)
+ lockeys:act("M-f", function (c) c.fullscreen = not c.fullscreen end)
+ lockeys:act("A-F4", function(c) c:kill() end)
+
+ lockeys:act("M-C-space", awful.client.floating.toggle)
+ lockeys:act("C-M-Return", function (c) c:swap(awful.client.getmaster()) end)
+ lockeys:act("M-o", awful.client.movetoscreen)
+ lockeys:act("C-S-A-Up", awful.client.movetoscreen)
+ lockeys:act("C-S-A-Down", awful.client.movetoscreen)
+ lockeys:act("M-t", function (c) c.ontop = not c.ontop end)
+ do
+ local function maximiser (c)
+ c.maximized_horizontal = not c.maximized_horizontal
+ c.maximized_vertical = not c.maximized_vertical
+ end
+ lockeys:act("M-m", maximiser)
+ lockeys:act("C-S-F11", maximiser)
+ end
+
+ return lockeys()
+end
+
+local function speshulterminal(t,e)
+ awful.util.spawn("gnome-terminal --role " .. t .. " --title " .. t .. " -e " .. e, false)
+end
+
+function globalkeys(modkey,mypromptbox)
+ local globkeys = keyjoiner_new(modkey)
+ globkeys:act("C-A-M-m",
+ function()
+ speshulterminal("Mutt", "mutt")
+ speshulterminal("OfflineIMAP", "offlineimap")
+ end)
+ globkeys:act("C-A-Left", awful.tag.viewprev)
+ globkeys:act("C-A-Right", awful.tag.viewnext)
+ globkeys:act("C-M-Left", shifty.shift_prev)
+ globkeys:act("C-M-Right", shifty.shift_next)
+ globkeys:act("M-t", function() shifty.add({ rel_index = 1 }) end)
+ globkeys:act("C-M-t", function() shifty.add({ rel_index = 1, nopopup = true }) end)
+ globkeys:act("M-r", shifty.rename)
+ globkeys:act("M-w", shifty.del)
+ globkeys:act("M-Escape", awful.tag.history.restore)
+
+ globkeys:act("M-j", function ()
+ awful.client.focus.byidx( 1)
+ if client.focus then client.focus:raise() end
+ end)
+ globkeys:act("M-k", function ()
+ awful.client.focus.byidx(-1)
+ if client.focus then client.focus:raise() end
+ end)
+ globkeys:act("M-Menu", function () mymainmenu:show({keygrabber=true}) end)
+
+ -- Layout manipulation
+ globkeys:act("M-S-j", function () awful.client.swap.byidx( 1) end)
+ globkeys:act("M-S-k", function () awful.client.swap.byidx( -1) end)
+ globkeys:act("M-C-j", function () awful.screen.focus_relative( 1) end)
+ globkeys:act("M-C-k", function () awful.screen.focus_relative(-1) end)
+ globkeys:act("C-A-Up", function () awful.screen.focus_relative( 1) end)
+ globkeys:act("C-A-Down", function () awful.screen.focus_relative(-1) end)
+ globkeys:act("M-u", awful.client.urgent.jumpto)
+ globkeys:act("M-Tab", function ()
+ awful.client.focus.history.previous()
+ if client.focus then
+ client.focus:raise()
+ end
+ end)
+
+ -- Standard program
+ globkeys:act("M-x", function () awful.util.spawn(terminal) end)
+ globkeys:act("M-C-r", awesome.restart)
+ globkeys:act("M-C-n", awful.client.restore)
+
+ -- Prompt
+ globkeys:act("A-F2", function () mypromptbox[mouse.screen]:run() end)
+ globkeys:act("M-C-x",
+ function ()
+ awful.prompt.run({ prompt = "Run Lua code: " },
+ mypromptbox[mouse.screen].widget,
+ awful.util.eval, nil,
+ awful.util.getdir("cache") .. "/history_eval")
+ end)
+ -- Tag switching
+ for i=1,9 do
+ local function si(p)
+ return p .. "-" .. tostring(i)
+ end
+ globkeys:act(si "M", function ()
+ local t = awful.tag.viewonly(shifty.getpos(i))
+ end)
+ globkeys:act(si "M-C", function ()
+ local t = shifty.getpos(i)
+ t.selected = not t.selected
+ end)
+ globkeys:act(si "M-C-S", function ()
+ if client.focus then
+ awful.client.toggletag(shifty.getpos(i))
+ end
+ end)
+ -- move clients to other tags
+ globkeys:act(si "M-S", function ()
+ if client.focus then
+ local t = shifty.getpos(i)
+ awful.client.movetotag(t)
+ awful.tag.viewonly(t)
+ end
+ end)
+ end
+ return globkeys()
+end
diff --git a/awesomerc/rc-git/naughtyaugment.lua b/awesomerc/rc-git/naughtyaugment.lua
new file mode 100644
index 0000000..12fefbd
--- /dev/null
+++ b/awesomerc/rc-git/naughtyaugment.lua
@@ -0,0 +1,49 @@
+local barexml = [=[<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object
+ Introspection 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+ <node>
+ <interface name="org.freedesktop.DBus.Introspectable">
+ <method name="Introspect">
+ <arg name="xml_data" type="s" direction="out"/>
+ </method>
+ </interface>
+ </node>
+]=]
+
+local function _retxml(nextnode)
+ return [=[<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object
+ Introspection 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+ <node>
+ <interface name="org.freedesktop.DBus.Introspectable">
+ <method name="Introspect">
+ <arg name="xml_data" type="s" direction="out"/>
+ </method>
+ </interface>
+ <node name="]=] .. nextnode .. [=[" />
+ </node>
+]=]
+end
+
+local function _introspect_cb(data, text)
+ if data.member == "Introspect" then
+ local nextnode
+ if data.path == "/" then
+ nextnode = "org"
+ elseif data.path == "/org" then
+ nextnode = "freedesktop"
+ elseif data.path == "/org/freedesktop" then
+ nextnode = "Notifications"
+ else
+ return "s", barexml
+ end
+ return "s", _retxml(nextnode)
+ end
+end
+
+local function _property_cb(data, text)
+end
+
+dbus.connect_signal("", _introspect_cb)
+dbus.connect_signal("org.freedesktop.DBus.Properties", _property_cb)
+
diff --git a/awesomerc/rc-git/reloader.lua b/awesomerc/rc-git/reloader.lua
new file mode 100644
index 0000000..59230a6
--- /dev/null
+++ b/awesomerc/rc-git/reloader.lua
@@ -0,0 +1,300 @@
+-- Facility to dump out a file describing all the clients attached to
+-- awesome, all the tags on all the screens, and to allow that to then
+-- be re-created on restart.
+--
+-- Essentially to allow restarts of awesome with as close to
+-- the currently running shape as possible
+--
+
+module(..., package.seeall)
+
+function print(...)
+ local space = ""
+ for _, v in ipairs{...} do
+ io.stderr:write(space, tostring(v))
+ space = "\t"
+ end
+ io.stderr:write("\n")
+ io.stderr:flush()
+end
+
+local layoutname = {
+ [awful.layout.suit.floating] = "floating",
+ [awful.layout.suit.fair] = "fair",
+ [awful.layout.suit.tile] = "tile",
+ [awful.layout.suit.max] = "max",
+ [awful.layout.suit.spiral] = "spiral",
+ [awful.layout.suit.magnifier] = "magnifier",
+}
+
+local function _dumpstate(f)
+ local space = ""
+ f:write("-- Screens\n\n")
+ local tagmap = {}
+ for i = 1, screen.count() do
+ local scr = screen[i]
+ -- To identify a screen, we can't rely on its index, instead we
+ -- rely on its geometry, initially we consider its width and
+ -- height only and if that is ambiguous then we use its x/y, but
+ -- this is only during restoration anyway.
+ f:write("DefineScreen {\n")
+ local geom = scr.geometry
+ f:write(" geometry = {")
+ space = ""
+ for _, v in ipairs{"x","y","width","height"} do
+ f:write(space, v, " = ", tostring(geom[v]))
+ space = ", "
+ end
+ f:write("},\n")
+ local tags = scr:tags()
+ f:write(" tags = {")
+ space = "\n "
+ for _, tag in ipairs(tags) do
+ tagmap[#tagmap+1] = tag
+ tagmap[tag] = #tagmap
+ f:write(("%s{ id = %d, name = %q,\n props = {\n"):format(space, #tagmap, tag.name))
+ for k, v in pairs(awful.tag.getdata(tag) or {}) do
+ if k ~= "layout" then
+ if type(v) == "string" then
+ v = ("%q"):format(v)
+ else
+ v = tostring(v)
+ end
+ f:write((" [%q] = %s,\n"):format(k, v))
+ end
+ end
+ local layout = awful.tag.getproperty(tag, "layout")
+ f:write(" layout = awful.layout.suit.", layoutname[layout] or "floating", "\n }\n")
+ f:write(" }")
+ space = ",\n "
+ end
+ f:write("\n },\n")
+ f:write(" id = ", tostring(i), "\n}\n\n")
+ end
+ f:write("\n\n-- Clients\n\n")
+ local all_clients = client.get();
+ for _, c in ipairs(all_clients) do
+ f:write("DefineClient {\n")
+ f:write(" -- ", tostring(c.name), " [", tostring(c.class), "/", tostring(c.instance), "]\n")
+ f:write(" screen = ", tostring(c.screen), ",\n")
+ f:write(" tags = { ")
+ space = ""
+ for _, tag in ipairs(c:tags()) do
+ f:write(("%s%d"):format(space, tagmap[tag]))
+ space = ", "
+ end
+ f:write(" },\n")
+ local geom = c:geometry()
+ f:write(" geometry = {")
+ space = ""
+ for _, v in ipairs{"x","y","width","height"} do
+ f:write(space, v, " = ", tostring(geom[v]))
+ space = ", "
+ end
+ f:write("},\n")
+ for _, prop in ipairs{"maximized_vertical", "maximized_horizontal", "minimized"} do
+ -- boolean property
+ f:write(" ", prop, " = ", (c[prop] and "true" or "false"), ",\n")
+ end
+ f:write(" id = ", tostring(c.window), "\n}\n\n")
+ end
+end
+
+local function dump_awesome_state(fname)
+ local f = io.open(fname, "w")
+ local ok, msg = pcall(_dumpstate, f)
+ if not ok then
+ f:write("\n\n-- ", msg, "\n\n")
+ f:close()
+ -- os.execute(("rm -f %q"):format(fname))
+ return false
+ end
+ f:close()
+ return true
+end
+
+local reloader_filename
+
+local function reloader_atexit(is_restart)
+ print "reloader: atexit"
+ if is_restart then
+ print "reloader: restart indicated"
+ dump_awesome_state(reloader_filename)
+ else
+ print "reloader: restart not indicated"
+ end
+end
+
+local client_screen_map = {}
+local client_tag_map = setmetatable({}, { __mode = "v" })
+local client_data_map = {}
+
+local function load_restore_state(f)
+ local func = assert(loadfile(f))
+ print ("reloader: Loaded configuration from " .. f)
+ local screens, clients = {}, {}
+
+ local function _DefineScreen(s)
+ screens[#screens+1] = s
+ end
+
+ local function _DefineClient(c)
+ clients[#clients+1] = c
+ end
+
+ setfenv(func, setmetatable({
+ DefineScreen = _DefineScreen,
+ DefineClient = _DefineClient
+ }, { __index = _G }))
+
+ func()
+
+ print("reloader: Defined", #screens, "screens and ", #clients, "clients")
+ local screenmap = client_screen_map
+ for _, thisscreen in ipairs(screens) do
+ -- Attempt to match this screen to the real screens
+ print("reloader: Attempting to match geometry for incoming screen ", thisscreen.id)
+ local thisgeom = thisscreen.geometry
+ local foundscreen
+ for i = 1, screen.count() do
+ local scr = screen[i]
+ local scrgeom = scr.geometry
+ if thisgeom.x == scrgeom.x and
+ thisgeom.y == scrgeom.y and
+ thisgeom.width == scrgeom.width and
+ thisgeom.height == scrgeom.height then
+ foundscreen = i
+ end
+ end
+ if not foundscreen then
+ for i = 1, screen.count() do
+ local scr = screen[i]
+ local scrgeom = scr.geometry
+ if thisgeom.width == scrgeom.width and
+ thisgeom.height == scrgeom.height then
+ foundscreen = i
+ end
+ end
+ end
+ if not foundscreen then
+ -- If we've not found a candidate then drop it onto screen 1
+ foundscreen = 1
+ end
+ print("reloader: Mapping screen", thisscreen.id, "to", foundscreen)
+ screenmap[thisscreen.id] = foundscreen
+ end
+ -- We've mapped the screens, so now we run through, preparing the tags
+ -- We merge tags which were named the same if they fold onto screen 1
+ local folding_tag_map = {}
+ for i = 1, screen.count() do
+ folding_tag_map[i] = { _byid = {}}
+ end
+ for _, thisscreen in ipairs(screens) do
+ for _, tagtab in ipairs(thisscreen.tags) do
+ tagtab.props.name = tagtab.name
+ local newtag = (folding_tag_map[screenmap[thisscreen.id]][tagtab.name] or
+ shifty.add(tagtab.props))
+ print("reloader: tag", newtag, "is", tagtab.name, "on", thisscreen.id, "[",screenmap[thisscreen.id], "]")
+ if not folding_tag_map[screenmap[thisscreen.id]][tagtab.name] then
+ folding_tag_map[screenmap[thisscreen.id]][tagtab.name] = newtag
+ local by = folding_tag_map[screenmap[thisscreen.id]]._byid
+ by[#by+1] = newtag
+ print("reloader: that tag is nr", #by, "on my list")
+ end
+ -- The client tag map has weak values which means that
+ -- the result might be nil on read
+ client_tag_map[tagtab.id] = newtag
+ end
+ end
+ -- Tags are folded and prepped, assign them to screens
+ for i = 1, screen.count() do
+ --[[ -- Seems to be bullshit
+ print("reloader: clearing tags for screen", i)
+ local tags_to_del = screen[i]:tags()
+ for i, tag in ipairs(tags_to_del) do
+ print("reloader: dumping tag", tag)
+ shifty.del(tag)
+ end
+ --]]
+ assert(next(folding_tag_map[i]._byid), "No tags for screen " .. tostring(i))
+ screen[i]:tags(folding_tag_map[i]._byid)
+ awful.tag.viewonly(folding_tag_map[i]._byid[1])
+ end
+ -- Right now, there's probably no clients (phew) so we'll not
+ -- worry too much about assigning them anywhere.
+ -- Just build the client_data_map for try_place_client later
+ for _, thisclient in ipairs(clients) do
+ print("reloader: defined client", thisclient.id)
+ client_data_map[tonumber(thisclient.id)] = thisclient
+ end
+ -- Aaaand we're done
+end
+
+function prepare_reload_state(fname)
+ -- The filename is where the reloader state will be.
+ reloader_filename = fname
+ local f = io.open(fname, "r")
+ if f then
+ f:close()
+ local ok, msg = pcall(load_restore_state, fname)
+ if not ok then
+ naughty.notify { title = "Failure restoring state", text = msg }
+ print("reloader: Error loading",fname,"::",msg)
+ -- Zero off any client map
+ client_data_map = {}
+ end
+ os.execute(("mv %q %q"):format(fname, fname .. ".old"))
+ end
+ -- Either way, register the atexit
+ print "reloader: connecting atexit"
+ awesome.connect_signal("exit", reloader_atexit)
+end
+
+function try_place_client(c, startup)
+ -- Perform a client placement if we can find hints for it This is
+ -- done *only* during startup management. Startup management is
+ -- done during awesome startup. so it will only happen once we're
+ -- loaded and then reloaded.
+ if not startup then return end
+ print("placement: Attempting to place", c.window)
+ local datamap = client_data_map[tonumber(c.window)]
+ if datamap then
+ client_data_map[c.window] = nil
+ else
+ print("placement: Could not find mapping for", c.window)
+ return
+ end
+ -- Apply the settings from the map to the client.
+ -- First, make sure it's on the right tag and screen
+ c.screen = client_screen_map[datamap.screen]
+ print("placement: Client asked for screen", datamap.screen,
+ "which is really screen", c.screen)
+ local tags, tagset = {}, {}
+ for _, id in ipairs(datamap.tags) do
+ local thistag = client_tag_map[id]
+ print("placement: Client in tag", id, "which is", thistag)
+ if not thistag then
+ -- if we failed to map this tag, we treat it as the first
+ -- tag on the first screen
+ thistag = screen[c.screen]:tags()[1]
+ end
+ if not tagset[thistag] then
+ tags[#tags+1] = thistag
+ tagset[thistag] = true
+ end
+ end
+ if #tags == 0 then
+ print("placement: Could not identify tag, defaulting...")
+ tags[1] = screen[c.screen]:tags()[1]
+ end
+ c:tags(tags)
+ -- Now apply geometry
+ c:geometry(datamap.geometry)
+ -- Now the boolean properties
+ for _, prop in ipairs{"maximized_horizontal", "maximized_vertical", "minimized"} do
+ print("placement: setting",prop,"to",datamap[prop])
+ c[prop] = datamap[prop]
+ end
+ -- We're done restoring this client. Woop Woop Woop
+end
+
diff --git a/awesomerc/rc-git/shifty.lua b/awesomerc/rc-git/shifty.lua
new file mode 100644
index 0000000..510c1ef
--- /dev/null
+++ b/awesomerc/rc-git/shifty.lua
@@ -0,0 +1,845 @@
+--- Shifty: Dynamic tagging library for awesome3-git
+-- @author koniu &lt;gkusnierz@gmail.com&gt;
+-- @author bioe007 &lt;perry.hargrave@gmail.com&gt;
+--
+-- http://awesome.naquadah.org/wiki/index.php?title=Shifty
+
+-- {{{ environment
+local type = type
+local ctag = tag
+local ipairs = ipairs
+local table = table
+local client = client
+local image = image
+local string = string
+local screen = screen
+local button = button
+local mouse = mouse
+local beautiful = require("beautiful")
+local awful = require("awful")
+local pairs = pairs
+local io = io
+local tonumber = tonumber
+local wibox = wibox
+local root = root
+local dbg= dbg
+local timer = timer
+local assert = assert
+local tostring = tostring
+local lselect = select
+
+module("shifty")
+-- }}}
+
+-- {{{ variables
+config = {}
+config.tags = {}
+config.apps = {}
+config.defaults = {}
+config.guess_name = true
+config.guess_position = true
+config.remember_index = true
+config.default_name = "new"
+config.clientkeys = {}
+config.globalkeys = nil
+config.layouts = {}
+config.prompt_sources = { "config_tags", "config_apps", "existing", "history" }
+config.prompt_matchers = { "^", ":", "" }
+
+local matchp = ""
+local index_cache = {}
+for i = 1, screen.count() do index_cache[i] = {} end
+-- }}}
+
+--{{{ name2tags: matches string 'name' to tag objects
+-- @param name : tag name to find
+-- @param scr : screen to look for tags on
+-- @return table of tag objects or nil
+function name2tags(name, scr)
+ local ret = {}
+ local a, b = scr or 1, scr or screen.count()
+ for s = a, b do
+ for i, t in ipairs(screen[s]:tags()) do
+ if name == t.name then
+ table.insert(ret, t)
+ end
+ end
+ end
+ if #ret > 0 then return ret end
+end
+
+function name2tag(name, scr, idx)
+ local ts = name2tags(name, scr)
+ if ts then return ts[idx or 1] end
+end
+--}}}
+
+--{{{ tag2index: finds index of a tag object
+-- @param scr : screen number to look for tag on
+-- @param tag : the tag object to find
+-- @return the index [or zero] or end of the list
+function tag2index(scr, tag)
+ local scrn = screen[scr]
+ local tags = scrn:tags()
+ for i,t in ipairs(tags) do
+ if t == tag then return i end
+ end
+end
+--}}}
+
+--{{{ rename
+--@param tag: tag object to be renamed
+--@param prefix: if any prefix is to be added
+--@param no_selectall:
+function rename(tag, prefix, no_selectall)
+ local theme = beautiful.get()
+ local t = tag or awful.tag.selected(mouse.screen)
+ local scr = t.screen
+ local bg = nil
+ local fg = nil
+ local text = prefix or t.name
+ local before = t.name
+
+ if t == awful.tag.selected(scr) then
+ bg = theme.bg_focus or '#535d6c'
+ fg = theme.fg_urgent or '#ffffff'
+ else
+ bg = theme.bg_normal or '#222222'
+ fg = theme.fg_urgent or '#ffffff'
+ end
+
+ local textwidget = taglist[scr].widgets[tag2index(scr,t)].widget.widgets[2].widget
+
+ awful.prompt.run( {
+ fg_cursor = fg, bg_cursor = bg, ul_cursor = "single",
+ text = text, selectall = not no_selectall },
+ textwidget,
+ function (name) if name:len() > 0 then t.name = name; end end,
+ completion,
+ awful.util.getdir("cache") .. "/history_tags", nil,
+ function ()
+ if t.name == before then
+ if awful.tag.getproperty(t, "initial") then del(t) end
+ else
+ awful.tag.setproperty(t, "initial", true)
+ set(t)
+ end
+ tagkeys(screen[scr])
+ t:emit_signal("property::name")
+ end
+ )
+end
+--}}}
+
+--{{{ send: moves client to tag[idx]
+-- maybe this isn't needed here in shifty?
+-- @param idx the tag number to send a client to
+function send(idx)
+ local scr = client.focus.screen or mouse.screen
+ local sel = awful.tag.selected(scr)
+ local sel_idx = tag2index(scr,sel)
+ local tags = screen[scr]:tags()
+ local target = awful.util.cycle(#tags, sel_idx + idx)
+ awful.client.movetotag(tags[target], client.focus)
+ awful.tag.viewonly(tags[target])
+end
+
+function send_next() send(1) end
+function send_prev() send(-1) end
+--}}}
+
+--{{{ pos2idx: translate shifty position to tag index
+--@param pos: position (an integer)
+--@param scr: screen number
+function pos2idx(pos, scr)
+ local v = 1
+ if pos and scr then
+ for i = #screen[scr]:tags() , 1, -1 do
+ local t = screen[scr]:tags()[i]
+ if awful.tag.getproperty(t,"position") and awful.tag.getproperty(t,"position") <= pos then
+ v = i + 1
+ break
+ end
+ end
+ end
+ return v
+end
+--}}}
+
+--{{{ select : helper function chooses the first non-nil argument
+--@param args - table of arguments
+function select(args)
+ for i, a in pairs(args) do
+ if a ~= nil then
+ return a
+ end
+ end
+end
+--}}}
+
+--{{{ tagtoscr : move an entire tag to another screen
+--
+--@param scr : the screen to move tag to
+--@param t : the tag to be moved [awful.tag.selected()]
+--@return the tag
+function tagtoscr(scr, t)
+ -- break if called with an invalid screen number
+ if not scr or scr < 1 or scr > screen.count() then return end
+ -- tag to move
+ local otag = t or awful.tag.selected()
+
+ -- set screen and then reset tag to order properly
+ if #otag:clients() > 0 then
+ for _ , c in ipairs(otag:clients()) do
+ if not c.sticky then
+ c.screen = scr
+ c:tags( { otag } )
+ else
+ awful.client.toggletag(otag,c)
+ end
+ end
+ end
+ return otag
+end
+---}}}
+
+--{{{ set : set a tags properties
+--@param t: the tag
+--@param args : a table of optional (?) tag properties
+--@return t - the tag object
+function set(t, args)
+ if not t then return end
+ if not args then args = {} end
+
+ -- set the name
+ t.name = args.name or t.name
+
+ -- attempt to load preset on initial run
+ local preset = (awful.tag.getproperty(t, "initial") and config.tags[t.name]) or {}
+
+ -- pick screen and get its tag table
+ local scr = args.screen or (not t.screen and preset.screen) or t.screen or mouse.screen
+ if scr > screen.count() then scr = screen.count() end
+ if t.screen and scr ~= t.screen then
+ tagtoscr(scr, t)
+ t.screen = nil
+ end
+ local tags = screen[scr]:tags()
+
+ -- try to guess position from the name
+ local guessed_position = nil
+ if not (args.position or preset.position) and config.guess_position then
+ local num = t.name:find('^[1-9]')
+ if num then guessed_position = tonumber(t.name:sub(1,1)) end
+ end
+
+ -- select from args, preset, getproperty, config.defaults.configs or defaults
+ local props = {
+ layout = select{ args.layout, preset.layout, awful.tag.getproperty(t,"layout"), config.defaults.layout, awful.layout.suit.tile },
+ mwfact = select{ args.mwfact, preset.mwfact, awful.tag.getproperty(t,"mwfact"), config.defaults.mwfact, 0.55 },
+ nmaster = select{ args.nmaster, preset.nmaster, awful.tag.getproperty(t,"nmaster"), config.defaults.nmaster, 1 },
+ ncol = select{ args.ncol, preset.ncol, awful.tag.getproperty(t,"ncol"), config.defaults.ncol, 1 },
+ matched = select{ args.matched, awful.tag.getproperty(t,"matched") },
+ exclusive = select{ args.exclusive, preset.exclusive, awful.tag.getproperty(t,"exclusive"), config.defaults.exclusive },
+ persist = select{ args.persist, preset.persist, awful.tag.getproperty(t,"persist"), config.defaults.persist },
+ nopopup = select{ args.nopopup, preset.nopopup, awful.tag.getproperty(t,"nopopup"), config.defaults.nopopup },
+ leave_kills = select{ args.leave_kills, preset.leave_kills, awful.tag.getproperty(t,"leave_kills"), config.defaults.leave_kills },
+ max_clients = select{ args.max_clients, preset.max_clients, awful.tag.getproperty(t,"max_clients"), config.defaults.max_clients },
+ position = select{ args.position, preset.position, guessed_position, awful.tag.getproperty(t,"position" ) },
+ icon = select{ args.icon and image(args.icon), preset.icon and image(preset.icon), awful.tag.getproperty(t,"icon"), config.defaults.icon and image(config.defaults.icon) },
+ icon_only = select{ args.icon_only, preset.icon_only, awful.tag.getproperty(t,"icon_only"), config.defaults.icon_only },
+ sweep_delay = select{ args.sweep_delay, preset.sweep_delay, awful.tag.getproperty(t,"sweep_delay"), config.defaults.sweep_delay },
+ overload_keys = select{ args.overload_keys, preset.overload_keys, awful.tag.getproperty(t,"overload_keys"), config.defaults.overload_keys },
+ }
+
+ -- get layout by name if given as string
+ if type(props.layout) == "string" then
+ props.layout = getlayout(props.layout)
+ end
+
+ -- set keys
+ if args.keys or preset.keys then
+ local keys = awful.util.table.join(config.globalkeys, args.keys or preset.keys)
+ if props.overload_keys then
+ props.keys = keys
+ else
+ props.keys = squash_keys(keys)
+ end
+ end
+
+ -- calculate desired taglist index
+ local index = args.index or preset.index or config.defaults.index
+ local rel_index = args.rel_index or preset.rel_index or config.defaults.rel_index
+ local sel = awful.tag.selected(scr)
+ local sel_idx = (sel and tag2index(scr,sel)) or 0 --TODO: what happens with rel_idx if no tags selected
+ local t_idx = tag2index(scr,t)
+ local limit = (not t_idx and #tags + 1) or #tags
+ local idx = nil
+
+ if rel_index then
+ idx = awful.util.cycle(limit, (t_idx or sel_idx) + rel_index)
+ elseif index then
+ idx = awful.util.cycle(limit, index)
+ elseif props.position then
+ idx = pos2idx(props.position, scr)
+ if t_idx and t_idx < idx then idx = idx - 1 end
+ elseif config.remember_index and index_cache[scr][t.name] then
+ idx = index_cache[scr][t.name]
+ elseif not t_idx then
+ idx = #tags + 1
+ end
+
+ -- if we have a new index, remove from old index and insert
+ if idx then
+ if t_idx then table.remove(tags, t_idx) end
+ table.insert(tags, idx, t)
+ index_cache[scr][t.name] = idx
+ end
+
+ -- set tag properties and push the new tag table
+ screen[scr]:tags(tags)
+ for prop, val in pairs(props) do awful.tag.setproperty(t, prop, val) end
+
+ -- execute run/spawn
+ if awful.tag.getproperty(t, "initial") then
+ local spawn = args.spawn or preset.spawn or config.defaults.spawn
+ local run = args.run or preset.run or config.defaults.run
+ if spawn and args.matched ~= true then awful.util.spawn_with_shell(spawn, scr) end
+ if run then run(t) end
+ awful.tag.setproperty(t, "initial", nil)
+ end
+
+ return t
+end
+
+function shift_next() set(awful.tag.selected(), { rel_index = 1 }) end
+function shift_prev() set(awful.tag.selected(), { rel_index = -1 }) end
+--}}}
+
+--{{{ add : adds a tag
+--@param args: table of optional arguments
+--
+function add(args)
+ if not args then args = {} end
+ local name = args.name or " "
+
+ -- initialize a new tag object and its data structure
+ local t = ctag{ name = name }
+
+ -- tell set() that this is the first time
+ awful.tag.setproperty(t, "initial", true)
+
+ -- apply tag settings
+ set(t, args)
+
+ -- unless forbidden or if first tag on the screen, show the tag
+ if not (awful.tag.getproperty(t,"nopopup") or args.noswitch) or #screen[t.screen]:tags() == 1 then awful.tag.viewonly(t) end
+
+ -- get the name or rename
+ if args.name then
+ t.name = args.name
+ else
+ -- FIXME: hack to delay rename for un-named tags for tackling taglist refresh
+ -- which disabled prompt from being rendered until input
+ awful.tag.setproperty(t, "initial", true)
+ local f
+ if args.position then
+ f = function() rename(t, args.rename, true); tmr:stop() end
+ else
+ f = function() rename(t); tmr:stop() end
+ end
+ tmr = timer({ timeout = 0.01 })
+ tmr:connect_signal("timeout", f)
+ tmr:start()
+ end
+
+ return t
+end
+--}}}
+
+--{{{ del : delete a tag
+--@param tag : the tag to be deleted [current tag]
+function del(tag)
+ local scr = (tag and tag.screen) or mouse.screen or 1
+ local tags = screen[scr]:tags()
+ local sel = awful.tag.selected(scr)
+ local t = tag or sel
+ local idx = tag2index(scr,t)
+
+ -- return if tag not empty (except sticky)
+ local clients = t:clients()
+ local sticky = 0
+ for i, c in ipairs(clients) do
+ if c.sticky then sticky = sticky + 1 end
+ end
+ if #clients > sticky then return end
+
+ -- store index for later
+ index_cache[scr][t.name] = idx
+
+ -- remove tag
+ t.screen = nil
+
+ -- if the current tag is being deleted, restore from history
+ if t == sel and #tags > 1 then
+ awful.tag.history.restore(scr,1)
+ -- this is supposed to cycle if history is invalid?
+ -- e.g. if many tags are deleted in a row
+ if not awful.tag.selected(scr) then
+ awful.tag.viewonly(tags[awful.util.cycle(#tags, idx - 1)])
+ end
+ end
+
+ -- FIXME: what is this for??
+ if client.focus then client.focus:raise() end
+end
+--}}}
+
+function print(...)
+ do return end
+ local t = {...}
+ local n = lselect("#",...)
+ io.stderr:write(tostring(t[1]))
+ for i = 2,n do
+ io.stderr:write("\t" .. tostring(t[i]))
+ end
+ io.stderr:write("\n")
+end
+
+--{{{ match : handles app->tag matching, a replacement for the manage hook in
+-- rc.lua
+--@param c : client to be matched
+function match(c, startup)
+ local nopopup, intrusive, nofocus, run, slave, wfact, struts, geom, float
+ local target_tag_names, target_tags = {}, {}
+ local typ = c.type
+ local cls = c.class
+ local inst = c.instance
+ local role = c.role
+ local name = c.name
+ local keys = config.clientkeys or c:keys() or {}
+ local target_screen = mouse.screen
+
+ run = {}
+
+ c.border_color = beautiful.border_normal
+ c.border_width = beautiful.border_width
+
+ print("New Client!")
+ print("Class", cls)
+ print("Instance", instance)
+ print("Role", role)
+ print("Name", name)
+ print("Type", typ)
+ print("Here we go...")
+
+ -- try matching client to config.apps
+ for i, a in ipairs(config.apps) do
+ if a.match then
+ for k, w in ipairs(a.match) do
+ print("Considering", w)
+ if
+ (cls and cls:find(w)) or
+ (inst and inst:find(w)) or
+ (name and name:find(w)) or
+ (role and role:find(w)) or
+ (typ and typ:find(w))
+ then
+ print("Woop, useful stuffs here")
+ if a.screen then target_screen = a.screen end
+ if a.tag then
+ if type(a.tag) == "string" then
+ target_tag_names = { a.tag }
+ else
+ target_tag_names = a.tag
+ end
+ end
+ if a.startup and startup then a = awful.util.table.join(a, a.startup) end
+ if a.geometry ~=nil then geom = { x = a.geometry[1], y = a.geometry[2], width = a.geometry[3], height = a.geometry[4] } end
+ if a.float ~= nil then float = a.float end
+ if a.slave ~=nil then slave = a.slave end
+ if a.border_width ~= nil then c.border_width = a.border_width end
+ if a.nopopup ~=nil then nopopup = a.nopopup end
+ if a.intrusive ~=nil then intrusive = a.intrusive end
+ if a.fullscreen ~=nil then c.fullscreen = a.fullscreen end
+ if a.honorsizehints ~=nil then c.size_hints_honor = a.honorsizehints end
+ if a.kill ~=nil then c:kill(); return end
+ if a.ontop ~= nil then c.ontop = a.ontop end
+ if a.above ~= nil then c.above = a.above end
+ if a.below ~= nil then c.below = a.below end
+ if a.buttons ~= nil then c:buttons(a.buttons) end
+ if a.nofocus ~= nil then nofocus = a.nofocus end
+ if a.keys ~= nil then keys = awful.util.table.join(keys, a.keys) end
+ if a.hidden ~= nil then c.hidden = a.hidden end
+ if a.minimized ~= nil then c.minimized = a.minimized end
+ if a.dockable ~= nil then awful.client.dockable.set(c, a.dockable) end
+ if a.urgent ~= nil then c.urgent = a.urgent end
+ if a.opacity ~= nil then c.opacity = a.opacity end
+ if a.run ~= nil then run[#run+1] = a.run end
+ if a.sticky ~= nil then c.sticky = a.sticky end
+ if a.wfact ~= nil then wfact = a.wfact end
+ if a.struts then struts = a.struts end
+ if a.skip_taskbar ~= nil then c.skip_taskbar = a.skip_taskbar end
+ if a.props then
+ for kk, vv in pairs(a.props) do awful.client.property.set(c, kk, vv) end
+ end
+ end
+ end
+ end
+ end
+
+ print("Finished?")
+
+ -- set key bindings
+ c:keys(keys)
+
+ -- set properties of floating clients
+ if awful.client.floating.get(c) then
+ awful.placement.centered(c, c.transient_for)
+ awful.placement.no_offscreen(c) -- this always seems to stick the client at 0,0 (incl titlebar)
+ end
+
+ -- if not matched to some names try putting client in c.transient_for or current tags
+ local sel = awful.tag.selectedlist(target_screen)
+ if not target_tag_names or #target_tag_names == 0 then
+ if c.transient_for then
+ target_tags = c.transient_for:tags()
+ elseif #sel > 0 then
+ for i, t in ipairs(sel) do
+ local mc = awful.tag.getproperty(t,"max_clients")
+ if not (awful.tag.getproperty(t,"exclusive") or (mc and mc >= #t:clients())) or intrusive then
+ table.insert(target_tags, t)
+ end
+ end
+ end
+ end
+
+ -- if we still don't know any target names/tags guess name from class or use default
+ if (not target_tag_names or #target_tag_names == 0) and (not target_tags or #target_tags == 0) then
+ if config.guess_name and cls then
+ target_tag_names = { cls:lower() }
+ else
+ target_tag_names = { config.default_name }
+ end
+ end
+
+ -- translate target names to tag objects, creating missing ones
+ if #target_tag_names > 0 and #target_tags == 0 then
+ for i, tn in ipairs(target_tag_names) do
+ local res = {}
+ for j, t in ipairs(name2tags(tn, target_screen) or name2tags(tn) or {}) do
+ local mc = awful.tag.getproperty(t,"max_clients")
+ if not (mc and (#t:clients() >= mc)) or intrusive then
+ table.insert(res, t)
+ end
+ end
+ if #res == 0 then
+ table.insert(target_tags, add({ name = tn, noswitch = true, matched = true }))
+ else
+ target_tags = awful.util.table.join(target_tags, res)
+ end
+ end
+ end
+
+ -- set client's screen/tag if needed
+ target_screen = target_tags[1].screen or target_screen
+ if c.screen ~= target_screen then c.screen = target_screen end
+ if slave then awful.client.setslave(c) end
+ c:tags( target_tags )
+ if wfact then awful.client.setwfact(wfact, c) end
+ if float ~= nil then awful.client.floating.set(c, float) end
+ if geom then c:geometry(geom) end
+ if struts then c:struts(struts) end
+
+ -- switch or highlight
+ local showtags = {}
+ local u = nil
+ if #target_tags > 0 and not startup then
+ for i,t in ipairs(target_tags) do
+ if not(awful.tag.getproperty(t,"nopopup") or nopopup) then
+ table.insert(showtags, t)
+ elseif not startup then
+ c.urgent = true
+ end
+ end
+ if #showtags > 0 then
+ local ident = true
+ for kk,vv in pairs(showtags) do
+ if sel[kk] ~= vv then ident = false; break end
+ end
+ if not ident then
+ awful.tag.viewmore(showtags, c.screen)
+ end
+ end
+ end
+
+ -- focus and raise accordingly or lower if supressed
+ if not (nofocus or c.hidden or c.minimized) then
+ if (awful.tag.getproperty(target,"nopopup") or nopopup) and (target and target ~= sel) then
+ awful.client.focus.history.add(c)
+ else
+ client.focus = c
+ end
+ c:raise()
+ else
+ c:lower()
+ end
+
+ -- execute run functions if specified
+ if #run > 0 then
+ for _, f in ipairs(run) do
+ f(c, startup, target)
+ end
+ end
+end
+--}}}
+
+--{{{ sweep : hook function that marks tags as used, visited, deserted
+-- also handles deleting used and empty tags
+function sweep()
+ for s = 1, screen.count() do
+ for i, t in ipairs(screen[s]:tags()) do
+ local clients = t:clients()
+ local sticky = 0
+ for i, c in ipairs(clients) do
+ if c.sticky then sticky = sticky + 1 end
+ end
+ if #clients == sticky then
+ if not awful.tag.getproperty(t,"persist") and awful.tag.getproperty(t,"used") then
+ if awful.tag.getproperty(t,"deserted") or not awful.tag.getproperty(t,"leave_kills") then
+ local delay = awful.tag.getproperty(t,"sweep_delay")
+ if delay then
+ local f = function() del(t); tmr:stop() end
+ tmr = timer({ timeout = delay })
+ tmr:connect_signal("timeout", f)
+ tmr:start()
+ else
+ del(t)
+ end
+ else
+ if not t.selected and awful.tag.getproperty(t,"visited") then awful.tag.setproperty(t,"deserted", true) end
+ end
+ end
+ else
+ awful.tag.setproperty(t,"used",true)
+ end
+ if t.selected then awful.tag.setproperty(t,"visited",true) end
+ end
+ end
+end
+--}}}
+
+--{{{ getpos : returns a tag to match position
+-- * originally this function did a lot of client stuff, i think its
+-- * better to leave what can be done by awful to be done by awful
+-- * -perry
+-- @param pos : the index to find
+-- @return v : the tag (found or created) at position == 'pos'
+function getpos(pos)
+ local v = nil
+ local existing = {}
+ local selected = nil
+ local scr = mouse.screen or 1
+ -- search for existing tag assigned to pos
+ for i = 1, screen.count() do
+ local s = awful.util.cycle(screen.count(), scr + i - 1)
+ for j, t in ipairs(screen[s]:tags()) do
+ if awful.tag.getproperty(t,"position") == pos then
+ table.insert(existing, t)
+ if t.selected and s == scr then selected = #existing end
+ end
+ end
+ end
+ if #existing > 0 then
+ -- if makeing another of an existing tag, return the end of the list
+ if selected then v = existing[awful.util.cycle(#existing, selected + 1)] else v = existing[1] end
+ end
+ if not v then
+ -- search for preconf with 'pos' and create it
+ for i, j in pairs(config.tags) do
+ if j.position == pos then v = add({ name = i, position = pos, noswitch = not switch }) end
+ end
+ end
+ if not v then
+ -- not existing, not preconfigured
+ v = add({ position = pos, rename = pos .. ':', no_selectall = true, noswitch = not switch })
+ end
+ return v
+end
+--}}}
+
+--{{{ init : search shifty.config.tags for initial set of tags to open
+function init()
+ local numscr = screen.count()
+
+ for i, j in pairs(config.tags) do
+ local scr = j.screen or 1
+ if j.init and ( scr <= numscr ) then
+ add({ name = i, persist = true, screen = scr, layout = j.layout, mwfact = j.mwfact })
+ end
+ end
+end
+--}}}
+
+--{{{ count : utility function returns the index of a table element
+--FIXME: this is currently used only in remove_dup, so is it really necessary?
+function count(table, element)
+ local v = 0
+ for i, e in pairs(table) do
+ if element == e then v = v + 1 end
+ end
+ return v
+end
+--}}}
+
+--{{{ remove_dup : used by shifty.completion when more than one
+--tag at a position exists
+function remove_dup(table)
+ local v = {}
+ for i, entry in ipairs(table) do
+ if count(v, entry) == 0 then v[#v+ 1] = entry end
+ end
+ return v
+end
+--}}}
+
+--{{{ completion : prompt completion
+--
+function completion(cmd, cur_pos, ncomp, sources, matchers)
+
+ -- get sources and matches tables
+ sources = sources or config.prompt_sources
+ matchers = matchers or config.prompt_matchers
+
+ local get_source = {
+ -- gather names from config.tags
+ config_tags = function()
+ local ret = {}
+ for n, p in pairs(config.tags) do table.insert(ret, n) end
+ return ret
+ end,
+ -- gather names from config.apps
+ config_apps = function()
+ local ret = {}
+ for i, p in pairs(config.apps) do
+ if p.tag then
+ if type(p.tag) == "string" then
+ table.insert(ret, p.tag)
+ else
+ ret = awful.util.table.join(ret, p.tag)
+ end
+ end
+ end
+ return ret
+ end,
+ -- gather names from existing tags, starting with the current screen
+ existing = function()
+ local ret = {}
+ for i = 1, screen.count() do
+ local s = awful.util.cycle(screen.count(), mouse.screen + i - 1)
+ local tags = screen[s]:tags()
+ for j, t in pairs(tags) do table.insert(ret, t.name) end
+ end
+ return ret
+ end,
+ -- gather names from history
+ history = function()
+ local ret = {}
+ local f = io.open(awful.util.getdir("cache") .. "/history_tags")
+ for name in f:lines() do table.insert(ret, name) end
+ f:close()
+ return ret
+ end,
+ }
+
+ -- if empty, match all
+ if #cmd == 0 or cmd == " " then cmd = "" end
+
+ -- match all up to the cursor if moved or no matchphrase
+ if matchp == "" or cmd:sub(cur_pos, cur_pos+#matchp) ~= matchp then
+ matchp = cmd:sub(1, cur_pos)
+ end
+
+ -- find matching commands
+ local matches = {}
+ for i, src in ipairs(sources) do
+ local source = get_source[src]()
+ for j, matcher in ipairs(matchers) do
+ for k, name in ipairs(source) do
+ if name:find(matcher .. matchp) then
+ table.insert(matches, name)
+ end
+ end
+ end
+ end
+
+ -- no matches
+ if #matches == 0 then return cmd, cur_pos end
+
+ -- remove duplicates
+ matches = remove_dup(matches)
+
+ -- cycle
+ while ncomp > #matches do ncomp = ncomp - #matches end
+
+ -- put cursor at the end of the matched phrase
+ if #matches == 1 then
+ cur_pos = #matches[ncomp] + 1
+ else
+ cur_pos = matches[ncomp]:find(matchp) + #matchp
+ end
+
+ -- return match and position
+ return matches[ncomp], cur_pos
+end
+--}}}
+
+-- {{{ tagkeys : hook function that sets keybindings per tag
+function tagkeys(s)
+ local sel = awful.tag.selected(s.index)
+ local keys = awful.tag.getproperty(sel, "keys") or config.globalkeys
+ if keys and sel.selected then root.keys(keys) end
+end
+-- }}}
+
+-- {{{ squash_keys: helper function which removes duplicate keybindings
+-- by picking only the last one to be listed in keys table arg
+function squash_keys(keys)
+ local squashed = {}
+ local ret = {}
+ for i, k in ipairs(keys) do
+ squashed[table.concat(k.modifiers) .. k.key] = k
+ end
+ for i, k in pairs(squashed) do
+ table.insert(ret, k)
+ end
+ return ret
+end
+-- }}}
+
+-- {{{ getlayout: returns a layout by name
+function getlayout(name)
+ for _, layout in ipairs(config.layouts) do
+ if awful.layout.getname(layout) == name then return layout end
+ end
+end
+-- }}}
+
+-- {{{ signals
+client.connect_signal("manage", match )
+client.connect_signal("unmanage", sweep)
+client.disconnect_signal("manage", awful.tag.withcurrent)
+
+for s = 1, screen.count() do
+ awful.tag.attached_connect_signal(s, "property::selected", sweep)
+ awful.tag.attached_connect_signal(s, "tagged", sweep)
+ screen[s]:connect_signal("tag::history::update", tagkeys)
+end
+
+for _,prop in ipairs { "visited", "initial", "matched", "used", "persist", "position" } do
+ ctag.add_signal("property::" .. prop)
+end
+
+-- }}}
+
+-- vim: foldmethod=marker:filetype=lua:expandtab:shiftwidth=2:tabstop=2:softtabstop=2:encoding=utf-8:textwidth=80
diff --git a/awesomerc/rc-git/shiftyconfig.lua b/awesomerc/rc-git/shiftyconfig.lua
new file mode 100644
index 0000000..8d8c565
--- /dev/null
+++ b/awesomerc/rc-git/shiftyconfig.lua
@@ -0,0 +1,107 @@
+-- Shifty configuration for Daniel's Awesome
+
+local awful = require 'awful'
+local shifty = require 'shifty'
+local beautiful = require 'beautiful'
+local tjoin = awful.util.table.join
+local reloader = require 'reloader'
+
+module(..., package.seeall)
+
+function go(modkey)
+
+shifty.config.tags = {
+ ["1:mail"] = {
+ init = true,
+ position = 1,
+ screen = 1,
+ mwfact = 0.60,
+ layout = awful.layout.suit.max,
+ },
+ ["2:term"] = {
+ persist = true,
+ position = 2,
+ },
+ ["3:www"] = {
+ --exclusive = true,
+ --max_clients = 1,
+ position = 3,
+ layout = awful.layout.suit.max,
+ },
+ ["4:emacs"] = {
+ position = 4,
+ layout = awful.layout.suit.max,
+ },
+ ["8:spotify"] = {
+ position = 8,
+ layout = awful.layout.suit.floating,
+ },
+ ["9:vmware"] = {
+ position = 9,
+ layout = awful.layout.suit.max,
+ },
+}
+
+local function handle_placement(c, startup)
+ if not startup then
+ -- Put windows in a smart way, only if they does not set an initial position.
+ if not c.size_hints.user_position and not c.size_hints.program_position then
+ awful.placement.no_overlap(c)
+ awful.placement.no_offscreen(c)
+ end
+ else
+ -- We're doing startup management, which means we should ask our funky
+ -- restoration module if there's anything it can do for our client.
+ reloader.try_place_client(c)
+ end
+end
+
+shifty.config.apps = {
+ { match = {"^Google%-chrome.*" },
+ tag = "3:www",
+ },
+
+ { match = {"^Gnome%-terminal.*" },
+ honorsizehints = false,
+ },
+
+ { match = { "^Mutt$", "^OfflineIMAP$" },
+ tag = "1:mail",
+-- props = {
+-- maximized_horizontal = true,
+-- maximized_vertical = true,
+-- },
+ },
+
+ { match = { "^Vmware$" },
+ tag = "9:vmware",
+ },
+
+ { match = { "^Spotify$" },
+ tag = "8:spotify",
+ },
+
+ { match = {"^Emacs$" },
+ tag = "4:emacs",
+ honorsizehints = false,
+ },
+
+ { match = { "" },
+ buttons = tjoin(
+ awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
+ awful.button({ modkey }, 1, function (c) awful.mouse.client.move() end),
+ awful.button({ modkey }, 3, awful.mouse.client.resize )
+ ),
+ border_width = beautiful.border_width,
+ border_color = beautiful.border_normal,
+ focus = true,
+ run = handle_placement,
+ },
+}
+
+shifty.config.defaults = {
+ layout = awful.layout.suit.floating,
+ run = function(tag) naughty.notify({ text = "New Tag: " .. tostring(tag.name) }) end,
+}
+end
+