local hotkeys_popup = require("awful.hotkeys_popup").widget
+local utils = require("utils")
-- Default modkey.
modkey = "Mod4"
awful.key({ }, "F13", function () awful.spawn("ksnapshot") end),
awful.key({ }, "Print", function () awful.spawn("ksnapshot") end),
-- ranger
- awful.key({ modkey }, "r", function () awful.spawn(terminal .. " -e ranger") end),
+ awful.key({ modkey }, "r", function () utils.spawn_terminal("ranger") end),
-- Volume
awful.key({ }, "XF86AudioMute", function () awful.spawn("pulsemixer --toggle-mute") end,
{description = "toggle mute", group = "volume"}),
awful.key({ modkey, "Control" }, "Escape", function () awful.spawn("i3lock -c 000000") end),
-- VimWiki
awful.key({ modkey }, "i", function ()
- awful.spawn(terminal.." -name vimwiki -e vim -c 'call vimwiki#base#goto_index(v:count1)'")
+ utils.spawn_terminal("vim -c 'call vimwiki#base#goto_index(v:count1)'", { instance = "vimwiki"})
end)
)
beautiful.init(gears.filesystem.get_dir("config").."/themes/mlp/theme.lua")
-- This is used later as the default terminal and editor to run.
-terminal = "urxvtc"
+terminal = os.getenv("TERMINAL") or "xterm"
+terminal_class = (function()
+ local map = { urxvt = "URxvt"
+ , urxvtc = "URxvt"
+ , xterm = "XTerm"
+ }
+ return map[terminal] or terminal
+end)()
+
editor = os.getenv("EDITOR") or "vim"
editor_cmd = terminal .. " -e " .. editor
"gimp",
} },
properties = { floating = true } },
- { rule = { class = "URxvt", instance = "pulsemixer" },
+ { rule = { class = terminal_class, instance = "pulsemixer" },
properties = { floating = true,
skip_taskbar = true,
ontop = true,
end } },
{ rule = { class = "Wine"},
properties = { floating = true } },
- { rule = { class = "URxvt"},
+ { rule = { class = terminal_class },
properties = { opacity = 0.8 } },
- { rule = { class = "URxvt", instance = "mutt" },
+ { rule = { class = terminal_class, instance = "mutt" },
properties = { tag = wwwtag,
function (c) awful.client.setslave(c) end } },
- { rule = { class = "URxvt", instance = "ncmpcpp" },
+ { rule = { class = terminal_class, instance = "ncmpcpp" },
properties = { tag = mediatag,
function (c) awful.client.setmaster(c) end } },
- { rule = { class = "URxvt", instance = "mopidy" },
+ { rule = { class = terminal_class, instance = "mopidy" },
properties = { tag = mediatag,
function (c) awful.client.setmaster(c) end } },
- { rule = { class = "URxvt", instance = "weechat" },
+ { rule = { class = terminal_class, instance = "weechat" },
properties = { tag = imtag,
function (c) awful.client.setmaster(c) end } },
{ rule_any = { class = { "Steam", "steam" } },
return os.execute(('[ -d "%s" ]'):format(path))
end
+function utils.spawn_terminal(prg, cprop, cb)
+ local join = require("gears.table").join
+ local term_cmd = {terminal}
+ if cprop and cprop.instance then
+ if terminal:match("rxvt") then
+ term_cmd = join(term_cmd, {"-name", cprop.instance})
+ end
+ end
+ awful.spawn(join(term_cmd, {"-e", prg}), cprop, cb)
+end
+
function utils.run_or_kill(prg, cprop, screen)
if not prg then
do return nil end
-- pomodoro:connect_signal("stop_pause", function () naughty.notify{ text = "stop_pause", timeout = 10 } end)
-- pomodoro:connect_signal("start_working", function () naughty.notify{ text = "start_working", timeout = 10 } end)
pomodoro:connect_signal("work_stop", function ()
- awful.spawn(terminal.." -name diary -e diary")
+ utils.spawn_terminal("diary", { instance = "diary" })
end)
globalkeys = gears.table.join(globalkeys,