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

create WiFiTransitions.lua #1

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

muescha
Copy link
Owner

@muescha muescha commented Jul 1, 2023

No description provided.

@muescha
Copy link
Owner Author

muescha commented Jul 1, 2023

you can do your action as

function myCommand()
	hs.notify.show("Left Home Wifi", "Volume set to 0%", "")
	hs.audiodevice.defaultOutputDevice():setVolume(0)

	local appName = 'VLC'
	hs.application.find(appName):kill()
end

and use it:

                actions = {
                    {
                        from = "Wifi1",
                        fn = function(_, _, prev_ssid, new_ssid)
                            myCommand()
                        end
                    },

@Excess-Code
Copy link

Excess-Code commented Jul 17, 2023

Thanks for all the help.
Perhaps I am dense but I keep getting this error when loading the init file.

WifiTransitions.lua':
	[sic....]/hammerspoon/WifiTransitions.lua:19: unexpected symbol near <eof>
stack traceback:
	[C]: in ?
	[C]: in function 'rawrequire'
	...poon.app/Contents/Resources/extensions/hs/_coresetup.lua:662: in function 'require'
	[sic....]/.hammerspoon/init.lua:4: in main chunk
	[C]: in function 'xpcall'
	...poon.app/Contents/Resources/extensions/hs/_coresetup.lua:723: in function 'hs._coresetup.setup'
	(...tail calls...)

.....
>init.lua
require('WifiTransitions')

>WifiTransitions.lua
-- https://github.com/muescha/dot_hammerspoon/pull/1

function myCommand()
	hs.notify.show("Left Home Wifi", "Volume set to 0%", "")
	hs.audiodevice.defaultOutputDevice():setVolume(0)

	local appName = 'VLC'
	hs.application.find(appName):kill()
end


actions = {
    {
        from = "Wifi1",
        fn = function(_, _, prev_ssid, new_ssid)
            myCommand()
        end
    },

@muescha
Copy link
Owner Author

muescha commented Jul 17, 2023

did you installed the spoon install script like described in the comments?
I guess this is not installed

other idea:

unexpected symbol near means that there is some missing code there

@muescha
Copy link
Owner Author

muescha commented Jul 17, 2023

what is in your line 19 of WifiTransitions.lua?

is it possible that you post your full code snippets and full error message?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants