You are not logged in.

#1 2019-04-25 22:28:08

hhh
Meep!
Registered: 2015-09-17
Posts: 8,721
Website

Beginner tutorial: Awesome WM, a tiling window manager

This is a beginner tutorial, all commands and instructions will be simplified down to my level, I expect that more advanced users can interpret the instructions to their needs.

Awesome is a highly configurable tiling window manager that uses lua, creates it's own session and is n00b friendly in many ways, but still has a fairly steep learning curve. This tutorial aims to simplify that curve and is geared to users already running a BunsenLabs Openbox session (helium/stretch or lithium/buster, hydrogen/stretch probably needs a few more steps for the volume icon) though it is easily adapted for other systems.

I'm not an expert, I am a novice. I used awesome a few years ago, loved it, and then forgot everything. This is the result of the last 3 days. I'm trying to make it easy for BL users to add an awesome session to their current system.

Install awesome...

sudo apt install awesome

awesome creates it's own session, so logout and choose awesome as your session and login. modkey(Super/Windows)+s will open a shortcut menu that auto-updates when you reconfigure known basic shortcuts.

As you can see there are many shortcuts, and many of them are awkward, and some of the terminology might not be clear.

Terms...

client=window
tag=workspace
wibox=panel
widget=panel applet (clock, systray, etc...)
modkey=Super/Windows key
"Mod1"=both Alt keys

beautiful=theming module
naughty=notification module

You've installed awesome, a session has been created and you are now logged in to your awesome session. From left-to-right on your wibox/panel you'll find the awesome menu launcher, 9 tags, a blank space where your opened apps will display, some widgets, and a layout-switcher icon.

Some default keybindings...

modkey+Enter=open the default terminal
modkey+Shift+q=exit awesome

Logout (modkey+Shift+q), you'll just be frustrated as a beginner using this session, especially if you're used to BunsenLabs' shortcuts. Login to your Openbox session, we'll set awesome up from there.

The next post might take some time to appear, I want to make sure I'm not giving poor instructions.

Offline

#2 2019-04-25 22:43:04

hhh
Meep!
Registered: 2015-09-17
Posts: 8,721
Website

Re: Beginner tutorial: Awesome WM, a tiling window manager

awesome is configured by lua files. Although the syntax for lua is a little tricky, the code itself is human readable.

The main config file is rc.lua. Many theme configs are managed by theme.lua.

Here is where my customizations begin...

First, create a folder in ~/.config named awesome. Create 2 files inside of that folder, one named rc.lua and one named theme.lua. Finally, create another file there named autorun.sh with the following content...

#!/usr/bin/env bash

function run {
  if ! pgrep -f $1 ;
  then
    $@&
  fi
}

Make that script executable (in Thunar, right-click the file>Properties>Permissions, check the box for 'Allow this file to run as a program'). Then add the following to the bottom of the file, directly after the code you just created. Note that your synclient line may be different and I have not included the syndaemon line which you might want to add, both of which you can check against your openbox autostart file. Do not add "&" to the end of your run commands and DO NOT include the Openbox xscape line that BL adds to the Openbox autostart, the last thing you want is something overriding the modkey in this window manager! ...

run /usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1
run synclient VertEdgeScroll=0 HorizEdgeScroll=0 TapButton1=1 2>/dev/null
run thunar --daemon
run light-locker
run bl-compositor --start
run nm-applet
run pnmixer
run xfce4-power-manager
run bl-conky-session --autostart

Now create content in the 2 other files in ~/.config awesome, they should be regular text files. rc.lua...

-- 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")

-- Standard awesome library
local gears = require("gears")
local awful = require("awful")
require("awful.autofocus")
-- Widget and layout library
local wibox = require("wibox")
-- Theme handling library
local beautiful = require("beautiful")
-- Notification library
local naughty = require("naughty")
--!Notification timeout in seconds
naughty.config.defaults.timeout = 30
local menubar = require("menubar")
local hotkeys_popup = require("awful.hotkeys_popup")
-- Enable hotkeys help widget for VIM and other apps
-- when client with a matching name is opened:
require("awful.hotkeys_popup.keys")

-- Load Debian menu entries
local debian = require("debian.menu")
local has_fdo, freedesktop = pcall(require, "freedesktop")

-- {{{ Error handling
-- Check if awesome encountered an error during startup and fell back to
-- another config (This code will only ever execute for the fallback config)
if awesome.startup_errors then
    naughty.notify({ preset = naughty.config.presets.critical,
                     title = "Oops, there were errors during startup!",
                     text = awesome.startup_errors })
end

-- Handle runtime errors after startup
do
    local in_error = false
    awesome.connect_signal("debug::error", function (err)
        -- Make sure we don't go into an endless error loop
        if in_error then return end
        in_error = true

        naughty.notify({ preset = naughty.config.presets.critical,
                         title = "Oops, an error happened!",
                         text = tostring(err) })
        in_error = false
    end)
end
-- }}}

-- {{{ Variable definitions
--!Themes define colours, icons, font and wallpapers.
beautiful.init("~/.config/awesome/theme.lua")

--!Run autostart.sh
awful.spawn.with_shell("~/.config/awesome/autorun.sh")

-- This is used later as the default terminal and editor to run.
terminal = "x-terminal-emulator"
editor = os.getenv("EDITOR") or "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.
awful.layout.layouts = {
    awful.layout.suit.tile,
--    awful.layout.suit.floating,
--    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,
}
-- }}}

-- {{{ Menu
-- Create a launcher widget and a main menu
myawesomemenu = {
   { "hotkeys", function() hotkeys_popup.show_help(nil, awful.screen.focused()) end },
   { "manual", terminal .. " -e man awesome" },
   { "edit config", editor_cmd .. " " .. awesome.conffile },
   { "restart", awesome.restart },
   { "quit", function() awesome.quit() end },
}

local menu_awesome = { "awesome", myawesomemenu, beautiful.awesome_icon }
local menu_terminal = { "open terminal", terminal }

if has_fdo then
    mymainmenu = freedesktop.menu.build({
        before = { menu_awesome },
        after =  { menu_terminal }
    })
else
    mymainmenu = awful.menu({
        items = {
                  menu_awesome,
                  { "Debian", debian.menu.Debian_menu.Debian },
                  menu_terminal,
                }
    })
end


mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon,
                                      menu = mymainmenu })

-- Menubar configuration
menubar.utils.terminal = terminal -- Set the terminal for applications that require it
-- }}}

-- Keyboard map indicator and switcher
mykeyboardlayout = awful.widget.keyboardlayout()

