danielpclark / clock_window

Clock your own desktop activity! Open for feature requests and contributors!
MIT License
6 stars 2 forks source link

Mac ocascript can likely be modified for correct string output #9

Closed danielpclark closed 8 years ago

danielpclark commented 8 years ago

The last line of the ocascript return {frontAppName, windowTitle} can likely be changed to return the desired text we want. If we swap the two variables they'll be in the right order. It would be nice if the ocascript would also join the two variables into a string joined with a dash " - "

lib/clock_window/oscommand.rb#L45

Once this is done we can change

format = Filters.new(
  substitutions: [ [Regexp.new(/([^,]*)[, ]{1,3}(.*)/), '\2 - \1'] ].
    add_if(@filter_opts.has_key? :substitutions){@filter_opts.delete(:substitutions)},
  **@filter_opts
)

to simply

format = Filters.new(**@filter_opts)

at lines lib/clock_window/oscommand.rb#L49-L53

Once this is done the test's will need to be rewritten for the Mac. They'll basically be format.call(x) == x once formatting is no longer needed.

danielpclark commented 8 years ago

Just need to update the tests for this.

danielpclark commented 8 years ago

Done! https://github.com/danielpclark/clock_window/commit/45ceac1dcbd8b6b4eb722f6dc3296a0625763c38