Skip to content

Instantly share code, notes, and snippets.

@ilhan-athn7
Last active February 3, 2025 08:38
Show Gist options
  • Save ilhan-athn7/fe79cec6784b20958028cde56c9e82bd to your computer and use it in GitHub Desktop.
Save ilhan-athn7/fe79cec6784b20958028cde56c9e82bd to your computer and use it in GitHub Desktop.
Awesome window manager config for termux, to run firefox at responsive window size borderlessly
-- Import the Awesome WM libraries
local awful = require("awful")
local beautiful = require("beautiful")
local gears = require("gears")
-- Set the theme
beautiful.init(gears.filesystem.get_themes_dir() .. "default/theme.lua")
-- Remove titlebars, window topbars, and spacing
beautiful.titlebar_height = 0
beautiful.border_width = 0
beautiful.useless_gap = 0
-- Define the modkey (usually Mod4 is the Super/Windows key)
local modkey = "Mod4"
-- Table of layouts to cover with awful.layout.inc
awful.layout.layouts = {
awful.layout.suit.tile,
awful.layout.suit.floating,
}
-- Create a tag table for each screen
awful.screen.connect_for_each_screen(function(s)
-- Each screen has its own tag table
awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, s, awful.layout.layouts[1])
end)
-- Key bindings
globalkeys = gears.table.join(
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 }, "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, "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 }, "Return", function() awful.spawn("termux-x11") end,
{ description = "open termux-x11", 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" })
)
-- Define client keys
clientkeys = gears.table.join(
awful.key({ modkey }, "f", function(c)
c.fullscreen = not c.fullscreen
c:raise()
end, { description = "toggle fullscreen", group = "client" }),
awful.key({ modkey, "Shift" }, "c", function(c) c:kill() end,
{ description = "close", group = "client" })
)
-- Define client buttons
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 to apply to new clients (through the "manage" signal)
awful.rules.rules = {
-- All clients will match this rule.
{ rule = {},
properties = {
border_width = 0,
focus = awful.client.focus.filter,
raise = true,
keys = clientkeys,
buttons = clientbuttons,
screen = awful.screen.preferred,
placement = awful.placement.no_overlap + awful.placement.no_offscreen
}
},
-- Floating clients.
{ rule_any = {
instance = {
"DTA", -- Firefox addon DownThemAll.
"copyq", -- Includes session name in class.
},
class = {
"Arandr",
"Gpick",
"Kruler",
"MessageWin", -- kalarm.
"Sxiv",
"Wpa_gui",
"pinentry",
"veromix",
"xtightvncviewer"
},
name = {
"Event Tester", -- xev.
},
role = {
"AlarmWindow", -- Thunderbird's calendar.
"pop-up", -- e.g. Google Chrome's (detached) Developer Tools.
}
}, properties = { floating = true }},
}
-- 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)
-- Remove titlebars
client.connect_signal("request::titlebars", function(c)
awful.titlebar(c, { size = 0 }):setup {}
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment