Repository navigation
Expand file tree
/
Copy pathinit.lua.example
More file actions
230 lines (201 loc) · 11.1 KB
/
Copy pathinit.lua.example
File metadata and controls
230 lines (201 loc) · 11.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
-- 0xin configuration.
--
-- Copy to ~/.config/0xin/init.lua and edit. With no config file at all, 0xin
-- uses the built-in defaults shown below, so an empty file and a missing file
-- behave the same.
--
-- The shape of this file is: assign the settings, register the behaviour,
-- return nothing. It is ordinary Lua, so it can loop, branch, and ask the
-- machine it is running on what is available.
--
-- If this file has an error, 0xin reports it with the line number and starts on
-- the built-in defaults — it never refuses to start. `0xinctl config-error`
-- repeats the message once you are in.
local oxin = require("oxin")
-- ---------------------------------------------------------------------------
-- Settings
-- ---------------------------------------------------------------------------
-- A setting you do not mention keeps its default. A name that is not a setting
-- is an error rather than a typo that silently does nothing.
-- The primary modifier, written as MOD in bindings below.
-- Set this BEFORE any MOD+ binding: chords resolve MOD as they are written.
oxin.modifier = "super" -- super | alt | ctrl | shift
oxin.gap = 4 -- pixels between and around windows
oxin.first_split = "vertical" -- vertical (left/right) | horizontal
oxin.background = { 0.0, 0.6, 0.6 } -- r, g, b in 0..1
-- oxin.wallpaper = "~/pictures/wall.png" -- PNG or JPEG; colour stays the fallback
oxin.window_opacity = 1.0 -- 0.0..1.0, applied to app windows
oxin.corner_radius = 8 -- logical pixels; 0 disables masking
-- (needs wlroots' GLES2 renderer)
oxin.border_width = 2 -- frame around windows; 0 = none
oxin.border_color_focused = { 0.35, 0.65, 1.0 } -- window with keyboard focus
oxin.border_color_unfocused = { 0.25, 0.25, 0.25 } -- every other window
oxin.float_size = { 60, 60 } -- default float size, % of usable area
oxin.focus_follows_mouse = false -- true: the window the pointer enters gets focus
-- Mod+drag a tiled window near another's edge to put it on that side, or into
-- its middle to trade places with it.
oxin.tile_drag = { sides = { "left", "right", "top", "bottom" }, replace = true }
-- oxin.tile_drag = { sides = { "left", "right" } } -- side-by-side only
-- oxin.tile_drag = { replace = false } -- edges only, no trading places
-- oxin.tile_drag = false -- off: Mod+click reaches the app
oxin.tile_resize = true -- Mod+right-drag moves a tiled window's edges
-- Touch: whether the bottom gesture target draws a visible pill.
oxin.gesture_handle = "visible" -- visible | hidden
-- Remote desktops and VM windows. A viewer that grabs the keyboard (Remmina,
-- FreeRDP's SDL client) gets every key while focused, Super and 0xin chords
-- included, until `pass_keys` (Ctrl+Alt+Escape by default) takes them back.
oxin.shortcuts_inhibit = true -- false: wait for a pass_keys press
-- Whether keys from virtual keyboards (an on-screen keyboard, a remote-desktop
-- server's input) may trigger bindings, not only type.
oxin.virtual_keyboard_binds = false
-- An optional virtual-keyboard controller, if you run one.
-- oxin.keyboard = {
-- show = "pkill -USR2 -x my-osk",
-- hide = "pkill -USR1 -x my-osk",
-- height = 300, -- its logical footprint height
-- }
-- ---------------------------------------------------------------------------
-- Monitors
-- ---------------------------------------------------------------------------
-- Keyed by connector name (`wlr-randr` will tell you). A monitor with no entry
-- is placed automatically, so this is opt-in.
--
-- oxin.monitors["DP-1"] = { x = 0, y = 0, scale = 1.0 }
-- oxin.monitors["HDMI-A-1"] = { x = 1920, y = 0, scale = 1.0 }
-- ---------------------------------------------------------------------------
-- Scratchpads
-- ---------------------------------------------------------------------------
-- A floating window one key hides and brings back, its program running the
-- whole time. The first press starts `cmd`; later presses hide it, show it
-- again, or (shown but not focused, or on another workspace) bring it to you.
-- Its window is recognised by app_id, so `cmd` has to set it: kitty --class,
-- foot --app-id. Closing it (Mod+Q, or the program exiting) ends it; the next
-- press starts a fresh one.
--
-- oxin.scratchpads["term"] = {
-- cmd = "kitty --class term", -- a shell; add `-e ~/bin/tool` to run your own
-- app_id = "term", -- optional: defaults to the name
-- position = "center", -- "center" (default) or "top" (a drop-down)
-- size = { 60, 60 }, -- % of the usable area; default float_size
-- -- centered, { 100, 40 } as a drop-down
-- }
-- oxin.keys["MOD+grave"] = oxin.action.scratchpad("term")
-- ---------------------------------------------------------------------------
-- Keys
-- ---------------------------------------------------------------------------
-- Keyed by chord, so binding the same chord twice replaces rather than stacks,
-- and the order of modifiers does not matter. Key names are xkb names
-- (`xev` or `wev` will tell you). A chord with no modifier is just the key.
--
-- Every binding below is already a default; they are written out so you can see
-- what you are overriding. Your bindings merge with the defaults rather than
-- replacing them, so a two-line config still has a working keymap.
oxin.keys["MOD+Return"] = oxin.action.spawn("kitty")
oxin.keys["MOD+q"] = oxin.action.close
oxin.keys["MOD+SHIFT+q"] = oxin.action.quit
oxin.keys["MOD+h"] = oxin.action.focus("left")
oxin.keys["MOD+j"] = oxin.action.focus("down")
oxin.keys["MOD+k"] = oxin.action.focus("up")
oxin.keys["MOD+l"] = oxin.action.focus("right")
oxin.keys["MOD+SHIFT+h"] = oxin.action.move("left")
oxin.keys["MOD+SHIFT+j"] = oxin.action.move("down")
oxin.keys["MOD+SHIFT+k"] = oxin.action.move("up")
oxin.keys["MOD+SHIFT+l"] = oxin.action.move("right")
oxin.keys["MOD+CTRL+h"] = oxin.action.resize("left")
oxin.keys["MOD+CTRL+j"] = oxin.action.resize("down")
oxin.keys["MOD+CTRL+k"] = oxin.action.resize("up")
oxin.keys["MOD+CTRL+l"] = oxin.action.resize("right")
oxin.keys["MOD+f"] = oxin.action.fullscreen
oxin.keys["MOD+s"] = oxin.action.solo
oxin.keys["MOD+v"] = oxin.action.float
-- Because this is a real language, nine workspace keys take two lines.
-- Workspaces work as in Hyprland: one is made the first time you go to it,
-- on the focused monitor, and dropped once it is empty and off screen, so
-- any number works. Each belongs to one monitor; going to a workspace on
-- another monitor moves focus there. Moving a window takes you along; add
-- `{ follow = false }` to stay where you are.
for i = 1, 9 do
oxin.keys["MOD+" .. i] = oxin.action.workspace(i)
oxin.keys["MOD+SHIFT+" .. i] = oxin.action.move_to_workspace(i)
end
-- Every key to the focused window (a remote desktop, a VM), or back to 0xin.
-- Not on MOD: the remote already saw Super go down, and a lone Super tap
-- opens the Windows Start menu.
oxin.keys["CTRL+ALT+Escape"] = oxin.action.pass_keys
-- Assigning nil removes a binding, including a built-in one.
-- oxin.keys["MOD+f"] = nil
-- Saving this file already reloads it into the running session; a key for it
-- is only needed if you edit somewhere the save is not seen.
-- oxin.keys["MOD+SHIFT+r"] = oxin.action.reload
-- A binding can also be a function, and then it can do anything Lua can.
-- oxin.keys["MOD+g"] = function()
-- oxin.gap = (oxin.gap == 0) and 12 or 0
-- end
-- Hold the chord for `ms` to get a different action. Held and tapped are
-- separate tables, so the same chord can have both.
-- oxin.hold["XF86PowerOff"] = { ms = 2000, action = oxin.action.spawn("power-menu") }
-- ---------------------------------------------------------------------------
-- Touch gestures
-- ---------------------------------------------------------------------------
-- Only meaningful with a touchscreen. Keyed by trigger name; the full set is
-- the edge swipes (bottom-up, bottom-down, edge-left-in, edge-right-in,
-- edge-left-up/down, edge-right-up/down, top-left, top-right, top-down,
-- to-top, to-left, to-right), the multi-finger swipes (two-/three- up, down,
-- left, right) and double-tap.
--
-- oxin.gestures["edge-right-up"] = oxin.action.workspace_next
-- oxin.gestures["edge-right-down"] = oxin.action.workspace_prev
-- oxin.gestures["three-up"] = oxin.action.close
-- oxin.gestures["double-tap"] = oxin.action.solo
-- ---------------------------------------------------------------------------
-- Touchpad gestures
-- ---------------------------------------------------------------------------
-- The laptop counterpart, in their own `pad-` namespace: pad-three-left,
-- -right, -up, -down and pad-pinch-in / pad-pinch-out. Three fingers rather
-- than two because libinput treats two fingers on a touchpad as scrolling,
-- and pinch is a separate event type rather than a swipe.
--
-- Anything left unbound is forwarded to the focused window, so an app's own
-- pinch-to-zoom keeps working.
--
-- oxin.gestures["pad-three-left"] = oxin.action.workspace_prev
-- oxin.gestures["pad-three-right"] = oxin.action.workspace_next
-- oxin.gestures["pad-three-up"] = oxin.action.fullscreen
-- oxin.gestures["pad-pinch-in"] = oxin.action.solo
-- ---------------------------------------------------------------------------
-- Behaviour
-- ---------------------------------------------------------------------------
-- Handlers can be registered as often as you like and run in the order you
-- registered them. If one raises, it is reported and the rest still run.
-- Runs once, after the Wayland socket exists, so anything launched here can
-- connect to us. This is what replaces a list of autostart lines:
-- local function autostart(cmd)
-- oxin.on.startup(function() oxin.spawn(cmd) end)
-- end
--
-- autostart("my-bar")
-- autostart("my-wallpaper-daemon")
-- Runs for each new window, before it is placed. Return nil to leave it alone,
-- or a table to say what to do with it instead.
-- oxin.on.window(function(w)
-- -- w has: app_id, title, workspace (1-based), floating
-- if w.app_id == "pavucontrol" then
-- return { float = true }
-- end
-- if w.app_id == "firefox" then
-- return { workspace = 2 }
-- end
-- end)
-- Runs after the focused workspace changes. `ev` has `from` and `to`, both
-- 1-based. With two monitors, `from` and `to` can be on different ones.
-- oxin.on.workspace(function(ev)
-- oxin.spawn("notify-send 'workspace " .. ev.to .. "'")
-- end)
-- ---------------------------------------------------------------------------
-- Asking about the running compositor
-- ---------------------------------------------------------------------------
-- Available inside a binding or a handler, once the compositor is up:
-- oxin.spawn(cmd) launch a command the way a keybinding would
-- oxin.workspace() the workspace on the focused monitor, 1-based
-- oxin.workspaces() the workspaces that exist, in number order, as
-- { number = N, windows = N, monitor = "DP-1" }