Skip to content
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
8 changes: 8 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"Lua.workspace.library": [
"/usr/share/hypr/stubs"
],
"Lua.diagnostics.globals": [
"changeFullscreen"
]
}
129 changes: 90 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Miaout
A really simple layout/workspace/window "manager" for hyprland lua config
A really simple *overengeeneried* workspace/window "manager" for hyprland lua config

## Setup
```lua
Expand All @@ -10,7 +10,10 @@ local miaout = require("miaout")
miaout = miaout.Init()
```
> [!IMPORTANT]
> **`hl.config({general = {layout = ...}})` need to be set before `miaout = miaout.Init()`**
> **`hl.config({...})` need to be set before `miaout = miaout.Init()`**

## Config
See config docs [Here](./Docs/CONFIG.md)

## Bind usage
```lua
Expand All @@ -19,80 +22,128 @@ hl.bind("KEY(S)", function()
end)
```

## Functions
## Methods

### Workspace

### Layout
**Some methods need a HL.Workspace as argument, to use the current workspace:**
```lua
miaout.layout:SwitchNextLayout()
miaout.workspace.current:method()
```
Switch to the next layout

```lua
miaout.layout:SwitchLastLayout()
miaout.workspace:NewWorkspace()
```
Switch to the last layout
Create a new workspace

#### Navigation

```lua
miaout.layout:SwitchPrevLayout()
miaout.workspace:NextWorkspace()
```
Switch to the previous layout
Focus the next workspace (e+1)
```lua
miaout.layout:SwitchDefaultLayout()
miaout.workspace:PrevWorkspace()
```
Switch to your default layout (see the the note above)
Focus the next workspace (e-1)

### Workspace
```lua
miaout.workspace:NewWorkspace()
miaout.workspace:NextMonitorWorkspace()
```
Create a new workspace
Focus the next monitor workspace (m+1)

```lua
miaout.workspace:PrevMonitorWorkspace()
```
Focus the next monitor workspace (m-1)

```lua
miaout.workspace:MoveToNextMonitor(workspace)
```
Move the workspace to the next monitor

```lua
miaout.workspace:SwitchNextWorkspace()
miaout.workspace:MoveToPrevMonitor(workspace)
```
Switch to the next workspace (e+1)
Move the workspace to the previous monitor

```lua
miaout.workspace:SwitchPreviousWorkspace()
miaout.workspace:MoveToMonitor(workspace, monitor)
```
Switch to the next workspace (e-1)
Move the workspace to a monitor

#### Layouts

```lua
miaout.workspace:SwitchNextMonitorWorkspace()
miaout.workspace:NextLayout(workspace)
```
Switch to the next monitor workspace (m+1)
Apply next layout to a workspace

```lua
miaout.workspace:SwitchPrevMonitorWorkspace()
miaout.workspace:PrevLayout(workspace)
```
Switch to the next monitor workspace (m-1)
Apply previous layout to a workspace

```lua
miaout.workspace:MoveWorkspaceMonitor()
miaout.workspace:DefaultLayout(workspace)
```
Move the workspace to the next Monitor
Apply the default layout to a workspace

### Window

**Some methods need a HL.Winfow as argument, to use the current window:**
```lua
miaout.window:MoveToNextWorkspace()
miaout.window.current:method()
```
Move the active window to the next workspace
#### Navigation

```lua
miaout.window:MoveToPrevWorkspace()
miaout.window:MoveToNextWorkspace(window)
```
Move the active window to the previous workspace
Move the window to the next workspace
```lua
miaout.window:SwapWindows()
miaout.window:MoveToPrevWorkspace(window)
```
Swap the active window with the last active window
Move the window to the previous workspace

```lua
miaout.window:SwapWindowMonitor()
miaout.window:MoveToNextMonitorWorkspace(window)
```
Swap the active window to the next monitor
Move the window to the next monitor workspace

