Add remote commands support
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
def handle_command(command)
|
||||
reply = {}
|
||||
|
||||
command_parts = command.split(" ")
|
||||
command = command_parts[0]
|
||||
args = command_parts[1..-1]
|
||||
|
||||
case command
|
||||
when "get-ws"
|
||||
monitor = args[0] ? $monitors[args[0].to_sym] : current_monitor
|
||||
return reply if monitor.nil?
|
||||
reply[:workspace] = monitor[:selected_workspace]
|
||||
reply[:monitor] = $monitors.key(monitor)
|
||||
reply[:count] = monitor[:workspaces].length
|
||||
when "set-ws"
|
||||
monitor = args[1] ? $monitors[args[1].to_sym] : current_monitor
|
||||
return reply if monitor.nil?
|
||||
select_workspace args[0].to_i, monitor
|
||||
reply[:workspace] = monitor[:selected_workspace]
|
||||
reply[:monitor] = $monitors.key(monitor)
|
||||
reply[:count] = monitor[:workspaces].length
|
||||
when "topped"
|
||||
reply[:topped] = $topped_windows
|
||||
when "stop"
|
||||
exit 1
|
||||
end
|
||||
|
||||
reply
|
||||
end
|
||||
Reference in New Issue
Block a user