dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit 5981458a7099c4c8853a89eafc2d29c56092e246
parent 7a796b6be394145d397b5da0ab13b817e345781a
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Tue,  1 Oct 2019 21:59:59 +0200

Minimize X configuration

Diffstat:
D.local/bin/calcurse_reminders.py | 68--------------------------------------------------------------------
D.local/bin/wallpaper | 24------------------------
M.profile | 5++---
M.xprofile | 27+++++----------------------
4 files changed, 7 insertions(+), 117 deletions(-)

diff --git a/.local/bin/calcurse_reminders.py b/.local/bin/calcurse_reminders.py @@ -1,68 +0,0 @@ -#!/usr/bin/env python3 -import subprocess -import time -import sys - -warn = int(sys.argv[1]) - -def get(command): - return subprocess.check_output(command).decode("utf-8") - -def convert(t): - # convert set time into a calculate- able time - return [int(n) for n in t.split(":")] - -def calc_diff(t_curr, t_event): - # calculate time span - diff_hr = (t_event[0] - t_curr[0])*60 - diff_m = t_event[1] - t_curr[1] - return diff_hr + diff_m - -def cleanup(done, newlist): - # clean up "done" -lists - for item in done: - if not item in newlist: - done.remove(item) - return done - -def show_time(event, s = ""): - # show scheduled event - hrs = str(event[0][0]); mnts = str(event[0][1]) - mnts = "0"+mnts if len(mnts) != 2 else mnts - subprocess.call(["notify-send", "--urgency=critical", s, "At "+hrs+":"+mnts+" - "+event[1]]) - -startups = []; times = [] - -while True: - currtime = convert(time.strftime("%H:%M")) - events = [l.strip() for l in get(["calcurse", "-a"]).splitlines()][1:] - # arrange event data: - groups = []; sub = [] - for l in events: - if l.startswith("* "): - groups.append([l.replace("* ", "")]) - elif l.startswith("- "): - sub.append(convert(l.split("->")[0].replace("-", "").strip())) - else: - groups.append(sub+[l]) - sub = [] - # run notifications - for item in groups: - # on startup: - if not item in startups: - # all- day events - if len(item) == 1: - subprocess.call(["notify-send", "--urgency=critical", "Today - "+item[0]]) - # time- specific events - elif len(item) == 2: - show_time(item, "Appointment") - startups.append(item) - # as a reminder: - if all([len(item) == 2, not item in times]): - span = calc_diff(currtime, item[0]) - if span <= warn: - show_time(item, "[Reminder]") - times.append(item) - # clean up events - startups = cleanup(startups, groups); times = cleanup(times, groups) - time.sleep(30) diff --git a/.local/bin/wallpaper b/.local/bin/wallpaper @@ -1,24 +0,0 @@ -#!/bin/sh -#hsetroot -fill ~/wallpapers/fall.jpg # single screen -#hsetroot -full ~/wallpapers/hackingtheloop_1920.jpg # single screen -#hsetroot -fill ~/wallpapers/polygon-art-17498.jpg -#hsetroot -fill ~/photos/wallpapers/current_wallpapers/overdeepenings-Edit-Edit.jpg - -# statusfile="$HOME/.wallpaper" -# -# function get_random_wallpaper { -# wallpapers=($1/*.{jpg,JPG,jpeg,JPEG,png,PNG,tif,TIF,tiff,TIFF}) -# printf "%s\n" "${wallpapers[RANDOM % ${#wallpapers[@]}]}" -# #echo $wallpapers -# } -# -# function set_wallpaper { -# feh --bg-scale "$1" -# echo "$1" > $statusfile # written to ~/.fehbg -# } -# -# dir="$HOME/photos/wallpapers/google_earth/" -# wallpaper=$(get_random_wallpaper "$dir") -# set_wallpaper "$wallpaper" - -xsetroot -solid "$(rg '\*\.background:' ~/.Xresources | awk '{ print $2 }')" diff --git a/.profile b/.profile @@ -1,6 +1,5 @@ # sh/ksh initialization -PATH=$HOME/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin:/usr/games -ENV="$HOME/.kshrc" - +PATH=$HOME/.local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin:/usr/games export PATH HOME TERM ENV +. $HOME/.kshrc diff --git a/.xprofile b/.xprofile @@ -1,33 +1,17 @@ #!/bin/sh -# Set normal cursor -xsetroot -cursor_name left_ptr & +xsetroot -solid "$(sed -n 's/^\*\.background: #/#/p' ~/.Xresources)" -# Set background -wallpaper - -# Set display color profile #[ -f ~/doc/colorprofile.icc ] && xcalib ~/doc/colorprofile.icc -# Start auth deamons -eval "$(ssh-agent)" eval "$(gpg-agent)" +if [ -z "$SSH_AUTH_SOCK" ] ; then + eval $(ssh-agent -s) + ssh-add +fi -# Automatically suspend system after 20 mins of inactivity -xautolock -time 10 -locker xlock -detectsleep & - -# see /usr/share/X11/xkb/rules/evdev.lst for options setxkbmap -option ctrl:nocaps #-option altwin:swap_lalt_lwin -if [ "$(hostname)" != "phony" ]; then - kelvin_day=6500 # default: 6500 K - kelvin_night=2300 # default: 4500 K - lat=56.09;lon=10.12 # Aarhus - #lat=37.25;lon=-122.9 # Stanford - #lat=32.84;lon=-117.26 # San Diego - redshift -l $lat:$lon -t $kelvin_day:$kelvin_night & -fi - xset -b # Disable beeps xset +dpms # Energy Star features on xset dpms 300 600 900 # standby -> suspend -> off (seconds) @@ -37,5 +21,4 @@ xset r rate 300 50 # key repeat rate ([delay in ms] [repeats per sec]) # auto-start programs sxhkd & dunst & -calcurse_reminders.py 15 & dwmstatus &