add move tag to focused screen
This commit is contained in:
parent
88d9d58efe
commit
656e158e80
82
rc.lua
82
rc.lua
@ -18,6 +18,8 @@ require("awful.hotkeys_popup.keys")
|
|||||||
local debian = require("debian.menu")
|
local debian = require("debian.menu")
|
||||||
local has_fdo, freedesktop = pcall(require, "freedesktop")
|
local has_fdo, freedesktop = pcall(require, "freedesktop")
|
||||||
|
|
||||||
|
local KEY_ALT = "Mod1"
|
||||||
|
|
||||||
-- {{{ Error handling
|
-- {{{ Error handling
|
||||||
-- Check if awesome encountered an error during startup and fell back to
|
-- Check if awesome encountered an error during startup and fell back to
|
||||||
-- another config (This code will only ever execute for the fallback config)
|
-- another config (This code will only ever execute for the fallback config)
|
||||||
@ -196,17 +198,34 @@ end
|
|||||||
-- Re-set wallpaper when a screen's geometry changes (e.g. different resolution)
|
-- Re-set wallpaper when a screen's geometry changes (e.g. different resolution)
|
||||||
screen.connect_signal("property::geometry", set_wallpaper)
|
screen.connect_signal("property::geometry", set_wallpaper)
|
||||||
|
|
||||||
|
local tag1 = "1:idea"
|
||||||
|
local tag2 = "2:brow"
|
||||||
|
local tag3 = "3:term"
|
||||||
|
local tag4 = "4:code"
|
||||||
|
local tag5 = "5:zoom"
|
||||||
|
local tag6 = "6:chat"
|
||||||
|
local tag7 = "7:pass"
|
||||||
|
local tag8 = "8"
|
||||||
|
local tag9 = "9"
|
||||||
|
|
||||||
|
local tags = {
|
||||||
|
tag1,tag2,tag3,tag4,tag5,tag6,tag7,tag8,tag9
|
||||||
|
}
|
||||||
|
|
||||||
awful.screen.connect_for_each_screen(function(s)
|
awful.screen.connect_for_each_screen(function(s)
|
||||||
-- Wallpaper
|
-- Wallpaper
|
||||||
set_wallpaper(s)
|
set_wallpaper(s)
|
||||||
|
|
||||||
for s in screen do
|
for s in screen do
|
||||||
print("Oh, wow, we have screen " .. tostring(s))
|
print("Oh, wow, we have screen " .. tostring(s))
|
||||||
|
print("Oh, wow, we have screen " .. tostring(s.index))
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Each screen has its own tag table.
|
if s.index == 1 then
|
||||||
awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, s, awful.layout.layouts[6])
|
-- screen#1 has all tag
|
||||||
|
awful.tag(tags, s, awful.layout.layouts[6])
|
||||||
|
-- awful.tag({ "1:ide", "2:browser", "3:term", "4:code", "5:zoom-teams", "6", "7", "8", "9" }, s, awful.layout.layouts[6])
|
||||||
|
end
|
||||||
-- Create a promptbox for each screen
|
-- Create a promptbox for each screen
|
||||||
s.mypromptbox = awful.widget.prompt()
|
s.mypromptbox = awful.widget.prompt()
|
||||||
-- Create an imagebox widget which will contain an icon indicating which layout we're using.
|
-- Create an imagebox widget which will contain an icon indicating which layout we're using.
|
||||||
@ -255,17 +274,21 @@ root.buttons(gears.table.join(
|
|||||||
))
|
))
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
|
|
||||||
-- {{{ Key bindings
|
-- {{{ Key bindings
|
||||||
|
-- mod + s = show help
|
||||||
globalkeys = gears.table.join(
|
globalkeys = gears.table.join(
|
||||||
awful.key({ modkey, }, "s", hotkeys_popup.show_help,
|
awful.key({ modkey, }, "s", hotkeys_popup.show_help,
|
||||||
{description="show help", group="awesome"}),
|
{description="show help", group="awesome"}),
|
||||||
|
-- mod + left|right -> view next/prev tag
|
||||||
awful.key({ modkey, }, "Left", awful.tag.viewprev,
|
awful.key({ modkey, }, "Left", awful.tag.viewprev,
|
||||||
{description = "view previous", group = "tag"}),
|
{description = "view previous", group = "tag"}),
|
||||||
awful.key({ modkey, }, "Right", awful.tag.viewnext,
|
awful.key({ modkey, }, "Right", awful.tag.viewnext,
|
||||||
{description = "view next", group = "tag"}),
|
{description = "view next", group = "tag"}),
|
||||||
|
-- mod + Esc -> tag history resotre
|
||||||
awful.key({ modkey, }, "Escape", awful.tag.history.restore,
|
awful.key({ modkey, }, "Escape", awful.tag.history.restore,
|
||||||
{description = "go back", group = "tag"}),
|
{description = "go back", group = "tag"}),
|
||||||
|
-- mod + j|k -> focuse next|prev client
|
||||||
awful.key({ modkey, }, "j",
|
awful.key({ modkey, }, "j",
|
||||||
function ()
|
function ()
|
||||||
awful.client.focus.byidx( 1)
|
awful.client.focus.byidx( 1)
|
||||||
@ -278,18 +301,22 @@ globalkeys = gears.table.join(
|
|||||||
end,
|
end,
|
||||||
{description = "focus previous by index", group = "client"}
|
{description = "focus previous by index", group = "client"}
|
||||||
),
|
),
|
||||||
|
-- mod + w -> show main menu
|
||||||
awful.key({ modkey, }, "w", function () mymainmenu:show() end,
|
awful.key({ modkey, }, "w", function () mymainmenu:show() end,
|
||||||
{description = "show main menu", group = "awesome"}),
|
{description = "show main menu", group = "awesome"}),
|
||||||
|
|
||||||
-- Layout manipulation
|
-- Layout manipulation
|
||||||
|
-- mod + shift + j|k -> swap client wiht next|prev client in tag
|
||||||
awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end,
|
awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end,
|
||||||
{description = "swap with next client by index", group = "client"}),
|
{description = "swap with next client by index", group = "client"}),
|
||||||
awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end,
|
awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end,
|
||||||
{description = "swap with previous client by index", group = "client"}),
|
{description = "swap with previous client by index", group = "client"}),
|
||||||
|
-- mod + ctrl + j|k -> focus next|prev screen
|
||||||
awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end,
|
awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end,
|
||||||
{description = "focus the next screen", group = "screen"}),
|
{description = "focus the next screen", group = "screen"}),
|
||||||
awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end,
|
awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end,
|
||||||
{description = "focus the previous screen", group = "screen"}),
|
{description = "focus the previous screen", group = "screen"}),
|
||||||
|
-- mod + u -> urgent client
|
||||||
awful.key({ modkey, }, "u", awful.client.urgent.jumpto,
|
awful.key({ modkey, }, "u", awful.client.urgent.jumpto,
|
||||||
{description = "jump to urgent client", group = "client"}),
|
{description = "jump to urgent client", group = "client"}),
|
||||||
awful.key({ modkey, }, "Tab",
|
awful.key({ modkey, }, "Tab",
|
||||||
@ -302,13 +329,21 @@ globalkeys = gears.table.join(
|
|||||||
{description = "go back", group = "client"}),
|
{description = "go back", group = "client"}),
|
||||||
|
|
||||||
-- Standard program
|
-- Standard program
|
||||||
|
-- mod + enter -> terminal
|
||||||
awful.key({ modkey, }, "Return", function () awful.spawn(terminal) end,
|
awful.key({ modkey, }, "Return", function () awful.spawn(terminal) end,
|
||||||
{description = "open a terminal", group = "launcher"}),
|
{description = "open a terminal", group = "launcher"}),
|
||||||
|
-- mod + ctrl + r -> restart awsome
|
||||||
awful.key({ modkey, "Control" }, "r", awesome.restart,
|
awful.key({ modkey, "Control" }, "r", awesome.restart,
|
||||||
{description = "reload awesome", group = "awesome"}),
|
{description = "reload awesome", group = "awesome"}),
|
||||||
|
-- mod + shift + q -> quit awesome
|
||||||
awful.key({ modkey, "Shift" }, "q", awesome.quit,
|
awful.key({ modkey, "Shift" }, "q", awesome.quit,
|
||||||
{description = "quit awesome", group = "awesome"}),
|
{description = "quit awesome", group = "awesome"}),
|
||||||
|
|
||||||
|
-- mod + l|h -> inc/dec master width factor
|
||||||
|
-- Note: def master:
|
||||||
|
-- The master window generally just refers to the first window. Many tiling layouts will size
|
||||||
|
-- it bigger than the rest, making it the primary window in the layout. There are a few
|
||||||
|
-- functions that deal with that window specifically (focus master, etc.)
|
||||||
awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end,
|
awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end,
|
||||||
{description = "increase master width factor", group = "layout"}),
|
{description = "increase master width factor", group = "layout"}),
|
||||||
awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end,
|
awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end,
|
||||||
@ -338,9 +373,11 @@ globalkeys = gears.table.join(
|
|||||||
{description = "restore minimized", group = "client"}),
|
{description = "restore minimized", group = "client"}),
|
||||||
|
|
||||||
-- Prompt
|
-- Prompt
|
||||||
|
-- mod + r -> run menu in top bar: type application name and run it
|
||||||
awful.key({ modkey }, "r", function () awful.screen.focused().mypromptbox:run() end,
|
awful.key({ modkey }, "r", function () awful.screen.focused().mypromptbox:run() end,
|
||||||
{description = "run prompt", group = "launcher"}),
|
{description = "run prompt", group = "launcher"}),
|
||||||
|
|
||||||
|
-- mod + x -> run lua code in top bar
|
||||||
awful.key({ modkey }, "x",
|
awful.key({ modkey }, "x",
|
||||||
function ()
|
function ()
|
||||||
awful.prompt.run {
|
awful.prompt.run {
|
||||||
@ -357,22 +394,30 @@ globalkeys = gears.table.join(
|
|||||||
)
|
)
|
||||||
|
|
||||||
clientkeys = gears.table.join(
|
clientkeys = gears.table.join(
|
||||||
|
-- mod + f -> full screen toggle
|
||||||
awful.key({ modkey, }, "f",
|
awful.key({ modkey, }, "f",
|
||||||
function (c)
|
function (c)
|
||||||
c.fullscreen = not c.fullscreen
|
c.fullscreen = not c.fullscreen
|
||||||
c:raise()
|
c:raise()
|
||||||
end,
|
end,
|
||||||
{description = "toggle fullscreen", group = "client"}),
|
{description = "toggle fullscreen", group = "client"}),
|
||||||
|
-- mod + shift + c -> close client
|
||||||
awful.key({ modkey, "Shift" }, "c", function (c) c:kill() end,
|
awful.key({ modkey, "Shift" }, "c", function (c) c:kill() end,
|
||||||
{description = "close", group = "client"}),
|
{description = "close", group = "client"}),
|
||||||
|
-- mod + ctrl + space -> toggle float
|
||||||
awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle ,
|
awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle ,
|
||||||
{description = "toggle floating", group = "client"}),
|
{description = "toggle floating", group = "client"}),
|
||||||
|
-- mod + ctrl + enter -> move to master position
|
||||||
awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end,
|
awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end,
|
||||||
{description = "move to master", group = "client"}),
|
{description = "move to master", group = "client"}),
|
||||||
|
-- mod + o -> move to screen
|
||||||
|
-- move the current client in to the active tag of the next screen
|
||||||
awful.key({ modkey, }, "o", function (c) c:move_to_screen() end,
|
awful.key({ modkey, }, "o", function (c) c:move_to_screen() end,
|
||||||
{description = "move to screen", group = "client"}),
|
{description = "move to screen", group = "client"}),
|
||||||
|
-- mod + t -> toggle on top
|
||||||
awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end,
|
awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end,
|
||||||
{description = "toggle keep on top", group = "client"}),
|
{description = "toggle keep on top", group = "client"}),
|
||||||
|
-- mod + n -> minimize
|
||||||
awful.key({ modkey, }, "n",
|
awful.key({ modkey, }, "n",
|
||||||
function (c)
|
function (c)
|
||||||
-- The client currently has the input focus, so it cannot be
|
-- The client currently has the input focus, so it cannot be
|
||||||
@ -380,18 +425,21 @@ clientkeys = gears.table.join(
|
|||||||
c.minimized = true
|
c.minimized = true
|
||||||
end ,
|
end ,
|
||||||
{description = "minimize", group = "client"}),
|
{description = "minimize", group = "client"}),
|
||||||
|
-- mod + m -> toggle maximize
|
||||||
awful.key({ modkey, }, "m",
|
awful.key({ modkey, }, "m",
|
||||||
function (c)
|
function (c)
|
||||||
c.maximized = not c.maximized
|
c.maximized = not c.maximized
|
||||||
c:raise()
|
c:raise()
|
||||||
end ,
|
end ,
|
||||||
{description = "(un)maximize", group = "client"}),
|
{description = "(un)maximize", group = "client"}),
|
||||||
|
-- mod + ctrl + m -> toggle maximize vertical
|
||||||
awful.key({ modkey, "Control" }, "m",
|
awful.key({ modkey, "Control" }, "m",
|
||||||
function (c)
|
function (c)
|
||||||
c.maximized_vertical = not c.maximized_vertical
|
c.maximized_vertical = not c.maximized_vertical
|
||||||
c:raise()
|
c:raise()
|
||||||
end ,
|
end ,
|
||||||
{description = "(un)maximize vertically", group = "client"}),
|
{description = "(un)maximize vertically", group = "client"}),
|
||||||
|
-- mod + shift + m -> toggle maximize horizontal
|
||||||
awful.key({ modkey, "Shift" }, "m",
|
awful.key({ modkey, "Shift" }, "m",
|
||||||
function (c)
|
function (c)
|
||||||
c.maximized_horizontal = not c.maximized_horizontal
|
c.maximized_horizontal = not c.maximized_horizontal
|
||||||
@ -400,12 +448,25 @@ clientkeys = gears.table.join(
|
|||||||
{description = "(un)maximize horizontally", group = "client"})
|
{description = "(un)maximize horizontally", group = "client"})
|
||||||
)
|
)
|
||||||
|
|
||||||
|
local function move_tag_to_focused_screen(tagName)
|
||||||
|
-- For all screens: find tag by name
|
||||||
|
print("looking for tag " .. tagName)
|
||||||
|
local tagByName = awful.tag.find_by_name(nil, tagName)
|
||||||
|
if tag then
|
||||||
|
print("tag found with name" .. tagName)
|
||||||
|
local screenFocused = awful.screen.focused()
|
||||||
|
tagByName.screen=screenFocused
|
||||||
|
tagByName:view_only()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- Bind all key numbers to tags.
|
-- Bind all key numbers to tags.
|
||||||
-- Be careful: we use keycodes to make it work on any keyboard layout.
|
-- 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.
|
-- This should map on the top row of your keyboard, usually 1 to 9.
|
||||||
for i = 1, 9 do
|
for i = 1, 9 do
|
||||||
globalkeys = gears.table.join(globalkeys,
|
globalkeys = gears.table.join(globalkeys,
|
||||||
-- View tag only.
|
-- View tag only.
|
||||||
|
-- mod + i -> show tag
|
||||||
awful.key({ modkey }, "#" .. i + 9,
|
awful.key({ modkey }, "#" .. i + 9,
|
||||||
function ()
|
function ()
|
||||||
local screen = awful.screen.focused()
|
local screen = awful.screen.focused()
|
||||||
@ -415,7 +476,16 @@ for i = 1, 9 do
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
{description = "view tag #"..i, group = "tag"}),
|
{description = "view tag #"..i, group = "tag"}),
|
||||||
|
|
||||||
|
awful.key({ modkey, KEY_ALT }, "#" .. i + 9,
|
||||||
|
function ()
|
||||||
|
move_tag_to_focused_screen(tags[i])
|
||||||
|
end,
|
||||||
|
{description = "view tag #"..i, group = "tag"}),
|
||||||
|
|
||||||
-- Toggle tag display.
|
-- Toggle tag display.
|
||||||
|
--
|
||||||
|
-- mod + ctrl + i -> show/hide tag
|
||||||
awful.key({ modkey, "Control" }, "#" .. i + 9,
|
awful.key({ modkey, "Control" }, "#" .. i + 9,
|
||||||
function ()
|
function ()
|
||||||
local screen = awful.screen.focused()
|
local screen = awful.screen.focused()
|
||||||
@ -426,6 +496,7 @@ for i = 1, 9 do
|
|||||||
end,
|
end,
|
||||||
{description = "toggle tag #" .. i, group = "tag"}),
|
{description = "toggle tag #" .. i, group = "tag"}),
|
||||||
-- Move client to tag.
|
-- Move client to tag.
|
||||||
|
-- mod + shift + i -> move client to tag
|
||||||
awful.key({ modkey, "Shift" }, "#" .. i + 9,
|
awful.key({ modkey, "Shift" }, "#" .. i + 9,
|
||||||
function ()
|
function ()
|
||||||
if client.focus then
|
if client.focus then
|
||||||
@ -437,6 +508,7 @@ for i = 1, 9 do
|
|||||||
end,
|
end,
|
||||||
{description = "move focused client to tag #"..i, group = "tag"}),
|
{description = "move focused client to tag #"..i, group = "tag"}),
|
||||||
-- Toggle tag on focused client.
|
-- Toggle tag on focused client.
|
||||||
|
-- mod + ctrl + shift +i -> toggle focused client on tag
|
||||||
awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
|
awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
|
||||||
function ()
|
function ()
|
||||||
if client.focus then
|
if client.focus then
|
||||||
@ -467,7 +539,7 @@ awful.rules.rules = {
|
|||||||
properties = { border_width = beautiful.border_width,
|
properties = { border_width = beautiful.border_width,
|
||||||
border_color = beautiful.border_normal,
|
border_color = beautiful.border_normal,
|
||||||
focus = awful.client.focus.filter,
|
focus = awful.client.focus.filter,
|
||||||
raise = true,
|
-- raise = true,
|
||||||
keys = clientkeys,
|
keys = clientkeys,
|
||||||
buttons = clientbuttons,
|
buttons = clientbuttons,
|
||||||
screen = awful.screen.preferred,
|
screen = awful.screen.preferred,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user