Updated river config
This commit is contained in:
parent
0715f8b16b
commit
f635cfc80e
1 changed files with 27 additions and 77 deletions
104
river/init.lua
104
river/init.lua
|
|
@ -1,13 +1,5 @@
|
|||
#!/usr/bin/lua5.4
|
||||
|
||||
--[[
|
||||
|
||||
NOTE:
|
||||
- execp() needs 'lua-posix' package
|
||||
- bitwise operands for tag mappings need Lua version >= 5.3
|
||||
|
||||
--]]
|
||||
|
||||
-- Convenient functions ────────────────────────────────────────────────────────
|
||||
|
||||
-- Wrapper around table.concat() to also handle other types
|
||||
|
|
@ -33,6 +25,11 @@ local monitors = {
|
|||
external = 'HDMI-A-1'
|
||||
}
|
||||
|
||||
local pointers = {
|
||||
touchpad = 'pointer-10248-514-ASUF1204:00_2808:0202_Touchpad',
|
||||
mouse = 'pointer-9639-64124-Compx_2.4G_Wireless_Receiver'
|
||||
}
|
||||
|
||||
local startup_commands = {
|
||||
-- Inform dbus about the environment variables
|
||||
{
|
||||
|
|
@ -45,16 +42,12 @@ local startup_commands = {
|
|||
{
|
||||
'waybar'
|
||||
},
|
||||
-- Wallpaper
|
||||
{
|
||||
string.format("swaybg -o %s -i %s -o %s -i %s",
|
||||
monitors.main, wallpapers.primary,
|
||||
monitors.external, wallpapers.secondary)
|
||||
}
|
||||
-- Startup programs
|
||||
--{
|
||||
-- 'swayidle',
|
||||
-- 'timeout 300 "swaylock"',
|
||||
--},
|
||||
}
|
||||
|
||||
local outputs = {
|
||||
|
|
@ -75,7 +68,7 @@ local outputs = {
|
|||
}
|
||||
|
||||
local inputs = {
|
||||
['pointer-10248-514-ASUF1204:00_2808:0202_Touchpad'] = {
|
||||
[pointers.touchpad] = {
|
||||
['drag'] = 'enabled',
|
||||
['tap'] = 'enabled',
|
||||
['tap-button-map'] = 'left-right-middle',
|
||||
|
|
@ -83,7 +76,7 @@ local inputs = {
|
|||
['scroll-method'] = 'two-finger',
|
||||
['accel-profile'] = 'none',
|
||||
},
|
||||
['pointer-9639-64124-Compx_2.4G_Wireless_Receiver'] = {
|
||||
[pointers.mouse] = {
|
||||
['accel-profile'] = 'none',
|
||||
}
|
||||
}
|
||||
|
|
@ -115,30 +108,6 @@ local gsettings = {
|
|||
},
|
||||
}
|
||||
|
||||
local window_rules = {
|
||||
['float-filter-add'] = {
|
||||
['app-id'] = {
|
||||
'float',
|
||||
'popup',
|
||||
'swappy',
|
||||
'pinentry-qt',
|
||||
'pavucontrol-qt',
|
||||
},
|
||||
['title'] = {
|
||||
'Picture-in-Picture',
|
||||
-- 'About *',
|
||||
},
|
||||
},
|
||||
['csd-filter-add'] = {
|
||||
['app-id'] = { 'swappy' },
|
||||
},
|
||||
}
|
||||
|
||||
-- Additional modes and their mappings to switch between them and 'normal' mode
|
||||
--
|
||||
-- name: string (the name of the additional mode)
|
||||
-- mod: string|list (modifiers for key binding, concanated by '+')
|
||||
-- key: string
|
||||
local modes = {
|
||||
{
|
||||
name = 'passthrough',
|
||||
|
|
@ -147,49 +116,46 @@ local modes = {
|
|||
},
|
||||
}
|
||||
|
||||
-- Each mapping contains 4 keys:
|
||||
--
|
||||
-- mod: string|list (modifiers, concanated by '+')
|
||||
-- key: string
|
||||
-- command: string|list (the command passed to riverctl)
|
||||
-- opt: string ('release' or 'repeat')
|
||||
local mappings = {
|
||||
-- Key bindings
|
||||
map = {
|
||||
normal = {
|
||||
-- Terminal emulator
|
||||
{
|
||||
mod = { 'Super', 'Shift' },
|
||||
key = 'T',
|
||||
command = { 'spawn', 'alacritty' },
|
||||
},
|
||||
-- Application launcher
|
||||
{
|
||||
mod = { 'Shift', 'Control' },
|
||||
key = 'Escape',
|
||||
command = { 'spawn', [['wofi --show drun']] }
|
||||
},
|
||||
-- Screenshot
|
||||
{
|
||||
mod = { 'Super', 'Shift' },
|
||||
key = 'S',
|
||||
command = { 'spawn', [['slurp | grim -g - - | wl-copy']] }
|
||||
},
|
||||
-- Screen locker
|
||||
{
|
||||
mod = { 'Super' },
|
||||
key = 'O',
|
||||
command = { 'spawn', [['waylock -init-color 0x352e2c -input-color 0x575e7a -fail-color 0x833b18']] }
|
||||
},
|
||||
-- Super+Q to close the focused view
|
||||
-- Close view
|
||||
{
|
||||
mod = 'Alt',
|
||||
key = 'F4',
|
||||
command = 'close',
|
||||
},
|
||||
-- Super+Shift+Q to exit river
|
||||
-- Exit river
|
||||
{
|
||||
mod = { 'Super', 'Shift' },
|
||||
key = 'Q',
|
||||
command = 'exit',
|
||||
},
|
||||
-- Super+{J,K} to focus next/previous view in the layout stack
|
||||
-- Focus next/previous view
|
||||
{
|
||||
mod = 'Super',
|
||||
key = 'J',
|
||||
|
|
@ -200,7 +166,7 @@ local mappings = {
|
|||
key = 'K',
|
||||
command = { 'focus-view', 'next' },
|
||||
},
|
||||
-- Super+Shift+{J,K} to swap focused view with the next/previous view in the layout stack
|
||||
-- Swap focused view with the next/previous view
|
||||
{
|
||||
mod = { 'Super', 'Shift' },
|
||||
key = 'J',
|
||||
|
|
@ -211,7 +177,7 @@ local mappings = {
|
|||
key = 'K',
|
||||
command = { 'swap', 'next' },
|
||||
},
|
||||
-- Super+{P,N} to focus next/previous output
|
||||
-- Focus next/previous output
|
||||
{
|
||||
mod = 'Super',
|
||||
key = 'P',
|
||||
|
|
@ -222,7 +188,7 @@ local mappings = {
|
|||
key = 'N',
|
||||
command = { 'focus-output', 'next' },
|
||||
},
|
||||
-- Super+Shift+{P,N} to send the focused view to next/previous output
|
||||
-- Send the focused view to next/previous output
|
||||
{
|
||||
mod = { 'Super', 'Shift' },
|
||||
key = 'P',
|
||||
|
|
@ -233,13 +199,13 @@ local mappings = {
|
|||
key = 'N',
|
||||
command = { 'send-to-output', 'next' },
|
||||
},
|
||||
-- Super+E to bump the focused view to the top of the layout stack
|
||||
-- Make view primary
|
||||
{
|
||||
mod = 'Super',
|
||||
key = 'E',
|
||||
command = 'zoom',
|
||||
},
|
||||
-- Super+{H,L} to decrease/increase the main_factor value of rivertile by 0.02
|
||||
-- Decrease/increase the main view ratio
|
||||
{
|
||||
mod = 'Super',
|
||||
key = 'H',
|
||||
|
|
@ -250,7 +216,7 @@ local mappings = {
|
|||
key = 'L',
|
||||
command = { 'send-layout-cmd', 'rivertile', [['main-ratio +0.02']] },
|
||||
},
|
||||
-- Super+Shift+{H,L} to increment/decrement the main_count value of rivertile
|
||||
-- Increment/decrement the main_count value of rivertile
|
||||
{
|
||||
mod = { 'Super', 'Shift' },
|
||||
key = 'H',
|
||||
|
|
@ -261,7 +227,7 @@ local mappings = {
|
|||
key = 'L',
|
||||
command = { 'send-layout-cmd', 'rivertile', [['main-count -1']] },
|
||||
},
|
||||
-- Control+Alt+{H,J,K,L} to change layout orientation
|
||||
-- Change layout orientation
|
||||
{
|
||||
mod = { 'Control', 'Alt' },
|
||||
key = 'H',
|
||||
|
|
@ -282,13 +248,13 @@ local mappings = {
|
|||
key = 'L',
|
||||
command = { 'send-layout-cmd', 'rivertile', [['main-location right']] },
|
||||
},
|
||||
-- Super+Space to toggle float
|
||||
-- Toggle float
|
||||
{
|
||||
mod = 'Super',
|
||||
key = 'Space',
|
||||
command = 'toggle-float',
|
||||
},
|
||||
-- Super+F to toggle fullscreen
|
||||
-- Toggle fullscreen
|
||||
{
|
||||
mod = 'Super',
|
||||
key = 'F',
|
||||
|
|
@ -299,13 +265,13 @@ local mappings = {
|
|||
-- Mappings for pointer (mouse)
|
||||
['map-pointer'] = {
|
||||
normal = {
|
||||
-- Super + Left Mouse Button to move views
|
||||
-- Move floating views
|
||||
{
|
||||
mod = 'Super',
|
||||
key = 'BTN_LEFT',
|
||||
command = 'move-view',
|
||||
},
|
||||
-- Super + Right Mouse Button to resize views
|
||||
-- Resize floating views
|
||||
{
|
||||
mod = 'Super',
|
||||
key = 'BTN_RIGHT',
|
||||
|
|
@ -341,10 +307,6 @@ end
|
|||
|
||||
-- Apply settings ──────────────────────────────────────────────────────────────
|
||||
|
||||
-- Run startup commands
|
||||
--
|
||||
-- 'riverctl spawn ...' always returns (even when the child process is a daemon)
|
||||
-- so we don't need to resort to posix.unistd.spawn()
|
||||
for _, cmd in ipairs(startup_commands) do
|
||||
os.execute(string.format([[riverctl spawn '%s']], concat(cmd, ' ')))
|
||||
end
|
||||
|
|
@ -415,6 +377,7 @@ for map_type, tbl in pairs(mappings) do
|
|||
opt = '-' .. opt
|
||||
end
|
||||
|
||||
-- -layout 0 is hardcoded to make mappings work on any layout
|
||||
os.execute(string.format('riverctl %s -layout 0 %s %s %s %s %s', map_type, opt, mode, modifiers, binding.key, cmd))
|
||||
|
||||
-- Duplicate mappings of mode 'locked' for mode 'normal'
|
||||
|
|
@ -428,20 +391,7 @@ end
|
|||
-- Mappings for tag management
|
||||
tag_mappings()
|
||||
|
||||
-- Window rules (float/csd filters)
|
||||
for key, value in pairs(window_rules) do
|
||||
for type, patterns in pairs(value) do
|
||||
for _, pattern in ipairs(patterns) do
|
||||
os.execute(string.format('riverctl %s %s %s', key, type, pattern))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Launch the layout generator as the final initial process.
|
||||
--
|
||||
-- River run the init file as a process group leader and send
|
||||
-- SIGTERM to the group on exit. Therefore, keep the main init
|
||||
-- process running (replace it with the layout generator process).
|
||||
local unistd = require('posix.unistd')
|
||||
unistd.execp('rivertile', {
|
||||
'-view-padding', 5,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue