Cleaning up unneeded things

This commit is contained in:
crater2150 2011-05-10 21:03:57 +02:00
parent 19e4095e5e
commit c8b66801ba
83 changed files with 0 additions and 1287 deletions

View file

@ -1,53 +0,0 @@
--- Spawns cmd if no client can be found matching properties
-- If such a client can be found, pop to first tag where it is visible, and give it focus
-- @param cmd the command to execute
-- @param properties a table of properties to match against clients. Possible entries: any properties of the client object
function runraise(cmd, properties)
local clients = client.get()
local focused = awful.client.next(0)
local findex = 0
local matched_clients = {}
local n = 0
for i, c in pairs(clients) do
--make an array of matched clients
if awful.rules.match(properties, c) then
n = n + 1
matched_clients[n] = c
if c == focused then
findex = n
end
end
end
if n > 0 then
local c = matched_clients[1]
-- if the focused window matched switch focus to next in list
if 0 < findex and findex < n then
c = matched_clients[findex+1]
end
local ctags = c:tags()
if table.getn(ctags) == 0 then
-- ctags is empty, show client on current tag
local curtag = awful.tag.selected()
awful.client.movetotag(curtag, c)
else
-- Otherwise, pop to first tag client is visible on
awful.tag.viewonly(ctags[1])
end
-- And then focus the client
client.focus = c
c:raise()
return
end
awful.util.spawn(cmd)
end
-- Returns true if all pairs in table1 are present in table2
function match (table1, table2)
for k, v in pairs(table1) do
if table2[k] ~= v and not table2[k]:find(v) then
return false
end
end
return true
end

View file

@ -1,12 +0,0 @@
All 'awesome' icons in this package were created by Adrian C. (anrxc).
They are licensed under the same terms as the awesome distribution itself
- GNU General Public License version 2. To view a human-readable summary
of this license, visit: http://creativecommons.org/licenses/GPL/2.0/
The widget icons with the exception of: 'chat', 'crypt', 'power' and
'rss' icons (which were made by me) were originally made by 'sm4tik'
for purposes of 'dzen', I could not find any licensing information
attached to those original bitmaps. Assuming they are in the public
domain I am licensing the widget icons under the terms of the
Creative Commons Attribution-Share Alike license. To view a copy of
this license, visit: http://creativecommons.org/licenses/by-sa/3.0/

Binary file not shown.

Before

Width:  |  Height:  |  Size: 205 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 214 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 217 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 216 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 235 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 219 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 201 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 189 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 216 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 194 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 179 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 201 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 180 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 395 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 190 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 202 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 182 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 209 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 184 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 313 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 190 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 215 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 174 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 195 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 177 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 172 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 189 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 195 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 177 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 192 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 213 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 203 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 192 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 226 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 232 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 222 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 203 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 226 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 440 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 203 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 187 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 377 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 163 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 210 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 377 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 377 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 345 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 334 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 240 B

View file

