My configurations for the software I use

add more rules, input configurations, and autostart apps to river

yemou.pink d760ac60 6055c547

verified
Changed files
+87 -207
config
river
+87 -207
config/river/init.roc
···
#!/usr/bin/env roc
-
app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br" }
+
app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.20.0/X73hGh05nNTkDHU06FHC0YfFaQB1pimX7gncRcao5mU.tar.br" }
# TODO: Create a platform that interfaces directly with the river wayland protocol
# TODO: Check for a cli argument to determine if the autostart commands should be run
import pf.Cmd
-
import pf.Env
import pf.Stdout
import pf.Stderr
+
tag_to_rtag = |num|
+
Num.shift_left_by 1 (num - 1)
+
|> Num.to_str
+
named_tag_to_rtag = |tag_name|
when tag_name is
One -> tag_to_rtag 1
···
Seven -> tag_to_rtag 7
Eight -> tag_to_rtag 8
Nine -> tag_to_rtag 9
-
KeePassXC -> tag_to_rtag 10
-
Nautilus -> tag_to_rtag 11
-
Thunderbird -> tag_to_rtag 12
-
All -> (Num.shift_left_by 1 32) - 1
+
Discord -> tag_to_rtag 10
+
Games -> tag_to_rtag 11
+
Hide -> tag_to_rtag 12
+
KeePassXC -> tag_to_rtag 13
+
Nautilus -> tag_to_rtag 14
+
Signal -> tag_to_rtag 15
+
Steam -> tag_to_rtag 16
+
Thunderbird -> tag_to_rtag 17
+
All -> Num.to_str ((Num.shift_left_by 1 32) - 1)
-
autostart! = |{}|
-
home = Env.decode! "HOME" ?? "/"
+
autostart = [
+
"systemctl --user start river-session-pre.target",
+
"update-session-vars",
+
"systemctl --user start river-session.target",
+
"kanshi",
+
"xrandr --output HDMI-A-5 --primary",
+
"rivertile -outer-padding 0 -view-padding 0 -main-ratio 0.5",
+
"swaybg -i /media/nextcloud/wallpapers/dark/evie-s-Pb1KFv4tauY-unsplash.jpg -m fill",
+
]
-
[
-
"systemctl --user start river-session-pre.target",
-
"update-session-vars",
-
"systemctl --user start river-session.target",
-
"kanshi",
-
"rivertile -outer-padding 0 -view-padding 0 -main-ratio 0.5",
-
Str.replace_each "swaybg -i $HOME/pic/wallpapers/dark/evie-s-Pb1KFv4tauY-unsplash.jpg -m fill" "$HOME" home,
-
]
+
autostart_apps = [
+
"keepassxc",
+
"org.mozilla.Thunderbird",
+
]
configurations = [
+
{ option: "allow-tearing", args: ["enabled"] },
{ option: "border-color-focused", args: ["0x93a1a1"] },
{ option: "border-color-unfocused", args: ["0x586e75"] },
+
{ option: "border-width", args: ["0"] },
{ option: "focus-follows-cursor", args: ["normal"] },
{ option: "set-cursor-warp", args: ["on-output-change"] },
{ option: "xcursor-theme", args: ["Adwaita", "24"] },
-
{
-
option: "input",
-
args: [
-
"pointer-1356-3570-Sony_Interactive_Entertainment_DualSense_Edge_Wireless_Controller_Touchpad",
-
"events",
-
"disabled",
-
],
-
},
+
{ option: "input", args: ["pointer-1356-3570-Sony_Interactive_Entertainment_DualSense_Edge_Wireless_Controller_Touchpad", "events", "disabled"] },
+
{ option: "input", args: ["pointer-4660-22136-extest_fake_device", "map-to-output", "HDMI-A-5"] },
]
rules = [
+
{ id: "discord", title: "", action: "output", args: ["AOC 2460G4 0x0000075E"] },
+
{ id: "discord", title: "", action: "tags", args: [named_tag_to_rtag Discord] },
{ id: "org.gnome.Nautilus", title: "", action: "float", args: [] },
-
{ id: "org.gnome.Nautilus", title: "", action: "tags", args: [Num.to_str (named_tag_to_rtag Nautilus)] },
-
{ id: "org.gnome.Nautilus", title: "", action: "float", args: [] },
+
{ id: "org.gnome.Nautilus", title: "", action: "tags", args: [named_tag_to_rtag Nautilus] },
+
{ id: "org.keepassxc.KeePassXC", title: "", action: "csd", args: [] },
{ id: "org.keepassxc.KeePassXC", title: "", action: "float", args: [] },
-
{
-
id: "org.keepassxc.KeePassXC",
-
title: "KeyChain.kdbx [Locked] - KeePassXC",
-
action: "tags",
-
args: [Num.to_str (named_tag_to_rtag KeePassXC)],
-
},
-
{ id: "org.mozilla.Thunderbird", title: "", action: "tags", args: [Num.to_str (named_tag_to_rtag Thunderbird)] },
+
{ id: "org.keepassxc.KeePassXC", title: "KeyChain.kdbx [Locked] - KeePassXC", action: "output", args: ["LG Electronics LG HDR WFHD 0x0000B11B"] },
+
{ id: "org.keepassxc.KeePassXC", title: "KeyChain.kdbx [Locked] - KeePassXC", action: "tags", args: [named_tag_to_rtag KeePassXC] },
+
{ id: "org.mozilla.Thunderbird", title: "", action: "output", args: ["LG Electronics LG HDR WFHD 0x0000B11B"] },
+
{ id: "org.mozilla.Thunderbird", title: "", action: "tags", args: [named_tag_to_rtag Thunderbird] },
+
{ id: "signal", title: "", action: "output", args: ["AOC 2460G4 0x0000075E"] },
+
{ id: "signal", title: "", action: "tags", args: [named_tag_to_rtag Signal] },
+
{ id: "steam", title: "", action: "output", args: ["LG Electronics LG HDR WFHD 0x0000B11B"] },
+
{ id: "steam", title: "", action: "tags", args: [named_tag_to_rtag Steam] },
+
{ id: "steam_app_*", title: "", action: "output", args: ["LG Electronics LG HDR WFHD 0x0000B11B"] },
+
{ id: "steam_app_*", title: "", action: "tags", args: [named_tag_to_rtag Games] },
]
modes = [
···
tag_binds =
List.range { start: At(1), end: At(9) }
|> List.map(
-
|tag_num| [
-
{
-
mode: "normal",
-
mods: [Super],
-
key: Num.to_str tag_num,
-
cmd: "toggle-focused-tags",
-
args: [Num.to_str (tag_to_rtag tag_num)],
-
},
-
{
-
mode: "normal",
-
mods: [Super, Shift],
-
key: Num.to_str tag_num,
-
cmd: "toggle-view-tags",
-
args: [Num.to_str (tag_to_rtag tag_num)],
-
},
-
{
-
mode: "normal",
-
mods: [Super, Control],
-
key: Num.to_str tag_num,
-
cmd: "set-focused-tags",
-
args: [Num.to_str (tag_to_rtag tag_num)],
-
},
-
{
-
mode: "normal",
-
mods: [Super, Shift, Control],
-
key: Num.to_str tag_num,
-
cmd: "set-view-tags",
-
args: [Num.to_str (tag_to_rtag tag_num)],
-
},
-
],
+
|tag|
+
tag_str = Num.to_str tag
+
[
+
{ mode: "normal", mods: [Super], key: tag_str, cmd: "toggle-focused-tags", args: [tag_to_rtag tag] },
+
{ mode: "normal", mods: [Super, Shift], key: tag_str, cmd: "toggle-view-tags", args: [tag_to_rtag tag] },
+
{ mode: "normal", mods: [Super, Control], key: tag_str, cmd: "set-focused-tags", args: [tag_to_rtag tag] },
+
{ mode: "normal", mods: [Super, Shift, Control], key: tag_str, cmd: "set-view-tags", args: [tag_to_rtag tag] },
+
],
)
|> List.join
|> List.concat [
# Show all tags
-
{
-
mode: "normal",
-
mods: [Super],
-
key: "0",
-
cmd: "set-focused-tags",
-
args: [Num.to_str (named_tag_to_rtag All)],
-
},
-
{
-
mode: "normal",
-
mods: [Super, Shift],
-
key: "0",
-
cmd: "set-view-tags",
-
args: [Num.to_str (named_tag_to_rtag All)],
-
},
+
{ mode: "normal", mods: [Super], key: "0", cmd: "set-focused-tags", args: [named_tag_to_rtag All] },
+
{ mode: "normal", mods: [Super, Shift], key: "0", cmd: "set-view-tags", args: [named_tag_to_rtag All] },
+
]
+
|> List.concat [
+
# Hide applications
+
{ mode: "normal", mods: [Super], key: "H", cmd: "set-view-tags", args: [named_tag_to_rtag Hide] },
+
{ mode: "normal", mods: [Super, Control], key: "H", cmd: "set-focused-tags", args: [named_tag_to_rtag Hide] },
]
+
+
special_tag_binds = |named_tag, key| [
+
{ mode: "special-tags", mods: [None], key: key, cmd: "toggle-focused-tags", args: [named_tag_to_rtag named_tag] },
+
{ mode: "special-tags", mods: [Shift], key: key, cmd: "toggle-view-tags", args: [named_tag_to_rtag named_tag] },
+
{ mode: "special-tags", mods: [Control], key: key, cmd: "set-focused-tags", args: [named_tag_to_rtag named_tag] },
+
{ mode: "special-tags", mods: [Shift, Control], key: key, cmd: "set-view-tags", args: [named_tag_to_rtag named_tag] },
+
]
keybinds = [
# Launch Applications
···
{ mode: "normal", mods: [Super, Alt], key: "X", cmd: "focus-output", args: ["previous"] },
{ mode: "normal", mods: [Super, Control], key: "X", cmd: "send-to-output", args: ["next"] },
{ mode: "normal", mods: [Super, Control, Alt], key: "X", cmd: "send-to-output", args: ["previous"] },
-
{
-
mode: "normal",
-
mods: [Super, Shift, Control],
-
key: "X",
-
cmd: "send-to-output",
-
args: ["-current-tags", "next"],
-
},
-
{
-
mode: "normal",
-
mods: [Super, Shift, Control, Alt],
-
key: "X",
-
cmd: "send-to-output",
-
args: ["-current-tags", "previous"],
-
},
+
{ mode: "normal", mods: [Super, Shift, Control], key: "X", cmd: "send-to-output", args: ["-current-tags", "next"] },
+
{ mode: "normal", mods: [Super, Shift, Control, Alt], key: "X", cmd: "send-to-output", args: ["-current-tags", "previous"] },
# Exit River
{ mode: "normal", mods: [Super, Control], key: "Escape", cmd: "exit", args: [] },
···
{ mode: "normal", mods: [Super], key: "Down", cmd: "send-layout-cmd", args: ["rivertile", "main-location bottom"] },
{ mode: "normal", mods: [Super], key: "Right", cmd: "send-layout-cmd", args: ["rivertile", "main-location right"] },
{ mode: "normal", mods: [Super], key: "Bracketleft", cmd: "send-layout-cmd", args: ["rivertile", "main-count -1"] },
-
{
-
mode: "normal",
-
mods: [Super],
-
key: "Bracketright",
-
cmd: "send-layout-cmd",
-
args: ["rivertile", "main-count +1"],
-
},
-
{
-
mode: "normal",
-
mods: [Super, Control],
-
key: "Bracketleft",
-
cmd: "send-layout-cmd",
-
args: ["rivertile", "main-ratio -0.05"],
-
},
-
{
-
mode: "normal",
-
mods: [Super, Control],
-
key: "Bracketright",
-
cmd: "send-layout-cmd",
-
args: ["rivertile", "main-ratio +0.05"],
-
},
+
{ mode: "normal", mods: [Super], key: "Bracketright", cmd: "send-layout-cmd", args: ["rivertile", "main-count +1"] },
+
{ mode: "normal", mods: [Super, Control], key: "Bracketleft", cmd: "send-layout-cmd", args: ["rivertile", "main-ratio -0.05"] },
+
{ mode: "normal", mods: [Super, Control], key: "Bracketright", cmd: "send-layout-cmd", args: ["rivertile", "main-ratio +0.05"] },
{ mode: "normal", mods: [Super], key: "Space", cmd: "zoom", args: [] },
{ mode: "normal", mods: [Super], key: "Comma", cmd: "focus-view", args: ["previous"] },
{ mode: "normal", mods: [Super], key: "Period", cmd: "focus-view", args: ["next"] },
···
# Special Tags Mode
{ mode: "normal", mods: [Super], key: "G", cmd: "enter-mode", args: ["special-tags"] },
{ mode: "special-tags", mods: [None], key: "Escape", cmd: "enter-mode", args: ["normal"] },
-
-
# KeePassXC Tag
-
{
-
mode: "special-tags",
-
mods: [None],
-
key: "K",
-
cmd: "toggle-focused-tags",
-
args: [Num.to_str (named_tag_to_rtag KeePassXC)],
-
},
-
{
-
mode: "special-tags",
-
mods: [Shift],
-
key: "K",
-
cmd: "toggle-view-tags",
-
args: [Num.to_str (named_tag_to_rtag KeePassXC)],
-
},
-
{
-
mode: "special-tags",
-
mods: [Control],
-
key: "K",
-
cmd: "set-focused-tags",
-
args: [Num.to_str (named_tag_to_rtag KeePassXC)],
-
},
-
{
-
mode: "special-tags",
-
mods: [Shift, Control],
-
key: "K",
-
cmd: "set-view-tags",
-
args: [Num.to_str (named_tag_to_rtag KeePassXC)],
-
},
-
-
# Thunderbird Tag
-
{
-
mode: "special-tags",
-
mods: [None],
-
key: "T",
-
cmd: "toggle-focused-tags",
-
args: [Num.to_str (named_tag_to_rtag Thunderbird)],
-
},
-
{
-
mode: "special-tags",
-
mods: [Shift],
-
key: "T",
-
cmd: "toggle-view-tags",
-
args: [Num.to_str (named_tag_to_rtag Thunderbird)],
-
},
-
{
-
mode: "special-tags",
-
mods: [Control],
-
key: "T",
-
cmd: "set-focused-tags",
-
args: [Num.to_str (named_tag_to_rtag Thunderbird)],
-
},
-
{
-
mode: "special-tags",
-
mods: [Shift, Control],
-
key: "T",
-
cmd: "set-view-tags",
-
args: [Num.to_str (named_tag_to_rtag Thunderbird)],
-
},
-
-
# Nautilus Tag
-
{
-
mode: "special-tags",
-
mods: [None],
-
key: "N",
-
cmd: "toggle-focused-tags",
-
args: [Num.to_str (named_tag_to_rtag Nautilus)],
-
},
-
{
-
mode: "special-tags",
-
mods: [Shift],
-
key: "N",
-
cmd: "toggle-view-tags",
-
args: [Num.to_str (named_tag_to_rtag Nautilus)],
-
},
-
{
-
mode: "special-tags",
-
mods: [Control],
-
key: "N",
-
cmd: "set-focused-tags",
-
args: [Num.to_str (named_tag_to_rtag Nautilus)],
-
},
-
{
-
mode: "special-tags",
-
mods: [Shift, Control],
-
key: "N",
-
cmd: "set-view-tags",
-
args: [Num.to_str (named_tag_to_rtag Nautilus)],
-
},
]
-
tag_to_rtag = |num|
-
Num.shift_left_by 1 (num - 1)
-
mod_str = |mod|
when mod is
Control -> "Control"
···
result =
Cmd.new "riverctl"
|> Cmd.args elem
-
|> Cmd.status!
+
|> Cmd.exec_exit_code!
when result is
Ok exit_code if exit_code == 0 -> Ok {}
···
main! = |_args|
autostart_cmds! =
-
autostart! {}
+
autostart
+
|> List.map |cmd|
+
["spawn", cmd]
+
+
autostart_apps_cmds =
+
autostart_apps
|> List.map |cmd|
["spawn", cmd]
···
keybind_cmds =
tag_binds
+
|> List.concat (special_tag_binds Discord "D")
+
|> List.concat (special_tag_binds Games "G")
+
|> List.concat (special_tag_binds KeePassXC "K")
+
|> List.concat (special_tag_binds Nautilus "N")
+
|> List.concat (special_tag_binds Signal "M")
+
|> List.concat (special_tag_binds Steam "S")
+
|> List.concat (special_tag_binds Thunderbird "T")
|> List.concat keybinds
|> List.map |{ mode, mods, key, cmd, args }|
["map", mode, Str.join_with (List.map mods mod_str) "+", key, cmd]
···
|> List.concat mode_cmds
|> List.concat pointer_bind_cmds
|> List.concat keybind_cmds
+
|> List.concat autostart_apps_cmds
|> riverctl_runner!