Jump to content

Wi-Fi toggle, Network Location, Fast User Switching, Finder Settings...


Recommended Posts

Posted (edited)

Hi,

 

Here are my first workflows, hope some of you might find them useful:

 

Fast User Switching

 

(I have linked to this one in here before)

 

Screenshot-Fast-User-Switching.png

 

https://github.com/aiyodk/Alfred-Extensions/raw/master/AlfredApp_2.x/Fast-User-Switching/Fast-User-Switching.alfredworkflow

 

 

Finder Settings

 

Change setting for: Hidden files, User Library and what to show on the Desktop.

More setting might be added later.

 

Screenshot-Finder.png

 

Screenshot-Desktop.png

 

https://github.com/aiyodk/Alfred-Extensions/raw/master/AlfredApp_2.x/Finder-Settings/Finder-Settings.alfredworkflow

 

 

Wi-Fi toggle

 

A rewrite of my Wi-Fi toggle extension for Alfred 1.x

 

Screenshot-Wi-Fi.png

 

https://github.com/aiyodk/Alfred-Extensions/raw/master/AlfredApp_2.x/Wi-Fi-Toggle/Wi-Fi-Toggle.alfredworkflow

 

 

Network Location

 

Also a rewrite...

 

Screenshot-Network-Location.png

 

https://github.com/aiyodk/Alfred-Extensions/raw/master/AlfredApp_2.x/Network-Location/Network-Location.alfredworkflow

 

 

And a nice little File Action, to uninstall apps with AppCleaner

 

https://github.com/aiyodk/Alfred-Extensions/raw/master/AlfredApp_2.x/AppCleaner/AppCleaner.alfredworkflow

Edited by Jonas Eriksen
Posted

You are absolutely right.

But I think they should be removed all together, as"valid" is only making a difference if

valid="no"

Thanks for pointing it out :)

Posted

Love the Finder settings one, i use show hidden icons all the time. But i also use TotalFinder, and when it relaunches the Finder it doesn't open with it. 

 

Is there a way you could add a line to the workflow so it opens totalfinder after restarting the finder? 

Posted

TotalFinder has a shortcut for showing/hiding hidden files (TotalFinder calls then system files) the default shortcut is: command + Shift + . 

 

I think this is the best option when using TotalFinder as it is a little slow at starting up.

  • 5 weeks later...
Posted

Is it possible to select a wifi network from the available networks ? currently, the Wifi Toggle workflow is showing the selected network and the IP address as shown in the screenshot of the workflow.

Posted

Is it possible to select a wifi network from the available networks ? currently, the Wifi Toggle workflow is showing the selected network and the IP address as shown in the screenshot of the workflow.

 

This is on the drawing board along with more details about the current network... stay tuned  :)

Posted

Nice workflows!!

I'm having problems with the Switch User workflow though.

I see it's looking for users in group 20 (staff) and therefore lists a number of active services (eg: Notification center, Calendar server, etc) if you're running Mac OS X Server.

It might be a good isea to exclude all com.apple.* “users” from the list  :)

 

 

          Corentin
Posted

Nice workflows!!

I'm having problems with the Switch User workflow though.

I see it's looking for users in group 20 (staff) and therefore lists a number of active services (eg: Notification center, Calendar server, etc) if you're running Mac OS X Server.

It might be a good isea to exclude all com.apple.* “users” from the list  :)

 

 

          Corentin

 

I have found another (hopefully better) way of listing user accounts. Give it a try and please report back if it does not work as intended.

 

https://github.com/aiyodk/Alfred-Extensions/raw/master/AlfredApp_2.x/Fast-User-Switching/Fast-User-Switching.alfredworkflow

 

( I have changed the workflow bundle id, so you have uninstall the old version of the workflow yourself )

 

Cheers,

Jonas

Posted

Here are two commands that might be able to help out here:

 

List all the available networks:

 

/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -s
 

 

 

Command to switch to a particular network in applescript:

 

do shell script "/usr/sbin/networksetup -switchtolocation 'NETWORKNAME' "
 
Posted

Here are two commands that might be able to help out here:

 

List all the available networks:

 

/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -s
 

 

 

Command to switch to a particular network in applescript:

 

do shell script "/usr/sbin/networksetup -switchtolocation 'NETWORKNAME' "
 

 

If you take a look at the workflow script you will see that I already use

/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport  :)

 

'networksetup -switchtolocation' Changes the Network Location, not the Wi-Fi network. You should see my Network Location Workflow for that functionality...

For changing the Wi-Fi network you should use 'networksetup -setairportnetwork' it requires a device name, network name and password.

 

There is some issues with implementing this, first there is a 3 seconds delay to scan for networks. Second there need to be a way for requesting a password for the network. I'm still looking into how this could be implemented best...

 

Cheers,

Jonas

Posted

I have found another (hopefully better) way of listing user accounts. Give it a try and please report back if it does not work as intended.

 

https://github.com/aiyodk/Alfred-Extensions/raw/master/AlfredApp_2.x/Fast-User-Switching/Fast-User-Switching.alfredworkflow

 

