feat: use a/s/d/f as tag switching key

This commit is contained in:
Klesh Wong 2022-05-05 03:03:52 +08:00
parent 32a31a2dd6
commit ed0c911d52

View File

@ -208,8 +208,8 @@ awful.screen.connect_for_each_screen(function(s)
set_wallpaper(s) set_wallpaper(s)
-- Each screen has its own tag table. -- Each screen has its own tag table.
awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, s, awful.layout.layouts[1]) --awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, s, awful.layout.layouts[1])
--awful.tag({"𝟭", "𝟮", "𝟯", "𝟰", "𝟱", "𝟲", "𝟳", "𝟴", "𝟵"}, s, awful.layout.layouts[1]) awful.tag({"", "", "", "" }, s, awful.layout.layouts[1])
-- Create a promptbox for each screen -- Create a promptbox for each screen
s.mypromptbox = awful.widget.prompt() s.mypromptbox = awful.widget.prompt()
@ -351,8 +351,8 @@ globalkeys = gears.table.join(
{ description = 'toggle play', group = 'hotkeys'} ), { description = 'toggle play', group = 'hotkeys'} ),
awful.key({}, 'F1', function () awful.spawn.with_shell("flameshot gui") end, awful.key({}, 'F1', function () awful.spawn.with_shell("flameshot gui") end,
{ description = 'toggle mute', group = 'hotkeys'} ), { description = 'toggle mute', group = 'hotkeys'} ),
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"}),
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,
@ -469,17 +469,17 @@ globalkeys = gears.table.join(
{description = "bookmark", group = "launcher"}), {description = "bookmark", group = "launcher"}),
-- Dict.sh -- Dict.sh
awful.key({ modkey }, "d", function() awful.spawn.with_shell('D_SELECTOR= d "$(xsel -o)"') end, awful.key({ modkey }, "t", function() awful.spawn.with_shell('D_SELECTOR= d "$(xsel -o)"') end,
{description = "dict.sh", group = "launcher"}) {description = "dict.sh", group = "launcher"})
) )
clientkeys = gears.table.join( clientkeys = gears.table.join(
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"}),
awful.key({ modkey }, "q", function (c) c:kill() end, awful.key({ modkey }, "q", function (c) c:kill() end,
{description = "close", group = "client"}), {description = "close", group = "client"}),
awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle , awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle ,
@ -488,8 +488,8 @@ clientkeys = gears.table.join(
{description = "move to master", group = "client"}), {description = "move to master", group = "client"}),
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"}),
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"}),
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
@ -567,6 +567,54 @@ for i = 1, 9 do
) )
end end
--- Bind a,s,d,f to tag 1,2,3,4
for i, key in pairs({"a", "s", "d", "f"}) do
globalkeys = gears.table.join(globalkeys,
-- View tag only.
awful.key({ modkey }, key,
function ()
local screen = awful.screen.focused()
local tag = screen.tags[i]
if tag then
tag:view_only()
end
end,
{description = "view tag #"..i, group = "tag"}),
-- Toggle tag display.
awful.key({ modkey, "Control" }, key,
function ()
local screen = awful.screen.focused()
local tag = screen.tags[i]
if tag then
awful.tag.viewtoggle(tag)
end
end,
{description = "toggle tag #" .. i, group = "tag"}),
-- Move client to tag.
awful.key({ modkey, "Shift" }, key,
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 client to tag #"..i, group = "tag"}),
-- Toggle tag on focused client.
awful.key({ modkey, "Control", "Shift" }, key,
function ()
if client.focus then
local tag = client.focus.screen.tags[i]
if tag then
client.focus:toggle_tag(tag)
end
end
end,
{description = "toggle focused client on tag #" .. i, group = "tag"})
)
end
clientbuttons = gears.table.join( clientbuttons = gears.table.join(
awful.button({ }, 1, function (c) awful.button({ }, 1, function (c)
c:emit_signal("request::activate", "mouse_click", {raise = true}) c:emit_signal("request::activate", "mouse_click", {raise = true})