@ -1,92 +0,0 @@
---------------------------
-- Default awesome theme --
---------------------------
theme = {}
theme.font = "fixed 6"
theme.bg_normal = "#222222"
theme.bg_focus = "#535d6c"
theme.bg_urgent = "#ff0000"
theme.bg_minimize = "#444444"
theme.fg_normal = "#aaaaaa"
theme.fg_focus = "#ffffff"
theme.fg_urgent = "#ffffff"
theme.fg_minimize = "#ffffff"
theme.border_width = "0"
theme.border_normal = "#00000000"
theme.border_focus = "#535d6c55"
theme.border_marked = "#91231c55"
-- There are another variables sets
-- overriding the default one when
-- defined, the sets are:
-- [taglist|tasklist]_[bg|fg]_[focus|urgent]
-- titlebar_[bg|fg]_[normal|focus]
-- Example:
--taglist_bg_focus = #ff0000
-- Display the taglist squares
theme.taglist_squares_sel = "/usr/share/awesome/themes/default/taglist/squarefw.png"
theme.taglist_squares_unsel = "/usr/share/awesome/themes/default/taglist/squarefw.png"
theme.tasklist_floating_icon = "/usr/share/awesome/themes/default/tasklist/floatingw.png"
-- Variables set for theming menu
-- menu_[bg|fg]_[normal|focus]
-- menu_[border_color|border_width]
theme.menu_submenu_icon = "/usr/share/awesome/themes/default/submenu.png"
theme.menu_height = "12"
theme.menu_width = "100"
-- You can add as many variables as
-- you wish and access them by using
-- beautiful.variable in your rc.lua
--bg_widget = #cc0000
-- Define the image to load
theme.titlebar_close_button_normal = "/usr/share/awesome/themes/default/titlebar/close_normal.png"
theme.titlebar_close_button_focus = "/usr/share/awesome/themes/default/titlebar/close_focus.png"
theme.titlebar_ontop_button_normal_inactive = "/usr/share/awesome/themes/default/titlebar/ontop_normal_inactive.png"
theme.titlebar_ontop_button_focus_inactive = "/usr/share/awesome/themes/default/titlebar/ontop_focus_inactive.png"
theme.titlebar_ontop_button_normal_active = "/usr/share/awesome/themes/default/titlebar/ontop_normal_active.png"
theme.titlebar_ontop_button_focus_active = "/usr/share/awesome/themes/default/titlebar/ontop_focus_active.png"
theme.titlebar_sticky_button_normal_inactive = "/usr/share/awesome/themes/default/titlebar/sticky_normal_inactive.png"
theme.titlebar_sticky_button_focus_inactive = "/usr/share/awesome/themes/default/titlebar/sticky_focus_inactive.png"
theme.titlebar_sticky_button_normal_active = "/usr/share/awesome/themes/default/titlebar/sticky_normal_active.png"
theme.titlebar_sticky_button_focus_active = "/usr/share/awesome/themes/default/titlebar/sticky_focus_active.png"
theme.titlebar_floating_button_normal_inactive = "/usr/share/awesome/themes/default/titlebar/floating_normal_inactive.png"
theme.titlebar_floating_button_focus_inactive = "/usr/share/awesome/themes/default/titlebar/floating_focus_inactive.png"
theme.titlebar_floating_button_normal_active = "/usr/share/awesome/themes/default/titlebar/floating_normal_active.png"
theme.titlebar_floating_button_focus_active = "/usr/share/awesome/themes/default/titlebar/floating_focus_active.png"
theme.titlebar_maximized_button_normal_inactive = "/usr/share/awesome/themes/default/titlebar/maximized_normal_inactive.png"
theme.titlebar_maximized_button_focus_inactive = "/usr/share/awesome/themes/default/titlebar/maximized_focus_inactive.png"
theme.titlebar_maximized_button_normal_active = "/usr/share/awesome/themes/default/titlebar/maximized_normal_active.png"
theme.titlebar_maximized_button_focus_active = "/usr/share/awesome/themes/default/titlebar/maximized_focus_active.png"
-- You can use your own command to set your wallpaper
-- theme.wallpaper_cmd = { "awsetbg /usr/share/awesome/themes/default/background.png" }
-- You can use your own layout icons like this:
theme.layout_fairh = "/usr/share/awesome/themes/default/layouts/fairhw.png"
theme.layout_fairv = "/usr/share/awesome/themes/default/layouts/fairvw.png"
theme.layout_floating = "/usr/share/awesome/themes/default/layouts/floatingw.png"
theme.layout_magnifier = "/usr/share/awesome/themes/default/layouts/magnifierw.png"
theme.layout_max = "/usr/share/awesome/themes/default/layouts/maxw.png"
theme.layout_fullscreen = "/usr/share/awesome/themes/default/layouts/fullscreenw.png"
theme.layout_tilebottom = "/usr/share/awesome/themes/default/layouts/tilebottomw.png"
theme.layout_tileleft = "/usr/share/awesome/themes/default/layouts/tileleftw.png"
theme.layout_tile = "/usr/share/awesome/themes/default/layouts/tilew.png"
theme.layout_tiletop = "/usr/share/awesome/themes/default/layouts/tiletopw.png"
theme.awesome_icon = "/usr/share/awesome/themes/default/layouts/taglist/squarew.png"
return theme
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80

