mirror of
https://codeberg.org/frosty/dotfiles.git
synced 2024-09-19 11:47:09 -04:00
some awesome changes, not complete
This commit is contained in:
parent
d254a204f8
commit
66127c8b73
|
@ -145,10 +145,15 @@ local client_buttons = gears.table.join(
|
||||||
end),
|
end),
|
||||||
awful.button({ "Mod4" }, 1, function(c)
|
awful.button({ "Mod4" }, 1, function(c)
|
||||||
c:emit_signal("request::activate", "mouse_click", { raise = true })
|
c:emit_signal("request::activate", "mouse_click", { raise = true })
|
||||||
|
c.floating = true
|
||||||
awful.mouse.client.move(c)
|
awful.mouse.client.move(c)
|
||||||
end),
|
end),
|
||||||
|
awful.button({ "Mod4" }, 2, function(c)
|
||||||
|
c.floating = not c.floating
|
||||||
|
end),
|
||||||
awful.button({ "Mod4" }, 3, function(c)
|
awful.button({ "Mod4" }, 3, function(c)
|
||||||
c:emit_signal("request::activate", "mouse_click", { raise = true })
|
c:emit_signal("request::activate", "mouse_click", { raise = true })
|
||||||
|
c.floating = true
|
||||||
awful.mouse.client.resize(c, config.resize_corner)
|
awful.mouse.client.resize(c, config.resize_corner)
|
||||||
end)
|
end)
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
local awful = require("awful")
|
local awful = require("awful")
|
||||||
|
|
||||||
|
local floating = require("floating")
|
||||||
|
|
||||||
local config = {}
|
local config = {}
|
||||||
|
|
||||||
-- Default programs
|
-- Default programs
|
||||||
|
@ -15,7 +17,7 @@ config.theme_name = "default"
|
||||||
config.layouts = {
|
config.layouts = {
|
||||||
awful.layout.suit.tile,
|
awful.layout.suit.tile,
|
||||||
awful.layout.suit.max,
|
awful.layout.suit.max,
|
||||||
awful.layout.suit.floating,
|
floating,
|
||||||
}
|
}
|
||||||
config.default_layout = 1 -- Index of layout (1-indexed)
|
config.default_layout = 1 -- Index of layout (1-indexed)
|
||||||
|
|
||||||
|
|
99
awesome/.config/awesome/floating.lua
Normal file
99
awesome/.config/awesome/floating.lua
Normal file
|
@ -0,0 +1,99 @@
|
||||||
|
local ipairs = ipairs
|
||||||
|
local capi = { mouse = mouse, mousegrabber = mousegrabber }
|
||||||
|
|
||||||
|
local floating = {}
|
||||||
|
|
||||||
|
function floating.mouse_resize_handler(c, corner, x, y)
|
||||||
|
local g = c:geometry()
|
||||||
|
|
||||||
|
-- Do not allow maximized clients to be resized by mouse
|
||||||
|
local fixed_x = c.maximized_horizontal
|
||||||
|
local fixed_y = c.maximized_vertical
|
||||||
|
|
||||||
|
local prev_coords = {}
|
||||||
|
local coordinates_delta = {x=0, y=0}
|
||||||
|
|
||||||
|
local corner_x, corner_y = x, y
|
||||||
|
local mouse_coords = capi.mouse.coords()
|
||||||
|
x = mouse_coords.x
|
||||||
|
y = mouse_coords.y
|
||||||
|
coordinates_delta = {x = corner_x-x,y = corner_y-y}
|
||||||
|
|
||||||
|
capi.mousegrabber.run(function(state)
|
||||||
|
if not c.valid then return false end
|
||||||
|
|
||||||
|
state.x = state.x + coordinates_delta.x
|
||||||
|
state.y = state.y + coordinates_delta.y
|
||||||
|
|
||||||
|
for _, v in ipairs(state.buttons) do
|
||||||
|
if v then
|
||||||
|
local ng
|
||||||
|
|
||||||
|
prev_coords = { x = state.x, y = state.y }
|
||||||
|
|
||||||
|
if corner == "bottom_right" then
|
||||||
|
ng = {
|
||||||
|
width = state.x - g.x,
|
||||||
|
height = state.y - g.y
|
||||||
|
}
|
||||||
|
elseif corner == "bottom_left" then
|
||||||
|
ng = {
|
||||||
|
x = state.x,
|
||||||
|
width = (g.x + g.width) - state.x,
|
||||||
|
height = state.y - g.y
|
||||||
|
}
|
||||||
|
elseif corner == "top_left" then
|
||||||
|
ng = {
|
||||||
|
x = state.x,
|
||||||
|
width = (g.x + g.width) - state.x,
|
||||||
|
y = state.y,
|
||||||
|
height = (g.y + g.height) - state.y
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ng = {
|
||||||
|
width = state.x - g.x,
|
||||||
|
y = state.y,
|
||||||
|
height = (g.y + g.height) - state.y
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
if ng.width <= 0 then ng.width = nil end
|
||||||
|
if ng.height <= 0 then ng.height = nil end
|
||||||
|
if fixed_x then ng.width = g.width ng.x = g.x end
|
||||||
|
if fixed_y then ng.height = g.height ng.y = g.y end
|
||||||
|
|
||||||
|
c:geometry(ng)
|
||||||
|
local rg = c:geometry()
|
||||||
|
|
||||||
|
if corner == "bottom_right" then
|
||||||
|
ng = {}
|
||||||
|
elseif corner == "bottom_left" then
|
||||||
|
ng = {
|
||||||
|
x = (g.x + g.width) - rg.width
|
||||||
|
}
|
||||||
|
elseif corner == "top_left" then
|
||||||
|
ng = {
|
||||||
|
x = (g.x + g.width) - rg.width,
|
||||||
|
y = (g.y + g.height) - rg.height
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ng = {
|
||||||
|
y = (g.y + g.height) - rg.height
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
c:geometry({ x = ng.x, y = ng.y })
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return prev_coords.x == state.x and prev_coords.y == state.y
|
||||||
|
end, corner .. "_corner")
|
||||||
|
end
|
||||||
|
|
||||||
|
function floating.arrange()
|
||||||
|
end
|
||||||
|
|
||||||
|
floating.name = "floating"
|
||||||
|
|
||||||
|
return floating
|
|
@ -1,3 +1,4 @@
|
||||||
|
local gears = require("gears")
|
||||||
local awful = require("awful")
|
local awful = require("awful")
|
||||||
local beautiful = require("beautiful")
|
local beautiful = require("beautiful")
|
||||||
|
|
||||||
|
@ -10,14 +11,20 @@ screen.connect_signal("property::geometry", function(s)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- Ensure client is on screen
|
-- Attach client to top of the slaves and ensure client is on screen
|
||||||
client.connect_signal("manage", function(c)
|
client.connect_signal("manage", function(c)
|
||||||
|
if not awesome.startup then utils.attach_top(c) end
|
||||||
|
|
||||||
if awesome.startup
|
if awesome.startup
|
||||||
and not c.size_hints.user_position
|
and not c.size_hints.user_position
|
||||||
and not c.size_hints.program_position
|
and not c.size_hints.program_position
|
||||||
then
|
then
|
||||||
awful.placement.no_offscreen(c)
|
awful.placement.no_offscreen(c)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if c.floating then
|
||||||
|
c.ontop = true
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- Use sloppy focus for clients
|
-- Use sloppy focus for clients
|
||||||
|
@ -26,24 +33,7 @@ client.connect_signal("mouse::enter", function(c)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- Set border color based on focus status
|
-- Set border color based on focus status
|
||||||
client.connect_signal("focus", function(c)
|
client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
|
||||||
if tag_only_has_floating() then
|
|
||||||
awful.client.focus.byidx(1)
|
|
||||||
else
|
|
||||||
t = 0
|
|
||||||
repeat
|
|
||||||
awful.client.focus.byidx(-1)
|
|
||||||
t = t + 1
|
|
||||||
until not client.focus.floating or t > 5
|
|
||||||
end
|
|
||||||
c.border_color = beautiful.border_focus
|
|
||||||
end)
|
|
||||||
client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
|
client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
|
||||||
|
|
||||||
client.connect_signal("unminimize", function(c) c.unminize() end)
|
client.connect_signal("minimize", function(c) c.unminize() end)
|
||||||
|
|
||||||
client.connect_signal("manage", function (c)
|
|
||||||
if c.floating then
|
|
||||||
c.ontop = true
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
|
@ -1,12 +1,16 @@
|
||||||
local awful = require("awful")
|
local awful = require("awful")
|
||||||
|
|
||||||
function tag_only_has_floating()
|
local utils = {}
|
||||||
local tag = awful.screen.focused().selected_tag
|
|
||||||
local clients = tag:clients()
|
function utils.attach_top(c)
|
||||||
for _, c in ipairs(clients) do
|
local t = awful.tag.selected(c.screen)
|
||||||
if not c.floating then
|
|
||||||
return false
|
local clients = t:clients()
|
||||||
end
|
local layout = awful.tag.getproperty(t, "layout")
|
||||||
end
|
local nmaster = layout.master_count or 1
|
||||||
return true
|
|
||||||
|
local index = math.min(#clients, nmaster)
|
||||||
|
c:swap(clients[index])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
return utils
|
||||||
|
|
Loading…
Reference in a new issue