Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move spawn_once logic into compositor #122

Merged
merged 1 commit into from
Dec 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 30 additions & 49 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ repository = "https://github.com/pinnacle-comp/pinnacle/"
keywords = ["wayland", "compositor", "smithay", "lua"]

[dependencies]
tracing = { git = "https://github.com/tokio-rs/tracing", rev = "84f0a60" }
tracing-subscriber = { git = "https://github.com/tokio-rs/tracing", rev = "84f0a60", features = ["env-filter"] }
tracing-appender = { git = "https://github.com/tokio-rs/tracing", rev = "84f0a60" }
tracing = "0.1.40"
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
tracing-appender = "0.2.3"
smithay = { git = "https://github.com/Smithay/smithay", rev = "56b6441a14600593d13229b9584058ec19e3e18b", default-features = false, features = ["desktop", "wayland_frontend"] }
smithay-drm-extras = { git = "https://github.com/Smithay/smithay", rev = "56b6441a14600593d13229b9584058ec19e3e18b", optional = true }
thiserror = "1"
Expand Down
71 changes: 41 additions & 30 deletions api/lua/example_config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ require("pinnacle").setup(function(pinnacle)
-- Outputs -----------------------------------------------------------------------
-- You can set your own monitor layout as I have done below for my monitors.
--
-- local lg = output.get_by_name("DP-2") --[[@as Output]]
-- local dell = output.get_by_name("DP-3") --[[@as Output]]
-- local lg = output.get_by_name("DP-2") --[[@as OutputHandle]]
-- local dell = output.get_by_name("DP-3") --[[@as OutputHandle]]
--
-- dell:set_loc_left_of(lg, "bottom")

Expand All @@ -42,49 +42,55 @@ require("pinnacle").setup(function(pinnacle)

-- Mousebinds --------------------------------------------------------------------

input.mousebind({"Ctrl"}, buttons.left, "Press",
function() window.begin_move(buttons.left) end)
input.mousebind({"Ctrl"}, buttons.right, "Press",
function() window.begin_resize(buttons.right) end)
input.mousebind({ "Ctrl" }, buttons.left, "Press", function()
window.begin_move(buttons.left)
end)
input.mousebind({ "Ctrl" }, buttons.right, "Press", function()
window.begin_resize(buttons.right)
end)

-- Keybinds ----------------------------------------------------------------------

-- mod_key + Alt + q quits the compositor
input.keybind({mod_key, "Alt"}, keys.q, pinnacle.quit)
input.keybind({ mod_key, "Alt" }, keys.q, pinnacle.quit)

-- mod_key + Alt + c closes the focused window
input.keybind({mod_key, "Alt"}, keys.c,
function() window.get_focused():close() end)
input.keybind({ mod_key, "Alt" }, keys.c, function()
window.get_focused():close()
end)

-- mod_key + return spawns a terminal
input.keybind({mod_key}, keys.Return, function()
input.keybind({ mod_key }, keys.Return, function()
process.spawn(terminal, function(stdout, stderr, exit_code, exit_msg)
-- do something with the output here
end)
end)

-- mod_key + Alt + Space toggle floating on the focused window
input.keybind({mod_key, "Alt"}, keys.space,
function() window.get_focused():toggle_floating() end)
input.keybind({ mod_key, "Alt" }, keys.space, function()
window.get_focused():toggle_floating()
end)

-- mod_key + f toggles fullscreen on the focused window
input.keybind({mod_key}, keys.f,
function() window.get_focused():toggle_fullscreen() end)
input.keybind({ mod_key }, keys.f, function()
window.get_focused():toggle_fullscreen()
end)

-- mod_key + m toggles maximized on the focused window
input.keybind({mod_key}, keys.m,
function() window.get_focused():toggle_maximized() end)
input.keybind({ mod_key }, keys.m, function()
window.get_focused():toggle_maximized()
end)

-- Tags ---------------------------------------------------------------------------

local tags = {"1", "2", "3", "4", "5"}
local tags = { "1", "2", "3", "4", "5" }

output.connect_for_all(function(op)
-- Add tags 1, 2, 3, 4 and 5 on all monitors, and toggle tag 1 active by default

op:add_tags(tags)
-- Same as tag.add(op, "1", "2", "3", "4", "5")
tag.toggle({name = "1", output = op})
tag.toggle({ name = "1", output = op })

-- Window rules
-- Add your own window rules here. Below is an example.
Expand All @@ -111,30 +117,35 @@ require("pinnacle").setup(function(pinnacle)
-- Create a layout cycler to cycle your tag layouts. This will store which layout each tag has
-- and change to the next or previous one in the array when the respective function is called.
local layout_cycler = tag.layout_cycler({
"MasterStack", "Dwindle", "Spiral", "CornerTopLeft", "CornerTopRight",
"CornerBottomLeft", "CornerBottomRight"
"MasterStack",
"Dwindle",
"Spiral",
"CornerTopLeft",
"CornerTopRight",
"CornerBottomLeft",
"CornerBottomRight",
})

input.keybind({mod_key}, keys.space, layout_cycler.next)
input.keybind({mod_key, "Shift"}, keys.space, layout_cycler.prev)
input.keybind({ mod_key }, keys.space, layout_cycler.next)
input.keybind({ mod_key, "Shift" }, keys.space, layout_cycler.prev)

-- Tag manipulation

for _, tag_name in pairs(tags) do
-- mod_key + 1-5 switches tags
input.keybind({mod_key}, tag_name,
function() tag.switch_to(tag_name) end)
input.keybind({ mod_key }, tag_name, function()
tag.switch_to(tag_name)
end)
-- mod_key + Shift + 1-5 toggles tags
input.keybind({mod_key, "Shift"}, tag_name,
function() tag.toggle(tag_name) end)
input.keybind({ mod_key, "Shift" }, tag_name, function()
tag.toggle(tag_name)
end)
-- mod_key + Alt + 1-5 moves windows to tags
input.keybind({mod_key, "Alt"}, tag_name,
function()
input.keybind({ mod_key, "Alt" }, tag_name, function()
window:get_focused():move_to_tag(tag_name)
end)
-- mod_key + Shift + Alt + 1-5 toggles tags on windows
input.keybind({mod_key, "Shift", "Alt"}, tag_name,
function()
input.keybind({ mod_key, "Shift", "Alt" }, tag_name, function()
window.get_focused():toggle_tag(tag_name)
end)
end
Expand Down
1 change: 1 addition & 0 deletions api/lua/msg.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
---@field WindowResizeGrab { button: integer }?
--
---@field Spawn { command: string[], callback_id: integer? }?
---@field SpawnOnce { command: string[], callback_id: integer? }?
---@field SetEnv { key: string, value: string }?
--Tags
---@field ToggleTag { tag_id: TagId }?
Expand Down
Loading
Loading