<commit_before>--- === plugins.finder.preferences.powerchime ===
---
--- General Preferences Panel

local require       = require

local hs            = hs

local log		    = require("hs.logger").new("powerchime")

local battery       = require("hs.battery")

local i18n          = require("cp.i18n")
local tools         = require("cp.tools")

local execute       = hs.execute
local trim          = tools.trim

--------------------------------------------------------------------------------
--
-- THE PLUGIN:
--
--------------------------------------------------------------------------------
local plugin = {
    id              = "finder.preferences.powerchime",
    group           = "finder",
    dependencies    = {
        ["finder.preferences.panel"]    = "panel",
    }
}

-- powerChimeDisabled() -> boolean
-- Function
-- Is the power chime disabled?
--
-- Parameters:
--  * None
--
-- Returns:
--  * `true` if disabled otherwise `false`
function powerChimeDisabled()
    local o, s, t, r = execute("defaults read com.apple.PowerChime ChimeOnNoHardware")
    if o and s and t == "exit" and r == 0 then
        if trim(o) == "1" then
            return true
        end
    end
    return false
end

-- setPowerChime(disabled) -> none
-- Function
-- Enables or disables the power chime.
--
-- Parameters:
--  * value - `true` to disable otherwise `false`
--
-- Returns:
--  * None
function setPowerChime(disabled)
    execute("defaults write com.apple.PowerChime ChimeOnNoHardware -bool " .. tostring(disabled))
    execute("killall PowerChime")
end

function plugin.init(deps)

    deps.panel
        :addHeading(100, i18n("advanced"))<commit_msg>#1666<commit_after>--- === plugins.finder.preferences.powerchime ===
---
--- General Preferences Panel

local require       = require

local hs            = hs

--local log		    = require("hs.logger").new("powerchime")

local battery       = require("hs.battery")

local i18n          = require("cp.i18n")
local tools         = require("cp.tools")

local execute       = hs.execute
local trim          = tools.trim

--------------------------------------------------------------------------------
--
-- THE PLUGIN:
--
--------------------------------------------------------------------------------
local plugin = {
    id              = "finder.preferences.powerchime",
    group           = "finder",
    dependencies    = {
        ["finder.preferences.panel"]    = "panel",
    }
}

-- powerChimeDisabled() -> boolean
-- Function
-- Is the power chime disabled?
--
-- Parameters:
--  * None
--
-- Returns:
--  * `true` if disabled otherwise `false`
local function powerChimeDisabled()
    local o, s, t, r = execute("defaults read com.apple.PowerChime ChimeOnNoHardware")
    if o and s and t == "exit" and r == 0 then
        if trim(o) == "1" then
            return true
        end
    end
    return false
end

-- setPowerChime(disabled) -> none
-- Function
-- Enables or disables the power chime.
--
-- Parameters:
--  * value - `true` to disable otherwise `false`
--
-- Returns:
--  * None
local function setPowerChime(disabled)
    execute("defaults write com.apple.PowerChime ChimeOnNoHardware -bool " .. tostring(disabled))
    execute("killall PowerChime")
end

function plugin.init(deps)

    deps.panel
        :addHeading(100, i18n("advanced"))
{'fraction_non_alphanumeric': 0.22091621458710067, 'fraction_numerical': 0.007836045810729355, 'mean_word_length': 1.713818479149632, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2226607', 'n_tokens_mistral': 954, 'n_tokens_neox': 927, 'n_words': 247}