69 lines
859 B
Ruby
Executable File
69 lines
859 B
Ruby
Executable File
#!/usr/bin/env ruby
|
|
|
|
# Require X-kutu library for all x11 functions
|
|
|
|
require_relative "./src/X-kutu"
|
|
|
|
|
|
# Initialize X
|
|
|
|
if X.deploy >= 0
|
|
puts "Started kutu WM for X11 successfully! :)"
|
|
else
|
|
raise "Failed to deploy X"
|
|
end
|
|
|
|
|
|
# Require modules
|
|
|
|
require_relative "./src/utils"
|
|
require_relative "./src/node"
|
|
require_relative "./src/workspace"
|
|
require_relative "./src/events"
|
|
|
|
|
|
# Cleanup on exit
|
|
|
|
at_exit do
|
|
X.cleanup
|
|
puts "Exited kutu WM, sadly :("
|
|
end
|
|
|
|
|
|
# Globals
|
|
|
|
$monitors = {}
|
|
$workspaces = {}
|
|
$windows = {}
|
|
|
|
$keybind_actions = {}
|
|
$mousebind_actions = {}
|
|
|
|
$mouse_data = {}
|
|
|
|
$root = X.get_root
|
|
$rect = {}
|
|
|
|
|
|
# Initialize monitors
|
|
|
|
refresh_monitors!
|
|
|
|
|
|
# Add keybinds
|
|
|
|
load File.join(__dir__, "/src/bindings.rb")
|
|
|
|
|
|
# Initialize workspaces
|
|
|
|
$workspaces[:main] = Workspace.new(:main)
|
|
|
|
|
|
# Main loop
|
|
|
|
loop do
|
|
event = X.wait_for_event
|
|
handle_event event
|
|
end
|