Skip to content

Add Mac network location changer #18961

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

rfscouto
Copy link

@rfscouto rfscouto commented May 5, 2025

Description

Shortcut to list change the Network Location on Mac OS

Screencast

screenshot1
screenshot2

Checklist

@raycastbot raycastbot added the new extension Label for PRs with new extensions label May 5, 2025
@raycastbot
Copy link
Collaborator

Congratulations on your new Raycast extension! 🚀

You can expect an initial review within five business days.

Once the PR is approved and merged, the extension will be available on our Store.

@rfscouto rfscouto changed the title initial setup: mac network location changer Add Mac network location changer May 5, 2025
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

This PR introduces a new Raycast extension for managing macOS network locations, providing a user-friendly interface to switch between network configurations directly from Raycast.

  • CHANGELOG.md entries need to use {PR_MERGE_DATE} template string instead of hardcoded dates, and version 1.0.1 should be placed above 1.0.0
  • Screenshots should be moved from /screenshots to /metadata folder as per Raycast Documentation
  • Git clone URL in README.md should be updated to point to the Raycast extensions repository
  • Command name network-location in package.json should be more descriptive, like change-network-location to better reflect its action

💡 (1/5) You can manually trigger the bot by mentioning @greptileai in a comment!

8 file(s) reviewed, 8 comment(s)
Edit PR Review Bot Settings | Greptile

### Added
- Initial release: allow changing Mac network location directly from Raycast

## [1.0.1] - 2025-05-05
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Move this entry to the top since newer entries should be first in the changelog

Suggested change
## [1.0.1] - 2025-05-05
# macOS Network Location Changer Changelog
## [1.0.1] - 2025-05-05
### Added
- Updated documentation in preparation for publishing
## [1.0.0] - 2025-05-05
### Added
- Initial release: allow changing Mac network location directly from Raycast

@@ -0,0 +1,9 @@
# macOS Network Location Changer Changelog

## [1.0.0] - 2025-05-05
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

syntax: Replace 2025-05-05 with {PR_MERGE_DATE} to follow the changelog date template format

Suggested change
## [1.0.0] - 2025-05-05
## [1.0.0] - {PR_MERGE_DATE}

### Added
- Initial release: allow changing Mac network location directly from Raycast

## [1.0.1] - 2025-05-05
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

syntax: Replace 2025-05-05 with {PR_MERGE_DATE} to follow the changelog date template format

Suggested change
## [1.0.1] - 2025-05-05
## [1.0.1] - {PR_MERGE_DATE}

.DS_Store

.idea/
**.bkp
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: The .bkp pattern uses ** which is redundant here since it's already at the root. Could simplify to *.bkp

### Manual (Development)

```bash
git clone https://github.com/rfscouto/raycast-mac-network-location-changer.git
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: The git clone URL should point to the Raycast extensions repository, not a personal repository

Suggested change
git clone https://github.com/rfscouto/raycast-mac-network-location-changer.git
git clone https://github.com/raycast/extensions.git


| Overview | List of Locations/Switch Confirmation |
|----------------------------------------------------------|------------------------------------------------------------|
| ![List of Locations](screenshots/mac-network-location-changer-1.png) | ![Switch Confirmation](screenshots/mac-network-location-changer-2.png) |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Screenshots should be in a 'metadata' folder for store submissions, not 'screenshots'

Suggested change
| ![List of Locations](screenshots/mac-network-location-changer-1.png) | ![Switch Confirmation](screenshots/mac-network-location-changer-2.png) |
| ![List of Locations](metadata/mac-network-location-changer-1.png) | ![Switch Confirmation](metadata/mac-network-location-changer-2.png) |

Comment on lines +19 to +20
"subtitle": "Change network location",
"description": "Changes the network location",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Description and subtitle are very similar. Consider making the subtitle more specific about what the command does

Comment on lines +54 to +63
const switchLocation = (name: string) => {
exec(`${SCSELECT} "${name}"`, (error) => {
if (error) {
showToast({ style: Toast.Style.Failure, title: "Failed to switch location" });
} else {
showToast({ style: Toast.Style.Success, title: `Switched to ${name}` });
fetchLocations();
}
});
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: switchLocation should be wrapped in try-catch and use showFailureToast from @raycast/utils for error handling

Suggested change
const switchLocation = (name: string) => {
exec(`${SCSELECT} "${name}"`, (error) => {
if (error) {
showToast({ style: Toast.Style.Failure, title: "Failed to switch location" });
} else {
showToast({ style: Toast.Style.Success, title: `Switched to ${name}` });
fetchLocations();
}
});
};
const switchLocation = (name: string) => {
try {
exec(`${SCSELECT} "${name}"`, (error) => {
if (error) {
showFailureToast(error, { title: "Failed to switch location" });
} else {
showToast({ style: Toast.Style.Success, title: `Switched to ${name}` });
fetchLocations();
}
});
} catch (error) {
showFailureToast(error, { title: "Failed to switch location" });
}
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new extension Label for PRs with new extensions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants