refactor utilise some new hyprland features
This commit is contained in:
@@ -137,18 +137,74 @@ hl.bind(mainMod .. " + 0", hl.dsp.focus({ workspace = 30 }))
|
||||
hl.bind(mainMod .. " + SHIFT + 0", hl.dsp.window.move({ workspace = 30 }))
|
||||
|
||||
-- Groups
|
||||
hl.bind(mainMod .. " + Z", hl.dsp.group.next())
|
||||
hl.bind(mainMod .. " + SHIFT + Z", hl.dsp.group.prev())
|
||||
local function is_grouped()
|
||||
local h = io.popen("hyprctl activewindow -j 2>/dev/null")
|
||||
if not h then return false end
|
||||
local out = h:read("*a"); h:close()
|
||||
local arr = out:match('"grouped":%[(.-)%]')
|
||||
return arr ~= nil and arr ~= "" and arr ~= "null"
|
||||
end
|
||||
|
||||
local function smart_group(dir)
|
||||
if is_grouped() then
|
||||
hl.dispatch(hl.dsp.window.move({ out_of_group = true }))
|
||||
else
|
||||
hl.dispatch(hl.dsp.window.move({ into_or_create_group = dir }))
|
||||
end
|
||||
end
|
||||
|
||||
hl.bind(mainMod .. " + G", hl.dsp.group.toggle())
|
||||
hl.bind(mainMod .. " + CTRL + G", hl.dsp.window.move({ out_of_group = true }))
|
||||
hl.bind(mainMod .. " + CTRL + H", hl.dsp.group.prev())
|
||||
hl.bind(mainMod .. " + CTRL + L", hl.dsp.group.next())
|
||||
hl.bind(mainMod .. " + CTRL + J", hl.dsp.group.move_window({ forward = true }))
|
||||
hl.bind(mainMod .. " + CTRL + K", hl.dsp.group.move_window({ forward = false }))
|
||||
hl.bind(mainMod .. " + CTRL + SHIFT + H", function() smart_group("l") end)
|
||||
hl.bind(mainMod .. " + CTRL + SHIFT + J", function() smart_group("d") end)
|
||||
hl.bind(mainMod .. " + CTRL + SHIFT + K", function() smart_group("u") end)
|
||||
hl.bind(mainMod .. " + CTRL + SHIFT + L", function() smart_group("r") end)
|
||||
hl.bind(mainMod .. " + Z", hl.dsp.group.next())
|
||||
hl.bind(mainMod .. " + SHIFT + Z", hl.dsp.group.prev())
|
||||
|
||||
-- Layout-aware navigation
|
||||
hl.bind(mainMod .. " + ALT + H", hl.dsp.exec_cmd("hypr-workspace-layout nav-prev"))
|
||||
hl.bind(mainMod .. " + ALT + L", hl.dsp.exec_cmd("hypr-workspace-layout nav-next"))
|
||||
hl.bind(mainMod .. " + ALT + J", hl.dsp.exec_cmd("hypr-workspace-layout nav-down"))
|
||||
hl.bind(mainMod .. " + ALT + K", hl.dsp.exec_cmd("hypr-workspace-layout nav-up"))
|
||||
hl.bind(mainMod .. " + ALT + Tab", hl.dsp.exec_cmd("hypr-workspace-layout nav-next"))
|
||||
hl.bind(mainMod .. " + ALT + SHIFT + Tab", hl.dsp.exec_cmd("hypr-workspace-layout nav-prev"))
|
||||
hl.bind(mainMod .. " + ALT + SHIFT + J", hl.dsp.exec_cmd("hypr-workspace-layout resize-shrink-h"))
|
||||
hl.bind(mainMod .. " + ALT + SHIFT + K", hl.dsp.exec_cmd("hypr-workspace-layout resize-grow-h"))
|
||||
|
||||
-- Mouse binds
|
||||
hl.bind(mainMod .. " + mouse:272", hl.dsp.window.drag(), { mouse = true })
|
||||
hl.bind(mainMod .. " + mouse:273", hl.dsp.window.resize(), { mouse = true })
|
||||
|
||||
-- master-scroll slave scrolling (mouse wheel + bracket fallback)
|
||||
hl.bind(mainMod .. " + mouse_down", hl.dsp.layout("scrollup"), { mouse = true })
|
||||
hl.bind(mainMod .. " + mouse_up", hl.dsp.layout("scrolldown"), { mouse = true })
|
||||
hl.bind(mainMod .. " + bracketright", hl.dsp.layout("scrolldown"))
|
||||
hl.bind(mainMod .. " + bracketleft", hl.dsp.layout("scrollup"))
|
||||
-- Guard by layout name: built-in and swap layouts error on unknown scroll messages.
|
||||
local scroll_layouts = {
|
||||
["lua:master-scroll"] = true,
|
||||
["lua:slave-master-scroll"] = true,
|
||||
["lua:center-master-scroll"] = true,
|
||||
["lua:top-master-scroll"] = true,
|
||||
["lua:center-master-scroll-v"] = true,
|
||||
}
|
||||
local function layout_scroll(dir)
|
||||
return function()
|
||||
if scroll_layouts[hl.get_config("general.layout")] then
|
||||
hl.dispatch(hl.dsp.layout(dir))
|
||||
end
|
||||
end
|
||||
end
|
||||
hl.bind(mainMod .. " + mouse_down", layout_scroll("scrollup"), { mouse = true })
|
||||
hl.bind(mainMod .. " + mouse_up", layout_scroll("scrolldown"), { mouse = true })
|
||||
hl.bind(mainMod .. " + bracketright", layout_scroll("scrolldown"))
|
||||
hl.bind(mainMod .. " + bracketleft", layout_scroll("scrollup"))
|
||||
|
||||
-- Screenshots
|
||||
hl.bind("Print", hl.dsp.exec_cmd("grimblast --notify copy screen"))
|
||||
hl.bind(mainMod .. " + Print", hl.dsp.exec_cmd("owlry-screenshot-menu"))
|
||||
hl.bind("SHIFT + Print", hl.dsp.exec_cmd("uwsm app -- kitty --class=scrrec -e wf-recorder -f ~/Videos/scrrec.mkv -y -g \"$(slurp)\""))
|
||||
|
||||
-- Multimedia
|
||||
hl.bind("XF86AudioRaiseVolume", hl.dsp.exec_cmd("wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+"), { repeating = true })
|
||||
|
||||
@@ -13,19 +13,21 @@ hl.config({
|
||||
-- colors to be integrated via theme table
|
||||
groupbar = {
|
||||
enabled = true,
|
||||
height = 12,
|
||||
height = 16,
|
||||
font_family = "GeistMono Nerd Font",
|
||||
font_size = 8,
|
||||
font_weight_active = "semibold",
|
||||
font_weight_inactive = "normal",
|
||||
stacked = false,
|
||||
gradients = true,
|
||||
gradient_rounding = 5,
|
||||
gradient_rounding = 6,
|
||||
gradient_rounding_power = 4.0,
|
||||
gradient_round_only_edges = false,
|
||||
indicator_height = 0,
|
||||
rounding = 0,
|
||||
gradient_round_only_edges = true,
|
||||
render_titles = true,
|
||||
scrolling = true,
|
||||
text_padding = 4,
|
||||
priority = 3
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,8 +32,9 @@ theme.border_group_inactive = { colors = { "rgba(40404066)", "rgba(14141466)" },
|
||||
theme.border_grouplocked_active = { colors = { "rgba(00eaffff)", "rgba(9d00ffff)" }, angle = 45 }
|
||||
theme.border_grouplocked_inactive = { colors = { "rgba(00eaff66)", "rgba(9d00ff66)" }, angle = 45 }
|
||||
|
||||
theme.groupbar_text = "rgba(050505ff)"
|
||||
theme.groupbar_active = { colors = { "rgba(ff0044ff)", "rgba(9d00ffaa)" } }
|
||||
theme.groupbar_text = "rgba(edededff)"
|
||||
theme.groupbar_text_inactive = "rgba(edededaa)"
|
||||
theme.groupbar_active = { colors = { "rgba(ffb700ff)", "rgba(050505ff)", "rgba(050505ff)", "rgba(050505ff)", "rgba(050505ff)", "rgba(050505ff)", "rgba(050505ff)", "rgba(ffb700ff)" }, angle = 0 }
|
||||
theme.groupbar_inactive = { colors = { "rgba(141414ee)", "rgba(404040aa)" } }
|
||||
theme.groupbar_grouplocked_active = { colors = { "rgba(00eaffff)", "rgba(9d00ffff)" } }
|
||||
theme.groupbar_grouplocked_inactive = { colors = { "rgba(00eaffaa)", "rgba(9d00ffaa)" } }
|
||||
@@ -67,6 +68,7 @@ theme.border_grouplocked_active = { colors = { "rgba(007a88ff)", "rgba(7a3cffff)
|
||||
theme.border_grouplocked_inactive = { colors = { "rgba(007a8866)", "rgba(7a3cff66)" }, angle = 45 }
|
||||
|
||||
theme.groupbar_text = "rgba(0a0a0aff)"
|
||||
theme.groupbar_text_inactive = "rgba(0a0a0aaa)"
|
||||
theme.groupbar_active = { colors = { "rgba(ff0044ff)", "rgba(7a3cffaa)" } }
|
||||
theme.groupbar_inactive = { colors = { "rgba(e8e8e8ee)", "rgba(737373aa)" } }
|
||||
theme.groupbar_grouplocked_active = { colors = { "rgba(007a88ff)", "rgba(7a3cffff)" } }
|
||||
@@ -96,6 +98,7 @@ hl.config({
|
||||
["col.border_locked_inactive"] = theme.border_grouplocked_inactive,
|
||||
groupbar = {
|
||||
text_color = theme.groupbar_text,
|
||||
text_color_inactive = theme.groupbar_text_inactive,
|
||||
["col.active"] = theme.groupbar_active,
|
||||
["col.inactive"] = theme.groupbar_inactive,
|
||||
["col.locked_active"] = theme.groupbar_grouplocked_active,
|
||||
|
||||
Reference in New Issue
Block a user