-. $HOME/lib/login_variables.private.sh # Personal data variables
+# XXX Setting the scaling variables causes inconsistent response from apps.
+# However, launching mate-appearance-properties after startx - causes
+# something to be adjusted and most apps scale up correctly. With some
+# exceptions, like zeal.
+#. $HOME/lib/login_variables_dpi.sh
+. $HOME/lib/login_variables.private.sh
+. $HOME/lib/login_variables.sh
+. $HOME/lib/login_functions.sh
unalias d 2> /dev/null || true # Defined by oh-my-zsh, but I want it for dict/fzf function.
-
-for file in $HOME/lib/login_*.sh
-do
- . $file
-done
+. $HOME/lib/login_aliases.sh
umask 077
eval "$(ssh-agent)"
fi
-status
+## TODO Rename status to motd
+case "$-" in
+ # Only execute if shell is interactive.
+ *i*) status;;
+esac
printf '\n'
+# TODO File per quote. Seed rng with date and select quote of the day.
#awk \
# -v RS='' \
# 'BEGIN {srand()} {fortunes[n++] = $0} END {print fortunes[int(n * rand())]}' \
"emacs"
Mod4 + Shift + e
-# Edit specific files
-"cd ~/doc/TODO && gvim TODO.md"
+
+### Edit specific files
+
+"todo.launch.sh"
Mod4 + t
+
"cd ~/doc/ideas && gvim ideas.md"
Mod4 + i
#"cd ~/doc/drafts && drafts_prepend && gvim -c NERDTreeFind drafts.md"
"cd ~/doc/quotations && gvim quotations.md"
Mod4 + q
+
# File browser
"pcmanfm"
Mod4 + f
set -e
+launch_then_killall() {
+ local -r program="$1"
+ local -r timeout="${2:-1}" # 2nd arg or default to 1.
+
+ "$program"&
+ sleep "$timeout"
+ killall "$program"
+}
+
+dpi_scale() {
+ # IDK what magic is at work here, but launching mate-appearance-properties
+ # does the job better than setting scaling variables.
+ # TODO Get to the bottom of how it works and replicate directly.
+ launch_then_killall 'mate-appearance-properties' 1
+
+ # GDK 3 (GTK 3)
+ # https://wiki.archlinux.org/index.php/HiDPI#GDK_3_(GTK_3)
+ #export GDK_SCALE=2
+
+ # QT
+ # https://wiki.archlinux.org/index.php/HiDPI#Qt_5
+ # https://doc.qt.io/qt-5/highdpi.html
+ # https://blog.qt.io/blog/2016/01/26/high-dpi-support-in-qt-5-6/
+ #export QT_SCALE_FACTOR=2 # Causes qutebrowser UI fonts to have large gaps.
+ #export QT_FONT_DPI=192 # Scales qutebrowser UI fonts as expected.
+}
launch_common() {
xbindkeys
xscreensaver &
- mpd --kill || true
- mpd
+ dpi_scale&
+ #mpd --kill || true
+ #mpd
for script in ~/.xlaunch.d/*; do
"$script"
done
+++ /dev/null
-#! /bin/bash
-
-set -e
-
-DIR_DATA="$HOME/var/run/today"
-FILE_WEATHER="$DIR_DATA/weather"
-
-mkdir -p "$DIR_DATA"
-
-repeat() {
- x="$1"
- n="$2"
- awk -v x="$x" -v n="$n" 'BEGIN {for (i=1; i<=n; i++) {printf x}}'
-}
-
-bar=$(repeat '-' '80')
-ts_fmt='+%A, %Y %B %d, %H:%M:%S'
-ts_lang='el_GR.UTF-8'
-timestamp_local=$(LANG="$ts_lang" date "$ts_fmt")
-timestamp_west=$( LANG="$ts_lang" TZ='US/Pacific' date "$ts_fmt")
-timestamp_pl=$( LANG="$ts_lang" TZ='Poland' date "$ts_fmt")
-timestamp_nz=$( LANG="$ts_lang" TZ='NZ' date "$ts_fmt")
-
-ip_addresses=$(
- ip addr \
- | awk '
- /^[0-9]+:/ {
- interface = $2
- sub(":$", "", interface)
- interfaces[++interface_count] = interface
- }
-
- /^ +inet +/ {
- addr = $2
- sub("/[0-9]+$", "", addr)
- addrs[interface] = addr
- }
-
- END {
- for (i=1; i<=interface_count; i++) {
- interface = interfaces[i]
- print interface, addrs[interface]
- }
- }' \
- | column -t
-)
-
-weather_fetch() {
- curl "http://wttr.in/${ZIP_CODE}?1" \
- 1> "$FILE_WEATHER" \
- 2> /dev/null
-}
-
-weather_file_age() {
- echo $(( $(date +%s) - $(stat -c '%Y' "$FILE_WEATHER") ))
-}
-
-weather_get_or_fetch() {
- weather_file_age_limit=$(( 3 * 60 * 60 ))
- if [[ ! -e $FILE_WEATHER || weather_file_age -ge $weather_file_age_limit ]]
- then
- weather_fetch
- fi
- cat "$FILE_WEATHER"
-}
-
-weather="$(weather_get_or_fetch)"
-
-clear
-#LANG="$ts_lang" ncal -M $(date +%Y)
-LANG="$ts_lang" ncal -M
-echo "$bar"
-(
- echo 'LOCAL' ',' "$timestamp_local"
- echo 'Pacific' ',' "$timestamp_west"
- echo 'Poland' ',' "$timestamp_pl"
- echo 'New Zealand' ',' "$timestamp_nz"
-) \
-| column -ts,
-echo "$bar"
-echo "$ip_addresses"
-echo "$bar"
-echo ''
-echo "Fetched on: $(stat -c %y $FILE_WEATHER)"
-echo "$weather"
-echo ''
--- /dev/null
+#! /bin/bash
+
+. ~/lib/login_variables.sh # To get $DIR_TODO
+. ~/lib/login_functions.sh # To get todo
+
+EDITOR=gvim todo
#alias startx='printf "Use a specialized startx-...\n"'
alias mans='man $(man -k . | sort | fzf -e | awk "{print \$1}")'
alias twread='twtxt timeline --limit 1000 | less'
-alias todo='cd ~/doc/TODO && vim TODO.md'
alias work_todo="cd $DIR_WORK/docs/TODO && vim -c NERDTreeFind TODO"
alias drafts='cd ~/doc/drafts && drafts_prepend && vim -c NERDTreeFind drafts.md'
alias notes='cd ~/doc/notes && notes_prepend && vim notes.md'
git clone "$1"
}
+todo() {
+ local date
+ local timestamp
+ local bar
+ date=$(date +%F)
+ timestamp=$(date '+%F %A')
+ bar=$(for _ in {1..80}; do printf '='; done)
+ local -r dir="$DIR_TODO/daily"
+ local -r file="$dir/$date.txt"
+
+ mkdir -p "$dir"
+ if [ ! -f "$file" ]
+ then
+ printf '%s\n%s\n%s\n' "$bar" "$timestamp" "$bar" > "$file"
+ fi
+ cd "$DIR_TODO" && "$EDITOR" "$file"
+}
+
work_log_template() {
cat << EOF
$(date '+%F %A')
export DIR_LOG_MPD="$DIR_LOG/mpd"
export DIR_NQ="$HOME/var/run/nq"
export DIR_WALLPAPERS="$HOME/arc/img/Wallpapers"
+export DIR_TODO="$HOME/doc/TODO"
# ensure all DIRs exist:
env | grep ^DIR_ | awk -F= '{print $2}' | xargs -I% mkdir -p '%'
# Gambit Scheme
export PATH=$PATH:/usr/local/Gambit/bin
-# DPI
-. "$HOME/lib/login_variables_dpi.sh"
-
# Doom
export PATH=$PATH:$HOME/.emacs.d/bin