-- {{{ Wibar
-- Create a textclock widget
--!mytextclock = wibox.widget.textclock()

--!12-hour clock, use code above for 24-hour (leave blank)
mytextclock = wibox.widget.textclock(" %l:%M %P ") --for AM/PM instead og am/pm, use %p (I know, it's counter-intuitive)

--!Create a popup month-calendar
month_calendar = awful.widget.calendar_popup.month()
month_calendar:attach( mytextclock, "tr")


-- Create a wibox for each screen and add it
local taglist_buttons = gears.table.join(
                    awful.button({ }, 1, function(t) t:view_only() end),
                    awful.button({ modkey }, 1, function(t)
                                              if client.focus then
                                                  client.focus:move_to_tag(t)
                                              end
                                          end),
                    awful.button({ }, 3, awful.tag.viewtoggle),
                    awful.button({ modkey }, 3, function(t)
                                              if client.focus then
                                                  client.focus:toggle_tag(t)
                                              end
                                          end),
                    awful.button({ }, 4, function(t) awful.tag.viewnext(t.screen) end),
                    awful.button({ }, 5, function(t) awful.tag.viewprev(t.screen) end)
                )

local tasklist_buttons = gears.table.join(
                     awful.button({ }, 1, function (c)
                                              if c == client.focus then
                                                  c.minimized = true
                                              else
                                                  c:emit_signal(
                                                      "request::activate",
                                                      "tasklist",
                                                      {raise = true}
                                                  )
                                              end
                                          end),
                     awful.button({ }, 3, function()
                                              awful.menu.client_list({ theme = { width = 250 } })
                                          end),
                     awful.button({ }, 4, function ()
                                              awful.client.focus.byidx(1)
                                          end),
                     awful.button({ }, 5, function ()
                                              awful.client.focus.byidx(-1)
                                          end))

local function set_wallpaper(s)
    -- Wallpaper
    if beautiful.wallpaper then
        local wallpaper = beautiful.wallpaper
        -- If wallpaper is a function, call it with the screen
        if type(wallpaper) == "function" then
            wallpaper = wallpaper(s)
        end
        gears.wallpaper.maximized(wallpaper, s, true)
    end
end

-- Re-set wallpaper when a screen's geometry changes (e.g. different resolution)
screen.connect_signal("property::geometry", set_wallpaper)

awful.screen.connect_for_each_screen(function(s)
    -- Wallpaper
    set_wallpaper(s)

--! Create up to 9 tags
    -- Each screen has its own tag table.
    awful.tag({ "1", "2", "3", "4", "5" }, s, awful.layout.layouts[1])

    -- Create a promptbox for each screen
    s.mypromptbox = awful.widget.prompt()
    -- Create an imagebox widget which will contain an icon indicating which layout we're using.
    -- We need one layoutbox per screen.
    s.mylayoutbox = awful.widget.layoutbox(s)
    s.mylayoutbox:buttons(gears.table.join(
                           awful.button({ }, 1, function () awful.layout.inc( 1) end),
                           awful.button({ }, 3, function () awful.layout.inc(-1) end),
                           awful.button({ }, 4, function () awful.layout.inc( 1) end),
                           awful.button({ }, 5, function () awful.layout.inc(-1) end)))
    -- Create a taglist widget
    s.mytaglist = awful.widget.taglist {
        screen  = s,
        filter  = awful.widget.taglist.filter.all,
        buttons = taglist_buttons
    }

    -- Create a tasklist widget
    s.mytasklist = awful.widget.tasklist {
        screen  = s,
        filter  = awful.widget.tasklist.filter.currenttags,
        buttons = tasklist_buttons
    }

    -- Create the wibox
    s.mywibox = awful.wibar({ position = "top", screen = s })

--!Panel widgets
    -- Add widgets to the wibox
    s.mywibox:setup {
        layout = wibox.layout.align.horizontal,
        { -- Left widgets
            layout = wibox.layout.fixed.horizontal,
--!            mylauncher,
            s.mytaglist,
            s.mypromptbox,
        },
        s.mytasklist, -- Middle widget
        { -- Right widgets
            layout = wibox.layout.fixed.horizontal,
--!            mykeyboardlayout,
            wibox.widget.systray(),
            mytextclock,
--!            s.mylayoutbox,
        },
    }
end)
-- }}}

-- {{{ Mouse bindings
root.buttons(gears.table.join(
    awful.button({ }, 3, function () mymainmenu:toggle() end),
    awful.button({ }, 4, awful.tag.viewnext),
    awful.button({ }, 5, awful.tag.viewprev)
))
-- }}}

-- {{{ Key bindings
globalkeys = gears.table.join(
    awful.key({ modkey,           }, "s",      hotkeys_popup.show_help,
              {description="show help", group="awesome"}),
    awful.key({ modkey,           }, "Left",   awful.tag.viewprev,
              {description = "view previous", group = "tag"}),
    awful.key({ modkey,           }, "Right",  awful.tag.viewnext,
              {description = "view next", group = "tag"}),
    awful.key({ modkey, "Shift"   }, "Escape", awful.tag.history.restore,
              {description = "go back", group = "tag"}),

    awful.key({ modkey,           }, "j",
        function ()
            awful.client.focus.byidx( 1)
        end,
        {description = "focus next by index", group = "client"}
    ),
    awful.key({ modkey,           }, "k",
        function ()
            awful.client.focus.byidx(-1)
        end,
        {description = "focus previous by index", group = "client"}
    ),
    awful.key({ modkey,           }, "w", function () mymainmenu:show() end,
              {description = "show main menu", group = "awesome"}),

--!Volume Keys
--[[   awful.key({}, "XF86AudioLowerVolume", function ()
     awful.util.spawn("amixer -q -D pulse sset Master 1%-", false)
   end),
   awful.key({}, "XF86AudioRaiseVolume", function ()
     awful.util.spawn("amixer -q -D pulse sset Master 1%+", false)
   end),
   awful.key({}, "XF86AudioMute", function ()
     awful.util.spawn("amixer -D pulse set Master 1+ toggle", false)
   end),
--]]

--!Media Keys
   awful.key({}, "XF86AudioPlay", function()
     awful.util.spawn("playerctl play-pause", false)
   end),
   awful.key({}, "XF86AudioNext", function()
     awful.util.spawn("playerctl next", false)
   end),
   awful.key({}, "XF86AudioPrev", function()
     awful.util.spawn("playerctl previous", false)
   end),

--!Application switcher
awful.key({ "Mod1",  }, "Tab", function ()
    -- If you want to always position the menu on the same place set coordinates
    awful.menu.menu_keys.down = { "Down", "Alt_L" }
    awful.menu.clients({theme = { width = 250 }}, { keygrabber=true })
end),


    -- Layout manipulation
    awful.key({ modkey, "Shift"   }, "j", function () awful.client.swap.byidx(  1)    end,
              {description = "swap with next client by index", group = "client"}),
    awful.key({ modkey, "Shift"   }, "k", function () awful.client.swap.byidx( -1)    end,
              {description = "swap with previous client by index", group = "client"}),
    awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end,
              {description = "focus the next screen", group = "screen"}),
    awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end,
              {description = "focus the previous screen", group = "screen"}),
    awful.key({ modkey,           }, "u", awful.client.urgent.jumpto,
              {description = "jump to urgent client", group = "client"}),
    awful.key({ modkey,           }, "Tab",
        function ()
            awful.client.focus.history.previous()
            if client.focus then
                client.focus:raise()
            end
        end,
        {description = "go back", group = "client"}),

    -- Standard program
    awful.key({ modkey,           }, "t", function () awful.spawn(terminal) end,
              {description = "open a terminal", group = "launcher"}),
    awful.key({ modkey, "Control" }, "r", awesome.restart,
              {description = "reload awesome", group = "awesome"}),
    awful.key({ modkey, "Shift"   }, "q", awesome.quit,
              {description = "quit awesome", group = "awesome"}),

    awful.key({ modkey,           }, "l",     function () awful.tag.incmwfact( 0.05)          end,
              {description = "increase master width factor", group = "layout"}),
    awful.key({ modkey,           }, "h",     function () awful.tag.incmwfact(-0.05)          end,
              {description = "decrease master width factor", group = "layout"}),
    awful.key({ modkey, "Shift"   }, "h",     function () awful.tag.incnmaster( 1, nil, true) end,
              {description = "increase the number of master clients", group = "layout"}),
    awful.key({ modkey, "Shift"   }, "l",     function () awful.tag.incnmaster(-1, nil, true) end,
              {description = "decrease the number of master clients", group = "layout"}),
    awful.key({ modkey, "Control" }, "h",     function () awful.tag.incncol( 1, nil, true)    end,
              {description = "increase the number of columns", group = "layout"}),
    awful.key({ modkey, "Control" }, "l",     function () awful.tag.incncol(-1, nil, true)    end,
              {description = "decrease the number of columns", group = "layout"}),
    awful.key({ modkey,           }, "space", function () awful.layout.inc( 1)                end,
              {description = "select next", group = "layout"}),
    awful.key({ modkey, "Shift"   }, "space", function () awful.layout.inc(-1)                end,
              {description = "select previous", group = "layout"}),

    awful.key({ modkey,  }, "a",
              function ()
                  local c = awful.client.restore()
                  -- Focus restored client
                  if c then
                    c:emit_signal(
                        "request::activate", "key.unminimize", {raise = true}
                    )
                  end
              end,
              {description = "restore minimized", group = "client"}),

    -- Prompt

--!Launch my custom applications and scripts
awful.key({ }, "Print", function () awful.util.spawn("xfce4-screenshooter") end),

awful.key({ modkey, }, "Escape", function () awful.util.spawn("yad-awesome-exit.sh") end),


--awful.key({ modkey, }, "r", function () awful.util.spawn("gmrun") end),
awful.key({ modkey, }, "r", function () awful.util.spawn("xfce4-appfinder --collapsed --disable-server") end),

awful.key({ modkey, }, "b", function () awful.util.spawn("x-www-browser") end),

awful.key({ modkey, }, "f", function () awful.util.spawn("bl-file-manager") end),

awful.key({ modkey, }, "e", function () awful.util.spawn("bl-text-editor") end),

awful.key({ "Mod1", }, "l", function () awful.util.spawn("bl-lock") end), --screen lock
-- End custom shortcuts

    awful.key({ modkey, "Shift" },            "r",     function () awful.screen.focused().mypromptbox:run() end,
              {description = "run prompt", group = "launcher"}),

    awful.key({ modkey }, "x",
              function ()
                  awful.prompt.run {
                    prompt       = "Run Lua code: ",
                    textbox      = awful.screen.focused().mypromptbox.widget,
                    exe_callback = awful.util.eval,
                    history_path = awful.util.get_cache_dir() .. "/history_eval"
                  }
              end,
              {description = "lua execute prompt", group = "awesome"}),
    -- Menubar
    awful.key({ modkey }, "p", function() menubar.show() end,
              {description = "show the menubar", group = "launcher"})
)

clientkeys = gears.table.join(
    awful.key({ modkey,  "Shift"    }, "f",
        function (c)
            c.fullscreen = not c.fullscreen
            c:raise()
        end,
        {description = "toggle fullscreen", group = "client"}),
    awful.key({ modkey, }, "q",      function (c) c:kill()                         end,
              {description = "close", group = "client"}),
    awful.key({ modkey, "Control" }, "space",  awful.client.floating.toggle                     ,
              {description = "toggle floating", group = "client"}),
    awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end,
              {description = "move to master", group = "client"}),
    awful.key({ modkey,           }, "o",      function (c) c:move_to_screen()               end,
              {description = "move to screen", group = "client"}),
    awful.key({ modkey, "Shift"   }, "t",      function (c) c.ontop = not c.ontop            end,
              {description = "toggle keep on top", group = "client"}),
    awful.key({ modkey,           }, "z",
        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 ,
        {description = "minimize", group = "client"}),
    awful.key({ modkey,           }, "m",
        function (c)
            c.maximized = not c.maximized
            c:raise()
        end ,
        {description = "(un)maximize", group = "client"}),
    awful.key({ modkey, "Control" }, "m",
        function (c)
            c.maximized_vertical = not c.maximized_vertical
            c:raise()
        end ,
        {description = "(un)maximize vertically", group = "client"}),
    awful.key({ modkey, "Shift"   }, "m",
        function (c)
            c.maximized_horizontal = not c.maximized_horizontal
            c:raise()
        end ,
        {description = "(un)maximize horizontally", group = "client"})
)

-- Bind all key numbers to tags.
-- Be careful: we use keycodes to make it work on any keyboard layout.
-- This should map on the top row of your keyboard, usually 1 to 9.
for i = 1, 9 do
    globalkeys = gears.table.join(globalkeys,
        -- View tag only.
        awful.key({ modkey }, "#" .. i + 9,
                  function ()
                        local screen = awful.screen.focused()
                        local tag = screen.tags[i]
                        if tag then
                           tag:view_only()
                        end
                  end,
                  {description = "view tag #"..i, group = "tag"}),
        -- Toggle tag display.
        awful.key({ modkey, "Control" }, "#" .. i + 9,
                  function ()
                      local screen = awful.screen.focused()
                      local tag = screen.tags[i]
                      if tag then
                         awful.tag.viewtoggle(tag)
                      end
                  end,
                  {description = "toggle tag #" .. i, group = "tag"}),
        -- Move client to tag.
        awful.key({ modkey, "Shift" }, "#" .. i + 9,
                  function ()
                      if client.focus then
                          local tag = client.focus.screen.tags[i]
                          if tag then
                              client.focus:move_to_tag(tag)
                          end
                     end
                  end,
                  {description = "move focused client to tag #"..i, group = "tag"}),
        -- Toggle tag on focused client.
        awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
                  function ()
                      if client.focus then
                          local tag = client.focus.screen.tags[i]
                          if tag then
                              client.focus:toggle_tag(tag)
                          end
                      end
                  end,
                  {description = "toggle focused client on tag #" .. i, group = "tag"})
    )
