Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a system service for Gifski #80

Merged
merged 11 commits into from May 22, 2019

Conversation

@sunshinejr
Copy link
Collaborator

commented May 7, 2019

Resolves #47.

How to test it:

  1. Archive the app, move it to /Application folder
  2. In terminal make sure you have the service installed:
    a) /System/Library/CoreServices/pbs -dump | grep Gifski.app
    b) If you don’t see NSBundlePath = "/Applications/Gifski.app”;, try refreshing using /System/Library/CoreServices/pbs -update
  3. Go to settings -> keyboard -> shortcuts -> services and enable Gifski: Convert to GIF
Sneak peak

@sindresorhus sindresorhus changed the title System service Add a system service for Gifski May 11, 2019

@sindresorhus

This comment has been minimized.

Copy link
Owner

commented May 11, 2019

Should we also set NSServiceDescription? It's not really clear where it would be used. Do you know?

https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/SysServices/Articles/properties.html

@sindresorhus

This comment has been minimized.

Copy link
Owner

commented May 11, 2019

Can you document the feature in the readme and how to activate and use it? From experience, not everyone knows how Services work. And Apple has not done a very good job of making it obvious how to activate and use them.

@sindresorhus

This comment has been minimized.

Copy link
Owner

commented May 11, 2019

Could you add a maintaining.md file and add the above steps for testing the service?

Gifski/Info.plist Outdated Show resolved Hide resolved
Gifski/Info.plist Outdated Show resolved Hide resolved
@sunshinejr

This comment has been minimized.

Copy link
Collaborator Author

commented May 14, 2019

@sindresorhus updated the PR with code changes and initial drafts of readme/maintaining docs. Let me know how it looks now!

Also, I didn't use NSServiceDescription and also don't quite understand where would it be seen. When I used the pbs dump command I didn't see any service using this property as well.

@sunshinejr

This comment has been minimized.

Copy link
Collaborator Author

commented May 14, 2019

Also, for some reason when I used the service today (without any code changes) the app would freeze both itself and my Finder 🤔 Wonder what happened.

@sindresorhus

This comment has been minimized.

Copy link
Owner

commented May 14, 2019

the app would freeze both itself and my Finder 🤔 Wonder what happened.

I experienced that too. I thought it was just me doing something wrong.

@kornelski

This comment has been minimized.

Copy link
Collaborator

commented May 14, 2019

If it's freezing Finder, it may be because the conversion is blocking? The callback should return ASAP and just schedule conversion for later.

@sunshinejr

This comment has been minimized.

Copy link
Collaborator Author

commented May 18, 2019

@kornelski that's a good idea. Although it was working before and, from what I understand, the system service is opening the app for us and then we can do whatever we want in that function as the app is opened.

I did clean everything, restarted the computer (as I thought that the manual Finder opening with debug flag could cause this) and for some reason when I built and moved the app again to /Applications folder, when tapped on "Convert to GIF with Gifski" it opened the version of the app that I didn't even archive before, lol (I'm pretty sure about that because it opened a version of the app with the alert as I was testing #84 for a few minutes yesterday).

So I've removed the app from /Applications, removed all previous archives, cleaned the project, did flush the pbs (/System/Library/CoreServices/pbs -flush) and tried the steps that I did before (basically what is in the maintaining.md) and boom - it worked. Not sure which step helped, though. Really weird.

@sindresorhus did it work for you even once and then stopped, or was it broken all the time?

sindresorhus added some commits May 21, 2019

readme.md Outdated

Gifski provides a [system service](https://www.computerworld.com/article/2476298/os-x-a-quick-guide-to-services-on-your-mac.html) that lets you quickly convert a video to GIF from anywhere.

You first have to enable it:

This comment has been minimized.

Copy link
@sindresorhus

sindresorhus May 21, 2019

Owner

Are you sure the user has to enable it manually? From experience, most services are auto-enabled when I install new apps.

This seems to confirm it: https://stackoverflow.com/questions/3859747/how-do-i-automatically-activate-an-item-in-the-os-x-services-menu

This comment has been minimized.

Copy link
@sunshinejr

sunshinejr May 21, 2019

Author Collaborator

Not totally sure, I had it unchecked 100% though. We may indicate in docs that we should make sure it's enabled in the settings.

This comment has been minimized.

Copy link
@sindresorhus

sindresorhus May 22, 2019

Owner

I have manually verified that services are enabled by default.

@sindresorhus

This comment has been minimized.

Copy link
Owner

commented May 21, 2019

So I've removed the app from /Applications, removed all previous archives, cleaned the project, did flush the pbs (/System/Library/CoreServices/pbs -flush) and tried the steps that I did before (basically what is in the maintaining.md) and boom - it worked. Not sure which step helped, though. Really weird.

Same. It's working now for me too. So was definitely something weird going on with different builds.

@sindresorhus

This comment has been minimized.

Copy link
Owner

commented May 22, 2019

Also, I didn't use NSServiceDescription and also don't quite understand where would it be seen.

I discovered where it's used now. If you hover over a service in the Services preferences for a couple of settings, the description will be shown in a tooltip.

Screen Shot 2019-05-22 at 12 58 10

sindresorhus added some commits May 22, 2019

@sindresorhus sindresorhus merged commit 2df8421 into sindresorhus:master May 22, 2019

@sunshinejr sunshinejr deleted the sunshinejr:feature/service_provider branch May 22, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.