awesomewm lua code to cycle windows and activate the selection with hotkey alt+tab (like…
- User
awesomewm lua code to cycle windows and activate the selection with hotkey alt+tab (like mac), hotkey to go to workspace 1-4, and hotkeys to move focused window to workspace 1-4. include making the windows themselves draggable
- Assistant
To configure AwesomeWM to cycle through windows using
Alt+Tab(similar to macOS), set up hotkeys for switching to and moving windows between workspaces 1-4, and enable draggable windows, follow these steps:1. Cycle Through Windows with
Alt+Tab:By default,
Mod+Tabin AwesomeWM switches between the last two focused windows. To cycle through all windows, you can modify yourrc.luaconfiguration file:-- Replace the existing Mod+Tab keybinding with the following: awful.key({ "Mod1" }, "Tab", function () awful.client.focus.byidx(1) if client.focus then client.focus:raise() end end, {description = "cycle through windows", group = "client"} ), awful.key({ "Mod1", "Shift" }, "Tab", function () awful.client.focus.byidx(-1) if client.focus then client.focus:raise() end end, {description = "cycle through windows in reverse", group = "client"} )This configuration allows you to cycle forward through windows with
Alt+Taband backward withAlt+Shift+Tab[1].2. Switch to Workspaces 1-4 with Hotkeys:
To navigate to workspaces 1 through 4 using
Mod+1toMod+4, add the following keybindings to yourrc.lua:-- Keybindings to switch to workspaces 1-4 for i = 1, 4 do globalkeys = awful.util.table.join(globalkeys, 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 workspace " .. i, group = "tag"} ) ) endThis loop assigns
Mod+1toMod+4to switch to workspaces 1 through 4, respectively.3. Move Focused Window to Workspaces 1-4:
To move the currently focused window to workspaces 1 through 4 using
Mod+Shift+1toMod+Shift+4, include the following in yourrc.lua:-- Keybindings to move focused window to workspaces 1-4 for i = 1, 4 do globalkeys = awful.util.table.join(globalkeys, 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 window to workspace " .. i, group = "tag"} ) ) endThis configuration allows you to move the focused window to workspaces 1 through 4 using
Mod+Shift+1toMod+Shift+4.4. Enable Draggable Windows:
To make windows draggable (floating), you can modify the mouse bindings in your
rc.lua:-- Mouse bindings for draggable (floating) windows clientbuttons = awful.util.table.join( awful.button({ }, 1, function (c) c:emit_signal("request::activate", "mouse_click", {raise = true}) if c.floating then awful.mouse.client.move(c) end 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) )This setup allows you to click and drag floating windows with the left mouse button.
Note: Ensure that you replace
modkeywith your actual modifier key (commonlyMod4or the Super/Windows key) in the configurations above.After making these changes, reload your AwesomeWM configuration to apply them.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.