]> git.phdru.name Git - dotfiles.git/blob - .xinitrc
.xinitrc: calculate geometry for `xclock`
[dotfiles.git] / .xinitrc
1 #!/bin/sh
2
3 # Add X authorization for all host names
4 if xauth list | grep -Fq -- -eth; then
5    if xauth list | grep -Fq -- -wifi; then
6       # Nothing to do
7       :
8    else
9       xauth list | sed -e 's/^/add /' -e 's/-eth/-wifi/' | xauth
10    fi
11 elif xauth list | grep -Fq -- -wifi; then
12    xauth list | sed -e 's/^/add /' -e 's/-wifi/-eth/' | xauth
13 fi
14
15 PATH="$PATH":/usr/games
16
17 # Set initial background
18 xsetroot -solid DarkCyan
19 xli -border darkcyan -center -onroot -quiet -zoom auto "`$HOME/current/projects/xsetbg/print-filename.py -e koi8-r`"
20
21 # load .Xdefaults/.Xresources
22 if [ -f "$HOME"/lib/X11/.Xdefaults ]; then
23     xrdb -merge -I"$HOME" "$HOME"/lib/X11/.Xdefaults
24 fi
25 if [ -f "$HOME"/lib/X11/.Xresources ]; then
26    xrdb -merge -I"$HOME" "$HOME"/lib/X11/.Xresources
27 fi
28
29 # SUN OpenWindows
30 #if [ -f "$HOME"/lib/X11/.OWdefaults ]; then
31 #    xrdb -merge -nocpp "$HOME"/lib/X11/.OWdefaults  # Load Users OW resource database
32 #fi
33 #if [ -f "$OPENWINHOME"/lib/Xdefaults ]; then
34 #   xrdb -merge "$OPENWINHOME"/lib/Xdefaults # Load Default X11 resource database
35 #fi
36
37 #if [ -x "$HOME"/lib/X11/.openwin-init ]; then
38 #    "$HOME"/lib/X11/.openwin-init   # Custom OpenWindows tools
39 #elif [ -x "$OPENWINHOME"/lib/openwin-init ]; then
40 #    "$OPENWINHOME"/lib/openwin-init    # Default OpenWindows tools
41 #fi
42
43 # EN/RU, switch on RightAlt and both Shifts,
44 # Compose: RightControl, Level3:RightMenu.
45 setxkbmap -layout '' -variant '' -option ''
46 setxkbmap -layout 'us,ru' -variant ',common' -option 'grp:toggle,grp:shifts_toggle,compose:rctrl,lv3:menu_switch'
47 # Terminate X session on Ctrl+Alt+Backspace
48 #setxkbmap -option terminate:ctrl_alt_bksp
49
50 # adjust key bindings (if any)
51 #[ -f "$HOME"/lib/X11/.Xmodmap ] && xmodmap "$HOME"/lib/X11/.Xmodmap
52
53 # X settings: shorter beep
54 #xset b 50 400 50
55 # mouse acceleration
56 #xset m 5/2
57 # keyboard autorepeat
58 xset r on
59 # screen saver 5 minutes
60 xset s 300 300
61 # DPMS on desktop: standby - 1 hour, suspend - 2 hours, off - 4 hours
62 #xset dpms 3600 7200 14400
63 # DPMS on notebook: standby - 10 minutes, suspend - 15 minutes, off - 20 minutes
64 xset dpms 600 900 1200
65
66 xscreensaver &
67 xbindkeys
68 xxkb &
69
70 synclient AccelFactor=0.1 MaxDoubleTapTime=80 MaxSpeed=1 RightEdge=5000 \
71    TapButton1=1 TapButton2=2 TapButton3=3 HorizEdgeScroll=1 VertEdgeScroll=1
72
73 # Turn mouse off on keyboard activity; turn it back on after 1 second
74 #syndaemon -dt -i1
75
76 # start a small console shell
77 #xterm -C -geometry 80x8-0+0 -n Console -T Consle -ls +ut -fn 6x10 &
78
79 screen_width=`xrandr --current | head -1 | awk '{print $8}'`
80 if [ $screen_width = 1024 ]; then
81    xclcok_geom=85x85+400+1
82 elif [ $screen_width = 1600 ]; then
83    xclcok_geom=100x100+600+1
84 elif [ $screen_width = 1920 ]; then
85    xclcok_geom=150x150+880+1
86 fi
87 test -n "$xclcok_geom" && xclock -geometry $xclcok_geom -bg white -update 1 &
88 unset screen_width xclcok_geom
89
90 # multi-biff
91 #xbuffy -fn '-*-helvetica-bold-r-*-*-*-100-*-*-*-*-koi8-r' -geometry +0+125 -boxfile mail/misc/.xbuffyrc &
92
93 if [ -z "$WINDOW_MANAGER" ]; then
94    WINDOW_MANAGER=fvwm2
95    export WINDOW_MANAGER
96 fi
97
98 dbus-launch --exit-with-session gpg-agent --daemon "$WINDOW_MANAGER"
99
100 # Stop pulseaudio, xscreensaver and xsetbg.py
101 pulseaudio -k
102 xscreensaver-command -exit &
103 "$HOME"/current/projects/xsetbg/xsetbg-http-stop &