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 has_fdo, freedesktop = pcall(require, "freedesktop")
|
||||
|
||||
local KEY_ALT = "Mod1"
|
||||
|
||||
-- {{{ 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)
|
||||
@ -196,17 +198,34 @@ end
|
||||
-- Re-set wallpaper when a screen's geometry changes (e.g. different resolution)
|
||||
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)
|
||||
-- Wallpaper
|
||||
set_wallpaper(s)
|
||||
|
||||
for s in screen do
|
||||
print("Oh, wow, we have screen " .. tostring(s))
|
||||
print("Oh, wow, we have screen " .. tostring(s.index))
|
||||
end
|
||||
|
||||
-- Each screen has its own tag table.
|
||||
awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, s, awful.layout.layouts[6])
|
||||
|
||||
if s.index == 1 then
|
||||
-- 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
|
||||
s.mypromptbox = awful.widget.prompt()
|
||||
-- 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
|
||||
-- mod + s = show help
|
||||
globalkeys = gears.table.join(
|
||||
awful.key({ modkey, }, "s", hotkeys_popup.show_help,
|
||||
{description="show help", group="awesome"}),
|
||||
-- mod + left|right -> view next/prev tag
|
||||
awful.key({ modkey, }, "Left", awful.tag.viewprev,
|
||||
{description = "view previous", group = "tag"}),
|
||||
awful.key({ modkey, }, "Right", awful.tag.viewnext,
|
||||
{description = "view next", group = "tag"}),
|
||||
-- mod + Esc -> tag history resotre
|
||||
awful.key({ modkey, }, "Escape", awful.tag.history.restore,
|
||||
{description = "go back", group = "tag"}),
|
||||
|
||||
-- mod + j|k -> focuse next|prev client
|
||||
awful.key({ modkey, }, "j",
|
||||
function ()
|
||||
awful.client.focus.byidx( 1)
|
||||
@ -278,18 +301,22 @@ globalkeys = gears.table.join(
|
||||
end,
|
||||
{description = "focus previous by index", group = "client"}
|
||||
),
|
||||
-- mod + w -> show main menu
|
||||
awful.key({ modkey, }, "w", function () mymainmenu:show() end,
|
||||
{description = "show main menu", group = "awesome"}),
|
||||
|
||||
-- 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,
|
||||
{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"}),
|
||||
-- mod + ctrl + j|k -> focus next|prev screen
|
||||
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"}),
|
||||
-- mod + u -> urgent client
|
||||
awful.key({ modkey, }, "u", awful.client.urgent.jumpto,
|
||||
{description = "jump to urgent client", group = "client"}),
|
||||
awful.key({ modkey, }, "Tab",
|
||||
@ -302,13 +329,21 @@ globalkeys = gears.table.join(
|
||||
{description = "go back", group = "client"}),
|
||||
|
||||
-- Standard program
|
||||
-- mod + enter -> terminal
|
||||
awful.key({ modkey, }, "Return", function () awful.spawn(terminal) end,
|
||||
{description = "open a terminal", group = "launcher"}),
|
||||
-- mod + ctrl + r -> restart awsome
|
||||
awful.key({ modkey, "Control" }, "r", awesome.restart,
|
||||
{description = "reload awesome", group = "awesome"}),
|
||||
-- mod + shift + q -> quit awesome
|
||||
awful.key({ modkey, "Shift" }, "q", awesome.quit,
|
||||
{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,
|
||||
{description = "increase master width factor", group = "layout"}),
|
||||
awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end,
|
||||
@ -338,9 +373,11 @@ globalkeys = gears.table.join(
|
||||
{description = "restore minimized", group = "client"}),
|
||||
|
||||
-- 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,
|
||||
{description = "run prompt", group = "launcher"}),
|
||||
|
||||
-- mod + x -> run lua code in top bar
|
||||
awful.key({ modkey }, "x",
|
||||
function ()
|
||||
awful.prompt.run {
|
||||
@ -357,22 +394,30 @@ globalkeys = gears.table.join(
|
||||
)
|
||||
|
||||
clientkeys = gears.table.join(
|
||||
-- mod + f -> full screen toggle
|
||||
awful.key({ modkey, }, "f",
|
||||
function (c)
|
||||
c.fullscreen = not c.fullscreen
|
||||
c:raise()
|
||||
end,
|
||||
{description = "toggle fullscreen", group = "client"}),
|
||||
-- mod + shift + c -> close client
|
||||
awful.key({ modkey, "Shift" }, "c", function (c) c:kill() end,
|
||||
{description = "close", group = "client"}),
|
||||
-- mod + ctrl + space -> toggle float
|
||||
awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle ,
|
||||
{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,
|
||||
{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,
|
||||
{description = "move to screen", group = "client"}),
|
||||
-- mod + t -> toggle on top
|
||||
awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end,
|
||||
{description = "toggle keep on top", group = "client"}),
|
||||
-- mod + n -> minimize
|
||||
awful.key({ modkey, }, "n",
|
||||
function (c)
|
||||
-- The client currently has the input focus, so it cannot be
|
||||
@ -380,18 +425,21 @@ clientkeys = gears.table.join(
|
||||
c.minimized = true
|
||||
end ,
|
||||
{description = "minimize", group = "client"}),
|
||||
-- mod + m -> toggle maximize
|
||||
awful.key({ modkey, }, "m",
|
||||
function (c)
|
||||
c.maximized = not c.maximized
|
||||
c:raise()
|
||||
end ,
|
||||
{description = "(un)maximize", group = "client"}),
|
||||
-- mod + ctrl + m -> toggle maximize vertical
|
||||
awful.key({ modkey, "Control" }, "m",
|
||||
function (c)
|
||||
c.maximized_vertical = not c.maximized_vertical
|
||||
c:raise()
|
||||
end ,
|
||||
{description = "(un)maximize vertically", group = "client"}),
|
||||
-- mod + shift + m -> toggle maximize horizontal
|
||||
awful.key({ modkey, "Shift" }, "m",
|
||||
function (c)
|
||||
c.maximized_horizontal = not c.maximized_horizontal
|
||||
@ -400,12 +448,25 @@ clientkeys = gears.table.join(
|
||||
{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.
|
||||
-- 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.
|
||||
-- mod + i -> show tag
|
||||
awful.key({ modkey }, "#" .. i + 9,
|
||||
function ()
|
||||
local screen = awful.screen.focused()
|
||||
@ -415,7 +476,16 @@ for i = 1, 9 do
|
||||
end
|
||||
end,
|
||||
{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.
|
||||
--
|
||||
-- mod + ctrl + i -> show/hide tag
|
||||
awful.key({ modkey, "Control" }, "#" .. i + 9,
|
||||
function ()
|
||||
local screen = awful.screen.focused()
|
||||
@ -426,6 +496,7 @@ for i = 1, 9 do
|
||||
end,
|
||||
{description = "toggle tag #" .. i, group = "tag"}),
|
||||
-- Move client to tag.
|
||||
-- mod + shift + i -> move client to tag
|
||||
awful.key({ modkey, "Shift" }, "#" .. i + 9,
|
||||
function ()
|
||||
if client.focus then
|
||||
@ -437,6 +508,7 @@ for i = 1, 9 do
|
||||
end,
|
||||
{description = "move focused client to tag #"..i, group = "tag"}),
|
||||
-- Toggle tag on focused client.
|
||||
-- mod + ctrl + shift +i -> toggle focused client on tag
|
||||
awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
|
||||
function ()
|
||||
if client.focus then
|
||||
@ -467,7 +539,7 @@ awful.rules.rules = {
|
||||
properties = { border_width = beautiful.border_width,
|
||||
border_color = beautiful.border_normal,
|
||||
focus = awful.client.focus.filter,
|
||||
raise = true,
|
||||
-- raise = true,
|
||||
keys = clientkeys,
|
||||
buttons = clientbuttons,
|
||||
screen = awful.screen.preferred,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user