end

clientbuttons = gears.table.join(
    awful.button({ }, 1, function (c)
        c:emit_signal("request::activate", "mouse_click", {raise = true})
    end),
    awful.button({ modkey }, 1, function (c)
        c:emit_signal("request::activate", "mouse_click", {raise = true})
        awful.mouse.client.move(c)
    end),
    awful.button({ modkey }, 3, function (c)
        c:emit_signal("request::activate", "mouse_click", {raise = true})
        awful.mouse.client.resize(c)
    end)
)

-- Set keys
root.keys(globalkeys)
-- }}}

-- {{{ Rules
-- Rules to apply to new clients (through the "manage" signal).
awful.rules.rules = {
    -- All clients will match this rule.
    { rule = { },
      properties = { border_width = 1,
                     border_color = beautiful.border_normal,
                     focus = awful.client.focus.filter,
                     raise = true,
                     size_hints_honor = false,
                     keys = clientkeys,
                     buttons = clientbuttons,
                     screen = awful.screen.preferred,
                     placement = awful.placement.no_overlap+awful.placement.no_offscreen
     }
    },

--!my dialog rules
    { rule = { instance = "xfce4-appfinder"},
       properties = { floating = true },
       callback = function (c)
         awful.placement.centered(c,nil)
       end
     },

    { rule = { instance = "yad"},
       properties = { floating = true },
       callback = function (c)
         awful.placement.centered(c,nil)
       end
     },

    -- Floating clients.
    { rule_any = {
        instance = {
          "DTA",  -- Firefox addon DownThemAll.
          "copyq",  -- Includes session name in class.
          "pinentry",
        },
        class = {
          "Arandr",
          "Blueman-manager",
          "Gpick",
          "Kruler",
          "MessageWin",  -- kalarm.
          "Sxiv",
          "Tor Browser", -- Needs a fixed window size to avoid fingerprinting by screen size.
          "Wpa_gui",
          "veromix",
          "xtightvncviewer"},

        -- Note that the name property shown in xprop might be set slightly after creation of the client
        -- and the name shown there might not match defined rules here.
        name = {
          "Event Tester",  -- xev.
        },
        role = {
          "AlarmWindow",  -- Thunderbird's calendar.
          "ConfigManager",  -- Thunderbird's about:config.
          "pop-up",       -- e.g. Google Chrome's (detached) Developer Tools.
        }
      }, properties = { floating = true }},

    -- Add titlebars to normal clients and dialogs
    { rule_any = {type = { "normal", "dialog" }
      }, properties = { titlebars_enabled = false --[[!default is true--]] }
    },

    -- Set Firefox to always map on the tag named "2" on screen 1.
    -- { rule = { class = "Firefox" },
    --   properties = { screen = 1, tag = "2" } },
}
-- }}}

-- {{{ Signals
-- Signal function to execute when a new client appears.
client.connect_signal("manage", function (c)
    -- Set the windows at the slave,
    -- i.e. put it at the end of others instead of setting it master.
    -- if not awesome.startup then awful.client.setslave(c) end

    if awesome.startup
      and not c.size_hints.user_position
      and not c.size_hints.program_position then
        -- Prevent clients from being unreachable after screen count changes.
        awful.placement.no_offscreen(c)
    end
end)

-- Add a titlebar if titlebars_enabled is set to true in the rules.
client.connect_signal("request::titlebars", function(c)
    -- buttons for the titlebar
    local buttons = gears.table.join(
        awful.button({ }, 1, function()
            c:emit_signal("request::activate", "titlebar", {raise = true})
            awful.mouse.client.move(c)
        end),
        awful.button({ }, 3, function()
            c:emit_signal("request::activate", "titlebar", {raise = true})
            awful.mouse.client.resize(c)
        end)
    )

    awful.titlebar(c) : setup {
        { -- Left
            awful.titlebar.widget.iconwidget(c),
            buttons = buttons,
            layout  = wibox.layout.fixed.horizontal
        },
        { -- Middle
            { -- Title
                align  = "center",
                widget = awful.titlebar.widget.titlewidget(c)
            },
            buttons = buttons,
            layout  = wibox.layout.flex.horizontal
        },
        { -- Right
            awful.titlebar.widget.floatingbutton (c),
            awful.titlebar.widget.maximizedbutton(c),
            awful.titlebar.widget.stickybutton   (c),
            awful.titlebar.widget.ontopbutton    (c),
            awful.titlebar.widget.closebutton    (c),
            layout = wibox.layout.fixed.horizontal()
        },
        layout = wibox.layout.align.horizontal
    }
end)

-- Enable sloppy focus, so that focus follows mouse.

--!Uncomment the next 6 lines to enable
--[[client.connect_signal("mouse::enter", function(c)
    c:emit_signal("request::activate", "mouse_enter", {raise = false})
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)--]]

-- }}}

And theme.lua...

---------------------------
-- Default awesome theme --
---------------------------

local theme_assets = require("beautiful.theme_assets")
local xresources = require("beautiful.xresources")
local dpi = xresources.apply_dpi

local gfs = require("gears.filesystem")
local themes_path = gfs.get_themes_dir()

local theme = {}

theme.font          = "sans bold 10"

theme.bg_normal     = "#152126"
theme.bg_focus      = "#346077"
theme.bg_urgent     = "#ff0000"
theme.bg_minimize   = "#40474A"
theme.bg_systray    = theme.bg_normal

theme.fg_normal     = "#d3dae3"
theme.fg_focus      = "#ffffff"
theme.fg_urgent     = "#ffffff"
theme.fg_minimize   = "#9AABB3"

theme.useless_gap   = dpi(4)
theme.border_width  = dpi(0)
theme.border_normal = "#152126"
theme.border_focus  = "#346077"
theme.border_marked = "#346077"

-- There are other variable sets
-- overriding the default one when
-- defined, the sets are:
-- taglist_[bg|fg]_[focus|urgent|occupied|empty|volatile]
-- tasklist_[bg|fg]_[focus|urgent]
-- titlebar_[bg|fg]_[normal|focus]
-- tooltip_[font|opacity|fg_color|bg_color|border_width|border_color]
-- mouse_finder_[color|timeout|animate_timeout|radius|factor]
-- prompt_[fg|bg|fg_cursor|bg_cursor|font]
-- hotkeys_[bg|fg|border_width|border_color|shape|opacity|modifiers_fg|label_bg|label_fg|group_margin|font|description_font]
-- Example:
--theme.taglist_bg_focus = "#ff0000"

-- Generate taglist squares:
local taglist_square_size = dpi(4)
theme.taglist_squares_sel = theme_assets.taglist_squares_sel(
    taglist_square_size, theme.fg_normal
)
theme.taglist_squares_unsel = theme_assets.taglist_squares_unsel(
    taglist_square_size, theme.fg_normal
)

-- Variables set for theming notifications:
-- notification_font
-- notification_[bg|fg]
-- notification_[width|height|margin]
-- notification_[border_color|border_width|shape|opacity]

-- Variables set for theming the menu:
-- menu_[bg|fg]_[normal|focus]
-- menu_[border_color|border_width]
theme.menu_submenu_icon = themes_path.."default/submenu.png"
theme.menu_height = dpi(18)
theme.menu_width  = dpi(200)

-- You can add as many variables as
-- you wish and access them by using
-- beautiful.variable in your rc.lua
--theme.bg_widget = "#cc0000"

-- Define the image to load
theme.titlebar_close_button_normal = themes_path.."default/titlebar/close_normal.png"
theme.titlebar_close_button_focus  = themes_path.."default/titlebar/close_focus.png"

theme.titlebar_minimize_button_normal = themes_path.."default/titlebar/minimize_normal.png"
theme.titlebar_minimize_button_focus  = themes_path.."default/titlebar/minimize_focus.png"

theme.titlebar_ontop_button_normal_inactive = themes_path.."default/titlebar/ontop_normal_inactive.png"
theme.titlebar_ontop_button_focus_inactive  = themes_path.."default/titlebar/ontop_focus_inactive.png"
theme.titlebar_ontop_button_normal_active = themes_path.."default/titlebar/ontop_normal_active.png"
theme.titlebar_ontop_button_focus_active  = themes_path.."default/titlebar/ontop_focus_active.png"

theme.titlebar_sticky_button_normal_inactive = themes_path.."default/titlebar/sticky_normal_inactive.png"
theme.titlebar_sticky_button_focus_inactive  = themes_path.."default/titlebar/sticky_focus_inactive.png"
theme.titlebar_sticky_button_normal_active = themes_path.."default/titlebar/sticky_normal_active.png"
theme.titlebar_sticky_button_focus_active  = themes_path.."default/titlebar/sticky_focus_active.png"

