lot o updates

master
Paul Walko 2021-07-21 14:00:12 -04:00
parent b2be5c0d4a
commit f444d5693a
11 changed files with 374 additions and 58 deletions

29
10-thinkpad-p53-xorg.conf Normal file
View File

@ -0,0 +1,29 @@
Section "ServerLayout"
Identifier "layout"
Screen 0 "nvidia"
Inactive "intel"
EndSection
Section "Device"
Identifier "nvidia"
Driver "nvidia"
BusID "PCI:1:0:0"
EndSection
Section "Screen"
Identifier "nvidia"
Device "nvidia"
Option "AllowEmptyInitialConfiguration"
EndSection
Section "Device"
Identifier "intel"
Driver "modesetting"
BusID "PCI:0:2:0"
#Option "AccelMethod" "none"
EndSection
Section "Screen"
Identifier "intel"
Device "intel"
EndSection

View File

@ -3,14 +3,15 @@ MKDIR_FLAGS = -pv
home_symlinks = Xresources xbindkeysrc xinitrc vimrc vim tmux.conf gitconfig bashrc
config_copy =
# apparmor doesn't work with symlinks (redshift)
config_copy = redshift
config_symlinks = i3 alacritty
gnupg_symlinks = gpg-agent.conf
local_install: Xresources xbindkeysrc xinitrc vimrc vim i3 gitconfig gpg-agent.conf bashrc alacritty
local_install: Xresources xbindkeysrc xinitrc vimrc vim i3 gitconfig gpg-agent.conf bashrc alacritty redshift
mac_local_install: vimrc vim gpg-agent.conf tmux.conf bashrc
@ -26,7 +27,7 @@ $(home_symlinks):
$(config_copy):
$(eval DESTDIR := $(shell dirname ~/.config/$@))
mkdir $(MKDIR_FLAGS) $(DESTDIR)
test -e $(CURDIR)/$@ && cp --remove-destination -p $(CURDIR)/$@ ~/.config/$@
test -e $(CURDIR)/$@ && cp -r --remove-destination -p $(CURDIR)/$@ ~/.config/$@
.PHONY: $(config_symlinks)
$(config_symlinks):

View File

@ -1,2 +1,29 @@
font:
size: 10
colors:
primary:
foreground: '#ffb000' # amber
background: '#000000' # black
bright_foreground: '#ffffff'
# The 'GNOME Dark" theme from GNOME terminal.
normal:
black: '#171421'
red: '#c01c28'
green: '#26a269'
yellow: '#a2734c'
blue: '#12488b'
magenta: '#a347ba'
cyan: '#2aa1b3'
white: '#d0cfcc'
bright:
black: '#5e5c64'
red: '#f66151'
green: '#33d17a'
yellow: '#e9ad0c'
blue: '#2a7bde'
magenta: '#c061cb'
cyan: '#33c7de'
white: '#ffffff'

23
bashrc
View File

@ -16,11 +16,7 @@ export PATH=$HOME/.local/bin:$PATH
export PATH=$HOME/.local/share/google-cloud-sdk/bin:$PATH
export PATH=$HOME/.local/share/alacritty/target/release:$PATH
export PATH=/usr/NX/bin:$PATH
if [[ -z $TMUX ]]; then
export TERM='xterm-256color'
else
export TERM='screen-256color'
fi
export TERM=xterm-256color
# Bash completion
if [ -f /etc/bash_completion ]; then
@ -72,4 +68,19 @@ fi
## Reduce delay swithing between normal & insert mode
export KEYTIMEOUT=1
[[ -s "/home/paul/.gvm/scripts/gvm" ]] && source "/home/paul/.gvm/scripts/gvm"
[[ -s "$HOME/.gvm/scripts/gvm" ]] && source "$HOME/.gvm/scripts/gvm"
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
# qr codes
alias qr='qrencode -t ansiutf8'
# jwt
function jwtd() {
sed 's/\./\n/g' <<< $(cut -d. -f1,2 <<< $1) | base64 --decode | jq
}
# rbenv
eval "$(rbenv init -)"

91
i3/compton.conf Normal file
View File