Binary file not shown.

Before

Width:  |  Height:  |  Size: 225 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 666 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 893 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 598 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 818 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 799 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 814 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1,013 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 774 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 965 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 833 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 836 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 967 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 872 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 277 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 228 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 213 B

View file

@ -1,48 +0,0 @@
-- Client manipulation
modkey = "Mod4"
keybinding({ "Mod1" }, "Tab", function () awful.client.focus.byidx(1); if client.focus then client.focus:raise() end end):add()
--From Here default config
keybinding({ modkey, "Shift" }, "f", function () if client.focus then client.focus.fullscreen = not client.focus.fullscreen end end):add()
keybinding({ modkey, "Shift" }, "c", function () if client.focus then client.focus:kill() end end):add()
keybinding({ modkey }, "j", function () awful.client.focus.byidx(1); if client.focus then client.focus:raise() end end):add()
keybinding({ modkey }, "k", function () awful.client.focus.byidx(-1); if client.focus then client.focus:raise() end end):add()
keybinding({ modkey, "Shift" }, "j", function () awful.client.swap.byidx(1) end):add()
keybinding({ modkey, "Shift" }, "k", function () awful.client.swap.byidx(-1) end):add()
keybinding({ modkey, "Control" }, "j", function () awful.screen.focus(1) end):add()
keybinding({ modkey, "Control" }, "k", function () awful.screen.focus(-1) end):add()
keybinding({ modkey, "Control" }, "space", awful.client.togglefloating):add()
keybinding({ modkey, "Control" }, "Return", function () if client.focus then client.focus:swap(awful.client.getmaster()) end end):add()
keybinding({ modkey }, "o", awful.client.movetoscreen):add()
keybinding({ modkey }, "Tab", awful.client.focus.history.previous):add()
keybinding({ modkey }, "u", awful.client.urgent.jumpto):add()
keybinding({ modkey, "Shift" }, "r", function () if client.focus then client.focus:redraw() end end):add()
-- Layout manipulation
keybinding({ modkey }, "l", function () awful.tag.incmwfact(0.05) end):add()
keybinding({ modkey }, "h", function () awful.tag.incmwfact(-0.05) end):add()
keybinding({ modkey, "Shift" }, "h", function () awful.tag.incnmaster(1) end):add()
keybinding({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1) end):add()
keybinding({ modkey, "Control" }, "h", function () awful.tag.incncol(1) end):add()
keybinding({ modkey, "Control" }, "l", function () awful.tag.incncol(-1) end):add()
keybinding({ modkey }, "space", function () awful.layout.inc(layouts, 1) end):add()
keybinding({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end):add()
-- Client awful tagging: this is useful to tag some clients and then do stuff like move to tag on them
keybinding({ modkey }, "t", awful.client.togglemarked):add()
for i = 1, keynumber do
keybinding({ modkey, "Shift" }, "F" .. i,
function ()
local screen = mouse.screen
if tags[screen][i] then
for k, c in pairs(awful.client.getmarked()) do
awful.client.movetotag(tags[screen][i], c)
end
end
end):add()
end

View file

@ -1,73 +0,0 @@
keybinding({ modkey }, "Return", function () awful.util.spawn(terminal) end):add()
keybinding({ modkey }, "f", function () awful.util.spawn("firefox") end):add()
keybinding({ }, "XF86AudioLowerVolume", function () awful.util.spawn("voldown 3") end):add()
keybinding({ }, "XF86AudioRaiseVolume", function () awful.util.spawn("volup 3") end):add()
keybinding({ "Shift" }, "XF86AudioLowerVolume", function () awful.util.spawn("voldown 10") end):add()
keybinding({ "Shift" }, "XF86AudioRaiseVolume", function () awful.util.spawn("volup 10") end):add()
keybinding({ modkey }, "XF86Mail", function () awful.util.spawn("xset dpms force off") end):add()
keybinding({ modkey }, "XF86WWW", function () awful.util.spawn(terminal .. " -e apselect") end):add()
keybinding({ }, "XF86AudioPlay", function () awful.util.spawn("mpc toggle") end):add()
keybinding({ }, "XF86AudioNext", function () awful.util.spawn("mpc next") end):add()
keybinding({ }, "XF86AudioPrev", function () awful.util.spawn("mpc prev") end):add()
keybinding({ }, "XF86AudioStop", function () awful.util.spawn("mpc stop") end):add()
keybinding({ modkey }, "XF86AudioStop", function () awful.util.spawn("mpc clear") end):add()
keybinding({ modkey }, "XF86AudioPlay", function ()
awful.prompt.run({ prompt = "Play Band: " },
mypromptbox[mouse.screen], playband,
awful.completion.bash,
awful.util.getdir("cache") .. "/history")
end):add()
function playband(b)
return awful.util.spawn("playband " .. b)
end
keybinding({ modkey }, "Return", function () awful.util.spawn(terminal) end):add()
keybinding({ modkey }, "F1", function ()
awful.prompt.run({ prompt = "Run: " },
mypromptbox[mouse.screen], awful.util.spawn,
awful.completion.bash,
awful.util.getdir("cache") .. "/history")
end):add()
keybinding({ modkey }, "F4", function ()
awful.prompt.run({ prompt = "Run Lua code: " },
mypromptbox[mouse.screen],
awful.util.eval,
awful.prompt.bash,
awful.util.getdir("cache") .. "/history_eval")
end):add()
keybinding({ modkey, "Ctrl" }, "i", function ()
local s = mouse.screen
if mypromptbox[s].text then
mypromptbox[s].text = nil
elseif client.focus then
mypromptbox[s].text = nil
if client.focus.class then
mypromptbox[s].text = "Class: " .. client.focus.class .. " "
end
if client.focus.instance then
mypromptbox[s].text = mypromptbox[s].text .. "Instance: "
.. client.focus.instance .. " "
end
if client.focus.role then
mypromptbox[s].text = mypromptbox[s].text .. "Role: "
.. client.focus.role
end
end
end):add()
keybinding({}, "F12", function ()
tags[1][10].selected = not tags[1][10].selected;
end):add()

View file

@ -1,49 +0,0 @@
-- Bind keyboard digits
-- 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
for i = 1, keynumber do
keybinding({ modkey }, i,
function ()
local screen = mouse.screen
if tags[screen][i] then
awful.tag.viewonly(tags[screen][i])
end
end):add()
keybinding({ modkey, "Control" }, i,
function ()
local screen = mouse.screen
if tags[screen][i] then
tags[screen][i].selected = not tags[screen][i].selected
end
end):add()
keybinding({ modkey, "Shift" }, i,
function ()
if client.focus then
if tags[client.focus.screen][i] then
awful.client.movetotag(tags[client.focus.screen][i])
end
end
end):add()
keybinding({ modkey, "Control", "Shift" }, i,
function ()
if client.focus then
if tags[client.focus.screen][i] then
awful.client.toggletag(tags[client.focus.screen][i])
end
end
end):add()
end
keybinding({ modkey }, "Left", awful.tag.viewprev):add()
keybinding({ modkey }, "Right", awful.tag.viewnext):add()
keybinding({ modkey }, "Escape", awful.tag.history.restore):add()
keybinding({ modkey, "Control" }, "r", function ()
mypromptbox[mouse.screen].text = awful.util.escape(awful.util.restart())
end):add()
keybinding({ modkey, "Shift" }, "q", awesome.quit):add()

View file

@ -1,150 +0,0 @@
-- Small interface to MusicPD
-- use luasocket, with a persistant connection to the MPD server.
--
-- Author: Alexandre "kAworu" Perrin <kaworu at kaworu dot ch>
--
-- based on a netcat version from Steve Jothen <sjothen at gmail dot com>
-- (see http://github.com/otkrove/ion3-config/tree/master/mpd.lua)
require("socket")
-- Grab env
local socket = socket
local string = string
local tonumber = tonumber
local setmetatable = setmetatable
local os = os
-- Music Player Daemon Lua library.
module("mpd")
MPD = {
} MPD_mt = { __index = MPD }
-- create and return a new mpd client.
-- the settings argument is a table with theses keys:
-- hostname: the MPD's host (default localhost)
-- port: MPD's port to connect to (default 6600)
-- desc: server's description (default hostname)
-- password: the server's password (default nil, no password)
-- timeout: time in sec to wait for connect() and receive() (default 1)
-- retry: time in sec to wait before reconnect if error (default 60)
function new(settings)
local client = {}
if settings == nil then settings = {} end
client.hostname = settings.hostname or "localhost"
client.port = settings.port or 6600
client.desc = settings.desc or client.hostname
client.password = settings.password
client.timeout = settings.timeout or 1
client.retry = settings.retry or 60
setmetatable(client, MPD_mt)
return client
end
-- calls the action and returns the server's response.
-- Example: if the server's response to "status" action is:
-- volume: 20
-- repeat: 0
-- random: 0
-- playlist: 599
-- ...
-- then the returned table is:
-- { volume = 20, repeat = 0, random = 0, playlist = 599, ... }
function MPD:send(action)
local command = string.format("%s\n", action)
local values = {}
-- connect to MPD server if not already done.
if not self.connected then
if not self.last_try or (os.time() - self.last_try) > self.retry then
self.socket = socket.tcp()
self.socket:settimeout(self.timeout, 't')
self.last_try = os.time()
self.connected = self.socket:connect(self.hostname, self.port)
if self.connected and self.password then
self:send(string.format("password %s", self.password))
end
end
end
if not self.connected then
return {}
end
self.socket:send(command)
local line = ""
while not line:match("^OK$") do
line = self.socket:receive("*l")
if not line then -- closed,timeout (mpd killed?)
self.connected = false
return self:send(action)
end
if line:match(string.format("^ACK", action)) then
return { errormsg = line }
end
local _, _, key, value = string.find(line, "([^:]+):%s(.+)")
if key then
values[string.lower(key)] = value
end
end
return values
end
function MPD:next()
self:send("next")
end
function MPD:previous()
self:send("previous")
end
function MPD:stop()
self:send("stop")
end
-- no need to check the new value, mpd will set the volume in [0,100]
function MPD:volume_up(delta)
local stats = self:send("status")
local new_volume = tonumber(stats.volume) + delta
self:send(string.format("setvol %d", new_volume))
end
function MPD:volume_down(delta)
self:volume_up(-delta)
end
function MPD:toggle_random()
local stats = self:send("status")
if tonumber(stats.random) == 0 then
self:send("random 1")
else
self:send("random 0")
end
end
function MPD:toggle_repeat()
local stats = self:send("status")
if tonumber(stats["repeat"]) == 0 then
self:send("repeat 1")
else
self:send("repeat 0")
end
end
function MPD:toggle_play()
if self:send("status").state == "stop" then
self:send("play")
else
self:send("pause")
end
end
-- vim:filetype=lua:tabstop=8:shiftwidth=2:fdm=marker:

View file

@ -1,779 +0,0 @@
--- 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
-- package env
local type = type
local tag = 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
module("shifty")
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)
for i,t in ipairs(screen[scr]: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
awful.prompt.run( {
fg_cursor = fg, bg_cursor = bg, ul_cursor = "single",
text = text, selectall = not no_selectall, prompt = " " },
taglist[scr][tag2index(scr,t)*2],
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
awful.hooks.user.call("tags", scr)
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 target = awful.util.cycle(#screen[scr]:tags(), sel_idx + idx)
awful.tag.viewonly(screen[scr]:tags()[target])
awful.client.movetotag(screen[scr]:tags()[target], client.focus)
end
function send_next() send(1) end
function send_prev() send(-1) end
--}}}
function shift_next() set(awful.tag.selected(), { rel_index = 1 }) end
function shift_prev() set(awful.tag.selected(), { rel_index = -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
for prop, val in pairs(props) do awful.tag.setproperty(t, prop, val) end
screen[scr]:tags(tags)
-- 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
--}}}
--{{{ 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 = tag( 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)
if args.position then
f = function() rename(t, args.rename, true); awful.hooks.timer.unregister(f) end
else
f = function() rename(t); awful.hooks.timer.unregister(f) end
end
awful.hooks.timer.register(0.01, f)
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)
-- 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
--}}}
--{{{ 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
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
c.border_color = beautiful.border_normal
c.border_width = beautiful.border_width
-- 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
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
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.float ~= nil then awful.client.floating.set(c, a.float) 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.slave ~=nil then slave = a.slave 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.hide ~= nil then c.hide = a.hide 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.titlebar ~= nil then awful.titlebar.add(c, { modkey = modkey }) end
if a.run ~= nil then run = 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
end
end
end
end
-- set key bindings
c:keys(keys)
-- set properties of floating clients
if awful.client.floating.get(c) then
if config.defaults.floatBars then -- add a titlebar if requested in config.defaults
awful.titlebar.add( c, { modkey = modkey } )
end
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
c:tags( target_tags )
if slave then awful.client.setslave(c) end
if wfact then awful.client.setwfact(wfact, c) 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 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
awful.tag.viewmore(showtags, c.screen)
end
end
-- focus and raise accordingly or lower if supressed
if not (nofocus or c.hide 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 function if specified
if run then run(c, target) 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
--FIXME: global f, what if more than one at a time is being swept
f = function() del(t); awful.hooks.timer.unregister(f) end
awful.hooks.timer.register(delay, f)
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)
local keys = awful.tag.getproperty(sel, "keys") or config.globalkeys
if keys 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.keysym] = 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
-- }}}
awful.hooks.manage.unregister(awful.tag.withcurrent)
awful.hooks.tags.register(sweep)
awful.hooks.arrange.register(sweep)
awful.hooks.arrange.register(tagkeys)
awful.hooks.clients.register(sweep)
awful.hooks.manage.register(match)
-- vim: foldmethod=marker:filetype=lua:expandtab:shiftwidth=2:tabstop=2:softtabstop=2:encoding=utf-8:textwidth=80