theme.titlebar_floating_button_normal_inactive = themes_path.."default/titlebar/floating_normal_inactive.png"
theme.titlebar_floating_button_focus_inactive  = themes_path.."default/titlebar/floating_focus_inactive.png"
theme.titlebar_floating_button_normal_active = themes_path.."default/titlebar/floating_normal_active.png"
theme.titlebar_floating_button_focus_active  = themes_path.."default/titlebar/floating_focus_active.png"

theme.titlebar_maximized_button_normal_inactive = themes_path.."default/titlebar/maximized_normal_inactive.png"
theme.titlebar_maximized_button_focus_inactive  = themes_path.."default/titlebar/maximized_focus_inactive.png"
theme.titlebar_maximized_button_normal_active = themes_path.."default/titlebar/maximized_normal_active.png"
theme.titlebar_maximized_button_focus_active  = themes_path.."default/titlebar/maximized_focus_active.png"

theme.wallpaper = "~/Pictures/wallpapers/wall.png"

-- You can use your own layout icons like this:
theme.layout_fairh = themes_path.."default/layouts/fairhw.png"
theme.layout_fairv = themes_path.."default/layouts/fairvw.png"
theme.layout_floating  = themes_path.."default/layouts/floatingw.png"
theme.layout_magnifier = themes_path.."default/layouts/magnifierw.png"
theme.layout_max = themes_path.."default/layouts/maxw.png"
theme.layout_fullscreen = themes_path.."default/layouts/fullscreenw.png"
theme.layout_tilebottom = themes_path.."default/layouts/tilebottomw.png"
theme.layout_tileleft   = themes_path.."default/layouts/tileleftw.png"
theme.layout_tile = themes_path.."default/layouts/tilew.png"
theme.layout_tiletop = themes_path.."default/layouts/tiletopw.png"
theme.layout_spiral  = themes_path.."default/layouts/spiralw.png"
theme.layout_dwindle = themes_path.."default/layouts/dwindlew.png"
theme.layout_cornernw = themes_path.."default/layouts/cornernww.png"
theme.layout_cornerne = themes_path.."default/layouts/cornernew.png"
theme.layout_cornersw = themes_path.."default/layouts/cornersww.png"
theme.layout_cornerse = themes_path.."default/layouts/cornersew.png"

-- Generate Awesome icon:
theme.awesome_icon = theme_assets.awesome_icon(
    theme.menu_height, theme.bg_focus, theme.fg_focus
)

-- Define the icon theme for application icons. If not set then the icons
-- from /usr/share/icons and /usr/share/icons/hicolor will be used.
theme.icon_theme = "Papirus"

return theme

-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

Give me a few minutes while I make sure my instructions are correct.

-edit- My autostart was truncated, please check yours to make sure polkit and synclient are included.

Last edited by hhh (2019-04-28 14:27:16)

Offline

#3 2019-04-25 22:56:55

hhh
Meep!
Registered: 2015-09-17
Posts: 8,721
Website

Re: Beginner tutorial: Awesome WM, a tiling window manager

Those are my rc.lua and theme lua configs, they're designed and formatted to ease the transition from BL Openbox to awesome. For example, modkey-f in awesome by default makes an active window fullscreen, but opens bl-file-manager in BL. My config favors the Openbox shortcut and should open your file manager.

I've tried to comment most things, ! for inline comments, block comments should be obvious.

