diff --git a/builds/jsfw.nix b/builds/jsfw.nix index 428be77..0f612c1 100644 --- a/builds/jsfw.nix +++ b/builds/jsfw.nix @@ -15,7 +15,7 @@ stdenv.mkDerivation rec { }; buildPhase = '' - make jsfw + VERBOSE=1 make jsfw ''; installPhase = '' diff --git a/lappy/background.jpg b/lappy/background.jpg new file mode 100644 index 0000000..c22784c Binary files /dev/null and b/lappy/background.jpg differ diff --git a/lappy/builds/utils.nix b/lappy/builds/utils.nix index bdb36f6..5a20976 100644 --- a/lappy/builds/utils.nix +++ b/lappy/builds/utils.nix @@ -3,6 +3,7 @@ , pkgs # shell scripts stuff , makeWrapper +, kbd # for chvt , xclip , rbw }: @@ -14,14 +15,14 @@ stdenv.mkDerivation rec { src = ./utils; nativeBuildInputs = [ makeWrapper ]; - buildInputs = [ xclip rbw ]; + buildInputs = [ xclip kbd rbw ]; installPhase = '' mkdir -p $out/bin for i in $(ls $src/); do cp $src/$i $out/bin - wrapProgram $out/bin/$i --prefix PATH : ${lib.makeBinPath [ xclip rbw ]} + wrapProgram $out/bin/$i --prefix PATH : ${lib.makeBinPath [ xclip kbd rbw ]} done ''; } diff --git a/lappy/builds/utils/blackhole b/lappy/builds/utils/blackhole new file mode 100755 index 0000000..7fa45e3 --- /dev/null +++ b/lappy/builds/utils/blackhole @@ -0,0 +1,7 @@ +#!/bin/sh + +sudo echo "" +chvt 6 +sleep 2 +sudo stty -echo -F /dev/tty6 +sudo /run/current-system/sw/bin/jsfw server 24800 /home/usr/dots/lappy/jsfw.json >/dev/null diff --git a/lappy/builds/utils/khalmacs b/lappy/builds/utils/khalmacs new file mode 100755 index 0000000..8dd785e --- /dev/null +++ b/lappy/builds/utils/khalmacs @@ -0,0 +1,43 @@ +#!/bin/sh + +print_help() { + echo " +this is khalmacs. + +builtin-options: + - regular + - late + " +} + +case $1 in + "regular") + khal new -g school -a home $2 07:40 08:27 AP Computer Science + khal new -g school -a home $2 08:34 09:19 Chemistry I H + khal new -g school -a home $2 09:29 10:14 AP Precalculus + khal new -g school -a home $2 10:21 11:06 AP European History + khal new -g school -a home $2 11:06 11:08 Flex Check time + khal new -g school -a home $2 11:15 12:05 Wind Ensemble H + khal new -g school -a home $2 12:12 12:37 SAIL + khal new -g school -a home $2 12:37 13:02 Lunch + khal new -g school -a home $2 13:09 13:54 English II H + khal new -g school -a home $2 14:01 14:47 Spanish III H + ;; + "late") + khal new -g school -a home $2 08:25 09:08 AP Computer Science + khal new -g school -a home $2 09:15 09:56 Chemistry I H + khal new -g school -a home $2 10:06 10:47 AP Precalculus + khal new -g school -a home $2 10:54 11:33 AP European History + khal new -g school -a home $2 11:33 11:35 Flex Check time + khal new -g school -a home $2 11:41 12:22 Wind Ensemble H + khal new -g school -a home $2 12:29 13:10 Lunch + khal new -g school -a home $2 13:17 13:58 English II H + khal new -g school -a home $2 14:05 14:47 Spanish III H + ;; + *) + print_help + ;; + "help") + print_help + ;; +esac diff --git a/lappy/builds/utils/status b/lappy/builds/utils/status index 714804c..4ec6e7f 100755 --- a/lappy/builds/utils/status +++ b/lappy/builds/utils/status @@ -8,13 +8,61 @@ else enable -f /lib/bash/sleep sleep fi +schedule_needs_update="yes" + +get_schedule_info () { + if [ "$schedule_needs_update" = "yes" ]; then + output=$( + khal at now --format '{title}|{end-time}|{categories}' | \ + awk -F'|' '{if($3 == "school") { print $1 "|" $2 }}' + ) + + if [ -z "$output" ]; then + schedule_needs_update="no" + schedule_status="" + return + fi + + class_name=${output%%|*} + schedule_time=${output##*|} + schedule_time_hours=${schedule_time%%:*} + schedule_time_minutes=${schedule_time##*:} + schedule_time_unix=$(date --date "$schedule_time" "+%s") + + schedule_needs_update="no" + fi + + printf -v current_time '%(%s)T' -1 + difference=$(($schedule_time_unix - $current_time)) + if [ "$difference" -lt 0 ]; then + schedule_needs_update="yes" + get_schedule_info + fi + until_end=$(($difference / 60)) + + if [ "$until_end" -le 5 ]; then + until_end_seconds=$(($difference % 60)) + schedule_status=$(printf "%02d:%02d left in %s/" "$until_end" "$until_end_seconds" "$class_name") + else + schedule_status=$(printf "%d minutes left in %s/" "$until_end" "$class_name") + fi +} + get_cmus_info () { if [ /dev/shm/status/cmus -nt /dev/shm/status/modified ]; then - cmus_status=$(