This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
random_wallpaper="$(find $1 -maxdepth 1 -name *.png | shuf | head -1)" | |
actual_size="$(identify -format %wx%h $random_wallpaper)" | |
target_size=$(xrandr | head -n 1 | awk -e '{OFS=""; gsub("[ ,]+","",$10); print $8,"x",$10;}') | |
if [[ "$actual_size" != "$target_size" ]]; then | |
convert "$random_wallpaper" -background black -gravity center -scale $target_size -extent $target_size png:- | i3lock -i /proc/self/fd/0 | |
else | |
i3lock -t -i "$random_wallpaper" | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:- use_module(library(clpfd)). | |
/* | |
Show a sublist of <Pos> in <Sublist>. | |
<Offset> Offset into <Pos> | |
<Step> Step size used in iterating through <Pos> | |
<Length> Length of the sublist. | |
*/ | |
getSublist(_,_,_,0,[]). % base case |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Create a battery widget | |
mybatterywidget = widget({type="textbox"}) | |
-- do not forget to add the widget to your panel ;-) | |
-- display the current charge (in %) and the charging/discharging rate (in W) | |
-- for the battery identified by <adapter> | |
function show_battery(adapter) | |
local fcur = io.open("/sys/class/power_supply/"..adapter.."/charge_now") | |
local fcap = io.open("/sys/class/power_supply/"..adapter.."/charge_full") |