awesome: pinning of tags + other random bs
This commit is contained in:
@ -14,6 +14,8 @@ local beautiful = require("beautiful")
|
||||
local naughty = require("naughty")
|
||||
local menubar = require("menubar")
|
||||
local hotkeys_popup = require("awful.hotkeys_popup")
|
||||
|
||||
local volume_widget = require("awesome-wm-widgets.volume-widget.volume")
|
||||
-- Enable hotkeys help widget for VIM and other apps
|
||||
-- when client with a matching name is opened:
|
||||
require("awful.hotkeys_popup.keys")
|
||||
@ -235,13 +237,12 @@ awful.screen.connect_for_each_screen(function(s)
|
||||
height = 40,
|
||||
})
|
||||
|
||||
local line_size = 3
|
||||
local separator_symbol = "|"
|
||||
|
||||
local separator = wibox.widget({
|
||||
widget = wibox.widget.separator,
|
||||
orientation = "vertical",
|
||||
forced_width = line_size,
|
||||
forced_width = 4,
|
||||
forced_height = 4,
|
||||
span_ration = 0.5,
|
||||
-- color =
|
||||
})
|
||||
|
||||
@ -268,6 +269,10 @@ awful.screen.connect_for_each_screen(function(s)
|
||||
layout = wibox.layout.fixed.horizontal,
|
||||
spacing = 5,
|
||||
separator,
|
||||
volume_widget({
|
||||
volume_widget = "icon_and_text",
|
||||
}),
|
||||
separator,
|
||||
mykeyboardlayout,
|
||||
separator,
|
||||
s.mylayoutbox,
|
||||
@ -433,6 +438,30 @@ clientkeys = gears.table.join(
|
||||
-- This should map on the top row of your keyboard, usually 1 to 9.
|
||||
-- for
|
||||
local tags = { "a", "s", "d", "f", "g", "z", "x", "c", "v", "b" }
|
||||
local pinned_tags = {}
|
||||
|
||||
local function view_tag(tag)
|
||||
if tag then
|
||||
tag:view_only()
|
||||
end
|
||||
for pinned_tag, _ in pairs(pinned_tags) do
|
||||
if tag ~= pinned_tag then
|
||||
awful.tag.viewtoggle(pinned_tag)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function toggle_tag(tag)
|
||||
if tag then
|
||||
awful.tag.viewtoggle(tag)
|
||||
end
|
||||
for pinned_tag, _ in pairs(pinned_tags) do
|
||||
if tag ~= pinned_tag then
|
||||
awful.tag.viewtoggle(pinned_tag)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
for i, tag_name in ipairs(tags) do
|
||||
globalkeys = gears.table.join(
|
||||
globalkeys,
|
||||
@ -440,9 +469,7 @@ for i, tag_name in ipairs(tags) do
|
||||
awful.key({ modkey }, tag_name, function()
|
||||
local screen = awful.screen.focused()
|
||||
local tag = screen.tags[i]
|
||||
if tag then
|
||||
tag:view_only()
|
||||
end
|
||||
view_tag(tag)
|
||||
end),
|
||||
-- Toggle tag display.
|
||||
awful.key({ modkey, "Control" }, tag_name, function()
|
||||
@ -452,6 +479,23 @@ for i, tag_name in ipairs(tags) do
|
||||
awful.tag.viewtoggle(tag)
|
||||
end
|
||||
end),
|
||||
-- Pin tag.
|
||||
awful.key({ modkey, "Shift", "Control" }, tag_name, function()
|
||||
local screen = awful.screen.focused()
|
||||
local tag = screen.tags[i]
|
||||
if tag then
|
||||
if pinned_tags[tag] then
|
||||
pinned_tags[tag] = nil
|
||||
toggle_tag(tag)
|
||||
else
|
||||
pinned_tags[tag] = true
|
||||
-- TODO: fucking eyesore logic
|
||||
local old_tag = screen.selected_tag
|
||||
view_tag(tag)
|
||||
awful.tag.viewtoggle(old_tag)
|
||||
end
|
||||
end
|
||||
end),
|
||||
-- Move client to tag.
|
||||
awful.key({ modkey, "Shift" }, tag_name, function()
|
||||
if client.focus then
|
||||
@ -545,12 +589,21 @@ awful.rules.rules = {
|
||||
}
|
||||
-- }}}
|
||||
|
||||
client.connect_signal("property::floating", function(c)
|
||||
if c.floating then
|
||||
c.ontop = true
|
||||
else
|
||||
c.ontop = false
|
||||
end
|
||||
end)
|
||||
-- {{{ Signals
|
||||
-- Signal function to execute when a new client appears.
|
||||
client.connect_signal("manage", function(c)
|
||||
-- Set the windows at the slave,
|
||||
-- i.e. put it at the end of others instead of setting it master.
|
||||
if not awesome.startup then awful.client.setslave(c) end
|
||||
if not awesome.startup then
|
||||
awful.client.setslave(c)
|
||||
end
|
||||
|
||||
if awesome.startup and not c.size_hints.user_position and not c.size_hints.program_position then
|
||||
-- Prevent clients from being unreachable after screen count changes.
|
||||
|
||||
Reference in New Issue
Block a user