awesome 3.3 - window manager
Úvod | Instalace | Defaultní konfigurace | Upravená konfigurace | Spouštění awesome | Automatické spouštění aplikací po startu awesome
Přehled úprav konfiguračních souborů:
Téma vzhledu | Nastavení defaultního editoru a terminálu | Modkey | Layouty | Plovoucí okna aplikací (floatapps) | Tagy aplikací (apptags) | Dekorace oken | Tagy (Plochy) | Wibox (Panel a Menu) | Zkratky (Keyboard/mouse bindings) | HooksOvládání:
Ovládání a klávesové zkratkyUpravené konfigurační soubory ke stažení:
Awesome 3.4.1 - awesome_conf_3.4.1.tar.bz2
Awesome 3.4-rcX - awesome_conf_34rcX.tar.bz2
Awesome 3.4-rc2 - awesome_conf_34rc2.tar.bz2
Awesome 3.4-rc1 - awesome_conf_34rc1.tar.bz2
Awesome 3.3 - awesome_conf_33.tar.bz2
Awesome 3.2.1 - awesome_conf_321.tar.bz2
Awesome 3.2 - awesome_conf_32.tar.bz2
Awesome 3.1 - awesome_conf_31.tar.bz2
Novější budou už jen v sekci Downloads.
Úvod
awesome je vysoce konfigurovatelný window manager pro X. Využívá dlaždicový (tiled) i plovoucí (floating) systém správy oken. Je velice malý, rychlý, rozšiřitelný a dostupný pod licencí GNU GPLv2. Konfigurace se provádí pomocí jazyka LUA, se kterým je program svázán. Konfigurace je složitější a né každému bude vyhovovat, proto zde zveřejním mojí funkční konfiguraci i s popisem a ovládáním.
I přes složitější konfiguraci je awesome výbornou volbou hlavního window manageru. Spojuje výhody tiled i floating window managerů a je výborně přizpůsobitelný podle individuálních požadavků. Aktivita vývojářů je také dobrá a mnoho informací se dá získat například na následujících adresách.
Domovská stránka: http://awesome.naquadah.org
WIKI: http://awesome.naquadah.org/wiki/
IRC: server: irc://irc.oftc.net:6667 kanál #awesome
Git: http://git.naquadah.org/?p=awesome.git;a=summary
Pro představu přikládám několik screenshotů.
Screenshoty z verze 3.2 (IBM R61, rozlišení 1680*1050, Gentoo Linux):
Screenshoty z verze 3.4.1 (IBM R61, rozlišení 1680*1050, Gentoo Linux):
Obrázek ze stránek http://awesome.naquadah.org ukazuje, že ani použití více monitorů není s awesome problém.