( I have changed the workflow bundle id, so you have uninstall the old version of the workflow yourself )

 

Cheers,

Jonas

 

 

This one works great. It only lists real users.

On 10.7 it looks as intended, but for some reason, on 10.8 it lists all users and  adds “(Logged in)” at the end (even though that's not the case — they're not logged in). e.g.:

RealName: Bob (Logged In)

 

Not super critical, but I thought it was worth mentioning,

 

 

          Corentin
Posted

This one works great. It only lists real users.

On 10.7 it looks as intended, but for some reason, on 10.8 it lists all users and  adds “(Logged in)” at the end (even though that's not the case — they're not logged in). e.g.:

RealName: Bob (Logged In)

 

Not super critical, but I thought it was worth mentioning,

 

 

          Corentin

 

Hmm this sounds weird, the workflow writes "(logged in)" on users who are listed by the "who" command. I made a small mistake so it will also match a username that is a subset of another username that is logged in... But otherwise it should reliable identify logged in users...

I will correct the mistake when I come home.

Posted

Hmm this sounds weird, the workflow writes "(logged in)" on users who are listed by the "who" command. I made a small mistake so it will also match a username that is a subset of another username that is logged in... But otherwise it should reliable identify logged in users...

I will correct the mistake when I come home.

Well I checked with who on my Mac and everything there is right, plus the other usernames appearing as logged-in are not subsets of the other ones.

I posted a capture (removing the usernames) here.

 

On the capture, only the first user is logged in.

This part of the script is not excluding entries that get 0 through who:

 

        # check if the user is logged in, if so then add (logged in) to the name

        if [[ $(who | grep -c "$USERNAME ") -gt 0 ]]

            then

            LOGINSTATUS=" (Logged In)"

        fi

 

 

It also looks like the syntax of the entries doesn't match the one on your first capture (e.g.: $RealName is not parsed as my real name):

 

        # fuzzymatch with real name and username 

        if [[ " $REALNAME" == *\ $QUERY* || $USERNAME == $QUERY* ]]

            then

            # if match is found display the user

            echo "<item uid=\"fastuserswitch $USERNAME\" arg=\"$USERNAME\">"

            echo "<title>$REALNAME$LOGINSTATUS</title><subtitle>Switch to $REALNAME</subtitle>"

            echo "<icon>$PICTURE</icon></item>"

        fi

 
 
Corentin
Posted

Well I checked with who on my Mac and everything there is right, plus the other usernames appearing as logged-in are not subsets of the other ones.

I posted a capture (removing the usernames) here.

 

On the capture, only the first user is logged in.

This part of the script is not excluding entries that get 0 through who:

 

        # check if the user is logged in, if so then add (logged in) to the name

        if [[ $(who | grep -c "$USERNAME ") -gt 0 ]]

            then

            LOGINSTATUS=" (Logged In)"

        fi

 

 

It also looks like the syntax of the entries doesn't match the one on your first capture (e.g.: $RealName is not parsed as my real name):

 

        # fuzzymatch with real name and username 

        if [[ " $REALNAME" == *\ $QUERY* || $USERNAME == $QUERY* ]]

            then

            # if match is found display the user

            echo "<item uid=\"fastuserswitch $USERNAME\" arg=\"$USERNAME\">"

            echo "<title>$REALNAME$LOGINSTATUS</title><subtitle>Switch to $REALNAME</subtitle>"

            echo "<icon>$PICTURE</icon></item>"

        fi

 
 
Corentin

 

I don't understand what is not working for you... You get the list of users on your system and the name of the users are correct?

But then you get "(logged in)" on all of them?

And when you type "who" into terminal.app you only see a list of the users who is logged in?

Posted

I have 4 user accounts on this Mac (with completely different names). The workflow lists them all, telling me they are all logged-in. who lists 2 (which reflects the reality).

In addition, instead of displaying something like "Switch to Bob", as on your capture, it says "Switch to RealName: Bob".

 

 

          Corentin
  • 3 weeks later...
Posted

Thanks for the updated workflows from 1.x!  I'm very much a coding noob and I liked how in the previous workflow from 1.x that all i had to do was type "wifi" and hit enter and it would just turn on or off the wifi connection.  Now I have extra clicks to enter the toggle and select on/off or the IPv4/6 selections.  Not a huge deal, but would love to know how I could change the script so it just turns on/off the wifi.  Thanks!

Posted

Thanks for the updated workflows from 1.x!  I'm very much a coding noob and I liked how in the previous workflow from 1.x that all i had to do was type "wifi" and hit enter and it would just turn on or off the wifi connection.  Now I have extra clicks to enter the toggle and select on/off or the IPv4/6 selections.  Not a huge deal, but would love to know how I could change the script so it just turns on/off the wifi.  Thanks!

 

Alfred will learn your preferred action after a few times, and at that point you just need to write "wifi" and hit enter, like with the 1.x extension.

 

Cheers,

Jonas

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...