+
+--]]
+
+local helpers = require("lain.helpers")
+local shell = require("awful.util").shell
+local escape_f = require("awful.util").escape
+local focused = require("awful.screen").focused
+local naughty = require("naughty")
+local wibox = require("wibox")
+local os = os
+local string = string
+
+-- MPD infos
+-- lain.widget.mpd
+
+local function factory(args)
+ local mpd = { widget = wibox.widget.textbox() }
+ local args = args or {}
+ local timeout = args.timeout or 2
+ local password = (args.password and #args.password > 0 and string.format("password %s\\n", args.password)) or ""
+ local host = args.host or os.getenv("MPD_HOST") or "127.0.0.1"
+ local port = args.port or os.getenv("MPD_PORT") or "6600"
+ local music_dir = args.music_dir or os.getenv("HOME") .. "/Music"
+ local cover_pattern = args.cover_pattern or "*\\.(jpg|jpeg|png|gif)$"
+ local cover_size = args.cover_size or 100
+ local default_art = args.default_art
+ local notify = args.notify or "on"
+ local followtag = args.followtag or false
+ local settings = args.settings or function() end
+
+ local mpdh = string.format("telnet://%s:%s", host, port)
+ local echo = string.format("printf \"%sstatus\\ncurrentsong\\nclose\\n\"", password)
+ local cmd = string.format("%s | curl --connect-timeout 1 -fsm 3 %s", echo, mpdh)
+
+ mpd_notification_preset = { title = "Now playing", timeout = 6 }
+
+ helpers.set_map("current mpd track", nil)
+
+ function mpd.update()
+ helpers.async({ shell, "-c", cmd }, function(f)
+ mpd_now = {
+ random_mode = false,
+ single_mode = false,
+ repeat_mode = false,
+ consume_mode = false,
+ pls_pos = "N/A",
+ pls_len = "N/A",
+ state = "N/A",
+ file = "N/A",
+ name = "N/A",
+ artist = "N/A",
+ title = "N/A",
+ album = "N/A",
+ genre = "N/A",
+ track = "N/A",
+ date = "N/A",
+ time = "N/A",
+ elapsed = "N/A"
+ }
+
+ for line in string.gmatch(f, "[^\n]+") do
+ for k, v in string.gmatch(line, "([%w]+):[%s](.*)$") do
+ if k == "state" then mpd_now.state = v
+ elseif k == "file" then mpd_now.file = v
+ elseif k == "Name" then mpd_now.name = escape_f(v)
+ elseif k == "Artist" then mpd_now.artist = escape_f(v)
+ elseif k == "Title" then mpd_now.title = escape_f(v)
+ elseif k == "Album" then mpd_now.album = escape_f(v)
+ elseif k == "Genre" then mpd_now.genre = escape_f(v)
+ elseif k == "Track" then mpd_now.track = escape_f(v)
+ elseif k == "Date" then mpd_now.date = escape_f(v)
+ elseif k == "Time" then mpd_now.time = v
+ elseif k == "elapsed" then mpd_now.elapsed = string.match(v, "%d+")
+ elseif k == "song" then mpd_now.pls_pos = v
+ elseif k == "playlistlength" then mpd_now.pls_len = v
+ elseif k == "repeat" then mpd_now.repeat_mode = v ~= "0"
+ elseif k == "single" then mpd_now.single_mode = v ~= "0"
+ elseif k == "random" then mpd_now.random_mode = v ~= "0"
+ elseif k == "consume" then mpd_now.consume_mode = v ~= "0"
+ end
+ end
+ end
+
+ mpd_notification_preset.text = string.format("%s (%s) - %s\n%s", mpd_now.artist,
+ mpd_now.album, mpd_now.date, mpd_now.title)
+ widget = mpd.widget
+ settings()
+
+ if mpd_now.state == "play" then
+ if notify == "on" and mpd_now.title ~= helpers.get_map("current mpd track") then
+ helpers.set_map("current mpd track", mpd_now.title)
+
+ if followtag then mpd_notification_preset.screen = focused() end
+
+ local common = {
+ preset = mpd_notification_preset,
+ icon = default_art,
+ icon_size = cover_size,
+ replaces_id = mpd.id
+ }
+
+ if not string.match(mpd_now.file, "http.*://") then -- local file instead of http stream
+ local path = string.format("%s/%s", music_dir, string.match(mpd_now.file, ".*/"))
+ local cover = string.format("find '%s' -maxdepth 1 -type f | egrep -i -m1 '%s'",
+ path:gsub("'", "'\\''"), cover_pattern)
+ helpers.async({ shell, "-c", cover }, function(current_icon)
+ common.icon = current_icon:gsub("\n", "")
+ if #common.icon == 0 then common.icon = nil end
+ mpd.id = naughty.notify(common).id
+ end)
+ else
+ mpd.id = naughty.notify(common).id
+ end
+
+ end
+ elseif mpd_now.state ~= "pause" then
+ helpers.set_map("current mpd track", nil)
+ end
+ end)
+ end
+
+ mpd.timer = helpers.newtimer("mpd", timeout, mpd.update, true, true)
+
+ return mpd
+end
+
+return factory
diff --git a/stow_home/awesome/.config/awesome/lain/widget/net.lua b/stow_home/awesome/.config/awesome/lain/widget/net.lua
new file mode 100644
index 0000000..805b577
--- /dev/null
+++ b/stow_home/awesome/.config/awesome/lain/widget/net.lua
@@ -0,0 +1,113 @@
+--[[
+
+ Licensed under GNU General Public License v2
+ * (c) 2013, Luca CPZ
+ * (c) 2010-2012, Peter Hofmann
+
+--]]
+
+local helpers = require("lain.helpers")
+local naughty = require("naughty")
+local wibox = require("wibox")
+local string = string
+
+-- Network infos
+-- lain.widget.net
+
+local function factory(args)
+ local net = { widget = wibox.widget.textbox(), devices = {} }
+ local args = args or {}
+ local timeout = args.timeout or 2
+ local units = args.units or 1024 -- KB
+ local notify = args.notify or "on"
+ local wifi_state = args.wifi_state or "off"
+ local eth_state = args.eth_state or "off"
+ local screen = args.screen or 1
+ local settings = args.settings or function() end
+
+ -- Compatibility with old API where iface was a string corresponding to 1 interface
+ net.iface = (args.iface and (type(args.iface) == "string" and {args.iface}) or
+ (type(args.iface) == "table" and args.iface)) or {}
+
+ function net.get_device()
+ helpers.line_callback("ip link", function(line)
+ net.iface[#net.iface + 1] = not string.match(line, "LOOPBACK") and string.match(line, "(%w+): <") or nil
+ end)
+ end
+
+ if #net.iface == 0 then net.get_device() end
+
+ function net.update()
+ -- These are the totals over all specified interfaces
+ net_now = {
+ devices = {},
+ -- Bytes since last iteration
+ sent = 0,
+ received = 0
+ }
+
+ for _, dev in ipairs(net.iface) do
+ local dev_now = {}
+ local dev_before = net.devices[dev] or { last_t = 0, last_r = 0 }
+ local now_t = tonumber(helpers.first_line(string.format("/sys/class/net/%s/statistics/tx_bytes", dev)) or 0)
+ local now_r = tonumber(helpers.first_line(string.format("/sys/class/net/%s/statistics/rx_bytes", dev)) or 0)
+
+ dev_now.carrier = helpers.first_line(string.format("/sys/class/net/%s/carrier", dev)) or "0"
+ dev_now.state = helpers.first_line(string.format("/sys/class/net/%s/operstate", dev)) or "down"
+
+ dev_now.sent = (now_t - dev_before.last_t) / timeout / units
+ dev_now.received = (now_r - dev_before.last_r) / timeout / units
+
+ net_now.sent = net_now.sent + dev_now.sent
+ net_now.received = net_now.received + dev_now.received
+
+ dev_now.sent = string.format("%.1f", dev_now.sent)
+ dev_now.received = string.format("%.1f", dev_now.received)
+
+ dev_now.last_t = now_t
+ dev_now.last_r = now_r
+
+ if wifi_state == "on" and helpers.first_line(string.format("/sys/class/net/%s/uevent", dev)) == "DEVTYPE=wlan" and string.match(dev_now.carrier, "1") then
+ dev_now.wifi = true
+ dev_now.signal = tonumber(string.match(helpers.lines_from("/proc/net/wireless")[3], "(%-%d+%.)")) or nil
+ end
+
+ if eth_state == "on" and helpers.first_line(string.format("/sys/class/net/%s/uevent", dev)) ~= "DEVTYPE=wlan" and string.match(dev_now.carrier, "1") then
+ dev_now.ethernet = true
+ end
+
+ net.devices[dev] = dev_now
+
+ -- Notify only once when connection is lost
+ if string.match(dev_now.carrier, "0") and notify == "on" and helpers.get_map(dev) then
+ naughty.notify {
+ title = dev,
+ text = "No carrier",
+ icon = helpers.icons_dir .. "no_net.png",
+ screen = screen
+ }
+ helpers.set_map(dev, false)
+ elseif string.match(dev_now.carrier, "1") then
+ helpers.set_map(dev, true)
+ end
+
+ net_now.carrier = dev_now.carrier
+ net_now.state = dev_now.state
+ net_now.devices[dev] = dev_now
+ -- net_now.sent and net_now.received will be
+ -- the totals across all specified devices
+ end
+
+ net_now.sent = string.format("%.1f", net_now.sent)
+ net_now.received = string.format("%.1f", net_now.received)
+
+ widget = net.widget
+ settings()
+ end
+
+ helpers.newtimer("network", timeout, net.update)
+
+ return net
+end
+
+return factory
diff --git a/stow_home/awesome/.config/awesome/lain/widget/pulse.lua b/stow_home/awesome/.config/awesome/lain/widget/pulse.lua
new file mode 100644
index 0000000..f63fe55
--- /dev/null
+++ b/stow_home/awesome/.config/awesome/lain/widget/pulse.lua
@@ -0,0 +1,57 @@
+--[[
+
+ Licensed under GNU General Public License v2
+ * (c) 2016, Luca CPZ
+
+--]]
+
+local helpers = require("lain.helpers")
+local shell = require("awful.util").shell
+local wibox = require("wibox")
+local string = string
+local type = type
+
+-- PulseAudio volume
+-- lain.widget.pulse
+
+local function factory(args)
+ local pulse = { widget = wibox.widget.textbox(), device = "N/A" }
+ local args = args or {}
+ local timeout = args.timeout or 5
+ local settings = args.settings or function() end
+
+ pulse.devicetype = args.devicetype or "sink"
+ pulse.cmd = args.cmd or "pacmd list-" .. pulse.devicetype .. "s | sed -n -e '/*/,$!d' -e '/index/p' -e '/base volume/d' -e '/volume:/p' -e '/muted:/p' -e '/device\\.string/p'"
+
+ function pulse.update()
+ helpers.async({ shell, "-c", type(pulse.cmd) == "string" and pulse.cmd or pulse.cmd() },
+ function(s)
+ volume_now = {
+ index = string.match(s, "index: (%S+)") or "N/A",
+ device = string.match(s, "device.string = \"(%S+)\"") or "N/A",
+ muted = string.match(s, "muted: (%S+)") or "N/A"
+ }
+
+ pulse.device = volume_now.index
+
+ local ch = 1
+ volume_now.channel = {}
+ for v in string.gmatch(s, ":.-(%d+)%%") do
+ volume_now.channel[ch] = v
+ ch = ch + 1
+ end
+
+ volume_now.left = volume_now.channel[1] or "N/A"
+ volume_now.right = volume_now.channel[2] or "N/A"
+
+ widget = pulse.widget
+ settings()
+ end)
+ end
+
+ helpers.newtimer("pulse", timeout, pulse.update)
+
+ return pulse
+end
+
+return factory
diff --git a/stow_home/awesome/.config/awesome/lain/widget/pulsebar.lua b/stow_home/awesome/.config/awesome/lain/widget/pulsebar.lua
new file mode 100644
index 0000000..51290f8
--- /dev/null
+++ b/stow_home/awesome/.config/awesome/lain/widget/pulsebar.lua
@@ -0,0 +1,171 @@
+--[[
+
+ Licensed under GNU General Public License v2
+ * (c) 2013, Luca CPZ
+ * (c) 2013, Rman
+
+--]]
+
+local helpers = require("lain.helpers")
+local awful = require("awful")
+local naughty = require("naughty")
+local wibox = require("wibox")
+local math = math
+local string = string
+local type = type
+local tonumber = tonumber
+
+-- PulseAudio volume bar
+-- lain.widget.pulsebar
+
+local function factory(args)
+ local pulsebar = {
+ colors = {
+ background = "#000000",
+ mute = "#EB8F8F",
+ unmute = "#A4CE8A"
+ },
+
+ _current_level = 0,
+ _mute = "no",
+ device = "N/A"
+ }
+
+ local args = args or {}
+ local timeout = args.timeout or 5
+ local settings = args.settings or function() end
+ local width = args.width or 63
+ local height = args.height or 1
+ local margins = args.margins or 1
+ local paddings = args.paddings or 1
+ local ticks = args.ticks or false
+ local ticks_size = args.ticks_size or 7
+ local tick = args.tick or "|"
+ local tick_pre = args.tick_pre or "["
+ local tick_post = args.tick_post or "]"
+ local tick_none = args.tick_none or " "
+
+ pulsebar.colors = args.colors or pulsebar.colors
+ pulsebar.followtag = args.followtag or false
+ pulsebar.notification_preset = args.notification_preset
+ pulsebar.devicetype = args.devicetype or "sink"
+ pulsebar.cmd = args.cmd or "pacmd list-" .. pulsebar.devicetype .. "s | sed -n -e '/*/,$!d' -e '/index/p' -e '/base volume/d' -e '/volume:/p' -e '/muted:/p' -e '/device\\.string/p'"
+
+ if not pulsebar.notification_preset then
+ pulsebar.notification_preset = {
+ font = "Monospace 10"
+ }
+ end
+
+ pulsebar.bar = wibox.widget {
+ color = pulsebar.colors.unmute,
+ background_color = pulsebar.colors.background,
+ forced_height = height,
+ forced_width = width,
+ margins = margins,
+ paddings = paddings,
+ ticks = ticks,
+ ticks_size = ticks_size,
+ widget = wibox.widget.progressbar,
+ }
+
+ pulsebar.tooltip = awful.tooltip({ objects = { pulsebar.bar } })
+
+ function pulsebar.update(callback)
+ helpers.async({ awful.util.shell, "-c", type(pulsebar.cmd) == "string" and pulsebar.cmd or pulsebar.cmd() },
+ function(s)
+ volume_now = {
+ index = string.match(s, "index: (%S+)") or "N/A",
+ device = string.match(s, "device.string = \"(%S+)\"") or "N/A",
+ muted = string.match(s, "muted: (%S+)") or "N/A"
+ }
+
+ pulsebar.device = volume_now.index
+
+ local ch = 1
+ volume_now.channel = {}
+ for v in string.gmatch(s, ":.-(%d+)%%") do
+ volume_now.channel[ch] = v
+ ch = ch + 1
+ end
+
+ volume_now.left = volume_now.channel[1] or "N/A"
+ volume_now.right = volume_now.channel[2] or "N/A"
+
+ local volu = volume_now.left
+ local mute = volume_now.muted
+
+ if volu:match("N/A") or mute:match("N/A") then return end
+
+ if volu ~= pulsebar._current_level or mute ~= pulsebar._mute then
+ pulsebar._current_level = tonumber(volu)
+ pulsebar.bar:set_value(pulsebar._current_level / 100)
+ if pulsebar._current_level == 0 or mute == "yes" then
+ pulsebar._mute = mute
+ pulsebar.tooltip:set_text ("[muted]")
+ pulsebar.bar.color = pulsebar.colors.mute
+ else
+ pulsebar._mute = "no"
+ pulsebar.tooltip:set_text(string.format("%s %s: %s", pulsebar.devicetype, pulsebar.device, volu))
+ pulsebar.bar.color = pulsebar.colors.unmute
+ end
+
+ settings()
+
+ if type(callback) == "function" then callback() end
+ end
+ end)
+ end
+
+ function pulsebar.notify()
+ pulsebar.update(function()
+ local preset = pulsebar.notification_preset
+
+ preset.title = string.format("%s %s - %s%%", pulsebar.devicetype, pulsebar.device, pulsebar._current_level)
+
+ if pulsebar._mute == "yes" then
+ preset.title = preset.title .. " muted"
+ end
+
+ -- tot is the maximum number of ticks to display in the notification
+ -- fallback: default horizontal wibox height
+ local wib, tot = awful.screen.focused().mywibox, 20
+
+ -- if we can grab mywibox, tot is defined as its height if
+ -- horizontal, or width otherwise
+ if wib then
+ if wib.position == "left" or wib.position == "right" then
+ tot = wib.width
+ else
+ tot = wib.height
+ end
+ end
+
+ int = math.modf((pulsebar._current_level / 100) * tot)
+ preset.text = string.format(
+ "%s%s%s%s",
+ tick_pre,
+ string.rep(tick, int),
+ string.rep(tick_none, tot - int),
+ tick_post
+ )
+
+ if pulsebar.followtag then preset.screen = awful.screen.focused() end
+
+ if not pulsebar.notification then
+ pulsebar.notification = naughty.notify {
+ preset = preset,
+ destroy = function() pulsebar.notification = nil end
+ }
+ else
+ naughty.replace_text(pulsebar.notification, preset.title, preset.text)
+ end
+ end)
+ end
+
+ helpers.newtimer(string.format("pulsebar-%s-%s", pulsebar.devicetype, pulsebar.device), timeout, pulsebar.update)
+
+ return pulsebar
+end
+
+return factory
diff --git a/stow_home/awesome/.config/awesome/lain/widget/sysload.lua b/stow_home/awesome/.config/awesome/lain/widget/sysload.lua
new file mode 100644
index 0000000..adf3e03
--- /dev/null
+++ b/stow_home/awesome/.config/awesome/lain/widget/sysload.lua
@@ -0,0 +1,38 @@
+--[[
+
+ Licensed under GNU General Public License v2
+ * (c) 2013, Luca CPZ
+ * (c) 2010-2012, Peter Hofmann
+
+--]]
+
+local helpers = require("lain.helpers")
+local wibox = require("wibox")
+local open, match = io.open, string.match
+
+-- System load
+-- lain.widget.sysload
+
+local function factory(args)
+ local sysload = { widget = wibox.widget.textbox() }
+ local args = args or {}
+ local timeout = args.timeout or 2
+ local settings = args.settings or function() end
+
+ function sysload.update()
+ local f = open("/proc/loadavg")
+ local ret = f:read("*all")
+ f:close()
+
+ load_1, load_5, load_15 = match(ret, "([^%s]+) ([^%s]+) ([^%s]+)")
+
+ widget = sysload.widget
+ settings()
+ end
+
+ helpers.newtimer("sysload", timeout, sysload.update)
+
+ return sysload
+end
+
+return factory
diff --git a/stow_home/awesome/.config/awesome/lain/widget/temp.lua b/stow_home/awesome/.config/awesome/lain/widget/temp.lua
new file mode 100644
index 0000000..e909b32
--- /dev/null
+++ b/stow_home/awesome/.config/awesome/lain/widget/temp.lua
@@ -0,0 +1,44 @@
+--[[
+
+ Licensed under GNU General Public License v2
+ * (c) 2013, Luca CPZ
+
+--]]
+
+local helpers = require("lain.helpers")
+local wibox = require("wibox")
+local tonumber = tonumber
+
+-- {thermal,core} temperature info
+-- lain.widget.temp
+
+local function factory(args)
+ local temp = { widget = wibox.widget.textbox() }
+ local args = args or {}
+ local timeout = args.timeout or 30
+ local tempfile = args.tempfile or "/sys/devices/virtual/thermal/thermal_zone0/temp"
+ local settings = args.settings or function() end
+
+ function temp.update()
+ helpers.async({"find", "/sys/devices", "-type", "f", "-name", "*temp*"}, function(f)
+ temp_now = {}
+ local temp_fl, temp_value
+ for t in f:gmatch("[^\n]+") do
+ temp_fl = helpers.first_line(t)
+ if temp_fl then
+ temp_value = tonumber(temp_fl)
+ temp_now[t] = temp_value and temp_value/1e3 or temp_fl
+ end
+ end
+ coretemp_now = temp_now[tempfile] or "N/A"
+ widget = temp.widget
+ settings()
+ end)
+ end
+
+ helpers.newtimer("thermal", timeout, temp.update)
+
+ return temp
+end
+
+return factory
diff --git a/stow_home/awesome/.config/awesome/lain/widget/weather.lua b/stow_home/awesome/.config/awesome/lain/widget/weather.lua
new file mode 100644
index 0000000..9c1e797
--- /dev/null
+++ b/stow_home/awesome/.config/awesome/lain/widget/weather.lua
@@ -0,0 +1,148 @@
+--[[
+
+ Licensed under GNU General Public License v2
+ * (c) 2015, Luca CPZ
+
+--]]
+
+local helpers = require("lain.helpers")
+local json = require("lain.util").dkjson
+local focused = require("awful.screen").focused
+local naughty = require("naughty")
+local wibox = require("wibox")
+local math = math
+local os = os
+local string = string
+local type = type
+local tonumber = tonumber
+
+-- OpenWeatherMap
+-- current weather and X-days forecast
+-- lain.widget.weather
+
+local function factory(args)
+ local weather = { widget = wibox.widget.textbox() }
+ local args = args or {}
+ local APPID = args.APPID or "3e321f9414eaedbfab34983bda77a66e" -- lain's default
+ local timeout = args.timeout or 60 * 15 -- 15 min
+ local timeout_forecast = args.timeout or 60 * 60 * 24 -- 24 hrs
+ local current_call = args.current_call or "curl -s 'http://api.openweathermap.org/data/2.5/weather?id=%s&units=%s&lang=%s&APPID=%s'"
+ local forecast_call = args.forecast_call or "curl -s 'http://api.openweathermap.org/data/2.5/forecast/daily?id=%s&units=%s&lang=%s&cnt=%s&APPID=%s'"
+ local city_id = args.city_id or 0 -- placeholder
+ local units = args.units or "metric"
+ local lang = args.lang or "en"
+ local cnt = args.cnt or 5
+ local date_cmd = args.date_cmd or "date -u -d @%d +'%%a %%d'"
+ local icons_path = args.icons_path or helpers.icons_dir .. "openweathermap/"
+ local notification_preset = args.notification_preset or {}
+ local notification_text_fun = args.notification_text_fun or
+ function (wn)
+ local day = os.date("%a %d", wn["dt"])
+ local tmin = math.floor(wn["temp"]["min"])
+ local tmax = math.floor(wn["temp"]["max"])
+ local desc = wn["weather"][1]["description"]
+ return string.format("%s: %s, %d - %d ", day, desc, tmin, tmax)
+ end
+ local weather_na_markup = args.weather_na_markup or " N/A "
+ local followtag = args.followtag or false
+ local showpopup = args.showpopup or "on"
+ local settings = args.settings or function() end
+
+ weather.widget:set_markup(weather_na_markup)
+ weather.icon_path = icons_path .. "na.png"
+ weather.icon = wibox.widget.imagebox(weather.icon_path)
+
+ function weather.show(seconds)
+ weather.hide()
+
+ if followtag then
+ notification_preset.screen = focused()
+ end
+
+ if not weather.notification_text then
+ weather.update()
+ weather.forecast_update()
+ end
+
+ weather.notification = naughty.notify {
+ preset = notification_preset,
+ text = weather.notification_text,
+ icon = weather.icon_path,
+ timeout = type(seconds == "number") and seconds or notification_preset.timeout
+ }
+ end
+
+ function weather.hide()
+ if weather.notification then
+ naughty.destroy(weather.notification)
+ weather.notification = nil
+ end
+ end
+
+ function weather.attach(obj)
+ obj:connect_signal("mouse::enter", function()
+ weather.show(0)
+ end)
+ obj:connect_signal("mouse::leave", function()
+ weather.hide()
+ end)
+ end
+
+ function weather.forecast_update()
+ local cmd = string.format(forecast_call, city_id, units, lang, cnt, APPID)
+ helpers.async(cmd, function(f)
+ local pos, err
+ weather_now, pos, err = json.decode(f, 1, nil)
+
+ if not err and type(weather_now) == "table" and tonumber(weather_now["cod"]) == 200 then
+ weather.notification_text = ""
+ for i = 1, weather_now["cnt"] do
+ weather.notification_text = weather.notification_text ..
+ notification_text_fun(weather_now["list"][i])
+ if i < weather_now["cnt"] then
+ weather.notification_text = weather.notification_text .. "\n"
+ end
+ end
+ end
+ end)
+ end
+
+ function weather.update()
+ local cmd = string.format(current_call, city_id, units, lang, APPID)
+ helpers.async(cmd, function(f)
+ local pos, err, icon
+ weather_now, pos, err = json.decode(f, 1, nil)
+
+ if not err and type(weather_now) == "table" and tonumber(weather_now["cod"]) == 200 then
+ local sunrise = tonumber(weather_now["sys"]["sunrise"])
+ local sunset = tonumber(weather_now["sys"]["sunset"])
+ local icon = weather_now["weather"][1]["icon"]
+ local loc_now = os.time()
+
+ if sunrise <= loc_now and loc_now <= sunset then
+ icon = string.gsub(icon, "n", "d")
+ else
+ icon = string.gsub(icon, "d", "n")
+ end
+
+ weather.icon_path = icons_path .. icon .. ".png"
+ widget = weather.widget
+ settings()
+ else
+ weather.icon_path = icons_path .. "na.png"
+ weather.widget:set_markup(weather_na_markup)
+ end
+
+ weather.icon:set_image(weather.icon_path)
+ end)
+ end
+
+ if showpopup == "on" then weather.attach(weather.widget) end
+
+ weather.timer = helpers.newtimer("weather-" .. city_id, timeout, weather.update, false, true)
+ weather.timer_forecast = helpers.newtimer("weather_forecast-" .. city_id, timeout, weather.forecast_update, false, true)
+
+ return weather
+end
+
+return factory
diff --git a/stow_home/awesome/.config/awesome/lain/wiki/Home.md b/stow_home/awesome/.config/awesome/lain/wiki/Home.md
new file mode 100644
index 0000000..d098efe
--- /dev/null
+++ b/stow_home/awesome/.config/awesome/lain/wiki/Home.md
@@ -0,0 +1,43 @@
+Welcome to the Lain wiki!
+
+If you spot a typo or have a suggestion to improve these pages, please notify me opening an [issue](https://github.com/lcpz/lain/issues) format. Thank you.
+
+Dependencies
+------------
+
+Package | Requested by | Reasons of choice
+--- | --- | ---
+[curl](https://curl.haxx.se) | `imap`, `mpd`, and `weather` widgets | 1. faster and simpler to use than [LuaSocket](https://github.com/diegonehab/luasocket); 2. it's in the core of almost every distro; 3. can be called [asynchronously](https://awesomewm.org/doc/api/libraries/awful.spawn.html#easy_async)
+GLib >= 2.54 | `fs` widget | Pure Awesome/Lua implementation.
+
+The second dependency will be removed once all major distros update their Gio/Glib versions.
+
+Installation
+------------
+
+### Arch Linux
+
+[AUR package](https://aur.archlinux.org/packages/lain-git/)
+
+### Other distributions
+
+```shell
+git clone https://github.com/lcpz/lain.git ~/.config/awesome/lain
+```
+
+Also available via [LuaRocks](https://luarocks.org/modules/aajjbb/lain).
+
+Usage
+--------
+
+First, include it into your `rc.lua`:
+
+```lua
+local lain = require("lain")
+```
+
+Then check out the submodules you want:
+
+- [Layouts](https://github.com/lcpz/lain/wiki/Layouts)
+- [Widgets](https://github.com/lcpz/lain/wiki/Widgets)
+- [Utilities](https://github.com/lcpz/lain/wiki/Utilities)
diff --git a/stow_home/awesome/.config/awesome/lain/wiki/Layouts.md b/stow_home/awesome/.config/awesome/lain/wiki/Layouts.md
new file mode 100644
index 0000000..0286d4b
--- /dev/null
+++ b/stow_home/awesome/.config/awesome/lain/wiki/Layouts.md
@@ -0,0 +1,255 @@
+
+ lain/layout
+ .
+ |-- termfair
+ |-- termfair.center
+ |-- cascade
+ |-- cascade.tile
+ |-- centerwork
+ |-- centerwork.horizontal
+
+Usage
+=====
+
+As usual, specify your favourites in `awful.layout.layouts`, or set them on specific tags with [`awful.layout.set`](https://awesomewm.org/doc/api/libraries/awful.layout.html#set).
+
+```lua
+awful.layout.set(lain.layout.termfair, tag)
+```
+
+How do layouts work?
+====================
+
+`termfair`
+--------
+
+This layout restricts the size of each window. Each window will have the
+same width but is variable in height. Furthermore, windows are
+left-aligned. The basic workflow is as follows (the number above the
+screen is the number of open windows, the number in a cell is the fixed
+number of a client):
+
+ (1) (2) (3)
+ +---+---+---+ +---+---+---+ +---+---+---+
+ | | | | | | | | | | | |
+ | 1 | | | -> | 2 | 1 | | -> | 3 | 2 | 1 | ->
+ | | | | | | | | | | | |
+ +---+---+---+ +---+---+---+ +---+---+---+
+
+ (4) (5) (6)
+ +---+---+---+ +---+---+---+ +---+---+---+
+ | 4 | | | | 5 | 4 | | | 6 | 5 | 4 |
+ +---+---+---+ -> +---+---+---+ -> +---+---+---+
+ | 3 | 2 | 1 | | 3 | 2 | 1 | | 3 | 2 | 1 |
+ +---+---+---+ +---+---+---+ +---+---+---+
+
+The first client will be located in the left column. When opening
+another window, this new window will be placed in the left column while
+moving the first window into the middle column. Once a row is full,
+another row above it will be created.
+
+Default number of columns and rows are respectively taken from `nmaster`
+and `ncol` values in `awful.tag`, but you can set your own.
+
+For example, this sets `termfair` to 3 columns and at least 1 row:
+
+```lua
+lain.layout.termfair.nmaster = 3
+lain.layout.termfair.ncol = 1
+```
+
+`termfair.center`
+----------
+
+Similar to `termfair`, but with fixed number of vertical columns. Cols are centerded until there are `nmaster` columns, then windows are stacked as slaves, with possibly `ncol` clients per column at most.
+
+ (1) (2) (3)
+ +---+---+---+ +-+---+---+-+ +---+---+---+
+ | | | | | | | | | | | | |
+ | | 1 | | -> | | 1 | 2 | | -> | 1 | 2 | 3 | ->
+ | | | | | | | | | | | | |
+ +---+---+---+ +-+---+---+-+ +---+---+---+
+
+ (4) (5)
+ +---+---+---+ +---+---+---+
+ | | | 3 | | | 2 | 4 |
+ + 1 + 2 +---+ -> + 1 +---+---+
+ | | | 4 | | | 3 | 5 |
+ +---+---+---+ +---+---+---+
+
+Like `termfair`, default number of columns and rows are respectively taken from `nmaster`
+and `ncol` values in `awful.tag`, but you can set your own.
+
+For example, this sets `termfair.center` to 3 columns and at least 1 row:
+
+```lua
+lain.layout.termfair.center.nmaster = 3
+lain.layout.termfair.center.ncol = 1
+```
+
+`cascade`
+-------
+
+Cascade all windows of a tag.
+
+You can control the offsets by setting these two variables:
+
+```lua
+lain.layout.cascade.offset_x = 64
+lain.layout.cascade.offset_y = 16
+```
+
+The following reserves space for 5 windows:
+
+```lua
+lain.layout.cascade.nmaster = 5
+```
+
+That is, no window will get resized upon the creation of a new window,
+unless there's more than 5 windows.
+
+`cascade.tile`
+-----------
+
+Similar to `awful.layout.suit.tile` layout, however, clients in the slave
+column are cascaded instead of tiled.
+
+Left column size can be set, otherwise is controlled by `mwfact` of the
+tag. Additional windows will be opened in another column on the right.
+New windows are placed above old windows.
+
+Whether the slave column is placed on top of the master window or not is
+controlled by the value of `ncol`. A value of 1 means "overlapping slave column"
+and anything else means "don't overlap windows".
+
+Usage example:
+
+```lua
+lain.layout.cascade.tile.offset_x = 2
+lain.layout.cascade.tile.offset_y = 32
+lain.layout.cascade.tile.extra_padding = 5
+lain.layout.cascade.tile.nmaster = 5
+lain.layout.cascade.tile.ncol = 2
+```
+
+`extra_padding` reduces the size of the master window if "overlapping
+slave column" is activated. This allows you to see if there are any
+windows in your slave column.
+
+Setting `offset_x` to a very small value or even 0 is recommended to avoid wasting space.
+
+`centerwork`
+----------
+
+You start with one window, centered horizontally:
+
+ +--------------------------+
+ | +----------+ |
+ | | | |
+ | | | |
+ | | | |
+ | | MAIN | |
+ | | | |
+ | | | |
+ | | | |
+ | | | |
+ | +----------+ |
+ +--------------------------+
+
+This is your main working window. You do most of the work right here.
+Sometimes, you may want to open up additional windows. They're put on left and right, alternately.
+
+ +--------------------------+
+ | +---+ +----------+ +---+ |
+ | | | | | | | |
+ | | | | | | | |
+ | | | | | | | |
+ | +---+ | MAIN | +---+ |
+ | +---+ | | +---+ |
+ | | | | | | | |
+ | | | | | | | |
+ | | | | | | | |
+ | +---+ +----------+ +---+ |
+ +--------------------------+
+
+*Please note:* If you use Awesome's default configuration, navigation in
+this layout may be very confusing. How do you get from the main window
+to satellite ones depends on the order in which the windows are opened.
+Thus, use of `awful.client.focus.bydirection()` is suggested.
+Here's an example:
+
+```lua
+globalkeys = awful.util.table.join(
+ -- [...]
+ awful.key({ modkey }, "j",
+ function()
+ awful.client.focus.bydirection("down")
+ if client.focus then client.focus:raise() end
+ end),
+ awful.key({ modkey }, "k",
+ function()
+ awful.client.focus.bydirection("up")
+ if client.focus then client.focus:raise() end
+ end),
+ awful.key({ modkey }, "h",
+ function()
+ awful.client.focus.bydirection("left")
+ if client.focus then client.focus:raise() end
+ end),
+ awful.key({ modkey }, "l",
+ function()
+ awful.client.focus.bydirection("right")
+ if client.focus then client.focus:raise() end
+ end),
+ -- [...]
+)
+```
+
+`centerwork.horizontal`
+-----------
+
+Same as `centerwork`, except that the main
+window expands horizontally, and the additional windows
+are put ontop/below it. Useful if you have a screen turned 90°.
+
+Pre 4.0 `uselesstile` patches
+=============================
+
+In branch 3.5, this module provided useless gaps layouts. Since useless gaps have been implemented in Awesome 4.0, those layouts have been removed.
+
+Following are a couple of `uselesstile` variants that were not part of lain. They are kept only for reference and are not supported.
+
+Xmonad-like
+-----------
+
+If you want to have `awful.layout.suit.tile` behave like xmonad, with internal gaps two times wider than external ones, download [this](https://gist.github.com/lcpz/9e56dcfbe66bfe14967c) as `lain/layout/uselesstile`.
+
+Inverted master
+---------------
+
+Want to invert master window position? Use [this](https://gist.github.com/lcpz/c59dc59c9f99d98218eb) version. You can set `single_gap` with `width` and `height` in your `theme.lua`, in order to define the window geometry when there's only one client, otherwise it goes maximized. An example:
+
+ theme.single_gap = { width = 600, height = 100 }
+
+What about layout icons?
+========================
+
+They are located in ``lain/icons/layout``.
+
+To use them, define new `layout_*` variables in your ``theme.lua``. For instance:
+
+```lua
+theme.lain_icons = os.getenv("HOME") ..
+ "/.config/awesome/lain/icons/layout/default/"
+theme.layout_termfair = theme.lain_icons .. "termfair.png"
+theme.layout_centerfair = theme.lain_icons .. "centerfair.png" -- termfair.center
+theme.layout_cascade = theme.lain_icons .. "cascade.png"
+theme.layout_cascadetile = theme.lain_icons .. "cascadetile.png" -- cascade.tile
+theme.layout_centerwork = theme.lain_icons .. "centerwork.png"
+theme.layout_centerworkh = theme.lain_icons .. "centerworkh.png" -- centerwork.horizontal
+```
+
+Credit goes to [Nicolas Estibals](https://github.com/nestibal) for creating
+layout icons for default theme.
+
+You can use them as a template for your custom versions.
\ No newline at end of file
diff --git a/stow_home/awesome/.config/awesome/lain/wiki/Utilities.md b/stow_home/awesome/.config/awesome/lain/wiki/Utilities.md
new file mode 100644
index 0000000..4ec3057
--- /dev/null
+++ b/stow_home/awesome/.config/awesome/lain/wiki/Utilities.md
@@ -0,0 +1,338 @@
+Quake
+-----
+
+A Quake-like dropdown container for your favourite application.
+
+**Usage**
+
+Define it globally to have a single instance for all screens:
+
+```lua
+local quake = lain.util.quake()
+```
+
+or define it in `connect_for_each_screen` to have one instance for each screen:
+
+```lua
+awful.screen.connect_for_each_screen(function(s)
+ -- Quake application
+ s.quake = lain.util.quake()
+ -- [...]
+```
+
+**Keybinding example**
+
+If using a global instance:
+```lua
+awful.key({ modkey, }, "z", function () quake:toggle() end),
+```
+
+If using a per-screen instance:
+```lua
+awful.key({ modkey, }, "z", function () awful.screen.focused().quake:toggle() end),
+```
+
+**Input table**
+
+Variable | Meaning | Type | Default
+--- | --- | --- | ---
+`app` | client to spawn | string | "xterm"
+`name` | client name | string | "QuakeDD"
+`argname` | how to specify client name | string | "-name %s"
+`extra` | extra `app` arguments | string | empty string
+`border` | border width | integer | 1
+`visible` | initially visible | boolean | false
+`followtag` | always spawn on currently focused screen | boolean | false
+`overlap` | Overlap the wibox or not | boolean | false
+`settings` | Additional settings to make on the client | function | `nil`
+`screen` | screen where to spawn the client | integer | `awful.screen.focused()`
+`height` | dropdown client height | float in [0,1] or exact pixels number | 0.25
+`width` | dropdown client width | float in [0,1] or exact pixels number | 1
+`vert` | vertical position | string, possible values: "top", "bottom", "center" | "top"
+`horiz` | horizontal position | string, possible values: "left", "right", "center" | "left"
+
+`height` and `width` express a fraction of the workspace.
+
+`settings` is a function which takes the client as input, and can be used to customize its properties. For instance:
+
+```lua
+-- set the client sticky
+s.quake = lain.util.quake { settings = function(c) c.sticky = true end }
+```
+
+Read [here](https://awesomewm.org/doc/api/classes/client.html#Object_properties) for the complete list of properties.
+
+**Notes**
+
+* [Does not work](https://github.com/lcpz/lain/issues/358) with `gnome-terminal`, `konsole`, or any other terminal which is strictly designed for a Desktop Environment. Just pick a better terminal, [there's plenty](https://wiki.archlinux.org/index.php/List_of_applications#Terminal_emulators).
+* Set `followtag = true` if [experiencing issues with multiple screens](https://github.com/lcpz/lain/issues/346).
+* If you have a `awful.client.setslave` rule for your application, ensure you use an exception for `QuakeDD` (or your defined `name`). Otherwise, you may run into problems with focus.
+* If you are using a VTE-based terminal like `termite`, be sure to set [`argname = "--name %s"`](https://github.com/lcpz/lain/issues/211).
+
+Separators
+----------
+
+Adds Cairo separators.
+
+```lua
+local separators = lain.util.separators
+```
+
+A separator function `separators.separator` takes two color arguments, defined as strings. `"alpha"` argument is allowed. Example:
+
+```lua
+arrl_dl = separators.arrow_left(beautiful.bg_focus, "alpha")
+arrl_ld = separators.arrow_left("alpha", beautiful.bg_focus)
+```
+
+You can customize height and width by setting `separators_height` and `separators_width` in your `theme.lua`. Default values are 0 and 9, respectively.
+
+List of functions:
+
+ +-- separators
+ |
+ |`-- arrow_right() Draw a right arrow.
+ `-- arrow_left() Draw a left arrow.
+
+markup
+------
+
+Mades markup easier.
+
+```lua
+local markup = lain.util.markup
+```
+
+List of functions:
+
+ +-- markup
+ |
+ |`-- bold() Set bold.
+ |`-- italic() Set italicized text.
+ |`-- strike() Set strikethrough text.
+ |`-- underline() Set underlined text.
+ |`-- monospace() Set monospaced text.
+ |`-- big() Set bigger text.
+ |`-- small() Set smaller text.
+ |`-- font() Set the font of the text.
+ |`-- font() Set the font of the text.
+ |`-- color() Set background and foreground color.
+ |`-- fontfg() Set font and foreground color.
+ |`-- fontbg() Set font and background color.
+ `-- fontcolor() Set font, plus background and foreground colors.
+ |
+ |`--+ bg
+ | |
+ | `-- color() Set background color.
+ |
+ `--+ fg
+ |
+ `-- color() Set foreground color.
+
+they all take one argument, which is the text to markup, except the following:
+
+```lua
+markup.font(font, text)
+markup.color(fg, bg, text)
+markup.fontfg(font, fg, text)
+markup.fontbg(font, bg, text)
+markup.fontcolor(font, fg, bg, text)
+markup.fg.color(color, text)
+markup.bg.color(color, text)
+```
+
+Dynamic tagging
+---------------
+
+That is:
+
+- add a new tag;
+- rename current tag;
+- move current tag;
+- delete current tag.
+
+If you delete a tag, any rule set on it shall be broken, so be careful.
+
+Use it with key bindings like these:
+
+```lua
+awful.key({ modkey, "Shift" }, "n", function () lain.util.add_tag(mylayout) end),
+awful.key({ modkey, "Shift" }, "r", function () lain.util.rename_tag() end),
+awful.key({ modkey, "Shift" }, "Left", function () lain.util.move_tag(1) end), -- move to next tag
+awful.key({ modkey, "Shift" }, "Right", function () lain.util.move_tag(-1) end), -- move to previous tag
+awful.key({ modkey, "Shift" }, "d", function () lain.util.delete_tag() end),
+```
+
+The argument in `lain.util.add_tag` represents the tag layout, and is optional: if not present, it will be defaulted to `awful.layout.suit.tile`.
+
+Useless gaps resize
+---------------------
+
+Changes `beautiful.useless_gaps` on the fly.
+
+```lua
+lain.util.useless_gap_resize(thatmuch, s, t)
+```
+
+The argument `thatmuch` is the number of pixel to add to/substract from gaps (integer).
+
+The arguments `s` and `t` are the `awful.screen` and `awful.tag` in which you want to change the gap. They are optional.
+
+Following are example keybindings for changing client gaps on current screen and tag.
+
+Example 1:
+
+```lua
+-- On the fly useless gaps change
+awful.key({ altkey, "Control" }, "+", function () lain.util.useless_gaps_resize(1) end),
+awful.key({ altkey, "Control" }, "-", function () lain.util.useless_gaps_resize(-1) end),
+```
+
+where `altkey = Mod1`. Example 2:
+
+```lua
+mywidget:buttons(awful.util.table.join (
+ awful.button({}, 4, function() lain.util.useless_gaps_resize(-1) end),
+ awful.button({}, 5, function() lain.util.useless_gaps_resize(1) end)
+ end)
+))
+```
+
+so when hovering the mouse over `mywidget`, you can adjust useless gaps size by scrolling with the mouse wheel.
+
+tag\_view\_nonempty
+-------------------
+
+This function lets you jump to the next/previous non-empty tag.
+It takes two arguments:
+
+* `direction`: `1` for next non-empty tag, `-1` for previous.
+* `sc`: Screen which the taglist is in. Default is `mouse.screen` or `1`. This
+ argument is optional.
+
+You can use it with key bindings like these:
+
+```lua
+-- Non-empty tag browsing
+awful.key({ altkey }, "Left", function () lain.util.tag_view_nonempty(-1) end),
+awful.key({ altkey }, "Right", function () lain.util.tag_view_nonempty(1) end),
+```
+
+where `altkey = "Mod1"`.
+
+magnify\_client
+---------------
+
+Set a client to floating and resize it in the same way the "magnifier"
+layout does it. Place it on the "current" screen (derived from the mouse
+position). This allows you to magnify any client you wish, regardless of
+the currently used layout. Use it with a client keybinding like this:
+
+```lua
+clientkeys = awful.util.table.join(
+ -- [...]
+ awful.key({ modkey, "Control" }, "m", lain.util.magnify_client),
+ -- [...]
+)
+```
+
+If you want to "de-magnify" it, just retype the keybinding.
+
+If you want magnified client to respond to `incmwfact`, read [here](https://github.com/lcpz/lain/issues/195).
+
+menu\_clients\_current\_tags
+----------------------------
+
+Similar to `awful.menu.clients`, but this menu only shows the clients
+of currently visible tags. Use it with a key binding like this:
+
+```lua
+awful.key({ "Mod1" }, "Tab", function()
+ lain.util.menu_clients_current_tags({ width = 350 }, { keygrabber = true })
+end),
+```
+
+menu\_iterator
+--------------
+
+A generic menu utility which enables iteration over lists of possible
+actions to execute. The perfect example is a menu for choosing what
+configuration to apply to X with `xrandr`, as suggested on the [Awesome wiki page](https://awesomewm.org/recipes/xrandr).
+
+
+
+
An example Synergy menu, courtesy of sim590
+
+
+You can either manually create a menu by defining a table in this format:
+
+```lua
+{ { "choice description 1", callbackFuction1 }, { "choice description 2", callbackFunction2 }, ... }
+```
+
+or use `lain.util.menu_iterator.menu`. Once you have your menu, use it with `lain.menu_iterator.iterate`.
+
+### Input tables
+
+**lain.menu_iterator.iterate**
+
+| Argument | Description | Type
+|---|---| ---
+| `menu` | the menu to iterate on | table
+| `timeout` | time (in seconds) to wait on a choice before the choice is accepted | integer (default: 4)
+| `icon` | path to the icon to display in `naughty.notify` window | string
+
+**lain.menu_iterator.menu**
+
+| Argument | Description | Type
+|---|---| ---
+`choices` | list of choices (e.g., `{ "choice1", "choice2", ... }`) | array of strings
+`name` | name of the program related to this menu | string
+`selected_cb` | callback to execute for each selected choice, it takes one choice (string) as argument; can be `nil` (no action to execute) | function
+`rejected_cb` | callback to execute for all rejected choices (the remaining choices, once one is selected), it takes one choice (string) as argument; can be `nil` (no action to execute) | function
+`extra_choices` | more choices to be added to the menu; unlike `choices`, these ones won't trigger `rejected_cb` | array of `{ choice, callback }` pairs, where `choice` is a string and `callback` is a function
+`combination` | how choices have to be combined in the menu; possible values are: "single" (default), the set of possible choices will simply be the input set ; "powerset", the set of possible choices will be the [power set](https://en.wikipedia.org/wiki/Power_set) of the input set | string
+
+### Examples
+
+A simple example is:
+
+```lua
+local mymenu_iterable = lain.util.menu_iterator.menu {
+ choices = {"My first choice", "My second choice"},
+ name = "My awesome program",
+ selected_cb = function(choice)
+ -- do something with selected choice
+ end,
+ rejected_cb = function(choice)
+ -- do something with every rejected choice
+ end
+}
+```
+
+The variable `mymenu_iterable` is a menu compatible with the function `lain.util.menu_iterator.iterate`, which will iterate over it and displays notification with `naughty.notify` every time it is called. You can use it like this:
+
+```lua
+local confirm_timeout = 5 -- time to wait before confirming the menu selection
+local my_notify_icon = "/path/to/icon" -- the icon to display in the notification
+lain.util.menu_iterator.iterate(mymenu_iterable, confirm_timeout, my_notify_icon)
+```
+
+Once `confirm_timeout` has passed without anymore calls to `iterate`, the choice is made and the associated callbacks (both for selected and rejected choices) are spawned.
+
+A useful practice is to add a `Cancel` option as an extra choice for canceling a menu selection. Extending the above example:
+
+```lua
+local mymenu_iterable = lain.util.menu_iterator.menu {
+ choices = {"My first choice", "My second choice"},
+ name = "My awesome program",
+ selected_cb = function(choice)
+ -- do something with selected choice
+ end,
+ rejected_cb = function(choice)
+ -- do something with every rejected choice
+ end
+ -- nil means no action to do
+ extra_choices = { {"Cancel"}, nil }
+}
+```
diff --git a/stow_home/awesome/.config/awesome/lain/wiki/Widgets.md b/stow_home/awesome/.config/awesome/lain/wiki/Widgets.md
new file mode 100644
index 0000000..34f518d
--- /dev/null
+++ b/stow_home/awesome/.config/awesome/lain/wiki/Widgets.md
@@ -0,0 +1,55 @@
+# Usage
+
+Every lain widget is a table.
+
+A lain widget is generated by a `function`.
+
+The `function` signature, input and output arguments can be found in the [related wiki entry](https://github.com/lcpz/lain/wiki/Widgets#index).
+
+Every lain widget contains a `wibox.widget`, which is updated by a timed function. To access the widget, use the field `widget`, while to access the timed function, use the field `update`. Some lain widgets may also have an `icon` field, which is a `wibox.widget.imagebox`, and/or a `timer` field, which is the `gears.timer` on `update`.
+
+Every `function` may take either a table or a list of variables as input.
+
+If the input is a table, you must define a function variable called `settings` in it. There you will be able to define `widget` appearance.
+
+For instance, if `widget` is a textbox, to markup it call `widget:set_markup(...)` within `settings`.
+
+In the scope of `settings` you can use predefined arguments, which are specified in the wiki entries.
+
+Example of a lain widget:
+
+```lua
+local cpu = lain.widget.cpu {
+ settings = function()
+ widget:set_markup("Cpu " .. cpu_now.usage)
+ end
+}
+-- to access the widget: cpu.widget
+```
+
+If you want to see some applications, check [awesome-copycats](https://github.com/lcpz/awesome-copycats).
+
+# Index
+
+- [alsa](https://github.com/lcpz/lain/wiki/alsa)
+- [alsabar](https://github.com/lcpz/lain/wiki/alsabar)
+- [bat](https://github.com/lcpz/lain/wiki/bat)
+- [cal](https://github.com/lcpz/lain/wiki/cal)
+- [cpu](https://github.com/lcpz/lain/wiki/cpu)
+- [fs](https://github.com/lcpz/lain/wiki/fs)
+- [imap](https://github.com/lcpz/lain/wiki/imap)
+- [mem](https://github.com/lcpz/lain/wiki/mem)
+- [mpd](https://github.com/lcpz/lain/wiki/mpd)
+- [net](https://github.com/lcpz/lain/wiki/net)
+- [pulse](https://github.com/lcpz/lain/wiki/pulse)
+- [pulsebar](https://github.com/lcpz/lain/wiki/pulsebar)
+- [sysload](https://github.com/lcpz/lain/wiki/sysload)
+- [temp](https://github.com/lcpz/lain/wiki/temp)
+- [weather](https://github.com/lcpz/lain/wiki/weather)
+
+## Users contributed
+
+- [moc](https://github.com/lcpz/lain/wiki/moc)
+- [redshift](https://github.com/lcpz/lain/wiki/redshift)
+- [task](https://github.com/lcpz/lain/wiki/task)
+- [tp_smapi](https://github.com/lcpz/lain/wiki/tp_smapi)
diff --git a/stow_home/awesome/.config/awesome/lain/wiki/_Footer.md b/stow_home/awesome/.config/awesome/lain/wiki/_Footer.md
new file mode 100644
index 0000000..b64f13b
--- /dev/null
+++ b/stow_home/awesome/.config/awesome/lain/wiki/_Footer.md
@@ -0,0 +1 @@
+[Home](https://github.com/lcpz/lain/wiki) • [Layouts](https://github.com/lcpz/lain/wiki/Layouts) • [Widgets](https://github.com/lcpz/lain/wiki/Widgets) • [Utilities](https://github.com/lcpz/lain/wiki/Utilities)
diff --git a/stow_home/awesome/.config/awesome/lain/wiki/_Sidebar.md b/stow_home/awesome/.config/awesome/lain/wiki/_Sidebar.md
new file mode 100644
index 0000000..0289783
--- /dev/null
+++ b/stow_home/awesome/.config/awesome/lain/wiki/_Sidebar.md
@@ -0,0 +1,26 @@
+* [Home](https://github.com/lcpz/lain/wiki/Home)
+* [Layouts](https://github.com/lcpz/lain/wiki/Layouts)
+ * [Usage](https://github.com/lcpz/lain/wiki/Layouts#Usage)
+ * [How do layouts work?](https://github.com/lcpz/lain/wiki/Layouts#how-do-layouts-work)
+ * [termfair](https://github.com/lcpz/lain/wiki/Layouts#termfair)
+ * [centerfair](https://github.com/lcpz/lain/wiki/Layouts#termfaircenter)
+ * [cascade](https://github.com/lcpz/lain/wiki/Layouts#cascade)
+ * [cascadetile](https://github.com/lcpz/lain/wiki/Layouts#cascadetile)
+ * [centerwork](https://github.com/lcpz/lain/wiki/Layouts#centerwork)
+ * [centerworkh](https://github.com/lcpz/lain/wiki/Layouts#centerworkhorizontal)
+ * [Pre 4.0 uselesstile patches](https://github.com/lcpz/lain/wiki/Layouts#pre-40-uselesstile-patches)
+ * [What about layout icons?](https://github.com/lcpz/lain/wiki/Layouts#what-about-layout-icons)
+* [Widgets](https://github.com/lcpz/lain/wiki/Widgets)
+ * [Usage](https://github.com/lcpz/lain/wiki/Widgets#usage)
+ * [Index](https://github.com/lcpz/lain/wiki/Widgets#index)
+ * [Users contributed](https://github.com/lcpz/lain/wiki/Widgets#users-contributed)
+* [Utilities](https://github.com/lcpz/lain/wiki/Utilities)
+ * [quake](https://github.com/lcpz/lain/wiki/Utilities#quake)
+ * [separators](https://github.com/lcpz/lain/wiki/Utilities#separators)
+ * [markup](https://github.com/lcpz/lain/wiki/Utilities#markup)
+ * [dynamic tagging](https://github.com/lcpz/lain/wiki/Utilities#dynamic-tagging)
+ * [useless_gaps_resize](https://github.com/lcpz/lain/wiki/Utilities#useless-gaps-resize)
+ * [tag_view_non_empty](https://github.com/lcpz/lain/wiki/Utilities#tag_view_nonempty)
+ * [magnify_client](https://github.com/lcpz/lain/wiki/Utilities#magnify_client)
+ * [menu_clients_current_tags](https://github.com/lcpz/lain/wiki/Utilities#menu_clients_current_tags)
+ * [menu_iterator](https://github.com/lcpz/lain/wiki/Utilities#menu_iterator)
diff --git a/stow_home/awesome/.config/awesome/lain/wiki/alsa.md b/stow_home/awesome/.config/awesome/lain/wiki/alsa.md
new file mode 100644
index 0000000..9c1e5c4
--- /dev/null
+++ b/stow_home/awesome/.config/awesome/lain/wiki/alsa.md
@@ -0,0 +1,148 @@
+## Usage
+
+[Read here.](https://github.com/lcpz/lain/wiki/Widgets#usage)
+
+### Description
+
+Shows ALSA volume.
+
+```lua
+local volume = lain.widget.alsa()
+```
+
+## Input table
+
+Variable | Meaning | Type | Default
+--- | --- | --- | ---
+`timeout` | Refresh timeout (in seconds) | integer | 5
+`cmd` | Alsa mixer command | string | "amixer"
+`channel` | Mixer channel | string | "Master"
+`togglechannel` | Toggle channel | string | `nil`
+`settings` | User settings | function | empty function
+
+`cmd` is useful if you need to pass additional arguments to amixer. For instance, you may want to define `cmd = "amixer -c X"` in order to set amixer with card `X`.
+
+`settings` can use the following variables:
+
+Variable | Meaning | Type | Values
+--- | --- | --- | ---
+`volume_now.level` | Volume level | integer | 0-100
+`volume_now.status` | Device status | string | "on", "off"
+
+## Output table
+
+Variable | Meaning | Type
+--- | --- | ---
+`widget` | The widget | `wibox.widget.textbox`
+`channel` | ALSA channel | string
+`update` | Update `widget` | function
+
+## Toggle channel
+
+In case mute toggling can't be mapped to master channel (this happens, for instance, when you are using an HDMI output), define togglechannel as your S/PDIF device. You can get the device ID with `scontents` command.
+
+For instance, if card number is 1 and S/PDIF number is 3:
+
+```shell
+$ amixer -c 1 scontents
+Simple mixer control 'Master',0
+ Capabilities: volume
+ Playback channels: Front Left - Front Right
+ Capture channels: Front Left - Front Right
+ Limits: 0 - 255
+ Front Left: 255 [100%]
+ Front Right: 255 [100%]
+Simple mixer control 'IEC958',0
+ Capabilities: pswitch pswitch-joined
+ Playback channels: Mono
+ Mono: Playback [on]
+Simple mixer control 'IEC958',1
+ Capabilities: pswitch pswitch-joined
+ Playback channels: Mono
+ Mono: Playback [on]
+Simple mixer control 'IEC958',2
+ Capabilities: pswitch pswitch-joined
+ Playback channels: Mono
+ Mono: Playback [on]
+Simple mixer control 'IEC958',3
+ Capabilities: pswitch pswitch-joined
+ Playback channels: Mono
+ Mono: Playback [on]
+```
+
+you have to set `togglechannel = "IEC958,3"`.
+
+## Buttons
+
+If you want buttons, just add the following after your widget in `rc.lua`.
+
+```lua
+volume.widget:buttons(awful.util.table.join(
+ awful.button({}, 1, function() -- left click
+ awful.spawn(string.format("%s -e alsamixer", terminal))
+ end),
+ awful.button({}, 2, function() -- middle click
+ os.execute(string.format("%s set %s 100%%", volume.cmd, volume.channel))
+ volume.update()
+ end),
+ awful.button({}, 3, function() -- right click
+ os.execute(string.format("%s set %s toggle", volume.cmd, volume.togglechannel or volume.channel))
+ volume.update()
+ end),
+ awful.button({}, 4, function() -- scroll up
+ os.execute(string.format("%s set %s 1%%+", volume.cmd, volume.channel))
+ volume.update()
+ end),
+ awful.button({}, 5, function() -- scroll down
+ os.execute(string.format("%s set %s 1%%-", volume.cmd, volume.channel))
+ volume.update()
+ end)
+))
+```
+
+## Keybindings
+
+You can control the widget with keybindings like these:
+
+```lua
+-- ALSA volume control
+awful.key({ altkey }, "Up",
+ function ()
+ os.execute(string.format("amixer set %s 1%%+", volume.channel))
+ volume.update()
+ end),
+awful.key({ altkey }, "Down",
+ function ()
+ os.execute(string.format("amixer set %s 1%%-", volume.channel))
+ volume.update()
+ end),
+awful.key({ altkey }, "m",
+ function ()
+ os.execute(string.format("amixer set %s toggle", volume.togglechannel or volume.channel))
+ volume.update()
+ end),
+awful.key({ altkey, "Control" }, "m",
+ function ()
+ os.execute(string.format("amixer set %s 100%%", volume.channel))
+ volume.update()
+ end),
+awful.key({ altkey, "Control" }, "0",
+ function ()
+ os.execute(string.format("amixer set %s 0%%", volume.channel))
+ volume.update()
+ end),
+```
+
+where `altkey = "Mod1"`.
+
+### Muting with PulseAudio
+
+If you are using this widget in conjuction with PulseAudio, add the option `-D pulse` to the muting keybinding, like this:
+
+```lua
+awful.key({ altkey }, "m",
+ function ()
+ os.execute(string.format("amixer -D pulse set %s toggle", volume.togglechannel or volume.channel))
+ volume.update()
+ end),
+```
diff --git a/stow_home/awesome/.config/awesome/lain/wiki/alsabar.md b/stow_home/awesome/.config/awesome/lain/wiki/alsabar.md
new file mode 100644
index 0000000..a986d8f
--- /dev/null
+++ b/stow_home/awesome/.config/awesome/lain/wiki/alsabar.md
@@ -0,0 +1,108 @@
+## Usage
+
+[Read here.](https://github.com/lcpz/lain/wiki/Widgets#usage)
+
+### Description
+
+Shows ALSA volume with a progressbar; provides tooltips and notifications.
+
+```lua
+local volume = lain.widget.alsabar()
+```
+
+## Input table
+
+Variable | Meaning | Type | Default
+--- | --- | --- | ---
+`timeout` | Refresh timeout (in seconds) | integer | 5
+`settings` | User settings | function | empty function
+`width` | Bar width | number | 63
+`height` | Bar height | number | 1
+`margins` | Bar margins | number | 1
+`paddings` | Bar paddings | number | 1
+`ticks` | Set bar ticks on | boolean | false
+`ticks_size` | Ticks size | integer | 7
+`tick` | String for a notification tick | string | "|"
+`tick_pre` | String for the left notification delimeter | string | "["
+`tick_post` | String for the right notification delimeter | string | "]"
+`tick_none` | String for an empty notification tick | string | " "
+`cmd` | ALSA mixer command | string | "amixer"
+`channel` | Mixer channel | string | "Master"
+`togglechannel` | Toggle channel | string | `nil`
+`tick` | The character usef for ticks in the notification | string | "|"
+`colors` | Bar colors | table | see [Default colors](https://github.com/lcpz/lain/wiki/alsabar#default-colors)
+`notification_preset` | Notification preset | table | See [default `notification_preset`](https://github.com/lcpz/lain/wiki/alsabar#default-notification_preset)
+`followtag` | Display the notification on currently focused screen | boolean | false
+
+`cmd` is useful if you need to pass additional arguments to `amixer`. For instance, you may want to define `cmd = "amixer -c X"` in order to set amixer with card `X`.
+
+In case mute toggling can't be mapped to master channel (this happens, for instance, when you are using an HDMI output), define `togglechannel` as your S/PDIF device. Read [`alsa`](https://github.com/lcpz/lain/wiki/alsa#toggle-channel) page to know how.
+
+To set the maximum number of ticks to display in the notification, define `max_ticks` (integer) in `notification_preset`.
+
+`settings` can use the following variables:
+
+Variable | Meaning | Type | Values
+--- | --- | --- | ---
+`volume_now.level` | Volume level | integer | 0-100
+`volume_now.status` | Device status | string | "on", "off"
+
+With multiple screens, the default behaviour is to show a visual notification pop-up window on the first screen. By setting `followtag` to `true` it will be shown on the currently focused tag screen.
+
+### Default colors
+
+Variable | Meaning | Type | Default
+--- | --- | --- | ---
+`background` | Bar backgrund color | string | "#000000"
+`mute` | Bar mute color | string | "#EB8F8F"
+`unmute` | Bar unmute color | string | "#A4CE8A"
+
+### Default `notification_preset`
+
+```lua
+notification_preset = {
+ font = "Monospace 10"
+}
+```
+
+## Output table
+
+Variable | Meaning | Type
+--- | --- | ---
+`bar` | The widget | `wibox.widget.progressbar`
+`channel` | ALSA channel | string
+`notify` | The notification | function
+`update` | Update `bar` | function
+`tooltip` | The tooltip | `awful.tooltip`
+
+## Buttons
+
+If you want buttons, just add the following after your widget in `rc.lua`.
+
+```lua
+volume.bar:buttons(awful.util.table.join(
+ awful.button({}, 1, function() -- left click
+ awful.spawn(string.format("%s -e alsamixer", terminal))
+ end),
+ awful.button({}, 2, function() -- middle click
+ os.execute(string.format("%s set %s 100%%", volume.cmd, volume.channel))
+ volume.update()
+ end),
+ awful.button({}, 3, function() -- right click
+ os.execute(string.format("%s set %s toggle", volume.cmd, volume.togglechannel or volume.channel))
+ volume.update()
+ end),
+ awful.button({}, 4, function() -- scroll up
+ os.execute(string.format("%s set %s 1%%+", volume.cmd, volume.channel))
+ volume.update()
+ end),
+ awful.button({}, 5, function() -- scroll down
+ os.execute(string.format("%s set %s 1%%-", volume.cmd, volume.channel))
+ volume.update()
+ end)
+))
+```
+
+## Keybindings
+
+Read [here](https://github.com/lcpz/lain/wiki/alsa#keybindings). If you want notifications, use `volume.notify()` instead of `volume.update()`.
diff --git a/stow_home/awesome/.config/awesome/lain/wiki/bat.md b/stow_home/awesome/.config/awesome/lain/wiki/bat.md
new file mode 100644
index 0000000..fb98166
--- /dev/null
+++ b/stow_home/awesome/.config/awesome/lain/wiki/bat.md
@@ -0,0 +1,100 @@
+## Usage
+
+[Read here.](https://github.com/lcpz/lain/wiki/Widgets#usage)
+
+### Description
+
+Shows the remaining time and percentage capacity of your laptop battery, as well
+as the current wattage. Multiple batteries are supported.
+
+Displays a notification when battery is fully charged, low, or critical.
+
+```lua
+local mybattery = lain.widget.bat()
+```
+
+## Input table
+
+Variable | Meaning | Type | Default
+--- | --- | --- | ---
+`timeout` | Refresh timeout (in seconds) | integer | 30
+`pspath` | Power supply directory path | string | "/sys/class/power_supply/"
+`battery` | Single battery id | string | autodetected
+`batteries` | Multiple batteries id table | table of strings | autodetected
+`ac` | AC | string | autodetected
+`notify` | Show notification popups | string | "on"
+`full_notify` | Show a notification popup when the battery's fully charged | string | inherited value from `notify`
+`n_perc` | Percentages assumed for critical and low battery levels | table of integers | `{5, 15}`
+`settings` | User settings | function | empty function
+
+The widget will try to autodetect `battery`, `batteries` and `ac`. If something
+goes wrong, you will have to define them manually. In that case, you only have
+to define one between `battery` and `batteries`. If you have one battery, you
+can either use `args.battery = "BAT*"` or `args.batteries = {"BAT*"}`, where `BAT*`
+is the identifier of your battery in `pspath` (do not use it as a wildcard).
+Of course, if you have multiple batteries, you need to use the latter option.
+
+To disable notifications, set `notify` to `"off"`.
+
+If you define `pspath`, **be sure** to not forget the final slash (/).
+
+`settings` can use the `bat_now` table, which contains the following strings:
+
+- `status`, general status ("N/A", "Discharging", "Charging", "Full");
+- `n_status[i]`, i-th battery status (like above);
+- `ac_status`, AC-plug flag (0 if cable is unplugged, 1 if plugged, "N/A" otherwise);
+- `perc`, total charge percentage (integer between 0 and 100 or "N/A");
+- `n_perc[i]`, i-th battery charge percentage (like above);
+- `time`, time remaining until charge if charging, until discharge if discharging (HH:MM string or "N/A");
+- `watt`, battery watts (float with 2 decimals).
+
+and can modify the following three tables, which will be the preset for the naughty notifications:
+* `bat_notification_charged_preset` (used if battery is fully charged and connected to AC)
+* `bat_notification_low_preset` (used if battery charge level <= 15)
+* `bat_notification_critical_preset` (used if battery charge level <= 5)
+
+Check [here](https://awesomewm.org/doc/api/libraries/naughty.html#notify) for
+the list of variables they can contain. Default definitions:
+
+```lua
+bat_notification_charged_preset = {
+ title = "Battery full",
+ text = "You can unplug the cable",
+ timeout = 15,
+ fg = "#202020",
+ bg = "#CDCDCD"
+ }
+
+```
+
+```lua
+bat_notification_low_preset = {
+ title = "Battery low",
+ text = "Plug the cable!",
+ timeout = 15,
+ fg = "#202020",
+ bg = "#CDCDCD"
+}
+```
+```lua
+bat_notification_critical_preset = {
+ title = "Battery exhausted",
+ text = "Shutdown imminent",
+ timeout = 15,
+ fg = "#000000",
+ bg = "#FFFFFF"
+}
+```
+
+## Output table
+
+Variable | Meaning | Type
+--- | --- | ---
+`widget` | The widget | `wibox.widget.textbox`
+`update` | Update `widget` | function
+
+The `update` function can be used to refresh the widget before `timeout` expires.
+
+## Note
+
+Alternatively, you can try the [`upower` recipe](https://awesomewm.org/recipes/watch).
diff --git a/stow_home/awesome/.config/awesome/lain/wiki/cal.md b/stow_home/awesome/.config/awesome/lain/wiki/cal.md
new file mode 100644
index 0000000..3e14bf5
--- /dev/null
+++ b/stow_home/awesome/.config/awesome/lain/wiki/cal.md
@@ -0,0 +1,83 @@
+## Usage
+
+[Read here.](https://github.com/lcpz/lain/wiki/Widgets#usage)
+
+### Description
+
+Creates a calendar notification that can be attached to widgets.
+
+This is a simpler but [faster](https://github.com/awesomeWM/awesome/issues/1861)
+alternative to [`awful.widget.calendar_popup`](https://awesomewm.org/doc/api/classes/awful.widget.calendar_popup.html), which emulates UNIX's `cal`.
+
+```lua
+local mycal = lain.widget.cal()
+```
+
+## Input table
+
+Variable | Meaning | Type | Default
+--- | --- | --- | ---
+`attach_to` | List of widgets | table | empty table
+`week_start` | First day of the week | integer | 2 (Monday)
+`three` | Display three months spanning the date | boolean | false
+`followtag` | Display the notification on currently focused screen | boolean | false
+`week_number` | Display the week number | string ("none", "left" or "right") | "none"
+`week_number_format` | Week number format | string | `"%3d \| "` for "left", `"\| %-3d"` for "right"
+`icons` | Path to calendar icons | string | [icons/cal/white/](https://github.com/lcpz/lain/tree/master/icons/cal/white)
+`notification_preset` | Notification preset | table | See [default `notification_preset`](https://github.com/lcpz/lain/wiki/calendar#default-notification_preset)
+
+Set `attach_to` as the list of widgets to which you want to attach the calendar, like this:
+
+```lua
+local mycal = lain.widget.cal {
+ attach_to = { mywidget1, mywidget2, ... },
+ -- [...]
+}
+```
+
+For every widget in `attach_to`:
+
+- Left click / scroll down: switch to previous month.
+- Middle click show current month.
+- Right click / scroll up: switch to next month.
+
+With multiple screens, the default behaviour is to show a visual notification pop-up window on the first screen. By setting `followtag` to `true` it will be shown on the currently focused tag screen.
+
+### Default `notification_preset`
+
+```lua
+notification_preset = {
+ font = "Monospace 10",
+ fg = "#FFFFFF",
+ bg = "#000000"
+}
+```
+
+## Output table
+
+Variable | Meaning | Type
+--- | --- | ---
+`attach` | Attach the calendar to an input widget | function
+`show` | Show calendar | function
+`hide` | Hide calendar | function
+
+`attach` takes as argument any widget you want to attach the calendar to, while
+`show` takes as optional argument an integer to indicate the seconds to timeout.
+
+## Keybinding
+
+```lua
+awful.key({ altkey }, "c", function () mycal.show(7) end)
+```
+
+Where `altkey = "Mod1"`.
+
+## Notes
+
+* Naughty notifications require `notification_preset.font` to be **monospaced**, in order to correctly display the output.
+* If you want to [disable notification icon](https://github.com/lcpz/lain/pull/351), set `icons = ""` in the input table.
+* If you want to localise the calendar, put `os.setlocale(os.getenv("LANG"))` in your `rc.lua`.
+* If you want to get notifications [only with mouse clicks](https://github.com/lcpz/lain/issues/320) on a given widget, use this code:
+ ```lua
+ yourwidget:disconnect_signal("mouse::enter", mycal.hover_on)
+ ```
diff --git a/stow_home/awesome/.config/awesome/lain/wiki/cpu.md b/stow_home/awesome/.config/awesome/lain/wiki/cpu.md
new file mode 100644
index 0000000..c13d05a
--- /dev/null
+++ b/stow_home/awesome/.config/awesome/lain/wiki/cpu.md
@@ -0,0 +1,30 @@
+## Usage
+
+[Read here.](https://github.com/lcpz/lain/wiki/Widgets#usage)
+
+### Description
+
+Shows the current CPU usage, both in general and per core.
+
+```lua
+local mycpu = lain.widget.cpu()
+```
+
+## Input table
+
+Variable | Meaning | Type | Default
+--- | --- | --- | ---
+`timeout` | Refresh timeout (in seconds) | integer | 2
+`settings` | User settings | function | empty function
+
+`settings` can use these strings:
+
+* `cpu_now.usage`, the general use percentage;
+* `cpu_now[i].usage`, the i-th core use percentage, with `i` starting from 1.
+
+## Output table
+
+Variable | Meaning | Type
+--- | --- | ---
+`widget` | The widget | `wibox.widget.textbox`
+`update` | Update `widget` | function
\ No newline at end of file
diff --git a/stow_home/awesome/.config/awesome/lain/wiki/fs.md b/stow_home/awesome/.config/awesome/lain/wiki/fs.md
new file mode 100644
index 0000000..47d6bb2
--- /dev/null
+++ b/stow_home/awesome/.config/awesome/lain/wiki/fs.md
@@ -0,0 +1,82 @@
+## Usage
+
+[Read here.](https://github.com/lcpz/lain/wiki/Widgets#usage)
+
+### Description
+
+Shows file systems informations.
+
+If a partition is given in input, a notification will be displayed when it is almost full.
+
+```lua
+local mypartition = lain.widget.fs()
+```
+
+## Input table
+
+Variable | Meaning | Type | Default
+--- | --- | --- | ---
+`timeout` | Refresh timeout (in seconds) | integer | 600
+`partition` | (Optional) Partition to watch: a notification will be displayed when full | string | `nil`
+`threshold` | Percentage threshold at which the notification is triggered | integer | 99
+`notification_preset` | Notification preset | table | See [default `notification_preset`](https://github.com/lcpz/lain/wiki/fs#default-notification_preset)
+`followtag` | Display the notification on currently focused screen | boolean | false
+`showpopup` | Display popups with mouse hovering | string, possible values: "on", "off" | "on"
+`settings` | User settings | function | empty function
+
+`settings` can use the table `fs_now`, which contains a string entry for each file system path available. For instance, root infos are located in the variable `fs_now["/"]`. Every entry in this table have the following variables:
+
+Variable | Meaning | Type
+--- | --- | ---
+`units` | (multiple of) units used | string ("Kb", "Mb", "Gb", and so on)
+`percentage` | the used percentage | integer
+`size` | size in `units` of the given fs | float
+`used` | amount of space used in the given fs, expressed in `units` | float
+`free` | amount of free space in the given fs, expressed in `units` | float
+
+Usage example:
+
+```lua
+-- shows used (percentage) and remaining space in home partition
+local fsroothome = lain.widget.fs({
+ settings = function()
+ widget:set_text("/home: " .. fs_now["/home"].percentage .. "% (" ..
+ fs_now["/home"].free .. " " .. fs_now["/home"].units .. " left)")
+ end
+})
+-- output example: "/home: 37% (239.4 Gb left)"
+```
+
+With multiple screens, the default behaviour is to show a visual notification pop-up window on the first screen. By setting `followtag` to `true` it will be shown on the currently focused tag screen.
+
+### Default `notification_preset`
+
+```lua
+notification_preset = {
+ font = "Monospace 10",
+ fg = "#FFFFFF",
+ bg = "#000000"
+}
+```
+
+## Output table
+
+Variable | Meaning | Type
+--- | --- | ---
+`widget` | The widget | `wibox.widget.textbox`
+`show` | The notification | function
+
+You can display the notification with a key binding like this:
+
+```lua
+awful.key({ altkey }, "h", function () mypartition.show(seconds, scr) end),
+```
+
+where ``altkey = "Mod1"`` and ``show`` arguments, both optionals, are:
+
+* `seconds`, notification time in seconds
+* `scr`, screen which to display the notification in
+
+## Note
+
+Naughty notifications require `notification_preset.font` to be **monospaced**, in order to correctly display the output.
diff --git a/stow_home/awesome/.config/awesome/lain/wiki/imap.md b/stow_home/awesome/.config/awesome/lain/wiki/imap.md
new file mode 100644
index 0000000..683777e
--- /dev/null
+++ b/stow_home/awesome/.config/awesome/lain/wiki/imap.md
@@ -0,0 +1,115 @@
+## Usage
+
+[Read here.](https://github.com/lcpz/lain/wiki/Widgets#usage)
+
+### Description
+
+Shows mails count fetching over IMAP.
+
+```lua
+local myimap = lain.widget.imap(args)
+```
+
+New mails are notified like this:
+
+ +--------------------------------------------+
+ | +---+ |
+ | |\ /| donald@disney.org has 3 new messages |
+ | +---+ |
+ +--------------------------------------------+
+
+## Input table
+
+Required parameters are:
+
+Variable | Meaning | Type
+--- | --- | ---
+`server` | Mail server | string
+`mail` | User mail | string
+`password` | User password | string
+
+while the optional are:
+
+Variable | Meaning | Type | Default
+--- | --- | --- | ---
+`port` | IMAP port | integer | 993
+`timeout` | Refresh timeout (in seconds) | integer | 60
+`pwdtimeout` | Timeout for password retrieval function (see [here](https://github.com/lcpz/lain/wiki/imap#password-security)) | integer | 10
+`is_plain` | Define whether `password` is a plain password (true) or a command that retrieves it (false) | boolean | false
+`followtag` | Notification behaviour | boolean | false
+`notify` | Show notification popups | string | "on"
+`settings` | User settings | function | empty function
+
+`settings` can use `imap_now` table, which contains the following non negative integers:
+
+- `["MESSAGES"]`
+- `["RECENT"]`
+- `["UNSEEN"]`
+
+example of fetch: `total = imap_now["MESSAGES"]`. For backwards compatibility, `settings` can also use `mailcount`, a pointer to `imap_now["UNSEEN"]`.
+
+Also, `settings` can modify `mail_notification_preset` table, which will be the preset for the naughty notifications. Check [here](https://awesomewm.org/apidoc/libraries/naughty.html#notify) for the list of variables it can contain. Default definition:
+
+```lua
+mail_notification _preset = {
+ icon = "lain/icons/mail.png",
+ position = "top_left"
+}
+```
+
+Note that `mailcount` and `imap_now` elements are equals to 0 either if there are no new mails or credentials are invalid, so make sure that your settings are correct.
+
+With multiple screens, the default behaviour is to show a visual notification pop-up window on the first screen. By setting `followtag` to `true` it will be shown on the currently focused tag screen.
+
+You can have multiple instances of this widget at the same time.
+
+## Password security
+
+The reason why `is_plain` is false by default is to discourage the habit of storing passwords in plain.
+
+In general, when `is_plain == false`, `password` can be either a string, a table or a function: the widget will execute it asynchronously in the first two cases.
+
+### Using plain passwords
+
+You can set your password in plain like this:
+
+```lua
+myimapcheck = lain.widget.imap {
+ is_plain = true,
+ password = "mymailpassword",
+ -- [...]
+}
+```
+
+and you will have the same security provided by `~/.netrc`.
+
+### Using a password manager
+
+I recommend to use [spm](https://notabug.org/kl3/spm) or [pass](https://www.passwordstore.org). In this case, `password` has to be a function. Example stub:
+
+```lua
+myimapcheck = lain.widget.imap {
+ password = function()
+ -- do your retrieval
+ return retrieved_password, try_again
+ end,
+ -- [...]
+}
+```
+
+Where `retrieved_password` is the password retrieved from the manager, and `try_again` supports [DBus Secret Service](https://specifications.freedesktop.org/secret-service).
+
+The process flow is that the first `password()` call spawns the unlock prompt, then the second call retrieves the password. [Here](https://gist.github.com/lcpz/1854fc4320f4701957cd5309c8eed4a6) is an example of `password` function.
+
+## Output table
+
+Variable | Meaning | Type
+--- | --- | ---
+`widget` | The widget | `wibox.widget.textbox`
+`update` | Update `widget` | function
+`timer` | The widget timer | [`gears.timer`](https://awesomewm.org/doc/api/classes/gears.timer.html)
+`pwdtimer` | Password retrieval timer (available only if `password` is a function)| [`gears.timer`](https://awesomewm.org/doc/api/classes/gears.timer.html)
+
+The `update` function can be used to refresh the widget before `timeout` expires.
+
+You can use `timer` to start/stop the widget as you like.
diff --git a/stow_home/awesome/.config/awesome/lain/wiki/mem.md b/stow_home/awesome/.config/awesome/lain/wiki/mem.md
new file mode 100644
index 0000000..205d535
--- /dev/null
+++ b/stow_home/awesome/.config/awesome/lain/wiki/mem.md
@@ -0,0 +1,33 @@
+## Usage
+
+[Read here.](https://github.com/lcpz/lain/wiki/Widgets#usage)
+
+### Description
+
+Shows memory status in MiB, [like `top` and `free -h`](https://github.com/lcpz/lain/issues/271).
+
+```lua
+local mymem = lain.widget.mem()
+```
+
+## Input table
+
+Variable | Meaning | Type | Default
+--- | --- | --- | ---
+`timeout` | Refresh timeout (in seconds) | integer | 2
+`settings` | User settings | function | empty function
+
+in `settings` you can use the following variables:
+
+Variable | Meaning | Type
+--- | --- | ---
+`mem_now.used` | Memory used (MiB) | string
+`mem_now.swapused` | Swap memory used (MiB) | string
+`mem_now.perc` | Memory percentage | int
+
+## Output table
+
+Variable | Meaning | Type
+--- | --- | ---
+`widget` | The widget | `wibox.widget.textbox`
+`update` | Update `widget` | function
\ No newline at end of file
diff --git a/stow_home/awesome/.config/awesome/lain/wiki/moc.md b/stow_home/awesome/.config/awesome/lain/wiki/moc.md
new file mode 100644
index 0000000..130bccb
--- /dev/null
+++ b/stow_home/awesome/.config/awesome/lain/wiki/moc.md
@@ -0,0 +1,122 @@
+## Usage
+
+[Read here.](https://github.com/lcpz/lain/wiki/Widgets#usage)
+
+### Description
+
+A widget for showing the current song track's information from MOC (Music On Console).
+
+```lua
+local mymoc = lain.widget.contrib.moc()
+```
+
+Now playing songs are notified like this:
+
+ +--------------------------------------------------------+
+ | +-------+ |
+ | |/^\_/^\| Now playing |
+ | |\ O O /| Cannibal Corpse (Hammer Smashed Face) - 1993 |
+ | | '.o.' | Hammer Smashed Face (Radio Disney Version) |
+ | +-------+ |
+ +--------------------------------------------------------+
+
+## Input table
+
+Variable | Meaning | Type | Default
+--- | --- | --- | ---
+`timeout` | Refresh timeout (in seconds) | integer | 1
+`music_dir` | Music directory | string | "~/Music"
+`cover_size` | Album art notification size (both height and width) | integer | 100
+`cover_pattern` | Pattern for the album art file | string | `*\\.(jpg|jpeg|png|gif)`*
+`default_art` | Default art | string | ""
+`followtag` | Display the notification on currently focused screen | boolean | false
+`settings` | User settings | function | empty function
+
+\* In Lua, "\\\\" means "\" escaped.
+
+Default `cover_pattern` definition will made the widget set the first jpg, jpeg, png or gif file found in the directory as the album art.
+
+Pay attention to case sensitivity when defining `music_dir`.
+
+`settings` can use `moc_now` table, which contains the following string values:
+
+- state (possible values: "PLAY", "PAUSE", "STOP")
+- file
+- artist
+- title
+- album
+- elapsed (Time elapsed for the current track)
+- total (The current track's total time)
+
+and can modify `moc_notification_preset` table, which will be the preset for the naughty notifications. Check [here](https://awesomewm.org/apidoc/libraries/naughty.html#notify) for the list of variables it can contain. Default definition:
+
+```lua
+moc_notification_preset = {
+ title = "Now playing",
+ timeout = 6,
+ text = string.format("%s (%s) - %s\n%s", moc_now.artist,
+ moc_now.album, moc_now.elapsed, moc_now.title)
+}
+```
+
+With multiple screens, the default behaviour is to show a visual notification pop-up window on the first screen. By setting `followtag` to `true` it will be shown on the currently focused tag screen.
+
+## Output table
+
+Variable | Meaning | Type
+--- | --- | ---
+`widget` | The widget | `wibox.widget.textbox`
+`update` | Update `widget` | function
+`timer` | The widget timer | [`gears.timer`](https://awesomewm.org/doc/api/classes/gears.timer.html)
+
+The `update` function can be used to refresh the widget before `timeout` expires.
+
+You can use `timer` to start/stop the widget as you like.
+
+## Keybindings
+
+You can control the widget with key bindings like these:
+
+```lua
+-- MOC control
+awful.key({ altkey, "Control" }, "Up",
+ function ()
+ os.execute("mocp -G") -- toggle
+ moc.update()
+ end),
+awful.key({ altkey, "Control" }, "Down",
+ function ()
+ os.execute("mocp -s") -- stop
+ moc.update()
+ end),
+awful.key({ altkey, "Control" }, "Left",
+ function ()
+ os.execute("mocp -r") -- previous
+ moc.update()
+ end),
+awful.key({ altkey, "Control" }, "Right",
+ function ()
+ os.execute("mocp -f") -- next
+ moc.update()
+ end),
+```
+
+where `altkey = "Mod1"`.
+
+If you don't use the widget for long periods and wish to spare CPU, you can toggle it with a keybinding like this:
+
+```lua
+-- toggle MOC widget
+awful.key({ altkey }, "0",
+ function ()
+ local common = { text = "MOC widget ", position = "top_middle", timeout = 2 }
+ if moc.timer.started then
+ moc.timer:stop()
+ common.text = common.text .. markup.bold("OFF")
+ else
+ moc.timer:start()
+ common.text = common.text .. markup.bold("ON")
+ end
+ naughty.notify(common)
+ end),
+```
diff --git a/stow_home/awesome/.config/awesome/lain/wiki/mpd.md b/stow_home/awesome/.config/awesome/lain/wiki/mpd.md
new file mode 100644
index 0000000..cd114a5
--- /dev/null
+++ b/stow_home/awesome/.config/awesome/lain/wiki/mpd.md
@@ -0,0 +1,180 @@
+## Usage
+
+[Read here.](https://github.com/lcpz/lain/wiki/Widgets#usage)
+
+### Description
+
+Shows MPD status.
+
+```lua
+local mympd = lain.widget.mpd()
+```
+
+Now playing songs are notified like this:
+
+ +--------------------------------------------------------+
+ | +-------+ |
+ | |/^\_/^\| Now playing |
+ | |\ O O /| Cannibal Corpse (Hammer Smashed Face) - 1993 |
+ | | '.o.' | Hammer Smashed Face (Radio Disney Version) |
+ | +-------+ |
+ +--------------------------------------------------------+
+
+**Note:** if MPD is turned off or not set correctly, the widget will constantly display "N/A" values.
+
+## Input table
+
+Variable | Meaning | Type | Default
+--- | --- | --- | ---
+`timeout` | Refresh timeout (in seconds) | integer | 2
+`password` | MPD password | string | ""
+`host` | MPD server | string | "127.0.0.1"
+`port` | MPD port | string | "6600"
+`music_dir` | Music directory | string | "~/Music"
+`cover_size` | Album art notification size (both height and width) | integer | 100
+`cover_pattern` | Pattern for the album art file | string | `*.(jpg\|jpeg\|png\|gif)$`
+`default_art` | Default art | string | `nil`
+`notify` | Show notification popups | string | "on"
+`followtag` | Notification behaviour | boolean | false
+`settings` | User settings | function | empty function
+
+\* In Lua, "\\\\" means "\" escaped.
+
+Default `cover_pattern` definition will made the widget set the first jpg, jpeg, png or gif file found in the directory as the album art.
+
+Pay attention to case sensitivity when defining `music_dir`.
+
+`settings` can use `mpd_now` table, which contains the following values:
+
+(**note:** the first four are boolean [flags](https://github.com/lcpz/lain/pull/205), the remaining are all strings)
+
+- random_mode
+- single_mode
+- repeat_mode
+- consume_mode
+- pls_pos (playlist position)
+- pls_len (playlist length)
+- state (possible values: "play", "pause", "stop")
+- file
+- artist
+- title
+- name
+- album
+- track
+- genre
+- date
+- [time](https://github.com/lcpz/lain/pull/90) (length of current song, in seconds)
+- [elapsed](https://github.com/lcpz/lain/pull/90) (elapsed time of current song, in seconds)
+
+and can modify `mpd_notification_preset` table, which will be the preset for the naughty notifications. Check [here](https://awesomewm.org/doc/api/libraries/naughty.html#notify) for the list of variables it can contain. Default definition:
+
+```lua
+mpd_notification_preset = {
+ title = "Now playing",
+ timeout = 6,
+ text = string.format("%s (%s) - %s\n%s", mpd_now.artist,
+ mpd_now.album, mpd_now.date, mpd_now.title)
+}
+```
+
+With multiple screens, the default behaviour is to show a visual notification pop-up window on the first screen. By setting `followtag` to `true` it will be shown on the currently focused tag screen.
+
+## Output table
+
+Variable | Meaning | Type
+--- | --- | ---
+`widget` | The textbox | `wibox.widget.textbox`
+`update` | Update `widget` | function
+`timer` | The widget timer | [`gears.timer`](https://awesomewm.org/doc/api/classes/gears.timer.html)
+
+The `update` function can be used to refresh the widget before `timeout` expires.
+
+You can use `timer` to start/stop the widget as you like.
+
+## Keybindings
+
+You can control the widget with keybindings like these:
+
+```lua
+-- MPD control
+awful.key({ altkey, "Control" }, "Up",
+ function ()
+ awful.spawn.with_shell("mpc toggle || ncmpc toggle || pms toggle")
+ mympd.update()
+ end),
+awful.key({ altkey, "Control" }, "Down",
+ function ()
+ awful.spawn.with_shell("mpc stop || ncmpc stop || pms stop")
+ mympd.update()
+ end),
+awful.key({ altkey, "Control" }, "Left",
+ function ()
+ awful.spawn.with_shell("mpc prev || ncmpc prev || pms prev")
+ mympd.update()
+ end),
+awful.key({ altkey, "Control" }, "Right",
+ function ()
+ awful.spawn.with_shell("mpc next || ncmpc next || pms next")
+ mympd.update()
+ end),
+```
+
+where `altkey = "Mod1"`.
+
+If you don't use the widget for long periods and wish to spare CPU, you can toggle it with a keybinding like this:
+
+```lua
+-- disable MPD widget
+awful.key({ altkey }, "0",
+ function ()
+ local common = {
+ text = "MPD widget ",
+ position = "top_middle",
+ timeout = 2
+ }
+ if mympd.timer.started then
+ mympd.timer:stop()
+ common.text = common.text .. markup.bold("OFF")
+ else
+ mympd.timer:start()
+ common.text = common.text .. markup.bold("ON")
+ end
+ naughty.notify(common)
+ end),
+```
+
+## Notes
+
+### Cover not showing in notifications
+
+If the cover file is existent but not showed in notifications, [try](https://github.com/lcpz/lain/issues/393) setting `music_dir` to a symlink of your music folder, rather than to a physical path. This can be easily done through
+```shell
+ln -s /the/real_path_to_your_music/ /home/username/Music
+```
+However, this only applies if the music is stored outside your user-specific folder, for instance in an external partition.
+
+### Always use `set_markup`
+
+In `settings`, if you use `widget:set_text`, [it will ignore Pango markup](https://github.com/lcpz/lain/issues/258), so be sure to always use `widget:set_markup`.
+
+### Volume fade in toggling MPD
+
+If you want a fade in/out in toggling MPD, you can put [this script](https://gist.github.com/lcpz/76e315bc27c6cdf7edd5021964b88df1) in your local `bin` directory:
+
+```shell
+$ curl https://gist.githubusercontent.com/lcpz/76e315bc27c6cdf7edd5021964b88df1/raw/97f7ba586418a4e07637cfbc91d2974278dfa623/mpd-fade -o ~/bin/mpc-fade
+$ chmod +x ~/bin/mpc-fade
+```
+
+Set your 1% decrease/increase commands [here](https://gist.github.com/lcpz/76e315bc27c6cdf7edd5021964b88df1#file-mpd-fade-L8-L9), then use a keybinding like this:
+
+```lua
+-- MPD toggle with volume fading
+awful.key({ "Shift" }, "Pause",
+ function()
+ awful.spawn.easy_async("mpc-fade 20 4", -- mpc-fade
+ function(stdout, stderr, reason, exit_code)
+ mympd.update()
+ end)
+ end),
+```
diff --git a/stow_home/awesome/.config/awesome/lain/wiki/net.md b/stow_home/awesome/.config/awesome/lain/wiki/net.md
new file mode 100644
index 0000000..252399e
--- /dev/null
+++ b/stow_home/awesome/.config/awesome/lain/wiki/net.md
@@ -0,0 +1,115 @@
+## Usage
+
+[Read here.](https://github.com/lcpz/lain/wiki/Widgets#usage)
+
+### Description
+
+Monitors network interfaces and shows current traffic.
+
+```lua
+local mynet = lain.widget.net()
+```
+
+## Input table
+
+Variable | Meaning | Type | Default
+--- | --- | --- | ---
+`timeout` | Refresh timeout (in seconds) | integer | 2
+`iface` | Network device(s) | string (single interface) or table of strings (multiple interfaces) | autodetected
+`units` | Units | integer | 1024 (kilobytes)
+`notify` | Display "no carrier" notifications | string | "on"
+`wifi_state` | Get wifi connection status | string | "off"
+`eth_state` | Get ethernet connection status | string | "off"
+`screen` | Notifications screen | integer | 1
+`settings` | User settings | function | empty function
+
+`iface` can be a string or an table of the form `{ "eth0", "eth1", ... }` containing a list of the devices to collect data on.
+
+If more than one device is included, `net_now.sent` and `net_now.received` will contain cumulative values over all given devices.
+Use `net_now.devices["eth0"]` to access `sent`, `received`, `state` or `carrier` per device.
+
+Possible alternative values for `units` are 1 (byte) or multiple of 1024: 1024^2 (mb), 1024^3 (gb), and so on.
+
+If `notify = "off"` is set, the widget won't display a notification when there's no carrier.
+
+`settings` can use the following `iface` related strings:
+
+- `net_now.carrier` ("0", "1");
+- `net_now.state` ("up", "down");
+- `net_now.sent` and `net_now.received` (numbers) will be the sum across all specified interfaces;
+- `net_now.devices["interface"]` contains the same attributes as the old api for each interface. More on this in the "Multiple devices" section below.
+
+If `wifi_state = "on"` is set, `settings` can use the following extra strings attached to `net_now.devices["wireless interface"]`:
+- `wifi` (true, false) indicates if the interface is connected to a network;
+- `signal` (number) is the connection signal strength in dBm;
+
+If `eth_state = "on"` is set, `settings` can use the following extra string: `net_now.devices["ethernet interface"].ethernet`, which is a boolean indicating if an ethernet connection's active.
+
+For compatibility reasons, if multiple devices are given, `net_now.carrier` and `net_now.state` correspond to the last interface in the iface table and should not be relied upon (deprecated).
+
+## Output table
+
+Variable | Meaning | Type
+--- | --- | ---
+`widget` | The widget | `wibox.widget.textbox`
+`update` | Update `widget` | function
+
+## Notes
+
+### Setting `iface` manually
+
+If the widget [spawns a "no carrier" notification and you are sure to have an active network device](https://github.com/lcpz/lain/issues/102), then autodetection is probably not working. This may due to [your user privileges](https://github.com/lcpz/lain/issues/102#issuecomment-246470526). In this case you can set `iface` manually. You can see which device is **UP,LOWER_UP** with the following command:
+
+```shell
+ip link show
+```
+## Usage examples
+### Two widgets for upload/download rates from the same `iface`
+
+```lua
+local mynetdown = wibox.widget.textbox()
+local mynetup = lain.widget.net {
+ settings = function()
+ widget:set_markup(net_now.sent)
+ netdowninfo:set_markup(net_now.received)
+ end
+}
+```
+### Wifi connection + signal strength indicator and ethernet connection indicator
+```lua
+local wifi_icon = wibox.widget.imagebox()
+local eth_icon = wibox.widget.imagebox()
+local net = lain.widget.net {
+ notify = "off",
+ wifi_state = "on",
+ eth_state = "on",
+ settings = function()
+ local eth0 = net_now.devices.eth0
+ if eth0 then
+ if eth0.ethernet then
+ eth_icon:set_image(ethernet_icon_filename)
+ else
+ eth_icon:set_image()
+ end
+ end
+
+ local wlan0 = net_now.devices.wlan0
+ if wlan0 then
+ if wlan0.wifi then
+ local signal = wlan0.signal
+ if signal < -83 then
+ wifi_icon:set_image(wifi_weak_filename)
+ elseif signal < -70 then
+ wifi_icon:set_image(wifi_mid_filename)
+ elseif signal < -53 then
+ wifi_icon:set_image(wifi_good_filename)
+ elseif signal >= -53 then
+ wifi_icon:set_image(wifi_great_filename)
+ end
+ else
+ wifi_icon:set_image()
+ end
+ end
+ end
+}
+```
diff --git a/stow_home/awesome/.config/awesome/lain/wiki/pulse.md b/stow_home/awesome/.config/awesome/lain/wiki/pulse.md
new file mode 100644
index 0000000..cea432a
--- /dev/null
+++ b/stow_home/awesome/.config/awesome/lain/wiki/pulse.md
@@ -0,0 +1,135 @@
+## Usage
+
+[Read here.](https://github.com/lcpz/lain/wiki/Widgets#usage)
+
+### Description
+
+Shows and controls PulseAudio volume.
+
+```lua
+local volume = lain.widget.pulse()
+```
+
+## Input table
+
+Variable | Meaning | Type | Default
+--- | --- | --- | ---
+`timeout` | Refresh timeout (in seconds) | integer | 5
+`devicetype` | PulseAudio device type | string ("sink", "source") | "sink"
+`cmd` | PulseAudio command | string or function | see [here](https://github.com/lcpz/lain/blob/master/widget/pulse.lua#L26)
+`settings` | User settings | function | empty function
+
+`cmd` is a terminal command to catch infos from current default device. You can redefine it, being sure that the ouput is something like this:
+
+```shell
+* index: 0
+ volume: front-left: 18340 / 28% / -33.18 dB, front-right: 18340 / 28% / -33.18 dB
+ muted: no
+ device.string = "front:1"
+```
+
+If your devices change dynamically, you can define it as a function which returns a command string.
+
+If sed doesn't work, you can try with a grep variant:
+
+```lua
+cmd = "pacmd list-" .. pulse.devicetype .. "s | grep -e $(pactl info | grep -e 'ink' | cut -d' ' -f3) -e 'volume: front' -e 'muted'"
+```
+
+### `settings` variables
+
+`settings` can use the following variables:
+
+Variable | Meaning | Type | Values
+--- | --- | --- | ---
+`volume_now.device` | Device name | string | device name or "N/A"
+`volume_now.index` | Device index | string | >= "0"
+`volume_now.muted` | Device mute status | string | "yes", "no", "N/A"
+`volume_now.channel` | Device channels | table of string integers | `volume_now.channel[i]`, where `i >= 1`
+`volume_now.left` | Front left sink level or first source | string | "0"-"100"
+`volume_now.right` | Front right sink level or second source | string | "0"-"100"
+
+`volume_now.channel` is a table of your PulseAudio devices. Fetch a channel level like this: `volume_now.channel[i]`, where `i >= 1`.
+
+`volume_now.{left,right}` are pointers for `volume_now.{channel[1], channel[2]}` (stereo).
+
+## Output table
+
+Variable | Meaning | Type
+--- | --- | ---
+`widget` | The widget | `wibox.widget.textbox`
+`update` | Update `widget` | function
+
+## Buttons
+
+```lua
+volume.widget:buttons(awful.util.table.join(
+ awful.button({}, 1, function() -- left click
+ awful.spawn("pavucontrol")
+ end),
+ awful.button({}, 2, function() -- middle click
+ os.execute(string.format("pactl set-sink-volume %s 100%%", volume.device))
+ volume.update()
+ end),
+ awful.button({}, 3, function() -- right click
+ os.execute(string.format("pactl set-sink-mute %s toggle", volume.device))
+ volume.update()
+ end),
+ awful.button({}, 4, function() -- scroll up
+ os.execute(string.format("pactl set-sink-volume %s +1%%", volume.device))
+ volume.update()
+ end),
+ awful.button({}, 5, function() -- scroll down
+ os.execute(string.format("pactl set-sink-volume %s -1%%", volume.device))
+ volume.update()
+ end)
+))
+```
+
+## Keybindings
+
+```lua
+-- PulseAudio volume control
+awful.key({ altkey }, "Up",
+ function ()
+ os.execute(string.format("pactl set-sink-volume %s +1%%", volume.device))
+ volume.update()
+ end),
+awful.key({ altkey }, "Down",
+ function ()
+ os.execute(string.format("pactl set-sink-volume %s -1%%", volume.device))
+ volume.update()
+ end),
+awful.key({ altkey }, "m",
+ function ()
+ os.execute(string.format("pactl set-sink-mute %s toggle", volume.device))
+ volume.update()
+ end),
+awful.key({ altkey, "Control" }, "m",
+ function ()
+ os.execute(string.format("pactl set-sink-volume %s 100%%", volume.device))
+ volume.update()
+ end),
+awful.key({ altkey, "Control" }, "0",
+ function ()
+ os.execute(string.format("pactl set-sink-volume %s 0%%", volume.device))
+ volume.update()
+ end),
+```
+
+where `altkey = "Mod1"`.
+
+## Example
+
+```lua
+-- PulseAudio volume (based on multicolor theme)
+local volume = lain.widget.pulse {
+ settings = function()
+ vlevel = volume_now.left .. "-" .. volume_now.right .. "% | " .. volume_now.device
+ if volume_now.muted == "yes" then
+ vlevel = vlevel .. " M"
+ end
+ widget:set_markup(lain.util.markup("#7493d2", vlevel))
+ end
+}
+```
diff --git a/stow_home/awesome/.config/awesome/lain/wiki/pulsebar.md b/stow_home/awesome/.config/awesome/lain/wiki/pulsebar.md
new file mode 100644
index 0000000..de3a475
--- /dev/null
+++ b/stow_home/awesome/.config/awesome/lain/wiki/pulsebar.md
@@ -0,0 +1,98 @@
+## Usage
+
+[Read here.](https://github.com/lcpz/lain/wiki/Widgets#usage)
+
+### Description
+
+Shows PulseAudio volume with a progressbar; provides tooltips and notifications.
+
+```lua
+local volume = lain.widget.pulsebar()
+```
+
+## Input table
+
+Variable | Meaning | Type | Default
+--- | --- | --- | ---
+`timeout` | Refresh timeout (in seconds) | integer | 5
+`settings` | User settings | function | empty function
+`width` | Bar width | number | 63
+`height` | Bar height | number | 1
+`margins` | Bar margins | number | 1
+`paddings` | Bar paddings | number | 1
+`ticks` | Set bar ticks on | boolean | false
+`ticks_size` | Ticks size | number | 7
+`tick` | String for a notification tick | string | "|"
+`tick_pre` | String for the left notification delimeter | string | "["
+`tick_post` | String for the right notification delimeter | string | "]"
+`tick_none` | String for an empty notification tick | string | " "
+`scallback` | [PulseAudio sink callback](https://github.com/lcpz/lain/wiki/pulseaudio/) | function | `nil`
+`sink` | Mixer sink | number | 0
+`colors` | Bar colors | table | see [Default colors](https://github.com/lcpz/lain/wiki/pulsebar#default-colors)
+`notification_preset` | Notification preset | table | See [default `notification_preset`](https://github.com/lcpz/lain/wiki/pulsebar#default-notification_preset)
+`followtag` | Display the notification on currently focused screen | boolean | false
+`notification_preset` | Notification preset | table | See [default `notification_preset`](https://github.com/lcpz/lain/wiki/pulsebar#default-notification_preset)
+`devicetype` | PulseAudio device type | string ("sink", "source") | "sink"
+`cmd` | PulseAudio command | string or function | see [here](https://github.com/lcpz/lain/blob/master/widget/pulsebar.lua#L48)
+
+Read [pulse](https://github.com/lcpz/lain/wiki/pulse) page for `cmd` settings.
+
+`settings` can use [these variables](https://github.com/lcpz/lain/wiki/pulse#settings-variables).
+
+With multiple screens, the default behaviour is to show a visual notification pop-up window on the first screen. By setting `followtag` to `true` it will be shown on the currently focused tag screen.
+
+### Default colors
+
+Variable | Meaning | Type | Default
+--- | --- | --- | ---
+`background` | Bar backgrund color | string | "#000000"
+`mute` | Bar mute color | string | "#EB8F8F"
+`unmute` | Bar unmute color | string | "#A4CE8A"
+
+### Default `notification_preset`
+
+```lua
+notification_preset = {
+ font = "Monospace 10"
+}
+```
+
+## Output table
+
+Variable | Meaning | Type
+--- | --- | ---
+`bar` | The widget | `wibox.widget.progressbar`
+`device` | PulseAudio device | string
+`notify` | The notification | function
+`update` | Update state | function
+`tooltip` | The tooltip | `awful.tooltip`
+
+## Buttons
+
+```lua
+volume.bar:buttons(awful.util.table.join(
+ awful.button({}, 1, function() -- left click
+ awful.spawn("pavucontrol")
+ end),
+ awful.button({}, 2, function() -- middle click
+ os.execute(string.format("pactl set-sink-volume %d 100%%", volume.device))
+ volume.update()
+ end),
+ awful.button({}, 3, function() -- right click
+ os.execute(string.format("pactl set-sink-mute %d toggle", volume.device))
+ volume.update()
+ end),
+ awful.button({}, 4, function() -- scroll up
+ os.execute(string.format("pactl set-sink-volume %d +1%%", volume.device))
+ volume.update()
+ end),
+ awful.button({}, 5, function() -- scroll down
+ os.execute(string.format("pactl set-sink-volume %d -1%%", volume.device))
+ volume.update()
+ end)
+))
+```
+
+## Keybindings
+
+Same as [here](https://github.com/lcpz/lain/wiki/pulse#keybindings). If you want notifications, use `volume.notify()` instead of `volume.update()`.
diff --git a/stow_home/awesome/.config/awesome/lain/wiki/redshift.md b/stow_home/awesome/.config/awesome/lain/wiki/redshift.md
new file mode 100644
index 0000000..b83ad3a
--- /dev/null
+++ b/stow_home/awesome/.config/awesome/lain/wiki/redshift.md
@@ -0,0 +1,100 @@
+### What is Redshift? #
+
+[**Project homepage**](http://jonls.dk/redshift/)
+
+>**Redshift** is an application that adjusts the computer display's color temperature based upon the Sun's apparent position in relation to the user's location on Earth.
+>
+>The program is free software, inspired by the proprietary f.lux, and can be used to reduce eye strain as well as insomnia and delayed sleep phase syndrome.
+>
+>The computer display's color temperature transitions evenly from night to daytime temperature to allow the user's eyes to slowly adapt. At night, the color temperature is low and is typically 3000–4000 K (default is 3500 K), preferably matching the room's lighting temperature. Typical color temperature during the daytime is 5500–6500 K (default is 5500 K).
+
+**Source:** [Wikipedia](https://en.wikipedia.org/wiki/Redshift_%28software%29)
+
+### Preparations
+
+**Redshift must be installed** on your system if you want to use this widget.
+
+Packages should be available for most distributions. Source code and build instructions can be found on Github [here](https://github.com/jonls/redshift).
+
+You also need a valid config file. Please see the [project homepage](http://jonls.dk/redshift/) for details. An example: [`~/.config/redshift.conf`](https://github.com/jonls/redshift/blob/master/redshift.conf.sample).
+
+You have to match the location settings to your personal situation: you can adjust the `lat` and `lon` variables using a [web service](https://encrypted.google.com/search?q=get+latitude+and+longitude).
+
+You might also want to modify the color temperatures to fit your preferences.
+
+### Using the widget
+
+This widget provides the following functions:
+
+| function | meaning |
+| --- | --- |
+| `redshift:toggle()` | Toggles Redshift adjustments on or off, and also restarts it if terminates. |
+| `redshift:attach(widget, update_function)` | Attach to a widget. Click on the widget to toggle redshift on or off. `update_function` is a callback function which will be triggered each time Redshift changes its status. (See the examples below.) |
+
+### Usage examples
+
+#### Textbox status widget
+
+```lua
+myredshift = wibox.widget.textbox()
+lain.widget.contrib.redshift:attach(
+ myredshift,
+ function (active)
+ if active then
+ myredshift:set_text("RS on")
+ else
+ myredshift:set_text("RS off")
+ end
+ end
+)
+```
+
+Then add `myredshift.widget` to your wibox.
+
+#### Checkbox status widget
+
+```lua
+local markup = lain.util.markup
+
+local myredshift = wibox.widget{
+ checked = false,
+ check_color = "#EB8F8F",
+ border_color = "#EB8F8F",
+ border_width = 1,
+ shape = gears.shape.square,
+ widget = wibox.widget.checkbox
+}
+
+local myredshift_text = wibox.widget{
+ align = "center",
+ widget = wibox.widget.textbox,
+}
+
+local myredshift_stack = wibox.widget{
+ myredshift,
+ myredshift_text,
+ layout = wibox.layout.stack
+}
+
+lain.widget.contrib.redshift:attach(
+ myredshift,
+ function (active)
+ if active then
+ myredshift_text:set_markup(markup(beautiful.bg_normal, "R"))
+ else
+ myredshift_text:set_markup(markup(beautiful.fg_normal, "R"))
+ end
+ myredshift.checked = active
+ end
+)
+```
+
+Then add the `myredshift_stack` widget to your wibox.
+
+#### Keybinding
+
+Add this to the keybindings in your `rc.lua`:
+```lua
+-- Toggle redshift with Mod+Shift+t
+awful.key({ modkey, "Shift" }, "t", function () lain.widget.contrib.redshift:toggle() end),
+```
\ No newline at end of file
diff --git a/stow_home/awesome/.config/awesome/lain/wiki/sysload.md b/stow_home/awesome/.config/awesome/lain/wiki/sysload.md
new file mode 100644
index 0000000..6fb1c04
--- /dev/null
+++ b/stow_home/awesome/.config/awesome/lain/wiki/sysload.md
@@ -0,0 +1,27 @@
+## Usage
+
+[Read here.](https://github.com/lcpz/lain/wiki/Widgets#usage)
+
+### Description
+
+Shows the current system load.
+
+```lua
+mysysload = lain.widget.sysload()
+```
+
+## Input table
+
+Variable | Meaning | Type | Default
+--- | --- | --- | ---
+`timeout` | Refresh timeout (in seconds) | integer | 2
+`settings` | User settings | function | empty function
+
+`settings` can use strings `load_1`, `load_5` and `load_15`, which are the load averages over 1, 5, and 15 minutes.
+
+## Output table
+
+Variable | Meaning | Type
+--- | --- | ---
+`widget` | The widget | `wibox.widget.textbox`
+`update` | Update `widget` | function
\ No newline at end of file
diff --git a/stow_home/awesome/.config/awesome/lain/wiki/task.md b/stow_home/awesome/.config/awesome/lain/wiki/task.md
new file mode 100644
index 0000000..af53a6a
--- /dev/null
+++ b/stow_home/awesome/.config/awesome/lain/wiki/task.md
@@ -0,0 +1,51 @@
+## Usage
+
+[Read here.](https://github.com/lcpz/lain/wiki/Widgets#usage)
+
+### Description
+
+Attaches a [taskwarrior](http://taskwarrior.org) notifications to a widget, and lets you execute `task` commands from the promptbox.
+
+```lua
+lain.widget.contrib.task.attach(widget, args)
+```
+
+`args` is an optional table which can contain:
+
+Variable | Meaning | Type | Default
+--- | --- | --- | ---
+`show_cmd` | Taskwarrior command to show in the popup | string | "task next"
+`prompt_text` | Prompt text | string | "Enter task command: "
+`followtag` | Display the notification on currently focused screen | boolean | false
+`notification_preset` | Notification preset | table | See [default `notification_preset`](https://github.com/lcpz/lain/wiki/task#default-notification_preset)
+
+The tasks are shown in a notification popup when the mouse is moved over the attached `widget`, and the popup is hidden when the mouse is moved away. By default, the notification will show the output of `task next`. With `show_cmd`, the `task` popup command can be customized, for example if you want to [filter the tasks](https://taskwarrior.org/docs/filter.html) or show a [custom report](https://github.com/lcpz/lain/pull/213).
+
+With multiple screens, the default behaviour is to show a visual notification pop-up window on the first screen. By setting `followtag` to `true` it will be shown on the currently focused tag screen.
+
+You can call the notification with a keybinding like this:
+
+```lua
+awful.key({ modkey, altkey }, "t", function () lain.widget.contrib.task.show(scr) end),
+```
+
+where ``altkey = "Mod1"`` and `scr` (optional) indicates the screen which you want the notification in.
+
+And you can prompt to input a `task` command with a keybinding like this:
+
+```lua
+awful.key({ altkey }, "t", lain.widget.contrib.task.prompt),
+```
+
+### Default `notification_preset`
+
+```lua
+notification_preset = {
+ font = "Monospace 10",
+ icon = helpers.icons_dir .. "/taskwarrior.png"
+}
+```
+
+## Note
+
+* If your widget does not display `task next` output, try changing Taskwarrior verbose, for instance: `show_cmd = 'task rc.verbose:label'` or `show_cmd = 'task rc.verbose:nothing'`.
\ No newline at end of file
diff --git a/stow_home/awesome/.config/awesome/lain/wiki/temp.md b/stow_home/awesome/.config/awesome/lain/wiki/temp.md
new file mode 100644
index 0000000..4ec5828
--- /dev/null
+++ b/stow_home/awesome/.config/awesome/lain/wiki/temp.md
@@ -0,0 +1,35 @@
+## Usage
+
+[Read here.](https://github.com/lcpz/lain/wiki/Widgets#usage)
+
+### Description
+
+Shows the current CPU temperature.
+
+```lua
+local mytemp = lain.widget.temp()
+```
+
+## Input table
+
+Variable | Meaning | Type | Default
+--- | --- | --- | ---
+`timeout` | Refresh timeout (in seconds) | integer | 30
+`tempfile` | Path of file which stores core temperature value | string | "/sys/devices/virtual/thermal/thermal_zone0/temp"
+`settings` | User settings | function | empty function
+
+`settings` can use the string `coretemp_now`, which contains the info retrieved from `tempfile`, and the table `temp_now`, which contains an entry for each `*temp*` file in each directory in the following paths:
+
+```shell
+/sys/class/devices/virtual/thermal/thermal_zone*
+/sys/class/devices/platform/coretemp*/hwmon/hwon*
+```
+
+All values are expressed in Celsius (GNU/Linux standard).
+
+## Output table
+
+Variable | Meaning | Type
+--- | --- | ---
+`widget` | The widget | `wibox.widget.textbox`
+`update` | Update `widget` | function
diff --git a/stow_home/awesome/.config/awesome/lain/wiki/tp_smapi.md b/stow_home/awesome/.config/awesome/lain/wiki/tp_smapi.md
new file mode 100644
index 0000000..edb108f
--- /dev/null
+++ b/stow_home/awesome/.config/awesome/lain/wiki/tp_smapi.md
@@ -0,0 +1,103 @@
+# Description
+
+[`tp_smapi`](http://www.thinkwiki.org/wiki/Tp_smapi) interface and widget creator.
+
+```lua
+local tp_smapi = lain.widget.contrib.tp_smapi(apipath)
+```
+
+The argument `apipath` is an optional string which defines the API path. Its default value is `"/sys/devices/platform/smapi"`.
+
+# Functions
+
+## tp_smapi.get(batid, feature)
+
+Gets the `feature` of battery `batid`. Returns a string. The list of available features is available at [this page](https://www.thinkwiki.org/wiki/Tp_smapi#Battery_status_features).
+
+## tp_smapi.installed(batid)
+
+Checks if battery `batid` is installed. Returns a boolean.
+
+## tp_smapi.status(batid)
+
+Gets the status of battery `batid`. Returns a string ("charging", "discharging", or "full").
+
+## tp_smapi.percentage(batid)
+
+Gets the percentage of battery `batid`. Returns a numeric string.
+
+## tp_smapi.time(batid)
+
+Gets the time of battery `batid`. Depending on the current status, it can be either running or charging time. Returns a string of the format `HH:MM`.
+
+## tp_smapi.hide()
+
+Removes any notification spawned by `tp_smapi.show`.
+
+## tp_smapi.show(batid, seconds, scr)
+
+Notifies the current information of battery `batid` for `seconds` seconds on screen `scr`.
+The argument `scr` is optional, and if missing, the notification will be displayed on the currently focused screen.
+
+## tp_smapi.create_widget(args)
+
+Creates a [lain widget](https://github.com/lcpz/lain/wiki/Widgets#usage) of the available ThinkPad batteries.
+
+```lua
+local tpbat = tp_smapi.create_widget()
+```
+
+### Input table
+
+Variable | Meaning | Type | Default
+--- | --- | --- | ---
+`widget` | The widget type to use | [`wibox.widget`](https://awesomewm.org/doc/api/classes/wibox.widget.html) | [`wibox.widget.textbox`](https://awesomewm.org/doc/api/classes/wibox.widget.textbox.html)
+`timeout` | Refresh timeout (in seconds) | integer | 30
+`pspath` | Power supply directory path | string | "/sys/class/power_supply/"
+`battery` | Single battery id | string | autodetected
+`batteries` | Multiple batteries id table | table of strings | autodetected
+`settings` | User settings | function | empty function
+
+The widget will try to autodetect `battery` and `batteries`. If something
+goes wrong, you will have to define them manually. In that case, you only have
+to define one between `battery` and `batteries`. If you have one battery, you
+can either use `args.battery = "BAT*"` or `args.batteries = {"BAT*"}`, where `BAT*`
+is the identifier of your battery in `pspath` (do not use it as a wildcard).
+Of course, if you have multiple batteries, you need to use the latter option.
+
+If you define `pspath`, **be sure** to not forget the final slash (/).
+
+`settings` can use the `tpbat_now` table, which contains the following strings:
+
+- `status`, general status ("N/A", "discharging", "charging", "full");
+- `n_status[i]`, i-th battery status (like above);
+- `n_perc[i]`, i-th battery charge percentage (like above);
+- `n_time[i]`, i-th battery running or charging time (HH:MM string or "N/A");
+
+`n_time[i]` is the running time of battery `i` when it is discharging, and the charging time otherwise.
+
+### Output table
+
+Variable | Meaning | Type
+--- | --- | ---
+`widget` | The widget | [`wibox.widget`](https://awesomewm.org/doc/api/classes/wibox.widget.html) | [textbox](https://awesomewm.org/doc/api/classes/wibox.widget.textbox.html)
+`batteries` | Battery identifiers | Table of strings
+`update` | Update `widget` | function
+`timer` | The widget timer | [`gears.timer`](https://awesomewm.org/doc/api/classes/gears.timer.html)
+
+The `update` function can be used to refresh the widget before `timeout` expires.
+
+### Usage example
+
+```lua
+local tp_smapi = lain.widget.contrib.tp_smapi()
+local bat = tp_smapi.create_widget {
+ battery = "BAT0",
+ settings = function()
+ widget:set_markup(tpbat_now.n_perc[1] .. "%")
+ end
+}
+
+bat.widget:connect_signal("mouse::enter", function () tp_smapi.show("BAT0") end)
+bat.widget:connect_signal("mouse::leave", function () tp_smapi.hide() end)
+```
diff --git a/stow_home/awesome/.config/awesome/lain/wiki/watch.md b/stow_home/awesome/.config/awesome/lain/wiki/watch.md
new file mode 100644
index 0000000..ff18a5c
--- /dev/null
+++ b/stow_home/awesome/.config/awesome/lain/wiki/watch.md
@@ -0,0 +1,222 @@
+## Usage
+
+[Read here.](https://github.com/lcpz/lain/wiki/Widgets#usage)
+
+### Description
+
+Template for asynchronous watcher widgets.
+
+Executes an input command and makes the user feed a `wibox.widget` with the output.
+
+```lua
+local mywatch = lain.widget.watch()
+```
+
+This has been implemented in Awesome 4.0 as [`awful.widget.watch`](https://awesomewm.org/doc/api/classes/awful.widget.watch.html). But while Awesome `watch` returns only the widget, Lain one returns a table including its timer and internal update function too.
+
+## Input table
+
+Variable | Meaning | Type | Default
+--- | --- | --- | ---
+`widget` | Widget to feed | `wibox.widget` | `wibox.widget.textbox`
+`timeout` | Refresh timeout seconds | number | 5
+`cmd` | The command to execute | string **or** table | `nil`
+`nostart` | Widget timer doesn't start immediately | boolean | false
+`stoppable` | Widget timer is stoppable | boolean | false
+`settings` | User settings | function | see [Default `settings` function](https://github.com/lcpz/lain/wiki/watch#default-settings-function)
+
+If your command needs a shell, you need to set `cmd` as an array of 3 strings, where the first contains the shell, the second contains `-c`, and the third contains the actual command. Example:
+
+```lua
+cmd = { awful.util.shell, "-c", "myactualcommand" }
+```
+
+`settings` can use the string `output`, which is the output of `cmd`.
+
+### Default `settings` function
+
+```lua
+settings = function() widget:set_text(output) end
+```
+## Output table
+
+Variable | Meaning | Type
+--- | --- | ---
+`widget` | The widget | input widget type or `wibox.widget.textbox`
+`update` | Update `widget` | function
+`timer` | The widget timer | [`gears.timer`](https://awesomewm.org/doc/api/classes/gears.timer.html) or `nil`
+
+The `update` function can be used to refresh the widget before `timeout` expires.
+
+If `stoppable == true`, the widget will have an ad-hoc timer, which you can control though `timer` variable.
+
+## Use case examples
+
+### bitcoin
+
+```lua
+-- Bitcoin to USD current price, using Coinbase V1 API
+local bitcoin = lain.widget.watch({
+ timeout = 43200, -- half day
+ stoppable = true,
+ cmd = "curl -m5 -s 'https://coinbase.com/api/v1/prices/buy'",
+ settings = function()
+ local btc, pos, err = require("lain.util").dkjson.decode(output, 1, nil)
+ local btc_price = (not err and btc and btc["subtotal"]["amount"]) or "N/A"
+
+ -- customize here
+ widget:set_text(btc_price)
+ end
+})
+```
+
+### btrfs
+
+```lua
+-- btrfs root df
+local myrootfs = lain.widget.watch({
+ timeout = 600,
+ cmd = "btrfs filesystem df -g /",
+ settings = function()
+ local total, used = string.match(output, "Data.-total=(%d+%.%d+)GiB.-used=(%d+%.%d+)GiB")
+ local percent_used = math.ceil((tonumber(used) / tonumber(total)) * 100)
+
+ -- customize here
+ widget:set_text(" [/: " .. percent_used .. "%] ")
+ end
+})
+```
+
+### cmus
+
+```lua
+-- cmus audio player
+local cmus = lain.widget.watch({
+ timeout = 2,
+ stoppable = true,
+ cmd = "cmus-remote -Q",
+ settings = function()
+ local cmus_now = {
+ state = "N/A",
+ artist = "N/A",
+ title = "N/A",
+ album = "N/A"
+ }
+
+ for w in string.gmatch(output, "(.-)tag") do
+ a, b = w:match("(%w+) (.-)\n")
+ cmus_now[a] = b
+ end
+
+ -- customize here
+ widget:set_text(cmus_now.artist .. " - " .. cmus_now.title)
+ end
+})
+```
+
+### maildir
+
+```lua
+-- checks whether there are files in the "new" directories of a mail dirtree
+local mailpath = "~/Mail"
+local mymaildir = lain.widget.watch({
+ timeout = 60,
+ stoppable = true,
+ cmd = { awful.util.shell, "-c", string.format("ls -1dr %s/*/new/*", mailpath) },
+ settings = function()
+ local inbox_now = { digest = "" }
+
+ for dir in output:gmatch(".-/(%w+)/new") do
+ inbox_now[dir] = 1
+ for _ in output:gmatch(dir) do
+ inbox_now[dir] = inbox_now[dir] + 1
+ end
+ if #inbox_now.digest > 0 then inbox_now.digest = inbox_now.digest .. ", " end
+ inbox_now.digest = inbox_now.digest .. string.format("%s (%d)", dir, inbox_now[dir])
+ end
+
+ -- customize here
+ widget:set_text("mail: " .. inbox_now.digest)
+ end
+})
+```
+
+### mpris
+
+```lua
+-- infos from mpris clients such as spotify and VLC
+-- based on https://github.com/acrisci/playerctl
+local mpris = lain.widget.watch({
+ cmd = "playerctl status && playerctl metadata",
+ timeout = 2,
+ stoppable = true,
+ settings = function()
+ local escape_f = require("awful.util").escape
+ local mpris_now = {
+ state = "N/A",
+ artist = "N/A",
+ title = "N/A",
+ art_url = "N/A",
+ album = "N/A",
+ album_artist = "N/A"
+ }
+
+ mpris_now.state = string.match(output, "Playing") or
+ string.match(output, "Paused") or "N/A"
+
+ for k, v in string.gmatch(output, "'[^:]+:([^']+)':[%s]<%[?'([^']+)'%]?>")
+ do
+ if k == "artUrl" then mpris_now.art_url = v
+ elseif k == "artist" then mpris_now.artist = escape_f(v)
+ elseif k == "title" then mpris_now.title = escape_f(v)
+ elseif k == "album" then mpris_now.album = escape_f(v)
+ elseif k == "albumArtist" then mpris_now.album_artist = escape_f(v)
+ end
+ end
+
+ -- customize here
+ widget:set_text(mpris_now.artist .. " - " .. mpris_now.title)
+ end
+})
+```
+
+### upower
+
+```lua
+-- battery infos from freedesktop upower
+local mybattery = lain.widget.watch({
+ timeout = 30,
+ cmd = { awful.util.shell, "-c", "upower -i /org/freedesktop/UPower/devices/battery_BAT | sed -n '/present/,/icon-name/p'" },
+ settings = function()
+ local bat_now = {
+ present = "N/A",
+ state = "N/A",
+ warninglevel = "N/A",
+ energy = "N/A",
+ energyfull = "N/A",
+ energyrate = "N/A",
+ voltage = "N/A",
+ percentage = "N/A",
+ capacity = "N/A",
+ icon = "N/A"
+ }
+
+ for k, v in string.gmatch(output, '([%a]+[%a|-]+):%s*([%a|%d]+[,|%a|%d]-)') do
+ if k == "present" then bat_now.present = v
+ elseif k == "state" then bat_now.state = v
+ elseif k == "warning-level" then bat_now.warninglevel = v
+ elseif k == "energy" then bat_now.energy = string.gsub(v, ",", ".") -- Wh
+ elseif k == "energy-full" then bat_now.energyfull = string.gsub(v, ",", ".") -- Wh
+ elseif k == "energy-rate" then bat_now.energyrate = string.gsub(v, ",", ".") -- W
+ elseif k == "voltage" then bat_now.voltage = string.gsub(v, ",", ".") -- V
+ elseif k == "percentage" then bat_now.percentage = tonumber(v) -- %
+ elseif k == "capacity" then bat_now.capacity = string.gsub(v, ",", ".") -- %
+ elseif k == "icon-name" then bat_now.icon = v
+ end
+ end
+
+ -- customize here
+ widget:set_text("Bat: " .. bat_now.percentage .. " " .. bat_now.state)
+ end
+})
+```
diff --git a/stow_home/awesome/.config/awesome/lain/wiki/weather.md b/stow_home/awesome/.config/awesome/lain/wiki/weather.md
new file mode 100644
index 0000000..1875965
--- /dev/null
+++ b/stow_home/awesome/.config/awesome/lain/wiki/weather.md
@@ -0,0 +1,150 @@
+## Usage
+
+[Read here.](https://github.com/lcpz/lain/wiki/Widgets#usage)
+
+### Description
+
+Provides current weather status widgets and X-days forecast popup notifications.
+
+Powered by [OpenWeatherMap](http://openweathermap.org/api) API.
+
+By default, it uses [current](http://openweathermap.org/current) for current weather data and [forecast16](http://openweathermap.org/forecast16) for forecasts.
+
+```lua
+local myweather = lain.widget.weather()
+```
+
+## Input table
+
+Variable | Meaning | Type | Default
+--- | --- | --- | ---
+`timeout` | Refresh timeout seconds for current weather status | number | 900 (15 min)
+`timeout_forecast` | Refresh timeout seconds for forecast notification | number | 86400 (24 hrs)
+`current_call` | Command to fetch weather status data from the API | string | see `default_current_call`
+`forecast_call` | Command to fetch forecast data from the API | string | see `default_forecast_call`
+`city_id` | API city code | number | not set
+`utc_offset` | UTC time offset | function | see [here](https://github.com/lcpz/lain/blob/master/widget/weather.lua#L35-L39)
+`units` | Temperature units system | string | "metric"
+`lang` | API data localization | string | "en"
+`cnt` | Forecast days interval | integer | 5
+`date_cmd` | Forecast notification format style | string | "date -u -d @%d +'%%a %%d'"
+`icons_path` | Icons path | string | `lain/icons/openweathermap`
+`notification_preset` | Preset for notifications | table | empty table
+`notification_text_fun` | Function to format forecast notifications | function | see `notification_text_fun` below
+`weather_na_markup` | Markup to be used when weather textbox is not available | text | " N/A "
+`followtag` | Display the notification on currently focused screen | boolean | false
+`showpopup` | Display popups with mouse hovering | string, possible values: "on", "off" | "on"
+`settings` | User settings | function | empty function
+
+- ``default_current_call``
+
+ `"curl -s 'http://api.openweathermap.org/data/2.5/weather?id=%s&units=%s&lang=%s'"`
+
+ You can rewrite it using any fetcher solution you like, or you can modify it in order to fetch data by city name, instead of ID: just replace `id` with `q`:
+
+ `"curl -s 'http://api.openweathermap.org/data/2.5/weather?q=%s&units=%s&lang=%s'"`
+
+ and set `city_id` with your city name, for instance `city_id = "London,UK"`.
+
+- ``default_forecast_call``
+
+ `"curl -s 'http://api.openweathermap.org/data/2.5/forecast/daily?id=%s&units=%s&lang=%s&cnt=%s'"`
+
+ Like above.
+ If you want to use [forecast5](http://openweathermap.org/forecast5), use this API call string:
+ `http://api.openweathermap.org/data/2.5/forecast?id=%s&units=%s&lang=%s&cnt=%s`
+
+- ``city_id``
+
+ An integer that defines the OpenWeatherMap ID code of your city.
+ To obtain it go to [OpenWeatherMap](http://openweathermap.org/) and query for your city in the top search bar. The link will look like this:
+
+ http://openweathermap.org/city/2643743
+
+ your `city_id` is the number at the end.
+
+- ``units``
+
+ - For temperature in Fahrenheit use `units = "imperial"`
+ - For temperature in Celsius use `units = "metric"` (Lain default)
+ - For temperature in Kelvin use `units = "standard"` (OpenWeatherMap default)
+
+- ``lang``
+
+ See *Multilingual Support* section [here](http://openweathermap.org/current).
+
+- ``cnt``
+
+ Determines how many days to show in the forecast notification. Up to 16 if you use [forecast16](http://openweathermap.org/forecast16) (default), and up to 5 if you use [forecast5](http://openweathermap.org/forecast5).
+
+- ``date_cmd``
+
+ OpenWeatherMap time is in UNIX format, so this variable uses `date` to determine how each line in the forecast notification is formatted. Default looks like this:
+
+ day #daynumber: forecast, temp_min - temp_max
+
+ see `man date` for your customizations.
+
+- ``icons_path``
+
+ You can set your own icons path if you don't wish to use `lain/icons/openweathermap`. Just be sure that your icons are PNGs and named exactly like [OpenWeatherMap ones](http://openweathermap.org/weather-conditions).
+
+- ``notification_preset``
+
+ Notifications preset table. See [here](https://awesomewm.org/doc/api/libraries/naughty.html#notify) for the details.
+
+- ``notification_text_fun``
+ ```lua
+ function (wn)
+ local day = string.gsub(read_pipe(string.format(date_cmd, wn["dt"])), "\n", "")
+ local tmin = math.floor(wn["temp"]["min"])
+ local tmax = math.floor(wn["temp"]["max"])
+ local desc = wn["weather"][1]["description"]
+
+ return string.format("%s: %s, %d - %d ", day, desc, tmin, tmax)
+ end
+ ```
+ See [here](https://github.com/lcpz/lain/issues/186#issuecomment-203400918) for a complete customization example.
+
+- ``followtag``
+
+ With multiple screens, the default behaviour is to show a visual notification pop-up window on the first screen. By setting `followtag` to `true` it will be shown on the currently focused tag screen.
+
+- ``settings``
+
+ In your `settings` function, you can use `widget` variable to refer to the textbox, and the dictionary `weather_now` to refer to data retrieved by `current_call`. The dictionary is built with [dkjson library](http://dkolf.de/src/dkjson-lua.fsl/home), and its structure is defined [here](http://openweathermap.org/weather-data).
+ For instance, you can retrieve current weather status and temperature in this way:
+ ```lua
+ descr = weather_now["weather"][1]["description"]:lower()
+ units = math.floor(weather_now["main"]["temp"])
+ ```
+
+## Output table
+
+Variable | Meaning | Type
+--- | --- | ---
+`widget` | The widget | `wibox.widget.textbox`
+`icon` | The icon | `wibox.widget.imagebox`
+`update` | Update `widget` | function
+`timer` | The widget timer | [`gears.timer`](https://awesomewm.org/doc/api/classes/gears.timer.html)
+`timer_forecast` | The forecast notification timer | [`gears.timer`](https://awesomewm.org/doc/api/classes/gears.timer.html)
+
+## Functions
+
+You can attach the forecast notification to any widget like this:
+
+```lua
+myweather.attach(obj)
+```
+
+Hovering over ``obj`` will display the notification.
+
+## Keybindings
+
+You can create a keybinding for the weather popup like this:
+
+```lua
+awful.key( { "Mod1" }, "w", function () myweather.show(5) end )
+```
+
+where ``show`` argument is an integer defining timeout seconds.
diff --git a/stow_home/awesome/.config/awesome/rc.lua b/stow_home/awesome/.config/awesome/rc.lua
new file mode 100644
index 0000000..103389d
--- /dev/null
+++ b/stow_home/awesome/.config/awesome/rc.lua
@@ -0,0 +1,659 @@
+-- If LuaRocks is installed, make sure that packages installed through it are
+-- found (e.g. lgi). If LuaRocks is not installed, do nothing.
+pcall(require, "luarocks.loader")
+
+-- Standard awesome library
+local gears = require("gears")
+local lain = require("lain")
+local awful = require("awful")
+require("awful.autofocus")
+-- Widget and layout library
+local wibox = require("wibox")
+-- Theme handling library
+local beautiful = require("beautiful")
+-- Notification library
+local naughty = require("naughty")
+local menubar = require("menubar")
+local hotkeys_popup = require("awful.hotkeys_popup")
+-- Enable hotkeys help widget for VIM and other apps
+-- when client with a matching name is opened:
+require("awful.hotkeys_popup.keys")
+
+-- {{{ Error handling
+-- Check if awesome encountered an error during startup and fell back to
+-- another config (This code will only ever execute for the fallback config)
+if awesome.startup_errors then
+ naughty.notify({ preset = naughty.config.presets.critical,
+ title = "Oops, there were errors during startup!",
+ text = awesome.startup_errors })
+end
+
+-- Handle runtime errors after startup
+do
+ local in_error = false
+ awesome.connect_signal("debug::error", function (err)
+ -- Make sure we don't go into an endless error loop
+ if in_error then return end
+ in_error = true
+
+ naughty.notify({ preset = naughty.config.presets.critical,
+ title = "Oops, an error happened!",
+ text = tostring(err) })
+ in_error = false
+ end)
+end
+-- }}}
+
+-- {{{ Variable definitions
+-- Themes define colours, icons, font and wallpapers.
+beautiful.init("~/.config/awesome/themes/zenburn/theme.lua")
+
+-- This is used later as the default terminal and editor to run.
+terminal = "alacritty"
+editor = os.getenv("EDITOR") or "nano"
+editor_cmd = terminal .. " -e " .. editor
+
+-- Default modkey.
+-- Usually, Mod4 is the key with a logo between Control and Alt.
+-- If you do not like this or do not have such a key,
+-- I suggest you to remap Mod4 to another key using xmodmap or other tools.
+-- However, you can use another modifier likeMod1, but it may interact with others.
+modkey = "Mod4"
+local altkey = "Mod1"
+-- Table of layouts to cover with awful.layout.inc, order matters.
+awful.layout.layouts = {
+ awful.layout.suit.tile,
+ awful.layout.suit.tile.left,
+ awful.layout.suit.tile.bottom,
+ awful.layout.suit.tile.top,
+ awful.layout.suit.fair,
+ awful.layout.suit.spiral,
+ awful.layout.suit.max.fullscreen,
+ --awful.layout.suit.fair.horizontal,
+ --awful.layout.suit.spiral.dwindle,
+ --awful.layout.suit.max,
+ --awful.layout.suit.floating,
+ --awful.layout.suit.magnifier,
+ --awful.layout.suit.corner.nw,
+ -- awful.layout.suit.corner.ne,
+ -- awful.layout.suit.corner.sw,
+ -- awful.layout.suit.corner.se,
+}
+-- }}}
+
+-- {{{ Menu
+-- Create a launcher widget and a main menu
+myawesomemenu = {
+ { "hotkeys", function() hotkeys_popup.show_help(nil, awful.screen.focused()) end },
+ { "manual", terminal .. " -e man awesome" },
+ { "edit config", editor_cmd .. " " .. awesome.conffile },
+ { "restart", awesome.restart },
+ { "quit", function() awesome.quit() end },
+}
+
+mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon },
+ { "open terminal", terminal }
+ }
+ })
+
+mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon,
+ menu = mymainmenu })
+
+-- Menubar configuration
+menubar.utils.terminal = terminal -- Set the terminal for applications that require it
+-- }}}
+
+-- Keyboard map indicator and switcher
+mykeyboardlayout = awful.widget.keyboardlayout()
+
+-- {{{ Wibar
+-- Create a textclock widget
+--
+mytextclock = wibox.widget.textclock("%B %d %I:%M %P " )--{ format = )
+
+-- Create a wibox for each screen and add it
+local taglist_buttons = gears.table.join(
+ awful.button({ }, 1, function(t) t:view_only() end),
+ awful.button({ modkey }, 1, function(t)
+ if client.focus then
+ client.focus:move_to_tag(t)
+ end
+ end),
+ awful.button({ }, 3, awful.tag.viewtoggle),
+ awful.button({ modkey }, 3, function(t)
+ if client.focus then
+ client.focus:toggle_tag(t)
+ end
+ end),
+ awful.button({ }, 4, function(t) awful.tag.viewnext(t.screen) end),
+ awful.button({ }, 5, function(t) awful.tag.viewprev(t.screen) end)
+ )
+
+local tasklist_buttons = gears.table.join(
+ awful.button({ }, 1, function (c)
+ if c == client.focus then
+ c.minimized = true
+ else
+ c:emit_signal(
+ "request::activate",
+ "tasklist",
+ {raise = true}
+ )
+ end
+ end),
+ awful.button({ }, 3, function()
+ awful.menu.client_list({ theme = { width = 250 } })
+ end),
+ awful.button({ }, 4, function ()
+ awful.client.focus.byidx(1)
+ end),
+ awful.button({ }, 5, function ()
+ awful.client.focus.byidx(-1)
+ end))
+
+local function set_wallpaper(s)
+ -- Wallpaper
+ if beautiful.wallpaper then
+ local wallpaper = beautiful.wallpaper
+ -- If wallpaper is a function, call it with the screen
+ if type(wallpaper) == "function" then
+ wallpaper = wallpaper(s)
+ end
+ gears.wallpaper.maximized(wallpaper, s, true)
+ end
+end
+
+-- Re-set wallpaper when a screen's geometry changes (e.g. different resolution)
+screen.connect_signal("property::geometry", set_wallpaper)
+
+awful.screen.connect_for_each_screen(function(s)
+ -- Wallpaper
+ set_wallpaper(s)
+
+ -- Each screen has its own tag table.
+ awful.tag({ " ", " ", " ", " ", " ", " ", " ", " ", " ", " " }, s, awful.layout.layouts[1])
+ -- Create a promptbox for each screen
+ s.mypromptbox = awful.widget.prompt()
+ -- Create an imagebox widget which will contain an icon indicating which layout we're using.
+ -- We need one layoutbox per screen.
+ s.mylayoutbox = awful.widget.layoutbox(s)
+ s.mylayoutbox:buttons(gears.table.join(
+ awful.button({ }, 1, function () awful.layout.inc( 1) end),
+ awful.button({ }, 3, function () awful.layout.inc(-1) end),
+ awful.button({ }, 4, function () awful.layout.inc( 1) end),
+ awful.button({ }, 5, function () awful.layout.inc(-1) end)))
+ -- Create a taglist widget
+ s.mytaglist = awful.widget.taglist {
+ screen = s,
+ filter = awful.widget.taglist.filter.all,
+ buttons = taglist_buttons,
+ }
+
+ -- Create a tasklist widget
+ s.mytasklist = awful.widget.tasklist {
+ screen = s,
+ filter = awful.widget.tasklist.filter.currenttags,
+ buttons = tasklist_buttons
+ }
+
+ -- Create the wibox
+ s.mywibox = awful.wibar({ position = "top", screen = s })
+
+ -- Add widgets to the wibox
+ s.mywibox:setup {
+ layout = wibox.layout.align.horizontal,
+ { -- Left widgets
+ layout = wibox.layout.fixed.horizontal,
+ mylauncher,
+ s.mytaglist,
+ s.mypromptbox,
+ },
+ s.mytasklist, -- Middle widget
+ { -- Right widgets
+ layout = wibox.layout.fixed.horizontal,
+ mykeyboardlayout,
+ wibox.layout.margin(wibox.widget.systray(), 3, 3, 3, 3),
+ mytextclock,
+ s.mylayoutbox,
+ },
+ }
+ end)
+-- }}}
+
+-- {{{ Mouse bindings
+root.buttons(gears.table.join(
+ awful.button({ }, 3, function () mymainmenu:toggle() end),
+ awful.button({ }, 4, awful.tag.viewnext),
+ awful.button({ }, 5, awful.tag.viewprev)
+))
+-- }}}
+
+-- {{{ Key bindings
+globalkeys = gears.table.join(
+ awful.key({ modkey, }, "s", hotkeys_popup.show_help,
+ {description="show help", group="awesome"}),
+ awful.key({ modkey, }, "Left", awful.tag.viewprev,
+ {description = "view previous", group = "tag"}),
+ awful.key({ modkey, }, "Right", awful.tag.viewnext,
+ {description = "view next", group = "tag"}),
+ awful.key({ modkey, }, "Escape", awful.tag.history.restore,
+ {description = "go back", group = "tag"}),
+ -- move window to previous tag
+ awful.key({ modkey, "Shift" }, "Left",
+ function ()
+ -- get current tag
+ local t = client.focus and client.focus.first_tag or nil
+ if t == nil then
+ return
+ end
+ -- get previous tag (modulo of tag n excluding 0 to wrap from tag 1 to tag n)
+ local tag = client.focus.screen.tags[(t.index - 2) % 10 + 1]
+ if tag then
+ client.focus:move_to_tag(tag)
+ awful.tag.viewprev()
+ end
+ end,
+ {description = "carry focused client to previous tag", group = "client"}),
+ -- move window to next tag
+ awful.key({ modkey, "Shift" }, "Right",
+ function ()
+ -- get current tag
+ local t = client.focus and client.focus.first_tag or nil
+ if t == nil then
+ return
+ end
+ -- get next tag (modulo of tag n excluding 0 to wrap from tag n to tag 1)
+ local tag = client.focus.screen.tags[(t.index % 10) + 1]
+ if tag then
+ client.focus:move_to_tag(tag)
+ awful.tag.viewnext()
+ end
+ end,
+ {description = "carry focused client to next tag", group = "client"}),
+
+ awful.key({ modkey, }, "j",
+ function ()
+ awful.client.focus.byidx( 1)
+ end,
+ {description = "focus next by index", group = "client"}
+ ),
+ awful.key({ modkey, }, "k",
+ function ()
+ awful.client.focus.byidx(-1)
+ end,
+ {description = "focus previous by index", group = "client"}
+ ),
+ awful.key({ modkey, }, "w", function () mymainmenu:show() end,
+ {description = "show main menu", group = "awesome"}),
+
+ -- On the fly useless gaps change
+ awful.key({ altkey, "Control" }, "l", function () lain.util.useless_gaps_resize(1) end,
+ {description = "increment useless gaps", group = "tag"}),
+ awful.key({ altkey, "Control" }, "h", function () lain.util.useless_gaps_resize(-1) end,
+ {description = "decrement useless gaps", group = "tag"}),
+ -- Layout manipulation
+ --
+ awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end,
+ {description = "swap with next client by index", group = "client"}),
+ awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end,
+ {description = "swap with previous client by index", group = "client"}),
+ awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end,
+ {description = "focus the next screen", group = "screen"}),
+ awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end,
+ {description = "focus the previous screen", group = "screen"}),
+ awful.key({ modkey, }, "u", awful.client.urgent.jumpto,
+ {description = "jump to urgent client", group = "client"}),
+ awful.key({ modkey, }, "Tab",
+ function ()
+ awful.client.focus.history.previous()
+ if client.focus then
+ client.focus:raise()
+ end
+ end,
+ {description = "go back", group = "client"}),
+
+ -- Standard program
+ awful.key({ modkey, }, "Return", function () awful.spawn(terminal) end,
+ {description = "open a terminal", group = "launcher"}),
+ awful.key({ modkey, "Shift" }, "r", awesome.restart,
+ {description = "reload awesome", group = "awesome"}),
+ awful.key({ modkey, "Control" }, "q", awesome.quit,
+ {description = "quit awesome", group = "awesome"}),
+
+ awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end,
+ {description = "increase master width factor", group = "layout"}),
+ awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end,
+ {description = "decrease master width factor", group = "layout"}),
+ awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1, nil, true) end,
+ {description = "increase the number of master clients", group = "layout"}),
+ awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1, nil, true) end,
+ {description = "decrease the number of master clients", group = "layout"}),
+ awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1, nil, true) end,
+ {description = "increase the number of columns", group = "layout"}),
+ awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1, nil, true) end,
+ {description = "decrease the number of columns", group = "layout"}),
+ awful.key({ modkey, }, "space", function () awful.layout.inc( 1) end,
+ {description = "select next", group = "layout"}),
+ awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(-1) end,
+ {description = "select previous", group = "layout"}),
+
+ awful.key({ modkey, "Control" }, "n",
+ function ()
+ local c = awful.client.restore()
+ -- Focus restored client
+ if c then
+ c:emit_signal(
+ "request::activate", "key.unminimize", {raise = true}
+ )
+ end
+ end,
+ {description = "restore minimized", group = "client"}),
+
+ --[[ Prompt
+ awful.key({ modkey }, "r", function () awful.screen.focused().mypromptbox:run() end,
+ {description = "run prompt", group = "launcher"}),
+
+ awful.key({ modkey }, "x",
+ function ()
+ awful.prompt.run {
+ prompt = "Run Lua code: ",
+ textbox = awful.screen.focused().mypromptbox.widget,
+ exe_callback = awful.util.eval,
+ history_path = awful.util.get_cache_dir() .. "/history_eval"
+ }
+ end,
+ {description = "lua execute prompt", group = "awesome"}),
+ -- Menubar
+ awful.key({ modkey }, "p", function() menubar.show() end,
+ {description = "show the menubar", group = "launcher"})
+ ]]--)
+
+
+ -- User programs
+ awful.key({ modkey, altkey }, "b", function () awful.spawn("qutebrowser") end,
+ {description = "run browser", group = "launcher"}),
+ awful.key({ modkey }, "a", function () awful.spawn(gui_editor) end,
+ {description = "run gui editor", group = "launcher"}),
+ awful.key({ modkey, altkey }, "d", function () awful.spawn("Discord") end,
+ {description = "run discord messaging client", group = "launcher"}),
+ awful.key({ modkey, altkey }, "f", function () awful.spawn("pcmanfm") end,
+ {description = "run gui file manager", group = "launcher"}),
+ awful.key({ modkey}, "p", function () awful.spawn("rofi -show drun") end,
+ {description = "run rofi prompt (drun)", group = "Rofi launcher"}),
+ awful.key({ modkey,"Shift"}, "q", function () awful.spawn("/home/joelchrono12/.config/rofi/scripts/power-menu.sh") end,
+ {description = "run rofi power menu script", group = "Rofi launcher"}),
+ awful.key({ modkey,altkey}, "k", function () awful.spawn("rofi-pass") end,
+ {description = "run rofi power menu script", group = "Rofi launcher"}),
+ awful.key({ modkey }, "r", function () awful.spawn("rofi -show run") end,
+ {description = "run prompt", group = "launcher"}),
+ awful.key({ modkey,"Shift"}, "s", function () awful.spawn("flameshot gui") end,
+ {description = "run gui editor", group = "launcher"}),
+ awful.key({ modkey, altkey }, "p", function () awful.spawn("/home/joelchrono12/.config/rofi/scripts/qpost.sh") end,
+ {description = "create new blogpost", group = "launcher"}))
+clientkeys = gears.table.join(
+ awful.key({ modkey, }, "f",
+ function (c)
+ c.fullscreen = not c.fullscreen
+ c:raise()
+ end,
+ {description = "toggle fullscreen", group = "client"}),
+ awful.key({ modkey, }, "q", function (c) c:kill() end,
+ {description = "close", group = "client"}),
+ awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle ,
+ {description = "toggle floating", group = "client"}),
+ awful.key({ modkey, "Shift" }, "Return", function (c) c:swap(awful.client.getmaster()) end,
+ {description = "move to master", group = "client"}),
+ awful.key({ modkey, }, "o", function (c) c:move_to_screen() end,
+ {description = "move to screen", group = "client"}),
+ awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end,
+ {description = "toggle keep on top", group = "client"}),
+ awful.key({ modkey, }, "n",
+ function (c)
+ -- The client currently has the input focus, so it cannot be
+ -- minimized, since minimized clients can't have the focus.
+ c.minimized = true
+ end ,
+ {description = "minimize", group = "client"}),
+ awful.key({ modkey, }, "m",
+ function (c)
+ c.maximized = not c.maximized
+ c:raise()
+ end ,
+ {description = "(un)maximize", group = "client"}),
+ awful.key({ modkey, "Control" }, "m",
+ function (c)
+ c.maximized_vertical = not c.maximized_vertical
+ c:raise()
+ end ,
+ {description = "(un)maximize vertically", group = "client"}),
+ awful.key({ modkey, "Shift" }, "m",
+ function (c)
+ c.maximized_horizontal = not c.maximized_horizontal
+ c:raise()
+ end ,
+ {description = "(un)maximize horizontally", group = "client"})
+)
+
+-- Bind all key numbers to tags.
+-- Be careful: we use keycodes to make it work on any keyboard layout.
+-- This should map on the top row of your keyboard, usually 1 to 9.
+for i = 1, 9 do
+ globalkeys = gears.table.join(globalkeys,
+ -- View tag only.
+ awful.key({ modkey }, "#" .. i + 9,
+ function ()
+ local screen = awful.screen.focused()
+ local tag = screen.tags[i]
+ if tag then
+ tag:view_only()
+ end
+ end,
+ {description = "view tag #"..i, group = "tag"}),
+ -- Toggle tag display.
+ awful.key({ modkey, "Control" }, "#" .. i + 9,
+ function ()
+ local screen = awful.screen.focused()
+ local tag = screen.tags[i]
+ if tag then
+ awful.tag.viewtoggle(tag)
+ end
+ end,
+ {description = "toggle tag #" .. i, group = "tag"}),
+ -- Move client to tag.
+ awful.key({ modkey, "Shift" }, "#" .. i + 9,
+ function ()
+ if client.focus then
+ local tag = client.focus.screen.tags[i]
+ if tag then
+ client.focus:move_to_tag(tag)
+ end
+ end
+ end,
+ {description = "move focused client to tag #"..i, group = "tag"}),
+ -- Toggle tag on focused client.
+ awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
+ function ()
+ if client.focus then
+ local tag = client.focus.screen.tags[i]
+ if tag then
+ client.focus:toggle_tag(tag)
+ end
+ end
+ end,
+ {description = "toggle focused client on tag #" .. i, group = "tag"})
+ )
+end
+
+clientbuttons = gears.table.join(
+ awful.button({ }, 1, function (c)
+ c:emit_signal("request::activate", "mouse_click", {raise = true})
+ end),
+ awful.button({ modkey }, 1, function (c)
+ c:emit_signal("request::activate", "mouse_click", {raise = true})
+ awful.mouse.client.move(c)
+ end),
+ awful.button({ modkey }, 3, function (c)
+ c:emit_signal("request::activate", "mouse_click", {raise = true})
+ awful.mouse.client.resize(c)
+ end)
+)
+
+-- Set keys
+root.keys(globalkeys)
+-- }}}
+
+-- {{{ Rules
+-- Rules to apply to new clients (through the "manage" signal).
+awful.rules.rules = {
+ -- All clients will match this rule.
+ { rule = { },
+ properties = { border_width = beautiful.border_width,
+ border_color = beautiful.border_normal,
+ focus = awful.client.focus.filter,
+ raise = true,
+ keys = clientkeys,
+ buttons = clientbuttons,
+ screen = awful.screen.preferred,
+ placement = awful.placement.no_overlap+awful.placement.no_offscreen
+ }
+ },
+
+ -- Floating clients.
+ { rule_any = {
+ instance = {
+ "DTA", -- Firefox addon DownThemAll.
+ "copyq", -- Includes session name in class.
+ "pinentry",
+ },
+ class = {
+ "Arandr",
+ "Blueman-manager",
+ "Nitrogen",
+ "Gpick",
+ "Kruler",
+ "MessageWin", -- kalarm.
+ "Sxiv",
+ "Tor Browser", -- Needs a fixed window size to avoid fingerprinting by screen size.
+ "Wpa_gui",
+ "veromix",
+ "xtightvncviewer"},
+
+ -- Note that the name property shown in xprop might be set slightly after creation of the client
+ -- and the name shown there might not match defined rules here.
+ name = {
+ "Event Tester", -- xev.
+ },
+ role = {
+ "AlarmWindow", -- Thunderbird's calendar.
+ "ConfigManager", -- Thunderbird's about:config.
+ "pop-up", -- e.g. Google Chrome's (detached) Developer Tools.
+ }
+ }, properties = { floating = true }},
+
+ -- Add titlebars to normal clients and dialogs
+ { rule_any = {type = { "normal", "dialog" }
+ }, properties = { titlebars_enabled = false }
+ },
+
+ -- Set Firefox to always map on the tag named "2" on screen 1.
+ -- { rule = { class = "Firefox" },
+ -- properties = { screen = 1, tag = "2" } },
+}
+-- }}}
+
+-- {{{ Signals
+-- Signal function to execute when a new client appears.
+client.connect_signal("manage", function (c)
+ -- Set the windows at the slave,
+ -- i.e. put it at the end of others instead of setting it master.
+ if not awesome.startup then awful.client.setslave(c) end
+
+ if awesome.startup
+ and not c.size_hints.user_position
+ and not c.size_hints.program_position then
+ -- Prevent clients from being unreachable after screen count changes.
+ awful.placement.no_offscreen(c)
+ end
+end)
+
+-- Add a titlebar if titlebars_enabled is set to true in the rules.
+client.connect_signal("request::titlebars", function(c)
+ -- buttons for the titlebar
+ local buttons = gears.table.join(
+ awful.button({ }, 1, function()
+ c:emit_signal("request::activate", "titlebar", {raise = true})
+ awful.mouse.client.move(c)
+ end),
+ awful.button({ }, 3, function()
+ c:emit_signal("request::activate", "titlebar", {raise = true})
+ awful.mouse.client.resize(c)
+ end)
+ )
+
+ awful.titlebar(c) : setup {
+ { -- Left
+ awful.titlebar.widget.iconwidget(c),
+ buttons = buttons,
+ layout = wibox.layout.fixed.horizontal
+ },
+ { -- Middle
+ { -- Title
+ align = "center",
+ widget = awful.titlebar.widget.titlewidget(c)
+ },
+ buttons = buttons,
+ layout = wibox.layout.flex.horizontal
+ },
+ { -- Right
+ awful.titlebar.widget.floatingbutton (c),
+ awful.titlebar.widget.maximizedbutton(c),
+ awful.titlebar.widget.stickybutton (c),
+ awful.titlebar.widget.ontopbutton (c),
+ awful.titlebar.widget.closebutton (c),
+ layout = wibox.layout.fixed.horizontal()
+ },
+ layout = wibox.layout.align.horizontal
+ }
+end)
+
+beautiful.notification_icon_size = 64
+-- Enable sloppy focus, so that focus follows mouse.
+--client.connect_signal("mouse::enter", function(c)
+-- c:emit_signal("request::activate", "mouse_enter", {raise = false})
+--end)
+
+client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
+client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
+-- }}}
+--
+--
+--
+--
+-- Add rounded corners to awesome wm
+client.connect_signal("manage", function (c)
+ c.shape = function(cr,w,h)
+ gears.shape.rounded_rect(cr,w,h,12)
+ end
+end)
+
+local autorun = true
+autorunApps =
+{
+ "pipewire",
+ "volumeicon",
+ "picom",
+ "lxpolkit",
+ "xfce4-power-manager",
+ "nm-applet",
+ "syncthing-gtk -m",
+ --"/home/joelchrono12/.config/polybar/launch.sh",
+ --"touchpad-indicator",
+ "setxkbmap -layout latam",
+ "nitrogen --restore",
+ --"cbatticon",
+}
+if autorun then
+ for app = 1, #autorunApps do
+ awful.util.spawn(autorunApps[app])
+ end
+end
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/awesome-icon.png b/stow_home/awesome/.config/awesome/themes/zenburn/awesome-icon.png
new file mode 100755
index 0000000..9ca448a
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/awesome-icon.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/darkpcnordwall.png b/stow_home/awesome/.config/awesome/themes/zenburn/darkpcnordwall.png
new file mode 100755
index 0000000..7695dce
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/darkpcnordwall.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/icons/ac.png b/stow_home/awesome/.config/awesome/themes/zenburn/icons/ac.png
new file mode 100755
index 0000000..453af4e
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/icons/ac.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/icons/awesome.png b/stow_home/awesome/.config/awesome/themes/zenburn/icons/awesome.png
new file mode 100755
index 0000000..2db19ca
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/icons/awesome.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/icons/battery.png b/stow_home/awesome/.config/awesome/themes/zenburn/icons/battery.png
new file mode 100755
index 0000000..7dd78a5
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/icons/battery.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/icons/battery_empty.png b/stow_home/awesome/.config/awesome/themes/zenburn/icons/battery_empty.png
new file mode 100755
index 0000000..763aa93
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/icons/battery_empty.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/icons/battery_low.png b/stow_home/awesome/.config/awesome/themes/zenburn/icons/battery_low.png
new file mode 100755
index 0000000..626222f
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/icons/battery_low.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/icons/cpu.png b/stow_home/awesome/.config/awesome/themes/zenburn/icons/cpu.png
new file mode 100755
index 0000000..c28a787
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/icons/cpu.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/icons/dish.png b/stow_home/awesome/.config/awesome/themes/zenburn/icons/dish.png
new file mode 100755
index 0000000..1fc4a6b
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/icons/dish.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/icons/floating.png b/stow_home/awesome/.config/awesome/themes/zenburn/icons/floating.png
new file mode 100755
index 0000000..add7f2b
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/icons/floating.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/icons/fwd.png b/stow_home/awesome/.config/awesome/themes/zenburn/icons/fwd.png
new file mode 100755
index 0000000..e9b875e
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/icons/fwd.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/icons/hdd.png b/stow_home/awesome/.config/awesome/themes/zenburn/icons/hdd.png
new file mode 100755
index 0000000..8922eaa
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/icons/hdd.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/icons/mail.png b/stow_home/awesome/.config/awesome/themes/zenburn/icons/mail.png
new file mode 100755
index 0000000..be656ed
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/icons/mail.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/icons/mail_on.png b/stow_home/awesome/.config/awesome/themes/zenburn/icons/mail_on.png
new file mode 100755
index 0000000..ce8984f
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/icons/mail_on.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/icons/mem.png b/stow_home/awesome/.config/awesome/themes/zenburn/icons/mem.png
new file mode 100755
index 0000000..ee6d480
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/icons/mem.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/icons/net.png b/stow_home/awesome/.config/awesome/themes/zenburn/icons/net.png
new file mode 100755
index 0000000..769bfec
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/icons/net.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/icons/next.png b/stow_home/awesome/.config/awesome/themes/zenburn/icons/next.png
new file mode 100755
index 0000000..9a62593
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/icons/next.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/icons/note.png b/stow_home/awesome/.config/awesome/themes/zenburn/icons/note.png
new file mode 100755
index 0000000..19866aa
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/icons/note.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/icons/note_on.png b/stow_home/awesome/.config/awesome/themes/zenburn/icons/note_on.png
new file mode 100755
index 0000000..aae5ca3
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/icons/note_on.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/icons/pacman.png b/stow_home/awesome/.config/awesome/themes/zenburn/icons/pacman.png
new file mode 100755
index 0000000..575144a
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/icons/pacman.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/icons/pause.png b/stow_home/awesome/.config/awesome/themes/zenburn/icons/pause.png
new file mode 100755
index 0000000..d4546e6
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/icons/pause.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/icons/phones.png b/stow_home/awesome/.config/awesome/themes/zenburn/icons/phones.png
new file mode 100755
index 0000000..bec0e57
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/icons/phones.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/icons/play.png b/stow_home/awesome/.config/awesome/themes/zenburn/icons/play.png
new file mode 100755
index 0000000..b228f74
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/icons/play.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/icons/prev.png b/stow_home/awesome/.config/awesome/themes/zenburn/icons/prev.png
new file mode 100755
index 0000000..4c4ca40
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/icons/prev.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/icons/rwd.png b/stow_home/awesome/.config/awesome/themes/zenburn/icons/rwd.png
new file mode 100755
index 0000000..ac3d6f4
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/icons/rwd.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/icons/scissors.png b/stow_home/awesome/.config/awesome/themes/zenburn/icons/scissors.png
new file mode 100755
index 0000000..30f867d
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/icons/scissors.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/icons/square_sel.png b/stow_home/awesome/.config/awesome/themes/zenburn/icons/square_sel.png
new file mode 100755
index 0000000..874a3a5
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/icons/square_sel.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/icons/square_unsel.png b/stow_home/awesome/.config/awesome/themes/zenburn/icons/square_unsel.png
new file mode 100755
index 0000000..979642f
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/icons/square_unsel.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/icons/stop.png b/stow_home/awesome/.config/awesome/themes/zenburn/icons/stop.png
new file mode 100755
index 0000000..207915b
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/icons/stop.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/icons/submenu.png b/stow_home/awesome/.config/awesome/themes/zenburn/icons/submenu.png
new file mode 100755
index 0000000..e9a6b7c
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/icons/submenu.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/icons/task.png b/stow_home/awesome/.config/awesome/themes/zenburn/icons/task.png
new file mode 100755
index 0000000..962b51a
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/icons/task.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/icons/temp.png b/stow_home/awesome/.config/awesome/themes/zenburn/icons/temp.png
new file mode 100755
index 0000000..7952de8
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/icons/temp.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/icons/tile.png b/stow_home/awesome/.config/awesome/themes/zenburn/icons/tile.png
new file mode 100755
index 0000000..98fe539
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/icons/tile.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/icons/tilebottom.png b/stow_home/awesome/.config/awesome/themes/zenburn/icons/tilebottom.png
new file mode 100755
index 0000000..80ce045
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/icons/tilebottom.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/icons/tileleft.png b/stow_home/awesome/.config/awesome/themes/zenburn/icons/tileleft.png
new file mode 100755
index 0000000..216dec9
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/icons/tileleft.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/icons/tiletop.png b/stow_home/awesome/.config/awesome/themes/zenburn/icons/tiletop.png
new file mode 100755
index 0000000..8bf290e
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/icons/tiletop.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/icons/titlebar/close_focus.png b/stow_home/awesome/.config/awesome/themes/zenburn/icons/titlebar/close_focus.png
new file mode 100755
index 0000000..cccbadc
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/icons/titlebar/close_focus.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/icons/titlebar/close_normal.png b/stow_home/awesome/.config/awesome/themes/zenburn/icons/titlebar/close_normal.png
new file mode 100755
index 0000000..cb0c3fa
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/icons/titlebar/close_normal.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/icons/titlebar/floating_focus_active.png b/stow_home/awesome/.config/awesome/themes/zenburn/icons/titlebar/floating_focus_active.png
new file mode 100755
index 0000000..77ea127
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/icons/titlebar/floating_focus_active.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/icons/titlebar/floating_focus_inactive.png b/stow_home/awesome/.config/awesome/themes/zenburn/icons/titlebar/floating_focus_inactive.png
new file mode 100755
index 0000000..d254a73
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/icons/titlebar/floating_focus_inactive.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/icons/titlebar/floating_normal_active.png b/stow_home/awesome/.config/awesome/themes/zenburn/icons/titlebar/floating_normal_active.png
new file mode 100755
index 0000000..c5ce3de
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/icons/titlebar/floating_normal_active.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/icons/titlebar/floating_normal_inactive.png b/stow_home/awesome/.config/awesome/themes/zenburn/icons/titlebar/floating_normal_inactive.png
new file mode 100755
index 0000000..850b602
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/icons/titlebar/floating_normal_inactive.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/icons/titlebar/maximized_focus_active.png b/stow_home/awesome/.config/awesome/themes/zenburn/icons/titlebar/maximized_focus_active.png
new file mode 100755
index 0000000..9fc0483
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/icons/titlebar/maximized_focus_active.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/icons/titlebar/maximized_focus_inactive.png b/stow_home/awesome/.config/awesome/themes/zenburn/icons/titlebar/maximized_focus_inactive.png
new file mode 100755
index 0000000..f684470
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/icons/titlebar/maximized_focus_inactive.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/icons/titlebar/maximized_normal_active.png b/stow_home/awesome/.config/awesome/themes/zenburn/icons/titlebar/maximized_normal_active.png
new file mode 100755
index 0000000..4aa4196
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/icons/titlebar/maximized_normal_active.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/icons/titlebar/maximized_normal_inactive.png b/stow_home/awesome/.config/awesome/themes/zenburn/icons/titlebar/maximized_normal_inactive.png
new file mode 100755
index 0000000..bfe01a3
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/icons/titlebar/maximized_normal_inactive.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/icons/titlebar/ontop_focus_active.png b/stow_home/awesome/.config/awesome/themes/zenburn/icons/titlebar/ontop_focus_active.png
new file mode 100755
index 0000000..86e61b7
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/icons/titlebar/ontop_focus_active.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/icons/titlebar/ontop_focus_inactive.png b/stow_home/awesome/.config/awesome/themes/zenburn/icons/titlebar/ontop_focus_inactive.png
new file mode 100755
index 0000000..286d439
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/icons/titlebar/ontop_focus_inactive.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/icons/titlebar/ontop_normal_active.png b/stow_home/awesome/.config/awesome/themes/zenburn/icons/titlebar/ontop_normal_active.png
new file mode 100755
index 0000000..fcee772
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/icons/titlebar/ontop_normal_active.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/icons/titlebar/ontop_normal_inactive.png b/stow_home/awesome/.config/awesome/themes/zenburn/icons/titlebar/ontop_normal_inactive.png
new file mode 100755
index 0000000..a628626
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/icons/titlebar/ontop_normal_inactive.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/icons/titlebar/sticky_focus_active.png b/stow_home/awesome/.config/awesome/themes/zenburn/icons/titlebar/sticky_focus_active.png
new file mode 100755
index 0000000..5af45c1
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/icons/titlebar/sticky_focus_active.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/icons/titlebar/sticky_focus_inactive.png b/stow_home/awesome/.config/awesome/themes/zenburn/icons/titlebar/sticky_focus_inactive.png
new file mode 100755
index 0000000..22d7453
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/icons/titlebar/sticky_focus_inactive.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/icons/titlebar/sticky_normal_active.png b/stow_home/awesome/.config/awesome/themes/zenburn/icons/titlebar/sticky_normal_active.png
new file mode 100755
index 0000000..aad079e
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/icons/titlebar/sticky_normal_active.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/icons/titlebar/sticky_normal_inactive.png b/stow_home/awesome/.config/awesome/themes/zenburn/icons/titlebar/sticky_normal_inactive.png
new file mode 100755
index 0000000..5f3e655
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/icons/titlebar/sticky_normal_inactive.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/icons/vol.png b/stow_home/awesome/.config/awesome/themes/zenburn/icons/vol.png
new file mode 100755
index 0000000..8fb9622
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/icons/vol.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/icons/vol_low.png b/stow_home/awesome/.config/awesome/themes/zenburn/icons/vol_low.png
new file mode 100755
index 0000000..32ad78f
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/icons/vol_low.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/icons/vol_mute.png b/stow_home/awesome/.config/awesome/themes/zenburn/icons/vol_mute.png
new file mode 100755
index 0000000..77148fb
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/icons/vol_mute.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/icons/vol_no.png b/stow_home/awesome/.config/awesome/themes/zenburn/icons/vol_no.png
new file mode 100755
index 0000000..f22ed63
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/icons/vol_no.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/layouts/cornerne.png b/stow_home/awesome/.config/awesome/themes/zenburn/layouts/cornerne.png
new file mode 100755
index 0000000..f6014fd
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/layouts/cornerne.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/layouts/cornernw.png b/stow_home/awesome/.config/awesome/themes/zenburn/layouts/cornernw.png
new file mode 100755
index 0000000..cdc085b
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/layouts/cornernw.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/layouts/cornerse.png b/stow_home/awesome/.config/awesome/themes/zenburn/layouts/cornerse.png
new file mode 100755
index 0000000..393202f
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/layouts/cornerse.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/layouts/cornersw.png b/stow_home/awesome/.config/awesome/themes/zenburn/layouts/cornersw.png
new file mode 100755
index 0000000..09298f5
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/layouts/cornersw.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/layouts/dwindle.png b/stow_home/awesome/.config/awesome/themes/zenburn/layouts/dwindle.png
new file mode 100755
index 0000000..6091e80
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/layouts/dwindle.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/layouts/fairh.png b/stow_home/awesome/.config/awesome/themes/zenburn/layouts/fairh.png
new file mode 100755
index 0000000..cf96a98
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/layouts/fairh.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/layouts/fairv.png b/stow_home/awesome/.config/awesome/themes/zenburn/layouts/fairv.png
new file mode 100755
index 0000000..7ce1e6f
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/layouts/fairv.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/layouts/floating.png b/stow_home/awesome/.config/awesome/themes/zenburn/layouts/floating.png
new file mode 100755
index 0000000..6db461c
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/layouts/floating.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/layouts/fullscreen.png b/stow_home/awesome/.config/awesome/themes/zenburn/layouts/fullscreen.png
new file mode 100755
index 0000000..11a0c89
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/layouts/fullscreen.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/layouts/magnifier.png b/stow_home/awesome/.config/awesome/themes/zenburn/layouts/magnifier.png
new file mode 100755
index 0000000..a765ad0
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/layouts/magnifier.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/layouts/max.png b/stow_home/awesome/.config/awesome/themes/zenburn/layouts/max.png
new file mode 100755
index 0000000..95e4774
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/layouts/max.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/layouts/spiral.png b/stow_home/awesome/.config/awesome/themes/zenburn/layouts/spiral.png
new file mode 100755
index 0000000..249e80d
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/layouts/spiral.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/layouts/tile.png b/stow_home/awesome/.config/awesome/themes/zenburn/layouts/tile.png
new file mode 100755
index 0000000..410e2b0
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/layouts/tile.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/layouts/tilebottom.png b/stow_home/awesome/.config/awesome/themes/zenburn/layouts/tilebottom.png
new file mode 100755
index 0000000..f957c74
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/layouts/tilebottom.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/layouts/tileleft.png b/stow_home/awesome/.config/awesome/themes/zenburn/layouts/tileleft.png
new file mode 100755
index 0000000..c269e71
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/layouts/tileleft.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/layouts/tiletop.png b/stow_home/awesome/.config/awesome/themes/zenburn/layouts/tiletop.png
new file mode 100755
index 0000000..4d21c20
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/layouts/tiletop.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/taglist/squarefz.png b/stow_home/awesome/.config/awesome/themes/zenburn/taglist/squarefz.png
new file mode 100755
index 0000000..5724708
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/taglist/squarefz.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/taglist/squarez.png b/stow_home/awesome/.config/awesome/themes/zenburn/taglist/squarez.png
new file mode 100755
index 0000000..517f937
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/taglist/squarez.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/theme.lua b/stow_home/awesome/.config/awesome/themes/zenburn/theme.lua
new file mode 100755
index 0000000..d97253d
--- /dev/null
+++ b/stow_home/awesome/.config/awesome/themes/zenburn/theme.lua
@@ -0,0 +1,130 @@
+-------------------------------
+-- "Zenburn" awesome theme --
+-- By Adrian C. (anrxc) --
+-------------------------------
+
+local themes_path = require("gears.filesystem").get_themes_dir()
+local dpi = require("beautiful.xresources").apply_dpi
+local lain = require("lain")
+local awful = require("awful")
+local wibox = require("wibox")
+
+-- {{{ Main
+local theme = {}
+theme.wallpaper = themes_path .. "zenburn/darkpcnordwall.png"
+-- }}}
+
+-- {{{ Styles
+
+-- {{{ Colors
+theme.font = "mononoki Nerd Font 11"
+theme.taglist_font = "Roboto Mono Nerd Font 13"
+theme.fg_normal = "#eceff4" -- white
+theme.fg_focus = "#434c5e" -- dark blue not so
+theme.fg_urgent = "#b48ead" -- purple
+theme.bg_normal = "#2e3440" -- dark blue
+theme.bg_focus = "#a3be8c" -- green
+theme.bg_urgent = "#b48ead"
+
+theme.taglist_fg_focus = "#282a36"
+
+theme.tasklist_bg_focus = "#4c566a" -- dark light blue
+theme.tasklist_fg_focus = "#a3be8c" -- green
+
+theme.titlebar_bg_focus = "#3F3F3F"
+theme.titlebar_bg_normal = "#3F3F3F"
+theme.titlebar_bg_focus = theme.bg_focus
+theme.titlebar_bg_normal = theme.bg_normal
+theme.titlebar_fg_focus = theme.fg_focus
+-- }}}
+
+-- {{{ Borders
+theme.border_width = 1
+theme.border_normal = "#5e81ac"
+theme.border_focus = "#bf616a"
+theme.border_marked = "#CC9393"
+theme.useless_gap = 0
+-- }}}
+
+-- {{{ Titlebars
+theme.titlebar_bg_focus = "#3F3F3F"
+theme.titlebar_bg_normal = "#3F3F3F"
+
+theme.tasklist_plain_task_name = true
+theme.tasklist_disable_icon = true
+-- }}}
+
+-- There are other variable sets
+-- overriding the default one when
+-- defined, the sets are:
+-- [taglist|tasklist]_[bg|fg]_[focus|urgent|occupied|empty|volatile]
+-- titlebar_[normal|focus]
+-- tooltip_[font|opacity|fg_color|bg_color|border_width|border_color]
+-- Example:
+--theme.taglist_bg_focus = "#CC9393"
+-- }}}
+
+-- {{{ Widgets
+-- You can add as many variables as
+-- you wish and access them by using
+-- beautiful.variable in your rc.lua
+--theme.fg_widget = "#AECF96"
+--theme.fg_center_widget = "#88A175"
+--theme.fg_end_widget = "#FF5656"
+--theme.bg_widget = "#494B4F"
+--theme.border_widget = "#3F3F3F"
+-- }}}
+
+-- {{{ Mouse finder
+theme.mouse_finder_color = "#CC9393"
+-- mouse_finder_[timeout|animate_timeout|radius|factor]
+-- }}}
+
+-- {{{ Menu
+-- Variables set for theming the menu:
+-- menu_[bg|fg]_[normal|focus]
+-- menu_[border_color|border_width]
+
+theme.menu_height = dpi(20)
+theme.menu_width = dpi(130)
+-- }}}
+
+-- {{{ Icons
+-- {{{ Taglist
+theme.taglist_squares_sel = themes_path .. "zenburn/taglist/squarefz.png"
+theme.taglist_squares_unsel = themes_path .. "zenburn/taglist/squarez.png"
+--theme.taglist_squares_resize = "false"
+-- }}}
+
+-- {{{ Misc
+theme.awesome_icon = themes_path .. "zenburn/icons/awesome.png"
+theme.menu_submenu_icon = themes_path .. "zenburn/icons/submenu.png"
+-- }}}
+
+-- {{{ Layout
+theme.layout_tile = themes_path .. "zenburn/layouts/tile.png"
+theme.layout_tileleft = themes_path .. "zenburn/layouts/tileleft.png"
+theme.layout_tilebottom = themes_path .. "zenburn/layouts/tilebottom.png"
+theme.layout_tiletop = themes_path .. "zenburn/layouts/tiletop.png"
+theme.layout_fairv = themes_path .. "zenburn/layouts/fairv.png"
+theme.layout_fairh = themes_path .. "zenburn/layouts/fairh.png"
+theme.layout_spiral = themes_path .. "zenburn/layouts/spiral.png"
+theme.layout_dwindle = themes_path .. "zenburn/layouts/dwindle.png"
+theme.layout_max = themes_path .. "zenburn/layouts/max.png"
+theme.layout_fullscreen = themes_path .. "zenburn/layouts/fullscreen.png"
+theme.layout_magnifier = themes_path .. "zenburn/layouts/magnifier.png"
+theme.layout_floating = themes_path .. "zenburn/layouts/floating.png"
+theme.layout_cornernw = themes_path .. "zenburn/layouts/cornernw.png"
+theme.layout_cornerne = themes_path .. "zenburn/layouts/cornerne.png"
+theme.layout_cornersw = themes_path .. "zenburn/layouts/cornersw.png"
+theme.layout_cornerse = themes_path .. "zenburn/layouts/cornerse.png"
+-- }}}
+
+-- {{{ Titlebar
+
+-- }}}
+-- }}}
+
+return theme
+
+-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/titlebar/close_focus.png b/stow_home/awesome/.config/awesome/themes/zenburn/titlebar/close_focus.png
new file mode 100755
index 0000000..9fc8ea2
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/titlebar/close_focus.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/titlebar/close_normal.png b/stow_home/awesome/.config/awesome/themes/zenburn/titlebar/close_normal.png
new file mode 100755
index 0000000..6e6b645
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/titlebar/close_normal.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/titlebar/floating_focus_active.png b/stow_home/awesome/.config/awesome/themes/zenburn/titlebar/floating_focus_active.png
new file mode 100755
index 0000000..044ba1d
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/titlebar/floating_focus_active.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/titlebar/floating_focus_inactive.png b/stow_home/awesome/.config/awesome/themes/zenburn/titlebar/floating_focus_inactive.png
new file mode 100755
index 0000000..94b0360
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/titlebar/floating_focus_inactive.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/titlebar/floating_normal_active.png b/stow_home/awesome/.config/awesome/themes/zenburn/titlebar/floating_normal_active.png
new file mode 100755
index 0000000..878a9fb
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/titlebar/floating_normal_active.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/titlebar/floating_normal_inactive.png b/stow_home/awesome/.config/awesome/themes/zenburn/titlebar/floating_normal_inactive.png
new file mode 100755
index 0000000..4147c7d
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/titlebar/floating_normal_inactive.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/titlebar/maximized_focus_active.png b/stow_home/awesome/.config/awesome/themes/zenburn/titlebar/maximized_focus_active.png
new file mode 100755
index 0000000..e5af7e9
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/titlebar/maximized_focus_active.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/titlebar/maximized_focus_inactive.png b/stow_home/awesome/.config/awesome/themes/zenburn/titlebar/maximized_focus_inactive.png
new file mode 100755
index 0000000..298751c
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/titlebar/maximized_focus_inactive.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/titlebar/maximized_normal_active.png b/stow_home/awesome/.config/awesome/themes/zenburn/titlebar/maximized_normal_active.png
new file mode 100755
index 0000000..1dca071
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/titlebar/maximized_normal_active.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/titlebar/maximized_normal_inactive.png b/stow_home/awesome/.config/awesome/themes/zenburn/titlebar/maximized_normal_inactive.png
new file mode 100755
index 0000000..f943ac7
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/titlebar/maximized_normal_inactive.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/titlebar/ontop_focus_active.png b/stow_home/awesome/.config/awesome/themes/zenburn/titlebar/ontop_focus_active.png
new file mode 100755
index 0000000..b2a79bd
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/titlebar/ontop_focus_active.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/titlebar/ontop_focus_inactive.png b/stow_home/awesome/.config/awesome/themes/zenburn/titlebar/ontop_focus_inactive.png
new file mode 100755
index 0000000..04bc63a
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/titlebar/ontop_focus_inactive.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/titlebar/ontop_normal_active.png b/stow_home/awesome/.config/awesome/themes/zenburn/titlebar/ontop_normal_active.png
new file mode 100755
index 0000000..8d9cb5b
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/titlebar/ontop_normal_active.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/titlebar/ontop_normal_inactive.png b/stow_home/awesome/.config/awesome/themes/zenburn/titlebar/ontop_normal_inactive.png
new file mode 100755
index 0000000..d383c77
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/titlebar/ontop_normal_inactive.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/titlebar/sticky_focus_active.png b/stow_home/awesome/.config/awesome/themes/zenburn/titlebar/sticky_focus_active.png
new file mode 100755
index 0000000..bbba813
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/titlebar/sticky_focus_active.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/titlebar/sticky_focus_inactive.png b/stow_home/awesome/.config/awesome/themes/zenburn/titlebar/sticky_focus_inactive.png
new file mode 100755
index 0000000..1a0c481
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/titlebar/sticky_focus_inactive.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/titlebar/sticky_normal_active.png b/stow_home/awesome/.config/awesome/themes/zenburn/titlebar/sticky_normal_active.png
new file mode 100755
index 0000000..50a6d2b
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/titlebar/sticky_normal_active.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/titlebar/sticky_normal_inactive.png b/stow_home/awesome/.config/awesome/themes/zenburn/titlebar/sticky_normal_inactive.png
new file mode 100755
index 0000000..ea09406
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/titlebar/sticky_normal_inactive.png differ
diff --git a/stow_home/awesome/.config/awesome/themes/zenburn/zenburn-background.png b/stow_home/awesome/.config/awesome/themes/zenburn/zenburn-background.png
new file mode 100755
index 0000000..6dd7df2
Binary files /dev/null and b/stow_home/awesome/.config/awesome/themes/zenburn/zenburn-background.png differ
diff --git a/stow_home/bat/.config/bat/config b/stow_home/bat/.config/bat/config
new file mode 100644
index 0000000..9f9ebe5
--- /dev/null
+++ b/stow_home/bat/.config/bat/config
@@ -0,0 +1,4 @@
+# Quite a simple config file right?
+--theme="Nord"
+--italic-text=always
+
diff --git a/stow_home/dunst/.config/dunst/dunstrc b/stow_home/dunst/.config/dunst/dunstrc
new file mode 100644
index 0000000..787991a
--- /dev/null
+++ b/stow_home/dunst/.config/dunst/dunstrc
@@ -0,0 +1,325 @@
+[global]
+ monitor = 0
+
+ follow = mouse
+
+ geometry = "0x0-8+30"
+
+ # Turn on the progess bar
+ progress_bar = true
+
+ # Set the progress bar height. This includes the frame, so make sure
+ # it's at least twice as big as the frame width.
+ progress_bar_height = 5
+
+ # Set the frame width of the progress bar
+ progress_bar_frame_width = 1
+
+ # Set the minimum width for the progress bar
+ progress_bar_min_width = 150
+
+ # Set the maximum width for the progress bar
+ progress_bar_max_width = 300
+
+
+ # Show how many messages are currently hidden (because of geometry).
+ indicate_hidden = yes
+
+ # Shrink window if it's smaller than the width. Will be ignored if
+ # width is 0.
+ shrink = no
+
+ # The transparency of the window. Range: [0; 100].
+ # This option will only work if a compositing window manager is
+ # present (e.g. xcompmgr, compiz, etc.).
+ transparency = 0
+
+ # The height of the entire notification. If the height is smaller
+ # than the font height and padding combined, it will be raised
+ # to the font height and padding.
+ notification_height = 2
+
+ # Draw a line of "separator_height" pixel height between two
+ # notifications.
+ # Set to 0 to disable.
+ separator_height = 3
+
+ # Padding between text and separator.
+ padding = 8
+
+ # Horizontal padding.
+ horizontal_padding = 8
+
+ # Padding between text and icon.
+ text_icon_padding = 0
+
+ # Defines width in pixels of frame around the notification window.
+ # Set to 0 to disable.
+ frame_width = 3
+
+ # Defines color of the frame around the notification window.
+ frame_color = "#a3be8c"
+#bar_color[1] = rgb:2e/34/40,rgb:eb/cb/8b,rgb:a3/be/8c,rgb:bf/61/6a,rgb:b4/8e/
+ # Define a color for the separator.
+ # possible values are:
+ # * auto: dunst tries to find a color fitting to the background;
+ # * foreground: use the same color as the foreground;
+ # * frame: use the same color as the frame;
+ # * anything else will be interpreted as a X color.
+ separator_color = auto
+
+ # Sort messages by urgency.
+ sort = yes
+
+ # Don't remove messages, if the user is idle (no mouse or keyboard input)
+ # for longer than idle_threshold seconds.
+ # Set to 0 to disable.
+ # A client can set the 'transient' hint to bypass this. See the rules
+ # section for how to disable this if necessary
+ idle_threshold = 120
+
+ ### Text ###
+
+ font = BlexMono Nerd Font 10
+
+ # The spacing between lines. If the height is smaller than the
+ # font height, it will get raised to the font height.
+ line_height = 0
+
+ # Possible values are:
+ # full: Allow a small subset of html markup in notifications:
+ # bold
+ # italic
+ # strikethrough
+ # underline
+ #
+ # For a complete reference see
+ # .
+ #
+ # strip: This setting is provided for compatibility with some broken
+ # clients that send markup even though it's not enabled on the
+ # server. Dunst will try to strip the markup but the parsing is
+ # simplistic so using this option outside of matching rules for
+ # specific applications *IS GREATLY DISCOURAGED*.
+ #
+ # no: Disable markup parsing, incoming notifications will be treated as
+ # plain text. Dunst will not advertise that it has the body-markup
+ # capability if this is set as a global setting.
+ #
+ # It's important to note that markup inside the format option will be parsed
+ # regardless of what this is set to.
+ markup = full
+
+ # The format of the message. Possible variables are:
+ # %a appname
+ # %s summary
+ # %b body
+ # %i iconname (including its path)
+ # %I iconname (without its path)
+ # %p progress value if set ([ 0%] to [100%]) or nothing
+ # %n progress value if set without any extra characters
+ # %% Literal %
+ # Markup is allowed
+ format = "%s\n%b"
+
+ # Alignment of message text.
+ # Possible values are "left", "center" and "right".
+ alignment = left
+
+ # Vertical alignment of message text and icon.
+ # Possible values are "top", "center" and "bottom".
+ vertical_alignment = center
+
+ # Show age of message if message is older than show_age_threshold
+ # seconds.
+ # Set to -1 to disable.
+ show_age_threshold = 60
+
+ # Split notifications into multiple lines if they don't fit into
+ # geometry.
+ word_wrap = yes
+
+ # When word_wrap is set to no, specify where to make an ellipsis in long lines.
+ # Possible values are "start", "middle" and "end".
+ ellipsize = middle
+
+ # Ignore newlines '\n' in notifications.
+ ignore_newline = no
+
+ # Stack together notifications with the same content
+ stack_duplicates = true
+
+ # Hide the count of stacked notifications with the same content
+ hide_duplicate_count = false
+
+ # Display indicators for URLs (U) and actions (A).
+ show_indicators = yes
+
+ ### Icons ###
+
+ # Align icons left/right/off
+ icon_position = left
+
+ # Scale small icons up to this size, set to 0 to disable. Helpful
+ # for e.g. small files or high-dpi screens. In case of conflict,
+ # max_icon_size takes precedence over this.
+ min_icon_size = 20
+
+ # Scale larger icons down to this size, set to 0 to disable
+ max_icon_size = 22
+
+ # Paths to default icons.
+ icon_path = /usr/share/icons/gnome/16x16/status/:/usr/share/icons/gnome/16x16/devices/
+
+ ### History ###
+
+ # Should a notification popped up from history be sticky or timeout
+ # as if it would normally do.
+ sticky_history = yes
+
+ # Maximum amount of notifications kept in history
+ history_length = 20
+
+ ### Misc/Advanced ###
+
+ # dmenu path.
+ dmenu = /usr/bin/dmenu -p dunst:
+
+ # Browser for opening urls in context menu.
+ browser = /usr/bin/firefox -new-tab
+
+ # Always run rule-defined scripts, even if the notification is suppressed
+ always_run_script = true
+
+ # Define the title of the windows spawned by dunst
+ title = Dunst
+
+ # Define the class of the windows spawned by dunst
+ class = Dunst
+
+ # Print a notification on startup.
+ # This is mainly for error detection, since dbus (re-)starts dunst
+ # automatically after a crash.
+ startup_notification = false
+
+ # Manage dunst's desire for talking
+ # Can be one of the following values:
+ # crit: Critical features. Dunst aborts
+ # warn: Only non-fatal warnings
+ # mesg: Important Messages
+ # info: all unimportant stuff
+ # debug: all less than unimportant stuff
+ verbosity = mesg
+
+ # Define the corner radius of the notification window
+ # in pixel size. If the radius is 0, you have no rounded
+ # corners.
+ # The radius will be automatically lowered if it exceeds half of the
+ # notification height to avoid clipping text and/or icons.
+ corner_radius = 7
+
+ # Ignore the dbus closeNotification message.
+ # Useful to enforce the timeout set by dunst configuration. Without this
+ # parameter, an application may close the notification sent before the
+ # user defined timeout.
+ ignore_dbusclose = false
+
+ ### Wayland ###
+ # These settings are Wayland-specific. They have no effect when using X11
+
+ # Uncomment this if you want to let notications appear under fullscreen
+ # applications (default: overlay)
+ # layer = top
+
+ # Set this to true to use X11 output on Wayland.
+ force_xwayland = false
+
+ ### Legacy
+
+ # Use the Xinerama extension instead of RandR for multi-monitor support.
+ # This setting is provided for compatibility with older nVidia drivers that
+ # do not support RandR and using it on systems that support RandR is highly
+ # discouraged.
+ #
+ # By enabling this setting dunst will not be able to detect when a monitor
+ # is connected or disconnected which might break follow mode if the screen
+ # layout changes.
+ force_xinerama = false
+
+ ### mouse
+
+ # Defines list of actions for each mouse event
+ # Possible values are:
+ # * none: Don't do anything.
+ # * do_action: If the notification has exactly one action, or one is marked as default,
+ # invoke it. If there are multiple and no default, open the context menu.
+ # * close_current: Close current notification.
+ # * close_all: Close all notifications.
+ # These values can be strung together for each mouse event, and
+ # will be executed in sequence.
+ mouse_left_click = do_action, close_current
+ mouse_middle_click = close_all
+ mouse_right_click = close_current
+
+# Experimental features that may or may not work correctly. Do not expect them
+# to have a consistent behaviour across releases.
+[experimental]
+ # Calculate the dpi to use on a per-monitor basis.
+ # If this setting is enabled the Xft.dpi value will be ignored and instead
+ # dunst will attempt to calculate an appropriate dpi value for each monitor
+ # using the resolution and physical size. This might be useful in setups
+ # where there are multiple screens with very different dpi values.
+ per_monitor_dpi = false
+
+# The internal keyboard shortcut support in dunst is now considered deprecated
+# and should be replaced by dunstctl calls. You can use the configuration of your
+# WM or DE to bind these to shortcuts of your choice.
+# Check the dunstctl manual page for more info.
+[shortcuts]
+
+ # Shortcuts are specified as [modifier+][modifier+]...key
+ # Available modifiers are "ctrl", "mod1" (the alt-key), "mod2",
+ # "mod3" and "mod4" (windows-key).
+ # Xev might be helpful to find names for keys.
+
+ # Close notification. Equivalent dunstctl command:
+ # dunstctl close
+ # close = ctrl+space
+
+ # Close all notifications. Equivalent dunstctl command:
+ # dunstctl close-all
+ # close_all = ctrl+shift+space
+
+ # Redisplay last message(s). Equivalent dunstctl command:
+ # dunstctl history-pop
+ # history = ctrl+grave
+
+ # Context menu. Equivalent dunstctl command:
+ # dunstctl context
+ # context = ctrl+shift+period
+
+[urgency_low]
+ # IMPORTANT: colors have to be defined in quotation marks.
+ # Otherwise the "#" and following would be interpreted as a comment.
+ background = "#434c5e"
+ foreground = "eceff4"
+ timeout = 6
+ # Icon for notifications with low urgency, uncomment to enable
+ #icon = /path/to/icon
+
+[urgency_normal]
+ background = "#434c5e"
+ foreground = "#eceff4"
+ timeout = 6
+ # Icon for notifications with normal urgency, uncomment to enable
+ #icon = /path/to/icon
+
+[urgency_critical]
+ background = "#900000"
+ foreground = "#eceff4"
+ frame_color = "#ff0000"
+ timeout = 0
+ # Icon for notifications with critical urgency, uncomment to enable
+ #icon = /path/to/icon
+
+
diff --git a/stow_home/nvim/.config/nvim/autoload/plug.vim b/stow_home/nvim/.config/nvim/autoload/plug.vim
new file mode 100644
index 0000000..6a958cb
--- /dev/null
+++ b/stow_home/nvim/.config/nvim/autoload/plug.vim
@@ -0,0 +1,2801 @@
+" vim-plug: Vim plugin manager
+" ============================
+"
+" Download plug.vim and put it in ~/.vim/autoload
+"
+" curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
+" https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
+"
+" Edit your .vimrc
+"
+" call plug#begin('~/.vim/plugged')
+"
+" " Make sure you use single quotes
+"
+" " Shorthand notation; fetches https://github.com/junegunn/vim-easy-align
+" Plug 'junegunn/vim-easy-align'
+"
+" " Any valid git URL is allowed
+" Plug 'https://github.com/junegunn/vim-github-dashboard.git'
+"
+" " Multiple Plug commands can be written in a single line using | separators
+" Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'
+"
+" " On-demand loading
+" Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
+" Plug 'tpope/vim-fireplace', { 'for': 'clojure' }
+"
+" " Using a non-default branch
+" Plug 'rdnetto/YCM-Generator', { 'branch': 'stable' }
+"
+" " Using a tagged release; wildcard allowed (requires git 1.9.2 or above)
+" Plug 'fatih/vim-go', { 'tag': '*' }
+"
+" " Plugin options
+" Plug 'nsf/gocode', { 'tag': 'v.20150303', 'rtp': 'vim' }
+"
+" " Plugin outside ~/.vim/plugged with post-update hook
+" Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
+"
+" " Unmanaged plugin (manually installed and updated)
+" Plug '~/my-prototype-plugin'
+"
+" " Initialize plugin system
+" call plug#end()
+"
+" Then reload .vimrc and :PlugInstall to install plugins.
+"
+" Plug options:
+"
+"| Option | Description |
+"| ----------------------- | ------------------------------------------------ |
+"| `branch`/`tag`/`commit` | Branch/tag/commit of the repository to use |
+"| `rtp` | Subdirectory that contains Vim plugin |
+"| `dir` | Custom directory for the plugin |
+"| `as` | Use different name for the plugin |
+"| `do` | Post-update hook (string or funcref) |
+"| `on` | On-demand loading: Commands or ``-mappings |
+"| `for` | On-demand loading: File types |
+"| `frozen` | Do not update unless explicitly specified |
+"
+" More information: https://github.com/junegunn/vim-plug
+"
+"
+" Copyright (c) 2017 Junegunn Choi
+"
+" MIT License
+"
+" Permission is hereby granted, free of charge, to any person obtaining
+" a copy of this software and associated documentation files (the
+" "Software"), to deal in the Software without restriction, including
+" without limitation the rights to use, copy, modify, merge, publish,
+" distribute, sublicense, and/or sell copies of the Software, and to
+" permit persons to whom the Software is furnished to do so, subject to
+" the following conditions:
+"
+" The above copyright notice and this permission notice shall be
+" included in all copies or substantial portions of the Software.
+"
+" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+" NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+" LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+" OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+" WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+if exists('g:loaded_plug')
+ finish
+endif
+let g:loaded_plug = 1
+
+let s:cpo_save = &cpo
+set cpo&vim
+
+let s:plug_src = 'https://github.com/junegunn/vim-plug.git'
+let s:plug_tab = get(s:, 'plug_tab', -1)
+let s:plug_buf = get(s:, 'plug_buf', -1)
+let s:mac_gui = has('gui_macvim') && has('gui_running')
+let s:is_win = has('win32')
+let s:nvim = has('nvim-0.2') || (has('nvim') && exists('*jobwait') && !s:is_win)
+let s:vim8 = has('patch-8.0.0039') && exists('*job_start')
+if s:is_win && &shellslash
+ set noshellslash
+ let s:me = resolve(expand(':p'))
+ set shellslash
+else
+ let s:me = resolve(expand(':p'))
+endif
+let s:base_spec = { 'branch': '', 'frozen': 0 }
+let s:TYPE = {
+\ 'string': type(''),
+\ 'list': type([]),
+\ 'dict': type({}),
+\ 'funcref': type(function('call'))
+\ }
+let s:loaded = get(s:, 'loaded', {})
+let s:triggers = get(s:, 'triggers', {})
+
+function! s:is_powershell(shell)
+ return a:shell =~# 'powershell\(\.exe\)\?$' || a:shell =~# 'pwsh\(\.exe\)\?$'
+endfunction
+
+function! s:isabsolute(dir) abort
+ return a:dir =~# '^/' || (has('win32') && a:dir =~? '^\%(\\\|[A-Z]:\)')
+endfunction
+
+function! s:git_dir(dir) abort
+ let gitdir = s:trim(a:dir) . '/.git'
+ if isdirectory(gitdir)
+ return gitdir
+ endif
+ if !filereadable(gitdir)
+ return ''
+ endif
+ let gitdir = matchstr(get(readfile(gitdir), 0, ''), '^gitdir: \zs.*')
+ if len(gitdir) && !s:isabsolute(gitdir)
+ let gitdir = a:dir . '/' . gitdir
+ endif
+ return isdirectory(gitdir) ? gitdir : ''
+endfunction
+
+function! s:git_origin_url(dir) abort
+ let gitdir = s:git_dir(a:dir)
+ let config = gitdir . '/config'
+ if empty(gitdir) || !filereadable(config)
+ return ''
+ endif
+ return matchstr(join(readfile(config)), '\[remote "origin"\].\{-}url\s*=\s*\zs\S*\ze')
+endfunction
+
+function! s:git_revision(dir) abort
+ let gitdir = s:git_dir(a:dir)
+ let head = gitdir . '/HEAD'
+ if empty(gitdir) || !filereadable(head)
+ return ''
+ endif
+
+ let line = get(readfile(head), 0, '')
+ let ref = matchstr(line, '^ref: \zs.*')
+ if empty(ref)
+ return line
+ endif
+
+ if filereadable(gitdir . '/' . ref)
+ return get(readfile(gitdir . '/' . ref), 0, '')
+ endif
+
+ if filereadable(gitdir . '/packed-refs')
+ for line in readfile(gitdir . '/packed-refs')
+ if line =~# ' ' . ref
+ return matchstr(line, '^[0-9a-f]*')
+ endif
+ endfor
+ endif
+
+ return ''
+endfunction
+
+function! s:git_local_branch(dir) abort
+ let gitdir = s:git_dir(a:dir)
+ let head = gitdir . '/HEAD'
+ if empty(gitdir) || !filereadable(head)
+ return ''
+ endif
+ let branch = matchstr(get(readfile(head), 0, ''), '^ref: refs/heads/\zs.*')
+ return len(branch) ? branch : 'HEAD'
+endfunction
+
+function! s:git_origin_branch(spec)
+ if len(a:spec.branch)
+ return a:spec.branch
+ endif
+
+ " The file may not be present if this is a local repository
+ let gitdir = s:git_dir(a:spec.dir)
+ let origin_head = gitdir.'/refs/remotes/origin/HEAD'
+ if len(gitdir) && filereadable(origin_head)
+ return matchstr(get(readfile(origin_head), 0, ''),
+ \ '^ref: refs/remotes/origin/\zs.*')
+ endif
+
+ " The command may not return the name of a branch in detached HEAD state
+ let result = s:lines(s:system('git symbolic-ref --short HEAD', a:spec.dir))
+ return v:shell_error ? '' : result[-1]
+endfunction
+
+if s:is_win
+ function! s:plug_call(fn, ...)
+ let shellslash = &shellslash
+ try
+ set noshellslash
+ return call(a:fn, a:000)
+ finally
+ let &shellslash = shellslash
+ endtry
+ endfunction
+else
+ function! s:plug_call(fn, ...)
+ return call(a:fn, a:000)
+ endfunction
+endif
+
+function! s:plug_getcwd()
+ return s:plug_call('getcwd')
+endfunction
+
+function! s:plug_fnamemodify(fname, mods)
+ return s:plug_call('fnamemodify', a:fname, a:mods)
+endfunction
+
+function! s:plug_expand(fmt)
+ return s:plug_call('expand', a:fmt, 1)
+endfunction
+
+function! s:plug_tempname()
+ return s:plug_call('tempname')
+endfunction
+
+function! plug#begin(...)
+ if a:0 > 0
+ let s:plug_home_org = a:1
+ let home = s:path(s:plug_fnamemodify(s:plug_expand(a:1), ':p'))
+ elseif exists('g:plug_home')
+ let home = s:path(g:plug_home)
+ elseif !empty(&rtp)
+ let home = s:path(split(&rtp, ',')[0]) . '/plugged'
+ else
+ return s:err('Unable to determine plug home. Try calling plug#begin() with a path argument.')
+ endif
+ if s:plug_fnamemodify(home, ':t') ==# 'plugin' && s:plug_fnamemodify(home, ':h') ==# s:first_rtp
+ return s:err('Invalid plug home. '.home.' is a standard Vim runtime path and is not allowed.')
+ endif
+
+ let g:plug_home = home
+ let g:plugs = {}
+ let g:plugs_order = []
+ let s:triggers = {}
+
+ call s:define_commands()
+ return 1
+endfunction
+
+function! s:define_commands()
+ command! -nargs=+ -bar Plug call plug#()
+ if !executable('git')
+ return s:err('`git` executable not found. Most commands will not be available. To suppress this message, prepend `silent!` to `call plug#begin(...)`.')
+ endif
+ if has('win32')
+ \ && &shellslash
+ \ && (&shell =~# 'cmd\(\.exe\)\?$' || s:is_powershell(&shell))
+ return s:err('vim-plug does not support shell, ' . &shell . ', when shellslash is set.')
+ endif
+ if !has('nvim')
+ \ && (has('win32') || has('win32unix'))
+ \ && !has('multi_byte')
+ return s:err('Vim needs +multi_byte feature on Windows to run shell commands. Enable +iconv for best results.')
+ endif
+ command! -nargs=* -bar -bang -complete=customlist,s:names PlugInstall call s:install(0, [])
+ command! -nargs=* -bar -bang -complete=customlist,s:names PlugUpdate call s:update(0, [])
+ command! -nargs=0 -bar -bang PlugClean call s:clean(0)
+ command! -nargs=0 -bar PlugUpgrade if s:upgrade() | execute 'source' s:esc(s:me) | endif
+ command! -nargs=0 -bar PlugStatus call s:status()
+ command! -nargs=0 -bar PlugDiff call s:diff()
+ command! -nargs=? -bar -bang -complete=file PlugSnapshot call s:snapshot(0, )
+endfunction
+
+function! s:to_a(v)
+ return type(a:v) == s:TYPE.list ? a:v : [a:v]
+endfunction
+
+function! s:to_s(v)
+ return type(a:v) == s:TYPE.string ? a:v : join(a:v, "\n") . "\n"
+endfunction
+
+function! s:glob(from, pattern)
+ return s:lines(globpath(a:from, a:pattern))
+endfunction
+
+function! s:source(from, ...)
+ let found = 0
+ for pattern in a:000
+ for vim in s:glob(a:from, pattern)
+ execute 'source' s:esc(vim)
+ let found = 1
+ endfor
+ endfor
+ return found
+endfunction
+
+function! s:assoc(dict, key, val)
+ let a:dict[a:key] = add(get(a:dict, a:key, []), a:val)
+endfunction
+
+function! s:ask(message, ...)
+ call inputsave()
+ echohl WarningMsg
+ let answer = input(a:message.(a:0 ? ' (y/N/a) ' : ' (y/N) '))
+ echohl None
+ call inputrestore()
+ echo "\r"
+ return (a:0 && answer =~? '^a') ? 2 : (answer =~? '^y') ? 1 : 0
+endfunction
+
+function! s:ask_no_interrupt(...)
+ try
+ return call('s:ask', a:000)
+ catch
+ return 0
+ endtry
+endfunction
+
+function! s:lazy(plug, opt)
+ return has_key(a:plug, a:opt) &&
+ \ (empty(s:to_a(a:plug[a:opt])) ||
+ \ !isdirectory(a:plug.dir) ||
+ \ len(s:glob(s:rtp(a:plug), 'plugin')) ||
+ \ len(s:glob(s:rtp(a:plug), 'after/plugin')))
+endfunction
+
+function! plug#end()
+ if !exists('g:plugs')
+ return s:err('plug#end() called without calling plug#begin() first')
+ endif
+
+ if exists('#PlugLOD')
+ augroup PlugLOD
+ autocmd!
+ augroup END
+ augroup! PlugLOD
+ endif
+ let lod = { 'ft': {}, 'map': {}, 'cmd': {} }
+
+ if exists('g:did_load_filetypes')
+ filetype off
+ endif
+ for name in g:plugs_order
+ if !has_key(g:plugs, name)
+ continue
+ endif
+ let plug = g:plugs[name]
+ if get(s:loaded, name, 0) || !s:lazy(plug, 'on') && !s:lazy(plug, 'for')
+ let s:loaded[name] = 1
+ continue
+ endif
+
+ if has_key(plug, 'on')
+ let s:triggers[name] = { 'map': [], 'cmd': [] }
+ for cmd in s:to_a(plug.on)
+ if cmd =~? '^.\+'
+ if empty(mapcheck(cmd)) && empty(mapcheck(cmd, 'i'))
+ call s:assoc(lod.map, cmd, name)
+ endif
+ call add(s:triggers[name].map, cmd)
+ elseif cmd =~# '^[A-Z]'
+ let cmd = substitute(cmd, '!*$', '', '')
+ if exists(':'.cmd) != 2
+ call s:assoc(lod.cmd, cmd, name)
+ endif
+ call add(s:triggers[name].cmd, cmd)
+ else
+ call s:err('Invalid `on` option: '.cmd.
+ \ '. Should start with an uppercase letter or ``.')
+ endif
+ endfor
+ endif
+
+ if has_key(plug, 'for')
+ let types = s:to_a(plug.for)
+ if !empty(types)
+ augroup filetypedetect
+ call s:source(s:rtp(plug), 'ftdetect/**/*.vim', 'after/ftdetect/**/*.vim')
+ augroup END
+ endif
+ for type in types
+ call s:assoc(lod.ft, type, name)
+ endfor
+ endif
+ endfor
+
+ for [cmd, names] in items(lod.cmd)
+ execute printf(
+ \ 'command! -nargs=* -range -bang -complete=file %s call s:lod_cmd(%s, "", , , , %s)',
+ \ cmd, string(cmd), string(names))
+ endfor
+
+ for [map, names] in items(lod.map)
+ for [mode, map_prefix, key_prefix] in
+ \ [['i', '', ''], ['n', '', ''], ['v', '', 'gv'], ['o', '', '']]
+ execute printf(
+ \ '%snoremap %s %s:call lod_map(%s, %s, %s, "%s")',
+ \ mode, map, map_prefix, string(map), string(names), mode != 'i', key_prefix)
+ endfor
+ endfor
+
+ for [ft, names] in items(lod.ft)
+ augroup PlugLOD
+ execute printf('autocmd FileType %s call lod_ft(%s, %s)',
+ \ ft, string(ft), string(names))
+ augroup END
+ endfor
+
+ call s:reorg_rtp()
+ filetype plugin indent on
+ if has('vim_starting')
+ if has('syntax') && !exists('g:syntax_on')
+ syntax enable
+ end
+ else
+ call s:reload_plugins()
+ endif
+endfunction
+
+function! s:loaded_names()
+ return filter(copy(g:plugs_order), 'get(s:loaded, v:val, 0)')
+endfunction
+
+function! s:load_plugin(spec)
+ call s:source(s:rtp(a:spec), 'plugin/**/*.vim', 'after/plugin/**/*.vim')
+endfunction
+
+function! s:reload_plugins()
+ for name in s:loaded_names()
+ call s:load_plugin(g:plugs[name])
+ endfor
+endfunction
+
+function! s:trim(str)
+ return substitute(a:str, '[\/]\+$', '', '')
+endfunction
+
+function! s:version_requirement(val, min)
+ for idx in range(0, len(a:min) - 1)
+ let v = get(a:val, idx, 0)
+ if v < a:min[idx] | return 0
+ elseif v > a:min[idx] | return 1
+ endif
+ endfor
+ return 1
+endfunction
+
+function! s:git_version_requirement(...)
+ if !exists('s:git_version')
+ let s:git_version = map(split(split(s:system(['git', '--version']))[2], '\.'), 'str2nr(v:val)')
+ endif
+ return s:version_requirement(s:git_version, a:000)
+endfunction
+
+function! s:progress_opt(base)
+ return a:base && !s:is_win &&
+ \ s:git_version_requirement(1, 7, 1) ? '--progress' : ''
+endfunction
+
+function! s:rtp(spec)
+ return s:path(a:spec.dir . get(a:spec, 'rtp', ''))
+endfunction
+
+if s:is_win
+ function! s:path(path)
+ return s:trim(substitute(a:path, '/', '\', 'g'))
+ endfunction
+
+ function! s:dirpath(path)
+ return s:path(a:path) . '\'
+ endfunction
+
+ function! s:is_local_plug(repo)
+ return a:repo =~? '^[a-z]:\|^[%~]'
+ endfunction
+
+ " Copied from fzf
+ function! s:wrap_cmds(cmds)
+ let cmds = [
+ \ '@echo off',
+ \ 'setlocal enabledelayedexpansion']
+ \ + (type(a:cmds) == type([]) ? a:cmds : [a:cmds])
+ \ + ['endlocal']
+ if has('iconv')
+ if !exists('s:codepage')
+ let s:codepage = libcallnr('kernel32.dll', 'GetACP', 0)
+ endif
+ return map(cmds, printf('iconv(v:val."\r", "%s", "cp%d")', &encoding, s:codepage))
+ endif
+ return map(cmds, 'v:val."\r"')
+ endfunction
+
+ function! s:batchfile(cmd)
+ let batchfile = s:plug_tempname().'.bat'
+ call writefile(s:wrap_cmds(a:cmd), batchfile)
+ let cmd = plug#shellescape(batchfile, {'shell': &shell, 'script': 0})
+ if s:is_powershell(&shell)
+ let cmd = '& ' . cmd
+ endif
+ return [batchfile, cmd]
+ endfunction
+else
+ function! s:path(path)
+ return s:trim(a:path)
+ endfunction
+
+ function! s:dirpath(path)
+ return substitute(a:path, '[/\\]*$', '/', '')
+ endfunction
+
+ function! s:is_local_plug(repo)
+ return a:repo[0] =~ '[/$~]'
+ endfunction
+endif
+
+function! s:err(msg)
+ echohl ErrorMsg
+ echom '[vim-plug] '.a:msg
+ echohl None
+endfunction
+
+function! s:warn(cmd, msg)
+ echohl WarningMsg
+ execute a:cmd 'a:msg'
+ echohl None
+endfunction
+
+function! s:esc(path)
+ return escape(a:path, ' ')
+endfunction
+
+function! s:escrtp(path)
+ return escape(a:path, ' ,')
+endfunction
+
+function! s:remove_rtp()
+ for name in s:loaded_names()
+ let rtp = s:rtp(g:plugs[name])
+ execute 'set rtp-='.s:escrtp(rtp)
+ let after = globpath(rtp, 'after')
+ if isdirectory(after)
+ execute 'set rtp-='.s:escrtp(after)
+ endif
+ endfor
+endfunction
+
+function! s:reorg_rtp()
+ if !empty(s:first_rtp)
+ execute 'set rtp-='.s:first_rtp
+ execute 'set rtp-='.s:last_rtp
+ endif
+
+ " &rtp is modified from outside
+ if exists('s:prtp') && s:prtp !=# &rtp
+ call s:remove_rtp()
+ unlet! s:middle
+ endif
+
+ let s:middle = get(s:, 'middle', &rtp)
+ let rtps = map(s:loaded_names(), 's:rtp(g:plugs[v:val])')
+ let afters = filter(map(copy(rtps), 'globpath(v:val, "after")'), '!empty(v:val)')
+ let rtp = join(map(rtps, 'escape(v:val, ",")'), ',')
+ \ . ','.s:middle.','
+ \ . join(map(afters, 'escape(v:val, ",")'), ',')
+ let &rtp = substitute(substitute(rtp, ',,*', ',', 'g'), '^,\|,$', '', 'g')
+ let s:prtp = &rtp
+
+ if !empty(s:first_rtp)
+ execute 'set rtp^='.s:first_rtp
+ execute 'set rtp+='.s:last_rtp
+ endif
+endfunction
+
+function! s:doautocmd(...)
+ if exists('#'.join(a:000, '#'))
+ execute 'doautocmd' ((v:version > 703 || has('patch442')) ? '' : '') join(a:000)
+ endif
+endfunction
+
+function! s:dobufread(names)
+ for name in a:names
+ let path = s:rtp(g:plugs[name])
+ for dir in ['ftdetect', 'ftplugin', 'after/ftdetect', 'after/ftplugin']
+ if len(finddir(dir, path))
+ if exists('#BufRead')
+ doautocmd BufRead
+ endif
+ return
+ endif
+ endfor
+ endfor
+endfunction
+
+function! plug#load(...)
+ if a:0 == 0
+ return s:err('Argument missing: plugin name(s) required')
+ endif
+ if !exists('g:plugs')
+ return s:err('plug#begin was not called')
+ endif
+ let names = a:0 == 1 && type(a:1) == s:TYPE.list ? a:1 : a:000
+ let unknowns = filter(copy(names), '!has_key(g:plugs, v:val)')
+ if !empty(unknowns)
+ let s = len(unknowns) > 1 ? 's' : ''
+ return s:err(printf('Unknown plugin%s: %s', s, join(unknowns, ', ')))
+ end
+ let unloaded = filter(copy(names), '!get(s:loaded, v:val, 0)')
+ if !empty(unloaded)
+ for name in unloaded
+ call s:lod([name], ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin'])
+ endfor
+ call s:dobufread(unloaded)
+ return 1
+ end
+ return 0
+endfunction
+
+function! s:remove_triggers(name)
+ if !has_key(s:triggers, a:name)
+ return
+ endif
+ for cmd in s:triggers[a:name].cmd
+ execute 'silent! delc' cmd
+ endfor
+ for map in s:triggers[a:name].map
+ execute 'silent! unmap' map
+ execute 'silent! iunmap' map
+ endfor
+ call remove(s:triggers, a:name)
+endfunction
+
+function! s:lod(names, types, ...)
+ for name in a:names
+ call s:remove_triggers(name)
+ let s:loaded[name] = 1
+ endfor
+ call s:reorg_rtp()
+
+ for name in a:names
+ let rtp = s:rtp(g:plugs[name])
+ for dir in a:types
+ call s:source(rtp, dir.'/**/*.vim')
+ endfor
+ if a:0
+ if !s:source(rtp, a:1) && !empty(s:glob(rtp, a:2))
+ execute 'runtime' a:1
+ endif
+ call s:source(rtp, a:2)
+ endif
+ call s:doautocmd('User', name)
+ endfor
+endfunction
+
+function! s:lod_ft(pat, names)
+ let syn = 'syntax/'.a:pat.'.vim'
+ call s:lod(a:names, ['plugin', 'after/plugin'], syn, 'after/'.syn)
+ execute 'autocmd! PlugLOD FileType' a:pat
+ call s:doautocmd('filetypeplugin', 'FileType')
+ call s:doautocmd('filetypeindent', 'FileType')
+endfunction
+
+function! s:lod_cmd(cmd, bang, l1, l2, args, names)
+ call s:lod(a:names, ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin'])
+ call s:dobufread(a:names)
+ execute printf('%s%s%s %s', (a:l1 == a:l2 ? '' : (a:l1.','.a:l2)), a:cmd, a:bang, a:args)
+endfunction
+
+function! s:lod_map(map, names, with_prefix, prefix)
+ call s:lod(a:names, ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin'])
+ call s:dobufread(a:names)
+ let extra = ''
+ while 1
+ let c = getchar(0)
+ if c == 0
+ break
+ endif
+ let extra .= nr2char(c)
+ endwhile
+
+ if a:with_prefix
+ let prefix = v:count ? v:count : ''
+ let prefix .= '"'.v:register.a:prefix
+ if mode(1) == 'no'
+ if v:operator == 'c'
+ let prefix = "\" . prefix
+ endif
+ let prefix .= v:operator
+ endif
+ call feedkeys(prefix, 'n')
+ endif
+ call feedkeys(substitute(a:map, '^', "\", '') . extra)
+endfunction
+
+function! plug#(repo, ...)
+ if a:0 > 1
+ return s:err('Invalid number of arguments (1..2)')
+ endif
+
+ try
+ let repo = s:trim(a:repo)
+ let opts = a:0 == 1 ? s:parse_options(a:1) : s:base_spec
+ let name = get(opts, 'as', s:plug_fnamemodify(repo, ':t:s?\.git$??'))
+ let spec = extend(s:infer_properties(name, repo), opts)
+ if !has_key(g:plugs, name)
+ call add(g:plugs_order, name)
+ endif
+ let g:plugs[name] = spec
+ let s:loaded[name] = get(s:loaded, name, 0)
+ catch
+ return s:err(repo . ' ' . v:exception)
+ endtry
+endfunction
+
+function! s:parse_options(arg)
+ let opts = copy(s:base_spec)
+ let type = type(a:arg)
+ let opt_errfmt = 'Invalid argument for "%s" option of :Plug (expected: %s)'
+ if type == s:TYPE.string
+ if empty(a:arg)
+ throw printf(opt_errfmt, 'tag', 'string')
+ endif
+ let opts.tag = a:arg
+ elseif type == s:TYPE.dict
+ for opt in ['branch', 'tag', 'commit', 'rtp', 'dir', 'as']
+ if has_key(a:arg, opt)
+ \ && (type(a:arg[opt]) != s:TYPE.string || empty(a:arg[opt]))
+ throw printf(opt_errfmt, opt, 'string')
+ endif
+ endfor
+ for opt in ['on', 'for']
+ if has_key(a:arg, opt)
+ \ && type(a:arg[opt]) != s:TYPE.list
+ \ && (type(a:arg[opt]) != s:TYPE.string || empty(a:arg[opt]))
+ throw printf(opt_errfmt, opt, 'string or list')
+ endif
+ endfor
+ if has_key(a:arg, 'do')
+ \ && type(a:arg.do) != s:TYPE.funcref
+ \ && (type(a:arg.do) != s:TYPE.string || empty(a:arg.do))
+ throw printf(opt_errfmt, 'do', 'string or funcref')
+ endif
+ call extend(opts, a:arg)
+ if has_key(opts, 'dir')
+ let opts.dir = s:dirpath(s:plug_expand(opts.dir))
+ endif
+ else
+ throw 'Invalid argument type (expected: string or dictionary)'
+ endif
+ return opts
+endfunction
+
+function! s:infer_properties(name, repo)
+ let repo = a:repo
+ if s:is_local_plug(repo)
+ return { 'dir': s:dirpath(s:plug_expand(repo)) }
+ else
+ if repo =~ ':'
+ let uri = repo
+ else
+ if repo !~ '/'
+ throw printf('Invalid argument: %s (implicit `vim-scripts'' expansion is deprecated)', repo)
+ endif
+ let fmt = get(g:, 'plug_url_format', 'https://git::@github.com/%s.git')
+ let uri = printf(fmt, repo)
+ endif
+ return { 'dir': s:dirpath(g:plug_home.'/'.a:name), 'uri': uri }
+ endif
+endfunction
+
+function! s:install(force, names)
+ call s:update_impl(0, a:force, a:names)
+endfunction
+
+function! s:update(force, names)
+ call s:update_impl(1, a:force, a:names)
+endfunction
+
+function! plug#helptags()
+ if !exists('g:plugs')
+ return s:err('plug#begin was not called')
+ endif
+ for spec in values(g:plugs)
+ let docd = join([s:rtp(spec), 'doc'], '/')
+ if isdirectory(docd)
+ silent! execute 'helptags' s:esc(docd)
+ endif
+ endfor
+ return 1
+endfunction
+
+function! s:syntax()
+ syntax clear
+ syntax region plug1 start=/\%1l/ end=/\%2l/ contains=plugNumber
+ syntax region plug2 start=/\%2l/ end=/\%3l/ contains=plugBracket,plugX
+ syn match plugNumber /[0-9]\+[0-9.]*/ contained
+ syn match plugBracket /[[\]]/ contained
+ syn match plugX /x/ contained
+ syn match plugDash /^-\{1}\ /
+ syn match plugPlus /^+/
+ syn match plugStar /^*/
+ syn match plugMessage /\(^- \)\@<=.*/
+ syn match plugName /\(^- \)\@<=[^ ]*:/
+ syn match plugSha /\%(: \)\@<=[0-9a-f]\{4,}$/
+ syn match plugTag /(tag: [^)]\+)/
+ syn match plugInstall /\(^+ \)\@<=[^:]*/
+ syn match plugUpdate /\(^* \)\@<=[^:]*/
+ syn match plugCommit /^ \X*[0-9a-f]\{7,9} .*/ contains=plugRelDate,plugEdge,plugTag
+ syn match plugEdge /^ \X\+$/
+ syn match plugEdge /^ \X*/ contained nextgroup=plugSha
+ syn match plugSha /[0-9a-f]\{7,9}/ contained
+ syn match plugRelDate /([^)]*)$/ contained
+ syn match plugNotLoaded /(not loaded)$/
+ syn match plugError /^x.*/
+ syn region plugDeleted start=/^\~ .*/ end=/^\ze\S/
+ syn match plugH2 /^.*:\n-\+$/
+ syn match plugH2 /^-\{2,}/
+ syn keyword Function PlugInstall PlugStatus PlugUpdate PlugClean
+ hi def link plug1 Title
+ hi def link plug2 Repeat
+ hi def link plugH2 Type
+ hi def link plugX Exception
+ hi def link plugBracket Structure
+ hi def link plugNumber Number
+
+ hi def link plugDash Special
+ hi def link plugPlus Constant
+ hi def link plugStar Boolean
+
+ hi def link plugMessage Function
+ hi def link plugName Label
+ hi def link plugInstall Function
+ hi def link plugUpdate Type
+
+ hi def link plugError Error
+ hi def link plugDeleted Ignore
+ hi def link plugRelDate Comment
+ hi def link plugEdge PreProc
+ hi def link plugSha Identifier
+ hi def link plugTag Constant
+
+ hi def link plugNotLoaded Comment
+endfunction
+
+function! s:lpad(str, len)
+ return a:str . repeat(' ', a:len - len(a:str))
+endfunction
+
+function! s:lines(msg)
+ return split(a:msg, "[\r\n]")
+endfunction
+
+function! s:lastline(msg)
+ return get(s:lines(a:msg), -1, '')
+endfunction
+
+function! s:new_window()
+ execute get(g:, 'plug_window', 'vertical topleft new')
+endfunction
+
+function! s:plug_window_exists()
+ let buflist = tabpagebuflist(s:plug_tab)
+ return !empty(buflist) && index(buflist, s:plug_buf) >= 0
+endfunction
+
+function! s:switch_in()
+ if !s:plug_window_exists()
+ return 0
+ endif
+
+ if winbufnr(0) != s:plug_buf
+ let s:pos = [tabpagenr(), winnr(), winsaveview()]
+ execute 'normal!' s:plug_tab.'gt'
+ let winnr = bufwinnr(s:plug_buf)
+ execute winnr.'wincmd w'
+ call add(s:pos, winsaveview())
+ else
+ let s:pos = [winsaveview()]
+ endif
+
+ setlocal modifiable
+ return 1
+endfunction
+
+function! s:switch_out(...)
+ call winrestview(s:pos[-1])
+ setlocal nomodifiable
+ if a:0 > 0
+ execute a:1
+ endif
+
+ if len(s:pos) > 1
+ execute 'normal!' s:pos[0].'gt'
+ execute s:pos[1] 'wincmd w'
+ call winrestview(s:pos[2])
+ endif
+endfunction
+
+function! s:finish_bindings()
+ nnoremap R :call retry()
+ nnoremap D :PlugDiff
+ nnoremap S :PlugStatus
+ nnoremap U :call status_update()
+ xnoremap U :call status_update()
+ nnoremap ]] :silent! call section('')
+ nnoremap [[ :silent! call section('b')
+endfunction
+
+function! s:prepare(...)
+ if empty(s:plug_getcwd())
+ throw 'Invalid current working directory. Cannot proceed.'
+ endif
+
+ for evar in ['$GIT_DIR', '$GIT_WORK_TREE']
+ if exists(evar)
+ throw evar.' detected. Cannot proceed.'
+ endif
+ endfor
+
+ call s:job_abort()
+ if s:switch_in()
+ if b:plug_preview == 1
+ pc
+ endif
+ enew
+ else
+ call s:new_window()
+ endif
+
+ nnoremap q :call close_pane()
+ if a:0 == 0
+ call s:finish_bindings()
+ endif
+ let b:plug_preview = -1
+ let s:plug_tab = tabpagenr()
+ let s:plug_buf = winbufnr(0)
+ call s:assign_name()
+
+ for k in ['', 'L', 'o', 'X', 'd', 'dd']
+ execute 'silent! unmap ' k
+ endfor
+ setlocal buftype=nofile bufhidden=wipe nobuflisted nolist noswapfile nowrap cursorline modifiable nospell
+ if exists('+colorcolumn')
+ setlocal colorcolumn=
+ endif
+ setf vim-plug
+ if exists('g:syntax_on')
+ call s:syntax()
+ endif
+endfunction
+
+function! s:close_pane()
+ if b:plug_preview == 1
+ pc
+ let b:plug_preview = -1
+ else
+ bd
+ endif
+endfunction
+
+function! s:assign_name()
+ " Assign buffer name
+ let prefix = '[Plugins]'
+ let name = prefix
+ let idx = 2
+ while bufexists(name)
+ let name = printf('%s (%s)', prefix, idx)
+ let idx = idx + 1
+ endwhile
+ silent! execute 'f' fnameescape(name)
+endfunction
+
+function! s:chsh(swap)
+ let prev = [&shell, &shellcmdflag, &shellredir]
+ if !s:is_win
+ set shell=sh
+ endif
+ if a:swap
+ if s:is_powershell(&shell)
+ let &shellredir = '2>&1 | Out-File -Encoding UTF8 %s'
+ elseif &shell =~# 'sh' || &shell =~# 'cmd\(\.exe\)\?$'
+ set shellredir=>%s\ 2>&1
+ endif
+ endif
+ return prev
+endfunction
+
+function! s:bang(cmd, ...)
+ let batchfile = ''
+ try
+ let [sh, shellcmdflag, shrd] = s:chsh(a:0)
+ " FIXME: Escaping is incomplete. We could use shellescape with eval,
+ " but it won't work on Windows.
+ let cmd = a:0 ? s:with_cd(a:cmd, a:1) : a:cmd
+ if s:is_win
+ let [batchfile, cmd] = s:batchfile(cmd)
+ endif
+ let g:_plug_bang = (s:is_win && has('gui_running') ? 'silent ' : '').'!'.escape(cmd, '#!%')
+ execute "normal! :execute g:_plug_bang\\"
+ finally
+ unlet g:_plug_bang
+ let [&shell, &shellcmdflag, &shellredir] = [sh, shellcmdflag, shrd]
+ if s:is_win && filereadable(batchfile)
+ call delete(batchfile)
+ endif
+ endtry
+ return v:shell_error ? 'Exit status: ' . v:shell_error : ''
+endfunction
+
+function! s:regress_bar()
+ let bar = substitute(getline(2)[1:-2], '.*\zs=', 'x', '')
+ call s:progress_bar(2, bar, len(bar))
+endfunction
+
+function! s:is_updated(dir)
+ return !empty(s:system_chomp(['git', 'log', '--pretty=format:%h', 'HEAD...HEAD@{1}'], a:dir))
+endfunction
+
+function! s:do(pull, force, todo)
+ for [name, spec] in items(a:todo)
+ if !isdirectory(spec.dir)
+ continue
+ endif
+ let installed = has_key(s:update.new, name)
+ let updated = installed ? 0 :
+ \ (a:pull && index(s:update.errors, name) < 0 && s:is_updated(spec.dir))
+ if a:force || installed || updated
+ execute 'cd' s:esc(spec.dir)
+ call append(3, '- Post-update hook for '. name .' ... ')
+ let error = ''
+ let type = type(spec.do)
+ if type == s:TYPE.string
+ if spec.do[0] == ':'
+ if !get(s:loaded, name, 0)
+ let s:loaded[name] = 1
+ call s:reorg_rtp()
+ endif
+ call s:load_plugin(spec)
+ try
+ execute spec.do[1:]
+ catch
+ let error = v:exception
+ endtry
+ if !s:plug_window_exists()
+ cd -
+ throw 'Warning: vim-plug was terminated by the post-update hook of '.name
+ endif
+ else
+ let error = s:bang(spec.do)
+ endif
+ elseif type == s:TYPE.funcref
+ try
+ call s:load_plugin(spec)
+ let status = installed ? 'installed' : (updated ? 'updated' : 'unchanged')
+ call spec.do({ 'name': name, 'status': status, 'force': a:force })
+ catch
+ let error = v:exception
+ endtry
+ else
+ let error = 'Invalid hook type'
+ endif
+ call s:switch_in()
+ call setline(4, empty(error) ? (getline(4) . 'OK')
+ \ : ('x' . getline(4)[1:] . error))
+ if !empty(error)
+ call add(s:update.errors, name)
+ call s:regress_bar()
+ endif
+ cd -
+ endif
+ endfor
+endfunction
+
+function! s:hash_match(a, b)
+ return stridx(a:a, a:b) == 0 || stridx(a:b, a:a) == 0
+endfunction
+
+function! s:checkout(spec)
+ let sha = a:spec.commit
+ let output = s:git_revision(a:spec.dir)
+ if !empty(output) && !s:hash_match(sha, s:lines(output)[0])
+ let credential_helper = s:git_version_requirement(2) ? '-c credential.helper= ' : ''
+ let output = s:system(
+ \ 'git '.credential_helper.'fetch --depth 999999 && git checkout '.plug#shellescape(sha).' --', a:spec.dir)
+ endif
+ return output
+endfunction
+
+function! s:finish(pull)
+ let new_frozen = len(filter(keys(s:update.new), 'g:plugs[v:val].frozen'))
+ if new_frozen
+ let s = new_frozen > 1 ? 's' : ''
+ call append(3, printf('- Installed %d frozen plugin%s', new_frozen, s))
+ endif
+ call append(3, '- Finishing ... ') | 4
+ redraw
+ call plug#helptags()
+ call plug#end()
+ call setline(4, getline(4) . 'Done!')
+ redraw
+ let msgs = []
+ if !empty(s:update.errors)
+ call add(msgs, "Press 'R' to retry.")
+ endif
+ if a:pull && len(s:update.new) < len(filter(getline(5, '$'),
+ \ "v:val =~ '^- ' && v:val !~# 'Already up.to.date'"))
+ call add(msgs, "Press 'D' to see the updated changes.")
+ endif
+ echo join(msgs, ' ')
+ call s:finish_bindings()
+endfunction
+
+function! s:retry()
+ if empty(s:update.errors)
+ return
+ endif
+ echo
+ call s:update_impl(s:update.pull, s:update.force,
+ \ extend(copy(s:update.errors), [s:update.threads]))
+endfunction
+
+function! s:is_managed(name)
+ return has_key(g:plugs[a:name], 'uri')
+endfunction
+
+function! s:names(...)
+ return sort(filter(keys(g:plugs), 'stridx(v:val, a:1) == 0 && s:is_managed(v:val)'))
+endfunction
+
+function! s:check_ruby()
+ silent! ruby require 'thread'; VIM::command("let g:plug_ruby = '#{RUBY_VERSION}'")
+ if !exists('g:plug_ruby')
+ redraw!
+ return s:warn('echom', 'Warning: Ruby interface is broken')
+ endif
+ let ruby_version = split(g:plug_ruby, '\.')
+ unlet g:plug_ruby
+ return s:version_requirement(ruby_version, [1, 8, 7])
+endfunction
+
+function! s:update_impl(pull, force, args) abort
+ let sync = index(a:args, '--sync') >= 0 || has('vim_starting')
+ let args = filter(copy(a:args), 'v:val != "--sync"')
+ let threads = (len(args) > 0 && args[-1] =~ '^[1-9][0-9]*$') ?
+ \ remove(args, -1) : get(g:, 'plug_threads', 16)
+
+ let managed = filter(copy(g:plugs), 's:is_managed(v:key)')
+ let todo = empty(args) ? filter(managed, '!v:val.frozen || !isdirectory(v:val.dir)') :
+ \ filter(managed, 'index(args, v:key) >= 0')
+
+ if empty(todo)
+ return s:warn('echo', 'No plugin to '. (a:pull ? 'update' : 'install'))
+ endif
+
+ if !s:is_win && s:git_version_requirement(2, 3)
+ let s:git_terminal_prompt = exists('$GIT_TERMINAL_PROMPT') ? $GIT_TERMINAL_PROMPT : ''
+ let $GIT_TERMINAL_PROMPT = 0
+ for plug in values(todo)
+ let plug.uri = substitute(plug.uri,
+ \ '^https://git::@github\.com', 'https://github.com', '')
+ endfor
+ endif
+
+ if !isdirectory(g:plug_home)
+ try
+ call mkdir(g:plug_home, 'p')
+ catch
+ return s:err(printf('Invalid plug directory: %s. '.
+ \ 'Try to call plug#begin with a valid directory', g:plug_home))
+ endtry
+ endif
+
+ if has('nvim') && !exists('*jobwait') && threads > 1
+ call s:warn('echom', '[vim-plug] Update Neovim for parallel installer')
+ endif
+
+ let use_job = s:nvim || s:vim8
+ let python = (has('python') || has('python3')) && !use_job
+ let ruby = has('ruby') && !use_job && (v:version >= 703 || v:version == 702 && has('patch374')) && !(s:is_win && has('gui_running')) && threads > 1 && s:check_ruby()
+
+ let s:update = {
+ \ 'start': reltime(),
+ \ 'all': todo,
+ \ 'todo': copy(todo),
+ \ 'errors': [],
+ \ 'pull': a:pull,
+ \ 'force': a:force,
+ \ 'new': {},
+ \ 'threads': (python || ruby || use_job) ? min([len(todo), threads]) : 1,
+ \ 'bar': '',
+ \ 'fin': 0
+ \ }
+
+ call s:prepare(1)
+ call append(0, ['', ''])
+ normal! 2G
+ silent! redraw
+
+ let s:clone_opt = []
+ if get(g:, 'plug_shallow', 1)
+ call extend(s:clone_opt, ['--depth', '1'])
+ if s:git_version_requirement(1, 7, 10)
+ call add(s:clone_opt, '--no-single-branch')
+ endif
+ endif
+
+ if has('win32unix') || has('wsl')
+ call extend(s:clone_opt, ['-c', 'core.eol=lf', '-c', 'core.autocrlf=input'])
+ endif
+
+ let s:submodule_opt = s:git_version_requirement(2, 8) ? ' --jobs='.threads : ''
+
+ " Python version requirement (>= 2.7)
+ if python && !has('python3') && !ruby && !use_job && s:update.threads > 1
+ redir => pyv
+ silent python import platform; print platform.python_version()
+ redir END
+ let python = s:version_requirement(
+ \ map(split(split(pyv)[0], '\.'), 'str2nr(v:val)'), [2, 6])
+ endif
+
+ if (python || ruby) && s:update.threads > 1
+ try
+ let imd = &imd
+ if s:mac_gui
+ set noimd
+ endif
+ if ruby
+ call s:update_ruby()
+ else
+ call s:update_python()
+ endif
+ catch
+ let lines = getline(4, '$')
+ let printed = {}
+ silent! 4,$d _
+ for line in lines
+ let name = s:extract_name(line, '.', '')
+ if empty(name) || !has_key(printed, name)
+ call append('$', line)
+ if !empty(name)
+ let printed[name] = 1
+ if line[0] == 'x' && index(s:update.errors, name) < 0
+ call add(s:update.errors, name)
+ end
+ endif
+ endif
+ endfor
+ finally
+ let &imd = imd
+ call s:update_finish()
+ endtry
+ else
+ call s:update_vim()
+ while use_job && sync
+ sleep 100m
+ if s:update.fin
+ break
+ endif
+ endwhile
+ endif
+endfunction
+
+function! s:log4(name, msg)
+ call setline(4, printf('- %s (%s)', a:msg, a:name))
+ redraw
+endfunction
+
+function! s:update_finish()
+ if exists('s:git_terminal_prompt')
+ let $GIT_TERMINAL_PROMPT = s:git_terminal_prompt
+ endif
+ if s:switch_in()
+ call append(3, '- Updating ...') | 4
+ for [name, spec] in items(filter(copy(s:update.all), 'index(s:update.errors, v:key) < 0 && (s:update.force || s:update.pull || has_key(s:update.new, v:key))'))
+ let [pos, _] = s:logpos(name)
+ if !pos
+ continue
+ endif
+ if has_key(spec, 'commit')
+ call s:log4(name, 'Checking out '.spec.commit)
+ let out = s:checkout(spec)
+ elseif has_key(spec, 'tag')
+ let tag = spec.tag
+ if tag =~ '\*'
+ let tags = s:lines(s:system('git tag --list '.plug#shellescape(tag).' --sort -version:refname 2>&1', spec.dir))
+ if !v:shell_error && !empty(tags)
+ let tag = tags[0]
+ call s:log4(name, printf('Latest tag for %s -> %s', spec.tag, tag))
+ call append(3, '')
+ endif
+ endif
+ call s:log4(name, 'Checking out '.tag)
+ let out = s:system('git checkout -q '.plug#shellescape(tag).' -- 2>&1', spec.dir)
+ else
+ let branch = s:git_origin_branch(spec)
+ call s:log4(name, 'Merging origin/'.s:esc(branch))
+ let out = s:system('git checkout -q '.plug#shellescape(branch).' -- 2>&1'
+ \. (has_key(s:update.new, name) ? '' : ('&& git merge --ff-only '.plug#shellescape('origin/'.branch).' 2>&1')), spec.dir)
+ endif
+ if !v:shell_error && filereadable(spec.dir.'/.gitmodules') &&
+ \ (s:update.force || has_key(s:update.new, name) || s:is_updated(spec.dir))
+ call s:log4(name, 'Updating submodules. This may take a while.')
+ let out .= s:bang('git submodule update --init --recursive'.s:submodule_opt.' 2>&1', spec.dir)
+ endif
+ let msg = s:format_message(v:shell_error ? 'x': '-', name, out)
+ if v:shell_error
+ call add(s:update.errors, name)
+ call s:regress_bar()
+ silent execute pos 'd _'
+ call append(4, msg) | 4
+ elseif !empty(out)
+ call setline(pos, msg[0])
+ endif
+ redraw
+ endfor
+ silent 4 d _
+ try
+ call s:do(s:update.pull, s:update.force, filter(copy(s:update.all), 'index(s:update.errors, v:key) < 0 && has_key(v:val, "do")'))
+ catch
+ call s:warn('echom', v:exception)
+ call s:warn('echo', '')
+ return
+ endtry
+ call s:finish(s:update.pull)
+ call setline(1, 'Updated. Elapsed time: ' . split(reltimestr(reltime(s:update.start)))[0] . ' sec.')
+ call s:switch_out('normal! gg')
+ endif
+endfunction
+
+function! s:job_abort()
+ if (!s:nvim && !s:vim8) || !exists('s:jobs')
+ return
+ endif
+
+ for [name, j] in items(s:jobs)
+ if s:nvim
+ silent! call jobstop(j.jobid)
+ elseif s:vim8
+ silent! call job_stop(j.jobid)
+ endif
+ if j.new
+ call s:rm_rf(g:plugs[name].dir)
+ endif
+ endfor
+ let s:jobs = {}
+endfunction
+
+function! s:last_non_empty_line(lines)
+ let len = len(a:lines)
+ for idx in range(len)
+ let line = a:lines[len-idx-1]
+ if !empty(line)
+ return line
+ endif
+ endfor
+ return ''
+endfunction
+
+function! s:job_out_cb(self, data) abort
+ let self = a:self
+ let data = remove(self.lines, -1) . a:data
+ let lines = map(split(data, "\n", 1), 'split(v:val, "\r", 1)[-1]')
+ call extend(self.lines, lines)
+ " To reduce the number of buffer updates
+ let self.tick = get(self, 'tick', -1) + 1
+ if !self.running || self.tick % len(s:jobs) == 0
+ let bullet = self.running ? (self.new ? '+' : '*') : (self.error ? 'x' : '-')
+ let result = self.error ? join(self.lines, "\n") : s:last_non_empty_line(self.lines)
+ call s:log(bullet, self.name, result)
+ endif
+endfunction
+
+function! s:job_exit_cb(self, data) abort
+ let a:self.running = 0
+ let a:self.error = a:data != 0
+ call s:reap(a:self.name)
+ call s:tick()
+endfunction
+
+function! s:job_cb(fn, job, ch, data)
+ if !s:plug_window_exists() " plug window closed
+ return s:job_abort()
+ endif
+ call call(a:fn, [a:job, a:data])
+endfunction
+
+function! s:nvim_cb(job_id, data, event) dict abort
+ return (a:event == 'stdout' || a:event == 'stderr') ?
+ \ s:job_cb('s:job_out_cb', self, 0, join(a:data, "\n")) :
+ \ s:job_cb('s:job_exit_cb', self, 0, a:data)
+endfunction
+
+function! s:spawn(name, cmd, opts)
+ let job = { 'name': a:name, 'running': 1, 'error': 0, 'lines': [''],
+ \ 'new': get(a:opts, 'new', 0) }
+ let s:jobs[a:name] = job
+
+ if s:nvim
+ if has_key(a:opts, 'dir')
+ let job.cwd = a:opts.dir
+ endif
+ let argv = a:cmd
+ call extend(job, {
+ \ 'on_stdout': function('s:nvim_cb'),
+ \ 'on_stderr': function('s:nvim_cb'),
+ \ 'on_exit': function('s:nvim_cb'),
+ \ })
+ let jid = s:plug_call('jobstart', argv, job)
+ if jid > 0
+ let job.jobid = jid
+ else
+ let job.running = 0
+ let job.error = 1
+ let job.lines = [jid < 0 ? argv[0].' is not executable' :
+ \ 'Invalid arguments (or job table is full)']
+ endif
+ elseif s:vim8
+ let cmd = join(map(copy(a:cmd), 'plug#shellescape(v:val, {"script": 0})'))
+ if has_key(a:opts, 'dir')
+ let cmd = s:with_cd(cmd, a:opts.dir, 0)
+ endif
+ let argv = s:is_win ? ['cmd', '/s', '/c', '"'.cmd.'"'] : ['sh', '-c', cmd]
+ let jid = job_start(s:is_win ? join(argv, ' ') : argv, {
+ \ 'out_cb': function('s:job_cb', ['s:job_out_cb', job]),
+ \ 'err_cb': function('s:job_cb', ['s:job_out_cb', job]),
+ \ 'exit_cb': function('s:job_cb', ['s:job_exit_cb', job]),
+ \ 'err_mode': 'raw',
+ \ 'out_mode': 'raw'
+ \})
+ if job_status(jid) == 'run'
+ let job.jobid = jid
+ else
+ let job.running = 0
+ let job.error = 1
+ let job.lines = ['Failed to start job']
+ endif
+ else
+ let job.lines = s:lines(call('s:system', has_key(a:opts, 'dir') ? [a:cmd, a:opts.dir] : [a:cmd]))
+ let job.error = v:shell_error != 0
+ let job.running = 0
+ endif
+endfunction
+
+function! s:reap(name)
+ let job = s:jobs[a:name]
+ if job.error
+ call add(s:update.errors, a:name)
+ elseif get(job, 'new', 0)
+ let s:update.new[a:name] = 1
+ endif
+ let s:update.bar .= job.error ? 'x' : '='
+
+ let bullet = job.error ? 'x' : '-'
+ let result = job.error ? join(job.lines, "\n") : s:last_non_empty_line(job.lines)
+ call s:log(bullet, a:name, empty(result) ? 'OK' : result)
+ call s:bar()
+
+ call remove(s:jobs, a:name)
+endfunction
+
+function! s:bar()
+ if s:switch_in()
+ let total = len(s:update.all)
+ call setline(1, (s:update.pull ? 'Updating' : 'Installing').
+ \ ' plugins ('.len(s:update.bar).'/'.total.')')
+ call s:progress_bar(2, s:update.bar, total)
+ call s:switch_out()
+ endif
+endfunction
+
+function! s:logpos(name)
+ let max = line('$')
+ for i in range(4, max > 4 ? max : 4)
+ if getline(i) =~# '^[-+x*] '.a:name.':'
+ for j in range(i + 1, max > 5 ? max : 5)
+ if getline(j) !~ '^ '
+ return [i, j - 1]
+ endif
+ endfor
+ return [i, i]
+ endif
+ endfor
+ return [0, 0]
+endfunction
+
+function! s:log(bullet, name, lines)
+ if s:switch_in()
+ let [b, e] = s:logpos(a:name)
+ if b > 0
+ silent execute printf('%d,%d d _', b, e)
+ if b > winheight('.')
+ let b = 4
+ endif
+ else
+ let b = 4
+ endif
+ " FIXME For some reason, nomodifiable is set after :d in vim8
+ setlocal modifiable
+ call append(b - 1, s:format_message(a:bullet, a:name, a:lines))
+ call s:switch_out()
+ endif
+endfunction
+
+function! s:update_vim()
+ let s:jobs = {}
+
+ call s:bar()
+ call s:tick()
+endfunction
+
+function! s:tick()
+ let pull = s:update.pull
+ let prog = s:progress_opt(s:nvim || s:vim8)
+while 1 " Without TCO, Vim stack is bound to explode
+ if empty(s:update.todo)
+ if empty(s:jobs) && !s:update.fin
+ call s:update_finish()
+ let s:update.fin = 1
+ endif
+ return
+ endif
+
+ let name = keys(s:update.todo)[0]
+ let spec = remove(s:update.todo, name)
+ let new = empty(globpath(spec.dir, '.git', 1))
+
+ call s:log(new ? '+' : '*', name, pull ? 'Updating ...' : 'Installing ...')
+ redraw
+
+ let has_tag = has_key(spec, 'tag')
+ if !new
+ let [error, _] = s:git_validate(spec, 0)
+ if empty(error)
+ if pull
+ let cmd = s:git_version_requirement(2) ? ['git', '-c', 'credential.helper=', 'fetch'] : ['git', 'fetch']
+ if has_tag && !empty(globpath(spec.dir, '.git/shallow'))
+ call extend(cmd, ['--depth', '99999999'])
+ endif
+ if !empty(prog)
+ call add(cmd, prog)
+ endif
+ call s:spawn(name, cmd, { 'dir': spec.dir })
+ else
+ let s:jobs[name] = { 'running': 0, 'lines': ['Already installed'], 'error': 0 }
+ endif
+ else
+ let s:jobs[name] = { 'running': 0, 'lines': s:lines(error), 'error': 1 }
+ endif
+ else
+ let cmd = ['git', 'clone']
+ if !has_tag
+ call extend(cmd, s:clone_opt)
+ endif
+ if !empty(prog)
+ call add(cmd, prog)
+ endif
+ call s:spawn(name, extend(cmd, [spec.uri, s:trim(spec.dir)]), { 'new': 1 })
+ endif
+
+ if !s:jobs[name].running
+ call s:reap(name)
+ endif
+ if len(s:jobs) >= s:update.threads
+ break
+ endif
+endwhile
+endfunction
+
+function! s:update_python()
+let py_exe = has('python') ? 'python' : 'python3'
+execute py_exe "<< EOF"
+import datetime
+import functools
+import os
+try:
+ import queue
+except ImportError:
+ import Queue as queue
+import random
+import re
+import shutil
+import signal
+import subprocess
+import tempfile
+import threading as thr
+import time
+import traceback
+import vim
+
+G_NVIM = vim.eval("has('nvim')") == '1'
+G_PULL = vim.eval('s:update.pull') == '1'
+G_RETRIES = int(vim.eval('get(g:, "plug_retries", 2)')) + 1
+G_TIMEOUT = int(vim.eval('get(g:, "plug_timeout", 60)'))
+G_CLONE_OPT = ' '.join(vim.eval('s:clone_opt'))
+G_PROGRESS = vim.eval('s:progress_opt(1)')
+G_LOG_PROB = 1.0 / int(vim.eval('s:update.threads'))
+G_STOP = thr.Event()
+G_IS_WIN = vim.eval('s:is_win') == '1'
+
+class PlugError(Exception):
+ def __init__(self, msg):
+ self.msg = msg
+class CmdTimedOut(PlugError):
+ pass
+class CmdFailed(PlugError):
+ pass
+class InvalidURI(PlugError):
+ pass
+class Action(object):
+ INSTALL, UPDATE, ERROR, DONE = ['+', '*', 'x', '-']
+
+class Buffer(object):
+ def __init__(self, lock, num_plugs, is_pull):
+ self.bar = ''
+ self.event = 'Updating' if is_pull else 'Installing'
+ self.lock = lock
+ self.maxy = int(vim.eval('winheight(".")'))
+ self.num_plugs = num_plugs
+
+ def __where(self, name):
+ """ Find first line with name in current buffer. Return line num. """
+ found, lnum = False, 0
+ matcher = re.compile('^[-+x*] {0}:'.format(name))
+ for line in vim.current.buffer:
+ if matcher.search(line) is not None:
+ found = True
+ break
+ lnum += 1
+
+ if not found:
+ lnum = -1
+ return lnum
+
+ def header(self):
+ curbuf = vim.current.buffer
+ curbuf[0] = self.event + ' plugins ({0}/{1})'.format(len(self.bar), self.num_plugs)
+
+ num_spaces = self.num_plugs - len(self.bar)
+ curbuf[1] = '[{0}{1}]'.format(self.bar, num_spaces * ' ')
+
+ with self.lock:
+ vim.command('normal! 2G')
+ vim.command('redraw')
+
+ def write(self, action, name, lines):
+ first, rest = lines[0], lines[1:]
+ msg = ['{0} {1}{2}{3}'.format(action, name, ': ' if first else '', first)]
+ msg.extend([' ' + line for line in rest])
+
+ try:
+ if action == Action.ERROR:
+ self.bar += 'x'
+ vim.command("call add(s:update.errors, '{0}')".format(name))
+ elif action == Action.DONE:
+ self.bar += '='
+
+ curbuf = vim.current.buffer
+ lnum = self.__where(name)
+ if lnum != -1: # Found matching line num
+ del curbuf[lnum]
+ if lnum > self.maxy and action in set([Action.INSTALL, Action.UPDATE]):
+ lnum = 3
+ else:
+ lnum = 3
+ curbuf.append(msg, lnum)
+
+ self.header()
+ except vim.error:
+ pass
+
+class Command(object):
+ CD = 'cd /d' if G_IS_WIN else 'cd'
+
+ def __init__(self, cmd, cmd_dir=None, timeout=60, cb=None, clean=None):
+ self.cmd = cmd
+ if cmd_dir:
+ self.cmd = '{0} {1} && {2}'.format(Command.CD, cmd_dir, self.cmd)
+ self.timeout = timeout
+ self.callback = cb if cb else (lambda msg: None)
+ self.clean = clean if clean else (lambda: None)
+ self.proc = None
+
+ @property
+ def alive(self):
+ """ Returns true only if command still running. """
+ return self.proc and self.proc.poll() is None
+
+ def execute(self, ntries=3):
+ """ Execute the command with ntries if CmdTimedOut.
+ Returns the output of the command if no Exception.
+ """
+ attempt, finished, limit = 0, False, self.timeout
+
+ while not finished:
+ try:
+ attempt += 1
+ result = self.try_command()
+ finished = True
+ return result
+ except CmdTimedOut:
+ if attempt != ntries:
+ self.notify_retry()
+ self.timeout += limit
+ else:
+ raise
+
+ def notify_retry(self):
+ """ Retry required for command, notify user. """
+ for count in range(3, 0, -1):
+ if G_STOP.is_set():
+ raise KeyboardInterrupt
+ msg = 'Timeout. Will retry in {0} second{1} ...'.format(
+ count, 's' if count != 1 else '')
+ self.callback([msg])
+ time.sleep(1)
+ self.callback(['Retrying ...'])
+
+ def try_command(self):
+ """ Execute a cmd & poll for callback. Returns list of output.
+ Raises CmdFailed -> return code for Popen isn't 0
+ Raises CmdTimedOut -> command exceeded timeout without new output
+ """
+ first_line = True
+
+ try:
+ tfile = tempfile.NamedTemporaryFile(mode='w+b')
+ preexec_fn = not G_IS_WIN and os.setsid or None
+ self.proc = subprocess.Popen(self.cmd, stdout=tfile,
+ stderr=subprocess.STDOUT,
+ stdin=subprocess.PIPE, shell=True,
+ preexec_fn=preexec_fn)
+ thrd = thr.Thread(target=(lambda proc: proc.wait()), args=(self.proc,))
+ thrd.start()
+
+ thread_not_started = True
+ while thread_not_started:
+ try:
+ thrd.join(0.1)
+ thread_not_started = False
+ except RuntimeError:
+ pass
+
+ while self.alive:
+ if G_STOP.is_set():
+ raise KeyboardInterrupt
+
+ if first_line or random.random() < G_LOG_PROB:
+ first_line = False
+ line = '' if G_IS_WIN else nonblock_read(tfile.name)
+ if line:
+ self.callback([line])
+
+ time_diff = time.time() - os.path.getmtime(tfile.name)
+ if time_diff > self.timeout:
+ raise CmdTimedOut(['Timeout!'])
+
+ thrd.join(0.5)
+
+ tfile.seek(0)
+ result = [line.decode('utf-8', 'replace').rstrip() for line in tfile]
+
+ if self.proc.returncode != 0:
+ raise CmdFailed([''] + result)
+
+ return result
+ except:
+ self.terminate()
+ raise
+
+ def terminate(self):
+ """ Terminate process and cleanup. """
+ if self.alive:
+ if G_IS_WIN:
+ os.kill(self.proc.pid, signal.SIGINT)
+ else:
+ os.killpg(self.proc.pid, signal.SIGTERM)
+ self.clean()
+
+class Plugin(object):
+ def __init__(self, name, args, buf_q, lock):
+ self.name = name
+ self.args = args
+ self.buf_q = buf_q
+ self.lock = lock
+ self.tag = args.get('tag', 0)
+
+ def manage(self):
+ try:
+ if os.path.exists(self.args['dir']):
+ self.update()
+ else:
+ self.install()
+ with self.lock:
+ thread_vim_command("let s:update.new['{0}'] = 1".format(self.name))
+ except PlugError as exc:
+ self.write(Action.ERROR, self.name, exc.msg)
+ except KeyboardInterrupt:
+ G_STOP.set()
+ self.write(Action.ERROR, self.name, ['Interrupted!'])
+ except:
+ # Any exception except those above print stack trace
+ msg = 'Trace:\n{0}'.format(traceback.format_exc().rstrip())
+ self.write(Action.ERROR, self.name, msg.split('\n'))
+ raise
+
+ def install(self):
+ target = self.args['dir']
+ if target[-1] == '\\':
+ target = target[0:-1]
+
+ def clean(target):
+ def _clean():
+ try:
+ shutil.rmtree(target)
+ except OSError:
+ pass
+ return _clean
+
+ self.write(Action.INSTALL, self.name, ['Installing ...'])
+ callback = functools.partial(self.write, Action.INSTALL, self.name)
+ cmd = 'git clone {0} {1} {2} {3} 2>&1'.format(
+ '' if self.tag else G_CLONE_OPT, G_PROGRESS, self.args['uri'],
+ esc(target))
+ com = Command(cmd, None, G_TIMEOUT, callback, clean(target))
+ result = com.execute(G_RETRIES)
+ self.write(Action.DONE, self.name, result[-1:])
+
+ def repo_uri(self):
+ cmd = 'git rev-parse --abbrev-ref HEAD 2>&1 && git config -f .git/config remote.origin.url'
+ command = Command(cmd, self.args['dir'], G_TIMEOUT,)
+ result = command.execute(G_RETRIES)
+ return result[-1]
+
+ def update(self):
+ actual_uri = self.repo_uri()
+ expect_uri = self.args['uri']
+ regex = re.compile(r'^(?:\w+://)?(?:[^@/]*@)?([^:/]*(?::[0-9]*)?)[:/](.*?)(?:\.git)?/?$')
+ ma = regex.match(actual_uri)
+ mb = regex.match(expect_uri)
+ if ma is None or mb is None or ma.groups() != mb.groups():
+ msg = ['',
+ 'Invalid URI: {0}'.format(actual_uri),
+ 'Expected {0}'.format(expect_uri),
+ 'PlugClean required.']
+ raise InvalidURI(msg)
+
+ if G_PULL:
+ self.write(Action.UPDATE, self.name, ['Updating ...'])
+ callback = functools.partial(self.write, Action.UPDATE, self.name)
+ fetch_opt = '--depth 99999999' if self.tag and os.path.isfile(os.path.join(self.args['dir'], '.git/shallow')) else ''
+ cmd = 'git fetch {0} {1} 2>&1'.format(fetch_opt, G_PROGRESS)
+ com = Command(cmd, self.args['dir'], G_TIMEOUT, callback)
+ result = com.execute(G_RETRIES)
+ self.write(Action.DONE, self.name, result[-1:])
+ else:
+ self.write(Action.DONE, self.name, ['Already installed'])
+
+ def write(self, action, name, msg):
+ self.buf_q.put((action, name, msg))
+
+class PlugThread(thr.Thread):
+ def __init__(self, tname, args):
+ super(PlugThread, self).__init__()
+ self.tname = tname
+ self.args = args
+
+ def run(self):
+ thr.current_thread().name = self.tname
+ buf_q, work_q, lock = self.args
+
+ try:
+ while not G_STOP.is_set():
+ name, args = work_q.get_nowait()
+ plug = Plugin(name, args, buf_q, lock)
+ plug.manage()
+ work_q.task_done()
+ except queue.Empty:
+ pass
+
+class RefreshThread(thr.Thread):
+ def __init__(self, lock):
+ super(RefreshThread, self).__init__()
+ self.lock = lock
+ self.running = True
+
+ def run(self):
+ while self.running:
+ with self.lock:
+ thread_vim_command('noautocmd normal! a')
+ time.sleep(0.33)
+
+ def stop(self):
+ self.running = False
+
+if G_NVIM:
+ def thread_vim_command(cmd):
+ vim.session.threadsafe_call(lambda: vim.command(cmd))
+else:
+ def thread_vim_command(cmd):
+ vim.command(cmd)
+
+def esc(name):
+ return '"' + name.replace('"', '\"') + '"'
+
+def nonblock_read(fname):
+ """ Read a file with nonblock flag. Return the last line. """
+ fread = os.open(fname, os.O_RDONLY | os.O_NONBLOCK)
+ buf = os.read(fread, 100000).decode('utf-8', 'replace')
+ os.close(fread)
+
+ line = buf.rstrip('\r\n')
+ left = max(line.rfind('\r'), line.rfind('\n'))
+ if left != -1:
+ left += 1
+ line = line[left:]
+
+ return line
+
+def main():
+ thr.current_thread().name = 'main'
+ nthreads = int(vim.eval('s:update.threads'))
+ plugs = vim.eval('s:update.todo')
+ mac_gui = vim.eval('s:mac_gui') == '1'
+
+ lock = thr.Lock()
+ buf = Buffer(lock, len(plugs), G_PULL)
+ buf_q, work_q = queue.Queue(), queue.Queue()
+ for work in plugs.items():
+ work_q.put(work)
+
+ start_cnt = thr.active_count()
+ for num in range(nthreads):
+ tname = 'PlugT-{0:02}'.format(num)
+ thread = PlugThread(tname, (buf_q, work_q, lock))
+ thread.start()
+ if mac_gui:
+ rthread = RefreshThread(lock)
+ rthread.start()
+
+ while not buf_q.empty() or thr.active_count() != start_cnt:
+ try:
+ action, name, msg = buf_q.get(True, 0.25)
+ buf.write(action, name, ['OK'] if not msg else msg)
+ buf_q.task_done()
+ except queue.Empty:
+ pass
+ except KeyboardInterrupt:
+ G_STOP.set()
+
+ if mac_gui:
+ rthread.stop()
+ rthread.join()
+
+main()
+EOF
+endfunction
+
+function! s:update_ruby()
+ ruby << EOF
+ module PlugStream
+ SEP = ["\r", "\n", nil]
+ def get_line
+ buffer = ''
+ loop do
+ char = readchar rescue return
+ if SEP.include? char.chr
+ buffer << $/
+ break
+ else
+ buffer << char
+ end
+ end
+ buffer
+ end
+ end unless defined?(PlugStream)
+
+ def esc arg
+ %["#{arg.gsub('"', '\"')}"]
+ end
+
+ def killall pid
+ pids = [pid]
+ if /mswin|mingw|bccwin/ =~ RUBY_PLATFORM
+ pids.each { |pid| Process.kill 'INT', pid.to_i rescue nil }
+ else
+ unless `which pgrep 2> /dev/null`.empty?
+ children = pids
+ until children.empty?
+ children = children.map { |pid|
+ `pgrep -P #{pid}`.lines.map { |l| l.chomp }
+ }.flatten
+ pids += children
+ end
+ end
+ pids.each { |pid| Process.kill 'TERM', pid.to_i rescue nil }
+ end
+ end
+
+ def compare_git_uri a, b
+ regex = %r{^(?:\w+://)?(?:[^@/]*@)?([^:/]*(?::[0-9]*)?)[:/](.*?)(?:\.git)?/?$}
+ regex.match(a).to_a.drop(1) == regex.match(b).to_a.drop(1)
+ end
+
+ require 'thread'
+ require 'fileutils'
+ require 'timeout'
+ running = true
+ iswin = VIM::evaluate('s:is_win').to_i == 1
+ pull = VIM::evaluate('s:update.pull').to_i == 1
+ base = VIM::evaluate('g:plug_home')
+ all = VIM::evaluate('s:update.todo')
+ limit = VIM::evaluate('get(g:, "plug_timeout", 60)')
+ tries = VIM::evaluate('get(g:, "plug_retries", 2)') + 1
+ nthr = VIM::evaluate('s:update.threads').to_i
+ maxy = VIM::evaluate('winheight(".")').to_i
+ vim7 = VIM::evaluate('v:version').to_i <= 703 && RUBY_PLATFORM =~ /darwin/
+ cd = iswin ? 'cd /d' : 'cd'
+ tot = VIM::evaluate('len(s:update.todo)') || 0
+ bar = ''
+ skip = 'Already installed'
+ mtx = Mutex.new
+ take1 = proc { mtx.synchronize { running && all.shift } }
+ logh = proc {
+ cnt = bar.length
+ $curbuf[1] = "#{pull ? 'Updating' : 'Installing'} plugins (#{cnt}/#{tot})"
+ $curbuf[2] = '[' + bar.ljust(tot) + ']'
+ VIM::command('normal! 2G')
+ VIM::command('redraw')
+ }
+ where = proc { |name| (1..($curbuf.length)).find { |l| $curbuf[l] =~ /^[-+x*] #{name}:/ } }
+ log = proc { |name, result, type|
+ mtx.synchronize do
+ ing = ![true, false].include?(type)
+ bar += type ? '=' : 'x' unless ing
+ b = case type
+ when :install then '+' when :update then '*'
+ when true, nil then '-' else
+ VIM::command("call add(s:update.errors, '#{name}')")
+ 'x'
+ end
+ result =
+ if type || type.nil?
+ ["#{b} #{name}: #{result.lines.to_a.last || 'OK'}"]
+ elsif result =~ /^Interrupted|^Timeout/
+ ["#{b} #{name}: #{result}"]
+ else
+ ["#{b} #{name}"] + result.lines.map { |l| " " << l }
+ end
+ if lnum = where.call(name)
+ $curbuf.delete lnum
+ lnum = 4 if ing && lnum > maxy
+ end
+ result.each_with_index do |line, offset|
+ $curbuf.append((lnum || 4) - 1 + offset, line.gsub(/\e\[./, '').chomp)
+ end
+ logh.call
+ end
+ }
+ bt = proc { |cmd, name, type, cleanup|
+ tried = timeout = 0
+ begin
+ tried += 1
+ timeout += limit
+ fd = nil
+ data = ''
+ if iswin
+ Timeout::timeout(timeout) do
+ tmp = VIM::evaluate('tempname()')
+ system("(#{cmd}) > #{tmp}")
+ data = File.read(tmp).chomp
+ File.unlink tmp rescue nil
+ end
+ else
+ fd = IO.popen(cmd).extend(PlugStream)
+ first_line = true
+ log_prob = 1.0 / nthr
+ while line = Timeout::timeout(timeout) { fd.get_line }
+ data << line
+ log.call name, line.chomp, type if name && (first_line || rand < log_prob)
+ first_line = false
+ end
+ fd.close
+ end
+ [$? == 0, data.chomp]
+ rescue Timeout::Error, Interrupt => e
+ if fd && !fd.closed?
+ killall fd.pid
+ fd.close
+ end
+ cleanup.call if cleanup
+ if e.is_a?(Timeout::Error) && tried < tries
+ 3.downto(1) do |countdown|
+ s = countdown > 1 ? 's' : ''
+ log.call name, "Timeout. Will retry in #{countdown} second#{s} ...", type
+ sleep 1
+ end
+ log.call name, 'Retrying ...', type
+ retry
+ end
+ [false, e.is_a?(Interrupt) ? "Interrupted!" : "Timeout!"]
+ end
+ }
+ main = Thread.current
+ threads = []
+ watcher = Thread.new {
+ if vim7
+ while VIM::evaluate('getchar(1)')
+ sleep 0.1
+ end
+ else
+ require 'io/console' # >= Ruby 1.9
+ nil until IO.console.getch == 3.chr
+ end
+ mtx.synchronize do
+ running = false
+ threads.each { |t| t.raise Interrupt } unless vim7
+ end
+ threads.each { |t| t.join rescue nil }
+ main.kill
+ }
+ refresh = Thread.new {
+ while true
+ mtx.synchronize do
+ break unless running
+ VIM::command('noautocmd normal! a')
+ end
+ sleep 0.2
+ end
+ } if VIM::evaluate('s:mac_gui') == 1
+
+ clone_opt = VIM::evaluate('s:clone_opt').join(' ')
+ progress = VIM::evaluate('s:progress_opt(1)')
+ nthr.times do
+ mtx.synchronize do
+ threads << Thread.new {
+ while pair = take1.call
+ name = pair.first
+ dir, uri, tag = pair.last.values_at *%w[dir uri tag]
+ exists = File.directory? dir
+ ok, result =
+ if exists
+ chdir = "#{cd} #{iswin ? dir : esc(dir)}"
+ ret, data = bt.call "#{chdir} && git rev-parse --abbrev-ref HEAD 2>&1 && git config -f .git/config remote.origin.url", nil, nil, nil
+ current_uri = data.lines.to_a.last
+ if !ret
+ if data =~ /^Interrupted|^Timeout/
+ [false, data]
+ else
+ [false, [data.chomp, "PlugClean required."].join($/)]
+ end
+ elsif !compare_git_uri(current_uri, uri)
+ [false, ["Invalid URI: #{current_uri}",
+ "Expected: #{uri}",
+ "PlugClean required."].join($/)]
+ else
+ if pull
+ log.call name, 'Updating ...', :update
+ fetch_opt = (tag && File.exist?(File.join(dir, '.git/shallow'))) ? '--depth 99999999' : ''
+ bt.call "#{chdir} && git fetch #{fetch_opt} #{progress} 2>&1", name, :update, nil
+ else
+ [true, skip]
+ end
+ end
+ else
+ d = esc dir.sub(%r{[\\/]+$}, '')
+ log.call name, 'Installing ...', :install
+ bt.call "git clone #{clone_opt unless tag} #{progress} #{uri} #{d} 2>&1", name, :install, proc {
+ FileUtils.rm_rf dir
+ }
+ end
+ mtx.synchronize { VIM::command("let s:update.new['#{name}'] = 1") } if !exists && ok
+ log.call name, result, ok
+ end
+ } if running
+ end
+ end
+ threads.each { |t| t.join rescue nil }
+ logh.call
+ refresh.kill if refresh
+ watcher.kill
+EOF
+endfunction
+
+function! s:shellesc_cmd(arg, script)
+ let escaped = substitute('"'.a:arg.'"', '[&|<>()@^!"]', '^&', 'g')
+ return substitute(escaped, '%', (a:script ? '%' : '^') . '&', 'g')
+endfunction
+
+function! s:shellesc_ps1(arg)
+ return "'".substitute(escape(a:arg, '\"'), "'", "''", 'g')."'"
+endfunction
+
+function! s:shellesc_sh(arg)
+ return "'".substitute(a:arg, "'", "'\\\\''", 'g')."'"
+endfunction
+
+" Escape the shell argument based on the shell.
+" Vim and Neovim's shellescape() are insufficient.
+" 1. shellslash determines whether to use single/double quotes.
+" Double-quote escaping is fragile for cmd.exe.
+" 2. It does not work for powershell.
+" 3. It does not work for *sh shells if the command is executed
+" via cmd.exe (ie. cmd.exe /c sh -c command command_args)
+" 4. It does not support batchfile syntax.
+"
+" Accepts an optional dictionary with the following keys:
+" - shell: same as Vim/Neovim 'shell' option.
+" If unset, fallback to 'cmd.exe' on Windows or 'sh'.
+" - script: If truthy and shell is cmd.exe, escape for batchfile syntax.
+function! plug#shellescape(arg, ...)
+ if a:arg =~# '^[A-Za-z0-9_/:.-]\+$'
+ return a:arg
+ endif
+ let opts = a:0 > 0 && type(a:1) == s:TYPE.dict ? a:1 : {}
+ let shell = get(opts, 'shell', s:is_win ? 'cmd.exe' : 'sh')
+ let script = get(opts, 'script', 1)
+ if shell =~# 'cmd\(\.exe\)\?$'
+ return s:shellesc_cmd(a:arg, script)
+ elseif s:is_powershell(shell)
+ return s:shellesc_ps1(a:arg)
+ endif
+ return s:shellesc_sh(a:arg)
+endfunction
+
+function! s:glob_dir(path)
+ return map(filter(s:glob(a:path, '**'), 'isdirectory(v:val)'), 's:dirpath(v:val)')
+endfunction
+
+function! s:progress_bar(line, bar, total)
+ call setline(a:line, '[' . s:lpad(a:bar, a:total) . ']')
+endfunction
+
+function! s:compare_git_uri(a, b)
+ " See `git help clone'
+ " https:// [user@] github.com[:port] / junegunn/vim-plug [.git]
+ " [git@] github.com[:port] : junegunn/vim-plug [.git]
+ " file:// / junegunn/vim-plug [/]
+ " / junegunn/vim-plug [/]
+ let pat = '^\%(\w\+://\)\='.'\%([^@/]*@\)\='.'\([^:/]*\%(:[0-9]*\)\=\)'.'[:/]'.'\(.\{-}\)'.'\%(\.git\)\=/\?$'
+ let ma = matchlist(a:a, pat)
+ let mb = matchlist(a:b, pat)
+ return ma[1:2] ==# mb[1:2]
+endfunction
+
+function! s:format_message(bullet, name, message)
+ if a:bullet != 'x'
+ return [printf('%s %s: %s', a:bullet, a:name, s:lastline(a:message))]
+ else
+ let lines = map(s:lines(a:message), '" ".v:val')
+ return extend([printf('x %s:', a:name)], lines)
+ endif
+endfunction
+
+function! s:with_cd(cmd, dir, ...)
+ let script = a:0 > 0 ? a:1 : 1
+ return printf('cd%s %s && %s', s:is_win ? ' /d' : '', plug#shellescape(a:dir, {'script': script}), a:cmd)
+endfunction
+
+function! s:system(cmd, ...)
+ let batchfile = ''
+ try
+ let [sh, shellcmdflag, shrd] = s:chsh(1)
+ if type(a:cmd) == s:TYPE.list
+ " Neovim's system() supports list argument to bypass the shell
+ " but it cannot set the working directory for the command.
+ " Assume that the command does not rely on the shell.
+ if has('nvim') && a:0 == 0
+ return system(a:cmd)
+ endif
+ let cmd = join(map(copy(a:cmd), 'plug#shellescape(v:val, {"shell": &shell, "script": 0})'))
+ if s:is_powershell(&shell)
+ let cmd = '& ' . cmd
+ endif
+ else
+ let cmd = a:cmd
+ endif
+ if a:0 > 0
+ let cmd = s:with_cd(cmd, a:1, type(a:cmd) != s:TYPE.list)
+ endif
+ if s:is_win && type(a:cmd) != s:TYPE.list
+ let [batchfile, cmd] = s:batchfile(cmd)
+ endif
+ return system(cmd)
+ finally
+ let [&shell, &shellcmdflag, &shellredir] = [sh, shellcmdflag, shrd]
+ if s:is_win && filereadable(batchfile)
+ call delete(batchfile)
+ endif
+ endtry
+endfunction
+
+function! s:system_chomp(...)
+ let ret = call('s:system', a:000)
+ return v:shell_error ? '' : substitute(ret, '\n$', '', '')
+endfunction
+
+function! s:git_validate(spec, check_branch)
+ let err = ''
+ if isdirectory(a:spec.dir)
+ let result = [s:git_local_branch(a:spec.dir), s:git_origin_url(a:spec.dir)]
+ let remote = result[-1]
+ if empty(remote)
+ let err = join([remote, 'PlugClean required.'], "\n")
+ elseif !s:compare_git_uri(remote, a:spec.uri)
+ let err = join(['Invalid URI: '.remote,
+ \ 'Expected: '.a:spec.uri,
+ \ 'PlugClean required.'], "\n")
+ elseif a:check_branch && has_key(a:spec, 'commit')
+ let sha = s:git_revision(a:spec.dir)
+ if empty(sha)
+ let err = join(add(result, 'PlugClean required.'), "\n")
+ elseif !s:hash_match(sha, a:spec.commit)
+ let err = join([printf('Invalid HEAD (expected: %s, actual: %s)',
+ \ a:spec.commit[:6], sha[:6]),
+ \ 'PlugUpdate required.'], "\n")
+ endif
+ elseif a:check_branch
+ let current_branch = result[0]
+ " Check tag
+ let origin_branch = s:git_origin_branch(a:spec)
+ if has_key(a:spec, 'tag')
+ let tag = s:system_chomp('git describe --exact-match --tags HEAD 2>&1', a:spec.dir)
+ if a:spec.tag !=# tag && a:spec.tag !~ '\*'
+ let err = printf('Invalid tag: %s (expected: %s). Try PlugUpdate.',
+ \ (empty(tag) ? 'N/A' : tag), a:spec.tag)
+ endif
+ " Check branch
+ elseif origin_branch !=# current_branch
+ let err = printf('Invalid branch: %s (expected: %s). Try PlugUpdate.',
+ \ current_branch, origin_branch)
+ endif
+ if empty(err)
+ let [ahead, behind] = split(s:lastline(s:system([
+ \ 'git', 'rev-list', '--count', '--left-right',
+ \ printf('HEAD...origin/%s', origin_branch)
+ \ ], a:spec.dir)), '\t')
+ if !v:shell_error && ahead
+ if behind
+ " Only mention PlugClean if diverged, otherwise it's likely to be
+ " pushable (and probably not that messed up).
+ let err = printf(
+ \ "Diverged from origin/%s (%d commit(s) ahead and %d commit(s) behind!\n"
+ \ .'Backup local changes and run PlugClean and PlugUpdate to reinstall it.', origin_branch, ahead, behind)
+ else
+ let err = printf("Ahead of origin/%s by %d commit(s).\n"
+ \ .'Cannot update until local changes are pushed.',
+ \ origin_branch, ahead)
+ endif
+ endif
+ endif
+ endif
+ else
+ let err = 'Not found'
+ endif
+ return [err, err =~# 'PlugClean']
+endfunction
+
+function! s:rm_rf(dir)
+ if isdirectory(a:dir)
+ return s:system(s:is_win
+ \ ? 'rmdir /S /Q '.plug#shellescape(a:dir)
+ \ : ['rm', '-rf', a:dir])
+ endif
+endfunction
+
+function! s:clean(force)
+ call s:prepare()
+ call append(0, 'Searching for invalid plugins in '.g:plug_home)
+ call append(1, '')
+
+ " List of valid directories
+ let dirs = []
+ let errs = {}
+ let [cnt, total] = [0, len(g:plugs)]
+ for [name, spec] in items(g:plugs)
+ if !s:is_managed(name)
+ call add(dirs, spec.dir)
+ else
+ let [err, clean] = s:git_validate(spec, 1)
+ if clean
+ let errs[spec.dir] = s:lines(err)[0]
+ else
+ call add(dirs, spec.dir)
+ endif
+ endif
+ let cnt += 1
+ call s:progress_bar(2, repeat('=', cnt), total)
+ normal! 2G
+ redraw
+ endfor
+
+ let allowed = {}
+ for dir in dirs
+ let allowed[s:dirpath(s:plug_fnamemodify(dir, ':h:h'))] = 1
+ let allowed[dir] = 1
+ for child in s:glob_dir(dir)
+ let allowed[child] = 1
+ endfor
+ endfor
+
+ let todo = []
+ let found = sort(s:glob_dir(g:plug_home))
+ while !empty(found)
+ let f = remove(found, 0)
+ if !has_key(allowed, f) && isdirectory(f)
+ call add(todo, f)
+ call append(line('$'), '- ' . f)
+ if has_key(errs, f)
+ call append(line('$'), ' ' . errs[f])
+ endif
+ let found = filter(found, 'stridx(v:val, f) != 0')
+ end
+ endwhile
+
+ 4
+ redraw
+ if empty(todo)
+ call append(line('$'), 'Already clean.')
+ else
+ let s:clean_count = 0
+ call append(3, ['Directories to delete:', ''])
+ redraw!
+ if a:force || s:ask_no_interrupt('Delete all directories?')
+ call s:delete([6, line('$')], 1)
+ else
+ call setline(4, 'Cancelled.')
+ nnoremap d :set opfunc=delete_opg@
+ nmap dd d_
+ xnoremap d :call delete_op(visualmode(), 1)
+ echo 'Delete the lines (d{motion}) to delete the corresponding directories'
+ endif
+ endif
+ 4
+ setlocal nomodifiable
+endfunction
+
+function! s:delete_op(type, ...)
+ call s:delete(a:0 ? [line("'<"), line("'>")] : [line("'["), line("']")], 0)
+endfunction
+
+function! s:delete(range, force)
+ let [l1, l2] = a:range
+ let force = a:force
+ let err_count = 0
+ while l1 <= l2
+ let line = getline(l1)
+ if line =~ '^- ' && isdirectory(line[2:])
+ execute l1
+ redraw!
+ let answer = force ? 1 : s:ask('Delete '.line[2:].'?', 1)
+ let force = force || answer > 1
+ if answer
+ let err = s:rm_rf(line[2:])
+ setlocal modifiable
+ if empty(err)
+ call setline(l1, '~'.line[1:])
+ let s:clean_count += 1
+ else
+ delete _
+ call append(l1 - 1, s:format_message('x', line[1:], err))
+ let l2 += len(s:lines(err))
+ let err_count += 1
+ endif
+ let msg = printf('Removed %d directories.', s:clean_count)
+ if err_count > 0
+ let msg .= printf(' Failed to remove %d directories.', err_count)
+ endif
+ call setline(4, msg)
+ setlocal nomodifiable
+ endif
+ endif
+ let l1 += 1
+ endwhile
+endfunction
+
+function! s:upgrade()
+ echo 'Downloading the latest version of vim-plug'
+ redraw
+ let tmp = s:plug_tempname()
+ let new = tmp . '/plug.vim'
+
+ try
+ let out = s:system(['git', 'clone', '--depth', '1', s:plug_src, tmp])
+ if v:shell_error
+ return s:err('Error upgrading vim-plug: '. out)
+ endif
+
+ if readfile(s:me) ==# readfile(new)
+ echo 'vim-plug is already up-to-date'
+ return 0
+ else
+ call rename(s:me, s:me . '.old')
+ call rename(new, s:me)
+ unlet g:loaded_plug
+ echo 'vim-plug has been upgraded'
+ return 1
+ endif
+ finally
+ silent! call s:rm_rf(tmp)
+ endtry
+endfunction
+
+function! s:upgrade_specs()
+ for spec in values(g:plugs)
+ let spec.frozen = get(spec, 'frozen', 0)
+ endfor
+endfunction
+
+function! s:status()
+ call s:prepare()
+ call append(0, 'Checking plugins')
+ call append(1, '')
+
+ let ecnt = 0
+ let unloaded = 0
+ let [cnt, total] = [0, len(g:plugs)]
+ for [name, spec] in items(g:plugs)
+ let is_dir = isdirectory(spec.dir)
+ if has_key(spec, 'uri')
+ if is_dir
+ let [err, _] = s:git_validate(spec, 1)
+ let [valid, msg] = [empty(err), empty(err) ? 'OK' : err]
+ else
+ let [valid, msg] = [0, 'Not found. Try PlugInstall.']
+ endif
+ else
+ if is_dir
+ let [valid, msg] = [1, 'OK']
+ else
+ let [valid, msg] = [0, 'Not found.']
+ endif
+ endif
+ let cnt += 1
+ let ecnt += !valid
+ " `s:loaded` entry can be missing if PlugUpgraded
+ if is_dir && get(s:loaded, name, -1) == 0
+ let unloaded = 1
+ let msg .= ' (not loaded)'
+ endif
+ call s:progress_bar(2, repeat('=', cnt), total)
+ call append(3, s:format_message(valid ? '-' : 'x', name, msg))
+ normal! 2G
+ redraw
+ endfor
+ call setline(1, 'Finished. '.ecnt.' error(s).')
+ normal! gg
+ setlocal nomodifiable
+ if unloaded
+ echo "Press 'L' on each line to load plugin, or 'U' to update"
+ nnoremap L :call status_load(line('.'))
+ xnoremap L :call status_load(line('.'))
+ end
+endfunction
+
+function! s:extract_name(str, prefix, suffix)
+ return matchstr(a:str, '^'.a:prefix.' \zs[^:]\+\ze:.*'.a:suffix.'$')
+endfunction
+
+function! s:status_load(lnum)
+ let line = getline(a:lnum)
+ let name = s:extract_name(line, '-', '(not loaded)')
+ if !empty(name)
+ call plug#load(name)
+ setlocal modifiable
+ call setline(a:lnum, substitute(line, ' (not loaded)$', '', ''))
+ setlocal nomodifiable
+ endif
+endfunction
+
+function! s:status_update() range
+ let lines = getline(a:firstline, a:lastline)
+ let names = filter(map(lines, 's:extract_name(v:val, "[x-]", "")'), '!empty(v:val)')
+ if !empty(names)
+ echo
+ execute 'PlugUpdate' join(names)
+ endif
+endfunction
+
+function! s:is_preview_window_open()
+ silent! wincmd P
+ if &previewwindow
+ wincmd p
+ return 1
+ endif
+endfunction
+
+function! s:find_name(lnum)
+ for lnum in reverse(range(1, a:lnum))
+ let line = getline(lnum)
+ if empty(line)
+ return ''
+ endif
+ let name = s:extract_name(line, '-', '')
+ if !empty(name)
+ return name
+ endif
+ endfor
+ return ''
+endfunction
+
+function! s:preview_commit()
+ if b:plug_preview < 0
+ let b:plug_preview = !s:is_preview_window_open()
+ endif
+
+ let sha = matchstr(getline('.'), '^ \X*\zs[0-9a-f]\{7,9}')
+ if empty(sha)
+ return
+ endif
+
+ let name = s:find_name(line('.'))
+ if empty(name) || !has_key(g:plugs, name) || !isdirectory(g:plugs[name].dir)
+ return
+ endif
+
+ if exists('g:plug_pwindow') && !s:is_preview_window_open()
+ execute g:plug_pwindow
+ execute 'e' sha
+ else
+ execute 'pedit' sha
+ wincmd P
+ endif
+ setlocal previewwindow filetype=git buftype=nofile nobuflisted modifiable
+ let batchfile = ''
+ try
+ let [sh, shellcmdflag, shrd] = s:chsh(1)
+ let cmd = 'cd '.plug#shellescape(g:plugs[name].dir).' && git show --no-color --pretty=medium '.sha
+ if s:is_win
+ let [batchfile, cmd] = s:batchfile(cmd)
+ endif
+ execute 'silent %!' cmd
+ finally
+ let [&shell, &shellcmdflag, &shellredir] = [sh, shellcmdflag, shrd]
+ if s:is_win && filereadable(batchfile)
+ call delete(batchfile)
+ endif
+ endtry
+ setlocal nomodifiable
+ nnoremap q :q
+ wincmd p
+endfunction
+
+function! s:section(flags)
+ call search('\(^[x-] \)\@<=[^:]\+:', a:flags)
+endfunction
+
+function! s:format_git_log(line)
+ let indent = ' '
+ let tokens = split(a:line, nr2char(1))
+ if len(tokens) != 5
+ return indent.substitute(a:line, '\s*$', '', '')
+ endif
+ let [graph, sha, refs, subject, date] = tokens
+ let tag = matchstr(refs, 'tag: [^,)]\+')
+ let tag = empty(tag) ? ' ' : ' ('.tag.') '
+ return printf('%s%s%s%s%s (%s)', indent, graph, sha, tag, subject, date)
+endfunction
+
+function! s:append_ul(lnum, text)
+ call append(a:lnum, ['', a:text, repeat('-', len(a:text))])
+endfunction
+
+function! s:diff()
+ call s:prepare()
+ call append(0, ['Collecting changes ...', ''])
+ let cnts = [0, 0]
+ let bar = ''
+ let total = filter(copy(g:plugs), 's:is_managed(v:key) && isdirectory(v:val.dir)')
+ call s:progress_bar(2, bar, len(total))
+ for origin in [1, 0]
+ let plugs = reverse(sort(items(filter(copy(total), (origin ? '' : '!').'(has_key(v:val, "commit") || has_key(v:val, "tag"))'))))
+ if empty(plugs)
+ continue
+ endif
+ call s:append_ul(2, origin ? 'Pending updates:' : 'Last update:')
+ for [k, v] in plugs
+ let branch = s:git_origin_branch(v)
+ if len(branch)
+ let range = origin ? '..origin/'.branch : 'HEAD@{1}..'
+ let cmd = ['git', 'log', '--graph', '--color=never']
+ if s:git_version_requirement(2, 10, 0)
+ call add(cmd, '--no-show-signature')
+ endif
+ call extend(cmd, ['--pretty=format:%x01%h%x01%d%x01%s%x01%cr', range])
+ if has_key(v, 'rtp')
+ call extend(cmd, ['--', v.rtp])
+ endif
+ let diff = s:system_chomp(cmd, v.dir)
+ if !empty(diff)
+ let ref = has_key(v, 'tag') ? (' (tag: '.v.tag.')') : has_key(v, 'commit') ? (' '.v.commit) : ''
+ call append(5, extend(['', '- '.k.':'.ref], map(s:lines(diff), 's:format_git_log(v:val)')))
+ let cnts[origin] += 1
+ endif
+ endif
+ let bar .= '='
+ call s:progress_bar(2, bar, len(total))
+ normal! 2G
+ redraw
+ endfor
+ if !cnts[origin]
+ call append(5, ['', 'N/A'])
+ endif
+ endfor
+ call setline(1, printf('%d plugin(s) updated.', cnts[0])
+ \ . (cnts[1] ? printf(' %d plugin(s) have pending updates.', cnts[1]) : ''))
+
+ if cnts[0] || cnts[1]
+ nnoremap (plug-preview) :silent! call preview_commit()
+ if empty(maparg("\", 'n'))
+ nmap (plug-preview)
+ endif
+ if empty(maparg('o', 'n'))
+ nmap o (plug-preview)
+ endif
+ endif
+ if cnts[0]
+ nnoremap X :call revert()
+ echo "Press 'X' on each block to revert the update"
+ endif
+ normal! gg
+ setlocal nomodifiable
+endfunction
+
+function! s:revert()
+ if search('^Pending updates', 'bnW')
+ return
+ endif
+
+ let name = s:find_name(line('.'))
+ if empty(name) || !has_key(g:plugs, name) ||
+ \ input(printf('Revert the update of %s? (y/N) ', name)) !~? '^y'
+ return
+ endif
+
+ call s:system('git reset --hard HEAD@{1} && git checkout '.plug#shellescape(g:plugs[name].branch).' --', g:plugs[name].dir)
+ setlocal modifiable
+ normal! "_dap
+ setlocal nomodifiable
+ echo 'Reverted'
+endfunction
+
+function! s:snapshot(force, ...) abort
+ call s:prepare()
+ setf vim
+ call append(0, ['" Generated by vim-plug',
+ \ '" '.strftime("%c"),
+ \ '" :source this file in vim to restore the snapshot',
+ \ '" or execute: vim -S snapshot.vim',
+ \ '', '', 'PlugUpdate!'])
+ 1
+ let anchor = line('$') - 3
+ let names = sort(keys(filter(copy(g:plugs),
+ \'has_key(v:val, "uri") && !has_key(v:val, "commit") && isdirectory(v:val.dir)')))
+ for name in reverse(names)
+ let sha = s:git_revision(g:plugs[name].dir)
+ if !empty(sha)
+ call append(anchor, printf("silent! let g:plugs['%s'].commit = '%s'", name, sha))
+ redraw
+ endif
+ endfor
+
+ if a:0 > 0
+ let fn = s:plug_expand(a:1)
+ if filereadable(fn) && !(a:force || s:ask(a:1.' already exists. Overwrite?'))
+ return
+ endif
+ call writefile(getline(1, '$'), fn)
+ echo 'Saved as '.a:1
+ silent execute 'e' s:esc(fn)
+ setf vim
+ endif
+endfunction
+
+function! s:split_rtp()
+ return split(&rtp, '\\\@`-mappings |
+"| `for` | On-demand loading: File types |
+"| `frozen` | Do not update unless explicitly specified |
+"
+" More information: https://github.com/junegunn/vim-plug
+"
+"
+" Copyright (c) 2017 Junegunn Choi
+"
+" MIT License
+"
+" Permission is hereby granted, free of charge, to any person obtaining
+" a copy of this software and associated documentation files (the
+" "Software"), to deal in the Software without restriction, including
+" without limitation the rights to use, copy, modify, merge, publish,
+" distribute, sublicense, and/or sell copies of the Software, and to
+" permit persons to whom the Software is furnished to do so, subject to
+" the following conditions:
+"
+" The above copyright notice and this permission notice shall be
+" included in all copies or substantial portions of the Software.
+"
+" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+" NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+" LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+" OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+" WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+if exists('g:loaded_plug')
+ finish
+endif
+let g:loaded_plug = 1
+
+let s:cpo_save = &cpo
+set cpo&vim
+
+let s:plug_src = 'https://github.com/junegunn/vim-plug.git'
+let s:plug_tab = get(s:, 'plug_tab', -1)
+let s:plug_buf = get(s:, 'plug_buf', -1)
+let s:mac_gui = has('gui_macvim') && has('gui_running')
+let s:is_win = has('win32')
+let s:nvim = has('nvim-0.2') || (has('nvim') && exists('*jobwait') && !s:is_win)
+let s:vim8 = has('patch-8.0.0039') && exists('*job_start')
+if s:is_win && &shellslash
+ set noshellslash
+ let s:me = resolve(expand(':p'))
+ set shellslash
+else
+ let s:me = resolve(expand(':p'))
+endif
+let s:base_spec = { 'branch': '', 'frozen': 0 }
+let s:TYPE = {
+\ 'string': type(''),
+\ 'list': type([]),
+\ 'dict': type({}),
+\ 'funcref': type(function('call'))
+\ }
+let s:loaded = get(s:, 'loaded', {})
+let s:triggers = get(s:, 'triggers', {})
+
+function! s:isabsolute(dir) abort
+ return a:dir =~# '^/' || (has('win32') && a:dir =~? '^\%(\\\|[A-Z]:\)')
+endfunction
+
+function! s:git_dir(dir) abort
+ let gitdir = s:trim(a:dir) . '/.git'
+ if isdirectory(gitdir)
+ return gitdir
+ endif
+ if !filereadable(gitdir)
+ return ''
+ endif
+ let gitdir = matchstr(get(readfile(gitdir), 0, ''), '^gitdir: \zs.*')
+ if len(gitdir) && !s:isabsolute(gitdir)
+ let gitdir = a:dir . '/' . gitdir
+ endif
+ return isdirectory(gitdir) ? gitdir : ''
+endfunction
+
+function! s:git_origin_url(dir) abort
+ let gitdir = s:git_dir(a:dir)
+ let config = gitdir . '/config'
+ if empty(gitdir) || !filereadable(config)
+ return ''
+ endif
+ return matchstr(join(readfile(config)), '\[remote "origin"\].\{-}url\s*=\s*\zs\S*\ze')
+endfunction
+
+function! s:git_revision(dir) abort
+ let gitdir = s:git_dir(a:dir)
+ let head = gitdir . '/HEAD'
+ if empty(gitdir) || !filereadable(head)
+ return ''
+ endif
+
+ let line = get(readfile(head), 0, '')
+ let ref = matchstr(line, '^ref: \zs.*')
+ if empty(ref)
+ return line
+ endif
+
+ if filereadable(gitdir . '/' . ref)
+ return get(readfile(gitdir . '/' . ref), 0, '')
+ endif
+
+ if filereadable(gitdir . '/packed-refs')
+ for line in readfile(gitdir . '/packed-refs')
+ if line =~# ' ' . ref
+ return matchstr(line, '^[0-9a-f]*')
+ endif
+ endfor
+ endif
+
+ return ''
+endfunction
+
+function! s:git_local_branch(dir) abort
+ let gitdir = s:git_dir(a:dir)
+ let head = gitdir . '/HEAD'
+ if empty(gitdir) || !filereadable(head)
+ return ''
+ endif
+ let branch = matchstr(get(readfile(head), 0, ''), '^ref: refs/heads/\zs.*')
+ return len(branch) ? branch : 'HEAD'
+endfunction
+
+function! s:git_origin_branch(spec)
+ if len(a:spec.branch)
+ return a:spec.branch
+ endif
+
+ " The file may not be present if this is a local repository
+ let gitdir = s:git_dir(a:spec.dir)
+ let origin_head = gitdir.'/refs/remotes/origin/HEAD'
+ if len(gitdir) && filereadable(origin_head)
+ return matchstr(get(readfile(origin_head), 0, ''),
+ \ '^ref: refs/remotes/origin/\zs.*')
+ endif
+
+ " The command may not return the name of a branch in detached HEAD state
+ let result = s:lines(s:system('git symbolic-ref --short HEAD', a:spec.dir))
+ return v:shell_error ? '' : result[-1]
+endfunction
+
+if s:is_win
+ function! s:plug_call(fn, ...)
+ let shellslash = &shellslash
+ try
+ set noshellslash
+ return call(a:fn, a:000)
+ finally
+ let &shellslash = shellslash
+ endtry
+ endfunction
+else
+ function! s:plug_call(fn, ...)
+ return call(a:fn, a:000)
+ endfunction
+endif
+
+function! s:plug_getcwd()
+ return s:plug_call('getcwd')
+endfunction
+
+function! s:plug_fnamemodify(fname, mods)
+ return s:plug_call('fnamemodify', a:fname, a:mods)
+endfunction
+
+function! s:plug_expand(fmt)
+ return s:plug_call('expand', a:fmt, 1)
+endfunction
+
+function! s:plug_tempname()
+ return s:plug_call('tempname')
+endfunction
+
+function! plug#begin(...)
+ if a:0 > 0
+ let s:plug_home_org = a:1
+ let home = s:path(s:plug_fnamemodify(s:plug_expand(a:1), ':p'))
+ elseif exists('g:plug_home')
+ let home = s:path(g:plug_home)
+ elseif !empty(&rtp)
+ let home = s:path(split(&rtp, ',')[0]) . '/plugged'
+ else
+ return s:err('Unable to determine plug home. Try calling plug#begin() with a path argument.')
+ endif
+ if s:plug_fnamemodify(home, ':t') ==# 'plugin' && s:plug_fnamemodify(home, ':h') ==# s:first_rtp
+ return s:err('Invalid plug home. '.home.' is a standard Vim runtime path and is not allowed.')
+ endif
+
+ let g:plug_home = home
+ let g:plugs = {}
+ let g:plugs_order = []
+ let s:triggers = {}
+
+ call s:define_commands()
+ return 1
+endfunction
+
+function! s:define_commands()
+ command! -nargs=+ -bar Plug call plug#()
+ if !executable('git')
+ return s:err('`git` executable not found. Most commands will not be available. To suppress this message, prepend `silent!` to `call plug#begin(...)`.')
+ endif
+ if has('win32')
+ \ && &shellslash
+ \ && (&shell =~# 'cmd\(\.exe\)\?$' || &shell =~# 'powershell\(\.exe\)\?$')
+ return s:err('vim-plug does not support shell, ' . &shell . ', when shellslash is set.')
+ endif
+ if !has('nvim')
+ \ && (has('win32') || has('win32unix'))
+ \ && !has('multi_byte')
+ return s:err('Vim needs +multi_byte feature on Windows to run shell commands. Enable +iconv for best results.')
+ endif
+ command! -nargs=* -bar -bang -complete=customlist,s:names PlugInstall call s:install(0, [])
+ command! -nargs=* -bar -bang -complete=customlist,s:names PlugUpdate call s:update(0, [])
+ command! -nargs=0 -bar -bang PlugClean call s:clean(0)
+ command! -nargs=0 -bar PlugUpgrade if s:upgrade() | execute 'source' s:esc(s:me) | endif
+ command! -nargs=0 -bar PlugStatus call s:status()
+ command! -nargs=0 -bar PlugDiff call s:diff()
+ command! -nargs=? -bar -bang -complete=file PlugSnapshot call s:snapshot(0, )
+endfunction
+
+function! s:to_a(v)
+ return type(a:v) == s:TYPE.list ? a:v : [a:v]
+endfunction
+
+function! s:to_s(v)
+ return type(a:v) == s:TYPE.string ? a:v : join(a:v, "\n") . "\n"
+endfunction
+
+function! s:glob(from, pattern)
+ return s:lines(globpath(a:from, a:pattern))
+endfunction
+
+function! s:source(from, ...)
+ let found = 0
+ for pattern in a:000
+ for vim in s:glob(a:from, pattern)
+ execute 'source' s:esc(vim)
+ let found = 1
+ endfor
+ endfor
+ return found
+endfunction
+
+function! s:assoc(dict, key, val)
+ let a:dict[a:key] = add(get(a:dict, a:key, []), a:val)
+endfunction
+
+function! s:ask(message, ...)
+ call inputsave()
+ echohl WarningMsg
+ let answer = input(a:message.(a:0 ? ' (y/N/a) ' : ' (y/N) '))
+ echohl None
+ call inputrestore()
+ echo "\r"
+ return (a:0 && answer =~? '^a') ? 2 : (answer =~? '^y') ? 1 : 0
+endfunction
+
+function! s:ask_no_interrupt(...)
+ try
+ return call('s:ask', a:000)
+ catch
+ return 0
+ endtry
+endfunction
+
+function! s:lazy(plug, opt)
+ return has_key(a:plug, a:opt) &&
+ \ (empty(s:to_a(a:plug[a:opt])) ||
+ \ !isdirectory(a:plug.dir) ||
+ \ len(s:glob(s:rtp(a:plug), 'plugin')) ||
+ \ len(s:glob(s:rtp(a:plug), 'after/plugin')))
+endfunction
+
+function! plug#end()
+ if !exists('g:plugs')
+ return s:err('plug#end() called without calling plug#begin() first')
+ endif
+
+ if exists('#PlugLOD')
+ augroup PlugLOD
+ autocmd!
+ augroup END
+ augroup! PlugLOD
+ endif
+ let lod = { 'ft': {}, 'map': {}, 'cmd': {} }
+
+ if exists('g:did_load_filetypes')
+ filetype off
+ endif
+ for name in g:plugs_order
+ if !has_key(g:plugs, name)
+ continue
+ endif
+ let plug = g:plugs[name]
+ if get(s:loaded, name, 0) || !s:lazy(plug, 'on') && !s:lazy(plug, 'for')
+ let s:loaded[name] = 1
+ continue
+ endif
+
+ if has_key(plug, 'on')
+ let s:triggers[name] = { 'map': [], 'cmd': [] }
+ for cmd in s:to_a(plug.on)
+ if cmd =~? '^.\+'
+ if empty(mapcheck(cmd)) && empty(mapcheck(cmd, 'i'))
+ call s:assoc(lod.map, cmd, name)
+ endif
+ call add(s:triggers[name].map, cmd)
+ elseif cmd =~# '^[A-Z]'
+ let cmd = substitute(cmd, '!*$', '', '')
+ if exists(':'.cmd) != 2
+ call s:assoc(lod.cmd, cmd, name)
+ endif
+ call add(s:triggers[name].cmd, cmd)
+ else
+ call s:err('Invalid `on` option: '.cmd.
+ \ '. Should start with an uppercase letter or ``.')
+ endif
+ endfor
+ endif
+
+ if has_key(plug, 'for')
+ let types = s:to_a(plug.for)
+ if !empty(types)
+ augroup filetypedetect
+ call s:source(s:rtp(plug), 'ftdetect/**/*.vim', 'after/ftdetect/**/*.vim')
+ augroup END
+ endif
+ for type in types
+ call s:assoc(lod.ft, type, name)
+ endfor
+ endif
+ endfor
+
+ for [cmd, names] in items(lod.cmd)
+ execute printf(
+ \ 'command! -nargs=* -range -bang -complete=file %s call s:lod_cmd(%s, "", , , , %s)',
+ \ cmd, string(cmd), string(names))
+ endfor
+
+ for [map, names] in items(lod.map)
+ for [mode, map_prefix, key_prefix] in
+ \ [['i', '', ''], ['n', '', ''], ['v', '', 'gv'], ['o', '', '']]
+ execute printf(
+ \ '%snoremap %s %s:call lod_map(%s, %s, %s, "%s")',
+ \ mode, map, map_prefix, string(map), string(names), mode != 'i', key_prefix)
+ endfor
+ endfor
+
+ for [ft, names] in items(lod.ft)
+ augroup PlugLOD
+ execute printf('autocmd FileType %s call lod_ft(%s, %s)',
+ \ ft, string(ft), string(names))
+ augroup END
+ endfor
+
+ call s:reorg_rtp()
+ filetype plugin indent on
+ if has('vim_starting')
+ if has('syntax') && !exists('g:syntax_on')
+ syntax enable
+ end
+ else
+ call s:reload_plugins()
+ endif
+endfunction
+
+function! s:loaded_names()
+ return filter(copy(g:plugs_order), 'get(s:loaded, v:val, 0)')
+endfunction
+
+function! s:load_plugin(spec)
+ call s:source(s:rtp(a:spec), 'plugin/**/*.vim', 'after/plugin/**/*.vim')
+endfunction
+
+function! s:reload_plugins()
+ for name in s:loaded_names()
+ call s:load_plugin(g:plugs[name])
+ endfor
+endfunction
+
+function! s:trim(str)
+ return substitute(a:str, '[\/]\+$', '', '')
+endfunction
+
+function! s:version_requirement(val, min)
+ for idx in range(0, len(a:min) - 1)
+ let v = get(a:val, idx, 0)
+ if v < a:min[idx] | return 0
+ elseif v > a:min[idx] | return 1
+ endif
+ endfor
+ return 1
+endfunction
+
+function! s:git_version_requirement(...)
+ if !exists('s:git_version')
+ let s:git_version = map(split(split(s:system(['git', '--version']))[2], '\.'), 'str2nr(v:val)')
+ endif
+ return s:version_requirement(s:git_version, a:000)
+endfunction
+
+function! s:progress_opt(base)
+ return a:base && !s:is_win &&
+ \ s:git_version_requirement(1, 7, 1) ? '--progress' : ''
+endfunction
+
+function! s:rtp(spec)
+ return s:path(a:spec.dir . get(a:spec, 'rtp', ''))
+endfunction
+
+if s:is_win
+ function! s:path(path)
+ return s:trim(substitute(a:path, '/', '\', 'g'))
+ endfunction
+
+ function! s:dirpath(path)
+ return s:path(a:path) . '\'
+ endfunction
+
+ function! s:is_local_plug(repo)
+ return a:repo =~? '^[a-z]:\|^[%~]'
+ endfunction
+
+ " Copied from fzf
+ function! s:wrap_cmds(cmds)
+ let cmds = [
+ \ '@echo off',
+ \ 'setlocal enabledelayedexpansion']
+ \ + (type(a:cmds) == type([]) ? a:cmds : [a:cmds])
+ \ + ['endlocal']
+ if has('iconv')
+ if !exists('s:codepage')
+ let s:codepage = libcallnr('kernel32.dll', 'GetACP', 0)
+ endif
+ return map(cmds, printf('iconv(v:val."\r", "%s", "cp%d")', &encoding, s:codepage))
+ endif
+ return map(cmds, 'v:val."\r"')
+ endfunction
+
+ function! s:batchfile(cmd)
+ let batchfile = s:plug_tempname().'.bat'
+ call writefile(s:wrap_cmds(a:cmd), batchfile)
+ let cmd = plug#shellescape(batchfile, {'shell': &shell, 'script': 0})
+ if &shell =~# 'powershell\(\.exe\)\?$'
+ let cmd = '& ' . cmd
+ endif
+ return [batchfile, cmd]
+ endfunction
+else
+ function! s:path(path)
+ return s:trim(a:path)
+ endfunction
+
+ function! s:dirpath(path)
+ return substitute(a:path, '[/\\]*$', '/', '')
+ endfunction
+
+ function! s:is_local_plug(repo)
+ return a:repo[0] =~ '[/$~]'
+ endfunction
+endif
+
+function! s:err(msg)
+ echohl ErrorMsg
+ echom '[vim-plug] '.a:msg
+ echohl None
+endfunction
+
+function! s:warn(cmd, msg)
+ echohl WarningMsg
+ execute a:cmd 'a:msg'
+ echohl None
+endfunction
+
+function! s:esc(path)
+ return escape(a:path, ' ')
+endfunction
+
+function! s:escrtp(path)
+ return escape(a:path, ' ,')
+endfunction
+
+function! s:remove_rtp()
+ for name in s:loaded_names()
+ let rtp = s:rtp(g:plugs[name])
+ execute 'set rtp-='.s:escrtp(rtp)
+ let after = globpath(rtp, 'after')
+ if isdirectory(after)
+ execute 'set rtp-='.s:escrtp(after)
+ endif
+ endfor
+endfunction
+
+function! s:reorg_rtp()
+ if !empty(s:first_rtp)
+ execute 'set rtp-='.s:first_rtp
+ execute 'set rtp-='.s:last_rtp
+ endif
+
+ " &rtp is modified from outside
+ if exists('s:prtp') && s:prtp !=# &rtp
+ call s:remove_rtp()
+ unlet! s:middle
+ endif
+
+ let s:middle = get(s:, 'middle', &rtp)
+ let rtps = map(s:loaded_names(), 's:rtp(g:plugs[v:val])')
+ let afters = filter(map(copy(rtps), 'globpath(v:val, "after")'), '!empty(v:val)')
+ let rtp = join(map(rtps, 'escape(v:val, ",")'), ',')
+ \ . ','.s:middle.','
+ \ . join(map(afters, 'escape(v:val, ",")'), ',')
+ let &rtp = substitute(substitute(rtp, ',,*', ',', 'g'), '^,\|,$', '', 'g')
+ let s:prtp = &rtp
+
+ if !empty(s:first_rtp)
+ execute 'set rtp^='.s:first_rtp
+ execute 'set rtp+='.s:last_rtp
+ endif
+endfunction
+
+function! s:doautocmd(...)
+ if exists('#'.join(a:000, '#'))
+ execute 'doautocmd' ((v:version > 703 || has('patch442')) ? '' : '') join(a:000)
+ endif
+endfunction
+
+function! s:dobufread(names)
+ for name in a:names
+ let path = s:rtp(g:plugs[name])
+ for dir in ['ftdetect', 'ftplugin', 'after/ftdetect', 'after/ftplugin']
+ if len(finddir(dir, path))
+ if exists('#BufRead')
+ doautocmd BufRead
+ endif
+ return
+ endif
+ endfor
+ endfor
+endfunction
+
+function! plug#load(...)
+ if a:0 == 0
+ return s:err('Argument missing: plugin name(s) required')
+ endif
+ if !exists('g:plugs')
+ return s:err('plug#begin was not called')
+ endif
+ let names = a:0 == 1 && type(a:1) == s:TYPE.list ? a:1 : a:000
+ let unknowns = filter(copy(names), '!has_key(g:plugs, v:val)')
+ if !empty(unknowns)
+ let s = len(unknowns) > 1 ? 's' : ''
+ return s:err(printf('Unknown plugin%s: %s', s, join(unknowns, ', ')))
+ end
+ let unloaded = filter(copy(names), '!get(s:loaded, v:val, 0)')
+ if !empty(unloaded)
+ for name in unloaded
+ call s:lod([name], ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin'])
+ endfor
+ call s:dobufread(unloaded)
+ return 1
+ end
+ return 0
+endfunction
+
+function! s:remove_triggers(name)
+ if !has_key(s:triggers, a:name)
+ return
+ endif
+ for cmd in s:triggers[a:name].cmd
+ execute 'silent! delc' cmd
+ endfor
+ for map in s:triggers[a:name].map
+ execute 'silent! unmap' map
+ execute 'silent! iunmap' map
+ endfor
+ call remove(s:triggers, a:name)
+endfunction
+
+function! s:lod(names, types, ...)
+ for name in a:names
+ call s:remove_triggers(name)
+ let s:loaded[name] = 1
+ endfor
+ call s:reorg_rtp()
+
+ for name in a:names
+ let rtp = s:rtp(g:plugs[name])
+ for dir in a:types
+ call s:source(rtp, dir.'/**/*.vim')
+ endfor
+ if a:0
+ if !s:source(rtp, a:1) && !empty(s:glob(rtp, a:2))
+ execute 'runtime' a:1
+ endif
+ call s:source(rtp, a:2)
+ endif
+ call s:doautocmd('User', name)
+ endfor
+endfunction
+
+function! s:lod_ft(pat, names)
+ let syn = 'syntax/'.a:pat.'.vim'
+ call s:lod(a:names, ['plugin', 'after/plugin'], syn, 'after/'.syn)
+ execute 'autocmd! PlugLOD FileType' a:pat
+ call s:doautocmd('filetypeplugin', 'FileType')
+ call s:doautocmd('filetypeindent', 'FileType')
+endfunction
+
+function! s:lod_cmd(cmd, bang, l1, l2, args, names)
+ call s:lod(a:names, ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin'])
+ call s:dobufread(a:names)
+ execute printf('%s%s%s %s', (a:l1 == a:l2 ? '' : (a:l1.','.a:l2)), a:cmd, a:bang, a:args)
+endfunction
+
+function! s:lod_map(map, names, with_prefix, prefix)
+ call s:lod(a:names, ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin'])
+ call s:dobufread(a:names)
+ let extra = ''
+ while 1
+ let c = getchar(0)
+ if c == 0
+ break
+ endif
+ let extra .= nr2char(c)
+ endwhile
+
+ if a:with_prefix
+ let prefix = v:count ? v:count : ''
+ let prefix .= '"'.v:register.a:prefix
+ if mode(1) == 'no'
+ if v:operator == 'c'
+ let prefix = "\" . prefix
+ endif
+ let prefix .= v:operator
+ endif
+ call feedkeys(prefix, 'n')
+ endif
+ call feedkeys(substitute(a:map, '^', "\", '') . extra)
+endfunction
+
+function! plug#(repo, ...)
+ if a:0 > 1
+ return s:err('Invalid number of arguments (1..2)')
+ endif
+
+ try
+ let repo = s:trim(a:repo)
+ let opts = a:0 == 1 ? s:parse_options(a:1) : s:base_spec
+ let name = get(opts, 'as', s:plug_fnamemodify(repo, ':t:s?\.git$??'))
+ let spec = extend(s:infer_properties(name, repo), opts)
+ if !has_key(g:plugs, name)
+ call add(g:plugs_order, name)
+ endif
+ let g:plugs[name] = spec
+ let s:loaded[name] = get(s:loaded, name, 0)
+ catch
+ return s:err(repo . ' ' . v:exception)
+ endtry
+endfunction
+
+function! s:parse_options(arg)
+ let opts = copy(s:base_spec)
+ let type = type(a:arg)
+ let opt_errfmt = 'Invalid argument for "%s" option of :Plug (expected: %s)'
+ if type == s:TYPE.string
+ if empty(a:arg)
+ throw printf(opt_errfmt, 'tag', 'string')
+ endif
+ let opts.tag = a:arg
+ elseif type == s:TYPE.dict
+ for opt in ['branch', 'tag', 'commit', 'rtp', 'dir', 'as']
+ if has_key(a:arg, opt)
+ \ && (type(a:arg[opt]) != s:TYPE.string || empty(a:arg[opt]))
+ throw printf(opt_errfmt, opt, 'string')
+ endif
+ endfor
+ for opt in ['on', 'for']
+ if has_key(a:arg, opt)
+ \ && type(a:arg[opt]) != s:TYPE.list
+ \ && (type(a:arg[opt]) != s:TYPE.string || empty(a:arg[opt]))
+ throw printf(opt_errfmt, opt, 'string or list')
+ endif
+ endfor
+ if has_key(a:arg, 'do')
+ \ && type(a:arg.do) != s:TYPE.funcref
+ \ && (type(a:arg.do) != s:TYPE.string || empty(a:arg.do))
+ throw printf(opt_errfmt, 'do', 'string or funcref')
+ endif
+ call extend(opts, a:arg)
+ if has_key(opts, 'dir')
+ let opts.dir = s:dirpath(s:plug_expand(opts.dir))
+ endif
+ else
+ throw 'Invalid argument type (expected: string or dictionary)'
+ endif
+ return opts
+endfunction
+
+function! s:infer_properties(name, repo)
+ let repo = a:repo
+ if s:is_local_plug(repo)
+ return { 'dir': s:dirpath(s:plug_expand(repo)) }
+ else
+ if repo =~ ':'
+ let uri = repo
+ else
+ if repo !~ '/'
+ throw printf('Invalid argument: %s (implicit `vim-scripts'' expansion is deprecated)', repo)
+ endif
+ let fmt = get(g:, 'plug_url_format', 'https://git::@github.com/%s.git')
+ let uri = printf(fmt, repo)
+ endif
+ return { 'dir': s:dirpath(g:plug_home.'/'.a:name), 'uri': uri }
+ endif
+endfunction
+
+function! s:install(force, names)
+ call s:update_impl(0, a:force, a:names)
+endfunction
+
+function! s:update(force, names)
+ call s:update_impl(1, a:force, a:names)
+endfunction
+
+function! plug#helptags()
+ if !exists('g:plugs')
+ return s:err('plug#begin was not called')
+ endif
+ for spec in values(g:plugs)
+ let docd = join([s:rtp(spec), 'doc'], '/')
+ if isdirectory(docd)
+ silent! execute 'helptags' s:esc(docd)
+ endif
+ endfor
+ return 1
+endfunction
+
+function! s:syntax()
+ syntax clear
+ syntax region plug1 start=/\%1l/ end=/\%2l/ contains=plugNumber
+ syntax region plug2 start=/\%2l/ end=/\%3l/ contains=plugBracket,plugX
+ syn match plugNumber /[0-9]\+[0-9.]*/ contained
+ syn match plugBracket /[[\]]/ contained
+ syn match plugX /x/ contained
+ syn match plugDash /^-\{1}\ /
+ syn match plugPlus /^+/
+ syn match plugStar /^*/
+ syn match plugMessage /\(^- \)\@<=.*/
+ syn match plugName /\(^- \)\@<=[^ ]*:/
+ syn match plugSha /\%(: \)\@<=[0-9a-f]\{4,}$/
+ syn match plugTag /(tag: [^)]\+)/
+ syn match plugInstall /\(^+ \)\@<=[^:]*/
+ syn match plugUpdate /\(^* \)\@<=[^:]*/
+ syn match plugCommit /^ \X*[0-9a-f]\{7,9} .*/ contains=plugRelDate,plugEdge,plugTag
+ syn match plugEdge /^ \X\+$/
+ syn match plugEdge /^ \X*/ contained nextgroup=plugSha
+ syn match plugSha /[0-9a-f]\{7,9}/ contained
+ syn match plugRelDate /([^)]*)$/ contained
+ syn match plugNotLoaded /(not loaded)$/
+ syn match plugError /^x.*/
+ syn region plugDeleted start=/^\~ .*/ end=/^\ze\S/
+ syn match plugH2 /^.*:\n-\+$/
+ syn match plugH2 /^-\{2,}/
+ syn keyword Function PlugInstall PlugStatus PlugUpdate PlugClean
+ hi def link plug1 Title
+ hi def link plug2 Repeat
+ hi def link plugH2 Type
+ hi def link plugX Exception
+ hi def link plugBracket Structure
+ hi def link plugNumber Number
+
+ hi def link plugDash Special
+ hi def link plugPlus Constant
+ hi def link plugStar Boolean
+
+ hi def link plugMessage Function
+ hi def link plugName Label
+ hi def link plugInstall Function
+ hi def link plugUpdate Type
+
+ hi def link plugError Error
+ hi def link plugDeleted Ignore
+ hi def link plugRelDate Comment
+ hi def link plugEdge PreProc
+ hi def link plugSha Identifier
+ hi def link plugTag Constant
+
+ hi def link plugNotLoaded Comment
+endfunction
+
+function! s:lpad(str, len)
+ return a:str . repeat(' ', a:len - len(a:str))
+endfunction
+
+function! s:lines(msg)
+ return split(a:msg, "[\r\n]")
+endfunction
+
+function! s:lastline(msg)
+ return get(s:lines(a:msg), -1, '')
+endfunction
+
+function! s:new_window()
+ execute get(g:, 'plug_window', 'vertical topleft new')
+endfunction
+
+function! s:plug_window_exists()
+ let buflist = tabpagebuflist(s:plug_tab)
+ return !empty(buflist) && index(buflist, s:plug_buf) >= 0
+endfunction
+
+function! s:switch_in()
+ if !s:plug_window_exists()
+ return 0
+ endif
+
+ if winbufnr(0) != s:plug_buf
+ let s:pos = [tabpagenr(), winnr(), winsaveview()]
+ execute 'normal!' s:plug_tab.'gt'
+ let winnr = bufwinnr(s:plug_buf)
+ execute winnr.'wincmd w'
+ call add(s:pos, winsaveview())
+ else
+ let s:pos = [winsaveview()]
+ endif
+
+ setlocal modifiable
+ return 1
+endfunction
+
+function! s:switch_out(...)
+ call winrestview(s:pos[-1])
+ setlocal nomodifiable
+ if a:0 > 0
+ execute a:1
+ endif
+
+ if len(s:pos) > 1
+ execute 'normal!' s:pos[0].'gt'
+ execute s:pos[1] 'wincmd w'
+ call winrestview(s:pos[2])
+ endif
+endfunction
+
+function! s:finish_bindings()
+ nnoremap R :call retry()
+ nnoremap D :PlugDiff
+ nnoremap S :PlugStatus
+ nnoremap U :call status_update()
+ xnoremap U :call status_update()
+ nnoremap ]] :silent! call section('')
+ nnoremap [[ :silent! call section('b')
+endfunction
+
+function! s:prepare(...)
+ if empty(s:plug_getcwd())
+ throw 'Invalid current working directory. Cannot proceed.'
+ endif
+
+ for evar in ['$GIT_DIR', '$GIT_WORK_TREE']
+ if exists(evar)
+ throw evar.' detected. Cannot proceed.'
+ endif
+ endfor
+
+ call s:job_abort()
+ if s:switch_in()
+ if b:plug_preview == 1
+ pc
+ endif
+ enew
+ else
+ call s:new_window()
+ endif
+
+ nnoremap q :call close_pane()
+ if a:0 == 0
+ call s:finish_bindings()
+ endif
+ let b:plug_preview = -1
+ let s:plug_tab = tabpagenr()
+ let s:plug_buf = winbufnr(0)
+ call s:assign_name()
+
+ for k in ['', 'L', 'o', 'X', 'd', 'dd']
+ execute 'silent! unmap ' k
+ endfor
+ setlocal buftype=nofile bufhidden=wipe nobuflisted nolist noswapfile nowrap cursorline modifiable nospell
+ if exists('+colorcolumn')
+ setlocal colorcolumn=
+ endif
+ setf vim-plug
+ if exists('g:syntax_on')
+ call s:syntax()
+ endif
+endfunction
+
+function! s:close_pane()
+ if b:plug_preview == 1
+ pc
+ let b:plug_preview = -1
+ else
+ bd
+ endif
+endfunction
+
+function! s:assign_name()
+ " Assign buffer name
+ let prefix = '[Plugins]'
+ let name = prefix
+ let idx = 2
+ while bufexists(name)
+ let name = printf('%s (%s)', prefix, idx)
+ let idx = idx + 1
+ endwhile
+ silent! execute 'f' fnameescape(name)
+endfunction
+
+function! s:chsh(swap)
+ let prev = [&shell, &shellcmdflag, &shellredir]
+ if !s:is_win
+ set shell=sh
+ endif
+ if a:swap
+ if &shell =~# 'powershell\(\.exe\)\?$' || &shell =~# 'pwsh$'
+ let &shellredir = '2>&1 | Out-File -Encoding UTF8 %s'
+ elseif &shell =~# 'sh' || &shell =~# 'cmd\(\.exe\)\?$'
+ set shellredir=>%s\ 2>&1
+ endif
+ endif
+ return prev
+endfunction
+
+function! s:bang(cmd, ...)
+ let batchfile = ''
+ try
+ let [sh, shellcmdflag, shrd] = s:chsh(a:0)
+ " FIXME: Escaping is incomplete. We could use shellescape with eval,
+ " but it won't work on Windows.
+ let cmd = a:0 ? s:with_cd(a:cmd, a:1) : a:cmd
+ if s:is_win
+ let [batchfile, cmd] = s:batchfile(cmd)
+ endif
+ let g:_plug_bang = (s:is_win && has('gui_running') ? 'silent ' : '').'!'.escape(cmd, '#!%')
+ execute "normal! :execute g:_plug_bang\\"
+ finally
+ unlet g:_plug_bang
+ let [&shell, &shellcmdflag, &shellredir] = [sh, shellcmdflag, shrd]
+ if s:is_win && filereadable(batchfile)
+ call delete(batchfile)
+ endif
+ endtry
+ return v:shell_error ? 'Exit status: ' . v:shell_error : ''
+endfunction
+
+function! s:regress_bar()
+ let bar = substitute(getline(2)[1:-2], '.*\zs=', 'x', '')
+ call s:progress_bar(2, bar, len(bar))
+endfunction
+
+function! s:is_updated(dir)
+ return !empty(s:system_chomp(['git', 'log', '--pretty=format:%h', 'HEAD...HEAD@{1}'], a:dir))
+endfunction
+
+function! s:do(pull, force, todo)
+ for [name, spec] in items(a:todo)
+ if !isdirectory(spec.dir)
+ continue
+ endif
+ let installed = has_key(s:update.new, name)
+ let updated = installed ? 0 :
+ \ (a:pull && index(s:update.errors, name) < 0 && s:is_updated(spec.dir))
+ if a:force || installed || updated
+ execute 'cd' s:esc(spec.dir)
+ call append(3, '- Post-update hook for '. name .' ... ')
+ let error = ''
+ let type = type(spec.do)
+ if type == s:TYPE.string
+ if spec.do[0] == ':'
+ if !get(s:loaded, name, 0)
+ let s:loaded[name] = 1
+ call s:reorg_rtp()
+ endif
+ call s:load_plugin(spec)
+ try
+ execute spec.do[1:]
+ catch
+ let error = v:exception
+ endtry
+ if !s:plug_window_exists()
+ cd -
+ throw 'Warning: vim-plug was terminated by the post-update hook of '.name
+ endif
+ else
+ let error = s:bang(spec.do)
+ endif
+ elseif type == s:TYPE.funcref
+ try
+ call s:load_plugin(spec)
+ let status = installed ? 'installed' : (updated ? 'updated' : 'unchanged')
+ call spec.do({ 'name': name, 'status': status, 'force': a:force })
+ catch
+ let error = v:exception
+ endtry
+ else
+ let error = 'Invalid hook type'
+ endif
+ call s:switch_in()
+ call setline(4, empty(error) ? (getline(4) . 'OK')
+ \ : ('x' . getline(4)[1:] . error))
+ if !empty(error)
+ call add(s:update.errors, name)
+ call s:regress_bar()
+ endif
+ cd -
+ endif
+ endfor
+endfunction
+
+function! s:hash_match(a, b)
+ return stridx(a:a, a:b) == 0 || stridx(a:b, a:a) == 0
+endfunction
+
+function! s:checkout(spec)
+ let sha = a:spec.commit
+ let output = s:git_revision(a:spec.dir)
+ if !empty(output) && !s:hash_match(sha, s:lines(output)[0])
+ let credential_helper = s:git_version_requirement(2) ? '-c credential.helper= ' : ''
+ let output = s:system(
+ \ 'git '.credential_helper.'fetch --depth 999999 && git checkout '.plug#shellescape(sha).' --', a:spec.dir)
+ endif
+ return output
+endfunction
+
+function! s:finish(pull)
+ let new_frozen = len(filter(keys(s:update.new), 'g:plugs[v:val].frozen'))
+ if new_frozen
+ let s = new_frozen > 1 ? 's' : ''
+ call append(3, printf('- Installed %d frozen plugin%s', new_frozen, s))
+ endif
+ call append(3, '- Finishing ... ') | 4
+ redraw
+ call plug#helptags()
+ call plug#end()
+ call setline(4, getline(4) . 'Done!')
+ redraw
+ let msgs = []
+ if !empty(s:update.errors)
+ call add(msgs, "Press 'R' to retry.")
+ endif
+ if a:pull && len(s:update.new) < len(filter(getline(5, '$'),
+ \ "v:val =~ '^- ' && v:val !~# 'Already up.to.date'"))
+ call add(msgs, "Press 'D' to see the updated changes.")
+ endif
+ echo join(msgs, ' ')
+ call s:finish_bindings()
+endfunction
+
+function! s:retry()
+ if empty(s:update.errors)
+ return
+ endif
+ echo
+ call s:update_impl(s:update.pull, s:update.force,
+ \ extend(copy(s:update.errors), [s:update.threads]))
+endfunction
+
+function! s:is_managed(name)
+ return has_key(g:plugs[a:name], 'uri')
+endfunction
+
+function! s:names(...)
+ return sort(filter(keys(g:plugs), 'stridx(v:val, a:1) == 0 && s:is_managed(v:val)'))
+endfunction
+
+function! s:check_ruby()
+ silent! ruby require 'thread'; VIM::command("let g:plug_ruby = '#{RUBY_VERSION}'")
+ if !exists('g:plug_ruby')
+ redraw!
+ return s:warn('echom', 'Warning: Ruby interface is broken')
+ endif
+ let ruby_version = split(g:plug_ruby, '\.')
+ unlet g:plug_ruby
+ return s:version_requirement(ruby_version, [1, 8, 7])
+endfunction
+
+function! s:update_impl(pull, force, args) abort
+ let sync = index(a:args, '--sync') >= 0 || has('vim_starting')
+ let args = filter(copy(a:args), 'v:val != "--sync"')
+ let threads = (len(args) > 0 && args[-1] =~ '^[1-9][0-9]*$') ?
+ \ remove(args, -1) : get(g:, 'plug_threads', 16)
+
+ let managed = filter(copy(g:plugs), 's:is_managed(v:key)')
+ let todo = empty(args) ? filter(managed, '!v:val.frozen || !isdirectory(v:val.dir)') :
+ \ filter(managed, 'index(args, v:key) >= 0')
+
+ if empty(todo)
+ return s:warn('echo', 'No plugin to '. (a:pull ? 'update' : 'install'))
+ endif
+
+ if !s:is_win && s:git_version_requirement(2, 3)
+ let s:git_terminal_prompt = exists('$GIT_TERMINAL_PROMPT') ? $GIT_TERMINAL_PROMPT : ''
+ let $GIT_TERMINAL_PROMPT = 0
+ for plug in values(todo)
+ let plug.uri = substitute(plug.uri,
+ \ '^https://git::@github\.com', 'https://github.com', '')
+ endfor
+ endif
+
+ if !isdirectory(g:plug_home)
+ try
+ call mkdir(g:plug_home, 'p')
+ catch
+ return s:err(printf('Invalid plug directory: %s. '.
+ \ 'Try to call plug#begin with a valid directory', g:plug_home))
+ endtry
+ endif
+
+ if has('nvim') && !exists('*jobwait') && threads > 1
+ call s:warn('echom', '[vim-plug] Update Neovim for parallel installer')
+ endif
+
+ let use_job = s:nvim || s:vim8
+ let python = (has('python') || has('python3')) && !use_job
+ let ruby = has('ruby') && !use_job && (v:version >= 703 || v:version == 702 && has('patch374')) && !(s:is_win && has('gui_running')) && threads > 1 && s:check_ruby()
+
+ let s:update = {
+ \ 'start': reltime(),
+ \ 'all': todo,
+ \ 'todo': copy(todo),
+ \ 'errors': [],
+ \ 'pull': a:pull,
+ \ 'force': a:force,
+ \ 'new': {},
+ \ 'threads': (python || ruby || use_job) ? min([len(todo), threads]) : 1,
+ \ 'bar': '',
+ \ 'fin': 0
+ \ }
+
+ call s:prepare(1)
+ call append(0, ['', ''])
+ normal! 2G
+ silent! redraw
+
+ let s:clone_opt = []
+ if get(g:, 'plug_shallow', 1)
+ call extend(s:clone_opt, ['--depth', '1'])
+ if s:git_version_requirement(1, 7, 10)
+ call add(s:clone_opt, '--no-single-branch')
+ endif
+ endif
+
+ if has('win32unix') || has('wsl')
+ call extend(s:clone_opt, ['-c', 'core.eol=lf', '-c', 'core.autocrlf=input'])
+ endif
+
+ let s:submodule_opt = s:git_version_requirement(2, 8) ? ' --jobs='.threads : ''
+
+ " Python version requirement (>= 2.7)
+ if python && !has('python3') && !ruby && !use_job && s:update.threads > 1
+ redir => pyv
+ silent python import platform; print platform.python_version()
+ redir END
+ let python = s:version_requirement(
+ \ map(split(split(pyv)[0], '\.'), 'str2nr(v:val)'), [2, 6])
+ endif
+
+ if (python || ruby) && s:update.threads > 1
+ try
+ let imd = &imd
+ if s:mac_gui
+ set noimd
+ endif
+ if ruby
+ call s:update_ruby()
+ else
+ call s:update_python()
+ endif
+ catch
+ let lines = getline(4, '$')
+ let printed = {}
+ silent! 4,$d _
+ for line in lines
+ let name = s:extract_name(line, '.', '')
+ if empty(name) || !has_key(printed, name)
+ call append('$', line)
+ if !empty(name)
+ let printed[name] = 1
+ if line[0] == 'x' && index(s:update.errors, name) < 0
+ call add(s:update.errors, name)
+ end
+ endif
+ endif
+ endfor
+ finally
+ let &imd = imd
+ call s:update_finish()
+ endtry
+ else
+ call s:update_vim()
+ while use_job && sync
+ sleep 100m
+ if s:update.fin
+ break
+ endif
+ endwhile
+ endif
+endfunction
+
+function! s:log4(name, msg)
+ call setline(4, printf('- %s (%s)', a:msg, a:name))
+ redraw
+endfunction
+
+function! s:update_finish()
+ if exists('s:git_terminal_prompt')
+ let $GIT_TERMINAL_PROMPT = s:git_terminal_prompt
+ endif
+ if s:switch_in()
+ call append(3, '- Updating ...') | 4
+ for [name, spec] in items(filter(copy(s:update.all), 'index(s:update.errors, v:key) < 0 && (s:update.force || s:update.pull || has_key(s:update.new, v:key))'))
+ let [pos, _] = s:logpos(name)
+ if !pos
+ continue
+ endif
+ if has_key(spec, 'commit')
+ call s:log4(name, 'Checking out '.spec.commit)
+ let out = s:checkout(spec)
+ elseif has_key(spec, 'tag')
+ let tag = spec.tag
+ if tag =~ '\*'
+ let tags = s:lines(s:system('git tag --list '.plug#shellescape(tag).' --sort -version:refname 2>&1', spec.dir))
+ if !v:shell_error && !empty(tags)
+ let tag = tags[0]
+ call s:log4(name, printf('Latest tag for %s -> %s', spec.tag, tag))
+ call append(3, '')
+ endif
+ endif
+ call s:log4(name, 'Checking out '.tag)
+ let out = s:system('git checkout -q '.plug#shellescape(tag).' -- 2>&1', spec.dir)
+ else
+ let branch = s:git_origin_branch(spec)
+ call s:log4(name, 'Merging origin/'.s:esc(branch))
+ let out = s:system('git checkout -q '.plug#shellescape(branch).' -- 2>&1'
+ \. (has_key(s:update.new, name) ? '' : ('&& git merge --ff-only '.plug#shellescape('origin/'.branch).' 2>&1')), spec.dir)
+ endif
+ if !v:shell_error && filereadable(spec.dir.'/.gitmodules') &&
+ \ (s:update.force || has_key(s:update.new, name) || s:is_updated(spec.dir))
+ call s:log4(name, 'Updating submodules. This may take a while.')
+ let out .= s:bang('git submodule update --init --recursive'.s:submodule_opt.' 2>&1', spec.dir)
+ endif
+ let msg = s:format_message(v:shell_error ? 'x': '-', name, out)
+ if v:shell_error
+ call add(s:update.errors, name)
+ call s:regress_bar()
+ silent execute pos 'd _'
+ call append(4, msg) | 4
+ elseif !empty(out)
+ call setline(pos, msg[0])
+ endif
+ redraw
+ endfor
+ silent 4 d _
+ try
+ call s:do(s:update.pull, s:update.force, filter(copy(s:update.all), 'index(s:update.errors, v:key) < 0 && has_key(v:val, "do")'))
+ catch
+ call s:warn('echom', v:exception)
+ call s:warn('echo', '')
+ return
+ endtry
+ call s:finish(s:update.pull)
+ call setline(1, 'Updated. Elapsed time: ' . split(reltimestr(reltime(s:update.start)))[0] . ' sec.')
+ call s:switch_out('normal! gg')
+ endif
+endfunction
+
+function! s:job_abort()
+ if (!s:nvim && !s:vim8) || !exists('s:jobs')
+ return
+ endif
+
+ for [name, j] in items(s:jobs)
+ if s:nvim
+ silent! call jobstop(j.jobid)
+ elseif s:vim8
+ silent! call job_stop(j.jobid)
+ endif
+ if j.new
+ call s:rm_rf(g:plugs[name].dir)
+ endif
+ endfor
+ let s:jobs = {}
+endfunction
+
+function! s:last_non_empty_line(lines)
+ let len = len(a:lines)
+ for idx in range(len)
+ let line = a:lines[len-idx-1]
+ if !empty(line)
+ return line
+ endif
+ endfor
+ return ''
+endfunction
+
+function! s:job_out_cb(self, data) abort
+ let self = a:self
+ let data = remove(self.lines, -1) . a:data
+ let lines = map(split(data, "\n", 1), 'split(v:val, "\r", 1)[-1]')
+ call extend(self.lines, lines)
+ " To reduce the number of buffer updates
+ let self.tick = get(self, 'tick', -1) + 1
+ if !self.running || self.tick % len(s:jobs) == 0
+ let bullet = self.running ? (self.new ? '+' : '*') : (self.error ? 'x' : '-')
+ let result = self.error ? join(self.lines, "\n") : s:last_non_empty_line(self.lines)
+ call s:log(bullet, self.name, result)
+ endif
+endfunction
+
+function! s:job_exit_cb(self, data) abort
+ let a:self.running = 0
+ let a:self.error = a:data != 0
+ call s:reap(a:self.name)
+ call s:tick()
+endfunction
+
+function! s:job_cb(fn, job, ch, data)
+ if !s:plug_window_exists() " plug window closed
+ return s:job_abort()
+ endif
+ call call(a:fn, [a:job, a:data])
+endfunction
+
+function! s:nvim_cb(job_id, data, event) dict abort
+ return (a:event == 'stdout' || a:event == 'stderr') ?
+ \ s:job_cb('s:job_out_cb', self, 0, join(a:data, "\n")) :
+ \ s:job_cb('s:job_exit_cb', self, 0, a:data)
+endfunction
+
+function! s:spawn(name, cmd, opts)
+ let job = { 'name': a:name, 'running': 1, 'error': 0, 'lines': [''],
+ \ 'new': get(a:opts, 'new', 0) }
+ let s:jobs[a:name] = job
+
+ if s:nvim
+ if has_key(a:opts, 'dir')
+ let job.cwd = a:opts.dir
+ endif
+ let argv = a:cmd
+ call extend(job, {
+ \ 'on_stdout': function('s:nvim_cb'),
+ \ 'on_stderr': function('s:nvim_cb'),
+ \ 'on_exit': function('s:nvim_cb'),
+ \ })
+ let jid = s:plug_call('jobstart', argv, job)
+ if jid > 0
+ let job.jobid = jid
+ else
+ let job.running = 0
+ let job.error = 1
+ let job.lines = [jid < 0 ? argv[0].' is not executable' :
+ \ 'Invalid arguments (or job table is full)']
+ endif
+ elseif s:vim8
+ let cmd = join(map(copy(a:cmd), 'plug#shellescape(v:val, {"script": 0})'))
+ if has_key(a:opts, 'dir')
+ let cmd = s:with_cd(cmd, a:opts.dir, 0)
+ endif
+ let argv = s:is_win ? ['cmd', '/s', '/c', '"'.cmd.'"'] : ['sh', '-c', cmd]
+ let jid = job_start(s:is_win ? join(argv, ' ') : argv, {
+ \ 'out_cb': function('s:job_cb', ['s:job_out_cb', job]),
+ \ 'err_cb': function('s:job_cb', ['s:job_out_cb', job]),
+ \ 'exit_cb': function('s:job_cb', ['s:job_exit_cb', job]),
+ \ 'err_mode': 'raw',
+ \ 'out_mode': 'raw'
+ \})
+ if job_status(jid) == 'run'
+ let job.jobid = jid
+ else
+ let job.running = 0
+ let job.error = 1
+ let job.lines = ['Failed to start job']
+ endif
+ else
+ let job.lines = s:lines(call('s:system', has_key(a:opts, 'dir') ? [a:cmd, a:opts.dir] : [a:cmd]))
+ let job.error = v:shell_error != 0
+ let job.running = 0
+ endif
+endfunction
+
+function! s:reap(name)
+ let job = s:jobs[a:name]
+ if job.error
+ call add(s:update.errors, a:name)
+ elseif get(job, 'new', 0)
+ let s:update.new[a:name] = 1
+ endif
+ let s:update.bar .= job.error ? 'x' : '='
+
+ let bullet = job.error ? 'x' : '-'
+ let result = job.error ? join(job.lines, "\n") : s:last_non_empty_line(job.lines)
+ call s:log(bullet, a:name, empty(result) ? 'OK' : result)
+ call s:bar()
+
+ call remove(s:jobs, a:name)
+endfunction
+
+function! s:bar()
+ if s:switch_in()
+ let total = len(s:update.all)
+ call setline(1, (s:update.pull ? 'Updating' : 'Installing').
+ \ ' plugins ('.len(s:update.bar).'/'.total.')')
+ call s:progress_bar(2, s:update.bar, total)
+ call s:switch_out()
+ endif
+endfunction
+
+function! s:logpos(name)
+ let max = line('$')
+ for i in range(4, max > 4 ? max : 4)
+ if getline(i) =~# '^[-+x*] '.a:name.':'
+ for j in range(i + 1, max > 5 ? max : 5)
+ if getline(j) !~ '^ '
+ return [i, j - 1]
+ endif
+ endfor
+ return [i, i]
+ endif
+ endfor
+ return [0, 0]
+endfunction
+
+function! s:log(bullet, name, lines)
+ if s:switch_in()
+ let [b, e] = s:logpos(a:name)
+ if b > 0
+ silent execute printf('%d,%d d _', b, e)
+ if b > winheight('.')
+ let b = 4
+ endif
+ else
+ let b = 4
+ endif
+ " FIXME For some reason, nomodifiable is set after :d in vim8
+ setlocal modifiable
+ call append(b - 1, s:format_message(a:bullet, a:name, a:lines))
+ call s:switch_out()
+ endif
+endfunction
+
+function! s:update_vim()
+ let s:jobs = {}
+
+ call s:bar()
+ call s:tick()
+endfunction
+
+function! s:tick()
+ let pull = s:update.pull
+ let prog = s:progress_opt(s:nvim || s:vim8)
+while 1 " Without TCO, Vim stack is bound to explode
+ if empty(s:update.todo)
+ if empty(s:jobs) && !s:update.fin
+ call s:update_finish()
+ let s:update.fin = 1
+ endif
+ return
+ endif
+
+ let name = keys(s:update.todo)[0]
+ let spec = remove(s:update.todo, name)
+ let new = empty(globpath(spec.dir, '.git', 1))
+
+ call s:log(new ? '+' : '*', name, pull ? 'Updating ...' : 'Installing ...')
+ redraw
+
+ let has_tag = has_key(spec, 'tag')
+ if !new
+ let [error, _] = s:git_validate(spec, 0)
+ if empty(error)
+ if pull
+ let cmd = s:git_version_requirement(2) ? ['git', '-c', 'credential.helper=', 'fetch'] : ['git', 'fetch']
+ if has_tag && !empty(globpath(spec.dir, '.git/shallow'))
+ call extend(cmd, ['--depth', '99999999'])
+ endif
+ if !empty(prog)
+ call add(cmd, prog)
+ endif
+ call s:spawn(name, cmd, { 'dir': spec.dir })
+ else
+ let s:jobs[name] = { 'running': 0, 'lines': ['Already installed'], 'error': 0 }
+ endif
+ else
+ let s:jobs[name] = { 'running': 0, 'lines': s:lines(error), 'error': 1 }
+ endif
+ else
+ let cmd = ['git', 'clone']
+ if !has_tag
+ call extend(cmd, s:clone_opt)
+ endif
+ if !empty(prog)
+ call add(cmd, prog)
+ endif
+ call s:spawn(name, extend(cmd, [spec.uri, s:trim(spec.dir)]), { 'new': 1 })
+ endif
+
+ if !s:jobs[name].running
+ call s:reap(name)
+ endif
+ if len(s:jobs) >= s:update.threads
+ break
+ endif
+endwhile
+endfunction
+
+function! s:update_python()
+let py_exe = has('python') ? 'python' : 'python3'
+execute py_exe "<< EOF"
+import datetime
+import functools
+import os
+try:
+ import queue
+except ImportError:
+ import Queue as queue
+import random
+import re
+import shutil
+import signal
+import subprocess
+import tempfile
+import threading as thr
+import time
+import traceback
+import vim
+
+G_NVIM = vim.eval("has('nvim')") == '1'
+G_PULL = vim.eval('s:update.pull') == '1'
+G_RETRIES = int(vim.eval('get(g:, "plug_retries", 2)')) + 1
+G_TIMEOUT = int(vim.eval('get(g:, "plug_timeout", 60)'))
+G_CLONE_OPT = ' '.join(vim.eval('s:clone_opt'))
+G_PROGRESS = vim.eval('s:progress_opt(1)')
+G_LOG_PROB = 1.0 / int(vim.eval('s:update.threads'))
+G_STOP = thr.Event()
+G_IS_WIN = vim.eval('s:is_win') == '1'
+
+class PlugError(Exception):
+ def __init__(self, msg):
+ self.msg = msg
+class CmdTimedOut(PlugError):
+ pass
+class CmdFailed(PlugError):
+ pass
+class InvalidURI(PlugError):
+ pass
+class Action(object):
+ INSTALL, UPDATE, ERROR, DONE = ['+', '*', 'x', '-']
+
+class Buffer(object):
+ def __init__(self, lock, num_plugs, is_pull):
+ self.bar = ''
+ self.event = 'Updating' if is_pull else 'Installing'
+ self.lock = lock
+ self.maxy = int(vim.eval('winheight(".")'))
+ self.num_plugs = num_plugs
+
+ def __where(self, name):
+ """ Find first line with name in current buffer. Return line num. """
+ found, lnum = False, 0
+ matcher = re.compile('^[-+x*] {0}:'.format(name))
+ for line in vim.current.buffer:
+ if matcher.search(line) is not None:
+ found = True
+ break
+ lnum += 1
+
+ if not found:
+ lnum = -1
+ return lnum
+
+ def header(self):
+ curbuf = vim.current.buffer
+ curbuf[0] = self.event + ' plugins ({0}/{1})'.format(len(self.bar), self.num_plugs)
+
+ num_spaces = self.num_plugs - len(self.bar)
+ curbuf[1] = '[{0}{1}]'.format(self.bar, num_spaces * ' ')
+
+ with self.lock:
+ vim.command('normal! 2G')
+ vim.command('redraw')
+
+ def write(self, action, name, lines):
+ first, rest = lines[0], lines[1:]
+ msg = ['{0} {1}{2}{3}'.format(action, name, ': ' if first else '', first)]
+ msg.extend([' ' + line for line in rest])
+
+ try:
+ if action == Action.ERROR:
+ self.bar += 'x'
+ vim.command("call add(s:update.errors, '{0}')".format(name))
+ elif action == Action.DONE:
+ self.bar += '='
+
+ curbuf = vim.current.buffer
+ lnum = self.__where(name)
+ if lnum != -1: # Found matching line num
+ del curbuf[lnum]
+ if lnum > self.maxy and action in set([Action.INSTALL, Action.UPDATE]):
+ lnum = 3
+ else:
+ lnum = 3
+ curbuf.append(msg, lnum)
+
+ self.header()
+ except vim.error:
+ pass
+
+class Command(object):
+ CD = 'cd /d' if G_IS_WIN else 'cd'
+
+ def __init__(self, cmd, cmd_dir=None, timeout=60, cb=None, clean=None):
+ self.cmd = cmd
+ if cmd_dir:
+ self.cmd = '{0} {1} && {2}'.format(Command.CD, cmd_dir, self.cmd)
+ self.timeout = timeout
+ self.callback = cb if cb else (lambda msg: None)
+ self.clean = clean if clean else (lambda: None)
+ self.proc = None
+
+ @property
+ def alive(self):
+ """ Returns true only if command still running. """
+ return self.proc and self.proc.poll() is None
+
+ def execute(self, ntries=3):
+ """ Execute the command with ntries if CmdTimedOut.
+ Returns the output of the command if no Exception.
+ """
+ attempt, finished, limit = 0, False, self.timeout
+
+ while not finished:
+ try:
+ attempt += 1
+ result = self.try_command()
+ finished = True
+ return result
+ except CmdTimedOut:
+ if attempt != ntries:
+ self.notify_retry()
+ self.timeout += limit
+ else:
+ raise
+
+ def notify_retry(self):
+ """ Retry required for command, notify user. """
+ for count in range(3, 0, -1):
+ if G_STOP.is_set():
+ raise KeyboardInterrupt
+ msg = 'Timeout. Will retry in {0} second{1} ...'.format(
+ count, 's' if count != 1 else '')
+ self.callback([msg])
+ time.sleep(1)
+ self.callback(['Retrying ...'])
+
+ def try_command(self):
+ """ Execute a cmd & poll for callback. Returns list of output.
+ Raises CmdFailed -> return code for Popen isn't 0
+ Raises CmdTimedOut -> command exceeded timeout without new output
+ """
+ first_line = True
+
+ try:
+ tfile = tempfile.NamedTemporaryFile(mode='w+b')
+ preexec_fn = not G_IS_WIN and os.setsid or None
+ self.proc = subprocess.Popen(self.cmd, stdout=tfile,
+ stderr=subprocess.STDOUT,
+ stdin=subprocess.PIPE, shell=True,
+ preexec_fn=preexec_fn)
+ thrd = thr.Thread(target=(lambda proc: proc.wait()), args=(self.proc,))
+ thrd.start()
+
+ thread_not_started = True
+ while thread_not_started:
+ try:
+ thrd.join(0.1)
+ thread_not_started = False
+ except RuntimeError:
+ pass
+
+ while self.alive:
+ if G_STOP.is_set():
+ raise KeyboardInterrupt
+
+ if first_line or random.random() < G_LOG_PROB:
+ first_line = False
+ line = '' if G_IS_WIN else nonblock_read(tfile.name)
+ if line:
+ self.callback([line])
+
+ time_diff = time.time() - os.path.getmtime(tfile.name)
+ if time_diff > self.timeout:
+ raise CmdTimedOut(['Timeout!'])
+
+ thrd.join(0.5)
+
+ tfile.seek(0)
+ result = [line.decode('utf-8', 'replace').rstrip() for line in tfile]
+
+ if self.proc.returncode != 0:
+ raise CmdFailed([''] + result)
+
+ return result
+ except:
+ self.terminate()
+ raise
+
+ def terminate(self):
+ """ Terminate process and cleanup. """
+ if self.alive:
+ if G_IS_WIN:
+ os.kill(self.proc.pid, signal.SIGINT)
+ else:
+ os.killpg(self.proc.pid, signal.SIGTERM)
+ self.clean()
+
+class Plugin(object):
+ def __init__(self, name, args, buf_q, lock):
+ self.name = name
+ self.args = args
+ self.buf_q = buf_q
+ self.lock = lock
+ self.tag = args.get('tag', 0)
+
+ def manage(self):
+ try:
+ if os.path.exists(self.args['dir']):
+ self.update()
+ else:
+ self.install()
+ with self.lock:
+ thread_vim_command("let s:update.new['{0}'] = 1".format(self.name))
+ except PlugError as exc:
+ self.write(Action.ERROR, self.name, exc.msg)
+ except KeyboardInterrupt:
+ G_STOP.set()
+ self.write(Action.ERROR, self.name, ['Interrupted!'])
+ except:
+ # Any exception except those above print stack trace
+ msg = 'Trace:\n{0}'.format(traceback.format_exc().rstrip())
+ self.write(Action.ERROR, self.name, msg.split('\n'))
+ raise
+
+ def install(self):
+ target = self.args['dir']
+ if target[-1] == '\\':
+ target = target[0:-1]
+
+ def clean(target):
+ def _clean():
+ try:
+ shutil.rmtree(target)
+ except OSError:
+ pass
+ return _clean
+
+ self.write(Action.INSTALL, self.name, ['Installing ...'])
+ callback = functools.partial(self.write, Action.INSTALL, self.name)
+ cmd = 'git clone {0} {1} {2} {3} 2>&1'.format(
+ '' if self.tag else G_CLONE_OPT, G_PROGRESS, self.args['uri'],
+ esc(target))
+ com = Command(cmd, None, G_TIMEOUT, callback, clean(target))
+ result = com.execute(G_RETRIES)
+ self.write(Action.DONE, self.name, result[-1:])
+
+ def repo_uri(self):
+ cmd = 'git rev-parse --abbrev-ref HEAD 2>&1 && git config -f .git/config remote.origin.url'
+ command = Command(cmd, self.args['dir'], G_TIMEOUT,)
+ result = command.execute(G_RETRIES)
+ return result[-1]
+
+ def update(self):
+ actual_uri = self.repo_uri()
+ expect_uri = self.args['uri']
+ regex = re.compile(r'^(?:\w+://)?(?:[^@/]*@)?([^:/]*(?::[0-9]*)?)[:/](.*?)(?:\.git)?/?$')
+ ma = regex.match(actual_uri)
+ mb = regex.match(expect_uri)
+ if ma is None or mb is None or ma.groups() != mb.groups():
+ msg = ['',
+ 'Invalid URI: {0}'.format(actual_uri),
+ 'Expected {0}'.format(expect_uri),
+ 'PlugClean required.']
+ raise InvalidURI(msg)
+
+ if G_PULL:
+ self.write(Action.UPDATE, self.name, ['Updating ...'])
+ callback = functools.partial(self.write, Action.UPDATE, self.name)
+ fetch_opt = '--depth 99999999' if self.tag and os.path.isfile(os.path.join(self.args['dir'], '.git/shallow')) else ''
+ cmd = 'git fetch {0} {1} 2>&1'.format(fetch_opt, G_PROGRESS)
+ com = Command(cmd, self.args['dir'], G_TIMEOUT, callback)
+ result = com.execute(G_RETRIES)
+ self.write(Action.DONE, self.name, result[-1:])
+ else:
+ self.write(Action.DONE, self.name, ['Already installed'])
+
+ def write(self, action, name, msg):
+ self.buf_q.put((action, name, msg))
+
+class PlugThread(thr.Thread):
+ def __init__(self, tname, args):
+ super(PlugThread, self).__init__()
+ self.tname = tname
+ self.args = args
+
+ def run(self):
+ thr.current_thread().name = self.tname
+ buf_q, work_q, lock = self.args
+
+ try:
+ while not G_STOP.is_set():
+ name, args = work_q.get_nowait()
+ plug = Plugin(name, args, buf_q, lock)
+ plug.manage()
+ work_q.task_done()
+ except queue.Empty:
+ pass
+
+class RefreshThread(thr.Thread):
+ def __init__(self, lock):
+ super(RefreshThread, self).__init__()
+ self.lock = lock
+ self.running = True
+
+ def run(self):
+ while self.running:
+ with self.lock:
+ thread_vim_command('noautocmd normal! a')
+ time.sleep(0.33)
+
+ def stop(self):
+ self.running = False
+
+if G_NVIM:
+ def thread_vim_command(cmd):
+ vim.session.threadsafe_call(lambda: vim.command(cmd))
+else:
+ def thread_vim_command(cmd):
+ vim.command(cmd)
+
+def esc(name):
+ return '"' + name.replace('"', '\"') + '"'
+
+def nonblock_read(fname):
+ """ Read a file with nonblock flag. Return the last line. """
+ fread = os.open(fname, os.O_RDONLY | os.O_NONBLOCK)
+ buf = os.read(fread, 100000).decode('utf-8', 'replace')
+ os.close(fread)
+
+ line = buf.rstrip('\r\n')
+ left = max(line.rfind('\r'), line.rfind('\n'))
+ if left != -1:
+ left += 1
+ line = line[left:]
+
+ return line
+
+def main():
+ thr.current_thread().name = 'main'
+ nthreads = int(vim.eval('s:update.threads'))
+ plugs = vim.eval('s:update.todo')
+ mac_gui = vim.eval('s:mac_gui') == '1'
+
+ lock = thr.Lock()
+ buf = Buffer(lock, len(plugs), G_PULL)
+ buf_q, work_q = queue.Queue(), queue.Queue()
+ for work in plugs.items():
+ work_q.put(work)
+
+ start_cnt = thr.active_count()
+ for num in range(nthreads):
+ tname = 'PlugT-{0:02}'.format(num)
+ thread = PlugThread(tname, (buf_q, work_q, lock))
+ thread.start()
+ if mac_gui:
+ rthread = RefreshThread(lock)
+ rthread.start()
+
+ while not buf_q.empty() or thr.active_count() != start_cnt:
+ try:
+ action, name, msg = buf_q.get(True, 0.25)
+ buf.write(action, name, ['OK'] if not msg else msg)
+ buf_q.task_done()
+ except queue.Empty:
+ pass
+ except KeyboardInterrupt:
+ G_STOP.set()
+
+ if mac_gui:
+ rthread.stop()
+ rthread.join()
+
+main()
+EOF
+endfunction
+
+function! s:update_ruby()
+ ruby << EOF
+ module PlugStream
+ SEP = ["\r", "\n", nil]
+ def get_line
+ buffer = ''
+ loop do
+ char = readchar rescue return
+ if SEP.include? char.chr
+ buffer << $/
+ break
+ else
+ buffer << char
+ end
+ end
+ buffer
+ end
+ end unless defined?(PlugStream)
+
+ def esc arg
+ %["#{arg.gsub('"', '\"')}"]
+ end
+
+ def killall pid
+ pids = [pid]
+ if /mswin|mingw|bccwin/ =~ RUBY_PLATFORM
+ pids.each { |pid| Process.kill 'INT', pid.to_i rescue nil }
+ else
+ unless `which pgrep 2> /dev/null`.empty?
+ children = pids
+ until children.empty?
+ children = children.map { |pid|
+ `pgrep -P #{pid}`.lines.map { |l| l.chomp }
+ }.flatten
+ pids += children
+ end
+ end
+ pids.each { |pid| Process.kill 'TERM', pid.to_i rescue nil }
+ end
+ end
+
+ def compare_git_uri a, b
+ regex = %r{^(?:\w+://)?(?:[^@/]*@)?([^:/]*(?::[0-9]*)?)[:/](.*?)(?:\.git)?/?$}
+ regex.match(a).to_a.drop(1) == regex.match(b).to_a.drop(1)
+ end
+
+ require 'thread'
+ require 'fileutils'
+ require 'timeout'
+ running = true
+ iswin = VIM::evaluate('s:is_win').to_i == 1
+ pull = VIM::evaluate('s:update.pull').to_i == 1
+ base = VIM::evaluate('g:plug_home')
+ all = VIM::evaluate('s:update.todo')
+ limit = VIM::evaluate('get(g:, "plug_timeout", 60)')
+ tries = VIM::evaluate('get(g:, "plug_retries", 2)') + 1
+ nthr = VIM::evaluate('s:update.threads').to_i
+ maxy = VIM::evaluate('winheight(".")').to_i
+ vim7 = VIM::evaluate('v:version').to_i <= 703 && RUBY_PLATFORM =~ /darwin/
+ cd = iswin ? 'cd /d' : 'cd'
+ tot = VIM::evaluate('len(s:update.todo)') || 0
+ bar = ''
+ skip = 'Already installed'
+ mtx = Mutex.new
+ take1 = proc { mtx.synchronize { running && all.shift } }
+ logh = proc {
+ cnt = bar.length
+ $curbuf[1] = "#{pull ? 'Updating' : 'Installing'} plugins (#{cnt}/#{tot})"
+ $curbuf[2] = '[' + bar.ljust(tot) + ']'
+ VIM::command('normal! 2G')
+ VIM::command('redraw')
+ }
+ where = proc { |name| (1..($curbuf.length)).find { |l| $curbuf[l] =~ /^[-+x*] #{name}:/ } }
+ log = proc { |name, result, type|
+ mtx.synchronize do
+ ing = ![true, false].include?(type)
+ bar += type ? '=' : 'x' unless ing
+ b = case type
+ when :install then '+' when :update then '*'
+ when true, nil then '-' else
+ VIM::command("call add(s:update.errors, '#{name}')")
+ 'x'
+ end
+ result =
+ if type || type.nil?
+ ["#{b} #{name}: #{result.lines.to_a.last || 'OK'}"]
+ elsif result =~ /^Interrupted|^Timeout/
+ ["#{b} #{name}: #{result}"]
+ else
+ ["#{b} #{name}"] + result.lines.map { |l| " " << l }
+ end
+ if lnum = where.call(name)
+ $curbuf.delete lnum
+ lnum = 4 if ing && lnum > maxy
+ end
+ result.each_with_index do |line, offset|
+ $curbuf.append((lnum || 4) - 1 + offset, line.gsub(/\e\[./, '').chomp)
+ end
+ logh.call
+ end
+ }
+ bt = proc { |cmd, name, type, cleanup|
+ tried = timeout = 0
+ begin
+ tried += 1
+ timeout += limit
+ fd = nil
+ data = ''
+ if iswin
+ Timeout::timeout(timeout) do
+ tmp = VIM::evaluate('tempname()')
+ system("(#{cmd}) > #{tmp}")
+ data = File.read(tmp).chomp
+ File.unlink tmp rescue nil
+ end
+ else
+ fd = IO.popen(cmd).extend(PlugStream)
+ first_line = true
+ log_prob = 1.0 / nthr
+ while line = Timeout::timeout(timeout) { fd.get_line }
+ data << line
+ log.call name, line.chomp, type if name && (first_line || rand < log_prob)
+ first_line = false
+ end
+ fd.close
+ end
+ [$? == 0, data.chomp]
+ rescue Timeout::Error, Interrupt => e
+ if fd && !fd.closed?
+ killall fd.pid
+ fd.close
+ end
+ cleanup.call if cleanup
+ if e.is_a?(Timeout::Error) && tried < tries
+ 3.downto(1) do |countdown|
+ s = countdown > 1 ? 's' : ''
+ log.call name, "Timeout. Will retry in #{countdown} second#{s} ...", type
+ sleep 1
+ end
+ log.call name, 'Retrying ...', type
+ retry
+ end
+ [false, e.is_a?(Interrupt) ? "Interrupted!" : "Timeout!"]
+ end
+ }
+ main = Thread.current
+ threads = []
+ watcher = Thread.new {
+ if vim7
+ while VIM::evaluate('getchar(1)')
+ sleep 0.1
+ end
+ else
+ require 'io/console' # >= Ruby 1.9
+ nil until IO.console.getch == 3.chr
+ end
+ mtx.synchronize do
+ running = false
+ threads.each { |t| t.raise Interrupt } unless vim7
+ end
+ threads.each { |t| t.join rescue nil }
+ main.kill
+ }
+ refresh = Thread.new {
+ while true
+ mtx.synchronize do
+ break unless running
+ VIM::command('noautocmd normal! a')
+ end
+ sleep 0.2
+ end
+ } if VIM::evaluate('s:mac_gui') == 1
+
+ clone_opt = VIM::evaluate('s:clone_opt').join(' ')
+ progress = VIM::evaluate('s:progress_opt(1)')
+ nthr.times do
+ mtx.synchronize do
+ threads << Thread.new {
+ while pair = take1.call
+ name = pair.first
+ dir, uri, tag = pair.last.values_at *%w[dir uri tag]
+ exists = File.directory? dir
+ ok, result =
+ if exists
+ chdir = "#{cd} #{iswin ? dir : esc(dir)}"
+ ret, data = bt.call "#{chdir} && git rev-parse --abbrev-ref HEAD 2>&1 && git config -f .git/config remote.origin.url", nil, nil, nil
+ current_uri = data.lines.to_a.last
+ if !ret
+ if data =~ /^Interrupted|^Timeout/
+ [false, data]
+ else
+ [false, [data.chomp, "PlugClean required."].join($/)]
+ end
+ elsif !compare_git_uri(current_uri, uri)
+ [false, ["Invalid URI: #{current_uri}",
+ "Expected: #{uri}",
+ "PlugClean required."].join($/)]
+ else
+ if pull
+ log.call name, 'Updating ...', :update
+ fetch_opt = (tag && File.exist?(File.join(dir, '.git/shallow'))) ? '--depth 99999999' : ''
+ bt.call "#{chdir} && git fetch #{fetch_opt} #{progress} 2>&1", name, :update, nil
+ else
+ [true, skip]
+ end
+ end
+ else
+ d = esc dir.sub(%r{[\\/]+$}, '')
+ log.call name, 'Installing ...', :install
+ bt.call "git clone #{clone_opt unless tag} #{progress} #{uri} #{d} 2>&1", name, :install, proc {
+ FileUtils.rm_rf dir
+ }
+ end
+ mtx.synchronize { VIM::command("let s:update.new['#{name}'] = 1") } if !exists && ok
+ log.call name, result, ok
+ end
+ } if running
+ end
+ end
+ threads.each { |t| t.join rescue nil }
+ logh.call
+ refresh.kill if refresh
+ watcher.kill
+EOF
+endfunction
+
+function! s:shellesc_cmd(arg, script)
+ let escaped = substitute('"'.a:arg.'"', '[&|<>()@^!"]', '^&', 'g')
+ return substitute(escaped, '%', (a:script ? '%' : '^') . '&', 'g')
+endfunction
+
+function! s:shellesc_ps1(arg)
+ return "'".substitute(escape(a:arg, '\"'), "'", "''", 'g')."'"
+endfunction
+
+function! s:shellesc_sh(arg)
+ return "'".substitute(a:arg, "'", "'\\\\''", 'g')."'"
+endfunction
+
+" Escape the shell argument based on the shell.
+" Vim and Neovim's shellescape() are insufficient.
+" 1. shellslash determines whether to use single/double quotes.
+" Double-quote escaping is fragile for cmd.exe.
+" 2. It does not work for powershell.
+" 3. It does not work for *sh shells if the command is executed
+" via cmd.exe (ie. cmd.exe /c sh -c command command_args)
+" 4. It does not support batchfile syntax.
+"
+" Accepts an optional dictionary with the following keys:
+" - shell: same as Vim/Neovim 'shell' option.
+" If unset, fallback to 'cmd.exe' on Windows or 'sh'.
+" - script: If truthy and shell is cmd.exe, escape for batchfile syntax.
+function! plug#shellescape(arg, ...)
+ if a:arg =~# '^[A-Za-z0-9_/:.-]\+$'
+ return a:arg
+ endif
+ let opts = a:0 > 0 && type(a:1) == s:TYPE.dict ? a:1 : {}
+ let shell = get(opts, 'shell', s:is_win ? 'cmd.exe' : 'sh')
+ let script = get(opts, 'script', 1)
+ if shell =~# 'cmd\(\.exe\)\?$'
+ return s:shellesc_cmd(a:arg, script)
+ elseif shell =~# 'powershell\(\.exe\)\?$' || shell =~# 'pwsh$'
+ return s:shellesc_ps1(a:arg)
+ endif
+ return s:shellesc_sh(a:arg)
+endfunction
+
+function! s:glob_dir(path)
+ return map(filter(s:glob(a:path, '**'), 'isdirectory(v:val)'), 's:dirpath(v:val)')
+endfunction
+
+function! s:progress_bar(line, bar, total)
+ call setline(a:line, '[' . s:lpad(a:bar, a:total) . ']')
+endfunction
+
+function! s:compare_git_uri(a, b)
+ " See `git help clone'
+ " https:// [user@] github.com[:port] / junegunn/vim-plug [.git]
+ " [git@] github.com[:port] : junegunn/vim-plug [.git]
+ " file:// / junegunn/vim-plug [/]
+ " / junegunn/vim-plug [/]
+ let pat = '^\%(\w\+://\)\='.'\%([^@/]*@\)\='.'\([^:/]*\%(:[0-9]*\)\=\)'.'[:/]'.'\(.\{-}\)'.'\%(\.git\)\=/\?$'
+ let ma = matchlist(a:a, pat)
+ let mb = matchlist(a:b, pat)
+ return ma[1:2] ==# mb[1:2]
+endfunction
+
+function! s:format_message(bullet, name, message)
+ if a:bullet != 'x'
+ return [printf('%s %s: %s', a:bullet, a:name, s:lastline(a:message))]
+ else
+ let lines = map(s:lines(a:message), '" ".v:val')
+ return extend([printf('x %s:', a:name)], lines)
+ endif
+endfunction
+
+function! s:with_cd(cmd, dir, ...)
+ let script = a:0 > 0 ? a:1 : 1
+ return printf('cd%s %s && %s', s:is_win ? ' /d' : '', plug#shellescape(a:dir, {'script': script}), a:cmd)
+endfunction
+
+function! s:system(cmd, ...)
+ let batchfile = ''
+ try
+ let [sh, shellcmdflag, shrd] = s:chsh(1)
+ if type(a:cmd) == s:TYPE.list
+ " Neovim's system() supports list argument to bypass the shell
+ " but it cannot set the working directory for the command.
+ " Assume that the command does not rely on the shell.
+ if has('nvim') && a:0 == 0
+ return system(a:cmd)
+ endif
+ let cmd = join(map(copy(a:cmd), 'plug#shellescape(v:val, {"shell": &shell, "script": 0})'))
+ if &shell =~# 'powershell\(\.exe\)\?$'
+ let cmd = '& ' . cmd
+ endif
+ else
+ let cmd = a:cmd
+ endif
+ if a:0 > 0
+ let cmd = s:with_cd(cmd, a:1, type(a:cmd) != s:TYPE.list)
+ endif
+ if s:is_win && type(a:cmd) != s:TYPE.list
+ let [batchfile, cmd] = s:batchfile(cmd)
+ endif
+ return system(cmd)
+ finally
+ let [&shell, &shellcmdflag, &shellredir] = [sh, shellcmdflag, shrd]
+ if s:is_win && filereadable(batchfile)
+ call delete(batchfile)
+ endif
+ endtry
+endfunction
+
+function! s:system_chomp(...)
+ let ret = call('s:system', a:000)
+ return v:shell_error ? '' : substitute(ret, '\n$', '', '')
+endfunction
+
+function! s:git_validate(spec, check_branch)
+ let err = ''
+ if isdirectory(a:spec.dir)
+ let result = [s:git_local_branch(a:spec.dir), s:git_origin_url(a:spec.dir)]
+ let remote = result[-1]
+ if empty(remote)
+ let err = join([remote, 'PlugClean required.'], "\n")
+ elseif !s:compare_git_uri(remote, a:spec.uri)
+ let err = join(['Invalid URI: '.remote,
+ \ 'Expected: '.a:spec.uri,
+ \ 'PlugClean required.'], "\n")
+ elseif a:check_branch && has_key(a:spec, 'commit')
+ let sha = s:git_revision(a:spec.dir)
+ if empty(sha)
+ let err = join(add(result, 'PlugClean required.'), "\n")
+ elseif !s:hash_match(sha, a:spec.commit)
+ let err = join([printf('Invalid HEAD (expected: %s, actual: %s)',
+ \ a:spec.commit[:6], sha[:6]),
+ \ 'PlugUpdate required.'], "\n")
+ endif
+ elseif a:check_branch
+ let current_branch = result[0]
+ " Check tag
+ let origin_branch = s:git_origin_branch(a:spec)
+ if has_key(a:spec, 'tag')
+ let tag = s:system_chomp('git describe --exact-match --tags HEAD 2>&1', a:spec.dir)
+ if a:spec.tag !=# tag && a:spec.tag !~ '\*'
+ let err = printf('Invalid tag: %s (expected: %s). Try PlugUpdate.',
+ \ (empty(tag) ? 'N/A' : tag), a:spec.tag)
+ endif
+ " Check branch
+ elseif origin_branch !=# current_branch
+ let err = printf('Invalid branch: %s (expected: %s). Try PlugUpdate.',
+ \ current_branch, origin_branch)
+ endif
+ if empty(err)
+ let [ahead, behind] = split(s:lastline(s:system([
+ \ 'git', 'rev-list', '--count', '--left-right',
+ \ printf('HEAD...origin/%s', origin_branch)
+ \ ], a:spec.dir)), '\t')
+ if !v:shell_error && ahead
+ if behind
+ " Only mention PlugClean if diverged, otherwise it's likely to be
+ " pushable (and probably not that messed up).
+ let err = printf(
+ \ "Diverged from origin/%s (%d commit(s) ahead and %d commit(s) behind!\n"
+ \ .'Backup local changes and run PlugClean and PlugUpdate to reinstall it.', origin_branch, ahead, behind)
+ else
+ let err = printf("Ahead of origin/%s by %d commit(s).\n"
+ \ .'Cannot update until local changes are pushed.',
+ \ origin_branch, ahead)
+ endif
+ endif
+ endif
+ endif
+ else
+ let err = 'Not found'
+ endif
+ return [err, err =~# 'PlugClean']
+endfunction
+
+function! s:rm_rf(dir)
+ if isdirectory(a:dir)
+ return s:system(s:is_win
+ \ ? 'rmdir /S /Q '.plug#shellescape(a:dir)
+ \ : ['rm', '-rf', a:dir])
+ endif
+endfunction
+
+function! s:clean(force)
+ call s:prepare()
+ call append(0, 'Searching for invalid plugins in '.g:plug_home)
+ call append(1, '')
+
+ " List of valid directories
+ let dirs = []
+ let errs = {}
+ let [cnt, total] = [0, len(g:plugs)]
+ for [name, spec] in items(g:plugs)
+ if !s:is_managed(name)
+ call add(dirs, spec.dir)
+ else
+ let [err, clean] = s:git_validate(spec, 1)
+ if clean
+ let errs[spec.dir] = s:lines(err)[0]
+ else
+ call add(dirs, spec.dir)
+ endif
+ endif
+ let cnt += 1
+ call s:progress_bar(2, repeat('=', cnt), total)
+ normal! 2G
+ redraw
+ endfor
+
+ let allowed = {}
+ for dir in dirs
+ let allowed[s:dirpath(s:plug_fnamemodify(dir, ':h:h'))] = 1
+ let allowed[dir] = 1
+ for child in s:glob_dir(dir)
+ let allowed[child] = 1
+ endfor
+ endfor
+
+ let todo = []
+ let found = sort(s:glob_dir(g:plug_home))
+ while !empty(found)
+ let f = remove(found, 0)
+ if !has_key(allowed, f) && isdirectory(f)
+ call add(todo, f)
+ call append(line('$'), '- ' . f)
+ if has_key(errs, f)
+ call append(line('$'), ' ' . errs[f])
+ endif
+ let found = filter(found, 'stridx(v:val, f) != 0')
+ end
+ endwhile
+
+ 4
+ redraw
+ if empty(todo)
+ call append(line('$'), 'Already clean.')
+ else
+ let s:clean_count = 0
+ call append(3, ['Directories to delete:', ''])
+ redraw!
+ if a:force || s:ask_no_interrupt('Delete all directories?')
+ call s:delete([6, line('$')], 1)
+ else
+ call setline(4, 'Cancelled.')
+ nnoremap d :set opfunc=delete_opg@
+ nmap dd d_
+ xnoremap d :call delete_op(visualmode(), 1)
+ echo 'Delete the lines (d{motion}) to delete the corresponding directories'
+ endif
+ endif
+ 4
+ setlocal nomodifiable
+endfunction
+
+function! s:delete_op(type, ...)
+ call s:delete(a:0 ? [line("'<"), line("'>")] : [line("'["), line("']")], 0)
+endfunction
+
+function! s:delete(range, force)
+ let [l1, l2] = a:range
+ let force = a:force
+ let err_count = 0
+ while l1 <= l2
+ let line = getline(l1)
+ if line =~ '^- ' && isdirectory(line[2:])
+ execute l1
+ redraw!
+ let answer = force ? 1 : s:ask('Delete '.line[2:].'?', 1)
+ let force = force || answer > 1
+ if answer
+ let err = s:rm_rf(line[2:])
+ setlocal modifiable
+ if empty(err)
+ call setline(l1, '~'.line[1:])
+ let s:clean_count += 1
+ else
+ delete _
+ call append(l1 - 1, s:format_message('x', line[1:], err))
+ let l2 += len(s:lines(err))
+ let err_count += 1
+ endif
+ let msg = printf('Removed %d directories.', s:clean_count)
+ if err_count > 0
+ let msg .= printf(' Failed to remove %d directories.', err_count)
+ endif
+ call setline(4, msg)
+ setlocal nomodifiable
+ endif
+ endif
+ let l1 += 1
+ endwhile
+endfunction
+
+function! s:upgrade()
+ echo 'Downloading the latest version of vim-plug'
+ redraw
+ let tmp = s:plug_tempname()
+ let new = tmp . '/plug.vim'
+
+ try
+ let out = s:system(['git', 'clone', '--depth', '1', s:plug_src, tmp])
+ if v:shell_error
+ return s:err('Error upgrading vim-plug: '. out)
+ endif
+
+ if readfile(s:me) ==# readfile(new)
+ echo 'vim-plug is already up-to-date'
+ return 0
+ else
+ call rename(s:me, s:me . '.old')
+ call rename(new, s:me)
+ unlet g:loaded_plug
+ echo 'vim-plug has been upgraded'
+ return 1
+ endif
+ finally
+ silent! call s:rm_rf(tmp)
+ endtry
+endfunction
+
+function! s:upgrade_specs()
+ for spec in values(g:plugs)
+ let spec.frozen = get(spec, 'frozen', 0)
+ endfor
+endfunction
+
+function! s:status()
+ call s:prepare()
+ call append(0, 'Checking plugins')
+ call append(1, '')
+
+ let ecnt = 0
+ let unloaded = 0
+ let [cnt, total] = [0, len(g:plugs)]
+ for [name, spec] in items(g:plugs)
+ let is_dir = isdirectory(spec.dir)
+ if has_key(spec, 'uri')
+ if is_dir
+ let [err, _] = s:git_validate(spec, 1)
+ let [valid, msg] = [empty(err), empty(err) ? 'OK' : err]
+ else
+ let [valid, msg] = [0, 'Not found. Try PlugInstall.']
+ endif
+ else
+ if is_dir
+ let [valid, msg] = [1, 'OK']
+ else
+ let [valid, msg] = [0, 'Not found.']
+ endif
+ endif
+ let cnt += 1
+ let ecnt += !valid
+ " `s:loaded` entry can be missing if PlugUpgraded
+ if is_dir && get(s:loaded, name, -1) == 0
+ let unloaded = 1
+ let msg .= ' (not loaded)'
+ endif
+ call s:progress_bar(2, repeat('=', cnt), total)
+ call append(3, s:format_message(valid ? '-' : 'x', name, msg))
+ normal! 2G
+ redraw
+ endfor
+ call setline(1, 'Finished. '.ecnt.' error(s).')
+ normal! gg
+ setlocal nomodifiable
+ if unloaded
+ echo "Press 'L' on each line to load plugin, or 'U' to update"
+ nnoremap L :call status_load(line('.'))
+ xnoremap L :call status_load(line('.'))
+ end
+endfunction
+
+function! s:extract_name(str, prefix, suffix)
+ return matchstr(a:str, '^'.a:prefix.' \zs[^:]\+\ze:.*'.a:suffix.'$')
+endfunction
+
+function! s:status_load(lnum)
+ let line = getline(a:lnum)
+ let name = s:extract_name(line, '-', '(not loaded)')
+ if !empty(name)
+ call plug#load(name)
+ setlocal modifiable
+ call setline(a:lnum, substitute(line, ' (not loaded)$', '', ''))
+ setlocal nomodifiable
+ endif
+endfunction
+
+function! s:status_update() range
+ let lines = getline(a:firstline, a:lastline)
+ let names = filter(map(lines, 's:extract_name(v:val, "[x-]", "")'), '!empty(v:val)')
+ if !empty(names)
+ echo
+ execute 'PlugUpdate' join(names)
+ endif
+endfunction
+
+function! s:is_preview_window_open()
+ silent! wincmd P
+ if &previewwindow
+ wincmd p
+ return 1
+ endif
+endfunction
+
+function! s:find_name(lnum)
+ for lnum in reverse(range(1, a:lnum))
+ let line = getline(lnum)
+ if empty(line)
+ return ''
+ endif
+ let name = s:extract_name(line, '-', '')
+ if !empty(name)
+ return name
+ endif
+ endfor
+ return ''
+endfunction
+
+function! s:preview_commit()
+ if b:plug_preview < 0
+ let b:plug_preview = !s:is_preview_window_open()
+ endif
+
+ let sha = matchstr(getline('.'), '^ \X*\zs[0-9a-f]\{7,9}')
+ if empty(sha)
+ return
+ endif
+
+ let name = s:find_name(line('.'))
+ if empty(name) || !has_key(g:plugs, name) || !isdirectory(g:plugs[name].dir)
+ return
+ endif
+
+ if exists('g:plug_pwindow') && !s:is_preview_window_open()
+ execute g:plug_pwindow
+ execute 'e' sha
+ else
+ execute 'pedit' sha
+ wincmd P
+ endif
+ setlocal previewwindow filetype=git buftype=nofile nobuflisted modifiable
+ let batchfile = ''
+ try
+ let [sh, shellcmdflag, shrd] = s:chsh(1)
+ let cmd = 'cd '.plug#shellescape(g:plugs[name].dir).' && git show --no-color --pretty=medium '.sha
+ if s:is_win
+ let [batchfile, cmd] = s:batchfile(cmd)
+ endif
+ execute 'silent %!' cmd
+ finally
+ let [&shell, &shellcmdflag, &shellredir] = [sh, shellcmdflag, shrd]
+ if s:is_win && filereadable(batchfile)
+ call delete(batchfile)
+ endif
+ endtry
+ setlocal nomodifiable
+ nnoremap q :q
+ wincmd p
+endfunction
+
+function! s:section(flags)
+ call search('\(^[x-] \)\@<=[^:]\+:', a:flags)
+endfunction
+
+function! s:format_git_log(line)
+ let indent = ' '
+ let tokens = split(a:line, nr2char(1))
+ if len(tokens) != 5
+ return indent.substitute(a:line, '\s*$', '', '')
+ endif
+ let [graph, sha, refs, subject, date] = tokens
+ let tag = matchstr(refs, 'tag: [^,)]\+')
+ let tag = empty(tag) ? ' ' : ' ('.tag.') '
+ return printf('%s%s%s%s%s (%s)', indent, graph, sha, tag, subject, date)
+endfunction
+
+function! s:append_ul(lnum, text)
+ call append(a:lnum, ['', a:text, repeat('-', len(a:text))])
+endfunction
+
+function! s:diff()
+ call s:prepare()
+ call append(0, ['Collecting changes ...', ''])
+ let cnts = [0, 0]
+ let bar = ''
+ let total = filter(copy(g:plugs), 's:is_managed(v:key) && isdirectory(v:val.dir)')
+ call s:progress_bar(2, bar, len(total))
+ for origin in [1, 0]
+ let plugs = reverse(sort(items(filter(copy(total), (origin ? '' : '!').'(has_key(v:val, "commit") || has_key(v:val, "tag"))'))))
+ if empty(plugs)
+ continue
+ endif
+ call s:append_ul(2, origin ? 'Pending updates:' : 'Last update:')
+ for [k, v] in plugs
+ let branch = s:git_origin_branch(v)
+ if len(branch)
+ let range = origin ? '..origin/'.branch : 'HEAD@{1}..'
+ let cmd = ['git', 'log', '--graph', '--color=never']
+ if s:git_version_requirement(2, 10, 0)
+ call add(cmd, '--no-show-signature')
+ endif
+ call extend(cmd, ['--pretty=format:%x01%h%x01%d%x01%s%x01%cr', range])
+ if has_key(v, 'rtp')
+ call extend(cmd, ['--', v.rtp])
+ endif
+ let diff = s:system_chomp(cmd, v.dir)
+ if !empty(diff)
+ let ref = has_key(v, 'tag') ? (' (tag: '.v.tag.')') : has_key(v, 'commit') ? (' '.v.commit) : ''
+ call append(5, extend(['', '- '.k.':'.ref], map(s:lines(diff), 's:format_git_log(v:val)')))
+ let cnts[origin] += 1
+ endif
+ endif
+ let bar .= '='
+ call s:progress_bar(2, bar, len(total))
+ normal! 2G
+ redraw
+ endfor
+ if !cnts[origin]
+ call append(5, ['', 'N/A'])
+ endif
+ endfor
+ call setline(1, printf('%d plugin(s) updated.', cnts[0])
+ \ . (cnts[1] ? printf(' %d plugin(s) have pending updates.', cnts[1]) : ''))
+
+ if cnts[0] || cnts[1]
+ nnoremap (plug-preview) :silent! call preview_commit()
+ if empty(maparg("\", 'n'))
+ nmap (plug-preview)
+ endif
+ if empty(maparg('o', 'n'))
+ nmap o (plug-preview)
+ endif
+ endif
+ if cnts[0]
+ nnoremap X :call revert()
+ echo "Press 'X' on each block to revert the update"
+ endif
+ normal! gg
+ setlocal nomodifiable
+endfunction
+
+function! s:revert()
+ if search('^Pending updates', 'bnW')
+ return
+ endif
+
+ let name = s:find_name(line('.'))
+ if empty(name) || !has_key(g:plugs, name) ||
+ \ input(printf('Revert the update of %s? (y/N) ', name)) !~? '^y'
+ return
+ endif
+
+ call s:system('git reset --hard HEAD@{1} && git checkout '.plug#shellescape(g:plugs[name].branch).' --', g:plugs[name].dir)
+ setlocal modifiable
+ normal! "_dap
+ setlocal nomodifiable
+ echo 'Reverted'
+endfunction
+
+function! s:snapshot(force, ...) abort
+ call s:prepare()
+ setf vim
+ call append(0, ['" Generated by vim-plug',
+ \ '" '.strftime("%c"),
+ \ '" :source this file in vim to restore the snapshot',
+ \ '" or execute: vim -S snapshot.vim',
+ \ '', '', 'PlugUpdate!'])
+ 1
+ let anchor = line('$') - 3
+ let names = sort(keys(filter(copy(g:plugs),
+ \'has_key(v:val, "uri") && !has_key(v:val, "commit") && isdirectory(v:val.dir)')))
+ for name in reverse(names)
+ let sha = s:git_revision(g:plugs[name].dir)
+ if !empty(sha)
+ call append(anchor, printf("silent! let g:plugs['%s'].commit = '%s'", name, sha))
+ redraw
+ endif
+ endfor
+
+ if a:0 > 0
+ let fn = s:plug_expand(a:1)
+ if filereadable(fn) && !(a:force || s:ask(a:1.' already exists. Overwrite?'))
+ return
+ endif
+ call writefile(getline(1, '$'), fn)
+ echo 'Saved as '.a:1
+ silent execute 'e' s:esc(fn)
+ setf vim
+ endif
+endfunction
+
+function! s:split_rtp()
+ return split(&rtp, '\\\@ :NERDTreeToggle
+nmap :wrap
+vmap NERDCommenterToggle
+nmap NERDCommenterToggle
+" Spellchecking and switch to spanish
+map :setlocal spell! spelllang=es
+map :set spelllang=es
+" Turn on Goyo for readibility and writing
+nmap :Goyo
+
+inoremap pumvisible() ? "\" : "\"
+inoremap pumvisible() ? "\" : "\"
+" Map control - backspace to delete work in insert mode
+inoremap dB
+inoremap db
+
+vnoremap "+y
+map "+P
+
+"Markdown configuration
+augroup MarkdownConfiguration
+ autocmd BufNewFile,BufRead *.md set linebreak breakindent wrap
+ autocmd BufNewFile,BufRead *.md nnoremap j gj
+ autocmd BufNewFile,BufRead *.md nnoremap k gk
+ "autocmd BufNewFile,BufRead *.md Goyo
+augroup END
+
+
+let g:lightline = {
+ \ 'colorscheme': 'nord',
+ \ }
+nmap gh :diffget //3
+nmap gu :diffget //2
+nmap gs :G
diff --git a/stow_home/nvim/.config/nvim/spell/en.utf-8.add b/stow_home/nvim/.config/nvim/spell/en.utf-8.add
new file mode 100644
index 0000000..c04c131
--- /dev/null
+++ b/stow_home/nvim/.config/nvim/spell/en.utf-8.add
@@ -0,0 +1,2 @@
+#log
+blog
diff --git a/stow_home/nvim/.config/nvim/spell/en.utf-8.add.spl b/stow_home/nvim/.config/nvim/spell/en.utf-8.add.spl
new file mode 100644
index 0000000..ec89f96
Binary files /dev/null and b/stow_home/nvim/.config/nvim/spell/en.utf-8.add.spl differ
diff --git a/stow_home/nvim/.config/nvim/spell/es.utf-8.spl b/stow_home/nvim/.config/nvim/spell/es.utf-8.spl
new file mode 100644
index 0000000..62d848d
Binary files /dev/null and b/stow_home/nvim/.config/nvim/spell/es.utf-8.spl differ
diff --git a/stow_home/nvim/.config/nvim/spell/es.utf-8.sug b/stow_home/nvim/.config/nvim/spell/es.utf-8.sug
new file mode 100644
index 0000000..9064321
Binary files /dev/null and b/stow_home/nvim/.config/nvim/spell/es.utf-8.sug differ
diff --git a/stow_home/nvim/.config/nvim/vim-plug/plugins.vim b/stow_home/nvim/.config/nvim/vim-plug/plugins.vim
new file mode 100644
index 0000000..93d638d
--- /dev/null
+++ b/stow_home/nvim/.config/nvim/vim-plug/plugins.vim
@@ -0,0 +1,43 @@
+" auto-install vim-plug
+if empty(glob('~/.config/nvim/autoload/plug.vim'))
+ silent !curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs
+ \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
+ "autocmd VimEnter * PlugInstall
+ "autocmd VimEnter * PlugInstall | source $MYVIMRC
+endif
+
+call plug#begin('~/.config/nvim/autoload/plugged')
+
+ " Better Syntax Support
+ Plug 'sheerun/vim-polyglot'
+ " File Explorer
+ Plug 'scrooloose/NERDTree'
+ " Auto pairs for '(' '[' '{'
+ Plug 'jiangmiao/auto-pairs'
+ Plug 'rwxrob/vim-pandoc-syntax-simple'
+ Plug 'arcticicestudio/nord-vim'
+ "Plug 'itchyny/lightline.vim'
+ "Plug 'vifm/vifm.vim'
+ Plug 'tpope/vim-fugitive'
+ "Plug 'vim-scripts/AutoComplPop'
+ Plug 'junegunn/goyo.vim'
+ Plug 'junegunn/limelight.vim'
+ Plug 'godlygeek/tabular'
+ Plug 'joshdick/onedark.vim'
+ Plug 'romgrk/doom-one.vim'
+ Plug 'jremmen/vim-ripgrep'
+ Plug 'kien/ctrlp.vim'
+ Plug 'dhruvasagar/vim-table-mode'
+ "Plug 'ycm-core/YouCompleteMe'
+ Plug 'neoclide/coc.nvim', {'branch': 'release'}
+
+ Plug 'gruvbox-community/gruvbox'
+ Plug 'sickill/vim-monokai'
+ Plug 'habamax/vim-godot'
+ Plug 'scrooloose/nerdcommenter'
+ "Starting to learn go
+ Plug 'fatih/vim-go'
+ Plug 'masukomi/vim-markdown-folding'
+ Plug 'vim-airline/vim-airline'
+ Plug 'vim-airline/vim-airline-themes'
+call plug#end()
diff --git a/stow_home/picom/.config/picom/picom.conf b/stow_home/picom/.config/picom/picom.conf
new file mode 100644
index 0000000..86b1bd8
--- /dev/null
+++ b/stow_home/picom/.config/picom/picom.conf
@@ -0,0 +1,521 @@
+#################################
+# Animations #
+#################################
+# requires https://github.com/jonaburg/picom
+# (These are also the default values)
+ transition-length = 400
+ transition-pow-x = 0.1
+ transition-pow-y = 0.1
+ transition-pow-w = 0.1
+ transition-pow-h = 0.1
+ size-transition = true
+
+
+#################################
+# Corners #
+#################################
+# requires: https://github.com/sdhand/compton or https://github.com/jonaburg/picom
+corner-radius = 0;
+rounded-corners-exclude = [
+ #"window_type = 'normal'",
+ "class_g = 'awesome'",
+ "class_g = 'trayer'",
+ "class_g = 'URxvt'",
+ "class_g = 'Bar'",
+ "class_g = 'Panel'",
+ "class_g = 'XTerm'",
+ "class_g = 'spectrwm'",
+ "class_g = 'Polybar'",
+ "class_g = 'code-oss'",
+ "class_g = 'Thunderbird'"
+ #"class_g = 'TelegramDesktop'",
+ #"class_g = 'Alacritty'",
+ #"class_g = 'firefox'",
+];
+round-borders = 0;
+round-borders-exclude = [
+ #"class_g = 'TelegramDesktop'",
+];
+
+#################################
+# Shadows #
+#################################
+
+
+# Enabled client-side shadows on windows. Note desktop windows
+# (windows with '_NET_WM_WINDOW_TYPE_DESKTOP') never get shadow,
+# unless explicitly requested using the wintypes option.
+#
+shadow = false
+## shadow = true;
+
+# The blur radius for shadows, in pixels. (defaults to 12)
+# shadow-radius = 12
+shadow-radius = 12;
+
+# The opacity of shadows. (0.0 - 1.0, defaults to 0.75)
+# shadow-opacity = .75
+
+# The left offset for shadows, in pixels. (defaults to -15)
+# shadow-offset-x = -15
+shadow-offset-x = -5;
+
+# The top offset for shadows, in pixels. (defaults to -15)
+# shadow-offset-y = -15
+shadow-offset-y = -5;
+
+# Avoid drawing shadows on dock/panel windows. This option is deprecated,
+# you should use the *wintypes* option in your config file instead.
+#
+# no-dock-shadow = false
+
+# Don't draw shadows on drag-and-drop windows. This option is deprecated,
+# you should use the *wintypes* option in your config file instead.
+#
+# no-dnd-shadow = false
+
+# Red color value of shadow (0.0 - 1.0, defaults to 0).
+# shadow-red = 0
+
+# Green color value of shadow (0.0 - 1.0, defaults to 0).
+# shadow-green = 0
+
+# Blue color value of shadow (0.0 - 1.0, defaults to 0).
+# shadow-blue = 0
+
+# Do not paint shadows on shaped windows. Note shaped windows
+# here means windows setting its shape through X Shape extension.
+# Those using ARGB background is beyond our control.
+# Deprecated, use
+# shadow-exclude = 'bounding_shaped'
+# or
+# shadow-exclude = 'bounding_shaped && !rounded_corners'
+# instead.
+#
+# shadow-ignore-shaped = ''
+
+# Specify a list of conditions of windows that should have no shadow.
+#
+# examples:
+# shadow-exclude = "n:e:Notification";
+#
+shadow-exclude = [
+ "name = 'Notification'",
+ "class_g = 'Conky'",
+ "class_g ?= 'Notify-osd'",
+ "class_g = 'Cairo-clock'",
+ "class_g = 'obs'",
+ "class_g = 'trayer'",
+ "_GTK_FRAME_EXTENTS@:c"
+];
+# Specify a X geometry that describes the region in which shadow should not
+# be painted in, such as a dock window region. Use
+# shadow-exclude-reg = "x10+0+0"
+# for example, if the 10 pixels on the bottom of the screen should not have shadows painted on.
+#
+# shadow-exclude-reg = ""
+
+# Crop shadow of a window fully on a particular Xinerama screen to the screen.
+# xinerama-shadow-crop = false
+
+
+#################################
+# Fading #
+#################################
+
+
+# Fade windows in/out when opening/closing and when opacity changes,
+# unless no-fading-openclose is used.
+fading = true
+#fading = true;
+
+# Opacity change between steps while fading in. (0.01 - 1.0, defaults to 0.028)
+# fade-in-step = 0.028
+fade-in-step = 0.03;
+
+# Opacity change between steps while fading out. (0.01 - 1.0, defaults to 0.03)
+# fade-out-step = 0.03
+fade-out-step = 0.03;
+
+# The time between steps in fade step, in milliseconds. (> 0, defaults to 10)
+fade-delta = 4
+
+# Specify a list of conditions of windows that should not be faded.
+# don't need this, we disable fading for all normal windows with wintypes: {}
+fade-exclude = [
+ "class_g = 'slop'", # maim
+]
+
+# Do not fade on window open/close.
+# no-fading-openclose = false
+
+# Do not fade destroyed ARGB windows with WM frame. Workaround of bugs in Openbox, Fluxbox, etc.
+# no-fading-destroyed-argb = false
+
+
+#################################
+# Transparency / Opacity #
+#################################
+
+
+# Opacity of inactive windows. (0.1 - 1.0, defaults to 1.0)
+# inactive-opacity = 1
+inactive-opacity = 0.7;
+
+# Opacity of window titlebars and borders. (0.1 - 1.0, disabled by default)
+# frame-opacity = 1.0
+#frame-opacity = 0.7;
+
+# Default opacity for dropdown menus and popup menus. (0.0 - 1.0, defaults to 1.0)
+# menu-opacity = 1.0
+# menu-opacity is depreciated use dropdown-menu and popup-menu instead.
+
+#If using these 2 below change their values in line 510 & 511 aswell
+popup_menu = { opacity = 0.8; }
+dropdown_menu = { opacity = 0.8; }
+
+
+# Let inactive opacity set by -i override the '_NET_WM_OPACITY' values of windows.
+# inactive-opacity-override = true
+inactive-opacity-override = false;
+
+# Default opacity for active windows. (0.0 - 1.0, defaults to 1.0)
+active-opacity = 1.0;
+
+# Dim inactive windows. (0.0 - 1.0, defaults to 0.0)
+# inactive-dim = 0.0
+
+# Specify a list of conditions of windows that should always be considered focused.
+# focus-exclude = []
+focus-exclude = [
+ "class_g = 'Cairo-clock'",
+ "class_g = 'Bar'", # lemonbar
+ "class_g = 'slop'" # maim
+];
+
+# Use fixed inactive dim value, instead of adjusting according to window opacity.
+# inactive-dim-fixed = 1.0
+
+# Specify a list of opacity rules, in the format `PERCENT:PATTERN`,
+# like `50:name *= "Firefox"`. picom-trans is recommended over this.
+# Note we don't make any guarantee about possible conflicts with other
+# programs that set '_NET_WM_WINDOW_OPACITY' on frame or client windows.
+# example:
+# opacity-rule = [ "80:class_g = 'URxvt'" ];
+#
+# opacity-rule = []
+opacity-rule = [
+ "100:class_g = 'Godot'",
+ "100:class_g = 'Emacs'",
+ "80:class_g = 'Bar'", # lemonbar
+ "100:class_g = 'libreoffice-writer'",
+ "100:class_g = 'slop'", # maim
+ "100:class_g = 'XTerm'",
+ "100:class_g = 'URxvt'",
+ "100:class_g = 'kitty'",
+ "100:class_g = 'Alacritty'",
+ "80:class_g = 'Polybar'",
+ "100:class_g = 'code-oss'",
+ "100:class_g = 'Meld'",
+ "90:class_g = 'Joplin'",
+ "100:class_g = 'firefox'",
+ "100:class_g = 'mpv'",
+ "100:class_g = 'vlc'",
+ "100:class_g = 'Thunderbird'",
+ "80:class_g = 'URxvt'",
+ "100:class_g = 'Firefox'",
+ "100:class_g = 'Gimp-2.10'",
+ "100:class_g = 'discord'",
+ "100:class_g = 'Brave-browser'",
+ "100:class_g = 'obs'",
+ "100:class_g = 'TelegramDesktop'",
+ "100:class_g = 'trayer'",
+];
+
+
+#################################
+# Background-Blurring #
+#################################
+
+
+# Parameters for background blurring, see the *BLUR* section for more information.
+# blur-method = dual-kawase
+# blur-size = 7
+#
+# blur-deviation = false
+
+# Blur background of semi-transparent / ARGB windows.
+# Bad in performance, with driver-dependent behavior.
+# The name of the switch may change without prior notifications.
+#
+# blur-background = true;
+
+# Blur background of windows when the window frame is not opaque.
+# Implies:
+# blur-background
+# Bad in performance, with driver-dependent behavior. The name may change.
+#
+# blur-background-frame = false;
+
+
+# Use fixed blur strength rather than adjusting according to window opacity.
+# blur-background-fixed = false;
+
+
+# Specify the blur convolution kernel, with the following format:
+# example:
+# blur-kern = "5,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1";
+#
+# blur-kern = ''
+# blur-kern = "3x3box";
+
+blur: {
+ # requires: https://github.com/ibhagwan/picom
+ method = "kawase";
+ #method = "kernel";
+ strength = 5;
+ # deviation = 1.0;
+ # kernel = "11x11gaussian";
+ background = false;
+ background-frame = false;
+ background-fixed = false;
+ kern = "3x3box";
+}
+
+# Exclude conditions for background blur.
+blur-background-exclude = [
+ #"window_type = 'dock'",
+ #"window_type = 'desktop'",
+ #"class_g = 'URxvt'",
+ #
+ # prevents picom from blurring the background
+ # when taking selection screenshot with `main`
+ # https://github.com/naelstrof/maim/issues/130
+ "class_g = 'slop'",
+ "_GTK_FRAME_EXTENTS@:c"
+];
+
+
+#################################
+# General Settings #
+#################################
+
+# Daemonize process. Fork to background after initialization. Causes issues with certain (badly-written) drivers.
+# daemon = false
+
+# Specify the backend to use: `xrender`, `glx`, or `xr_glx_hybrid`.
+# `xrender` is the default one.
+#
+experimental-backends = true;
+backend = "glx";
+#backend = "xrender";
+
+
+# Enable/disable VSync.
+# vsync = false
+vsync = true
+
+# Enable remote control via D-Bus. See the *D-BUS API* section below for more details.
+# dbus = false
+
+# Try to detect WM windows (a non-override-redirect window with no
+# child that has 'WM_STATE') and mark them as active.
+#
+# mark-wmwin-focused = false
+mark-wmwin-focused = true;
+
+# Mark override-redirect windows that doesn't have a child window with 'WM_STATE' focused.
+# mark-ovredir-focused = false
+mark-ovredir-focused = true;
+
+# Try to detect windows with rounded corners and don't consider them
+# shaped windows. The accuracy is not very high, unfortunately.
+#
+# detect-rounded-corners = false
+detect-rounded-corners = true;
+
+# Detect '_NET_WM_OPACITY' on client windows, useful for window managers
+# not passing '_NET_WM_OPACITY' of client windows to frame windows.
+#
+# detect-client-opacity = false
+detect-client-opacity = true;
+
+# Specify refresh rate of the screen. If not specified or 0, picom will
+# try detecting this with X RandR extension.
+#
+# refresh-rate = 60
+refresh-rate = 0
+
+# Limit picom to repaint at most once every 1 / 'refresh_rate' second to
+# boost performance. This should not be used with
+# vsync drm/opengl/opengl-oml
+# as they essentially does sw-opti's job already,
+# unless you wish to specify a lower refresh rate than the actual value.
+#
+# sw-opti =
+
+# Use EWMH '_NET_ACTIVE_WINDOW' to determine currently focused window,
+# rather than listening to 'FocusIn'/'FocusOut' event. Might have more accuracy,
+# provided that the WM supports it.
+#
+# use-ewmh-active-win = false
+
+# Unredirect all windows if a full-screen opaque window is detected,
+# to maximize performance for full-screen windows. Known to cause flickering
+# when redirecting/unredirecting windows. paint-on-overlay may make the flickering less obvious.
+#
+# unredir-if-possible = false
+
+# Delay before unredirecting the window, in milliseconds. Defaults to 0.
+# unredir-if-possible-delay = 0
+
+# Conditions of windows that shouldn't be considered full-screen for unredirecting screen.
+# unredir-if-possible-exclude = []
+
+# Use 'WM_TRANSIENT_FOR' to group windows, and consider windows
+# in the same group focused at the same time.
+#
+# detect-transient = false
+detect-transient = true
+
+# Use 'WM_CLIENT_LEADER' to group windows, and consider windows in the same
+# group focused at the same time. 'WM_TRANSIENT_FOR' has higher priority if
+# detect-transient is enabled, too.
+#
+# detect-client-leader = false
+detect-client-leader = true
+
+# Resize damaged region by a specific number of pixels.
+# A positive value enlarges it while a negative one shrinks it.
+# If the value is positive, those additional pixels will not be actually painted
+# to screen, only used in blur calculation, and such. (Due to technical limitations,
+# with use-damage, those pixels will still be incorrectly painted to screen.)
+# Primarily used to fix the line corruption issues of blur,
+# in which case you should use the blur radius value here
+# (e.g. with a 3x3 kernel, you should use `--resize-damage 1`,
+# with a 5x5 one you use `--resize-damage 2`, and so on).
+# May or may not work with *--glx-no-stencil*. Shrinking doesn't function correctly.
+#
+# resize-damage = 1
+
+# Specify a list of conditions of windows that should be painted with inverted color.
+# Resource-hogging, and is not well tested.
+#
+# invert-color-include = []
+
+# GLX backend: Avoid using stencil buffer, useful if you don't have a stencil buffer.
+# Might cause incorrect opacity when rendering transparent content (but never
+# practically happened) and may not work with blur-background.
+# My tests show a 15% performance boost. Recommended.
+#
+# glx-no-stencil = false
+
+# GLX backend: Avoid rebinding pixmap on window damage.
+# Probably could improve performance on rapid window content changes,
+# but is known to break things on some drivers (LLVMpipe, xf86-video-intel, etc.).
+# Recommended if it works.
+#
+# glx-no-rebind-pixmap = false
+
+# Disable the use of damage information.
+# This cause the whole screen to be redrawn everytime, instead of the part of the screen
+# has actually changed. Potentially degrades the performance, but might fix some artifacts.
+# The opposing option is use-damage
+#
+# no-use-damage = false
+#use-damage = true (Causing Weird Black semi opaque rectangles when terminal is opened)
+#Changing use-damage to false fixes the problem
+use-damage = false
+
+# Use X Sync fence to sync clients' draw calls, to make sure all draw
+# calls are finished before picom starts drawing. Needed on nvidia-drivers
+# with GLX backend for some users.
+#
+# xrender-sync-fence = false
+
+# GLX backend: Use specified GLSL fragment shader for rendering window contents.
+# See `compton-default-fshader-win.glsl` and `compton-fake-transparency-fshader-win.glsl`
+# in the source tree for examples.
+#
+# glx-fshader-win = ''
+
+# Force all windows to be painted with blending. Useful if you
+# have a glx-fshader-win that could turn opaque pixels transparent.
+#
+# force-win-blend = false
+
+# Do not use EWMH to detect fullscreen windows.
+# Reverts to checking if a window is fullscreen based only on its size and coordinates.
+#
+# no-ewmh-fullscreen = false
+
+# Dimming bright windows so their brightness doesn't exceed this set value.
+# Brightness of a window is estimated by averaging all pixels in the window,
+# so this could comes with a performance hit.
+# Setting this to 1.0 disables this behaviour. Requires --use-damage to be disabled. (default: 1.0)
+#
+# max-brightness = 1.0
+
+# Make transparent windows clip other windows like non-transparent windows do,
+# instead of blending on top of them.
+#
+# transparent-clipping = false
+
+# Set the log level. Possible values are:
+# "trace", "debug", "info", "warn", "error"
+# in increasing level of importance. Case doesn't matter.
+# If using the "TRACE" log level, it's better to log into a file
+# using *--log-file*, since it can generate a huge stream of logs.
+#
+# log-level = "debug"
+log-level = "info";
+
+# Set the log file.
+# If *--log-file* is never specified, logs will be written to stderr.
+# Otherwise, logs will to written to the given file, though some of the early
+# logs might still be written to the stderr.
+# When setting this option from the config file, it is recommended to use an absolute path.
+#
+# log-file = '/path/to/your/log/file'
+
+# Show all X errors (for debugging)
+# show-all-xerrors = false
+
+# Write process ID to a file.
+# write-pid-path = '/path/to/your/log/file'
+
+# Window type settings
+#
+# 'WINDOW_TYPE' is one of the 15 window types defined in EWMH standard:
+# "unknown", "desktop", "dock", "toolbar", "menu", "utility",
+# "splash", "dialog", "normal", "dropdown_menu", "popup_menu",
+# "tooltip", "notification", "combo", and "dnd".
+#
+# Following per window-type options are available: ::
+#
+# fade, shadow:::
+# Controls window-type-specific shadow and fade settings.
+#
+# opacity:::
+# Controls default opacity of the window type.
+#
+# focus:::
+# Controls whether the window of this type is to be always considered focused.
+# (By default, all window types except "normal" and "dialog" has this on.)
+#
+# full-shadow:::
+# Controls whether shadow is drawn under the parts of the window that you
+# normally won't be able to see. Useful when the window has parts of it
+# transparent, and you want shadows in those areas.
+#
+# redir-ignore:::
+# Controls whether this type of windows should cause screen to become
+# redirected again after been unredirected. If you have unredir-if-possible
+# set, and doesn't want certain window to cause unnecessary screen redirection,
+# you can set this to `true`.
+#
+wintypes:
+{
+ dock = { shadow = false; }
+ dnd = { shadow = false; }
+};
diff --git a/stow_home/picom/.config/picom/picom.conf.bak b/stow_home/picom/.config/picom/picom.conf.bak
new file mode 100755
index 0000000..a5b20a2
--- /dev/null
+++ b/stow_home/picom/.config/picom/picom.conf.bak
@@ -0,0 +1,63 @@
+backend = "glx";
+glx-no-stencil = true;
+vsync = true;
+unredir-if-possible = true;
+
+# Shadow
+shadow = true; # Enabled client-side shadows on windows.
+shadow-radius = 7; # The blur radius for shadows. (default 12)
+shadow-offset-x = -7; # The left offset for shadows. (default -15)
+shadow-offset-y = -7; # The top offset for shadows. (default -15)
+shadow-exclude = [
+ "n:e:Notification",
+ "n:e:Docky",
+ "g:e:Synapse",
+ "g:e:Conky",
+ "n:w:*Chromium*",
+ "n:w:*dockbarx*",
+ "n:w:*panel*"
+ "n:w:*maim*"
+ "class_g ?= 'spectrwm'",
+ "class_g ?= 'Cairo-dock'",
+ "class_g ?= 'Xfce4-notifyd'",
+ "class_g ?= 'Xfce4-power-manager'",
+ "class_g ?= 'Notify-osd'",
+ "class_g ?= 'Firefox'",
+ "_GTK_FRAME_EXTENTS@:c"
+];
+
+
+blur-background = true;
+blur-background-frame = true;
+blur-kern = "3x3box"
+blur-background-fixed = true;
+blur-background-exclude = [
+ "window_type = 'dock'",
+ "window_type = 'desktop'"
+];
+
+
+# Opacity
+detect-client-opacity = true;
+menu-opacity = 1.0;
+active-opacity = 1.0;
+inactive-opacity = 0.8;
+inactive-opacity-override = false;
+opacity-rule = [
+"90:class_g ?= 'pcmanfm'" ,
+"99:class_g ?= 'Firefox'" ,
+"99:class_g ?= 'Xfce4-terminal'" ,
+"99:class_g ?= 'konsole'" ,
+"100:class_g ?= 'rofi'"
+]
+
+
+
+
+# Window type settings
+wintypes:
+{
+ dock = { shadow = false; };
+ dnd = { shadow = false; };
+ tooltip = { shadow = false; };
+};
diff --git a/stow_home/picom/.config/picom/picomvoiddefault.conf.bak b/stow_home/picom/.config/picom/picomvoiddefault.conf.bak
new file mode 100755
index 0000000..31a30f5
--- /dev/null
+++ b/stow_home/picom/.config/picom/picomvoiddefault.conf.bak
@@ -0,0 +1,425 @@
+#################################
+# Shadows #
+#################################
+
+
+# Enabled client-side shadows on windows. Note desktop windows
+# (windows with '_NET_WM_WINDOW_TYPE_DESKTOP') never get shadow,
+# unless explicitly requested using the wintypes option.
+#
+# shadow = false
+shadow = true;
+
+# The blur radius for shadows, in pixels. (defaults to 12)
+# shadow-radius = 12
+shadow-radius = 7;
+
+# The opacity of shadows. (0.0 - 1.0, defaults to 0.75)
+# shadow-opacity = .75
+
+# The left offset for shadows, in pixels. (defaults to -15)
+# shadow-offset-x = -15
+shadow-offset-x = -7;
+
+# The top offset for shadows, in pixels. (defaults to -15)
+# shadow-offset-y = -15
+shadow-offset-y = -7;
+
+# Red color value of shadow (0.0 - 1.0, defaults to 0).
+# shadow-red = 0
+
+# Green color value of shadow (0.0 - 1.0, defaults to 0).
+# shadow-green = 0
+
+# Blue color value of shadow (0.0 - 1.0, defaults to 0).
+# shadow-blue = 0
+
+# Hex string color value of shadow (#000000 - #FFFFFF, defaults to #000000). This option will override options set shadow-(red/green/blue)
+# shadow-color = "#000000"
+
+# Specify a list of conditions of windows that should have no shadow.
+#
+# examples:
+# shadow-exclude = "n:e:Notification";
+#
+# shadow-exclude = []
+shadow-exclude = [
+ "name = 'Notification'",
+ "class_g = 'Conky'",
+ "class_g ?= 'Notify-osd'",
+ "class_g = 'Cairo-clock'",
+ "class_g = 'Firefox'",
+ "class_g = 'LibreWolf'",
+ "class_g = 'Brave-browser'",
+ "class_g = 'obs'",
+ "class_g = 'trayer'",
+ "_GTK_FRAME_EXTENTS@:c"
+];
+
+# Specify a X geometry that describes the region in which shadow should not
+# be painted in, such as a dock window region. Use
+# shadow-exclude-reg = "x10+0+0"
+# for example, if the 10 pixels on the bottom of the screen should not have shadows painted on.
+#
+# shadow-exclude-reg = ""
+
+# Crop shadow of a window fully on a particular Xinerama screen to the screen.
+# xinerama-shadow-crop = false
+
+
+#################################
+# Fading #
+#################################
+
+
+# Fade windows in/out when opening/closing and when opacity changes,
+# unless no-fading-openclose is used.
+# fading = false
+fading = true;
+
+# Opacity change between steps while fading in. (0.01 - 1.0, defaults to 0.028)
+# fade-in-step = 0.028
+fade-in-step = 0.03;
+
+# Opacity change between steps while fading out. (0.01 - 1.0, defaults to 0.03)
+# fade-out-step = 0.03
+fade-out-step = 0.03;
+
+# The time between steps in fade step, in milliseconds. (> 0, defaults to 10)
+# fade-delta = 10
+
+# Specify a list of conditions of windows that should not be faded.
+# fade-exclude = []
+
+# Do not fade on window open/close.
+# no-fading-openclose = false
+
+# Do not fade destroyed ARGB windows with WM frame. Workaround of bugs in Openbox, Fluxbox, etc.
+# no-fading-destroyed-argb = false
+
+
+#################################
+# Transparency / Opacity #
+#################################
+
+
+# Opacity of inactive windows. (0.1 - 1.0, defaults to 1.0)
+# inactive-opacity = 1
+inactive-opacity = 0.8;
+
+# Opacity of window titlebars and borders. (0.1 - 1.0, disabled by default)
+# frame-opacity = 1.0
+frame-opacity = 0.7;
+
+# Let inactive opacity set by -i override the '_NET_WM_OPACITY' values of windows.
+# inactive-opacity-override = true
+inactive-opacity-override = false;
+
+# Default opacity for active windows. (0.0 - 1.0, defaults to 1.0)
+# active-opacity = 1.0
+
+# Dim inactive windows. (0.0 - 1.0, defaults to 0.0)
+# inactive-dim = 0.0
+
+# Specify a list of conditions of windows that should always be considered focused.
+# focus-exclude = []
+focus-exclude = [ "class_g = 'Cairo-clock'" ];
+
+# Use fixed inactive dim value, instead of adjusting according to window opacity.
+# inactive-dim-fixed = 1.0
+
+# Specify a list of opacity rules, in the format `PERCENT:PATTERN`,
+# like `50:name *= "Firefox"`. picom-trans is recommended over this.
+# Note we don't make any guarantee about possible conflicts with other
+# programs that set '_NET_WM_WINDOW_OPACITY' on frame or client windows.
+# example:
+ opacity-rule = [
+ "80:class_g = 'URxvt'",
+ "100:class_g = 'Firefox'",
+ "100:class_g = 'Gimp-2.10'",
+ "100:class_g = 'discord'",
+ "100:class_g = 'Brave-browser'",
+ "100:class_g = 'obs'",
+ "100:class_g = 'trayer'",
+ ];
+#
+# opacity-rule = []
+
+
+#################################
+# Corners #
+#################################
+
+# Sets the radius of rounded window corners. When > 0, the compositor will
+# round the corners of windows. Does not interact well with
+# `transparent-clipping`.
+corner-radius = 16
+
+# Exclude conditions for rounded corners.
+rounded-corners-exclude = [
+ "window_type = 'dock'",
+ "window_type = 'desktop'",
+];
+
+
+#################################
+# Background-Blurring #
+#################################
+
+
+# Parameters for background blurring, see the *BLUR* section for more information.
+blur-method ="gaussian"
+# blur-size = 50
+#
+# blur-deviation = false
+#
+blur-strength = 45
+
+# Blur background of semi-transparent / ARGB windows.
+# Bad in performance, with driver-dependent behavior.
+# The name of the switch may change without prior notifications.
+#
+# blur-background = false
+
+# Blur background of windows when the window frame is not opaque.
+# Implies:
+# blur-background
+# Bad in performance, with driver-dependent behavior. The name may change.
+#
+# blur-background-frame = false
+
+
+# Use fixed blur strength rather than adjusting according to window opacity.
+blur-background-fixed = true
+
+
+# Specify the blur convolution kernel, with the following format:
+# example:
+# blur-kern = "5,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1";
+#
+# blur-kern = ""
+blur-kern = "3x3box";
+
+
+# Exclude conditions for background blur.
+# blur-background-exclude = []
+blur-background-exclude = [
+ "window_type = 'dock'",
+ "window_type = 'desktop'",
+ "_GTK_FRAME_EXTENTS@:c"
+];
+
+#################################
+# General Settings #
+#################################
+
+# Daemonize process. Fork to background after initialization. Causes issues with certain (badly-written) drivers.
+# daemon = false
+
+# Specify the backend to use: `xrender`, `glx`, or `xr_glx_hybrid`.
+# `xrender` is the default one.
+#
+# backend = "glx"
+backend = "xrender";
+
+# Enable/disable VSync.
+# vsync = false
+vsync = true;
+
+# Enable remote control via D-Bus. See the *D-BUS API* section below for more details.
+# dbus = false
+
+# Try to detect WM windows (a non-override-redirect window with no
+# child that has 'WM_STATE') and mark them as active.
+#
+# mark-wmwin-focused = false
+mark-wmwin-focused = true;
+
+# Mark override-redirect windows that doesn't have a child window with 'WM_STATE' focused.
+# mark-ovredir-focused = false
+mark-ovredir-focused = true;
+
+# Try to detect windows with rounded corners and don't consider them
+# shaped windows. The accuracy is not very high, unfortunately.
+#
+# detect-rounded-corners = false
+detect-rounded-corners = true;
+
+# Detect '_NET_WM_OPACITY' on client windows, useful for window managers
+# not passing '_NET_WM_OPACITY' of client windows to frame windows.
+#
+# detect-client-opacity = false
+detect-client-opacity = true;
+
+# Specify refresh rate of the screen. If not specified or 0, picom will
+# try detecting this with X RandR extension.
+#
+# refresh-rate = 60
+refresh-rate = 0;
+
+# Use EWMH '_NET_ACTIVE_WINDOW' to determine currently focused window,
+# rather than listening to 'FocusIn'/'FocusOut' event. Might have more accuracy,
+# provided that the WM supports it.
+#
+# use-ewmh-active-win = false
+
+# Unredirect all windows if a full-screen opaque window is detected,
+# to maximize performance for full-screen windows. Known to cause flickering
+# when redirecting/unredirecting windows.
+#
+# unredir-if-possible = false
+
+# Delay before unredirecting the window, in milliseconds. Defaults to 0.
+# unredir-if-possible-delay = 0
+
+# Conditions of windows that shouldn't be considered full-screen for unredirecting screen.
+# unredir-if-possible-exclude = []
+
+# Use 'WM_TRANSIENT_FOR' to group windows, and consider windows
+# in the same group focused at the same time.
+#
+# detect-transient = false
+detect-transient = true;
+
+# Use 'WM_CLIENT_LEADER' to group windows, and consider windows in the same
+# group focused at the same time. 'WM_TRANSIENT_FOR' has higher priority if
+# detect-transient is enabled, too.
+#
+# detect-client-leader = false
+detect-client-leader = true;
+
+# Resize damaged region by a specific number of pixels.
+# A positive value enlarges it while a negative one shrinks it.
+# If the value is positive, those additional pixels will not be actually painted
+# to screen, only used in blur calculation, and such. (Due to technical limitations,
+# with use-damage, those pixels will still be incorrectly painted to screen.)
+# Primarily used to fix the line corruption issues of blur,
+# in which case you should use the blur radius value here
+# (e.g. with a 3x3 kernel, you should use `--resize-damage 1`,
+# with a 5x5 one you use `--resize-damage 2`, and so on).
+# May or may not work with *--glx-no-stencil*. Shrinking doesn't function correctly.
+#
+# resize-damage = 1
+
+# Specify a list of conditions of windows that should be painted with inverted color.
+# Resource-hogging, and is not well tested.
+#
+# invert-color-include = []
+
+# GLX backend: Avoid using stencil buffer, useful if you don't have a stencil buffer.
+# Might cause incorrect opacity when rendering transparent content (but never
+# practically happened) and may not work with blur-background.
+# My tests show a 15% performance boost. Recommended.
+#
+# glx-no-stencil = false
+
+# GLX backend: Avoid rebinding pixmap on window damage.
+# Probably could improve performance on rapid window content changes,
+# but is known to break things on some drivers (LLVMpipe, xf86-video-intel, etc.).
+# Recommended if it works.
+#
+# glx-no-rebind-pixmap = false
+
+# Disable the use of damage information.
+# This cause the whole screen to be redrawn everytime, instead of the part of the screen
+# has actually changed. Potentially degrades the performance, but might fix some artifacts.
+# The opposing option is use-damage
+#
+# no-use-damage = false
+use-damage = true;
+
+# Use X Sync fence to sync clients' draw calls, to make sure all draw
+# calls are finished before picom starts drawing. Needed on nvidia-drivers
+# with GLX backend for some users.
+#
+# xrender-sync-fence = false
+
+# GLX backend: Use specified GLSL fragment shader for rendering window contents.
+# See `compton-default-fshader-win.glsl` and `compton-fake-transparency-fshader-win.glsl`
+# in the source tree for examples.
+#
+# glx-fshader-win = ""
+
+# Force all windows to be painted with blending. Useful if you
+# have a glx-fshader-win that could turn opaque pixels transparent.
+#
+# force-win-blend = false
+
+# Do not use EWMH to detect fullscreen windows.
+# Reverts to checking if a window is fullscreen based only on its size and coordinates.
+#
+# no-ewmh-fullscreen = false
+
+# Dimming bright windows so their brightness doesn't exceed this set value.
+# Brightness of a window is estimated by averaging all pixels in the window,
+# so this could comes with a performance hit.
+# Setting this to 1.0 disables this behaviour. Requires --use-damage to be disabled. (default: 1.0)
+#
+# max-brightness = 1.0
+
+# Make transparent windows clip other windows like non-transparent windows do,
+# instead of blending on top of them.
+#
+# transparent-clipping = false
+
+# Set the log level. Possible values are:
+# "trace", "debug", "info", "warn", "error"
+# in increasing level of importance. Case doesn't matter.
+# If using the "TRACE" log level, it's better to log into a file
+# using *--log-file*, since it can generate a huge stream of logs.
+#
+# log-level = "debug"
+log-level = "warn";
+
+# Set the log file.
+# If *--log-file* is never specified, logs will be written to stderr.
+# Otherwise, logs will to written to the given file, though some of the early
+# logs might still be written to the stderr.
+# When setting this option from the config file, it is recommended to use an absolute path.
+#
+# log-file = "/path/to/your/log/file"
+
+# Show all X errors (for debugging)
+# show-all-xerrors = false
+
+# Write process ID to a file.
+# write-pid-path = "/path/to/your/log/file"
+
+# Window type settings
+#
+# 'WINDOW_TYPE' is one of the 15 window types defined in EWMH standard:
+# "unknown", "desktop", "dock", "toolbar", "menu", "utility",
+# "splash", "dialog", "normal", "dropdown_menu", "popup_menu",
+# "tooltip", "notification", "combo", and "dnd".
+#
+# Following per window-type options are available: ::
+#
+# fade, shadow:::
+# Controls window-type-specific shadow and fade settings.
+#
+# opacity:::
+# Controls default opacity of the window type.
+#
+# focus:::
+# Controls whether the window of this type is to be always considered focused.
+# (By default, all window types except "normal" and "dialog" has this on.)
+#
+# full-shadow:::
+# Controls whether shadow is drawn under the parts of the window that you
+# normally won't be able to see. Useful when the window has parts of it
+# transparent, and you want shadows in those areas.
+#
+# redir-ignore:::
+# Controls whether this type of windows should cause screen to become
+# redirected again after been unredirected. If you have unredir-if-possible
+# set, and doesn't want certain window to cause unnecessary screen redirection,
+# you can set this to `true`.
+#
+wintypes:
+{
+ tooltip = { fade = true; shadow = true; opacity = 0.75; focus = true; full-shadow = false; };
+ dock = { shadow = false; }
+ dnd = { shadow = false; }
+ popup_menu = { opacity = 0.8; }
+ dropdown_menu = { opacity = 0.8; }
+};
diff --git a/stow_home/rofi/.config/rofi/config.rasi b/stow_home/rofi/.config/rofi/config.rasi
new file mode 100644
index 0000000..3dee511
--- /dev/null
+++ b/stow_home/rofi/.config/rofi/config.rasi
@@ -0,0 +1,11 @@
+configuration {
+ columns: 1;
+ terminal: "alacritty";
+ theme: "/home/joelchrono12/.config/rofi/themes/centered-nord.rasi";
+ modi: "drun,calc:qalc,window,run,emoji";
+ show-icons: true;
+ icon-theme: "Flatery-Blue-Dark";
+ width: 30;
+ lines: 18;
+ fake-transparency: true;
+}
diff --git a/stow_home/rofi/.config/rofi/scripts/dmenu-edit-configs.sh b/stow_home/rofi/.config/rofi/scripts/dmenu-edit-configs.sh
new file mode 100755
index 0000000..f80b05c
--- /dev/null
+++ b/stow_home/rofi/.config/rofi/scripts/dmenu-edit-configs.sh
@@ -0,0 +1,56 @@
+#!/bin/bash
+# ____ _____
+# | _ \_ _| Derek Taylor (DistroTube)
+# | | | || | http://www.youtube.com/c/DistroTube
+# | |_| || | http://www.gitlab.com/dwt1/
+# |____/ |_|
+#
+# Dmenu script for editing some of my more frequently edited config files.
+
+
+declare options=("alacritty
+awesome
+bash
+doom/config.el
+doom/init.el
+neovim
+picom
+spectrwm
+quit")
+
+choice=$(echo -e "${options[@]}" | rofi -dmenu -p 'Edit config file: ')
+
+case "$choice" in
+ quit)
+ echo "Program terminated." && exit 1
+ ;;
+ alacritty)
+ choice="$HOME/.config/alacritty/alacritty.yml"
+ ;;
+ awesome)
+ choice="$HOME/.config/awesome/rc.lua"
+ ;;
+ bash)
+ choice="$HOME/.bashrc"
+ ;;
+ doom.d/config.el)
+ choice="$HOME/.config/doom/config.el"
+ ;;
+ doom.d/init.el)
+ choice="$HOME/.config/doom/init.el"
+ ;;
+ neovim)
+ choice="$HOME/.config/nvim/init.vim"
+ ;;
+ picom)
+ choice="$HOME/.config/picom/picom.conf"
+ ;;
+ spectrwm)
+ choice="$HOME/.config/spectrwm/README.org"
+ ;;
+ *)
+ exit 1
+ ;;
+esac
+#alacritty -e nvim "$choice" &
+emacsclient -c -a emacs "$choice"
diff --git a/stow_home/rofi/.config/rofi/scripts/power-menu.sh b/stow_home/rofi/.config/rofi/scripts/power-menu.sh
new file mode 100755
index 0000000..d532521
--- /dev/null
+++ b/stow_home/rofi/.config/rofi/scripts/power-menu.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+# Simple script to handle a DIY shutdown menu. When run you should see a bunch of options (shutdown, reboot etc.)
+#
+# Requirements:
+# - rofi
+# - systemd, but you can replace the commands for OpenRC or anything else
+#
+# Instructions:
+current=$(wmctrl -m | grep Name | awk {'print $2'})
+# - Save this file as power.sh or anything
+# - Give it exec priviledge, or chmod +x /path/to/power.sh
+# - Run it
+chosen=$(echo -e "[Cancel]\nLogout\nShutdown\nReboot System\nEdit config\nEdit dotfiles\nEdit power menu" | rofi -dmenu -width 10 -lines 7 -i -p "Power Menu:")
+# Info about some states are available here:
+# https://www.freedesktop.org/software/systemd/man/systemd-sleep.conf.html#Description
+
+if [[ $chosen = "Logout" ]]; then
+ pkill $current
+elif [[ $chosen = "Shutdown" ]]; then
+ systemctl poweroff
+elif [[ $chosen = "Reboot System" ]]; then
+ systemctl reboot
+elif [[ $chosen = "Edit config" ]]; then
+ if [[ $current = "spectrwm" ]]; then
+ alacritty -e nvim ~/.spectrwm.conf
+ elif [[ $current = "awesome" ]]; then
+ alacritty -e nvim ~/.config/awesome/rc.lua
+ elif [[ $current = "leftwm" ]]; then
+ alacritty -e nvim ~/.config/leftwm/config.toml
+ fi
+elif [[ $chosen = "Edit dotfiles" ]]; then
+ ~/.config/rofi/scripts/dmenu-edit-configs.sh
+elif [[ $chosen = "Edit power menu" ]]; then
+ alacritty -e nvim $HOME/.config/rofi/scripts/power-menu.sh
+fi
diff --git a/stow_home/rofi/.config/rofi/scripts/qpost.sh b/stow_home/rofi/.config/rofi/scripts/qpost.sh
new file mode 100755
index 0000000..eb4a9f3
--- /dev/null
+++ b/stow_home/rofi/.config/rofi/scripts/qpost.sh
@@ -0,0 +1,32 @@
+#! /bin/bash
+path=/home/joelchrono12/git/joelchrono12.ml/_posts/
+title=$(rofi -l 0 -width 50 -p "Title:" -dmenu)
+filen=$(echo $title | tr " ,.!" "-"| awk '{print tolower($0)}')
+if [ -z $title ]; then
+ exit
+fi
+today=$(date +"%Y-%m-%d")
+filename=($today-$filen)
+description=$(rofi -l 0 -width 60 -height 20 -p "Description:" -dmenu)
+tags=$(rofi -l 0 -width 45 -p "Tags:" -dmenu)
+num=0
+while [ $num = 0 ]; do
+ choice=$(echo -e "Edit file\nEdit title\nEdit description\nEdit tags\nCancel" | rofi -width 15 -l 5-p "Now?:" -dmenu)
+
+ if [[ $choice = "Edit file" ]]; then
+ touch $path/$filename.md
+ echo -e "---\ntitle: $title\nheader: $title\ndescription: $description\ntags: $tags\npermalink: /blog/$filen/\nlayout: post\ndate: $today $(date +"%T") -0500\nhost: fosstodon.org\nusername: joeligj12\ncom_id: idcomments\n---">> $path/$filename.md
+ num=1
+ alacritty -e nvim $path/$filename.md & disown
+ #cp $path/$filename.md ~/Documents
+ elif [[ $choice = "Edit title" ]]; then
+ title=$(rofi -l 0 -width 50 -p "Title:" -dmenu)
+ elif [[ $choice = "Edit description" ]]; then
+ description=$(rofi -l 0 -width 60 -height 20 -p "Description:" -dmenu)
+ elif [[ $choice = "Edit tags" ]]; then
+ tags=$(rofi -l 0 -width 45 -p "Tags:" -dmenu)
+ else
+ num=1
+ fi
+done
+
diff --git a/stow_home/rofi/.config/rofi/themes/centered-nord.rasi b/stow_home/rofi/.config/rofi/themes/centered-nord.rasi
new file mode 100755
index 0000000..1787106
--- /dev/null
+++ b/stow_home/rofi/.config/rofi/themes/centered-nord.rasi
@@ -0,0 +1,84 @@
+/**
+ * Based on: dt-center.rasi by Derek Taylor (DT)
+ * Customized by JoelChrono12
+ * Nord Theme Rofi
+ */
+
+* {
+ background-color: #2e3440;
+ border-color: #2e3440;
+ text-color: #eceff4;
+ font: "Source Code Pro 12";
+ prompt-font: "Source Code Pro 13";
+ prompt-background: #b48ead;
+ prompt-foreground: #2e3440;
+ prompt-padding: 4px;
+ alternate-normal-background: #3b4252;
+ alternate-normal-foreground: @text-color;
+ selected-normal-background: #a3be8c;
+ selected-normal-foreground: #2e3440;
+ border-radius: 8px;
+ spacing: 3;
+}
+#window {
+ border: 1;
+ padding: 5;
+}
+#mainbox {
+ border: 0;
+ padding: 0;
+}
+#message {
+ border: 1px dash 0px 0px ;
+ padding: 1px ;
+}
+#listview {
+ fixed-height: 0;
+ border: 2px dash 0px 0px ;
+ spacing: 2px ;
+ scrollbar: true;
+ padding: 2px 0px 0px ;
+}
+#element {
+ border: 0;
+ padding: 1px ;
+}
+#element.selected.normal {
+ background-color: @selected-normal-background;
+ text-color: @selected-normal-foreground;
+}
+#element.alternate.normal {
+ background-color: @alternate-normal-background;
+ text-color: @alternate-normal-foreground;
+}
+#scrollbar {
+ width: 0px ;
+ border: 0;
+ handle-width: 0px ;
+ padding: 0;
+}
+#sidebar {
+ border: 2px dash 0px 0px ;
+}
+#button.selected {
+ background-color: @selected-normal-background;
+ text-color: @selected-normal-foreground;
+}
+#inputbar {
+ spacing: 0;
+ padding: 1px ;
+}
+#case-indicator {
+ spacing: 0;
+}
+#entry {
+ padding: 4px 4px;
+ expand: false;
+ width: 100%;
+}
+#prompt {
+ padding: @prompt-padding;
+ background-color: @prompt-background;
+ text-color: @prompt-foreground;
+ font: @prompt-font;
+}
diff --git a/stow_home/spectrwm/.config/spectrwm/README.org b/stow_home/spectrwm/.config/spectrwm/README.org
new file mode 100644
index 0000000..81d8854
--- /dev/null
+++ b/stow_home/spectrwm/.config/spectrwm/README.org
@@ -0,0 +1,291 @@
+#+TITLE: My custom Spectrwm configuration
+#+PROPERTY: header-args :tangle spectrwm.conf
+#+author: Joelchrono12
+* My config
+:PROPERTIES:
+:DIR: ~/.config/spectrwm/org-assets/
+:END:
+This is my personal config for the Spectrwm window manager. Spectrwm its a really minimal program to manage windows, not as simple as DWM, while still being fairly customizable.
+You can see how it looks here!
+
+[[./org-assets/spectrwm.png][My config]]
+
+* Initial setup
+These first lines are pretty easy to understand. The variables in spectrwm describe their functionality quite well. These first lines are just setting up the minimal, simple configuration.
+#+begin_src conf
+ # Initial setup config
+workspace_limit = 9
+focus_mode = manual
+focus_close = previous
+focus_close_wrap = 0
+focus_default = last
+spawn_position = next
+workspace_clamp = 1
+warp_focus = 0
+warp_pointer = 0
+
+#+end_src
+* Window decoration & boundaries
+This is a fairly customizable section of the config, we configure the borders of the windows, the colors when focused or not, as well as the gaps and padding.
+
+I like to have quite a big amount of gaps. The focus color is the blue from the [[https://www.nordtheme.com/][Nord]] color scheme, and the unfocused is dark gray
+
+#+begin_src conf
+ # Window decorations & boundaries
+border_width = 2
+color_focus = rgb:d0/87/70
+color_unfocus = rgb:5e/81/ac
+region_padding = 0
+tile_gap = 0
+boundary_width = 50
+
+#+end_src
+
+* The bar
+My bar is the most important aspect of this config, since its the one that will appear in all of my workspaces. It is a top bar and it shows all of the
+available workspaces, marking the current one with an asterisk The bar borders are useless to me since I only have one screen
+
+#+begin_src conf
+ # Bar configuration
+bar_enabled = 1
+bar_border_width = 1
+bar_border[1] = rgb:18/18/18
+bar_border_unfocus[1] = rgb:18/18/18
+bar_color[1] = rgb:2e/34/40,rgb:eb/cb/8b,rgb:a3/be/8c,rgb:bf/61/6a,rgb:b4/8e/ad,rgb:88/c0/d0,rgb:d0/87/70,rgb:3b/42/52,rgb:4c/56/6a
+bar_color_selected[1] = rgb:88/c0/d0
+bar_font_color[1] = rgb:ec/ef/f4,rgb:2e/34/40,rgb:2e/34/40,rgb:eb/cb/8b,rgb:a3/be/8c,rgb:bf/61/6a,rgb:b4/8e/ad,rgb:88/c0/d0,rgb:d0/87/70,rgb:3b/42/52,rgb:4c/56/6a
+bar_font = Blex Mono Nerd Font:pixelsize=15:antialias=true
+bar_action = ~/.config/spectrwm/baraction.sh
+bar_action_expand = 1
+bar_justify = right
+bar_format = +|L +@bg=0;+S +L +@bg=0; +@bg=8; +C +@fg=0; +|2R +A +@bg=0;+@fg=0; %a, %b %d %R +<
+bar_at_bottom = 0
+workspace_indicator = listall,markcurrent
+stack_enabled = 1
+clock_enabled = 1
+clock_format = %a, %b %d %R
+iconic_enabled = 1
+maximize_hide_bar = 0
+window_class_enabled = 1
+window_instance_enabled = 1
+window_name_enabled = 0
+verbose_layout = 0
+urgent_enabled = 1
+urgent_collapse = 0
+
+#+end_src
+
+* Starting up and applications
+No need to talk about these, I use these programs to set up stuff as soon as my session starts, maybe I should put some in another file, like ~.initrc~, but I've not done it yet.
+
+#+begin_src conf
+ # Autorunning applications
+autorun = ws[1]:nitrogen --set-auto ~/Pictures/walls/paranoid.jpg &
+autorun = ws[1]:setxkbmap -layout latam &
+autorun = ws[1]:alacritty
+autorun = ws[1]:volumeicon
+autorun = ws[1]:xfce4-power-manager
+autorun = ws[1]:syncthing
+autorun = ws[1]:nm-applet &
+autorun = ws[1]:lxpolkit &
+autorun = ws[1]:picom --experimental-backends --backend glx --blur-method 'dual_kawase' --blur-strength 6
+
+#+end_src
+
+Other important details are setup here, like workspace names and defining a Modifier key, I could use glyphs as workspace names, but honestly, they don't really describe that well what I want to do in them.
+
+#+begin_src conf
+ # Workspace names and modkey
+layout = ws[1]:4:0:0:0:vertical
+name = ws[1]:WEB
+name = ws[2]:DEV
+name = ws[3]:MAIL
+name = ws[4]:FILE
+name = ws[5]:CHAT
+name = ws[6]:SSH
+name = ws[7]:EMACS
+name = ws[8]:TERM
+name = ws[9]:ETC
+# ", " ", " ", " ", " ", " ", " ", " ", " ", " "
+modkey = Mod4
+
+#+end_src
+* Quirks
+These are different ways to treat the windows of specific programs, making them float, or appear in a certain workspace all the time. These are really powerful settings, but are still being set up, since some apps don't behave as I expect them to do so.
+
+#+begin_src conf
+ # Quirks and custom per program behavior
+quirk[firefox:Dialog] = FLOAT + MINIMALBORDER + TRANSSZ
+quirk[Image Lounge] = FLOAT
+quirk[firefox] = IGNOREPID + TRANSSZ + ANYWHERE
+quirk[Thunderbird] = ANYWHERE + IGNORESPAWNWS + IGNOREPID + TRANSSZ
+quirk[Claws-mail] = ANYWHERE + IGNORESPAWNWS + IGNOREPID + TRANSSZ
+quirk[Xarchiver] = ANYWHERE + IGNORESPAWNWS + IGNOREPID + TRANSSZ
+quirk[Lxappearance] = FLOAT
+quirk[Pavucontrol] = FLOAT
+quirk[Volumeicon] = FLOAT + ANYWHERE + IGNORESPAWNWS + IGNOREPID
+quirk[discord:Discord Updater] = FLOAT + IGNOREPID
+quirk[stalonetray] = FLOAT + ANYWHERE
+quirk[trayer] = FLOAT + ANYWHERE + NOFOCUSCYCLE + MINIMALBORDER + NOFOCUSONMAP
+quirk[Lxpolkit] = FLOAT + IGNOREPID +FOCUSPREV + IGNORESPAWNWS
+quirk[Xfce4-power-manager-settings] = FLOAT + ANYWHERE
+quirk[Nm-connection-editor] = ANYWHERE + IGNORESPAWNWS + FLOAT
+quirk[Pcmanfm] = ANYWHERE + IGNORESPAWNWS
+quirk[Thunar] = ANYWHERE + IGNORESPAWNWS
+
+#+end_src
+
+* General Keybindings
+This is the defining factor of any window manager, how good and optimized are your keybindings. As you can assume, these are made to fit my needs, so your mileage may vary, but a lot of them are just the default one, in case you are wondering.
+
+It is important to remember that default kebindings are not unbinded unless you add ~bind[] = ~, so that's why you'll seee a few of them here and there.
+#+begin_src conf
+ # General keybindings
+bind[] = MOD+x
+bind[] = MOD+v
+bind[bar_toggle] = MOD+b
+bind[bar_toggle_ws] = MOD+Shift+b
+bind[cycle_layout] = MOD+space
+bind[flip_layout] = MOD+Shift+backslash
+bind[float_toggle] = MOD+t
+bind[focus_main] = MOD+m
+bind[focus_next] = MOD+j
+bind[focus_next] = MOD+Tab
+bind[focus_prev] = MOD+k
+bind[focus_prev] = MOD+Shift+Tab
+bind[focus_urgent] = MOD+u
+bind[height_grow] = MOD+Shift+equal
+bind[height_shrink] = MOD+Shift+minus
+bind[iconify] = MOD+w
+bind[initscr] = MOD+Shift+i
+bind[lock] = MOD+Shift+Delete
+bind[master_add] = MOD+Shift+comma
+bind[master_del] = MOD+Shift+period
+bind[master_grow] = MOD+l
+bind[master_shrink] = MOD+h
+bind[maximize_toggle] = MOD+e
+bind[move_down] = MOD+Shift+bracketright
+bind[move_left] = MOD+bracketleft
+bind[move_right] = MOD+bracketright
+bind[move_up] = MOD+Shift+bracketleft
+bind[mvrg_1] = MOD+Shift+KP_End
+bind[mvrg_2] = MOD+Shift+KP_Down
+bind[mvrg_3] = MOD+Shift+KP_Next
+bind[mvrg_4] = MOD+Shift+KP_Left
+bind[mvrg_5] = MOD+Shift+KP_Begin
+bind[mvrg_6] = MOD+Shift+KP_Right
+bind[mvrg_7] = MOD+Shift+KP_Home
+bind[mvrg_8] = MOD+Shift+KP_Up
+bind[mvrg_9] = MOD+Shift+KP_Prior
+bind[mvws_1] = MOD+Shift+1
+bind[mvws_2] = MOD+Shift+2
+bind[mvws_3] = MOD+Shift+3
+bind[mvws_4] = MOD+Shift+4
+bind[mvws_5] = MOD+Shift+5
+bind[mvws_6] = MOD+Shift+6
+bind[mvws_7] = MOD+Shift+7
+bind[mvws_8] = MOD+Shift+8
+bind[mvws_9] = MOD+Shift+9
+bind[mvws_10] = MOD+Shift+0
+bind[mvws_11] = MOD+Shift+F1
+bind[mvws_12] = MOD+Shift+F2
+bind[mvws_13] = MOD+Shift+F3
+bind[mvws_14] = MOD+Shift+F4
+bind[mvws_15] = MOD+Shift+F5
+bind[mvws_16] = MOD+Shift+F6
+bind[mvws_17] = MOD+Shift+F7
+bind[mvws_18] = MOD+Shift+F8
+bind[mvws_19] = MOD+Shift+F9
+bind[mvws_20] = MOD+Shift+F10
+bind[mvws_21] = MOD+Shift+F11
+bind[mvws_22] = MOD+Shift+F12
+bind[name_workspace] = MOD+Shift+slash
+bind[quit] = MOD+Control+q
+bind[raise_toggle] = MOD+Control+r
+bind[restart] = MOD+Shift+r
+bind[rg_1] = MOD+KP_End
+bind[rg_2] = MOD+KP_Down
+bind[rg_3] = MOD+KP_Next
+bind[rg_4] = MOD+KP_Left
+bind[rg_5] = MOD+KP_Begin
+bind[rg_6] = MOD+KP_Right
+bind[rg_7] = MOD+KP_Home
+bind[rg_8] = MOD+KP_Up
+bind[rg_9] = MOD+KP_Prior
+bind[rg_next] = MOD+period
+bind[rg_prev] = MOD+comma
+bind[screenshot_all] = MOD+s
+bind[screenshot_wind] = MOD+Shift+s
+bind[search_win] = MOD+f
+bind[search_workspace] = MOD+slash
+bind[stack_dec] = MOD+Shift+period
+bind[stack_inc] = MOD+Shift+comma
+bind[stack_reset] = MOD+Shift+space
+bind[swap_next] = MOD+Shift+j
+bind[swap_prev] = MOD+Shift+k
+bind[uniconify] = MOD+Shift+w
+bind[version] = MOD+Shift+v
+bind[width_grow] = MOD+equal
+bind[width_shrink] = MOD+minus
+bind[wind_del] = MOD+q
+bind[ws_1] = MOD+1
+bind[ws_2] = MOD+2
+bind[ws_3] = MOD+3
+bind[ws_4] = MOD+4
+bind[ws_5] = MOD+5
+bind[ws_6] = MOD+6
+bind[ws_7] = MOD+7
+bind[ws_8] = MOD+8
+bind[ws_9] = MOD+9
+bind[ws_10] = MOD+0
+bind[ws_11] = MOD+F1
+bind[ws_12] = MOD+F2
+bind[ws_13] = MOD+F3
+bind[ws_14] = MOD+F4
+bind[ws_15] = MOD+F5
+bind[ws_16] = MOD+F6
+bind[ws_17] = MOD+F7
+bind[ws_18] = MOD+F8
+bind[ws_19] = MOD+F9
+bind[ws_20] = MOD+F10
+bind[ws_21] = MOD+F11
+bind[ws_22] = MOD+F12
+bind[ws_next_all] = MOD+Right
+bind[ws_next] = MOD+Up
+bind[ws_next_move] = MOD+Shift+Right
+bind[ws_prev_all] = MOD+Left
+bind[ws_prev] = MOD+Down
+bind[ws_prev_move] = MOD+Shift+Left
+bind[ws_prior] = MOD+a
+
+#+end_src
+
+* Program Keybindings
+These are the keybindings I setup myself, in order to open programs and execute any command I configure, they don't change much, but I add some new one from time to time.
+#+begin_src conf
+ # Custom program keybindings
+program[Discord] = discord
+bind[Discord] = MOD+mod1+d
+program[term] = alacritty
+bind[term] = MOD+Return
+program[rofi_run] = rofi -show run
+bind[rofi_run] = MOD+r
+program[post] = ~/.config/rofi/scripts/qpost.sh
+bind[post] = MOD+mod1+p
+program[rofi_pass] = rofi-pass
+bind[rofi_pass] = MOD+mod1+k
+program[tab_switch] = rofi -show window
+bind[tab_switch] = Mod1+Tab
+program[rofi] = rofi -show drun
+bind[rofi] = MOD+p
+program[power_menu] = ~/.config/rofi/scripts/power-menu.sh
+bind[power_menu] = MOD+Shift+q
+program[screenshot] = flameshot gui
+bind[screenshot] = MOD+Shift+s
+program[firefox] = firefox
+bind[firefox] = MOD+Mod1+b
+program[pcmanfm] = pcmanfm
+bind[pcmanfm] = MOD+Mod1+f
+program[pulsemixer] = alacritty -e pulsemixer
+bind[pulsemixer] = MOD+mod1+v
+#+end_src
diff --git a/stow_home/spectrwm/.config/spectrwm/bar-config.org b/stow_home/spectrwm/.config/spectrwm/bar-config.org
new file mode 100644
index 0000000..761d6c5
--- /dev/null
+++ b/stow_home/spectrwm/.config/spectrwm/bar-config.org
@@ -0,0 +1,187 @@
+#+TITLE: My Spectrwm bar config
+#+property: header-args :tangle baraction.sh
+#+author: joelchrono12
+
+* Contents :toc:
+- [[#my-bar-action-configuration][My bar action configuration]]
+ - [[#dependencies][Dependencies]]
+ - [[#disclaimer][Disclaimer]]
+- [[#network-status][Network status]]
+- [[#battery-status][Battery status]]
+- [[#volume-levels][Volume levels]]
+- [[#storage-and-ram][Storage and RAM]]
+- [[#cpu-status][CPU status]]
+- [[#bar-process][Bar process]]
+- [[#extras][Extras]]
+ - [[#mpd-status][MPD status]]
+ - [[#packages-and-updates][Packages and updates]]
+ - [[#weather-report][Weather report]]
+
+* My bar action configuration
+This is my bar script for Spectrwm. Which can be found [[./README.org][here]].
+This script displays some of the information I actually care about, as well as some things I don't.
+** Dependencies
+You are going to need a few programs in order to properly display the bar output
+- awk
+- mpc
+- pamixer
+- sed
+- mpd
+** Disclaimer
+Keep in mind that some of my scripts might not work on your specific linux distro, I am running Endeavour OS which is Arch based and uses pacman as package manager. So some of the package related scripts might not work
+
+* Network status
+This one will probably be fine for most setups.
+#+begin_src bash
+# network status
+network() {
+wifi="$(ip a | grep wlan0 | grep inet | wc -l)"
+wire="$(ip a | grep enp1s0 | grep inet | wc -l)"
+if [ $wire = 1 ]; then
+ echo " "
+elif [ $wifi = 1 ]; then
+ echo " "
+else
+ echo "睊"
+fi
+}
+
+#+end_src
+* Battery status
+This one comes from using cat on a system file. There might be some other utilites, like ~acpi~ that could work here, but this is fine.
+#+begin_src bash
+# battery status
+bat() {
+ batstat="$(cat /sys/class/power_supply/BAT0/status)"
+ battery="$(cat /sys/class/power_supply/BAT0/capacity)"
+
+ if [ $batstat = 'Unknown' ]; then
+ batstat=""
+ elif [[ $battery -ge 5 ]] && [[ $battery -le 19 ]]; then
+ batstat=""
+ elif [[ $battery -ge 20 ]] && [[ $battery -le 39 ]]; then
+ batstat=""
+ elif [[ $battery -ge 40 ]] && [[ $battery -le 59 ]]; then
+ batstat=""
+ elif [[ $battery -ge 60 ]] && [[ $battery -le 79 ]]; then
+ batstat=""
+ elif [[ $battery -ge 80 ]] && [[ $battery -le 95 ]]; then
+ batstat=""
+ elif [[ $battery -ge 96 ]] && [[ $battery -le 100 ]]; then
+ batstat=""
+ fi
+
+ echo "$batstat $battery"
+}
+
+#+end_src
+* Volume levels
+In this case I decided to go with ~pamixer~ just because its easier to use and write. I can probably do something like what happens with the [[Battery status][battery section]], but its fine as is, I got this from the internet too, what do you expect?
+
+#+begin_src bash
+# volume status
+vol() {
+ volstat=$(pamixer --get-volume-human)
+ vol=$(echo "$volstat")
+ volicon="墳"
+ echo -e "$volicon $vol"
+}
+
+#+end_src
+
+* Storage and RAM
+This section just displays how much storage I've used in my ssd, might require some configuration on your part, I don't know. It also shows the available system memory.
+
+#+begin_src bash
+# used storage
+hdd() {
+ hdd="$(df -h /home | grep /dev | awk '{print $3 " / " $2}')"
+ echo -e " $hdd"
+}
+
+# available ram
+mem() {
+ used="$(free -h | grep Mem: | awk '{print $3}')"
+ #total="$(free | grep Mem: | awk '{print $2}')"
+ #totalh="$(free -h | grep Mem: | awk '{print $2}' | sed 's/Gi/G/')"
+ ram="$used"
+ echo $ram
+}
+
+#+end_src
+
+* CPU status
+Yep, I have no idea of what this does, but it works and I use it, ok?
+#+begin_src bash
+# Cpu things
+cpu() {
+ read cpu a b c previdle rest < /proc/stat
+ prevtotal=$((a+b+c+previdle))
+ sleep 0.5
+ read cpu a b c idle rest < /proc/stat
+ total=$((a+b+c+idle))
+ cpu=$((100*( (total-prevtotal) - (idle-previdle) ) / (total-prevtotal) ))
+ echo -e " $cpu%"
+}
+
+#+end_src
+* Bar process
+The bar is going to be constantly running, updating every once in a while, this section echoes the output of all of the used functions, and its what spectrwm will show as the bar
+
+Notice the different sections such as ~+fg@1~, these are the colors that are shown in my ~spectrwm.conf~ file, and that's how spectrwm knows it needs to change the color of things. Like foreground and background
+
+#+begin_src bash
+# Loop to update bar output
+update(){
+ echo " $(mpd) $(cpu)+@fg=3; +@bg=1;+@fg=1; $(mem) +@fg=4;+@bg=2;+@fg=1; $(hdd) +@fg=5;+@bg=3;+@fg=1; $(vol) +@fg=7;+@bg=5;+@fg=1; $(bat) +@fg=8;+@bg=6;+@fg=1; $(network) +@fg=1;+@bg=0;"
+ wait
+}
+while :; do
+ update
+ ~/.config/spectrwm/scripts/trayer_follows_ws.sh
+ sleep 2 &
+ wait
+done
+
+#+end_src
+* Extras
+I have used and removed a few things from my script, but I added them here just in case anyone cares about them or is looking for stuff to put into their own config files.
+** MPD status
+Displays the current song playing with mpd, and if its paused
+#+begin_src bash
+mpd(){
+ song="$(mpc current)"
+ status="$(mpc status | grep paused | awk '{print $1}')"
+ echo -e "$song"
+}
+
+#+end_src
+
+** Packages and updates
+These were made for [[https://voidlinux.org][Void Linux]], and I stil don't adapt them for Endeavor OS. Therefore, I don't call them, since they would not work
+#+begin_src bash
+# Installed packages
+pkgs() {
+ pkgs="$(xbps-query -l | wc -l)"
+ echo -e " $pkgs"
+}
+
+# Available updates
+upgrades() {
+ upgrades="$(xbps-install -Sun | wc -l)"
+ echo -e " $upgrades"
+}
+
+#+end_src
+
+** Weather report
+I guess you can tell what this does from reading the title. I don't really know if it still works, to be honest.
+#+begin_src bash
+# weather using curl wttr.in
+temp() {
+ tmp="$(curl -s wttr.in | grep -m 1 °C | awk '{print $5 $6}')"
+ ##tmp="$(grep temp_F ~/.config/weather.txt | awk '{print $2}' | sed 's/"//g' | sed 's/,/ F/g')"
+ echo " $tmp"
+}
+
+#+end_src
diff --git a/stow_home/spectrwm/.config/spectrwm/baraction.sh b/stow_home/spectrwm/.config/spectrwm/baraction.sh
new file mode 100755
index 0000000..630fb2d
--- /dev/null
+++ b/stow_home/spectrwm/.config/spectrwm/baraction.sh
@@ -0,0 +1,107 @@
+# network status
+network() {
+wifi="$(ip a | grep wlan0 | grep inet | wc -l)"
+wire="$(ip a | grep enp1s0 | grep inet | wc -l)"
+if [ $wire = 1 ]; then
+ echo " "
+elif [ $wifi = 1 ]; then
+ echo " "
+else
+ echo "睊"
+fi
+}
+
+# battery status
+bat() {
+ batstat="$(cat /sys/class/power_supply/BAT0/status)"
+ battery="$(cat /sys/class/power_supply/BAT0/capacity)"
+
+ if [ $batstat = 'Unknown' ]; then
+ batstat=""
+ elif [[ $battery -ge 5 ]] && [[ $battery -le 19 ]]; then
+ batstat=""
+ elif [[ $battery -ge 20 ]] && [[ $battery -le 39 ]]; then
+ batstat=""
+ elif [[ $battery -ge 40 ]] && [[ $battery -le 59 ]]; then
+ batstat=""
+ elif [[ $battery -ge 60 ]] && [[ $battery -le 79 ]]; then
+ batstat=""
+ elif [[ $battery -ge 80 ]] && [[ $battery -le 95 ]]; then
+ batstat=""
+ elif [[ $battery -ge 96 ]] && [[ $battery -le 100 ]]; then
+ batstat=""
+ fi
+
+ echo "$batstat $battery"
+}
+
+# volume status
+vol() {
+ volstat=$(pamixer --get-volume-human)
+ vol=$(echo "$volstat")
+ volicon="墳"
+ echo -e "$volicon $vol"
+}
+
+# used storage
+hdd() {
+ hdd="$(df -h /home | grep /dev | awk '{print $3 " / " $2}')"
+ echo -e " $hdd"
+}
+
+# available ram
+mem() {
+ used="$(free -h | grep Mem: | awk '{print $3}')"
+ #total="$(free | grep Mem: | awk '{print $2}')"
+ #totalh="$(free -h | grep Mem: | awk '{print $2}' | sed 's/Gi/G/')"
+ ram="$used"
+ echo $ram
+}
+
+# Cpu things
+cpu() {
+ read cpu a b c previdle rest < /proc/stat
+ prevtotal=$((a+b+c+previdle))
+ sleep 0.5
+ read cpu a b c idle rest < /proc/stat
+ total=$((a+b+c+idle))
+ cpu=$((100*( (total-prevtotal) - (idle-previdle) ) / (total-prevtotal) ))
+ echo -e " $cpu%"
+}
+
+# Loop to update bar output
+update(){
+ echo " $(mpd) $(cpu)+@fg=3; +@bg=1;+@fg=1; $(mem) +@fg=4;+@bg=2;+@fg=1; $(hdd) +@fg=5;+@bg=3;+@fg=1; $(vol) +@fg=7;+@bg=5;+@fg=1; $(bat) +@fg=8;+@bg=6;+@fg=1; $(network) +@fg=1;+@bg=0;"
+ wait
+}
+while :; do
+ update
+ ~/.config/spectrwm/scripts/trayer_follows_ws.sh
+ sleep 2 &
+ wait
+done
+
+mpd(){
+ song="$(mpc current)"
+ status="$(mpc status | grep paused | awk '{print $1}')"
+ echo -e "$song"
+}
+
+# Installed packages
+pkgs() {
+ pkgs="$(xbps-query -l | wc -l)"
+ echo -e " $pkgs"
+}
+
+# Available updates
+upgrades() {
+ upgrades="$(xbps-install -Sun | wc -l)"
+ echo -e " $upgrades"
+}
+
+# weather using curl wttr.in
+temp() {
+ tmp="$(curl -s wttr.in | grep -m 1 °C | awk '{print $5 $6}')"
+ ##tmp="$(grep temp_F ~/.config/weather.txt | awk '{print $2}' | sed 's/"//g' | sed 's/,/ F/g')"
+ echo " $tmp"
+}
diff --git a/stow_home/spectrwm/.config/spectrwm/org-assets/spectrwm.png b/stow_home/spectrwm/.config/spectrwm/org-assets/spectrwm.png
new file mode 100644
index 0000000..213f11e
Binary files /dev/null and b/stow_home/spectrwm/.config/spectrwm/org-assets/spectrwm.png differ
diff --git a/stow_home/spectrwm/.config/spectrwm/scripts/README.org b/stow_home/spectrwm/.config/spectrwm/scripts/README.org
new file mode 100644
index 0000000..14dc186
--- /dev/null
+++ b/stow_home/spectrwm/.config/spectrwm/scripts/README.org
@@ -0,0 +1,57 @@
+#+TITLE: Other useful Spectrwm scripts
+#+author: joelchrono12 header-args :tangle yes
+* My spectrwm scripts
+These are other kinds of scripts that you can use alongside my main [[./bar.org][baraction.sh]] script. They make use of ~wmctrl~ to add some level of functionality to Spectrwm. Here are the scripts!
+Once generated, make sure to do the following command to make them executable!
+#+begin_example
+chmod +x file.sh
+#+end_example
+* Keep trayer on workspace
+This script makes sure that trayer or any system tray or application stays in your current workspace. Spectrwm does not work very well with these kinda programs, and this solution is still kinda hacky, which is why its not part of my main script. If it does not work, sorry.
+#+begin_src bash :tangle keep-trayer-ws.sh
+#!/bin/bash
+current_ws="$(wmctrl -d | grep '*' | awk '{print $1}')"
+wmctrl -r panel -t $current_ws
+
+#+end_src
+* Number of windows in workspace
+A simple script that shows how many windows are open inside of current workspace
+#+begin_src bash :tangle workspace-windows.sh
+#!/bin/bash
+ws_icon="$(wmctrl -d | grep "*" | awk '{print $9}')"
+windows_number="$(wmctrl -l | grep -v panel | awk '{print $2}'))"
+current_ws="$(wmctrl -d | grep '*' | awk '{print $1}')"
+windows_in_ws="$(echo -e "$windows_number" | grep $current_ws | wc -l)"
+echo -e "[$ws_icon ] [$windows_in_ws]"
+
+#+end_src
+* Volume control
+I normally use the ~volumeicon~ to take care of this, or ~pamixer~ on a terminal, but this script can do it too!, kinda...
+Make sure to add this line to beginning or the main bar script
+#+begin_example
+trap 'update' 5
+#+end_example
+
+And this is the script itself.
+#+begin_src bash :tangle volume-spectrwm.sh
+#!/bin/bash
+volumecontrol() {
+ pkill -SIGTRAP baraction.sh
+ case $1 in
+ increase)
+ amixer set Master 5%+
+ ;;
+ ecrease)
+ amixer set Master 5%-
+ ;;
+ toggle)
+ amixer set Master toggle
+ ;;
+ ,*)
+ ;;
+ esac;
+}
+
+volumecontrol $1
+
+#+end_src
diff --git a/stow_home/spectrwm/.config/spectrwm/scripts/keep-trayer-ws.sh b/stow_home/spectrwm/.config/spectrwm/scripts/keep-trayer-ws.sh
new file mode 100755
index 0000000..5215016
--- /dev/null
+++ b/stow_home/spectrwm/.config/spectrwm/scripts/keep-trayer-ws.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+current_ws="$(wmctrl -d | grep '*' | awk '{print $1}')"
+wmctrl -r panel -t $current_ws
diff --git a/stow_home/spectrwm/.config/spectrwm/scripts/volume-spectrwm.sh b/stow_home/spectrwm/.config/spectrwm/scripts/volume-spectrwm.sh
new file mode 100755
index 0000000..e38ce60
--- /dev/null
+++ b/stow_home/spectrwm/.config/spectrwm/scripts/volume-spectrwm.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+volumecontrol() {
+ pkill -SIGTRAP baraction.sh
+ case $1 in
+ increase)
+ amixer set Master 5%+
+ ;;
+ ecrease)
+ amixer set Master 5%-
+ ;;
+ toggle)
+ amixer set Master toggle
+ ;;
+ *)
+ ;;
+ esac;
+}
+
+volumecontrol $1
diff --git a/stow_home/spectrwm/.config/spectrwm/scripts/workspace-windows.sh b/stow_home/spectrwm/.config/spectrwm/scripts/workspace-windows.sh
new file mode 100755
index 0000000..40b2978
--- /dev/null
+++ b/stow_home/spectrwm/.config/spectrwm/scripts/workspace-windows.sh
@@ -0,0 +1,6 @@
+#!/bin/bash
+ws_icon="$(wmctrl -d | grep "*" | awk '{print $9}')"
+windows_number="$(wmctrl -l | grep -v panel | awk '{print $2}'))"
+current_ws="$(wmctrl -d | grep '*' | awk '{print $1}')"
+windows_in_ws="$(echo -e "$windows_number" | grep $current_ws | wc -l)"
+echo -e "[$ws_icon ] [$windows_in_ws]"
diff --git a/stow_home/spectrwm/.config/spectrwm/spectrwm.conf b/stow_home/spectrwm/.config/spectrwm/spectrwm.conf
new file mode 100644
index 0000000..5e96c46
--- /dev/null
+++ b/stow_home/spectrwm/.config/spectrwm/spectrwm.conf
@@ -0,0 +1,233 @@
+ # Initial setup config
+workspace_limit = 9
+focus_mode = manual
+focus_close = previous
+focus_close_wrap = 0
+focus_default = last
+spawn_position = next
+workspace_clamp = 1
+warp_focus = 0
+warp_pointer = 0
+
+ # Window decorations & boundaries
+border_width = 2
+color_focus = rgb:d0/87/70
+color_unfocus = rgb:5e/81/ac
+region_padding = 0
+tile_gap = 0
+boundary_width = 50
+
+ # Bar configuration
+bar_enabled = 1
+bar_border_width = 1
+bar_border[1] = rgb:18/18/18
+bar_border_unfocus[1] = rgb:18/18/18
+bar_color[1] = rgb:2e/34/40,rgb:eb/cb/8b,rgb:a3/be/8c,rgb:bf/61/6a,rgb:b4/8e/ad,rgb:88/c0/d0,rgb:d0/87/70,rgb:3b/42/52,rgb:4c/56/6a
+bar_color_selected[1] = rgb:88/c0/d0
+bar_font_color[1] = rgb:ec/ef/f4,rgb:2e/34/40,rgb:2e/34/40,rgb:eb/cb/8b,rgb:a3/be/8c,rgb:bf/61/6a,rgb:b4/8e/ad,rgb:88/c0/d0,rgb:d0/87/70,rgb:3b/42/52,rgb:4c/56/6a
+bar_font = Blex Mono Nerd Font:pixelsize=15:antialias=true
+bar_action = ~/.config/spectrwm/baraction.sh
+bar_action_expand = 1
+bar_justify = right
+bar_format = +|L +@bg=0;+S +L +@bg=0; +@bg=8; +C +@fg=0; +|2R +A +@bg=0;+@fg=0; %a, %b %d %R +<
+bar_at_bottom = 0
+workspace_indicator = listall,markcurrent
+stack_enabled = 1
+clock_enabled = 1
+clock_format = %a, %b %d %R
+iconic_enabled = 1
+maximize_hide_bar = 0
+window_class_enabled = 1
+window_instance_enabled = 1
+window_name_enabled = 0
+verbose_layout = 0
+urgent_enabled = 1
+urgent_collapse = 0
+
+ # Autorunning applications
+autorun = ws[1]:nitrogen --set-auto ~/Pictures/walls/paranoid.jpg &
+autorun = ws[1]:setxkbmap -layout latam &
+autorun = ws[1]:alacritty
+autorun = ws[1]:volumeicon
+autorun = ws[1]:xfce4-power-manager
+autorun = ws[1]:syncthing
+autorun = ws[1]:nm-applet &
+autorun = ws[1]:lxpolkit &
+autorun = ws[1]:picom --experimental-backends --backend glx --blur-method 'dual_kawase' --blur-strength 6
+
+ # Workspace names and modkey
+layout = ws[1]:4:0:0:0:vertical
+name = ws[1]:WEB
+name = ws[2]:DEV
+name = ws[3]:MAIL
+name = ws[4]:FILE
+name = ws[5]:CHAT
+name = ws[6]:SSH
+name = ws[7]:EMACS
+name = ws[8]:TERM
+name = ws[9]:ETC
+# ", " ", " ", " ", " ", " ", " ", " ", " ", " "
+modkey = Mod4
+
+ # Quirks and custom per program behavior
+quirk[firefox:Dialog] = FLOAT + MINIMALBORDER + TRANSSZ
+quirk[Image Lounge] = FLOAT
+quirk[firefox] = IGNOREPID + TRANSSZ + ANYWHERE
+quirk[Thunderbird] = ANYWHERE + IGNORESPAWNWS + IGNOREPID + TRANSSZ
+quirk[Claws-mail] = ANYWHERE + IGNORESPAWNWS + IGNOREPID + TRANSSZ
+quirk[Xarchiver] = ANYWHERE + IGNORESPAWNWS + IGNOREPID + TRANSSZ
+quirk[Lxappearance] = FLOAT
+quirk[Pavucontrol] = FLOAT
+quirk[Volumeicon] = FLOAT + ANYWHERE + IGNORESPAWNWS + IGNOREPID
+quirk[discord:Discord Updater] = FLOAT + IGNOREPID
+quirk[stalonetray] = FLOAT + ANYWHERE
+quirk[trayer] = FLOAT + ANYWHERE + NOFOCUSCYCLE + MINIMALBORDER + NOFOCUSONMAP
+quirk[Lxpolkit] = FLOAT + IGNOREPID +FOCUSPREV + IGNORESPAWNWS
+quirk[Xfce4-power-manager-settings] = FLOAT + ANYWHERE
+quirk[Nm-connection-editor] = ANYWHERE + IGNORESPAWNWS + FLOAT
+quirk[Pcmanfm] = ANYWHERE + IGNORESPAWNWS
+quirk[Thunar] = ANYWHERE + IGNORESPAWNWS
+
+ # General keybindings
+bind[] = MOD+x
+bind[] = MOD+v
+bind[bar_toggle] = MOD+b
+bind[bar_toggle_ws] = MOD+Shift+b
+bind[cycle_layout] = MOD+space
+bind[flip_layout] = MOD+Shift+backslash
+bind[float_toggle] = MOD+t
+bind[focus_main] = MOD+m
+bind[focus_next] = MOD+j
+bind[focus_next] = MOD+Tab
+bind[focus_prev] = MOD+k
+bind[focus_prev] = MOD+Shift+Tab
+bind[focus_urgent] = MOD+u
+bind[height_grow] = MOD+Shift+equal
+bind[height_shrink] = MOD+Shift+minus
+bind[iconify] = MOD+w
+bind[initscr] = MOD+Shift+i
+bind[lock] = MOD+Shift+Delete
+bind[master_add] = MOD+Shift+comma
+bind[master_del] = MOD+Shift+period
+bind[master_grow] = MOD+l
+bind[master_shrink] = MOD+h
+bind[maximize_toggle] = MOD+e
+bind[move_down] = MOD+Shift+bracketright
+bind[move_left] = MOD+bracketleft
+bind[move_right] = MOD+bracketright
+bind[move_up] = MOD+Shift+bracketleft
+bind[mvrg_1] = MOD+Shift+KP_End
+bind[mvrg_2] = MOD+Shift+KP_Down
+bind[mvrg_3] = MOD+Shift+KP_Next
+bind[mvrg_4] = MOD+Shift+KP_Left
+bind[mvrg_5] = MOD+Shift+KP_Begin
+bind[mvrg_6] = MOD+Shift+KP_Right
+bind[mvrg_7] = MOD+Shift+KP_Home
+bind[mvrg_8] = MOD+Shift+KP_Up
+bind[mvrg_9] = MOD+Shift+KP_Prior
+bind[mvws_1] = MOD+Shift+1
+bind[mvws_2] = MOD+Shift+2
+bind[mvws_3] = MOD+Shift+3
+bind[mvws_4] = MOD+Shift+4
+bind[mvws_5] = MOD+Shift+5
+bind[mvws_6] = MOD+Shift+6
+bind[mvws_7] = MOD+Shift+7
+bind[mvws_8] = MOD+Shift+8
+bind[mvws_9] = MOD+Shift+9
+bind[mvws_10] = MOD+Shift+0
+bind[mvws_11] = MOD+Shift+F1
+bind[mvws_12] = MOD+Shift+F2
+bind[mvws_13] = MOD+Shift+F3
+bind[mvws_14] = MOD+Shift+F4
+bind[mvws_15] = MOD+Shift+F5
+bind[mvws_16] = MOD+Shift+F6
+bind[mvws_17] = MOD+Shift+F7
+bind[mvws_18] = MOD+Shift+F8
+bind[mvws_19] = MOD+Shift+F9
+bind[mvws_20] = MOD+Shift+F10
+bind[mvws_21] = MOD+Shift+F11
+bind[mvws_22] = MOD+Shift+F12
+bind[name_workspace] = MOD+Shift+slash
+bind[quit] = MOD+Control+q
+bind[raise_toggle] = MOD+Control+r
+bind[restart] = MOD+Shift+r
+bind[rg_1] = MOD+KP_End
+bind[rg_2] = MOD+KP_Down
+bind[rg_3] = MOD+KP_Next
+bind[rg_4] = MOD+KP_Left
+bind[rg_5] = MOD+KP_Begin
+bind[rg_6] = MOD+KP_Right
+bind[rg_7] = MOD+KP_Home
+bind[rg_8] = MOD+KP_Up
+bind[rg_9] = MOD+KP_Prior
+bind[rg_next] = MOD+period
+bind[rg_prev] = MOD+comma
+bind[screenshot_all] = MOD+s
+bind[screenshot_wind] = MOD+Shift+s
+bind[search_win] = MOD+f
+bind[search_workspace] = MOD+slash
+bind[stack_dec] = MOD+Shift+period
+bind[stack_inc] = MOD+Shift+comma
+bind[stack_reset] = MOD+Shift+space
+bind[swap_next] = MOD+Shift+j
+bind[swap_prev] = MOD+Shift+k
+bind[uniconify] = MOD+Shift+w
+bind[version] = MOD+Shift+v
+bind[width_grow] = MOD+equal
+bind[width_shrink] = MOD+minus
+bind[wind_del] = MOD+q
+bind[ws_1] = MOD+1
+bind[ws_2] = MOD+2
+bind[ws_3] = MOD+3
+bind[ws_4] = MOD+4
+bind[ws_5] = MOD+5
+bind[ws_6] = MOD+6
+bind[ws_7] = MOD+7
+bind[ws_8] = MOD+8
+bind[ws_9] = MOD+9
+bind[ws_10] = MOD+0
+bind[ws_11] = MOD+F1
+bind[ws_12] = MOD+F2
+bind[ws_13] = MOD+F3
+bind[ws_14] = MOD+F4
+bind[ws_15] = MOD+F5
+bind[ws_16] = MOD+F6
+bind[ws_17] = MOD+F7
+bind[ws_18] = MOD+F8
+bind[ws_19] = MOD+F9
+bind[ws_20] = MOD+F10
+bind[ws_21] = MOD+F11
+bind[ws_22] = MOD+F12
+bind[ws_next_all] = MOD+Right
+bind[ws_next] = MOD+Up
+bind[ws_next_move] = MOD+Shift+Right
+bind[ws_prev_all] = MOD+Left
+bind[ws_prev] = MOD+Down
+bind[ws_prev_move] = MOD+Shift+Left
+bind[ws_prior] = MOD+a
+
+ # Custom program keybindings
+program[Discord] = discord
+bind[Discord] = MOD+mod1+d
+program[term] = alacritty
+bind[term] = MOD+Return
+program[rofi_run] = rofi -show run
+bind[rofi_run] = MOD+r
+program[post] = ~/.config/rofi/scripts/qpost.sh
+bind[post] = MOD+mod1+p
+program[rofi_pass] = rofi-pass
+bind[rofi_pass] = MOD+mod1+k
+program[tab_switch] = rofi -show window
+bind[tab_switch] = Mod1+Tab
+program[rofi] = rofi -show drun
+bind[rofi] = MOD+p
+program[power_menu] = ~/.config/rofi/scripts/power-menu.sh
+bind[power_menu] = MOD+Shift+q
+program[screenshot] = flameshot gui
+bind[screenshot] = MOD+Shift+s
+program[firefox] = firefox
+bind[firefox] = MOD+Mod1+b
+program[pcmanfm] = pcmanfm
+bind[pcmanfm] = MOD+Mod1+f
+program[pulsemixer] = alacritty -e pulsemixer
+bind[pulsemixer] = MOD+mod1+v