kcrawford / dockutil

command line tool for managing dock items
http://patternbuffer.wordpress.com
Apache License 2.0
1.36k stars 131 forks source link

FR: Ability to find spacers and move #161

Open afonsoc12 opened 6 months ago

afonsoc12 commented 6 months ago

Hi,

I would like to use dockutil spacers with ansible, but it doesn't seem to be possible to get the status of a spacer, nor "label" them.

dockutil --add '' --type spacer --section apps --after 'Activity Monitor' --label 'spacer1'
# None of these work
dockutil --find spacer1
dockutil --find ''

For idempotency purposes, first I check if the spacer exists, and if not, add it. The current workaround is to remove all spacers and re add them with each ansible playbook run.

For comparison, I'm doing the following for apps:

- name: Add all to dock
  shell: dockutil --find '{{ item.name }}' || dockutil --add '{{ item.path }}' --label '{{ item.name }}'
  register: dockutil_add
  changed_when: "'was found in' not in dockutil_add.stdout"
  with_items: "{{ dock_persistent_apps }}"

This would only add an app if --find fails, and mark as changed if "was not found in" exists in the output.

Additionally, following-up on #31 , it would also be great if there was a way to move spacers like we do for apps, as an alternative of using --after flag:

dockutil --move 'spacer4' --position 2 --section apps 

dockutil: v3.1.3

Thank you for your work!