X-Git-Url: https://projects.mako.cc/source/awesome-config/blobdiff_plain/0e4fe08588fbdbc8fad797f3d79f5f8d4c18cfaf..4f2d7dde644098f6ff5a6bf23cfe906dc7b191c2:/rc.lua?ds=sidebyside diff --git a/rc.lua b/rc.lua index 9458979..2289a12 100644 --- a/rc.lua +++ b/rc.lua @@ -1,3 +1,16 @@ +-- read the timezone from /etc/timezone (this doesn't work, somehow) +local function read_tz_file(path) + local file = io.open(path, "r") -- r read mode and b binary mode + if not file then return nil end + local content = file:read "*a" -- *a or *all reads the whole file + file:close() + content = content:gsub("^%s*", "") + content = content:gsub("%s*$", "") + return content +end + +local tz_string = read_tz_file("/etc/timezone") + -- If LuaRocks is installed, make sure that packages installed through it are -- found (e.g. lgi). If LuaRocks is not installed, do nothing. pcall(require, "luarocks.loader") @@ -18,6 +31,10 @@ local hotkeys_popup = require("awful.hotkeys_popup") -- when client with a matching name is opened: require("awful.hotkeys_popup.keys") +-- load the volume widget code and set settings +local volume_control = require("volume-control") +volumecfg = volume_control({}) + -- Load Debian menu entries local debian = require("debian.menu") local has_fdo, freedesktop = pcall(require, "freedesktop") @@ -49,7 +66,8 @@ end -- {{{ Variable definitions -- Themes define colours, icons, font and wallpapers. -beautiful.init(gears.filesystem.get_themes_dir() .. "default/theme.lua") +beautiful.init(awful.util.get_themes_dir() .. "sky/theme.lua") +beautiful.wallpaper = "/home/mako/images/Flag_of_Cascadia.png" -- This is used later as the default terminal and editor to run. terminal = "x-terminal-emulator" @@ -65,22 +83,9 @@ modkey = "Mod4" -- Table of layouts to cover with awful.layout.inc, order matters. awful.layout.layouts = { - awful.layout.suit.floating, awful.layout.suit.tile, - awful.layout.suit.tile.left, - awful.layout.suit.tile.bottom, - awful.layout.suit.tile.top, - awful.layout.suit.fair, - awful.layout.suit.fair.horizontal, - awful.layout.suit.spiral, - awful.layout.suit.spiral.dwindle, awful.layout.suit.max, - awful.layout.suit.max.fullscreen, - awful.layout.suit.magnifier, - awful.layout.suit.corner.nw, - -- awful.layout.suit.corner.ne, - -- awful.layout.suit.corner.sw, - -- awful.layout.suit.corner.se, + awful.layout.suit.floating } -- }}} @@ -125,7 +130,7 @@ mykeyboardlayout = awful.widget.keyboardlayout() -- {{{ Wibar -- Create a textclock widget -mytextclock = wibox.widget.textclock() +mytextclock = wibox.widget.textclock("%a %m %d %H:%M", 60, tz_string) -- Create a wibox for each screen and add it local taglist_buttons = gears.table.join( @@ -230,6 +235,7 @@ awful.screen.connect_for_each_screen(function(s) layout = wibox.layout.fixed.horizontal, mykeyboardlayout, wibox.widget.systray(), + -- volumecfg.widget, mytextclock, s.mylayoutbox, }, @@ -237,6 +243,8 @@ awful.screen.connect_for_each_screen(function(s) end) -- }}} +-- right_layout:add(volumecfg.widget) + -- {{{ Mouse bindings root.buttons(gears.table.join( awful.button({ }, 3, function () mymainmenu:toggle() end), @@ -331,8 +339,20 @@ globalkeys = gears.table.join( -- Prompt awful.key({ modkey }, "r", function () awful.screen.focused().mypromptbox:run() end, {description = "run prompt", group = "launcher"}), + + awful.key({ modkey, }, "x", + function () + awful.prompt.run { + prompt = "Run in terminal: ", + textbox = awful.screen.focused().mypromptbox.widget, + exe_callback = function (prog) awful.util.spawn_with_shell(terminal .. " -title " .. prog .. " -e " .. prog) end + } + end, + {description = "terminal execute prompt", group = "awesome"}), - awful.key({ modkey }, "x", + -- Mako's additional keybindings + --- {{{ + awful.key({ modkey, "Shift", }, "x", function () awful.prompt.run { prompt = "Run Lua code: ", @@ -342,6 +362,17 @@ globalkeys = gears.table.join( } end, {description = "lua execute prompt", group = "awesome"}), + + awful.key({ modkey }, "q", + function () + awful.tag.incnmaster(-1) + awful.tag.incncol(3) + end), + + awful.key({ modkey, "Shift" }, "t", awful.titlebar.toggle), + + --- }}} + -- Menubar awful.key({ modkey }, "p", function() menubar.show() end, {description = "show the menubar", group = "launcher"}) @@ -437,7 +468,10 @@ for i = 1, 9 do end end end, - {description = "toggle focused client on tag #" .. i, group = "tag"}) + {description = "toggle focused client on tag #" .. i, group = "tag"}), + awful.key({}, "XF86AudioRaiseVolume", function() volumecfg:up() end), + awful.key({}, "XF86AudioLowerVolume", function() volumecfg:down() end), + awful.key({}, "XF86AudioMute", function() volumecfg:toggle() end) ) end @@ -579,4 +613,4 @@ 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) --- }}} \ No newline at end of file +-- }}}