Media keys are hopefully enabled, they work for me (rc.lua, line #300). My volume-key settings are commented out because you should be using pnmixer set to use hotkeys. Same with xfce4-power-manager, it will control the backlight keys, screen-brightness should get adjusted OOTB even if the widget doesn't tell you anything (Brightness 93, whatever).

Hover over the clock widget, a calendar for the month pops up, no frills, move your mouse away, it disappears. Click to keep it on top, click again to escape.

Open rc.lua, it looks a hot mess but it's not that bad. Go to line #52, you can see that the theme.lua and autorun.sh files are being called. Open theme.lua and go to line #100. The theme is calling an image from your Pictures/wallpapers folder named "wall.png" to use as your wallpaper. Create a shortcut to your current wallpaper named "wall.png" and place it in your wallpaper folder, it's fine if it links to a jpg image instead of a png. (Protip, call this shortcut from nitrogen or feh in Openbox and from lightdm-gtk.conf or slick-greeter.conf in /etc/lightdm. The full path is required for lightdm, I believe [/home/username/Pictures/wallpapers/wall.png, replace username with your user name]. Now when you want to change your wallpaper, just create a new shortcut to it named wall.png, move it to ~/Pictures/wallpapers, overriding the old shortcut, and logout. All your backgrounds will be updated).

In line #127 of theme.lua, I'm calling Papirus icons. Either change the theme name to something installed on your system, or install papirus-icon-theme. In stretch, that package is in stretch backports...

https://backports.debian.org/Instructions/

Logout and login to awesome.

Give me a few minutes here to check things...

Last edited by hhh (2019-04-26 13:49:18)

Offline

#4 2019-04-25 23:15:39

hhh
Meep!
Registered: 2015-09-17
Posts: 8,721
Website

Re: Beginner tutorial: Awesome WM, a tiling window manager

There might be some mistakes or unclear instructions above, we'll get those sorted soon.

Now, the rc.lua I've given you uses many familiar shortcuts...

modkey+t opens your terminal

modkey+f opens your file manager

modkey+e opens your text-editor

A few are slightly different...

"Mod1' (Alt) +l locks your screen

modkey+b opens your browser.

You only have one layout mode with this rc.lua, and that is tiling. Here are the shortcuts...

modkey+numbers 1-5 moves you to a new tag/workspace (the default config enables 9 tags, FYI)

modkey+Shift+1-5 moves the active client/window to that tag, but does not follow it. So, move a client to tag 3, then modkey+3 to move to it.

modkey+Tab, cycle between the last two active clients
modkey+j/k, cycle forward and back through all active clients (not minimized) on a tag/workspace.
modkey+l/h resizes the tile columns horizontally (needs 2 windows open to work, no point in resizing an already full-sized window)


modkey+m, remove a window from tiling mode so it displays maximized, but is still part of the modkey+j/k cycle

^ This one's important. If you ever are wondering why a window isn't tiling, check that it isn't already maximized. awesome will add a little "+" to the title in the wibox/panel to show it's maximized. modkey+m to toggle maximize on/off.

BTW, I've removed titlebars from the windows in this rc.lua. To enable them, change the value in line #590 from false to true.

modkey+q, quit a window
modkey+z, Minimize/iconify a window
modkey+a, un-minimize the most recently minimized window, then the next most recently minimized, etc...
modkey+Shift+f, open the active window fullscreen
modkey+r, open gmrun
modkey+Shift+r, open the awesome run dialog, it will appear on the left of your panel after the tags and behaves likes dmrun (tab autocomplete)
modkey+p, opens the awesome launcher
modkey+w, opens the right-click awesome menu
Mod1(Alt)+Tab, opens a client-menu that lets you choose any opened window, including minimized ones.

Those last two menus will open under the mouse cursor. I tend to hide my cursor in my lower-left screen, now I know to look there for those menus if I don't immediately see them.

I need a breather and to check everything, play with this while I'm gone.

Remember, modkey+s opens the dynamically adjusting shortcut menu, and modkey+Shift+q exits the session.

Last edited by hhh (2019-04-26 03:11:19)

Offline

#5 2019-04-25 23:35:44

hhh
Meep!
Registered: 2015-09-17
Posts: 8,721
Website

Re: Beginner tutorial: Awesome WM, a tiling window manager

For conky, set "Window type" to "override". To reconfigure rc.lua and/or theme.lua, edit it/them and then use 'Control+Shift+r' to restart awesome. Note that with these configs, conky will also restart, which can get messy. I recommend removing conky from the autorun.sh script until you're done configuring awesome.

Offline

#6 2019-04-25 23:40:17

hhh
Meep!
Registered: 2015-09-17
Posts: 8,721
Website

Re: Beginner tutorial: Awesome WM, a tiling window manager

My awesome theme is meant to be used with BL-Moonlight GTK themes and BL-greyIcons icons + Papirus icons...

https://github.com/hhhorb/Lithium_theme … ght.tar.gz

https://github.com/hhhorb/Lithium_theme … ons.tar.gz

https://packages.debian.org/buster/papirus-icon-theme

Offline

#7 2019-04-25 23:52:59

hhh
Meep!
Registered: 2015-09-17
Posts: 8,721
Website

Re: Beginner tutorial: Awesome WM, a tiling window manager

I'm using a replacement for bl-exit that's being discussed in the development forum. To use it with this rc.lua file, create a script in ~/bin named yad-awesome-exit.sh, add the following content...

#!/usr/bin/env bash

########################################################################
##                                                                    ##
## Init and desktop agnostic "yad" based Logout/Exit dialogue.        ##
##                                                                    ##
## Written in response to the seeimingly widely held belief that      ##
## 'systemctl' is what you _have_ to use for power operations if you  ##
## have systemd, regardless that dbus calls are arguably superior.    ##
##                                                                    ##
## Since systemd users like systemd specific commands so much, here's ##
## a system exit dialogue that uses systemd's calls for every power   ##
## or session control action, while remaining compatible with         ##
## non-systemd systems.                                               ##
##                                                                    ##
## Originally written for Bunsenlabs "Lithium" by Bearded_Blunder     ##
## <init.choice@mxstuff.org> February 2019                            ##
##                                                                    ##
## Copyright © 2019 MXStuff.org <init.choice@mxstuff.org>             ##
##                                                                    ##
## This program is free software. It comes without any warranty, to   ##
## the extent permitted by applicable law. You can redistribute it    ##
## and/or modify it under the terms of the Do What The Fuck You Want  ##
## To Public License, Version 2, as published by Sam Hocevar. See     ##
## http://www.wtfpl.net/ for more details.                            ##
##                                                                    ##
########################################################################

########################################################################
#       Config block begins. Copy & paste block to config file.        #
#       Parser expects a file in any of these locations:               #
#       Vendor: Config added by "vendors" (eg BL).                     #
#              /usr/share/bunsen/conf.d/bl-exit.conf                   #
#       Local Administrator: Settings added by sysadmins               #
#              /etc/bl-exit/bl-exit.conf                               #
#       User Settings: Individual preferences.                         #
#              ~/.config/bunsen/bl-exit.conf                           #
#                                                                      #
#  NOTE: These files are not needed for operation, though at least one #
#        is required to edit settings with the --config-system or      #
#        --config arguments, when present they are read in the order   #
#        listed, and settings from the last file read take precedence, #
#        the resulting behaviour is the cumulative total of changes in #
#        each file in order, relative to the defaults in this script.  #
#                                                                      #
#        --configure-system                                            #
#            Will open /etc/bl-exit/bl-exit.conf if present or copy    #
#            /usr/share/bunsen/conf.d/bl-exit.conf to /etc/bl-exit/    #
#            then open it. If neither exist it will fail.              #
#                                                                      #
#        --configure                                                   #
#            Will check if ~/.config/bl-exit/bl-exit.conf exists and   #
#            open it for editing. If it does not it will try to copy   #
#            first /etc/bl-exit/bl-exit.conf then                      #
#            /usr/share/bunsen/conf.d/bl-exit.conf and open the copy   #
#            for editing. If no file exists it will fail.              #
#                                                                      #
########################################################################

# Default interface with no arguments see `bl-exit --help` for options.
# Specifying a non-graphical option such as --reboot here is silly.
DEFAULT_MODE="--vertical"

## Strings and Icons - These blocks make local translation easier ##

# Globally, except "icon" interface, button text/keyboard accelerators leading _underscore defines alt+key accelerator.
# Default accelerators except for "Cancel" correspond with the short command line arguments for that specific action.
# Colours and fonts can be specified. Example:
# For BL-Moonlight obconf tells me things are using "Sans" `fc-match Sans` says "Noto Sans" so I've specified
# 'Noto Sans Mono Bold' for buttons and 'Noto Sans Mono' for tooltips, the foreground colour I've picked up from the icons.
# The background from the windows themselves.
# CUSTOM Uncomment and comment out "DEFAULT" to enable and use.
#<identifier>  <push text field bg away from icons> <set font & button bg colours> text and _accelerators </span>
#TXT_CANCELYAD="<span font='Noto Sans Mono'> </span><span font='Noto Sans Mono Bold' foreground='#78909C' background='#152126'> _Cancel    </span>"
#TXT_LOGOUT_PC="<span font='Noto Sans Mono'> </span><span font='Noto Sans Mono Bold' foreground='#78909C' background='#152126'> _Log out   </span>"
#TXT_LOCK_SCRN="<span font='Noto Sans Mono'> </span><span font='Noto Sans Mono Bold' foreground='#78909C' background='#152126'> Loc_k      </span>"
#TXT_SLEEP_RAM="<span font='Noto Sans Mono'> </span><span font='Noto Sans Mono Bold' foreground='#78909C' background='#152126'> _Sleep     </span>"
#TXT_RESTARTPC="<span font='Noto Sans Mono'> </span><span font='Noto Sans Mono Bold' foreground='#78909C' background='#152126'> Re_boot    </span>"
#TXT_SHUT_DOWN="<span font='Noto Sans Mono'> </span><span font='Noto Sans Mono Bold' foreground='#78909C' background='#152126'> _Power off </span>"
#TXT_HIBERNATE="<span font='Noto Sans Mono'> </span><span font='Noto Sans Mono Bold' foreground='#78909C' background='#152126'> H_ibernate </span>"
#TXT_HYBRIDZZZ="<span font='Noto Sans Mono'> </span><span font='Noto Sans Mono Bold' foreground='#78909C' background='#152126'> H_yb Sleep </span>"
# NOTE: Text alignment will be unpredictablep without a monospace font and matching field lengths.
# `yad --font` and `yad --color` are useful for selection.

# DEFAULT
TXT_CANCELYAD="<span font='Noto Sans Mono'> _Cancel   </span>"
TXT_LOGOUT_PC="<span font='Noto Sans Mono'> _Log out  </span>"
TXT_LOCK_SCRN="<span font='Noto Sans Mono'> Loc_k     </span>"
TXT_SLEEP_RAM="<span font='Noto Sans Mono'> _Sleep    </span>"
TXT_RESTARTPC="<span font='Noto Sans Mono'> Re_boot   </span>"
TXT_SHUT_DOWN="<span font='Noto Sans Mono'> _Power off</span>"
TXT_HIBERNATE="<span font='Noto Sans Mono'> H_ibernate</span>"
TXT_HYBRIDZZZ="<span font='Noto Sans Mono'> H_yb Sleep</span>"

# Globally, tooltips.  I've just bunged in something for now :P
# Colours can be set too, Custom 'BL-Moonlight" example:
# CUSTOM Uncomment and comment out "DEFAULT" to enable and use.
#TIP_CANCELYAD="<span font='Noto Sans Mono' foreground='#78909C' background='#152126'> Cancel and close window. </span>"
#TIP_LOGOUT_PC="<span font='Noto Sans Mono' foreground='#78909C' background='#152126'> Log out from current session. </span>"
#TIP_LOCK_SCRN="<span font='Noto Sans Mono' foreground='#78909C' background='#152126'> Lock current session. </span>"
#TIP_SLEEP_RAM="<span font='Noto Sans Mono' foreground='#78909C' background='#152126'> Suspend computer. </span>"
#TIP_RESTARTPC="<span font='Noto Sans Mono' foreground='#78909C' background='#152126'> Restart computer. </span>"
#TIP_SHUT_DOWN="<span font='Noto Sans Mono' foreground='#78909C' background='#152126'> Shut down and power off. </span>"
#TIP_HIBERNATE="<span font='Noto Sans Mono' foreground='#78909C' background='#152126'> Save computer state and power off. </span>"
#TIP_HYBRIDZZZ="<span font='Noto Sans Mono' background='#152126'> Put in hybrid sleep mode. </span>"

# DEFAULT
TIP_CANCELYAD="Cancel and close window."
TIP_LOGOUT_PC="Log out from current session."
TIP_LOCK_SCRN="Lock current session."
TIP_SLEEP_RAM="Suspend computer."
TIP_RESTARTPC="Restart computer."
TIP_SHUT_DOWN="Shut down and power off."
TIP_HIBERNATE="Save computer state and power off."
TIP_HYBRIDZZZ="Put in hybrid sleep mode."

# Icons for normal buttons, for no icons in non-icon interfaces, set ""
ICO_CANCELYAD="gtk-close"
ICO_LOCK_SCRN="gnome-lockscreen"
ICO_LOGOUT_PC="gnome-logout"
ICO_SLEEP_RAM="system-suspend"
ICO_HIBERNATE="system-hibernate"
ICO_HYBRIDZZZ="system-suspend-hibernate"
ICO_RESTARTPC="system-reboot"
ICO_SHUT_DOWN="system-shutdown"
# TODO: Create NO_ICONS= key so these can be left set when disabling button icons
# Trivial to clear these values when NO_ICONS="true"

# Icon interface images directory.
# This can be set to a custom icon set in a folder of your choice.
# Note: trailing / is required.
IMAGE_PATH="/usr/share/images/bunsen/exit/light/"
# Button image files.
BTN_CANCELYAD="cancel-sm.png"
BTN_LOGOUT_PC="logout-sm.png"
# CURRENTLY NO FILE for BTN_LOCK_SCRN="$IMAGE_PATH/lock.png"
# Using cancel[-sm].png ../dark/ renamed & copied [or reverse].
BTN_LOCK_SCRN="lock-sm.png"
BTN_SLEEP_RAM="sleep-sm.png"
BTN_RESTARTPC="reboot-sm.png"
BTN_SHUT_DOWN="poweroff-sm.png"
BTN_HIBERNATE="hibernate-sm.png"
# CURRENTLY NO FILE BTN_HYBRIDZZZ="$IMAGE_PATH/hybrid.png"
# Using hibernate[-sm].png ../dark/ renamed & copied [or reverse].
BTN_HYBRIDZZZ="hybrid-sm.png"

# YAD tweaks
BORDERS_STD=7
BORDERS_ICON=20
# TODO: See about re-enabling the text & image on top.

# Troubleshooting :
# Some screen locking software does not listen for logind calls,
# screen locking then fails, for such screen lockers set
# LOCK_SCREEN_COMMAND="what-locks-screen  --now"
LOCK_SCREEN_COMMAND=""
# Known tested examples: "i3lock", "slock", "xsceeensaver-command -lock"

# May be useful if dialogue fails to launch because graphical session
# is detected as a TTY typically when no display manager is installed.
TTY_DETECT_OVERRIDE="false"
# When set to "true" TTY use with no arguments will break as a
# graphical user interface will be called.

########################################################################
#       Config block ends. Copy & paste block to config file.          #
########################################################################

# Usage: parse_config_vars <file>
# No arrays, just read variables individually.
# Preexisting variables will be overwritten.
parse_config_vars(){
    [[ -f $1 ]] || { echo "$1 is not a file." >&2;return 1;}
    local line key value entry_regex
    entry_regex="^[[:blank:]]*([[:alnum:]_]+)[[:blank:]]*=[[:blank:]]*('[^']+'|\"[^\"]+\"|[^#]+)"
    while read -r line
    do
        [[ -n $line ]] || continue
        [[ $line =~ $entry_regex ]] || continue
        key=${BASH_REMATCH[1]}
        value=${BASH_REMATCH[2]#[\'\"]} # strip quotes
        value=${value%[\'\"]}
        value=${value%${value##*[![:blank:]]}} # strip trailing spaces
        declare -g "${key}"="${value}"
    done < "$1"
}
export -f parse_config_vars

# Load config from files, if present, otherwise use settings in head of this file.
for conffile in /usr/share/bunsen/conf.d/bl-exit.conf /etc/bl-exit/bl-exit.conf ~/.config/bl-exit/bl-exit.conf
    do
        [[ -f $conffile ]] && parse_config_vars $conffile
    done

### Usage ###
USAGE="\nbl-exit [OPTION]\n\n\
With no arguments default yad (GUI) or text menu at a TTY\n\n\
Only one argument is read, they cannot be combined\n\
-h --help\tShow this help\n\
-k --lock\tLock session\tDoes not work for a tty session\n\
-l --logout\tLogout\t\tAlso works for tty.\n\
-s --suspend\tSuspend\tState determined by ACPI S0 S1 or S3\n\
-i --hibernate\tSuspend to Disk\tRequires enough swap to store RAM\n\
-y --hybrid\tHybrid Sleep\tACPI must support sleep state S3\n\
-b --reboot\tReboot\n\
-p --poweroff\tShut down\n\n\
GUI Options\n\
-m --simple\t\t(GUI) Yad dialogue\n\
-M --simple-hibernate\t(GUI) Adds hibernate option\n\
   --simpl-all\t\t(GUI) Adds hibernate and hybrid-sleep\n\
-v --vertical\t\t(GUI) Yad stacked buttons\n\
-V --vertical-hibernate (GUI) Stacked, including hibernate\n\
   --vertical-all\t(GUI) Stacked, all available options\n
-n --icon\t\t(GUI) Row of icons\n\
-N --icon-hibernate\t(GUI) Row of icons, including hibernate\n\
   --icon-all\t\t(GUI) Row of icons, all available options\n
-c --icon-vert\t\t(GUI) Icons stacked vertically\n\
-C --icon-vert-hibernate\t(GUI) Icons stacked vertically, inc hibernate\n\
   --icon-vert-all\t\t(GUI) Icons stacked vertically, all available\n
Config options\n\
   --configure\t\tEdit config settings, set defaults etc.\n\
   --configure-system\tSystemwide settings and defaults (requires sudo)\n"

export LOCK_SCREEN_COMMAND=$LOCK_SCREEN_COMMAND

########################################################################
#                  Compatibility function details                      #
#                                                                      #
# logoutctl() takes the following `systemctl` arguments:               #
#                                                                      #
# poweroff reboot suspend hibernate hybrid-sleep                       #
# ? suspend-then-hibernate                                             #
#                                                                      #
# elogind supports it (documented), undocumented for systemd. It does  #
# _something_ on my systemd systems YMMV. Not implimented in the main  #
# script owing to not being documented by systemctl --help.            #
#                                                                      #
# Other systemctl arguments are not transferred to the elogind project #
# and will break if a similar systemctl || loginctl approach is used.  #
#                                                                      #
# Also takes $LOCK_SCREEN_COMMAND if defined in config to handle       #
# screen lockers which don't respond to `loginctl lock-session`        #
#                                                                      #
# loginctl lock-/terminate-session is handled here both to provide     #
# central yad closing and for non-standard screen-lock compatibiliy.   #
#                                                                      #
########################################################################
logoutctl(){
    if [[ ! -z $YAD_PID ]]; then
#        kill -SIGUSR1 $YAD_PID

        pkill -INT awesome

    fi
    case $1 in
        cancel )
            echo -e "\ncancelled"
            exit 0 ;;
        lock-session )
            echo -e "\n$1"
            [[ ! -z "$LOCK_SCREEN_COMMAND" ]] && $LOCK_SCREEN_COMMAND || loginctl $1 $XDG_SESSION_ID
            exit $? ;;
        terminate-session | lock-session )
            echo  -e "\n$1"
            loginctl $1 $XDG_SESSION_ID
            exit $? ;;
        suspend | hibernate | hybrid-sleep | suspend-then-hibernate | reboot | poweroff )
            echo -e "\n$1"
            # The systemd or elogind compatibility magic.   #
            [[ $(command -v systemctl) ]] && systemctl "$1" || loginctl "$1"
            exit $? ;;
    esac
}
export -f logoutctl

# Skip tty test if config option set
if [[ "$TTY_DETECT_OVERRIDE" != "true" ]]; then
    # If a yad picker or "lock" was chosen, test we're not at a TTY.
    if [[ -z $@ ]] || [[ $1 =~ (-m|--simple|-M|--simple-hibernate|--simple-all|-v|--vertical|-V|--vertical-hibernate|--vertical-all|-n|--icon|-N|--icon-hibernate|--icon-all|-c|--icon-vert|-C|--icon-vert-hibernate|--icon-vert-all|-k|--lock)$ ]]; then
        # Probably better ways, but: "Using systemd" :P Chops out 'x11;' in most DE's 'wayland;' in gnome and 'tty;' at a TTY or with no DM
        if [[ $(loginctl session-status | grep Service: | cut -d " " -f5) = 'tty;' ]]; then
            # We're at a TTY - Are we being asked to lock a TTY?
            if [[ $1 =~ (-k|--lock)$ ]]; then
                echo -e "Error: Graphical environment needed for screen locking."
                echo -e "It can be done with the vlock package installed, using the"
                echo -e "command 'vlock'. This script does not handle that case."
                echo -e "If you have a graphical environment running the probable cause"
                echo -e "of seeing this message is that no display manager is installed."
                exit 1
            fi
            # TTY exit menu.
            clear
            TTY_EXIT="Please choose an option "
            select option in Logout Sleep Hibernate Hybrid-Sleep Reboot Power-Off Quit-Dialogue
            do
                case $option in
                    Logout)        logoutctl terminate-session;;
                    Sleep)         logoutctl suspend;;
                    Hibernate)     logoutctl hibernate;;
                    Hybrid-Sleep)  logoutctl hybrid-sleep;;
                    Reboot)        logoutctl reboot;;
                    Power-Off)     logoutctl poweroff;;
                    Quit-Dialogue) break;;
                esac
            done
        fi
    fi