@ -0,0 +1,91 @@
## Shadow
#shadow = true;
#no-dnd-shadow = true;
#no-dock-shadow = true;
#clear-shadow = true;
#shadow-radius = 7;
#shadow-offset-x = -7;
#shadow-offset-y = -7;
## shadow-opacity = 0.7;
## shadow-red = 0.0;
## shadow-green = 0.0;
## shadow-blue = 0.0;
#shadow-exclude = [
# "name = 'Notification'",
# "class_g = 'Conky'",
# "class_g ?= 'Notify-osd'",
# "class_g = 'Cairo-clock'",
# "_GTK_FRAME_EXTENTS@:c"
#];
## shadow-exclude = "n:e:Notification";
## shadow-exclude-reg = "x10+0+0";
## xinerama-shadow-crop = true;
#
## Opacity
#menu-opacity = 0.8;
#inactive-opacity = 0.8;
## active-opacity = 0.8;
#frame-opacity = 0.7;
#inactive-opacity-override = false;
#alpha-step = 0.06;
## inactive-dim = 0.2;
## inactive-dim-fixed = true;
## blur-background = true;
## blur-background-frame = true;
#blur-kern = "3x3box";
## blur-kern = "5,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1";
## blur-background-fixed = true;
#blur-background-exclude = [
# "window_type = 'dock'",
# "window_type = 'desktop'",
# "_GTK_FRAME_EXTENTS@:c"
#];
## opacity-rule = [ "80:class_g = 'URxvt'" ];
#
## Fading
#fading = true;
## fade-delta = 30;
#fade-in-step = 0.03;
#fade-out-step = 0.03;
## no-fading-openclose = true;
## no-fading-destroyed-argb = true;
#fade-exclude = [ ];
#
## Other
#backend = "xrender";
#mark-wmwin-focused = true;
#mark-ovredir-focused = true;
## use-ewmh-active-win = true;
#detect-rounded-corners = true;
#detect-client-opacity = true;
#refresh-rate = 0;
#vsync = "none";
#dbe = false;
#paint-on-overlay = true;
## sw-opti = true;
## unredir-if-possible = true;
## unredir-if-possible-delay = 5000;
## unredir-if-possible-exclude = [ ];
#focus-exclude = [ "class_g = 'Cairo-clock'" ];
#detect-transient = true;
#detect-client-leader = true;
#invert-color-include = [ ];
## resize-damage = 1;
#
## GLX backend
## glx-no-stencil = true;
#glx-copy-from-front = false;
## glx-use-copysubbuffermesa = true;
## glx-no-rebind-pixmap = true;
#glx-swap-method = "undefined";
## glx-use-gpushader4 = true;
## xrender-sync = true;
## xrender-sync-fence = true;
#
## Window type settings
#wintypes:
#{
# tooltip = { fade = true; shadow = true; opacity = 0.75; focus = true; };
#};
#
opacity-rule = ["10:name = 'i3lock'"]

View File

