F1: 移动当前窗口到左边SPACErequire 'totalspaces2'current_spaces = TotalSpaces2.current_spacewindows = TotalSpaces2.window_listif current_spaces > 1 dest_space = current_spaces - 1else dest_space = 4endif !windows.empty? current_space_windows = windows.select { |window| window[:space_number] == current_spaces }endif current_space_windows[0] win_pra = (current_space_windows[0][:frame].delete"\{\} ").split(',') xpos = win_pra[0].to_i ypos = win_pra[1].to_i off = (1920 - win_pra[0].to_i) 0.step(off,8){|n| TotalSpaces2.move_window( current_space_windows[0][:window_id],xpos-n,ypos) } TotalSpaces2.move_window_to_space( current_space_windows[0][:window_id],dest_space) if current_space_windows[1] TotalSpaces2.set_front_window(current_space_windows[1][:window_id]) end 2.times{TotalSpaces2.move_window( current_space_windows[0][:window_id],xpos, ypos) sleep 0.1}end F2: 移动当前窗口到右边SPACErequire 'totalspaces2'current_spaces = TotalSpaces2.current_spacewindows = TotalSpaces2.window_listif current_spaces dest_space = current_spaces + 1else dest_space = 1endif !windows.empty? current_space_windows = windows.select { |window| window[:space_number] == current_spaces }endif current_space_windows[0] win_pra = (current_space_windows[0][:frame].delete"\{\} ").split(',') xpos = win_pra[0].to_i ypos = win_pra[1].to_i off = (1920 - win_pra[0].to_i) 0.step(off,8){|n| TotalSpaces2.move_window( current_space_windows[0][:window_id],xpos+n,ypos) } TotalSpaces2.move_window_to_space( current_space_windows[0][:window_id],dest_space) if current_space_windows[1] TotalSpaces2.set_front_window(current_space_windows[1][:window_id]) end 2.times{TotalSpaces2.move_window( current_space_windows[0][:window_id],xpos, ypos) sleep 0.1}end F3: 移动非活动窗口到右边SPACE#!/usr/bin/rubyrequire 'totalspaces2'current_spaces = TotalSpaces2.current_spacewindowslist = TotalSpaces2.window_listif current_spaces dest_space = current_spaces + 1else dest_space = 1endif !windowslist.empty? current_space_windows = windowslist.select { |window| window[:space_number] == current_spaces }current_space_windows.each_with_index{ |list,index| if index > 0 win_pra = (list[:frame].delete"\{\} ").split(',') xpos = win_pra[0].to_i ypos = win_pra[1].to_i off = (1920 - win_pra[0].to_i) 0.step(off,10){|n| TotalSpaces2.move_window( list[:window_id],xpos+n,ypos) } TotalSpaces2.move_window_to_space( list[:window_id], dest_space) 2.times{TotalSpaces2.move_window( list[:window_id],xpos, ypos) sleep 0.1 } end }end 10-04 08:03