fi

# Default setting
if [[ -z $@ ]];then
#    OP_MODE="$DEFAULT_MODE"

    OP_MODE="--simple-gui"

else
    OP_MODE=$1
fi

# switch to icons if selected
if [[ $OP_MODE =~ (-n|--icon|-N|--icon-hibernate|--icon-all|-c|--icon-vert|-C|--icon-vert-hibernate|--icon-vert-all)$ ]]; then
    # clear button text
    TXT_CANCELYAD=""
    TXT_LOGOUT_PC=""
    TXT_LOCK_SCRN=""
    TXT_SLEEP_RAM=""
    TXT_RESTARTPC=""
    TXT_SHUT_DOWN=""
    TXT_HIBERNATE=""
    TXT_HYBRIDZZZ=""
    # Switch icon set
    ICO_CANCELYAD="$IMAGE_PATH$BTN_CANCELYAD"
    ICO_LOGOUT_PC="$IMAGE_PATH$BTN_LOGOUT_PC"
    ICO_LOCK_SCRN="$IMAGE_PATH$BTN_LOCK_SCRN"
    ICO_SLEEP_RAM="$IMAGE_PATH$BTN_SLEEP_RAM"
    ICO_RESTARTPC="$IMAGE_PATH$BTN_RESTARTPC"
    ICO_SHUT_DOWN="$IMAGE_PATH$BTN_SHUT_DOWN"
    ICO_HIBERNATE="$IMAGE_PATH$BTN_HIBERNATE"
    ICO_HYBRIDZZZ="$IMAGE_PATH$BTN_HYBRIDZZZ"
fi