@ -123,44 +123,32 @@ bindsym $mod+Shift+r restart
# exit i3 (logs you out of your X session)
bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'"
# resize window (you can also use the mouse for that)
mode "resize" {
# These bindings trigger as soon as you enter the resize mode
# Pressing left will shrink the windows width.
# Pressing right will grow the windows width.
# Pressing up will shrink the windows height.
# Pressing down will grow the windows height.
bindsym j resize shrink width 10 px or 10 ppt
bindsym k resize grow height 10 px or 10 ppt
bindsym l resize shrink height 10 px or 10 ppt
bindsym semicolon resize grow width 10 px or 10 ppt
# same bindings, but for the arrow keys
bindsym Left resize shrink width 10 px or 10 ppt
bindsym Down resize grow height 10 px or 10 ppt
bindsym Up resize shrink height 10 px or 10 ppt
bindsym Right resize grow width 10 px or 10 ppt
# back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $mod+r mode "resize"
# Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available)
bar {
tray_output primary
status_command i3status
}
# Custom stats
# Custom config
default_border pixel 1
exec $HOME/.screenlayout/main.sh
workspace 1 output HDMI-A-1
workspace 2 output HDMI-A-0
#workspace 3 output DVI-I-1
exec $HOME/.screenlayout/dock.sh
# Only moves workspace if output
workspace 1 output DP-0
workspace 2 output DP-0
workspace 3 output eDP-1-1
workspace 4 output eDP-1-1
workspace 10 output eDP-1-1
# Move whole workspace
bindsym $mod+o move workspace to output left
bindsym $mod+p move workspace to output right
# Change between laptop/dock
bindsym $mod+Shift+o exec $HOME/.screenlayout/dock.sh
bindsym $mod+Shift+p exec $HOME/.screenlayout/laptop.sh
# Misc
bindsym $mod+Shift+f focus parent; fullscreen; focus child
#i3lock
bindsym $mod+x exec i3lock -c 000000
bindsym $mod+x exec $HOME/.config/i3/matrixlock.py

98
i3/matrixlock.py Executable file
View File

@ -0,0 +1,98 @@
#!/usr/bin/python3
from argparse import ArgumentParser
from http.server import BaseHTTPRequestHandler, HTTPServer
from os.path import dirname, join
from subprocess import run, Popen, DEVNULL
from threading import Thread, Event
from time import time
import json
def main(matrix_delay_secs):
workspaces = get_workspaces()
visible = [ws for ws in workspaces if ws['visible']]
with SubprocessServer(('', 0), len(visible)) as server:
port = server.server_address[1]
for ws in visible:
overlay_matrix_on_workspace(ws['name'], port, matrix_delay_secs)
run(['i3lock', '-n'], check=True)
for pid_path in server.received_posts:
assert pid_path.startswith('/'), pid_path
try:
pid = int(pid_path[1:])
except ValueError:
continue
run(['kill', str(pid)])
def get_workspaces():
cp = run(
['i3-msg', '-t', 'get_workspaces'],
capture_output=True, check=True, text=True
)
return json.loads(cp.stdout)
def overlay_matrix_on_workspace(ws_name, port, delay):
run([
'i3-msg',
f'workspace {ws_name}; '
# There may already be a full-screen app on that workspace.
# This would prevent us from showing the Matrix full-screen.
# So disable fullscreen first.
f'fullscreen disable; '
# --color-text=black to hide the cursor when there is a delay.
f'exec "xfce4-terminal --hide-scrollbar --hide-menubar --fullscreen --color-text=black '
# Send child PID to server so the parent can kill it, then show Matrix:
f'-x bash -c \'curl -X POST localhost:{port}/$$ && sleep {delay} && cmatrix -b\'"'
], check=True, stdout=DEVNULL)
class SubprocessServer(HTTPServer):
"""
Process up to num_requests POST requests in up to timeout_secs seconds and
store their paths in self.received_posts.
"""
def __init__(self, server_address, num_requests, timeout_secs=5):
super().__init__(server_address, SubprocessHandler)
self.received_posts = []
self._num_requests = num_requests
self._timeout_secs = timeout_secs
self._thread = Thread(target=self._run_in_thread)
self._started = Event()
self._timeout_encountered = False
def __enter__(self):
result = super().__enter__()
self._thread.start()
self._started.wait()
return result
def __exit__(self, *args, **kwargs):
self._thread.join()
def _run_in_thread(self):
self._started.set()
end = time() + self._timeout_secs
for _ in range(self._num_requests):
time_remaining = end - time()
if time_remaining < 0:
break
self.timeout = time_remaining
self.handle_request()
if self._timeout_encountered:
break
def handle_timeout(self):
self._timeout_encountered = True
class SubprocessHandler(BaseHTTPRequestHandler):
def do_POST(self):
self.server.received_posts.append(self.path)
self.send_response(200)
self.end_headers()
def log_message(self, format, *args):
return
if __name__ == '__main__':
parser = ArgumentParser(description='Alternative to i3lock that displays the Matrix')
parser.add_argument(
'delay', type=int, nargs='?', default=0,
help='Seconds between blanking out the screen and starting the Matrix'
)
args = parser.parse_args()
main(args.delay)

70
redshift/redshift.conf Normal file
View File

@ -0,0 +1,70 @@
; Global settings for redshift
[redshift]
; Set the day and night screen temperatures
temp-day=5700
temp-night=3500
; Disable the smooth fade between temperatures when Redshift starts and stops.
; 0 will cause an immediate change between screen temperatures.
; 1 will gradually apply the new screen temperature over a couple of seconds.
fade=1
; Solar elevation thresholds.
; By default, Redshift will use the current elevation of the sun to determine
; whether it is daytime, night or in transition (dawn/dusk). When the sun is
; above the degrees specified with elevation-high it is considered daytime and
; below elevation-low it is considered night.
;elevation-high=3
;elevation-low=-6
; Custom dawn/dusk intervals.
; Instead of using the solar elevation, the time intervals of dawn and dusk
; can be specified manually. The times must be specified as HH:MM in 24-hour
; format.
;dawn-time=6:00-7:45
;dusk-time=18:35-20:15
; Set the screen brightness. Default is 1.0.
;brightness=0.9
; It is also possible to use different settings for day and night
; since version 1.8.
;brightness-day=0.7
;brightness-night=0.4
; Set the screen gamma (for all colors, or each color channel
; individually)
gamma=0.8
;gamma=0.8:0.7:0.8
; This can also be set individually for day and night since
; version 1.10.
;gamma-day=0.8:0.7:0.8
;gamma-night=0.6
; Set the location-provider: 'geoclue2', 'manual'
; type 'redshift -l list' to see possible values.
; The location provider settings are in a different section.
location-provider=manual
; Set the adjustment-method: 'randr', 'vidmode'
; type 'redshift -m list' to see all possible values.
; 'randr' is the preferred method, 'vidmode' is an older API.
; but works in some cases when 'randr' does not.
; The adjustment method settings are in a different section.
adjustment-method=randr
; Configuration of the location-provider:
; type 'redshift -l PROVIDER:help' to see the settings.
; ex: 'redshift -l manual:help'
; Keep in mind that longitudes west of Greenwich (e.g. the Americas)
; are negative numbers.
[manual]
lat=48.1
lon=11.6
; Configuration of the adjustment-method
; type 'redshift -m METHOD:help' to see the settings.
; ex: 'redshift -m randr:help'
; In this example, randr is configured to adjust only screen 0.
; Note that the numbering starts from 0, so this is actually the first screen.
; If this option is not specified, Redshift will try to adjust _all_ screens.
[randr]
screen=0

3
vimrc
View File

@ -101,6 +101,3 @@ noremap <leader>7 : 7b<CR>
noremap <leader>8 : 8b<CR>
noremap <leader>9 : 9b<CR>
noremap <leader>10 : 10b<CR>
"" Scroll stuff
set mouse=a

View File

@ -1,13 +1,13 @@
"amixer -c 1 set Master 5%+"
"pactl set-sink-volume @DEFAULT_SINK@ +5%"
XF86AudioRaiseVolume
"amixer -c 1 set Master 5%-"
"pactl set-sink-volume @DEFAULT_SINK@ -5%"
XF86AudioLowerVolume
"amixer -c 1 set Master toggle && amixer -c 1 set Speaker unmute"
"pactl set-sink-mute @DEFAULT_SINK@ toggle"
XF86AudioMute
"amixer -c 1 set Capture toggle"
"pactl set-source-mute @DEFAULT_SOURCE@ toggle"
XF86AudioMicMute
# See http://haikarainen.github.io/light/ for udev rules
@ -26,9 +26,8 @@
"light -S 100"
XF86LaunchA
"chromium --app-id=bikioccmkafdpakkkcpdbppfkghcmihk"
XF86Explorer
#"i3lock"
# Super_L
"light -S 100"
XF86Favorites
"arandr"
XF86Display

13
xinitrc
View File

@ -2,10 +2,11 @@
[ -f ~/.Xresources ] && xrdb -merge .Xresources
xsetroot -cursor_name left_ptr
xset -b
HOSTNAME=$(hostname)
compton &
compton --config $HOME/.config/i3/compton.conf &
#com.discordapp.Discord &
#com.slack.Slack &
if [ "$HOSTNAME" = cabinet ]; then
@ -17,9 +18,13 @@ if [ "$HOSTNAME" = cabinet ]; then
exec $STARTUP i3
fi
else
# xbindkeys
# xmodmap ~/.Xmodmap
/usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1 &
xbindkeys
# hybrid graphics stuff
xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto
## dunst, for X notifications, notably used by Network Manager
systemctl --user import-environment DISPLAY
systemctl --user restart dunst
nm-applet &
exec i3
fi