From e5187c31d45d0242f0ee25d907110ae32c22ef2f Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Tue, 22 Dec 2020 14:03:15 +0530 Subject: added extra tags and keybndings for them --- awesome/rc.lua | 118 ++++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 74 insertions(+), 44 deletions(-) diff --git a/awesome/rc.lua b/awesome/rc.lua index b839c5fb..696cc3ef 100755 --- a/awesome/rc.lua +++ b/awesome/rc.lua @@ -289,9 +289,9 @@ layoutKeys = gears.table.join( -- I need these to resize window in magnifier layout -- increase master width factor - awful.key({ modkey, }, "=", function () awful.tag.incmwfact( 0.05) end), + awful.key({ modkey, }, "[", function () awful.tag.incmwfact( 0.05) end), -- decrease master width factor - awful.key({ modkey, }, "-", function () awful.tag.incmwfact(-0.05) end) + awful.key({ modkey, }, "]", function () awful.tag.incmwfact(-0.05) end) ) -- keybindings to navigate b/w monitors @@ -308,12 +308,43 @@ tagKeys = gears.table.join( awful.key({ "Mod1", }, "h", awful.tag.viewprev), awful.key({ "Mod1", }, "l", awful.tag.viewnext), -- go back to last tag - awful.key({ "Mod1", }, "Tab", awful.tag.history.restore) -) - - + awful.key({ "Mod1", }, "Tab", awful.tag.history.restore), + -- view scrcpy tag + awful.key({ modkey, }, "o", function() awful.tag.viewtoggle(phoneTag) end), + + -- switch to extra tags + awful.key({ modkey, }, "-", function() awful.tag.viewonly(tag11) end), + awful.key({ modkey, }, "=", function() awful.tag.viewonly(tag12) end), + + -- view (copy) extra tags + awful.key({ "Mod1", }, "-", function() awful.tag.viewtoggle(tag11) end), + awful.key({ "Mod1", }, "=", function() awful.tag.viewtoggle(tag12) end), + + -- move client to extra tags + awful.key({ modkey, "Shift", }, "-", function() + if client.focus then + client.focus:move_to_tag(tag11) + end + end), + awful.key({ modkey, "Shift", }, "=", function() + if client.focus then + client.focus:move_to_tag(tag12) + end + end), + -- toggle extra tags on client + awful.key({ "Mod1", "Shift", }, "-", function() + if client.focus then + client.focus:toggle_tag(tag11) + end + end), + awful.key({ "Mod1", "Shift", }, "=", function() + if client.focus then + client.focus:toggle_tag(tag12) + end + end) +) -- keybindings to handle clients -- i.e minimizing, maximizing, hiding, closing windows clientkeys = gears.table.join( @@ -378,7 +409,7 @@ clientkeys = gears.table.join( awesomeKeys = gears.table.join( awful.key({ modkey, "Control" }, "r", awesome.restart), - awful.key({ modkey, "Shift" }, "q", awesome.quit) + awful.key({ modkey, "Control" }, "q", awesome.quit) ) globalkeys = gears.table.join( @@ -404,8 +435,7 @@ for i = 1, 10 do if tag then tag:view_only() end - end, - {description = "view tag #"..i, group = "tag"}), + end), -- Toggle tag display. awful.key({ "Mod1" }, "#" .. i + 9, function () @@ -414,8 +444,7 @@ for i = 1, 10 do if tag then awful.tag.viewtoggle(tag) end - end, - {description = "toggle tag #" .. i, group = "tag"}), + end), -- Move client to tag. awful.key({ modkey, "Shift" }, "#" .. i + 9, function () @@ -425,8 +454,7 @@ for i = 1, 10 do client.focus:move_to_tag(tag) end end - end, - {description = "move focused client to tag #"..i, group = "tag"}), + end), -- Toggle tag on focused client. awful.key({ "Mod1", "Shift" }, "#" .. i + 9, function () @@ -436,15 +464,33 @@ for i = 1, 10 do client.focus:toggle_tag(tag) end end - end, - {description = "toggle focused client on tag #" .. i, group = "tag"}) + end) ) end +-- extra tag functionality +-- not packed inside a function +-- because I'm bad at lua +-- these variables need to be global + +tag11 = awful.tag.add("十一", { + screen = awful.screen.focused(), + layout = awful.layout.suit.floating, +}) +tag12 = awful.tag.add("十三", { + screen = awful.screen.focused(), + layout = awful.layout.suit.floating, +}) + +-- this tag contains scrcpy +phoneTag = awful.tag.add("携帯", { + screen = awful.screen.focused(), + layout = awful.layout.suit.floating +}) + + + clientbuttons = gears.table.join( --- awful.button({ }, 1, function (c) --- c:emit_signal("request::activate", "mouse_click", {raise = true}) --- end), awful.button({ modkey }, 1, function (c) c:emit_signal("request::activate", "mouse_click", {raise = true}) awful.mouse.client.move(c) @@ -457,7 +503,6 @@ clientbuttons = gears.table.join( -- Set keys root.keys(globalkeys) --- }}} -- {{{ Rules -- Rules to apply to new clients (through the "manage" signal). @@ -476,34 +521,19 @@ awful.rules.rules = { } }, - -- Floating clients. - { rule_any = { - instance = { - "scrcpy", - }, - class = { - "GIMP", - "Sxiv", - "Tor Browser", -- Needs a fixed window size to avoid fingerprinting by screen size. - "xtightvncviewer"}, - - -- Note that the name property shown in xprop might be set slightly after creation of the client - -- and the name shown there might not match defined rules here. - name = { - "Event Tester", -- xev. - }, - role = { - "AlarmWindow", -- Thunderbird's calendar. - "ConfigManager", -- Thunderbird's about:config. - "pop-up", -- e.g. Google Chrome's (detached) Developer Tools. - } - }, properties = { floating = false, - above = true, - }}, + -- scrcpy properties + { rule = { name = "Motorola One Power" }, + properties = { + floating = true, + ontop = true, + screen = 1, + tag = phoneTag + },}, -- Set Firefox to always map on the tag named "2" on screen 1. { rule = { class = "Firefox" }, - properties = { screen = 1, tag = "2" } }, + properties = { screen = 1, tag = "2" }, + }, } -- }}} -- cgit v1.2.3