```lua
miaout.window:Fullscreen()
miaout.window:MoveToPrevMonitorWorkspace(window)
```
Puts the active window in full screen (toggle switch)
Move the window to the previous monitor workspace

```lua
miaout.window:Maximise()
miaout.window:MoveToNextMonitor(window)
```
Maximise the active window (toggle switch)
Move the window to the next monitor

```lua
miaout.window:Default()
miaout.window:MoveToPrevMonitor(window)
```
Reset the window fullscreen state to the default value
Move the window to the previous monitor

```lua
miaout.window:SwapWindows(windowA, windowB)
```
Swap `windowA` with `windowB` (with current, swap with the last active window)

#### Fullscreen States

```lua
miaout.window:Fullscreen(window)
```
Puts the window in full screen (toggle switch)

```lua
miaout.window:Maximise(window)
```
Maximise the window (toggle switch)

```lua
miaout.window:Default(window)
```
Reset the window fullscreen state to the default value
5 changes: 5 additions & 0 deletions miaout/DOC.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#### il y a 3 types d'abstractions :
*par exemple pour window*
le module window est la gestion de fenêtre avec son manager et repo
le module facade est le module qui expose l'api publique
init est le module qui permet d'initialiser le tout
35 changes: 35 additions & 0 deletions miaout/config.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
local Config = {} ---@class MiaoutConfig
Config.__index = Config

function Config.new()
local self = setmetatable({}, Config)

Config.window = {
default = {client = 0, internal = 0},
maximise = {client = 1, internal = 1},
fullscreen = {client = 1, internal = 2},
}

Config.workspace = {
nextWorkspaceSelector = "e+1",
prevWorkspaceSelector = "e-1",
nextMonitorWorkspaceSelector = "m+1",
prevMonitorWorkspaceSelector = "m-1" ,
defaultLayout = hl.get_config("general.layout"),
layouts = {
"dwindle",
"master",
"scrolling",
"monocle"
}
}

Config.notifications = {
prefix = "MIAOUT ",
displayTimeMs = 3000,
}

return self
end

return Config
41 changes: 30 additions & 11 deletions miaout/init.lua
Original file line number Diff line number Diff line change
@@ -1,17 +1,36 @@
local workspace = require("miaout.workspace")
local layout = require("miaout.layout")
local window = require("miaout.window")
local Log = require("miaout.log") ---@class Log
local Config = require("miaout.config") ---@class MiaoutConfig

local M = {}
local WindowManager = require("miaout.window.manager") ---@class WindowManager
local WindowLogic = require("miaout.window.logic") ---@class WindowLogic
local WindowFacade = require("miaout.window.facade") ---@class WindowFacade

function M.Init()
local Instances = {}
local WorkspaceManager = require("miaout.workspace.manager") ---@class WorkspaceManager
local WorkspaceLogic = require("miaout.workspace.logic") ---@class WorkspaceLogic
local WorkspaceFacade = require("miaout.workspace.facade") ---@class WorkspaceFacade

Instances.layout = layout.new()
Instances.window = window.new()
Instances.workspace = workspace.new(Instances.layout, Instances.window)

return Instances
local Miaout = {}

---@return Modules
function Miaout.Init()
local config = Config.new()
local log = Log.new(config)

local workspaceManager = WorkspaceManager.new()
local workspaceLogic = WorkspaceLogic.new(log, config, workspaceManager)
local workspaceFacade = WorkspaceFacade.new(log, workspaceLogic, workspaceManager)

local windowManager = WindowManager.new()
local windowLogic = WindowLogic.new(log, config, windowManager, workspaceManager)
local windowFacade = WindowFacade.new(log, windowLogic, windowManager)

local Modules = {}

Modules.window = windowFacade
Modules.workspace = workspaceFacade

return Modules
end

return M
return Miaout
82 changes: 0 additions & 82 deletions miaout/layout.lua

This file was deleted.

Loading
Loading