add move client to tag by name
This commit is contained in:
parent
656e158e80
commit
29b0263dfa
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
function run {
|
||||
if ! pgrep -f $1 ;
|
||||
if ! pgrep $1 ;
|
||||
then
|
||||
$@&
|
||||
fi
|
||||
@ -10,7 +10,7 @@ function run {
|
||||
# tag 1
|
||||
run /usr/local/bin/idea
|
||||
# tag 2
|
||||
run /usr/bin/google-chrome
|
||||
run /opt/google/chrome/chrome
|
||||
# tag 3
|
||||
run /usr/bin/terminator
|
||||
# tag 4
|
||||
@ -20,5 +20,7 @@ run /usr/bin/zoom
|
||||
run /usr/bin/teams
|
||||
# tag 6
|
||||
run /usr/bin/rocketchat-desktop
|
||||
run /usr/bin/thunderbird
|
||||
# tag 7
|
||||
run /usr/local/bin/bitwarden
|
||||
run /usr/bin/keepass2
|
||||
|
||||
78
rc.lua
78
rc.lua
@ -288,7 +288,7 @@ globalkeys = gears.table.join(
|
||||
-- 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
|
||||
-- mod + j|k -> focus next|prev client
|
||||
awful.key({ modkey, }, "j",
|
||||
function ()
|
||||
awful.client.focus.byidx( 1)
|
||||
@ -460,6 +460,15 @@ local function move_tag_to_focused_screen(tagName)
|
||||
end
|
||||
end
|
||||
|
||||
local function move_client_to_tag(tagName)
|
||||
if client.focus then
|
||||
local tag = awful.tag.find_by_name(nil, tagName)
|
||||
if tag then
|
||||
client.focus:move_to_tag(tag)
|
||||
end
|
||||
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.
|
||||
@ -469,11 +478,12 @@ for i = 1, 9 do
|
||||
-- mod + i -> show tag
|
||||
awful.key({ modkey }, "#" .. i + 9,
|
||||
function ()
|
||||
local screen = awful.screen.focused()
|
||||
local tag = screen.tags[i]
|
||||
if tag then
|
||||
tag:view_only()
|
||||
end
|
||||
-- local screen = awful.screen.focused()
|
||||
-- local tag = screen.tags[i]
|
||||
-- if tag then
|
||||
-- tag:view_only()
|
||||
-- end
|
||||
move_tag_to_focused_screen(tags[i])
|
||||
end,
|
||||
{description = "view tag #"..i, group = "tag"}),
|
||||
|
||||
@ -499,12 +509,13 @@ for i = 1, 9 do
|
||||
-- mod + shift + i -> 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
|
||||
-- if client.focus then
|
||||
-- local tag = client.focus.screen.tags[i]
|
||||
-- if tag then
|
||||
-- client.focus:move_to_tag(tag)
|
||||
-- end
|
||||
-- end
|
||||
move_client_to_tag(tags[i])
|
||||
end,
|
||||
{description = "move focused client to tag #"..i, group = "tag"}),
|
||||
-- Toggle tag on focused client.
|
||||
@ -577,7 +588,36 @@ awful.rules.rules = {
|
||||
{ rule_any = {type = { "normal", "dialog" }
|
||||
}, properties = { titlebars_enabled = true }
|
||||
},
|
||||
|
||||
-- jetbrains-idea -> tag 1
|
||||
{ rule = { class = "jetbrains-idea" },
|
||||
properties = { tag = tag1 } },
|
||||
-- chrome -> tag 2
|
||||
{ rule = { class = "google-chrome" },
|
||||
properties = { tag = tag2 } },
|
||||
-- terminator-> tag 3
|
||||
{ rule = { class = "terminator" },
|
||||
properties = { tag = tag3 } },
|
||||
-- vscode -> tag 4
|
||||
{ rule = { class = "code" },
|
||||
properties = { tag = tag4 } },
|
||||
-- zoom -> tag5
|
||||
{ rule = { class = "zoom" },
|
||||
properties = { tag = tag5 } },
|
||||
-- microsoft teams - preview -> tag5
|
||||
{ rule = { class = "microsoft teams - preview" },
|
||||
properties = { tag = tag5 } },
|
||||
-- rocket.chat-> tag6
|
||||
{ rule = { class = "rocket.chat" },
|
||||
properties = { tag = tag6 } },
|
||||
-- Thunderbird -> tag6
|
||||
{ rule = { class = "Thunderbird" },
|
||||
properties = { tag = tag6 } },
|
||||
-- Bitwarden -> tag7
|
||||
{ rule = { class = "bitwarden" },
|
||||
properties = { tag = tag7 } },
|
||||
-- keepass2 -> tag7
|
||||
{ rule = { class = "keepass2" },
|
||||
properties = { tag = tag7 } },
|
||||
-- Set Firefox to always map on the tag named "2" on screen 1.
|
||||
-- { rule = { class = "Firefox" },
|
||||
-- properties = { screen = 1, tag = "2" } },
|
||||
@ -642,12 +682,12 @@ client.connect_signal("request::titlebars", function(c)
|
||||
end)
|
||||
|
||||
-- Enable sloppy focus, so that focus follows mouse.
|
||||
client.connect_signal("mouse::enter", function(c)
|
||||
if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
|
||||
and awful.client.focus.filter(c) then
|
||||
client.focus = c
|
||||
end
|
||||
end)
|
||||
-- client.connect_signal("mouse::enter", function(c)
|
||||
-- if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
|
||||
-- and awful.client.focus.filter(c) then
|
||||
-- client.focus = c
|
||||
-- end
|
||||
-- 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)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user