summaryrefslogtreecommitdiffstats
path: root/hammerspoon/Spoons
diff options
context:
space:
mode:
Diffstat (limited to 'hammerspoon/Spoons')
-rw-r--r--hammerspoon/Spoons/ReloadConfiguration.spoon/docs.json90
-rw-r--r--hammerspoon/Spoons/ReloadConfiguration.spoon/init.lua49
-rw-r--r--hammerspoon/Spoons/SpeedMenu.spoon/docs.json39
-rw-r--r--hammerspoon/Spoons/SpeedMenu.spoon/init.lua111
4 files changed, 0 insertions, 289 deletions
diff --git a/hammerspoon/Spoons/ReloadConfiguration.spoon/docs.json b/hammerspoon/Spoons/ReloadConfiguration.spoon/docs.json
deleted file mode 100644
index 50c62f2..0000000
--- a/hammerspoon/Spoons/ReloadConfiguration.spoon/docs.json
+++ /dev/null
@@ -1,90 +0,0 @@
-[
- {
- "Command": [],
- "Constant": [],
- "Constructor": [],
- "Deprecated": [],
- "Field": [],
- "Function": [],
- "Method": [
- {
- "def": "ReloadConfiguration:bindHotkeys(mapping)",
- "desc": "Binds hotkeys for ReloadConfiguration",
- "doc": "Binds hotkeys for ReloadConfiguration\n\nParameters:\n * mapping - A table containing hotkey modifier/key details for the following items:\n * reloadConfiguration - This will cause the configuration to be reloaded",
- "name": "bindHotkeys",
- "parameters": [
- " * mapping - A table containing hotkey modifier/key details for the following items:",
- " * reloadConfiguration - This will cause the configuration to be reloaded"
- ],
- "signature": "ReloadConfiguration:bindHotkeys(mapping)",
- "stripped_doc": "",
- "type": "Method"
- },
- {
- "def": "ReloadConfiguration:start()",
- "desc": "Start ReloadConfiguration",
- "doc": "Start ReloadConfiguration\n\nParameters:\n * None",
- "name": "start",
- "parameters": [
- " * None"
- ],
- "signature": "ReloadConfiguration:start()",
- "stripped_doc": "",
- "type": "Method"
- }
- ],
- "Variable": [
- {
- "def": "ReloadConfiguration.watch_paths",
- "desc": "List of directories to watch for changes, defaults to hs.configdir",
- "doc": "List of directories to watch for changes, defaults to hs.configdir",
- "name": "watch_paths",
- "signature": "ReloadConfiguration.watch_paths",
- "stripped_doc": "",
- "type": "Variable"
- }
- ],
- "desc": "Adds a hotkey to reload the hammerspoon configuration, and a pathwatcher to automatically reload on changes.",
- "doc": "Adds a hotkey to reload the hammerspoon configuration, and a pathwatcher to automatically reload on changes.\n\nDownload: [https://github.com/Hammerspoon/Spoons/raw/master/Spoons/ReloadConfiguration.spoon.zip](https://github.com/Hammerspoon/Spoons/raw/master/Spoons/ReloadConfiguration.spoon.zip)",
- "items": [
- {
- "def": "ReloadConfiguration:bindHotkeys(mapping)",
- "desc": "Binds hotkeys for ReloadConfiguration",
- "doc": "Binds hotkeys for ReloadConfiguration\n\nParameters:\n * mapping - A table containing hotkey modifier/key details for the following items:\n * reloadConfiguration - This will cause the configuration to be reloaded",
- "name": "bindHotkeys",
- "parameters": [
- " * mapping - A table containing hotkey modifier/key details for the following items:",
- " * reloadConfiguration - This will cause the configuration to be reloaded"
- ],
- "signature": "ReloadConfiguration:bindHotkeys(mapping)",
- "stripped_doc": "",
- "type": "Method"
- },
- {
- "def": "ReloadConfiguration:start()",
- "desc": "Start ReloadConfiguration",
- "doc": "Start ReloadConfiguration\n\nParameters:\n * None",
- "name": "start",
- "parameters": [
- " * None"
- ],
- "signature": "ReloadConfiguration:start()",
- "stripped_doc": "",
- "type": "Method"
- },
- {
- "def": "ReloadConfiguration.watch_paths",
- "desc": "List of directories to watch for changes, defaults to hs.configdir",
- "doc": "List of directories to watch for changes, defaults to hs.configdir",
- "name": "watch_paths",
- "signature": "ReloadConfiguration.watch_paths",
- "stripped_doc": "",
- "type": "Variable"
- }
- ],
- "name": "ReloadConfiguration",
- "stripped_doc": "\nDownload: [https://github.com/Hammerspoon/Spoons/raw/master/Spoons/ReloadConfiguration.spoon.zip](https://github.com/Hammerspoon/Spoons/raw/master/Spoons/ReloadConfiguration.spoon.zip)",
- "submodules": [],
- "type": "Module"
- }
-] \ No newline at end of file
diff --git a/hammerspoon/Spoons/ReloadConfiguration.spoon/init.lua b/hammerspoon/Spoons/ReloadConfiguration.spoon/init.lua
deleted file mode 100644
index bb83f67..0000000
--- a/hammerspoon/Spoons/ReloadConfiguration.spoon/init.lua
+++ /dev/null
@@ -1,49 +0,0 @@
---- === ReloadConfiguration ===
----
---- Adds a hotkey to reload the hammerspoon configuration, and a pathwatcher to automatically reload on changes.
----
---- Download: [https://github.com/Hammerspoon/Spoons/raw/master/Spoons/ReloadConfiguration.spoon.zip](https://github.com/Hammerspoon/Spoons/raw/master/Spoons/ReloadConfiguration.spoon.zip)
-
-local obj = {}
-obj.__index = obj
-
--- Metadata
-obj.name = "ReloadConfiguration"
-obj.version = "1.0"
-obj.author = "Jon Lorusso <jonlorusso@gmail.com>"
-obj.homepage = "https://github.com/Hammerspoon/Spoons"
-obj.license = "MIT - https://opensource.org/licenses/MIT"
-
-
---- ReloadConfiguration.watch_paths
---- Variable
---- List of directories to watch for changes, defaults to hs.configdir
-obj.watch_paths = { hs.configdir }
-
---- ReloadConfiguration:bindHotkeys(mapping)
---- Method
---- Binds hotkeys for ReloadConfiguration
----
---- Parameters:
---- * mapping - A table containing hotkey modifier/key details for the following items:
---- * reloadConfiguration - This will cause the configuration to be reloaded
-function obj:bindHotkeys(mapping)
- local def = { reloadConfiguration = hs.fnutils.partial(hs.reload, self) }
- hs.spoons.bindHotkeysToSpec(def, mapping)
-end
-
---- ReloadConfiguration:start()
---- Method
---- Start ReloadConfiguration
----
---- Parameters:
---- * None
-function obj:start()
- self.watchers = {}
- for _,dir in pairs(self.watch_paths) do
- self.watchers[dir] = hs.pathwatcher.new(dir, hs.reload):start()
- end
- return self
-end
-
-return obj
diff --git a/hammerspoon/Spoons/SpeedMenu.spoon/docs.json b/hammerspoon/Spoons/SpeedMenu.spoon/docs.json
deleted file mode 100644
index f57b965..0000000
--- a/hammerspoon/Spoons/SpeedMenu.spoon/docs.json
+++ /dev/null
@@ -1,39 +0,0 @@
-[
- {
- "Command": [],
- "Constant": [],
- "Constructor": [],
- "Deprecated": [],
- "Field": [],
- "Function": [],
- "Method": [
- {
- "def": "SpeedMenu:rescan()",
- "desc": "Redetect the active interface, darkmode …And redraw everything.",
- "doc": "Redetect the active interface, darkmode …And redraw everything.\n",
- "name": "rescan",
- "signature": "SpeedMenu:rescan()",
- "stripped_doc": "",
- "type": "Method"
- }
- ],
- "Variable": [],
- "desc": "Menubar netspeed meter",
- "doc": "Menubar netspeed meter\n\nDownload: [https://github.com/Hammerspoon/Spoons/raw/master/Spoons/SpeedMenu.spoon.zip](https://github.com/Hammerspoon/Spoons/raw/master/Spoons/SpeedMenu.spoon.zip)",
- "items": [
- {
- "def": "SpeedMenu:rescan()",
- "desc": "Redetect the active interface, darkmode …And redraw everything.",
- "doc": "Redetect the active interface, darkmode …And redraw everything.\n",
- "name": "rescan",
- "signature": "SpeedMenu:rescan()",
- "stripped_doc": "",
- "type": "Method"
- }
- ],
- "name": "SpeedMenu",
- "stripped_doc": "\nDownload: [https://github.com/Hammerspoon/Spoons/raw/master/Spoons/SpeedMenu.spoon.zip](https://github.com/Hammerspoon/Spoons/raw/master/Spoons/SpeedMenu.spoon.zip)",
- "submodules": [],
- "type": "Module"
- }
-] \ No newline at end of file
diff --git a/hammerspoon/Spoons/SpeedMenu.spoon/init.lua b/hammerspoon/Spoons/SpeedMenu.spoon/init.lua
deleted file mode 100644
index d4ecdac..0000000
--- a/hammerspoon/Spoons/SpeedMenu.spoon/init.lua
+++ /dev/null
@@ -1,111 +0,0 @@
---- === SpeedMenu ===
----
---- Menubar netspeed meter
----
---- Download: [https://github.com/Hammerspoon/Spoons/raw/master/Spoons/SpeedMenu.spoon.zip](https://github.com/Hammerspoon/Spoons/raw/master/Spoons/SpeedMenu.spoon.zip)
-
-local obj={}
-obj.__index = obj
-
--- Metadata
-obj.name = "SpeedMenu"
-obj.version = "1.0"
-obj.author = "ashfinal <ashfinal@gmail.com>"
-obj.homepage = "https://github.com/Hammerspoon/Spoons"
-obj.license = "MIT - https://opensource.org/licenses/MIT"
-
-function obj:init()
- self.menubar = hs.menubar.new()
- obj:rescan()
-end
-
-local function data_diff()
- local in_seq = hs.execute(obj.instr)
- local out_seq = hs.execute(obj.outstr)
- local in_diff = in_seq - obj.inseq
- local out_diff = out_seq - obj.outseq
- if in_diff/1024 > 1024 then
- obj.kbin = string.format("%6.2f", in_diff/1024/1024) .. ' mb/s'
- else
- obj.kbin = string.format("%6.2f", in_diff/1024) .. ' kb/s'
- end
- if out_diff/1024 > 1024 then
- obj.kbout = string.format("%6.2f", out_diff/1024/1024) .. ' mb/s'
- else
- obj.kbout = string.format("%6.2f", out_diff/1024) .. ' kb/s'
- end
- local disp_str = '⥄ ' .. obj.kbout .. '\n⥂ ' .. obj.kbin
- if obj.darkmode then
- obj.disp_str = hs.styledtext.new(disp_str, {font={size=9.0, color={hex="#FFFFFF"}}})
- else
- obj.disp_str = hs.styledtext.new(disp_str, {font={size=9.0, color={hex="#000000"}}})
- end
- obj.menubar:setTitle(obj.disp_str)
- obj.inseq = in_seq
- obj.outseq = out_seq
-end
-
---- SpeedMenu:rescan()
---- Method
---- Redetect the active interface, darkmode …And redraw everything.
----
-
-function obj:rescan()
- obj.interface = hs.network.primaryInterfaces()
- obj.darkmode = hs.osascript.applescript('tell application "System Events"\nreturn dark mode of appearance preferences\nend tell')
- local menuitems_table = {}
- if obj.interface then
- -- Inspect active interface and create menuitems
- local interface_detail = hs.network.interfaceDetails(obj.interface)
- if interface_detail.AirPort then
- local ssid = interface_detail.AirPort.SSID
- table.insert(menuitems_table, {
- title = "SSID: " .. ssid,
- tooltip = "Copy SSID to clipboard",
- fn = function() hs.pasteboard.setContents(ssid) end
- })
- end
- if interface_detail.IPv4 then
- local ipv4 = interface_detail.IPv4.Addresses[1]
- table.insert(menuitems_table, {
- title = "IPv4: " .. ipv4,
- tooltip = "Copy IPv4 to clipboard",
- fn = function() hs.pasteboard.setContents(ipv4) end
- })
- end
- if interface_detail.IPv6 then
- local ipv6 = interface_detail.IPv6.Addresses[1]
- table.insert(menuitems_table, {
- title = "IPv6: " .. ipv6,
- tooltip = "Copy IPv6 to clipboard",
- fn = function() hs.pasteboard.setContents(ipv6) end
- })
- end
- local macaddr = hs.execute('ifconfig ' .. obj.interface .. ' | grep ether | awk \'{print $2}\'')
- table.insert(menuitems_table, {
- title = "MAC Addr: " .. macaddr,
- tooltip = "Copy MAC Address to clipboard",
- fn = function() hs.pasteboard.setContents(macaddr) end
- })
- -- Start watching the netspeed delta
- obj.instr = 'netstat -ibn | grep -e ' .. obj.interface .. ' -m 1 | awk \'{print $7}\''
- obj.outstr = 'netstat -ibn | grep -e ' .. obj.interface .. ' -m 1 | awk \'{print $10}\''
-
- obj.inseq = hs.execute(obj.instr)
- obj.outseq = hs.execute(obj.outstr)
-
- if obj.timer then
- obj.timer:stop()
- obj.timer = nil
- end
- obj.timer = hs.timer.doEvery(1, data_diff)
- end
- table.insert(menuitems_table, {
- title = "Rescan Network Interfaces",
- fn = function() obj:rescan() end
- })
- obj.menubar:setTitle("⚠︎")
- obj.menubar:setMenu(menuitems_table)
-end
-
-return obj