Make it work
This commit is contained in:
+144
-5
@@ -1,23 +1,162 @@
|
||||
keybind(23) do |_event|
|
||||
run "firefox"
|
||||
end
|
||||
|
||||
keybind(24) do |event|
|
||||
X.kill event[:window]
|
||||
end
|
||||
|
||||
keybind(25) do |_event|
|
||||
pid = spawn "kitty"
|
||||
Process.detach pid
|
||||
run "kitty"
|
||||
end
|
||||
|
||||
keybind(26) do |_event|
|
||||
$workspaces.each_value(&:close_all)
|
||||
# run "~/dotfiles/scripts/power.sh"
|
||||
exit 1
|
||||
end
|
||||
|
||||
keybind(38) do |_event|
|
||||
run "maim -c 0.3,0.5,1.0,0.8 -s | tee /tmp/screenshot_temp.png | xclip -selection clipboard -t image/png && if [ -s '/tmp/screenshot_temp.png' ]; then mv /tmp/screenshot_temp.png ~/screenshots/$(date +%Y-%m-%d_%H:%M:%S).png; fi"
|
||||
end
|
||||
|
||||
keybind(54) do |_event|
|
||||
run "kitty -e fish -c \"y\""
|
||||
end
|
||||
|
||||
keybind(53) do |_event|
|
||||
run "kitty -e fish -c \"editor\""
|
||||
end
|
||||
|
||||
keybind(40) do |_event|
|
||||
run "~/dotfiles/scripts/run.sh"
|
||||
end
|
||||
|
||||
keybind(33) do |_event|
|
||||
run "~/.config/polybar/launch.sh"
|
||||
end
|
||||
|
||||
keybind(56) do |_event|
|
||||
monitor = current_monitor
|
||||
create_workspace monitor
|
||||
persistence_path = File.join(__dir__, ".num.json")
|
||||
persistence = File.exist?(persistence_path) ?
|
||||
JSON.parse(File.read(persistence_path), symbolize_names: true) :
|
||||
{}
|
||||
persistence[$monitors.key(monitor)] = monitor[:workspaces].length
|
||||
File.write(persistence_path, JSON.pretty_generate(persistence))
|
||||
end
|
||||
|
||||
keybind(57) do |_event|
|
||||
monitor = current_monitor
|
||||
delete_workspace monitor[:workspaces].length - 1, monitor
|
||||
persistence_path = File.join(__dir__, ".num.json")
|
||||
persistence = File.exist?(persistence_path) ?
|
||||
JSON.parse(File.read(persistence_path), symbolize_names: true) :
|
||||
{}
|
||||
persistence[$monitors.key(monitor)] = monitor[:workspaces].length
|
||||
File.write(persistence_path, JSON.pretty_generate(persistence))
|
||||
end
|
||||
|
||||
keybind(112, 0) do |_event|
|
||||
monitor = current_monitor
|
||||
next_ws = (monitor[:selected_workspace] + 1) % monitor[:workspaces].length
|
||||
select_workspace next_ws, monitor
|
||||
end
|
||||
|
||||
keybind(112) do |_event|
|
||||
monitor = current_monitor
|
||||
pointer = X.get_pointer
|
||||
|
||||
window = monitor[:workspaces][monitor[:selected_workspace]].windows.find do |w|
|
||||
pointer[:x] >= w.x &&
|
||||
pointer[:x] < w.x + w.width &&
|
||||
pointer[:y] >= w.y &&
|
||||
pointer[:y] < w.y + w.height
|
||||
end
|
||||
|
||||
next_ws = (monitor[:selected_workspace] + 1) % monitor[:workspaces].length
|
||||
monitor[:workspaces][next_ws].drop monitor[:workspaces][next_ws].tiled_windows.length, window if window
|
||||
end
|
||||
|
||||
keybind(117, 0) do |_event|
|
||||
monitor = current_monitor
|
||||
next_ws = (monitor[:selected_workspace] - 1) % monitor[:workspaces].length
|
||||
select_workspace next_ws, monitor
|
||||
end
|
||||
|
||||
keybind(117) do |_event|
|
||||
monitor = current_monitor
|
||||
pointer = X.get_pointer
|
||||
|
||||
window = monitor[:workspaces][monitor[:selected_workspace]].windows.find do |w|
|
||||
pointer[:x] >= w.x &&
|
||||
pointer[:x] < w.x + w.width &&
|
||||
pointer[:y] >= w.y &&
|
||||
pointer[:y] < w.y + w.height
|
||||
end
|
||||
|
||||
next_ws = (monitor[:selected_workspace] - 1) % monitor[:workspaces].length
|
||||
monitor[:workspaces][next_ws].drop monitor[:workspaces][next_ws].tiled_windows.length, window if window
|
||||
end
|
||||
|
||||
keybind(27) do |_event|
|
||||
monitor = current_monitor
|
||||
return unless monitor
|
||||
monitor[:workspaces][monitor[:selected_workspace]].switch_direction
|
||||
end
|
||||
|
||||
keybind(55) do |_event|
|
||||
pid = spawn "rofi -modi 'clipboard:greenclip print' -show clipboard -run-command '{cmd}'"
|
||||
Process.detach pid
|
||||
run "rofi -modi 'clipboard:greenclip print' -show clipboard -run-command '{cmd}'"
|
||||
end
|
||||
|
||||
keybind(39) do |event|
|
||||
window = $windows[event[:window]]
|
||||
window.toggle_floating if window
|
||||
end
|
||||
|
||||
|
||||
mousebind 1
|
||||
|
||||
mousebind 3
|
||||
|
||||
mousebind(8, 0) do |_event|
|
||||
monitor = current_monitor
|
||||
next_ws = (monitor[:selected_workspace] + 1) % monitor[:workspaces].length
|
||||
select_workspace next_ws, monitor
|
||||
end
|
||||
|
||||
mousebind 8 do |_event|
|
||||
monitor = current_monitor
|
||||
pointer = X.get_pointer
|
||||
|
||||
window = monitor[:workspaces][monitor[:selected_workspace]].windows.find do |w|
|
||||
pointer[:x] >= w.x &&
|
||||
pointer[:x] < w.x + w.width &&
|
||||
pointer[:y] >= w.y &&
|
||||
pointer[:y] < w.y + w.height
|
||||
end
|
||||
|
||||
next_ws = (monitor[:selected_workspace] + 1) % monitor[:workspaces].length
|
||||
monitor[:workspaces][next_ws].drop monitor[:workspaces][next_ws].tiled_windows.length, window if window
|
||||
end
|
||||
|
||||
mousebind(9, 0) do |_event|
|
||||
monitor = current_monitor
|
||||
next_ws = (monitor[:selected_workspace] - 1) % monitor[:workspaces].length
|
||||
select_workspace next_ws, monitor
|
||||
end
|
||||
|
||||
mousebind 9 do |_event|
|
||||
monitor = current_monitor
|
||||
pointer = X.get_pointer
|
||||
|
||||
window = monitor[:workspaces][monitor[:selected_workspace]].windows.find do |w|
|
||||
pointer[:x] >= w.x &&
|
||||
pointer[:x] < w.x + w.width &&
|
||||
pointer[:y] >= w.y &&
|
||||
pointer[:y] < w.y + w.height
|
||||
end
|
||||
|
||||
next_ws = (monitor[:selected_workspace] - 1) % monitor[:workspaces].length
|
||||
monitor[:workspaces][next_ws].drop monitor[:workspaces][next_ws].tiled_windows.length, window if window
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user