Add 0th tag and move to first empty workspace
This commit is contained in:
parent
ab90eaa114
commit
e7d2525d84
|
@ -17,8 +17,6 @@ local naughty = require("naughty")
|
||||||
local beautiful = require("beautiful")
|
local beautiful = require("beautiful")
|
||||||
local volume_widget = require("widgets.volume-widget.volume")
|
local volume_widget = require("widgets.volume-widget.volume")
|
||||||
local dpi = beautiful.xresources.apply_dpi
|
local dpi = beautiful.xresources.apply_dpi
|
||||||
local mouse_utils = require("mouse_utils")
|
|
||||||
|
|
||||||
|
|
||||||
local modkey = "Mod4"
|
local modkey = "Mod4"
|
||||||
|
|
||||||
|
@ -27,6 +25,20 @@ local keys = {}
|
||||||
|
|
||||||
-- AwesomeWM Vim Tmux Navigator
|
-- AwesomeWM Vim Tmux Navigator
|
||||||
|
|
||||||
|
local function get_first_nonempty_tag()
|
||||||
|
local screen = awful.screen.focused()
|
||||||
|
local tags = screen.tags
|
||||||
|
local first_empty = nil
|
||||||
|
for _, t in ipairs(tags) do
|
||||||
|
if #t:clients() > 0 then
|
||||||
|
first_empty = nil
|
||||||
|
elseif first_empty == nil then
|
||||||
|
first_empty = t
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return first_empty
|
||||||
|
end
|
||||||
|
|
||||||
local focus_bydirection = function(direction)
|
local focus_bydirection = function(direction)
|
||||||
awful.client.focus.global_bydirection(direction)
|
awful.client.focus.global_bydirection(direction)
|
||||||
if client.focus then
|
if client.focus then
|
||||||
|
@ -409,19 +421,9 @@ keys.globalkeys = gears.table.join(
|
||||||
end,
|
end,
|
||||||
{description = "Switch to next tag", group = "client"}
|
{description = "Switch to next tag", group = "client"}
|
||||||
),
|
),
|
||||||
-- Focus client by index (cycle through clients)
|
|
||||||
awful.key({modkey}, "t",
|
awful.key({modkey}, "t",
|
||||||
function()
|
function()
|
||||||
local screen = awful.screen.focused()
|
local first_empty = get_first_nonempty_tag()
|
||||||
local tags = screen.tags
|
|
||||||
local first_empty = nil
|
|
||||||
for _, t in ipairs(tags) do
|
|
||||||
if #t:clients() > 0 then
|
|
||||||
first_empty = nil
|
|
||||||
elseif first_empty == nil then
|
|
||||||
first_empty = t
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if first_empty ~= nil then
|
if first_empty ~= nil then
|
||||||
first_empty:view_only()
|
first_empty:view_only()
|
||||||
end
|
end
|
||||||
|
@ -429,6 +431,17 @@ keys.globalkeys = gears.table.join(
|
||||||
{description = "Switch to next tag", group = "client"}
|
{description = "Switch to next tag", group = "client"}
|
||||||
),
|
),
|
||||||
|
|
||||||
|
awful.key({modkey, "Shift"}, "t",
|
||||||
|
function()
|
||||||
|
local first_empty = get_first_nonempty_tag()
|
||||||
|
if first_empty ~= nil then
|
||||||
|
client.focus:move_to_tag(first_empty)
|
||||||
|
first_empty:view_only()
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
{description = "Switch to next tag", group = "client"}
|
||||||
|
),
|
||||||
|
|
||||||
-- =========================================
|
-- =========================================
|
||||||
-- SCREEN FOCUSING
|
-- SCREEN FOCUSING
|
||||||
-- =========================================
|
-- =========================================
|
||||||
|
@ -640,34 +653,38 @@ keys.clientkeys = gears.table.join(
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
-- Bind all key numbers to tags
|
local function register_tag(tag)
|
||||||
for i = 1, 9 do
|
|
||||||
keys.globalkeys = gears.table.join(keys.globalkeys,
|
keys.globalkeys = gears.table.join(keys.globalkeys,
|
||||||
-- Switch to tag
|
-- Switch to tag
|
||||||
awful.key({modkey}, "#" .. i + 9,
|
awful.key({modkey}, "#" .. tag + 9,
|
||||||
function()
|
function()
|
||||||
local screen = awful.screen.focused()
|
local screen = awful.screen.focused()
|
||||||
local tag = screen.tags[i]
|
local t = screen.tags[tag]
|
||||||
if tag then
|
if t then
|
||||||
tag:view_only()
|
t:view_only()
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
{description = "view tag #"..i, group = "tag"}
|
{description = "view tag #"..tag, group = "tag"}
|
||||||
),
|
),
|
||||||
-- Move client to tag
|
-- Move client to tag
|
||||||
awful.key({modkey, "Shift"}, "#" .. i + 9,
|
awful.key({modkey, "Shift"}, "#" .. tag + 9,
|
||||||
function()
|
function()
|
||||||
if client.focus then
|
if client.focus then
|
||||||
local tag = client.focus.screen.tags[i]
|
local t= client.focus.screen.tags[tag]
|
||||||
if tag then
|
if t then
|
||||||
client.focus:move_to_tag(tag)
|
client.focus:move_to_tag(t)
|
||||||
tag:view_only()
|
t:view_only()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
{description = "move focused client to tag #"..i, group = "tag"}
|
{description = "move focused client to tag #"..tag, group = "tag"}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Bind all key numbers to tags
|
||||||
|
for i = 1, 10 do
|
||||||
|
register_tag(i)
|
||||||
|
end
|
||||||
|
|
||||||
return keys
|
return keys
|
||||||
|
|
|
@ -32,15 +32,14 @@ pastel.initialize = function()
|
||||||
|
|
||||||
-- Set up each screen (add tags & panels)
|
-- Set up each screen (add tags & panels)
|
||||||
awful.screen.connect_for_each_screen(function(s)
|
awful.screen.connect_for_each_screen(function(s)
|
||||||
for i = 1, 9, 1
|
for i = 1, 10, 1
|
||||||
do
|
do
|
||||||
awful.tag.add(tostring(i), {
|
awful.tag.add(tostring(i % 10), {
|
||||||
layout = grid,
|
layout = grid,
|
||||||
screen = s,
|
screen = s,
|
||||||
selected = i == 1
|
selected = i == 1
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
s.quake = quake
|
s.quake = quake
|
||||||
|
|
||||||
-- Only add the top panel on the primary screen
|
-- Only add the top panel on the primary screen
|
||||||
|
|
Loading…
Reference in New Issue