Added support for vertical monitors
This commit is contained in:
parent
1685f54115
commit
af29f6ffe5
@ -7,7 +7,7 @@ set(POSITION_INDEPENDENT_CODE YES)
|
|||||||
set(C_STANDARD 11)
|
set(C_STANDARD 11)
|
||||||
add_compile_options(-Wall -Wextra)
|
add_compile_options(-Wall -Wextra)
|
||||||
|
|
||||||
pkg_check_modules(CONSTRAIN REQUIRED x11 xi xfixes xrandr)
|
pkg_check_modules(CONSTRAIN REQUIRED luajit x11 xi xfixes xrandr)
|
||||||
add_library(constrain SHARED lib/constrain.c)
|
add_library(constrain SHARED lib/constrain.c)
|
||||||
target_link_libraries(constrain ${CONSTRAIN_LIBRARIES})
|
target_link_libraries(constrain ${CONSTRAIN_LIBRARIES})
|
||||||
target_include_directories(constrain PUBLIC ${CONSTRAIN_INCLUDE_DIRS})
|
target_include_directories(constrain PUBLIC ${CONSTRAIN_INCLUDE_DIRS})
|
||||||
|
6
Makefile
6
Makefile
@ -4,6 +4,12 @@ LUA_FILES = $(shell find src -type f -name '*.lua') rc.lua settings.lua
|
|||||||
test: build
|
test: build
|
||||||
{ sleep 1; DISPLAY=:10 awesome -c "$(CURDIR)/rc.lua"; } & Xephyr :10 -name xephyr_awesome -ac -br -noreset -screen "1920x1080"
|
{ sleep 1; DISPLAY=:10 awesome -c "$(CURDIR)/rc.lua"; } & Xephyr :10 -name xephyr_awesome -ac -br -noreset -screen "1920x1080"
|
||||||
|
|
||||||
|
.PHONY: testv
|
||||||
|
testv: build
|
||||||
|
{ sleep 1; DISPLAY=:10 awesome -c "$(CURDIR)/rc.lua"; } & \
|
||||||
|
{ sleep 2; DISPLAY=:10 st & DISPLAY=:10 st & DISPLAY=:10 st & DISPLAY=:10 st & DISPLAY=:10 st; } & \
|
||||||
|
Xephyr :10 -name xephyr_awesome -ac -br -noreset -screen "1080x1920"
|
||||||
|
|
||||||
.PHONY: deploy
|
.PHONY: deploy
|
||||||
deploy: build
|
deploy: build
|
||||||
rsync -avmh --delete --exclude 'settings.lua' --include '*.lua' --include '*.so' --include '*.png' --include '*/' --include '*.rasi' --include '*.sh' --exclude '*' ./ ~/.config/awesome/
|
rsync -avmh --delete --exclude 'settings.lua' --include '*.lua' --include '*.so' --include '*.png' --include '*/' --include '*.rasi' --include '*.sh' --exclude '*' ./ ~/.config/awesome/
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
{
|
{
|
||||||
"folders": [
|
"folders": [
|
||||||
{
|
{
|
||||||
|
"name": "awesome (dev)",
|
||||||
"path": "."
|
"path": "."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"name": "awesome (.config)",
|
||||||
"path": "../../.config/awesome"
|
"path": "../../.config/awesome"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
BIN
icons/fairc.png
Executable file
BIN
icons/fairc.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
@ -1,5 +1,6 @@
|
|||||||
return {
|
return {
|
||||||
wallpaper = 'wall2.png',
|
wallpaper = 'wall2.png',
|
||||||
|
vallpaper = 'vall0.png',
|
||||||
systray_screen = 1,
|
systray_screen = 1,
|
||||||
|
|
||||||
show_battery = false
|
show_battery = false
|
||||||
|
@ -85,10 +85,13 @@ local globalkeys = gears.table.join(
|
|||||||
awful.key({ modkey, altkey }, 'Return', function() quake:toggle() end, { description = 'Dropdown terminal', group = 'programs' }),
|
awful.key({ modkey, altkey }, 'Return', function() quake:toggle() end, { description = 'Dropdown terminal', group = 'programs' }),
|
||||||
awful.key({ modkey }, 'y', function()
|
awful.key({ modkey }, 'y', function()
|
||||||
awful.spawn('rofi -show drun -theme "' .. os.getenv('HOME') .. '/.config/awesome/rofi/launcher.rasi"')
|
awful.spawn('rofi -show drun -theme "' .. os.getenv('HOME') .. '/.config/awesome/rofi/launcher.rasi"')
|
||||||
end, { description = 'show rofi', group = 'launcher' }),
|
end, { description = 'show drun', group = 'launcher' }),
|
||||||
|
awful.key({ modkey, 'Control', 'Shift' }, 'y', function()
|
||||||
|
awful.spawn('rofi -show drun -drun-show-actions -theme "' .. os.getenv('HOME') .. '/.config/awesome/rofi/launcher.rasi"')
|
||||||
|
end, { description = 'show drun actions', group = 'launcher' }),
|
||||||
awful.key({ modkey, 'Shift' }, 'y', function()
|
awful.key({ modkey, 'Shift' }, 'y', function()
|
||||||
awful.spawn(os.getenv('HOME') .. '/.config/awesome/rofi/launcher_launcher.sh')
|
awful.spawn(os.getenv('HOME') .. '/.config/awesome/rofi/launcher_launcher.sh')
|
||||||
end, { description = 'show rofi', group = 'launcher' }),
|
end, { description = 'show rofi launcher', group = 'launcher' }),
|
||||||
|
|
||||||
---- LAYOUT ----
|
---- LAYOUT ----
|
||||||
awful.key({ modkey, altkey }, 'l', function() awful.tag.incmwfact(0.05) end, { description = 'increase master width factor', group = 'layout' }),
|
awful.key({ modkey, altkey }, 'l', function() awful.tag.incmwfact(0.05) end, { description = 'increase master width factor', group = 'layout' }),
|
||||||
|
35
src/layouts/fair_col.lua
Normal file
35
src/layouts/fair_col.lua
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
local ipairs = ipairs
|
||||||
|
local math = math
|
||||||
|
|
||||||
|
local fair = {}
|
||||||
|
fair.name = "fairc"
|
||||||
|
|
||||||
|
function fair.arrange(s)
|
||||||
|
local wa = s.workarea
|
||||||
|
local cls = s.clients
|
||||||
|
|
||||||
|
if #cls > 0 then
|
||||||
|
local clc = #cls
|
||||||
|
local row_h = math.ceil(wa.height / clc)
|
||||||
|
clc = clc - 1
|
||||||
|
|
||||||
|
for i, c in ipairs(cls) do
|
||||||
|
i = i - 1
|
||||||
|
local g = {
|
||||||
|
width=wa.width,
|
||||||
|
x=wa.x
|
||||||
|
}
|
||||||
|
if i == clc then
|
||||||
|
g.height = wa.height - row_h * i
|
||||||
|
g.y = wa.y + wa.height - g.height
|
||||||
|
else
|
||||||
|
g.height = row_h
|
||||||
|
g.y = wa.y + row_h * i
|
||||||
|
end
|
||||||
|
|
||||||
|
s.geometries[c] = g
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return fair
|
@ -1,4 +1,6 @@
|
|||||||
local awful = require('awful')
|
local awful = require('awful')
|
||||||
|
local fair_col = require('src.layouts.fair_col')
|
||||||
|
local tile_col = require('src.layouts.tile_col')
|
||||||
|
|
||||||
tag.connect_signal("request::default_layouts", function()
|
tag.connect_signal("request::default_layouts", function()
|
||||||
awful.layout.append_default_layouts({
|
awful.layout.append_default_layouts({
|
||||||
@ -8,12 +10,8 @@ tag.connect_signal("request::default_layouts", function()
|
|||||||
awful.layout.suit.tile.left,
|
awful.layout.suit.tile.left,
|
||||||
awful.layout.suit.tile.bottom,
|
awful.layout.suit.tile.bottom,
|
||||||
awful.layout.suit.tile.top,
|
awful.layout.suit.tile.top,
|
||||||
awful.layout.suit.spiral,
|
awful.layout.suit.floating,
|
||||||
awful.layout.suit.spiral.dwindle,
|
fair_col,
|
||||||
awful.layout.suit.max,
|
--tile_col
|
||||||
awful.layout.suit.max.fullscreen,
|
|
||||||
awful.layout.suit.magnifier,
|
|
||||||
awful.layout.suit.corner.nw,
|
|
||||||
awful.layout.suit.floating
|
|
||||||
})
|
})
|
||||||
end)
|
end)
|
120
src/layouts/tile_col.lua
Normal file
120
src/layouts/tile_col.lua
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
local tag = require("awful.tag")
|
||||||
|
local client = require("awful.client")
|
||||||
|
local ipairs = ipairs
|
||||||
|
local math = math
|
||||||
|
local capi = {
|
||||||
|
mouse = mouse,
|
||||||
|
screen = screen,
|
||||||
|
mousegrabber = mousegrabber
|
||||||
|
}
|
||||||
|
|
||||||
|
local debug = require('gears.debug').dump
|
||||||
|
|
||||||
|
local function apply_size_hints(c, width, height, useless_gap)
|
||||||
|
local bw = c.border_width
|
||||||
|
width, height = width - 2 * bw - useless_gap, height - 2 * bw - useless_gap
|
||||||
|
_, height = c:apply_size_hints(math.max(1, width), math.max(1, height))
|
||||||
|
return height + 2 * bw + useless_gap
|
||||||
|
end
|
||||||
|
|
||||||
|
local tile = {}
|
||||||
|
tile.name = "tilec"
|
||||||
|
|
||||||
|
function tile.arrange(s)
|
||||||
|
local t = s.tag or capi.screen[s.screen].selected_tag
|
||||||
|
local gs = s.geometries
|
||||||
|
local cls = s.clients
|
||||||
|
local useless_gap = s.useless_gap
|
||||||
|
local nmaster = #cls
|
||||||
|
local wa = s.workarea
|
||||||
|
|
||||||
|
local fact = tag.getdata(t).windowfact
|
||||||
|
if not fact then
|
||||||
|
fact = {}
|
||||||
|
tag.getdata(t).windowfact = fact
|
||||||
|
end
|
||||||
|
|
||||||
|
if #cls > 0 then
|
||||||
|
debug(fact)
|
||||||
|
-- find our total values
|
||||||
|
local total_fact = 0
|
||||||
|
local min_fact = 1
|
||||||
|
for i = 1,nmaster do
|
||||||
|
-- calculate the height
|
||||||
|
if not fact[i] then
|
||||||
|
fact[i] = min_fact
|
||||||
|
else
|
||||||
|
min_fact = math.min(fact[i],min_fact)
|
||||||
|
end
|
||||||
|
total_fact = total_fact + fact[i]
|
||||||
|
end
|
||||||
|
|
||||||
|
local coord = wa.y
|
||||||
|
local unused = wa.height
|
||||||
|
for c = 1,nmaster do
|
||||||
|
local geom = {}
|
||||||
|
geom.width = wa.width
|
||||||
|
geom.height = math.max(1, math.floor(unused * fact[c] / total_fact))
|
||||||
|
geom.x = wa.x
|
||||||
|
geom.y = coord
|
||||||
|
gs[cls[c]] = geom
|
||||||
|
local height = apply_size_hints(cls[c], geom.width, geom.height, useless_gap)
|
||||||
|
coord = coord + height
|
||||||
|
unused = unused - height
|
||||||
|
total_fact = total_fact - fact[c]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
function tile.skip_gap(nclients, t) return nclients == 1 and t.master_fill_policy == "expand" end
|
||||||
|
|
||||||
|
function tile.mouse_resize_handler(c, _, _, _)
|
||||||
|
local wa = c.screen.workarea
|
||||||
|
local t = c.screen.selected_tag
|
||||||
|
local useless_gap = t.gap
|
||||||
|
local g = c:geometry()
|
||||||
|
local i = client.idx(c).idx
|
||||||
|
local fact = tag.getdata(t).windowfact
|
||||||
|
if not fact then
|
||||||
|
fact = {}
|
||||||
|
tag.getdata(t).windowfact = fact
|
||||||
|
end
|
||||||
|
local offset = 0
|
||||||
|
if g.height+useless_gap+15 > wa.height then
|
||||||
|
offset = g.height * .5
|
||||||
|
elseif g.y+g.height+useless_gap+15 <= wa.y+wa.height then
|
||||||
|
offset = g.height
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
print(g.y + (((capi.mouse.coords().y - g.y) >= (g.height / 2)) and g.height or 0))
|
||||||
|
capi.mouse.coords { x = wa.x + wa.width * 0.5, y = g.y + offset }
|
||||||
|
local prev_coords = {}
|
||||||
|
capi.mousegrabber.run(function(coords)
|
||||||
|
if not c.valid then return false end
|
||||||
|
|
||||||
|
for _, v in ipairs(coords.buttons) do
|
||||||
|
if v then
|
||||||
|
prev_coords = { y = coords.y }
|
||||||
|
|
||||||
|
local geom = c:geometry()
|
||||||
|
|
||||||
|
local wfact
|
||||||
|
if (geom.y + geom.height + useless_gap + 15) > (wa.y + wa.height) then
|
||||||
|
wfact = (geom.y + geom.height - coords.y) / wa.height
|
||||||
|
else
|
||||||
|
wfact = (coords.y - geom.y) / wa.height
|
||||||
|
end
|
||||||
|
|
||||||
|
fact[i] = math.min(math.max(wfact, 0.01), 0.99)
|
||||||
|
t:emit_signal("property::windowfact")
|
||||||
|
print(fact[i])
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return (prev_coords.y == coords.y)
|
||||||
|
end, "sb_v_double_arrow")
|
||||||
|
end
|
||||||
|
|
||||||
|
return tile
|
@ -5,6 +5,7 @@ local confdir = require('src.util.path').conf_dir
|
|||||||
|
|
||||||
---@class Settings
|
---@class Settings
|
||||||
---@field wallpaper? string
|
---@field wallpaper? string
|
||||||
|
---@field vallpaper? string
|
||||||
---@field systray_screen? integer
|
---@field systray_screen? integer
|
||||||
---@field show_battery? boolean
|
---@field show_battery? boolean
|
||||||
---@return Settings
|
---@return Settings
|
||||||
@ -29,6 +30,7 @@ local settings = load_settings()
|
|||||||
return {
|
return {
|
||||||
confdir = confdir,
|
confdir = confdir,
|
||||||
wallpaper = confdir .. '/wallpapers/' .. (settings.wallpaper or 'wall.png'),
|
wallpaper = confdir .. '/wallpapers/' .. (settings.wallpaper or 'wall.png'),
|
||||||
|
vallpaper = confdir .. '/wallpapers/' .. (settings.vallpaper or 'vall0.png'),
|
||||||
font = 'Terminus 8',
|
font = 'Terminus 8',
|
||||||
font_mono = 'Mononoki Nerd Font Mono 10',
|
font_mono = 'Mononoki Nerd Font Mono 10',
|
||||||
bg_normal = '#000000',
|
bg_normal = '#000000',
|
||||||
@ -83,6 +85,7 @@ return {
|
|||||||
layout_fullscreen = confdir .. '/icons/fullscreen.png',
|
layout_fullscreen = confdir .. '/icons/fullscreen.png',
|
||||||
layout_magnifier = confdir .. '/icons/magnifier.png',
|
layout_magnifier = confdir .. '/icons/magnifier.png',
|
||||||
layout_floating = confdir .. '/icons/floating.png',
|
layout_floating = confdir .. '/icons/floating.png',
|
||||||
|
layout_fairc = confdir .. '/icons/fairc.png',
|
||||||
titlebar_close_button_normal = confdir .. '/icons/titlebar/close_normal.png',
|
titlebar_close_button_normal = confdir .. '/icons/titlebar/close_normal.png',
|
||||||
titlebar_close_button_focus = confdir .. '/icons/titlebar/close_focus.png',
|
titlebar_close_button_focus = confdir .. '/icons/titlebar/close_focus.png',
|
||||||
titlebar_minimize_button_normal = confdir .. '/icons/titlebar/minimize_normal.png',
|
titlebar_minimize_button_normal = confdir .. '/icons/titlebar/minimize_normal.png',
|
||||||
|
@ -4,6 +4,7 @@ local wibox = require('wibox')
|
|||||||
local dpi = require('beautiful.xresources').apply_dpi
|
local dpi = require('beautiful.xresources').apply_dpi
|
||||||
local theme = require('src.theme')
|
local theme = require('src.theme')
|
||||||
local widgets = require('src.widgets')
|
local widgets = require('src.widgets')
|
||||||
|
local fair_col = require('src.layouts.fair_col')
|
||||||
|
|
||||||
local function create_separator()
|
local function create_separator()
|
||||||
return wibox.widget.separator({ orientation = 'vertical', forced_width = 7, thickness = 1, span_ratio = 0.7, color = theme.fg_normal })
|
return wibox.widget.separator({ orientation = 'vertical', forced_width = 7, thickness = 1, span_ratio = 0.7, color = theme.fg_normal })
|
||||||
@ -37,12 +38,18 @@ local tasklist_buttons = gears.table.join(
|
|||||||
awful.button({}, 1, function(c) c:emit_signal('request::activate', 'tasklist', { raise = true }) end)
|
awful.button({}, 1, function(c) c:emit_signal('request::activate', 'tasklist', { raise = true }) end)
|
||||||
)
|
)
|
||||||
|
|
||||||
screen.connect_signal('property::geometry', function(s) gears.wallpaper.maximized(theme.wallpaper, s, true) end)
|
local function wallpaper(s)
|
||||||
|
local is_v = s.geometry.height > s.geometry.width
|
||||||
|
gears.wallpaper.maximized(is_v and theme.vallpaper or theme.wallpaper, s, true)
|
||||||
|
end
|
||||||
|
|
||||||
|
screen.connect_signal('property::geometry', wallpaper)
|
||||||
|
|
||||||
return function(s)
|
return function(s)
|
||||||
gears.wallpaper.maximized(theme.wallpaper, s, true)
|
wallpaper(s)
|
||||||
|
|
||||||
awful.tag.new({'1', '2', '3', '4', '5'}, s, awful.layout.suit.fair)
|
local is_v = s.geometry.height > s.geometry.width
|
||||||
|
awful.tag.new({'1', '2', '3', '4', '5'}, s, is_v and fair_col or awful.layout.suit.fair)
|
||||||
|
|
||||||
local tasklist = awful.widget.tasklist({
|
local tasklist = awful.widget.tasklist({
|
||||||
screen = s,
|
screen = s,
|
||||||
|
BIN
wallpapers/vall0.png
Normal file
BIN
wallpapers/vall0.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 MiB |
Loading…
x
Reference in New Issue
Block a user