Instalace:
Instalace byla na Gentoo velice snadná, stačilo odmaskovat potřebné balíky a instalovat. Nepoužívám přídavné knihovny typu wicked, nejsou defaultně v portage.
# emerge awesome
Defaultní konfigurace:
Konfigurace awesome se provádí editací konfiguračních souborů. Syntaxe je napsaná v jazyce LUA. Defaultní konfigurační soubor se jmenuje rc.lua a najdeme ho po instalaci v adresáři /etc/xdg/awesome/.
Detailním popisem nastavení se nebudu zabývat, protože je množství nastavení nekonečné, díky možnosti doprogramovat si cokoliv. Pro vaše vlastní nastavení si zkopírujte soubor /etc/xdg/awesome/rc.lua do ~/.config/awesome/rc.lua a můžete začít experimentovat.
Upravený konfigurační soubor může vypadat například takto:
------------------------------------------------------------------------------------- -- awesome 3.3 configuration file by fastlinux.eu-- ------------------------------------------------------------------------------------- -- Standard awesome library require("awful") -- Theme handling library require("beautiful") -- Notification library require("naughty") -- {{{ Variable definitions -- Themes define colours, icons, and wallpapers -- The default is a dark theme -- theme_path = "/usr/share/awesome/themes/default/theme.lua" -- Uncommment this for a lighter theme -- theme_path = "/usr/share/awesome/themes/sky/theme.lua" theme_path = os.getenv("HOME") .. "/.config/awesome/themes/mseed/theme.lua" -- Actually load theme beautiful.init(theme_path) -- This is used later as the default terminal and editor to run. terminal = "xterm -bg black -fg white -fa terminus -fs 11" editor = "vim" or os.getenv("EDITOR") 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.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.max, --awful.layout.suit.max.fullscreen, --awful.layout.suit.magnifier, awful.layout.suit.floating } -- Table of clients that should be set floating. The index may be either -- the application class or instance. The instance is useful when running -- a console app in a terminal like (Music on Console) -- xterm -name mocp -e mocp floatapps = { -- by class ["MPlayer"] = true, ["Smlayer"] = true, ["gimp"] = true, ["Gajim.py"] = true, ["VirtualBox"] = true, ["dia"] = true, ["xine"] = true, -- by instance -- ["Panel xine"] = true } -- Applications to be moved to a pre-defined tag by class or instance. -- Use the screen and tags indices. apptags = { ["Firefox"] = { screen = 1, tag = 4 }, ["opera"] = { screen = 1, tag = 4 }, ["Liferea"] = { screen = 1, tag = 4 }, ["Claws-mail"] = { screen = 1, tag = 5 }, ["Xchat"] = { screen = 1, tag = 5 }, ["eclipse"] = { screen = 1, tag = 3 }, ["poedit"] = { screen = 1, tag = 3 }, ["soffice"] = { screen = 1, tag = 8 }, ["blender"] = { screen = 1, tag = 6 }, ["inkscape"] = { screen = 1, tag = 6 }, ["gimp"] = { screen = 1, tag = 6 } } -- Define if we want to use titlebar on all applications. -- Nastaveni zobrazeni panelu oken(listy) use_titlebar = true -- }}} -- {{{ Tags -- -- Define tags table tags = {} tags.settings = { { name = "term", layout = layouts[1], setslave = true, nmaster = 1, ncol = 1, mwfact = 0.600000 }, { name = "file", layout = layouts[1], setslave = true }, { name = "work", layout = layouts[1] }, { name = "web", layout = layouts[7] }, { name = "mail/im", layout = layouts[1] }, { name = "grafx", layout = layouts[8] }, { name = "média", layout = layouts[1] }, { name = "office", layout = layouts[8] }, { name = "ostatní", layout = layouts[1] } } -- Initialize tags for s = 1, screen.count() do tags[s] = {} for i, v in ipairs(tags.settings) do tags[s][i] = tag(v.name) tags[s][i].screen = s awful.tag.setproperty(tags[s][i], "layout", v.layout) awful.tag.setproperty(tags[s][i], "setslave", v.setslave) awful.tag.setproperty(tags[s][i], "mwfact", v.mwfact) awful.tag.setproperty(tags[s][i], "nmaster", v.nmaster) awful.tag.setproperty(tags[s][i], "ncols", v.ncols) awful.tag.setproperty(tags[s][i], "icon", v.icon) end tags[s][1].selected = true end -- }}} -- {{{ Wibox -- Create a textbox widget mytextbox = widget({ type = "textbox", align = "right" }) -- Set the default text in textbox mytextbox.text = " " .. awesome.release .. " " -- {{{ Load menu - vlozi externi soubor s menu -- Create a laucher widget and a main menu require("menu_conf") -- }}} -- Create a systray mysystray = widget({ type = "systray", align = "right" }) -- Create a wibox for each screen and add it mywibox = {} mypromptbox = {} mylayoutbox = {} mytaglist = {} mytaglist.buttons = awful.util.table.join( awful.button({ }, 1, awful.tag.viewonly), awful.button({ modkey }, 1, awful.client.movetotag), awful.button({ }, 3, function (tag) tag.selected = not tag.selected end), awful.button({ modkey }, 3, awful.client.toggletag), awful.button({ }, 4, awful.tag.viewnext), awful.button({ }, 5, awful.tag.viewprev) ) mytasklist = {} mytasklist.buttons = awful.util.table.join( awful.button({ }, 1, function (c) if not c:isvisible() then awful.tag.viewonly(c:tags()[1]) end client.focus = c c:raise() 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({ align = "left" }) -- Create an imagebox widget which will contains an icon indicating which layout we're using. -- We need one layoutbox per screen. mylayoutbox[s] = widget({ type = "imagebox", align = "left" }) mylayoutbox[s]:buttons(awful.util.table.join( awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end), awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end), awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end), awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end))) -- Create a taglist widget mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.label.all, mytaglist.buttons) -- Create a tasklist widget mytasklist[s] = awful.widget.tasklist(function(c) return awful.widget.tasklist.label.currenttags(c, s) end, mytasklist.buttons) -- Create the wibox mywibox[s] = wibox({ position = "top", fg = beautiful.fg_normal, bg = beautiful.bg_normal, height = "25" }) -- Add widgets to the wibox - order matters mywibox[s].widgets = { mylauncher, mytaglist[s], mytasklist[s], mypromptbox[s], mylayoutbox[s], s == 1 and mysystray or nil, mytextbox } mywibox[s].screen = s end -- }}} -- {{{ Mouse bindings root.buttons(awful.util.table.join( awful.button({ }, 3, function () mymainmenu:toggle() end), awful.button({ }, 4, awful.tag.viewnext), awful.button({ }, 5, awful.tag.viewprev) )) -- }}} -- {{{ Key bindings globalkeys = awful.util.table.join( 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(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( 1) end), awful.key({ modkey, "Control" }, "k", function () awful.screen.focus(-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), -- 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), -- terminal awful.key({ "Mod1" }, "F1", function () awful.util.spawn(terminal) end), -- gmrun awful.key({ "Mod1" }, "F2", function () awful.util.spawn("gmrun") end), -- dmenu awful.key({ "Mod1" }, "F3", function () awful.util.spawn(os.getenv("HOME") .. "/.config/awesome/scripts/dmenu.sh") end), -- vypnuti aplikace awful.key({ "Mod1" }, "F4", function () if client.focus then client.focus:kill() end end), -- screenshot awful.key({ modkey }, "Print", function () awful.util.spawn("scrot 'shot_%d.%m.%Y_%H.%M.%S.png' -e 'mv $f ~/shots/ & mirage ~/shots/$f'") end), -- hlasitost awful.key({ } , "#122" , function () awful.util.spawn("amixer -q set Master 2- unmute") end), awful.key({ } , "#123" , function () awful.util.spawn("amixer -q set Master 2+ unmute") end), awful.key({ modkey } , "#122" , function () awful.util.spawn("amixer -q set PCM 2- unmute") end), awful.key({ modkey } , "#123" , function () awful.util.spawn("amixer -q set PCM 2+ unmute") end), -- zamknuti pc (lock) awful.key({ modkey }, "l", function () awful.util.spawn("xscreensaver-command -lock") end), -- plovouci okno na vsechny plochy awful.key({ modkey }, "s", function () client.focus.sticky = not client.focus.sticky end), -- plovouci okno vzdy navrchu awful.key({ modkey }, "a", function () client.focus.ontop = not client.focus.ontop end), -- schova okno awful.key({ modkey }, "d", function () client.focus.hide = not client.focus.hide end), -- vertikalni a horzontalni resaiz oken awful.key({ modkey, "Mod1" }, "Down", function () awful.client.incwfact(0.05) end), awful.key({ modkey, "Mod1" }, "Up", function () awful.client.incwfact(-0.05) end), awful.key({ modkey, "Mod1" }, "Right", function () awful.tag.incmwfact( 0.05) end), awful.key({ modkey, "Mod1" }, "Left", function () awful.tag.incmwfact(-0.05) end), -- Zobrazí / schová titlebar (20px vysoky). awful.key({ modkey }, "q", function () if client.focus.titlebar then awful.titlebar.remove(client.focus, { modkey = modkey, height = "20" }) else awful.titlebar.add(client.focus, { modkey = modkey, height = "20" }) end end) ) -- Client awful tagging: this is useful to tag some clients and then do stuff like move to tag on them clientkeys = awful.util.table.join( 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, "Shift" }, "r", function (c) c:redraw() end), awful.key({ modkey }, "t", awful.client.togglemarked), 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 for i = 1, keynumber do globalkeys = awful.util.table.join(globalkeys, awful.key({ modkey }, i, function () local screen = mouse.screen if tags[screen][i] then awful.tag.viewonly(tags[screen][i]) end end), awful.key({ modkey, "Control" }, i, function () local screen = mouse.screen if tags[screen][i] then tags[screen][i].selected = not tags[screen][i].selected end end), awful.key({ modkey, "Shift" }, i, 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, function () if client.focus and tags[client.focus.screen][i] then awful.client.toggletag(tags[client.focus.screen][i]) end end), awful.key({ 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)) end -- Set keys root.keys(globalkeys) -- }}} -- {{{ Hooks -- Hook function to execute when focusing a client. awful.hooks.focus.register(function (c) if not awful.client.ismarked(c) then c.border_color = beautiful.border_focus end end) -- Hook function to execute when unfocusing a client. awful.hooks.unfocus.register(function (c) if not awful.client.ismarked(c) then c.border_color = beautiful.border_normal end end) -- Hook function to execute when marking a client awful.hooks.marked.register(function (c) c.border_color = beautiful.border_marked end) -- Hook function to execute when unmarking a client. awful.hooks.unmarked.register(function (c) c.border_color = beautiful.border_focus end) -- Hook function to execute when the mouse enters a client. -- Fokus okna pri najeti mysi awful.hooks.mouse_enter.register(function (c) -- Sloppy focus, but disabled for magnifier layout -- if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier -- and awful.client.focus.filter(c) then -- client.focus = c -- end end) -- Hook function to execute when a new client appears. awful.hooks.manage.register(function (c, startup) -- If we are not managing this application at startup, -- move it to the screen where the mouse is. -- We only do it for filtered windows (i.e. no dock, etc). if not startup and awful.client.focus.filter(c) then c.screen = mouse.screen end if use_titlebar then -- Add a titlebar (pridano nastaveni vysky - height) awful.titlebar.add(c, { modkey = modkey, height = "20" }) end -- Add mouse bindings c:buttons(awful.util.table.join( 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) )) -- New client may not receive focus -- if they're not focusable, so set border anyway. c.border_width = beautiful.border_width c.border_color = beautiful.border_normal -- Check if the application should be floating. local cls = c.class local inst = c.instance if floatapps[cls] ~= nil then awful.client.floating.set(c, floatapps[cls]) elseif floatapps[inst] ~= nil then awful.client.floating.set(c, floatapps[inst]) end -- Check application->screen/tag mappings. local target if apptags[cls] then target = apptags[cls] elseif apptags[inst] then target = apptags[inst] end if target then c.screen = target.screen awful.client.movetotag(tags[target.screen][target.tag], c) end -- Do this after tag mapping, so you don't see it on the wrong tag for a split second. client.focus = c -- Set key bindings c:keys(clientkeys) -- Set the windows at the slave, -- i.e. put it at the end of others instead of setting it master. -- Nova okna nebudou jako master, ale hodi se nakonec jako slave -- awful.client.setslave(c) -- Nova plovouci okna nebudou prekryvat wibox awful.placement.no_offscreen(c) -- Honor size hints: if you want to drop the gaps between windows, set this to false. c.size_hints_honor = false end) -- Hook function to execute when arranging the screen. -- (tag switch, new client, etc) awful.hooks.arrange.register(function (screen) local layout = awful.layout.getname(awful.layout.get(screen)) if layout and beautiful["layout_" ..layout] then mylayoutbox[screen].image = image(beautiful["layout_" .. layout]) else mylayoutbox[screen].image = nil end -- Give focus to the latest client in history if no window has focus -- or if the current window is a desktop or a dock one. if not client.focus then local c = awful.client.focus.history.get(screen, 0) if c then client.focus = c end end end) -- Hook called every minute awful.hooks.timer.register(60, function () -- mytextbox.text = os.date(" %a %b %d, %H:%M ") mytextbox.text = os.date(" %d.%m.%Y %H:%M ") end) -- }}} -- rucni spusteni data (fix zobrazeni casu az po minute) ? register (time, f, runnow) mytextbox.text = os.date(" %d.%m.%Y %H:%M ")
Moje upravená konfigurace:
Jelikož jsem strávil nějaký čas s konfigurací tohoto window manageru, tak zde zveřejním moje upravené nastavení.
Jestliže chcete jednoduše použít mojí konfiguraci, stačí stáhnout konfigurační soubory a rozbalit je do vašeho domovského adresáře.
Přehled aplikací použitých v upravených konfiguračních souborech(po startu, klávesová zkratka, ...).
# emerge dmenu gmrun nitrogen xscreensaver parcellite xterm gkrellm stardict xpad geeqie vim terminus-font
Dále uvedu jak jsem postupoval při konfiguraci a změny oproti defaultní konfiguraci. Začneme spouštěním awesome a poté budeme postupovat konfiguračním souborem rc.lua
Spouštění awesome:
Nepoužívám grafické přihlašovací managery typu (gdm, kdm,...).
Spouštění window manageru pomocí příkazu startx je definováno v souboru ~/.xinitrc.
~/.xinitrc
exec awesome
Při odhalování problémů se může hodit:
# awesome &> /home/user/awesome.log
Ověřit správnost konfiguračních souborů můžeme pomocí:
# awesome -k
Automatické spouštění aplikací po startu awesome.
Vytvořil jsem soubor ~/.config/awesome/autostart.sh, nastavil mu spouštěcí práva a nechal ho načíst před startem awesome wm.
~/.xinitrc
~/.config/awesome/autostart.sh & exec awesome
~/.config/awesome/autostart.sh
#!/bin/bash # --- Prepinani klavesnice --- setxkbmap -layout us,cz -variant qwerty -option grp:alt_shift_toggle & xset r & # --- Pozadi plochy --- nitrogen --restore & # --- Spusteni terminalu --- xterm -name Terminal_1 -fa terminus -fs 11 -bg black -fg white & xterm -name Terminal_2 -fa terminus -fs 11 -bg black -fg white & xterm -name Terminal_3 -fa terminus -fs 11 -bg black -fg white & # --- Ostatni aplikace --- xpad & zim --iconify & osmo & stardict & gkrellm & sonata --hidden & # Manazer schranky (sleep 1s && parcellite) & # Spuštění screensaveru xscreensaver -no-splash &
Přehled úprav
Následující úpravy se provádí v souboru ~/.config/awesome/rc.lua
Téma vzhledu:
Do sekce Variable definitions jsem přidal cestu k mému upravenému souboru s tématem vzhledu pro awesome.
theme_path = os.getenv("HOME") .. "/.config/awesome/themes/mseed/theme.lua"
Soubor s tématem ~/.config/awesome/themes/mseed/theme
Nastavení defaultního editoru a terminálu:
terminal = "xterm -bg black -fg white -fa terminus -fs 11"
editor = "vim" or os.getenv("EDITOR")
editor_cmd = terminal .. " -e " .. editor
terminal - Používám klasický xterm, další výborný terminál je například urxvt.
editor - Editor vim nebo defaultní systémový editor.
Modkey:
Většina klávesových zkratek se aktivuje pomocí výchozí klávesy. Tuto klávesu si můžete jednoduše namapovat. Mod4 je win tlačítko na klávesnici a je to i výchozí volba po instalaci awesome.
modkey = "Mod4"
Layouty:
Layout uvádí v jakém módu se budou okna na ploše chovat. Zakomentoval jsem módy fullscreen a magnifier které nepoužívám.
-- Table of layouts to cover with awful.layout.inc, order matters.
layouts =
{
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.max,
--awful.layout.suit.max.fullscreen,
--awful.layout.suit.magnifier,
awful.layout.suit.floating
}
Plovoucí okna aplikací (floatapps):
Seznam aplikací, které se defaultně spustí v plovoucích oknech.
Třídu a instanci okna aplikace můžeme zjistit například pomocí klávesové zkratky ctrl + mod4 + i nebo aplikace xprop (WM_CLASS).
-- Table of clients that should be set floating. The index may be either
-- the application class or instance. The instance is useful when running
-- a console app in a terminal like (Music on Console)
-- xterm -name mocp -e mocp
floatapps =
{
-- by class
["MPlayer"] = true,
["Smlayer"] = true,
["gimp"] = true,
["Gajim.py"] = true,
["VirtualBox"] = true,
["dia"] = true,
["xine"] = true,
-- by instance
-- ["Panel xine"] = true
}
Tagy aplikací (apptags):
Pomocí tagů můžeme nadefinovat na jaké ploše(tagu) a monitoru se nám otevře spouštěná aplikace.
Třídu nebo instanci okna aplikace můžeme zjistit například pomocí klávesové zkratky ctrl + mod4 + i nebo aplikace xprop (WM_CLASS).
-- Applications to be moved to a pre-defined tag by class or instance.
-- Use the screen and tags indices.
apptags =
{
["Firefox"] = { screen = 1, tag = 4 },
["opera"] = { screen = 1, tag = 4 },
["Liferea"] = { screen = 1, tag = 4 },
["Claws-mail"] = { screen = 1, tag = 5 },
["Xchat"] = { screen = 1, tag = 5 },
["eclipse"] = { screen = 1, tag = 3 },
["poedit"] = { screen = 1, tag = 3 },
["soffice"] = { screen = 1, tag = 8 },
["blender"] = { screen = 1, tag = 6 },
["inkscape"] = { screen = 1, tag = 6 },
["gimp"] = { screen = 1, tag = 6 }
}
Dekorace oken - Horní panel
Defaultně je horní panel vypnut, tato volba se vztahuje na většinu oken (mimo některá popup).
-- Define if we want to use titlebar on all applications. use_titlebar = true
Tagy - Plochy
Moje rozložení je podle okruhů prací, které často provádím. Každému tagu se definuje název a defaultní layout.
-- {{{ Tags
--
-- Define tags table
tags = {}
tags.settings = {
{ name = "term", layout = layouts[1], setslave = true, nmaster = 1, ncol = 1, mwfact = 0.600000 },
{ name = "file", layout = layouts[7], setslave = true },
{ name = "work", layout = layouts[1] },
{ name = "web", layout = layouts[7] },
{ name = "mail/im", layout = layouts[1] },
{ name = "grafx", layout = layouts[8] },
{ name = "média", layout = layouts[1] },
{ name = "office", layout = layouts[8] },
{ name = "ostatní", layout = layouts[1] }
}
-- Initialize tags
for s = 1, screen.count() do
tags[s] = {}
for i, v in ipairs(tags.settings) do
tags[s][i] = tag(v.name)
tags[s][i].screen = s
awful.tag.setproperty(tags[s][i], "layout", v.layout)
awful.tag.setproperty(tags[s][i], "setslave", v.setslave)
awful.tag.setproperty(tags[s][i], "mwfact", v.mwfact)
awful.tag.setproperty(tags[s][i], "nmaster", v.nmaster)
awful.tag.setproperty(tags[s][i], "ncols", v.ncols)
awful.tag.setproperty(tags[s][i], "icon", v.icon)
end
tags[s][1].selected = true
end
-- }}}
Wibox - panel a Menu
Wibox je klasický panel, který v základu obsahuje menu, rozložení ploch, správce aplikací, tray a textové pole s datem a časem. Panel je rozšiřitelný pomocí vlastních widgetů.
Panel jsem trochu přeskládal a oddělil jsem část popisující obsah menu do samostatného souboru ~/.config/awesome/menu_conf.lua pro lepší přehlednost.
-- {{{ Wibox
-- Create a textbox widget
mytextbox = widget({ type = "textbox", align = "right" })
-- Set the default text in textbox
mytextbox.text = " " .. awesome.release .. " "
-- {{{ Load menu - vlozi externi soubor s menu
-- Create a laucher widget and a main menu
require("menu_conf")
-- }}}
-- Create a systray
mysystray = widget({ type = "systray", align = "right" })
-- Create a wibox for each screen and add it
mywibox = {}
mypromptbox = {}
mylayoutbox = {}
mytaglist = {}
mytaglist.buttons = awful.util.table.join(
awful.button({ }, 1, awful.tag.viewonly),
awful.button({ modkey }, 1, awful.client.movetotag),
awful.button({ }, 3, function (tag) tag.selected = not tag.selected end),
awful.button({ modkey }, 3, awful.client.toggletag),
awful.button({ }, 4, awful.tag.viewnext),
awful.button({ }, 5, awful.tag.viewprev)
)
mytasklist = {}
mytasklist.buttons = awful.util.table.join(
awful.button({ }, 1, function (c)
if not c:isvisible() then
awful.tag.viewonly(c:tags()[1])
end
client.focus = c
c:raise()
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({ align = "left" })
-- Create an imagebox widget which will contains an icon indicating which layout we're using.
-- We need one layoutbox per screen.
mylayoutbox[s] = widget({ type = "imagebox", align = "left" })
mylayoutbox[s]:buttons(awful.util.table.join(
awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end),
awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end),
awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end),
awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end)))
-- Create a taglist widget
mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.label.all, mytaglist.buttons)
-- Create a tasklist widget
mytasklist[s] = awful.widget.tasklist(function(c)
return awful.widget.tasklist.label.currenttags(c, s)
end, mytasklist.buttons)
-- Create the wibox
mywibox[s] = wibox({ position = "top", fg = beautiful.fg_normal, bg = beautiful.bg_normal, height = "25" })
-- Add widgets to the wibox - order matters
mywibox[s].widgets = { mylauncher,
mytaglist[s],
mytasklist[s],
mypromptbox[s],
mylayoutbox[s],
s == 1 and mysystray or nil,
mytextbox }
mywibox[s].screen = s
end
-- }}}
Zkratky - Keyboard/mouse bindings
Nadefinoval jsem si další funkce na klávesové zkratky. Všechny defaultní zkratky zůstali nezměněny.
Ke zjištění správného kódu klávesy nám pomůže program xev.
Zkratky jsem přidal do globalkeys = { }
-- terminal
awful.key({ "Mod1" }, "F1", function () awful.util.spawn(terminal) end),
-- gmrun
awful.key({ "Mod1" }, "F2", function () awful.util.spawn("gmrun") end),
-- dmenu
awful.key({ "Mod1" }, "F3", function () awful.util.spawn(os.getenv("HOME") .. "/.config/awesome/scripts/dmenu.sh") end),
-- vypnuti aplikace
awful.key({ "Mod1" }, "F4", function () if client.focus then client.focus:kill() end end),
-- screenshot
awful.key({ modkey }, "Print", function () awful.util.spawn("scrot 'shot_%d.%m.%Y_%H.%M.%S.png' -e 'mv $f ~/shots/ & mirage ~/shots/$f'") end),
-- hlasitost
awful.key({ } , "#122" , function () awful.util.spawn("amixer -q set Master 2- unmute") end),
awful.key({ } , "#123" , function () awful.util.spawn("amixer -q set Master 2+ unmute") end),
awful.key({ modkey } , "#122" , function () awful.util.spawn("amixer -q set PCM 2- unmute") end),
awful.key({ modkey } , "#123" , function () awful.util.spawn("amixer -q set PCM 2+ unmute") end),
-- zamknuti pc (lock)
awful.key({ modkey }, "l", function () awful.util.spawn("xscreensaver-command -lock") end),
-- plovouci okno na vsechny plochy
awful.key({ modkey }, "s", function () client.focus.sticky = not client.focus.sticky end),
-- plovouci okno vzdy navrchu
awful.key({ modkey }, "a", function () client.focus.ontop = not client.focus.ontop end),
-- schova okno
awful.key({ modkey }, "d", function () client.focus.hide = not client.focus.hide end),
-- vertikalni a horzontalni resaiz oken
awful.key({ modkey, "Mod1" }, "Down", function () awful.client.incwfact(0.05) end),
awful.key({ modkey, "Mod1" }, "Up", function () awful.client.incwfact(-0.05) end),
awful.key({ modkey, "Mod1" }, "Right", function () awful.tag.incmwfact( 0.05) end),
awful.key({ modkey, "Mod1" }, "Left", function () awful.tag.incmwfact(-0.05) end),
-- Zobrazí / schová titlebar (20px vysoky).
awful.key({ modkey }, "q", function () if client.focus.titlebar then awful.titlebar.remove(client.focus, { modkey = modkey, height = "20" }) else awful.titlebar.add(client.focus, { modkey = modkey, height = "20" }) end end)
Hooks:
Hooks jsou jednotlivé funkce (události) ovlivňující chování našeho window manageru.
Do awful.hooks.manage.register jsem přidal nastavení výšky titlebaru.
if use_titlebar then
-- Add a titlebar (pridano nastaveni vysky - height)
awful.titlebar.add(c, { modkey = modkey, height = "20" })
end
Přidal a povolil jsem několik dalších voleb pro chování oken.
-- Nova plovouci okna nebudou prekryvat wibox awful.placement.no_offscreen(c) -- Nova okna nebudou jako master, ale hodi se nakonec jako slave -- awful.client.setslave(c) -- Honor size hints: if you want to drop the gaps between windows, set this to false. c.size_hints_honor = false
Zakomentoval jsem funkci pro nastavení fokusu okna při najetí myši.
-- Fokus okna pri najeti mysi
-- Hook function to execute when the mouse enters a client.
-- awful.hooks.mouse_enter.register(function (c)
-- Sloppy focus, but disabled for magnifier layout
-- if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
-- and awful.client.focus.filter(c) then
-- client.focus = c
-- end
-- end)
V awful.hooks.timer.register jsem upravil formát datumu a času zobrazovaný v panelu.
-- Hook called every minute
awful.hooks.timer.register(60, function ()
-- Format data a casu
mytextbox.text = os.date(" %d.%m.%Y %H:%M ")
end)
-- rucni spusteni data (fix zobrazeni casu az po minute) ? register (time, f, runnow)
mytextbox.text = os.date(" %d.%m.%Y %H:%M ")
Ovládání:
Ovládání myší (DEFAULT MOUSE BINDINGS)
| Navigace | |
| Button1 na názvu tagu | Zobrazit tag |
| Button4, Button5 na názvu tagu | Přepne na předchozí nebo další tag |
| Button4, Button5 na root okně | Přepne na předchozí nebo další tag |
| Button1, Button3, Button4, Button5 na ikoně layoutu | Přepne na předchozí nebo další layout |
| Modifikace layoutu | |
| Mod4 + Button1 na jméně tagu | Přesune vybraného klienta daný tag |
| Mod4 + Button3 na jméně tagu | Spojí tento tag s vybraným klientem |
| Button3 na jméně tagu | Přidá tento tag do současného pohledu |
| Mod4 + Button1 na klientském okně | Přesune okno |
| Mod4 + Button3 na klientském okně | Změní velikost okna (resize) |
Klávesové zkratky (DEFAULT KEY BINDINGS)
| Ovládání Window manageru | |
| Mod4 + Control + r | Restart awesome |
| Mod4 + Shift + q | Ukončit awesome |
| Mod4 + F1 | Spustit příkaz (prompt v panelu) |
| Mod4 + F4 | Spustí Lua code prompt |
| Mod4 + Return | Spustí terminal emulator |
| Klienti (Clients) | |
| Mod4 + Shift + r | Překreslí vybrané okno |
| Mod4 + m | Maximalizuje klientské okno |
| Mod4 + f | Nastaví vybrané klientské okno na fullscreen |
| Mod4 + Shift + c | Ukončí(kill) vybraného klienta |
| Mod4 + t | Označí(mark) klienta |
| Navigace | |
| Mod4 + j | Vybere okno dalšího klienta |
| Mod4 + k | Vybere okno předchozího klienta |
| Mod4 + u | Vybere(focus) prvního urgent klienta |
| Mod4 + Left | Zobrazí předchozí tag |
| Mod4 + Right | Zobrazí další tag |
| Mod4 + 1-9 | Přepne na tag 1-9 |
| Mod4 + Control + j | Fokus na další obrazovku |
| Mod4 + Control + k | Fokus na předchozí obrazovku |
| Mod4 + Escape | Přejde na předchozí vybraný tag |
| Modifikace Layoutu | |
| Mod4 + Shift + j | Prohodí pozici klientského okna s následujícím |
| Mod4 + Shift + k | Prohodí pozici klientského okna s předchozím |
| Mod4 + h | Zmenší šířku master okna o 5% |
| Mod4 + l | Zvětší šířku master okna o 5% |
| Mod4 + Shift + h | Zvýší počet master oken o 1 |
| Mod4 + Shift + l | Sníží počet master oken o 1 |
| Mod4 + Control + h | Zvýší počet sloupců non-master oken o 1 |
| Mod4 + Control + l | Sníží počet sloupců non-master oken o 1 |
| Mod4 + space | Přepne do dalšího layoutu |
| Mod4 + Shift + space | Přepne do předchozího layoutu |
| Mod4 + Control + space | Zapne/Vypne plovoucí(floating) layout klientského okna |
| Mod4 + Control + Return | Prohodí pozici vybraného okna s master oknem |
| Mod4 + Control + 1-9 | Spojí pohled na vybrané tagy |
| Mod4 + Shift + 1-9 | Přesune vybrané okno na zvolený tag(1-9) |
| Mod4 + Shift + Control + 1-9 | Zobrazí okno klienta i na dalším zvoleném tagu |
| Mod4 + Shift + F1-9 | Tag marked clients with tag |
Rozšířené klávesové zkratky
Klávesové zkratky, které jsem do awesome přidal.
Mod1 = levý alt
Mod4 = win tlačítko
| Moje úpravy | |
| Mod1 + F1 | Spustí terminál |
| Mod1 + F2 | Spustí gmrun |
| Mod1 + F3 | Spustí dmenu |
| Mod1 + F4 | Ukončí aplikaci |
| Mod4 + Print | Provede screenshot obrazovky a otevře náhled |
| #174 | Multimediální klávesa na zeslabení zvuku (master) |
| #176 | Multimediální klávesa na zesílení zvuku (master) |
| Mod4 + #174 | Multimediální klávesa na zeslabení zvuku (PCM) |
| Mod4 + #176 | Multimediální klávesa na zesílení zvuku (PCM) |
| Mod4 + c | Zamkne počítač (xscreensaver-command -lock) |
| Mod4 + s | Umístí/zruší plovoucí okno na všechny plochy |
| Mod4 + a | Nastaví/zruší možnost umístit plovoucí okno vždy nad ostatníma |
| Mod4 + d | Schová okno |
| Mod4 + Mod1 + Left | Zvětší šířku master okna o 5% |
| Mod4 + Mod1 + Right | Zmenší šířku master okna o 5% |
| Mod4 + Mod1 + Up | Zmenší výšku master okna o 5% |
| Mod4 + Mod1 + Down | Zmenší výšku master okna o 5% |
| Mod4 + q | Zobrazí/schová titlebar |
Navazující článek: Awesome 3.4.1 - fastlinux modifikace.




























