Skip to content

Instantly share code, notes, and snippets.

@3demax
Created January 16, 2012 16:18
Show Gist options
  • Save 3demax/1621595 to your computer and use it in GitHub Desktop.
Save 3demax/1621595 to your computer and use it in GitHub Desktop.
rc.lua for lualock simpleblack theme
#!/bin/bash
sudo ln -s `pwd`/rc.lua /etc/xdg/lualock/rc.lua -f
sudo ln -s `pwd`/img/ /usr/share/lualock/data/simpleblack
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.0"
width="22"
height="22"
id="svg3167"
sodipodi:version="0.32"
inkscape:version="0.47 r22583"
sodipodi:docname="nm-signal-25.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape">
<metadata
id="metadata18">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<sodipodi:namedview
inkscape:window-height="753"
inkscape:window-width="1280"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
guidetolerance="10.0"
gridtolerance="10.0"
objecttolerance="10.0"
borderopacity="1.0"
bordercolor="#666666"
pagecolor="#ffffff"
id="base"
showgrid="false"
inkscape:zoom="7.3362329"
inkscape:cx="-16.32527"
inkscape:cy="12"
inkscape:window-x="0"
inkscape:window-y="24"
inkscape:current-layer="svg3167"
inkscape:window-maximized="1" />
<defs
id="defs3169">
<linearGradient
x1="66.09668"
y1="9.3638258"
x2="66.09668"
y2="27.363825"
id="linearGradient2395"
xlink:href="#linearGradient3678"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(-52.096803,-7.363826)" />
<linearGradient
x1="14"
y1="3"
x2="14"
y2="21"
id="linearGradient3177"
xlink:href="#linearGradient3678"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(-1.0001235,-1)" />
<linearGradient
id="linearGradient3678">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop3680" />
<stop
style="stop-color:#e6e6e6;stop-opacity:1;"
offset="1"
id="stop3682" />
</linearGradient>
<linearGradient
gradientTransform="matrix(-0.4100229,0,0,0.5447147,78.029995,-3.8459034)"
gradientUnits="userSpaceOnUse"
xlink:href="#linearGradient3678"
id="linearGradient2388"
y2="38.279892"
x2="159.68553"
y1="14.403693"
x1="159.68553" />
</defs>
<path
d="M 12.971363,18.223407 C 12.884814,18.304188 10.974534,20.5 10.974534,20.5 C 10.974534,20.5 9.0824435,18.285633 9.0114535,18.223407 C 9.1383195,18.120264 9.6561155,17.71465 10.978659,17.720434 C 12.280013,17.726134 12.872244,18.123429 12.971363,18.223407 L 12.971363,18.223407 z"
id="path3375-2"
style="opacity:0.5;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;overflow:visible" />
<path
d="M 13.146798,16.709046 C 13.052548,16.790336 10.972279,19 10.972279,19 C 10.972279,19 8.911818,16.771664 8.8345108,16.709046 C 8.9726655,16.605252 9.5365385,16.197079 10.976771,16.2029 C 12.393928,16.2086 13.038859,16.608437 13.146798,16.709046 L 13.146798,16.709046 z"
id="path3375"
style="opacity:1;fill:url(#linearGradient3177);fill-opacity:1;fill-rule:evenodd;stroke:none;overflow:visible" />
<g
id="g3625"
style="opacity:0.4">
<path
style="opacity:0.50000000000000000;fill:none;stroke:#000000;stroke-width:1.62394821999999994;stroke-linecap:butt;stroke-linejoin:miter;marker:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
id="path3209-4"
d="M 8.0435287,15.541611 C 8.0435287,15.541611 8.6057337,14.688743 10.917018,14.662365 C 13.282811,14.635365 14.120438,15.705247 14.120438,15.705247 M 5.2784117,12.563637 C 5.2784117,12.563637 7.196683,10.603146 10.982131,10.678445 C 14.767579,10.753745 16.685849,12.656844 16.685849,12.656844 M 2.4362401,9.563637 C 2.4362401,9.563637 5.0265877,6.5708846 10.982131,6.5708846 C 16.937675,6.5708846 19.563514,9.54958 19.563514,9.54958" />
<path
style="opacity:1;fill:none;stroke:url(#linearGradient2395);stroke-width:1.70000005000000010;stroke-linecap:butt;stroke-linejoin:miter;marker:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
id="path3209"
d="M 6.7706663,14.449448 C 6.7706663,14.449448 7.7891705,13.158446 10.909645,13.12554 C 13.991216,13.09304 15.170316,14.449448 15.170316,14.449448 M 4.0564876,11.452688 C 4.0564876,11.452688 6.2918592,9.030303 10.980552,9.116488 C 15.708135,9.203388 17.904614,11.491594 17.904614,11.491594 M 1.199,8.4137962 C 1.199,8.4137962 4.3028827,4.983016 10.980552,4.983016 C 17.625393,4.983016 20.800755,8.4196184 20.800755,8.4196184" />
</g>
</svg>
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
require "odious"
local oocairo = require "oocairo"
-- {{{ lualock settings
background("color", "#000000")
--im = image(utils.get_data_dir() .. "/simpleblack/archlinux-official-light.svg")
----im:scale(0.75, 0.75)
--im:set_position(utils.screen_width()/2 - 600/2, 0.2)
--im:show()
im = image(utils.get_data_dir() .. "/simpleblack/panel.png")
--im:scale(0.75, 0.75)
--im:set_position(utils.screen_width()/2 - 600/2, 0.2)
im:set_position(utils.screen_width()/2 - 600/2, utils.screen_height()/2 - 400/2)
im:show()
sxcenter = utils.screen_width()/2
sycenter = utils.screen_height()/2
input_top = sycenter + 50
--panel = image(utils.get_data_dir() .. "/simpleblack/panel_transp1.png")
--panel:set_position(utils.screen_width()/2 - 300/2, input_top-50)
--panel:show()
style{ color = "black", font = "Sans 24",
x = sxcenter - 150/2 - 24,
y = input_top + 50,
off_x = 10,
off_y = 10,
width = 199,
height = 50,
bg_color = 'rgba(0, 0, 0, 0)',
border_color = 'rgba(0, 0, 0, 0)',
border_width = 2
}
prefs{ timeout = 10 * 60 }
user_text = odious.widget.text{ text = os.getenv("USER"), font = "Sans 24", color = "black",
x = sxcenter - 92,
y = input_top + 10,
border_color = "black", border_width = 0
}
-- }}}
-- define functions for setting and restoring DPMS settings
local dpms = {
set = function (standby, suspend, off)
utils.spawn(string.format("xset dpms %i %i %i", standby, suspend, off))
end,
get = function ()
local xset_out = odious.util.pread("xset q")
local standby, suspend, off =
string.match(xset_out, "Standby: (%d+).*Suspend: (%d+).*Off: (%d+)")
return tonumber(standby) or 0, tonumber(suspend) or 0, tonumber(off) or 0
end
}
-- {{{ Hooks
-- get current DPMS settings
local standby, suspend, off = dpms.get()
hook.connect("lock", function ()
dpms.set(60, 120, 300)
end)
-- restore DPMS settings once we're done
hook.connect("unlock", function ()
dpms.set(standby, suspend, off)
end)
-- show a dot for each failed login attempt
--evildot = utils.get_data_dir() .. "/glowydot.png"
--failed_attempts = 0
--hook.connect("auth-failed", function ()
-- local dot = image(evildot)
-- dot:set_position(500 + 20 * failed_attempts, 440)
-- dot:show()
-- failed_attempts = failed_attempts + 1
--end)
-- }}}
-- {{{
-- SYSTRAY
function update_systray()
print("systray " .. os.date("*t").min .. ":" .. os.date("*t").sec)
right = utils.screen_width()
-- systray = image(right, 30)
-- systray:set_position(0, 0)
-- --systray:draw_rectangle(0, 0, 100, 100, true, "#ff0000")
-- systray:show()
systray = odious.widget.progressbar{ width = right, height = 30, x = 0, y = 0 }
systray:set_border_color("black"):set_vertical(false):set_color("#000000")
systray:set_value(100)
-- CLOCK
-- right = right - 175
top = 3
local update_clock = function()
local time = os.date("*t")
local sec = time.sec
local file = assert(io.popen("date +\"%a, %b %e %H:%M\"", 'r'))
local output = file:read('*all')
file:close()
output = string.gsub(output, "\n", "")
systray:set_value(100)
local clock_text = odious.widget.text{ text = "" .. output, font = "Droid Sans 16", color = "#ffffff",
x = utils.screen_width()/2 - 85,
y = 5,
border_color = "#000000", border_width = 3 }
end
update_clock()
-- BATTERY
right = right - 45
batt_box = odious.widget.progressbar{ width = 30, height = 16, x = right+0, y = top+1 }
batt_box:set_border_color("#dddddd"):set_vertical(false):set_color("#dddddd")
batt_box_pip = odious.widget.progressbar{ width = 3, height = 10, x = right+30, y = top+4 }
batt_box_pip:set_border_color("#dddddd"):set_vertical(false):set_color("#dddddd")
batt_box_pip:set_value(100)
function update_battery ()
local batt_info = odious.util.get_battery("BAT0")
local level = batt_info.charge_now / batt_info.charge_full
-- level = math.random()
-- level = 100
batt_box:set_value(level)
if (level <= 0.15) then
batt_box:set_color("#d70000")
end
if (level == 1) then
level = ""
else
level = math.floor(level*100) .. "%"
end
local batt_text = odious.widget.text{ text = level .. "", font = "Sans 8", color = "#000000",
x = right,
y = top,
border_color = "#dddddd", border_width = 3 }
end
update_battery()
-- network
right = right - 35
local file = assert(io.popen("nm-tool", 'r'))
local output = file:read('*all')
file:close()
string.gsub(output, "\nState: (.-)\n", function(a) print("[network]", a); state = a; end)
if (state == "disconnected") then
path = "nm-no-connection.svg"
else
path = "nm-signal-100.svg"
end
print("[path]", path)
network_icon = image(utils.get_data_dir() .. "/simpleblack/" .. path)
network_icon:scale(1, 1)
network_icon:set_position(right, 0)
network_icon:show()
end
local first_update = function ()
update_systray()
local systray_timer = timer(update_systray, 60)
systray_timer:start()
end
-- align update_systray timer to the start of the minute
local once = function ()
first_update()
once_timer:stop()
print("once timer stopped")
end
once_timer = timer(once, 60-os.date("*t").sec)
once_timer:start()
update_systray()
-- }}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment