<commit_before>require 'utils'

Action = {}
Action.__index = Action

function Action.Close()
  return function(win) if win then win:close() end end
end

function Action.Maximize()
  return function(win) if win then win:maximize() end end
end

function Action.FullScreen()
  return function(Win) if win then win:setFullScreen(true) end end
end

function Action.Snap()
  return function(win) if win and not utils.isFullScreen(win) then hs.grid.snap(win) end end
end

function Action.MoveToScreen(screenIndex)
  return function(win) if win then utils.pushToScreen(win, hs.screen.allScreens()[screenIndex]) end end
end

function Action.MoveToNextScreen()
  return function(win) if win then utils.pushToScreen(win, win:screen():next()) end end
end

function Action.MoveToPreviousScreen()
  return function(win) if win then utils.pushToScreen(win, win:screen():previous()) end end
end

function Action.MoveToUnit(x, y, w, h)
  return function(win)
    if win and not utils.isFullScreen(win) then
      win:moveToUnit({x = x, y = y, w = w, h = h}):ensureIsInScreenBounds()
    end
  end
end

----------------------------------------------------------------------------------------------------

return Action<commit_msg>the caller is responsible for providing a valid window for an action<commit_after>require 'utils'

Action = {}
Action.__index = Action

function Action.Close()
  return function(win) win:close() end
end

function Action.Maximize()
  return function(win) win:maximize() end
end

function Action.FullScreen()
  return function(win) win:setFullScreen(true) end
end

function Action.Snap()
  return function(win) if not utils.isFullScreen(win) then hs.grid.snap(win) end end
end

function Action.MoveToScreen(screenIndex)
  return function(win) utils.pushToScreen(win, hs.screen.allScreens()[screenIndex]) end
end

function Action.MoveToNextScreen()
  return function(win) utils.pushToScreen(win, win:screen():next()) end
end

function Action.MoveToPreviousScreen()
  return function(win) utils.pushToScreen(win, win:screen():previous()) end
end

function Action.MoveToUnit(x, y, w, h)
  return function(win)
    if not utils.isFullScreen(win) then
      win:moveToUnit({x = x, y = y, w = w, h = h}):ensureIsInScreenBounds()
    end
  end
end

----------------------------------------------------------------------------------------------------

return Action
{'fraction_non_alphanumeric': 0.18335445711871567, 'fraction_numerical': 0.0, 'mean_word_length': 3.321167883211679, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '317447', 'n_tokens_mistral': 696, 'n_tokens_neox': 697, 'n_words': 210}