2
rc.lua
View file

@ -34,10 +34,8 @@ layouts =
awful.layout.suit.floating awful.layout.suit.floating
} }
dofile (MY_PATH .. "helpers.lua")
dofile (MY_PATH .. "tags.lua") dofile (MY_PATH .. "tags.lua")
dofile (MY_PATH .. "wibox.lua") dofile (MY_PATH .. "wibox.lua")
dofile (MY_PATH .. "bindings.lua") dofile (MY_PATH .. "bindings.lua")
dofile (MY_PATH .. "rules.lua") dofile (MY_PATH .. "rules.lua")
dofile (MY_PATH .. "signals.lua") dofile (MY_PATH .. "signals.lua")
--dofile (MY_PATH .. "wallpaper.lua")

View file

@ -1,29 +0,0 @@
-- seed and "pop a few"
math.randomseed( os.time())
for i=1,1000 do tmp=math.random(0,1000) end
x = 0
-- setup the timer
mytimer = timer { timeout = x }
mytimer:add_signal("timeout", function()
-- tell awsetbg to randomly choose a wallpaper from your wallpaper directory
os.execute("awsetbg -a -r /home/crater2150/.config/awesome/walls/ &")
-- stop the timer (we don't need multiple instances running at the same time)
mytimer:stop()
-- define the interval in which the next wallpaper change should occur in seconds
-- (in this case anytime between 10 and 20 minutes)
x = math.random( 600, 1200)
--restart the timer
mytimer.timeout = x
mytimer:start()
end)
-- initial start when rc.lua is first run
mytimer:start()