Skip to content

Commit 708bf1f

Browse files
committed
add xsession
1 parent 5acf48f commit 708bf1f

File tree

8 files changed

+256
-0
lines changed

8 files changed

+256
-0
lines changed

bin/xorg/wlr-autorandr

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
if ! command -v autorandr >/dev/null 2>&1; then
5+
exit
6+
fi
7+
8+
target="$(autorandr --detected)"
9+
override_script="$HOME/.screenlayout/autorandr-$target.sh"
10+
11+
if [ -x "$override_script" ]; then
12+
"$override_script"
13+
else
14+
autorandr --change
15+
fi

dotfiles/.Xresources

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
! Common
2+
#define S_yellow #b58900
3+
#define S_orange #cb4b16
4+
#define S_red #dc322f
5+
#define S_magenta #d33682
6+
#define S_violet #6c71c4
7+
#define S_blue #268bd2
8+
#define S_cyan #2aa198
9+
#define S_green #859900
10+
! Dark
11+
#define S_base03 #002b36
12+
#define S_base02 #073642
13+
#define S_base01 #586e75
14+
#define S_base00 #657b83
15+
#define S_base0 #839496
16+
#define S_base1 #93a1a1
17+
#define S_base2 #eee8d5
18+
#define S_base3 #fdf6e3
19+
*background: S_base03
20+
*foreground: S_base0
21+
*fading: 40
22+
*fadeColor: S_base03
23+
*cursorColor: S_base1
24+
*pointerColorBackground: S_base01
25+
*pointerColorForeground: S_base1
26+
*color0: S_base02
27+
*color1: S_red
28+
*color2: S_green
29+
*color3: S_yellow
30+
*color4: S_blue
31+
*color5: S_magenta
32+
*color6: S_cyan
33+
*color7: S_base2
34+
*color8: S_base03
35+
*color9: S_orange
36+
*color10: S_base01
37+
*color11: S_base00
38+
*color12: S_base0
39+
*color13: S_violet
40+
*color14: S_base1
41+
*color15: S_base3
42+
Xft.dpi: 96
43+
URxvt*fading: 0
44+
URxvt*scrollBar: false
45+
URxvt*scrollTtyOutput: false
46+
URxvt*scrollTtyKeypress: true
47+
URxvt*scrollWithBuffer: true
48+
URxvt*secondaryScreen: 1
49+
URxvt*secondaryScroll: 0
50+
URxvt*secondaryWheel: 1
51+
URxvt.perl-ext-common: default,matcher
52+
URxvt.url-launcher: xdg-open
53+
URxvt.matcher.button: 1
54+
URxvt.iso14755: false
55+
URxvt.iso14755_52: false
56+
URxvt.font: xft:monospace:pixelsize=12