case $OP_MODE in
    # command line use
    -h|--help)
        echo -e "$USAGE"
        exit 0
        ;;
    -k|--lock)         logoutctl lock-session;;
    -l|--logout)       logoutctl terminate-session;;
    -s|--suspend)      logoutctl suspend;;
    -i|--hibernate)    logoutctl hibernate;;
    -y|--hybrid)       logoutctl hybrid-sleep;;
    -b|--reboot)       logoutctl reboot;;
    -p|--poweroff)     logoutctl poweroff;;
    ####################################################################
    #            GUI sections "yad hacking" starts here                #
    ####################################################################

    # Simple yad
    -m|--simple) yad --class=WmanExit --undecorated --center --on-top --skip-taskbar \
                     --sticky --text-align=right --text="$HOSTNAME:\nLogout $USER?" \
                     --image-on-top --image="gtk-quit" \
                     --button="_Cancel":'bash -c "logoutctl cancel"' \
                     --button="Loc_k":'bash -c "logoutctl lock-session"' \
                     --button="_Logout":'bash -c "logoutctl terminate-session"' \
                     --button="_Sleep":'bash -c "logoutctl suspend"' \
                     --button="_Restart PC":'bash -c "logoutctl reboot"' \
                     --button="Shu_t Down":'bash -c "logoutctl poweroff"' \
                 ;;
    # Simple yad GUI
    --simple-gui) yad --class=WmanExit --title "Exit" --close-on-unfocus --undecorated --center --on-top --borders=5 --window-icon=gnome-logout \
                       --button=" _Logout!gnome-logout!":'bash -c "logoutctl terminate-session"' \
                       --button=" _Suspend!gnome-session-suspend!":'bash -c "logoutctl suspend"' \
                       --button=" Re_boot!system-reboot!":'bash -c "logoutctl reboot"' \
                       --button=" _Power Off!gnome-shutdown!":'bash -c "logoutctl poweroff"' \
                 ;;

    # yad with hibernate
    -d|--show-hibernate) yad --class=WmanExit --undecorated --center --on-top --skip-taskbar \
                             --sticky --text-align=right --text="$HOSTNAME:\nLogout $USER?" \
                             --image-on-top --image="gtk-quit" \
                             --button="_Cancel":'bash -c "logoutctl cancel"' \
                             --button="Loc_k":'bash -c "logoutctl lock-session"' \
                             --button="_Logout":'bash -c "logoutctl terminate-session"' \
                             --button="_Sleep":'bash -c "logoutctl suspend"' \
                             --button="_Hibernate":'bash -c "logoutctl hibernate"' \
                             --button="_Restart PC":'bash -c "logoutctl reboot"' \
                             --button="Shu_t Down":'bash -c "logoutctl poweroff"' \
                         ;;

    # yad with hibernate and hybrid sleep
    -a|--show-all) yad --class=WmanExit --undecorated --center --on-top --skip-taskbar \
                       --sticky --text-align=right --text="$HOSTNAME:\nLogout $USER?" \
                       --image-on-top --image="gtk-quit" \
                       --button="_Cancel":'bash -c "logoutctl cancel"' \
                       --button="Loc_k":'bash -c "logoutctl lock-session"' \
                       --button="_Logout":'bash -c "logoutctl terminate-session"' \
                       --button="_Sleep":'bash -c "logoutctl suspend"' \
                       --button="H_yb Sleep":'bash -c "logoutctl hybrid-sleep"' \
                       --button="_Hibernate":'bash -c "logoutctl hibernate"' \
                       --button="_Restart PC":'bash -c "logoutctl reboot"' \
                       --button="Shu_t Down":'bash -c "logoutctl poweroff"' \
                   ;;
                   
    # Vertical GUI
    -v|--vertical) yad --form --columns 1 --width=200 --borders=7 --class=WmanExit \
                       --no-buttons --undecorated --center --on-top --skip-taskbar \
                       --sticky --text="$HOSTNAME\nLogout $USER?" --text-align=center \
                       --image-on-top --image="gtk-quit" \
                       --field="_Cancel":fbtn 'bash -c "logoutctl cancel"' \
                       --field="Loc_k":fbtn 'bash -c "logoutctl lock-session"' \
                       --field="_Logout":fbtn 'bash -c "logoutctl terminate-session"' \
                       --field="_Sleep":fbtn 'bash -c "logoutctl suspend"' \
                       --field="_Restart PC":fbtn 'bash -c "logoutctl reboot"' \
                       --field="Shu_t Down":fbtn 'bash -c "logoutctl poweroff"' \
                       | grep -v "|" &
                   exit 0
                   ;;
                   
    # Vertical Simple GUI
    --vertical-simple) yad --form --columns 1 --width=130 --title "Exit" --borders=7 --class=WmanExit --window-icon=gnome-logout \
                       --no-buttons --undecorated --center --on-top \
                       --field=" _Logout!gnome-logout!":fbtn 'bash -c "logoutctl terminate-session"' \
                       --field=" _Suspend!gnome-session-suspend!":fbtn 'bash -c "logoutctl suspend"' \
                       --field=" Re_boot!system-reboot!":fbtn 'bash -c "logoutctl reboot"' \
                       --field=" _Power Off!gnome-shutdown!":fbtn 'bash -c "logoutctl poweroff"' \
                       | grep -v "|" &
                   exit 0
                   ;;

    # Vertical GUI With hibernate
    -D|--vertical-hibernate) yad --form --columns 1 --width=200 --borders=7 --class=WmanExit \
                                 --no-buttons --undecorated --center --on-top --skip-taskbar \
                                 --sticky --text="$HOSTNAME\nLogout $USER?" --text-align=center \
                                 --image-on-top --image="gtk-quit" \
                                 --field="_Cancel":fbtn 'bash -c "logoutctl cancel"' \
                                 --field="Loc_k":fbtn 'bash -c "logoutctl lock-session"' \
                                 --field="_Logout":fbtn 'bash -c "logoutctl terminate-session"' \
                                 --field="_Sleep":fbtn 'bash -c "logoutctl suspend"' \
                                 --field="_Hibernate":fbtn 'bash -c "logoutctl hibernate"' \
                                 --field="_Restart PC":fbtn 'bash -c "logoutctl reboot"' \
                                 --field="Shu_t Down":fbtn 'bash -c "logoutctl poweroff"' \
                                 | grep -v "|" &
                             exit 0
                             ;;  

    # Vertical GUI All available options
    -A|--vertical-all) yad --form --columns 1 --width=200 --borders=7 --class=WmanExit \
                            --no-buttons --undecorated --center --on-top --skip-taskbar \
                            --sticky --text="$HOSTNAME\nLogout $USER?" --text-align=center \
                            --image-on-top --image="gtk-quit" \
                            --field="_Cancel":fbtn 'bash -c "logoutctl cancel"' \
                            --field="Loc_k":fbtn 'bash -c "logoutctl lock-session"' \
                            --field="_Logout":fbtn 'bash -c "logoutctl terminate-session"' \
                            --field="_Sleep":fbtn 'bash -c "logoutctl suspend"' \
                            --field="H_yb Sleep":fbtn 'bash -c "logoutctl hybrid-sleep"' \
                            --field="_Hibernate":fbtn 'bash -c "logoutctl hibernate"' \
                            --field="_Restart PC":fbtn 'bash -c "logoutctl reboot"' \
                            --field="Shu_t Down":fbtn 'bash -c "logoutctl poweroff"' \
                            | grep -v "|" &
                       exit 0
                       ;;

    # typo land
    *)            echo -e "\nUnknown operation $1"
                  echo -e "$USAGE"
                  exit 1
                  ;;
esac

########################################################################
##                                                                    ##
## Version: 0.2~alpha-1                                               ##
##                                                                    ##
## Depends: bash,systemd | elogind,policykit-1                        ##
##                                                                    ##
## Recommends: yad,light-locker,x-display-manager                     ##
##                                                                    ##
## Note: re "Depends:" `systemctl` requires root or sudo unless       ##
##       policykit-1 is silently providing it. Debian very helpfully  ##
##       configured rootless systemd shutdown/reboot/etc. via         ##
##       policykit-1, `sudo apt purge policykit-1` and try            ##
##       `systemctl reboot` if you disbelieve.                        ##
##       You'll lose a lot of programs in the process though.         ##
##       yad not a hard depend because command line use is possible   ##
##       without it.                                                  ##
##                                                                    ##
## KNOWN ISSUES: xscreensaver, i3lock, and slock, need the xss-lock   ##
##               package installing and configuring for systemd's     ##
##               loginctl to be able to lock the session using them,  ##
##               or edits to this script.                             ##
##                                                                    ##
##               If no display manager is installed the script will   ##
##               detect the session as a TTY rather than graphical,   ##
##               in which case the TTY picker can be run in a         ##
##               terminal emulator, or simply supply command line     ##
##               arguments and run without GUI.                       ##
##                                                                    ##
## BUGS: Probably.                                                    ##
##                                                                    ##
## Customization: Copy to ~/bin Then hack away `man yad` is more use  ##
##                than any help file or manual page I could write.    ##
##                Prettification options abound.                      ##
##                                                                    ##
## Dedicated to: Debian Ecosystem Init Diversity Team                 ##
##               <debian-init-diversity@chiark.greenend.org.uk>       ##
##               May their efforts meet with every success.           ##
##                                                                    ##
########################################################################
#
# Version: 0.2~alpha-1 Added keyboard accelerators. 
#                      Fixed typo on one button.
#
# Version: 0.1~alpha-1 Initial script.
#

... and make it executable. The shortcut is modkey+Escape

Offline

#8 2019-04-25 23:54:20

hhh
Meep!
Registered: 2015-09-17
Posts: 8,721
Website

Re: Beginner tutorial: Awesome WM, a tiling window manager

Feedback needed, I think I've covered all the basics but there is a lot to remember and learn.

Offline

#9 2019-04-26 00:18:09

hhh
Meep!
Registered: 2015-09-17
Posts: 8,721
Website

Re: Beginner tutorial: Awesome WM, a tiling window manager

Check your file names, I had a typo or two. rc.lua, main file. theme.lua, theme file. autorun.sh, programs to run on startup.

Offline

#10 2019-04-26 00:30:40

hhh
Meep!
Registered: 2015-09-17
Posts: 8,721
Website

Re: Beginner tutorial: Awesome WM, a tiling window manager

Oh yeah, pic or it didn't happen...

Screenshot_2019-04-25_20-28-23.md.png

Offline

#11 2019-04-26 01:13:00

PackRat
jgmenu user Numero Uno
Registered: 2015-10-02
Posts: 1,116

Re: Beginner tutorial: Awesome WM, a tiling window manager

Handy tutorial.

This screenshot using the posted rc.lua and theme.lua?

