-
Notifications
You must be signed in to change notification settings - Fork 0
/
i3setup.sh
executable file
·136 lines (119 loc) · 5.12 KB
/
i3setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#!/bin/sh
##
# Source in ~/.profile to handle switching from MATE<->i3
#
# In MORNINGSTAR (Dell XPS 15 9550)
# - Enable natural and horizontal scrolling
# - Main Display is eDP-1 on intel, eDP-1-1 on nvidia
# - Configure the external monitor (if connected)
# - Touchpad ID is 06CB:7A13
#
# In DEMOGORGON:
# - Fix the monitor arrangement
#
# In CAPRICA:
# - Fix the monitor arrangement
##
if [ "$(hostname)" = "CAPRICA" ]; then
xrandr \
--output DP-3 --mode 1920x1080 \
--output HDMI-0 --primary --mode 1920x1080 --right-of DP-3 \
--output DVI-I-1 --mode 1920x1080 --right-of HDMI-0
elif [ "$(hostname)" = "DEMOGORGON" ]; then
# Fix the workstation's monitors
xrandr \
--output DP-6 --mode 2560x1440 --scale-from 3840x2160 --panning 3840x2160+0+0 \
--output DP-4 --mode 3840x2160 --pos 3840x0 --scale 1x1 --primary \
--output DP-0 --mode 3840x2160 --pos 7680x0 --scale 1x1
elif [ "$(hostname)" = "MORNINGSTAR" ]; then
if [ "$(prime-select query)" = "nvidia" ]; then
MAIN_DISPLAY="eDP-1-1"
EXT_DISPLAY="HDMI-1-1"
else
MAIN_DISPLAY="eDP-1"
EXT_DISPLAY="HDMI-1"
fi
#xrandr --output ${MAIN_DISPLAY} --primary --mode 3840x2160
#if [ ! -z "$(xrandr | grep "${EXT_DISPLAY} connected")" ]; then
# xrandr --output ${EXT_DISPLAY} --mode 1920x1080 --scale-from 3840x2160 --panning 3840x2160+3840+0 --right-of ${MAIN_DISPLAY}
#fi
# Drop to 1080p so the system's actually usable.
xrandr --output ${MAIN_DISPLAY} --primary --mode 1920x1080
if [ ! -z "$(xrandr | grep "${EXT_DISPLAY} connected")" ]; then
xrandr --output ${EXT_DISPLAY} --mode 1920x1080 --right-of ${MAIN_DISPLAY} --scale 1x1 --panning 0x0
fi
unset MAIN_DISPLAY
unset EXT_DISPLAY
TOUCHPAD_ID=$(xinput list --id-only 'DLL06E4:01 06CB:7A13 Touchpad')
if [ ! -z ${TOUCHPAD_ID} ]; then
xinput set-prop ${TOUCHPAD_ID} 'libinput Natural Scrolling Enabled' 1
xinput set-prop ${TOUCHPAD_ID} 'libinput Horizontal Scroll Enabled' 1
xinput set-prop ${TOUCHPAD_ID} 'libinput Tapping Enabled' 1
fi
unset TOUCHPAD_ID
elif [ "$(hostname)" = "ANUBIS" ]; then
TOUCHPAD_ID=$(xinput list --id-only 'SynPS/2 Synaptics TouchPad')
if [ ! -z ${TOUCHPAD_ID} ]; then
xinput set-prop ${TOUCHPAD_ID} 'libinput Natural Scrolling Enabled' 1
xinput set-prop ${TOUCHPAD_ID} 'libinput Horizontal Scroll Enabled' 1
xinput set-prop ${TOUCHPAD_ID} 'libinput Tapping Enabled' 1
fi
unset TOUCHPAD_ID
fi
RESOLUTION=$(xrandr -q | sed -nr 's/^.+primary\s+([0-9]+x[0-9]+).+$/\1/p')
if [ "${XDG_CURRENT_DESKTOP}" = "MATE" -o "${XDG_CURRENT_DESKTOP}" = "mate" ]; then
unset GDK_SCALE
xrandr --dpi 96
if [ "${RESOLUTION}" = "3840x2160" ]; then
export QT_SCALE_FACTOR=2
dconf write /org/mate/desktop/interface/window-scaling-factor 2
dconf write /org/gnome/desktop/interface/scaling-factor 2
# Needs this to be explicitly set otherwise it's wayyy too big
dconf write /org/mate/desktop/font-rendering/dpi 96
else
export QT_SCALE_FACTOR=1
dconf write /org/mate/desktop/interface/window-scaling-factor 1
dconf write /org/gnome/desktop/interface/scaling-factor 1
fi
# Remap Alt-to-move
dconf write /org/gnome/desktop/wm/preferences/mouse-button-modifier "'<Control><Alt><Space>'"
dconf write /org/mate/marco/general/mouse-button-modifier "'<Control><Alt><Space>'"
dconf write /org/mate/settings-daemon/plugins/media-keys/home "'<Mod4>e'"
dconf write /org/mate/marco/global-keybindings/run-command-terminal "'<Primary><Alt>t'"
# Kill automount
dconf write /org/mate/desktop/media-handling/automount-open false
dconf write /org/mate/desktop/media-handling/automount false
# Fix themes
dconf write /org/mate/marco/general/theme "'Arc-Dark'"
dconf write /org/mate/desktop/interface/gtk-theme "'Arc-Dark'"
dconf write /org/mate/desktop/interface/icon-theme "'Papirus-Dark'"
dconf write /org/mate/desktop/peripherals/mouse/cursor-theme "'mate-black'"
# Configure Keyboard Layouts
dconf write /org/mate/desktop/peripherals/keyboard/kbd/layouts "['us', 'ru']"
dconf write /org/mate/desktop/peripherals/keyboard/kbd/options "['grp\tgrp:alt_caps_toggle', 'terminate\tterminate:ctrl_alt_bksp']"
# Fix touchpad on the laptops
if [ "$(hostname)" = "MORNINGSTAR" -o "$(hostname)" = "BAST" ]; then
dconf write /org/mate/desktop/peripherals/touchpad/horizontal-two-finger-scrolling true
dconf write /org/mate/desktop/peripherals/touchpad/natural-scroll true
dconf write /org/mate/desktop/peripherals/touchpad/tap-to-click true
dconf write /org/mate/marco/general/compositing-manager true
elif [ "$(hostname)" = "CAPRICA" -o "$(hostname)" = "DEMOGORGON" ]; then
# On Nvidia cards, picom's handling this
dconf write /org/mate/marco/general/compositing-manager false
fi
elif [ "${XDG_CURRENT_DESKTOP}" = "i3" ]; then
if [ "${RESOLUTION}" = "3840x2160" ]; then
export GDK_SCALE=2
export QT_SCALE_FACTOR=2
xrandr --dpi 235
dconf write /org/mate/desktop/interface/window-scaling-factor 2
dconf write /org/gnome/desktop/interface/scaling-factor 2
else
unset GDK_SCALE
unset QT_SCALE_FACTOR
xrandr --dpi 96
dconf write /org/mate/desktop/interface/window-scaling-factor 1
dconf write /org/gnome/desktop/interface/scaling-factor 1
fi
fi
unset RESOLUTION