dotfiles/.config/gallery-dl/config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"base-directory": ".",
66
"directory": ["{id}"],
77
"filename": "{num}.{filename}.{extension}",
8+
"text-posts": true,
89
"imgur": {
910
"directory": ["media", "{id[0]}", "{id[1]}"],
1011
"filename": "{filename}.{extension}",

dotfiles/.xinitrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
. "$HOME/.wlrenv/xorg/xsession.sh"

dotfiles/.xsession

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
. "$HOME/.wlrenv/xorg/xsession.sh"

keyboard/xkb/pc.xkb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
xkb_keymap {
2+
xkb_keycodes { include "evdev+aliases(qwerty)" };
3+
xkb_types { include "complete" };
4+
xkb_compat { include "complete" };
5+
xkb_symbols { include "pc+us(dvorak-programisto)" };
6+
xkb_geometry { include "pc(pc104)" };
7+
};

keyboard/xkb/symbols/us

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
default partial alphanumeric_keys
2+
xkb_symbols "dvorak-programisto" {
3+
name[Group1]= "English (Programisto Dvorak)";
4+
5+
key <TLDE> { [ dollar , asciitilde , grave , dead_tilde ] };
6+
7+
key <AE01> { [ ampersand , percent ] };
8+
key <AE02> { [ bracketleft , 0 ] };
9+
key <AE03> { [ braceleft , 1 ] };
10+
key <AE04> { [ parenleft , 2 ] };
11+
key <AE05> { [ plus , 3 ] };
12+
key <AE06> { [ equal , 4 ] };
13+
key <AE07> { [ asterisk , 5 ] };
14+
key <AE08> { [ parenright , 6 ] };
15+
key <AE09> { [ braceright , 7 ] };
16+
key <AE10> { [ bracketright , 8 ] };
17+
key <AE11> { [ exclam , 9 ] };
18+
key <AE12> { [ numbersign , grave , numbersign , dead_grave ] };
19+
20+
key <CAPS> { [ Alt_L ] };
21+
22+
key <AD01> { [ apostrophe , quotedbl ] };
23+
key <AD02> { [ comma , less ] };
24+
key <AD03> { [ period , greater ] };
25+
key <AD04> { [ p , P ] };
26+
key <AD05> { [ y , Y ] };
27+
key <AD06> { [ f , F ] };
28+
key <AD07> { [ g , G ] };
29+
key <AD08> { [ c , C ] };
30+
key <AD09> { [ r , R ] };
31+
key <AD10> { [ l , L ] };
32+
key <AD11> { [ slash , question ] };
33+
key <AD12> { [ at , asciicircum ] };
34+
key <BKSL> { [ backslash , bar , notsign , brokenbar ] };
35+
36+
key <AC01> { [ a , A ] };
37+
key <AC02> { [ o , O ] };
38+
key <AC03> { [ e , E ] };
39+
key <AC04> { [ u , U ] };
40+
key <AC05> { [ i , I ] };
41+
key <AC06> { [ d , D ] };
42+
key <AC07> { [ h , H ] };
43+
key <AC08> { [ t , T ] };
44+
key <AC09> { [ n , N ] };
45+
key <AC10> { [ s , S ] };
46+
key <AC11> { [ minus , underscore ] };
47+
48+
key <AB01> { [ semicolon , colon ] };
49+
key <AB02> { [ q , Q ] };
50+
key <AB03> { [ j , J ] };
51+
key <AB04> { [ k , K ] };
52+
key <AB05> { [ x , X ] };
53+
key <AB06> { [ b , B ] };
54+
key <AB07> { [ m , M ] };
55+
key <AB08> { [ w , W ] };
56+
key <AB09> { [ v , V ] };
57+
key <AB10> { [ z , Z ] };
58+
};

xorg/xsession.sh

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
#!/bin/bash
2+
3+
export _JAVA_AWT_WM_NONREPARENTING=1
4+
5+
cmd_exists() {
6+
for cmd in "$@"; do
7+
if ! command -v "$1" >/dev/null 2>&1; then
8+
return 1
9+
fi
10+
done
11+
return 0
12+
}
13+
14+
first_cmd() {
15+
for cmd in "$@"; do
16+
if cmd_exists "$cmd"; then
17+
echo "$cmd"
18+
return 0
19+
fi
20+
done
21+
return 1
22+
}
23+
24+
cmd_exists qt5ct && export QT_QPA_PLATFORMTHEME=qt5ct
25+
26+
if editor="$(first_cmd subl3 subl)"; then
27+
export EDITOR="$editor -nw"
28+
fi
29+
30+
if browser="$(first_cmd google-chrome-stable chromium firefox)"; then
31+
export BROWSER="$browser"
32+
fi
33+
34+
export TERMINAL=xterm
35+
if terminal="$(first_cmd alacritty kitty urxvt)"; then
36+
export TERMINAL="$terminal"
37+
fi
38+
39+
[ -f '/etc/X11/xinit/.Xresources' ] && xrdb -merge '/etc/X11/xinit/.Xresources'
40+
[ -f "$HOME/.Xresources" ] && xrdb -merge "$HOME/.Xresources"
41+
42+
cmd_exists numlockx && numlockx on
43+
cmd_exists i3status xmodar && i3status | xmobar &
44+
cmd_exists xbindkeys && xbindkeys
45+
46+
if cmd_exists xautolock i3lock; then
47+
LOCKER='i3lock -fc000000 --ring-color=b5890080 --keyhl-color=b58900 --bshl-color=dc322f --verif-text= --insidever-color=00000000 --ringver-color=859900 --wrong-color=dc322f --insidewrong-color=00000000 --ringwrong-color=dc322f'
48+
xautolock -time 10 -detectsleep -locker "$LOCKER" &
49+
cmd_exists caffeine && caffeine &
50+
fi
51+
52+
if [ -d '/etc/X11/xinit/xinitrc.d' ] ; then
53+
for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
54+
[ -x "$f" ] && . "$f"
55+
done
56+
unset f
57+
fi
58+
59+
# These lines race on some systems. No idea why.
60+
xsetroot -cursor_name left_ptr
61+
# TODO figure out how to combine this with the below: setxkbmap -option ctrl:nocaps
62+
xkbcomp -I"$HOME/.wlrenv/keyboard/xkb" "$HOME/.wlrenv/keyboard/xkb/pc.xkb" "$DISPLAY"
63+
# TODO this started causing some hosts to render all windows as pure black, no idea why
64+
#xrandr --dpi 96
65+
66+
cmd_exists xcape && xcape
67+
68+
if cmd_exists redshift; then
69+
redshift &
70+
redshift_pid=$!
71+
fi
72+
73+
wlr-autorandr
74+
75+
if [ "$HOME/.xmonad/xmonad-x86_64-linux" -ot "$(which xmonad)" ]; then
76+
xmonad --recompile
77+
fi
78+
79+
if [ -f "$HOME/.xmonad/xmonad.state" ]; then
80+
printf 'Removing malignant xmonad.state file...\n'
81+
rm "$HOME/.xmonad/xmonad.state"
82+
fi
83+
84+
systemctl --user import-environment PATH DBUS_SESSION_BUS_ADDRESS
85+
systemctl --no-block --user start xsession.target
86+
87+
if [ -n "${XBACKLIGHT:-}" ] && cmd_exists xbacklight; then
88+
xbacklight -set "$XBACKLIGHT"
89+
fi
90+
91+
if [ -n "$NO_DPMS" ]; then
92+
xset s off -dpms
93+
fi
94+
95+
if [ "${BARRIER_SERVER:-}" == localhost ]; then
96+
if cmd_exists barriers; then
97+
# if barriers launches before xmonad, Xorg hangs (!) when barrier takes control
98+
# should probably make xmonad launch this kind of thing
99+
( sleep 10; barriers --enable-crypto ) &
100+
fi
101+
elif [ -n "${BARRIER_SERVER:-}" ]; then
102+
if cmd_exists barrierc; then
103+
# if barriers launches before xmonad, Xorg hangs (!) when barrier takes control
104+
# should probably make xmonad launch this kind of thing
105+
( sleep 10; barrierc --enable-crypto "$BARRIER_SERVER" ) &
106+
fi
107+
fi
108+
109+
xmonad
110+
111+
systemctl --no-block --user stop xsession.target
112+
113+
[ -n "${redshift_pid:-}" && kill "$redshift_pid"

0 commit comments

Comments
 (0)