The gaps look right (gaps defined in the theme.lua). If you add this line to the -- {{{ Rules section of your rc.lua:

size_hints_honor = false,

the terminal in that busier screenshot will expand a bit and the bottom edge line up with the bottom edge of browser. If all you're working with are terminals (especially without theme-defined gaps) the gaps around the terminals will close and all screen real estate will be utilized.

Like this:

2019-01-30-06-16-20.md.png

Last edited by PackRat (2019-04-26 01:18:26)


You must unlearn what you have learned.
    -- yoda

Offline

#12 2019-04-26 01:38:44

hhh
Meep!
Registered: 2015-09-17
Posts: 8,721
Website

Re: Beginner tutorial: Awesome WM, a tiling window manager

PackRat wrote:

Handy tutorial.

Thanks!

This screenshot using the posted rc.lua and theme.lua?

The gaps look right (gaps defined in the theme.lua). If you add this line to the -- {{{ Rules section of your rc.lua:

size_hints_honor = false,

the terminal in that busier screenshot will expand a bit and the bottom edge line up with the bottom edge of browser. If all you're working with are terminals (especially without theme-defined gaps) the gaps around the terminals will close and all screen real estate will be utilized.

Like this:

https://cdn.scrot.moe/images/2019/01/31/2019-01-30-06-16-20.md.png

I've made some tweaks in the 12 hours since that scrot, thanks for reminding me. That scrot uses lxterminal. Lxterminal has produced weird gaps with every tiler or tiling script I've used. Terminator works fine (so slow, I hate it), I currently use konsole --no-install-recommends, I'm sure gnome-terminal works but it won't start unless you have at-spi2 I think, and I've removed that daemon.

Using konsole, gaps at 4dpi in theme.lua, no changes to the default hints_honor settings, music muted so I could concentrate for a minute...

Screenshot_2019-04-25_21-36-21.md.png

Thanks for checking in here, I was hoping you would. smile

Offline

#13 2019-04-26 01:54:38

hhh
Meep!
Registered: 2015-09-17
Posts: 8,721
Website

Re: Beginner tutorial: Awesome WM, a tiling window manager

PackRat wrote:

The gaps look right (gaps defined in the theme.lua). If you add this line to the -- {{{ Rules section of your rc.lua:

size_hints_honor = false,

the terminal in that busier screenshot will expand a bit and the bottom edge line up with the bottom edge of browser. If all you're working with are terminals (especially without theme-defined gaps) the gaps around the terminals will close and all screen real estate will be utilized.

Like this:

https://cdn.scrot.moe/images/2019/01/31/2019-01-30-06-16-20.md.png

Number one) That looks fantastic

Letter B) Which line in my rc.lua should I add that to, and can you post the code in context for me and our other n00b friends? Lua degrades gracefully in that it will run everything until it borks, but that red bork message is harsh. big_smile

Offline

#14 2019-04-26 02:25:52

PackRat
jgmenu user Numero Uno
Registered: 2015-10-02
Posts: 1,116

Re: Beginner tutorial: Awesome WM, a tiling window manager

Put it in the Rules section of the rc.lua. The Rules section is analogous to openbox per app settings in the rc.xml.

like so -

-- {{{ Rules
-- Rules to apply to new clients (through the "manage" signal).
awful.rules.rules = {
    -- All clients will match this rule.
    { rule = { },
      properties = { border_width = 1,
                     border_color = beautiful.border_normal,
                     focus = awful.client.focus.filter,
                     raise = true,
                     size_hints_honor = false,
                     keys = clientkeys,
                     buttons = clientbuttons,
                     screen = awful.screen.preferred,
                     placement = awful.placement.no_overlap+awful.placement.no_offscreen
     }
    },

The position doesn't really matter, just note that the last entry does not end with a "," so, if you put it last, delete the comma and add a comma to your "placement=...." line. Otherwise you will get an error message on restart and awesome will fallback to the defaults.

Should point out that default rc.lua should be in /etc/xdg/awesome.

Last edited by PackRat (2019-04-26 02:42:00)


You must unlearn what you have learned.
    -- yoda

Offline

#15 2019-04-26 02:35:40

PackRat
jgmenu user Numero Uno
Registered: 2015-10-02
Posts: 1,116

Re: Beginner tutorial: Awesome WM, a tiling window manager

I've made some tweaks in the 12 hours since that scrot, thanks for reminding me. That scrot uses lxterminal. Lxterminal has produced weird gaps with every tiler or tiling script I've used. Terminator works fine (so slow, I hate it), I currently use konsole --no-install-recommends, I'm sure gnome-terminal works but it won't start unless you have at-spi2 I think, and I've removed that daemon.

Sakura is a nice vte terminal to use. Supports tabs and not tied to any DE so only vte dependency.
Sakura + tmux = Terminator sans bloat.  monkey

To reconfigure rc.lua and/or theme.lua, edit it/them and then use 'Control+Shift+r' to restart awesome. Note that with these configs, conky will also restart, which can get messy.

A quick fix for that (or any application that will restart when awesome is restarted) is to add a killall command to the beginning of your autostart.sh file.

killall -q conky

at the beginning will kill conky then run the rest of the commands.

Last edited by PackRat (2019-04-26 02:37:20)


You must unlearn what you have learned.
    -- yoda

Offline

#16 2019-04-26 02:43:27

hhh
Meep!
Registered: 2015-09-17
Posts: 8,721
Website

Re: Beginner tutorial: Awesome WM, a tiling window manager

PackRat wrote:

To reconfigure rc.lua and/or theme.lua, edit it/them and then use 'Control+Shift+r' to restart awesome. Note that with these configs, conky will also restart, which can get messy.

A quick fix for that (or any application that will restart when awesome is restarted) is to add a killall command to the beginning of your autostart.sh file.

killall -q conky

at the beginning will kill conky then run the rest of the commands.

Nice! Thanks. Better to keep it simple though for us beginners, make sure killall -q is removed from your run command when your configs are done and you logout or reboot.

Offline

#17 2019-04-26 08:17:48

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 1,928
Website

Re: Beginner tutorial: Awesome WM, a tiling window manager

@hhh, Nice, thanks for this.

Offline

#18 2019-04-26 08:19:18

hhh
Meep!
Registered: 2015-09-17
Posts: 8,721
Website

Re: Beginner tutorial: Awesome WM, a tiling window manager

My dinosaur man!

Offline

#19 2019-04-26 13:58:01

hhh
Meep!
Registered: 2015-09-17
Posts: 8,721
Website

Re: Beginner tutorial: Awesome WM, a tiling window manager

PackRat wrote:
size_hints_honor = false,

I've added this to my rc.lua posted in Post #2. Thanks again, Pack Rat!

Offline

#20 2019-04-26 16:30:53

PackRat
jgmenu user Numero Uno
Registered: 2015-10-02
Posts: 1,116

Re: Beginner tutorial: Awesome WM, a tiling window manager

No problem.

What version of awesome and lua will be in the Debian repos when Lithium is released?

Users need to keep in mind that lua (and therefore awesome) is not always backwards compatible so they have to be careful when using a code snippet from 3rd party rc.lua files. Not as bad as it used to be, but very easy to bork your rc.lua. So be careful if you find some cool lua function on the Arch forum that you want to try in your rc.lua.

Really comes into play if a user wants to use awesome widgets on the taskbar instead of conky on the desktop. Most of the widget dev's are good about specifying what version(s) of awesome their code will work with.

Last edited by PackRat (2019-04-26 16:34:04)


You must unlearn what you have learned.
    -- yoda

Offline

#21 2019-04-26 16:38:50

PackRat
jgmenu user Numero Uno
Registered: 2015-10-02
Posts: 1,116

Re: Beginner tutorial: Awesome WM, a tiling window manager

I'm curious about this:

--!Table of layouts to cover with awful.layout.inc, order matters.
awful.layout.layouts = {
    awful.layout.suit.tile,
--    awful.layout.suit.floating,
--    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,
}
-- }}}

Why are you only using one layout?


You must unlearn what you have learned.
    -- yoda

Offline

#22 2019-04-27 03:05:13

hhh
Meep!
Registered: 2015-09-17
Posts: 8,721
Website

Re: Beginner tutorial: Awesome WM, a tiling window manager

To make it easier for me to transition to awesome from openbox. In tile mode, modkey-m takes a window out of tiling so it's essentially floating maximized. So witching to floating mode doesn't seem that useful to me. And for a complete tiling n00b, removing options to begin with simplifies the learning curve.

The layouts are there, just enable them and have at it. modkey+Space to cycle through the layouts, and I'd enable the layout-switcher widget in rc.lua, too.

roy@TyrellCorp:~$ apt-cache policy awesome
awesome:
  Installed: 4.3-4
  Candidate: 4.3-4
  Version table:
 *** 4.3-4 500
        500 https://deb.debian.org/debian buster/main amd64 Packages
        100 /var/lib/dpkg/status
roy@TyrellCorp:~$

Stretch is 4.0 but jessie is 3.4-15, so good heads up that my rc.lua might not work there. smile

Last edited by hhh (2019-04-28 05:23:18)

Offline

#23 2019-04-27 07:09:22

ohnonot
...again
Registered: 2015-09-29
Posts: 4,159
Website

Re: Beginner tutorial: Awesome WM, a tiling window manager

^ Jessie? how does that relate to the next release??? :confused:

PackRat wrote:

the gaps around the terminals will close and all screen real estate will be utilized.

sorry to be nitpicking, but that's not strictly true: it will put empty space around the text inside the terminal. the terminal however cannot utilize this empty space.

that said it definitely looks better and sometimes also helps with moving windows around (you can be sure that 50% height is exactly 50% height, and not 50% minus a few pixels).

Last edited by ohnonot (2019-04-27 07:09:44)

Offline

#24 2019-04-27 08:07:20

hhh
Meep!
Registered: 2015-09-17
Posts: 8,721
Website

Re: Beginner tutorial: Awesome WM, a tiling window manager

ohnonot wrote:

^ Jessie? how does that relate to the next release??? :confused:

PackRat wrote:

Users need to keep in mind that lua (and therefore awesome) is not always backwards compatible

Just erring on the side of caution. I originally mentioned jessie as a marginal case, anyway.

Offline

#25 2019-04-27 14:26:34

PackRat
jgmenu user Numero Uno
Registered: 2015-10-02
Posts: 1,116

Re: Beginner tutorial: Awesome WM, a tiling window manager

hhh wrote:
PackRat wrote:

Users need to keep in mind that lua (and therefore awesome) is not always backwards compatible

Just erring on the side of caution. I originally mentioned jessie as a marginal case, anyway.

lua code is also not necessarily compatible from one rc.lua to another even though the versions of awesome/lua are the same. I'm finding that out right now trying to port some keybindings for window movement over from the ArchLabs config to my own config. Can't bring the bindings and helper function over directly; going to need to translate some additional lua to get them working.

Curse you for getting me started on this monkey


You must unlearn what you have learned.
    -- yoda

Offline

Board footer

Powered by FluxBB