From 90739079f6b5b68538e2f1e96e01778d48661512 Mon Sep 17 00:00:00 2001 From: Frieder Schlesier Date: Sat, 2 Apr 2022 09:56:50 +0200 Subject: [PATCH] updates and cleanup --- .config/kitty/kitty.conf | 381 +++++++++++++++++ .gitconfig | 2 + .i3/config | 44 +- .i3/status-rust.toml | 111 +++++ .spacemacs | 5 +- .tmux.conf | 24 -- .urxvt/ext/font-size | 434 ------------------- LICENSE.md | 2 +- README.org | 55 +-- alacritty.yml | 882 --------------------------------------- bin/xrandr-toggle | 311 -------------- scripts/install.sh | 56 +-- scripts/install_arch.sh | 3 + wireguard/README.org | 2 +- 14 files changed, 551 insertions(+), 1761 deletions(-) create mode 100644 .config/kitty/kitty.conf create mode 100644 .i3/status-rust.toml delete mode 100755 .tmux.conf delete mode 100755 .urxvt/ext/font-size delete mode 100644 alacritty.yml delete mode 100755 bin/xrandr-toggle diff --git a/.config/kitty/kitty.conf b/.config/kitty/kitty.conf new file mode 100644 index 0000000..13e2f0c --- /dev/null +++ b/.config/kitty/kitty.conf @@ -0,0 +1,381 @@ +# vim:fileencoding=utf-8:ft=conf + +# Font family. You can also specify different fonts for the +# bold/italic/bold-italic variants. By default they are derived automatically, +# by the OSes font system. Setting them manually is useful for font families +# that have many weight variants like Book, Medium, Thick, etc. For example: +# font_family Operator Mono Book +# bold_font Operator Mono Medium +# italic_font Operator Mono Book Italic +# bold_italic_font Operator Mono Medium Italic +# +# You can get a list of full family names available on your computer by running +# kitty list-fonts +font_family Meslo LG M Regular +italic_font auto +bold_font auto +bold_italic_font auto + +# Font size (in pts) +font_size 10.0 + +# The amount the font size is changed by (in pts) when increasing/decreasing +# the font size in a running terminal. +font_size_delta 2 + + +# Adjust the line height. +# You can use either numbers, which are interpreted as pixels or percentages +# (number followed by %), which are interpreted as percentages of the +# unmodified line height. You can use negative pixels or percentages less than +# 100% to reduce line height (but this might cause rendering artifacts). +adjust_line_height 0 + +# Change the sizes of the lines used for the box drawing unicode characters +# These values are in pts. They will be scaled by the monitor DPI to arrive at +# a pixel value. There must be four values corresponding to thin, normal, thick, +# and very thick lines; +box_drawing_scale 0.001, 1, 1.5, 2 + +# The opacity of the background. A number between 0 and 1, where 1 is opaque and 0 is fully transparent. +# This will only work if supported by the OS (for instance, when using a compositor under X11). Note +# that it only sets the default background color's opacity. This is so that +# things like the status bar in vim, powerline prompts, etc. still look good. +# But it means that if you use a color theme with a background color in your +# editor, it will not be rendered as transparent. Instead you should change the +# default background color in your kitty config and not use a background color +# in the editor color scheme. Or use the escape codes to set the terminals +# default colors in a shell script to launch your editor. +# Be aware that using a value less than 1.0 is a (possibly significant) performance hit. +background_opacity 1.0 + + +# The cursor shape can be one of (block, beam, underline) +cursor_shape block + +# The interval (in seconds) at which to blink the cursor. Set to zero to +# disable blinking. Note that numbers smaller than repaint_delay will be +# limited to repaint_delay. +cursor_blink_interval 0.0 + +# Stop blinking cursor after the specified number of seconds of keyboard inactivity. Set to +# zero to never stop blinking. +cursor_stop_blinking_after 15.0 + +# Number of lines of history to keep in memory for scrolling back +scrollback_lines 10000 + +# Program with which to view scrollback in a new window. The scrollback buffer is passed as +# STDIN to this program. If you change it, make sure the program you use can +# handle ANSI escape sequences for colors and text formatting. +scrollback_pager less +G -R + +# When viewing scrollback in a new window, put it in a new tab as well +scrollback_in_new_tab no + +# Wheel scroll multiplier (modify the amount scrolled by the mouse wheel). Use negative +# numbers to change scroll direction. +wheel_scroll_multiplier 5.0 + +# The interval between successive clicks to detect double/triple clicks (in seconds) +click_interval 0.5 + +# Characters considered part of a word when double clicking. In addition to these characters +# any character that is marked as an alpha-numeric character in the unicode +# database will be matched. +select_by_word_characters :@-./_~?&=%+# + +# Hide mouse cursor after the specified number of seconds of the mouse not being used. Set to +# zero to disable mouse cursor hiding. +mouse_hide_wait 3.0 + +# Set the active window to the window under the mouse when moving the mouse around +focus_follows_mouse no + +# The enabled window layouts. A comma separated list of layout names. The special value * means +# all layouts. The first listed layout will be used as the startup layout. +# For a list of available layouts, see the file layouts.py +enabled_layouts * + +# If enabled, the window size will be remembered so that new instances of kitty will have the same +# size as the previous instance. If disabled, the window will initially have size configured +# by initial_window_width/height, in pixels. +remember_window_size no +initial_window_width 640 +initial_window_height 400 + +# Delay (in milliseconds) between screen updates. Decreasing it, increases +# frames-per-second (FPS) at the cost of more CPU usage. The default value +# yields ~100 FPS which is more than sufficient for most uses. +repaint_delay 10 + +# Delay (in milliseconds) before input from the program running in the terminal +# is processed. Note that decreasing it will increase responsiveness, but also +# increase CPU usage and might cause flicker in full screen programs that +# redraw the entire screen on each loop, because kitty is so fast that partial +# screen updates will be drawn. +input_delay 3 + +# Visual bell duration. Flash the screen when a bell occurs for the specified number of +# seconds. Set to zero to disable. +visual_bell_duration 0.0 + +# Enable/disable the audio bell. Useful in environments that require silence. +enable_audio_bell yes + +# The modifier keys to press when clicking with the mouse on URLs to open the URL +open_url_modifiers ctrl+shift + +# The program with which to open URLs that are clicked on. The special value "default" means to +# use the operating system's default URL handler. +open_url_with default + +# The modifiers to use rectangular selection (i.e. to select text in a +# rectangular block with the mouse) +rectangle_select_modifiers ctrl+alt + +# Choose whether to use the system implementation of wcwidth() (used to +# control how many cells a character is rendered in). If you use the system +# implementation, then kitty and any programs running in it will agree. The +# problem is that system implementations often are based on outdated unicode +# standards and get the width of many characters, such as emoji, wrong. So if +# you are using kitty with programs that have their own up-to-date wcwidth() +# implementation, set this option to no, otherwise set it to yes. +use_system_wcwidth no + +# The value of the TERM environment variable to set +term xterm-kitty + +# The width (in pts) of window borders. Will be rounded to the nearest number of pixels based on screen resolution. +# Note that borders are displayed only when more than one window is visible. They are meant to separate multiple windows. +window_border_width 1 + +# The window margin (in pts) (blank area outside the border) +window_margin_width 0 + +# The window padding (in pts) (blank area between the text and the window border) +window_padding_width 0 + +# The color for the border of the active window +active_border_color #00ff00 + +# The color for the border of inactive windows +inactive_border_color #cccccc + +# Fade the text in inactive windows by the specified amount (a number between +# zero and one, with 0 being fully faded). +inactive_text_alpha 1.0 + +# Tab-bar customization +active_tab_foreground #d3d4c4 +active_tab_background #404552 +active_tab_font_style normal +inactive_tab_foreground #7c838f +inactive_tab_background #383c4a +inactive_tab_font_style normal +tab_separator " ┇ " + +# The color and style for highlighting URLs on mouse-over. url_style can be one of: +# none, single, double, curly +url_color #0087BD +url_style curly +cursor #93a1a1 + +# The 16 terminal colors. There are 8 basic colors, each color has a dull and +# bright version. +# solarized dark higher contrast +# https://github.com/dexpota/kitty-themes/blob/master/themes/Solarized_Dark_Higher_Contrast.conf +# background #001e26 +# foreground #9bc1c2 +# cursor #f34a00 +# selection_background #003747 +# color0 #002731 +# color8 #006388 +# color1 #d01b24 +# color9 #f4153b +# color2 #6bbe6c +# color10 #50ee84 +# color3 #a57705 +# color11 #b17e28 +# color4 #2075c7 +# color12 #178dc7 +# color5 #c61b6e +# color13 #e14d8e +# color6 #259185 +# color14 #00b29e +# color7 #e9e2cb +# color15 #fcf4dc +# selection_foreground #001e26 + +# https://github.com/dexpota/kitty-themes/blob/master/themes/Relaxed_Afterglow.conf +# Relaxed Afterglow by Michael Kühnel , https://github.com/Relaxed-Theme/relaxed-terminal-themes +# This work is licensed under the terms of the MIT license. +# For a copy, see https://opensource.org/licenses/MIT. + +background #353a44 +foreground #d9d9d9 +cursor #d9d9d9 +selection_foreground #d8d8d8 +selection_background #6a7984 +color0 #151515 +color1 #bc5653 +color2 #909d63 +color3 #ebc17a +color4 #6a8799 +color5 #b06698 +color6 #c9dfff +color7 #d9d9d9 +color8 #636363 +color9 #bc5653 +color10 #a0ac77 +color11 #ebc17a +color12 #7eaac7 +color13 #b06698 +color14 #acbbd0 +color15 #f7f7f7 + + + +# Key mapping +# For a list of key names, see: http://www.glfw.org/docs/latest/group__keys.html +# For a list of modifier names, see: http://www.glfw.org/docs/latest/group__mods.html +# +# You can use the special action no_op to unmap a keyboard shortcut that is +# assigned in the default configuration. +# +# You can combine multiple actions to be triggered by a single shortcut, using the +# syntax below: +# map key combine action1 action2 action3 ... +# For example: +# map ctrl+shift+e combine : new_window : next_layout +# this will create a new window and switch to the next available layout + +# Clipboard +map ctrl+shift+v paste_from_clipboard +map ctrl+shift+s no_op +map ctrl+shift+c copy_to_clipboard +map shift+insert no_op +# You can also pass the contents of the current selection to any program using +# pass_selection_to_program. By default, the system's open program is used, but +# you can specify your own, for example: +# map ctrl+shift+o pass_selection_to_program firefox +map ctrl+shift+o no_op + +# Scrolling +map ctrl+shift+up no_op +map ctrl+shift+down no_op +map ctrl+shift+k no_op +map ctrl+shift+j no_op +map ctrl+shift+page_up no_op +map ctrl+shift+page_down no_op +map ctrl+shift+home no_op +map ctrl+shift+end no_op +map ctrl+shift+h no_op + +# Window management +map ctrl+shift+enter no_op +# map ctrl+n new_os_window +# map ctrl+w close_window +map ctrl+shift+] no_op +map ctrl+shift+[ no_op +map ctrl+shift+f no_op +map ctrl+shift+1 no_op +map ctrl+shift+2 no_op +map ctrl+shift+3 no_op +map ctrl+shift+4 no_op +map ctrl+shift+5 no_op +map ctrl+shift+6 no_op +map ctrl+shift+7 no_op +map ctrl+shift+8 no_op +map ctrl+shift+9 no_op +map ctrl+shift+0 no_op +# You can open a new window running an arbitrary program, for example: +# map ctrl+shift+y new_window mutt +# +# You can pass the current selection to the new program by using the @selection placeholder +# map ctrl+shift+y new_window less @selection +# +# You can even send the contents of the current screen + history buffer as stdin using +# the placeholders @text (which is the plain text) and @ansi (which includes text styling escape codes) +# For example, the following command opens the scrollback buffer in less in a new window. +# map ctrl+shift+y new_window @ansi less +G -R +# +# You can open a new window with the current working directory set to the +# working directory of the current window using +# map ctrl+alt+enter new_window_with_cwd + + +# Tab management +map ctrl+shift+] next_tab +map ctrl+shift+[ previous_tab +# map ctrl+t new_tab +# map ctrl+q close_tab +map ctrl+shift+l no_op +map ctrl+shift+. move_tab_forward +map ctrl+shift+, move_tab_backward +# You can also create shortcuts to go to specific tabs, with 1 being the first tab +# map ctrl+alt+1 goto_tab 1 +# map ctrl+alt+2 goto_tab 2 + +# Just as with new_window above, you can also pass the name of arbitrary +# commands to run when using new_tab and use new_tab_with_cwd. + + +# Miscellaneous +# map ctrl+equal increase_font_size +# map ctrl+minus decrease_font_size +# map ctrl+0 restore_font_size +# map ctrl+shift+f11 no_op + +# Sending arbitrary text on shortcut key presses +# You can tell kitty to send arbitrary (UTF-8) encoded text to +# the client program when pressing specified shortcut keys. For example: +# map ctrl+alt+a send_text all Special text +# This will send "Special text" when you press the Ctrl+Alt+a key combination. +# The text to be sent is a python string literal so you can use escapes like +# \x1b to send control codes or \u21fb to send unicode characters (or you can +# just input the unicode characters directly as UTF-8 text). The first argument +# to send_text is the keyboard modes in which to activate the shortcut. The possible +# values are normal or application or kitty or a comma separated combination of them. +# The special keyword all means all modes. The modes normal and application refer to +# the DECCKM cursor key mode for terminals, and kitty refers to the special kitty +# extended keyboard protocol. Another example, that outputs a word and then moves the cursor +# to the start of the line (same as pressing the Home key): +# map ctrl+alt+a send_text normal Word\x1b[H +# map ctrl+alt+a send_text application Word\x1bOH + +# Symbol mapping (special font for specified unicode code points). Map the +# specified unicode codepoints to a particular font. Useful if you need special +# rendering for some symbols, such as for Powerline. Avoids the need for +# patched fonts. Each unicode code point is specified in the form U+. You can specify multiple code points, separated by commas +# and ranges separated by hyphens. symbol_map itself can be specified multiple times. +# Syntax is: +# +# symbol_map codepoints Font Family Name +# +# For example: +# +# symbol_map U+E0A0-U+E0A2,U+E0B0-U+E0B3 PowerlineSymbols + + +# OS specific tweaks + +# Hide the kitty window's title bar on macOS. +macos_hide_titlebar no + +# Use the option key as an alt key. With this set to no, kitty will use +# the macOS native Option+Key = unicode character behavior. This will +# break any Alt+key keyboard shortcuts in your terminal programs, but you +# can use the macOS unicode input technique. +macos_option_as_alt yes + +# The number is a percentage of maximum volume. +# See man XBell for details. +x11_bell_volume 80 + +# Prefer color emoji fonts when available. Note that this only works +# on systems such as Linux that use fontconfig. On other OSes, the emoji +# font used is system dependent. It can be overriden using symbol_map in the kitty +# configuration. +prefer_color_emoji yes diff --git a/.gitconfig b/.gitconfig index d862c49..d7dd743 100755 --- a/.gitconfig +++ b/.gitconfig @@ -29,3 +29,5 @@ ui = true [pull] rebase = true +[init] + defaultBranch = main diff --git a/.i3/config b/.i3/config index 54bfc59..3454e62 100755 --- a/.i3/config +++ b/.i3/config @@ -128,7 +128,7 @@ mode "monitor" { # HDMI main, laptop left, VGA right, *not* supported on X230 bindsym 3 exec xrandr --output $CENTER --primary --auto --output $LEFT --auto --left-of $CENTER --output $RIGHT --auto --right-of $CENTER # CENTER main, RIGHT right, rotated - bindsym 4 exec xrandr --output $CENTER --primary --auto --output $RIGHT --auto --right-of $CENTER --rotate left --output $LAPTOP --off --output $LEFT --auto + bindsym 4 exec xrandr --output $CENTER --primary --auto --output $RIGHT --auto --right-of $CENTER --rotate left --output $LAPTOP --off --output $LEFT --auto --left-of $CENTER --rotate right # VGA main, laptop left, HDMI off bindsym 8 exec xrandr --output $RIGHT --primary --auto --output $LAPTOP --auto --left-of $RIGHT --output $CENTER --off # HDMI main, VGA right, laptop off @@ -210,25 +210,20 @@ mode "resize" { bindsym $mod+r mode "resize" -# Start i3bar to display a workspace bar (plus the system information i3status -# finds out, if available) bar { - - # i3blocks: http://kumarcode.com/Colorful-i3/ - # status_command i3blocks -c ~/.i3/i3blocks.conf - colors { - # separator #268bd2 - background #111b16 - statusline #b3c4c6 - focused_workspace #7d9683 #6c71c4 #fdf6e3 - active_workspace #fdf6e3 #6c71c4 #fdf6e3 - inactive_workspace #002b36 #586e75 #002b36 - urgent_workspace #d33682 #d33682 #fdf6e3 - } + font pango:DejaVu Sans, FontAwesome 9 + # position top output $CENTER - font pango:DejaVu Sans Mono, FontAwesome 9 - status_command i3status --config ~/.i3/status.conf - tray_output $CENTER + status_command /usr/bin/i3status-rs /home/fschl/dotfiles/.i3/status-rust.toml + colors { + separator #166616 + background #222222 + statusline #166616 + focused_workspace #0088CC #0088CC #ffffff + active_workspace #333333 #333333 #ffffff + inactive_workspace #333333 #333333 #888888 + urgent_workspace #2f343a #900000 #ffffff + } } bar { @@ -238,20 +233,9 @@ bar { tray_output $CENTER } -# auto run commands -# set background -# use the same background as slim (login manager) -# this file is an alias to something in /home/jessie/Pictures -#exec --no-startup-id feh --bg-fill /usr/share/slim/themes/default/background.jpg - -# run the merge for good colors -#exec xrdb -merge /home/jessie/.Xresources -#exec xrdb -merge /home/jessie/.Xdefaults - - # startup programs exec --no-startup-id nm-applet -exec --no-startup-id xrandr --output $CENTER --primary --auto --output $RIGHT --auto --right-of $CENTER --rotate left --output $LAPTOP --off --output $LEFT --auto --left-of $CENTER +exec --no-startup-id xrandr --output $CENTER --primary --auto --output $RIGHT --auto --right-of $CENTER --rotate left --output $LAPTOP --off --output $LEFT --auto --left-of $CENTER --rotate right exec --no-startup-id i3-msg 'workspace $WS1; exec firefox;' exec --no-startup-id i3-msg 'workspace $WS2; exec emacs' exec --no-startup-id i3-msg 'exec thunderbird' diff --git a/.i3/status-rust.toml b/.i3/status-rust.toml new file mode 100644 index 0000000..ea6cbb8 --- /dev/null +++ b/.i3/status-rust.toml @@ -0,0 +1,111 @@ +[theme] +name = "semi-native" +# theme = "solarized-dark" +[theme.overrides] +separator = "|" +[icons] +name = "awesome" + + +[[block]] +block = "pomodoro" +length = 25 +break_length = 5 +message = " Take a break!" +break_message = "Back to work!" +notifier = "i3nag" +[icons.overrides] +pomodoro = "" +pomodoro_started = "" +pomodoro_stopped = "⏹" +pomodoro_paused = "⏸" +pomodoro_break = "" + + +# [[block]] +# block = "disk_space" +# path = "/" +# info_type = "available" +# unit = "GB" +# interval = 20 +# warning = 1.5 +# alert = 0.8 +# alert_absolute = true +# format = "{icon}/{available}" + +[[block]] +block = "disk_space" +path = "/home" +info_type = "available" +unit = "GB" +interval = 20 +warning = 20.0 +alert = 10.0 +alert_absolute = true +format = "{icon}/home {available}" + +# [[block]] +# block = "docker" +# interval = 2 +# format = "{running}/{total} | {images}" + +[[block]] +block = "memory" +display_type = "memory" +format_mem = "{mem_used_percents}" +format_swap = "{swap_used_percents}" + +[[block]] +block = "cpu" +interval = 5 + +[[block]] +block = "load" +interval = 5 +format = "{1m}" + +[[block]] +block = "net" +device = "enp31s0" +format = "eth {ip} {speed_down;K*b} {graph_down;K*b}" +interval = 5 + +# [[block]] +# block = "net" +# device = "wlp3s0" +# on_click = "alacritty -e nmtui" +# format = "{ssid} {signal_strength} {ip} {speed_down;K*b}" +# # format = "{ssid} {signal_strength} {ip} {speed_down;K*b} {graph_down;K*b}" +# interval = 5 + +[[block]] +block = "sound" +format = "{volume}" +show_volume_when_muted = true + +# [[block]] +# block = "sound" +# name = "Mic" +# format = "{output_name} {volume}" +# show_volume_when_muted = true + +# [[block]] +# block = "battery" +# # driver = "upower" +# driver = "sysfs" +# format = "{percentage} {time}" +# allow_missing = true + +# [[block]] +# block = "networkmanager" +# on_click = "alacritty -e nmtui" +# interface_name_exclude = ["br\\-[0-9a-f]{12}", "docker\\d+"] +# interface_name_include = [] +# ap_format = "{ssid^10}" + + +[[block]] +block = "time" +timezone = "Europe/Berlin" +interval = 5 +format = "%a %Y-%m-%d %R:%S" diff --git a/.spacemacs b/.spacemacs index 6332e09..6891213 100644 --- a/.spacemacs +++ b/.spacemacs @@ -78,7 +78,10 @@ This function should only modify configuration layer settings." ;; `dotspacemacs/user-config'. To use a local version of a package, use the ;; `:location' property: '(your-package :location "~/path/to/your-package/") ;; Also include the dependencies as they will not be resolved automatically. - dotspacemacs-additional-packages '() + dotspacemacs-additional-packages '( + org-tree-slide + ) + ;; A list of packages that cannot be updated. dotspacemacs-frozen-packages '() diff --git a/.tmux.conf b/.tmux.conf deleted file mode 100755 index 7adf980..0000000 --- a/.tmux.conf +++ /dev/null @@ -1,24 +0,0 @@ -bind -n M-Left select-pane -L -bind -n M-Right select-pane -R -bind -n M-Up select-pane -U -bind -n M-Down select-pane -D - -set-window-option -g window-status-current-bg yellow - -# force a reload of the config file -unbind r -bind r source-file ~/.tmux.conf - -# quick pane cycling -unbind M-s -bind -n M-s select-pane -t :.+ - -# pane splitting like in emacs -unbind M-2 -bind -n M-2 split-window -h - -unbind M-4 -bind -n M-4 split-window - -#unbind C-W -#bind -n C-W confirm-before -p "kill-pane #W? (y/n)" kill-window diff --git a/.urxvt/ext/font-size b/.urxvt/ext/font-size deleted file mode 100755 index 433539c..0000000 --- a/.urxvt/ext/font-size +++ /dev/null @@ -1,434 +0,0 @@ -#!/usr/bin/perl -# -# On-the-fly adjusting of the font size in urxvt -# -# Copyright (c) 2008 David O'Neill -# 2012 Noah K. Tilton -# 2012-2013 Jan Larres -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# URL: https://github.com/majutsushi/urxvt-font-size -# -# Based on: -# https://github.com/dave0/urxvt-font-size -# https://github.com/noah/urxvt-font -# - -#:META:X_RESOURCE:%.step:interger:font size increase/decrease step - -=head1 NAME - -font-size - interactive font size setter - -=head1 USAGE - -Put the font-size script into $HOME/.urxvt/ext/ and add it to the list -of enabled perl-extensions in ~/.Xresources: - - URxvt.perl-ext-common: ...,font-size - -Add some keybindings: - - URxvt.keysym.C-Up: font-size:increase - URxvt.keysym.C-Down: font-size:decrease - URxvt.keysym.C-S-Up: font-size:incglobal - URxvt.keysym.C-S-Down: font-size:decglobal - -Note that for urxvt versions older than 9.21 the resources have to look like this: - - URxvt.keysym.C-Up: perl:font-size:increase - URxvt.keysym.C-Down: perl:font-size:decrease - URxvt.keysym.C-S-Up: perl:font-size:incglobal - URxvt.keysym.C-S-Down: perl:font-size:decglobal - -Supported functions: - -=over 2 - -=item * increase/decrease: - - increase or decrease the font size of the current terminal. - -=item * incglobal/decglobal: - - same as above and also adjust the X server values so all newly - started terminals will use the same fontsize. - -=item * incsave/decsave: - - same as incglobal/decglobal and also modify the ~/.Xresources - file so the changed font sizes will persist over a restart of - the X server or a reboot. - -=back - -You can also change the step size that the script will use to increase -the font size: - - URxvt.font-size.step: 4 - -The default step size is 1. This means that with this setting a -size change sequence would be for example 8->12->16->20 instead of -8->9->10->11->12 etc. Please note that many X11 fonts are only -available in specific sizes, though, and odd sizes are often not -available, resulting in an effective step size of 2 instead of 1 -in that case. -=cut - -use strict; -use warnings; - -my %escapecodes = ( - "font" => 710, - "boldFont" => 711, - "italicFont" => 712, - "boldItalicFont" => 713 -); - -sub on_start -{ - my ($self) = @_; - - $self->{step} = $self->x_resource("%.step") || 1; - - foreach my $type (qw(font boldFont italicFont boldItalicFont)) { - $self->{$type} = $self->x_resource($type) || "undef"; - } -} - -# Needed for backwards compatibility with < 9.21 -sub on_user_command -{ - my ($self, $cmd) = @_; - - my $step = $self->{step}; - - if ($cmd eq "font-size:increase") { - fonts_change_size($self, $step, 0); - } elsif ($cmd eq "font-size:decrease") { - fonts_change_size($self, -$step, 0); - } elsif ($cmd eq "font-size:incglobal") { - fonts_change_size($self, $step, 1); - } elsif ($cmd eq "font-size:decglobal") { - fonts_change_size($self, -$step, 1); - } elsif ($cmd eq "font-size:incsave") { - fonts_change_size($self, $step, 2); - } elsif ($cmd eq "font-size:decsave") { - fonts_change_size($self, -$step, 2); - } elsif ($cmd eq "font-size:reset") { - fonts_reset($self); - } -} - -sub on_action -{ - my ($self, $action) = @_; - - my $step = $self->{step}; - - if ($action eq "increase") { - fonts_change_size($self, $step, 0); - } elsif ($action eq "decrease") { - fonts_change_size($self, -$step, 0); - } elsif ($action eq "incglobal") { - fonts_change_size($self, $step, 1); - } elsif ($action eq "decglobal") { - fonts_change_size($self, -$step, 1); - } elsif ($action eq "incsave") { - fonts_change_size($self, $step, 2); - } elsif ($action eq "decsave") { - fonts_change_size($self, -$step, 2); - } elsif ($action eq "reset") { - fonts_reset($self); - } -} - -sub fonts_change_size -{ - my ($term, $change, $save) = @_; - - my @newfonts = (); - - my $curres = $term->resource('font'); - if (!$curres) { - $term->scr_add_lines("\r\nWarning: No font configured, trying a default.\r\nPlease set a font with the 'URxvt.font' resource."); - $curres = "fixed"; - } - my @curfonts = split(/\s*,\s*/, $curres); - - my $basefont = shift(@curfonts); - my ($newbasefont, $newbasesize) = handle_font($term, $basefont, $change, 0); - push @newfonts, $newbasefont; - - # Only adjust other fonts if base font changed - if ($newbasefont ne $basefont) { - foreach my $font (@curfonts) { - my ($newfont, $newsize) = handle_font($term, $font, $change, $newbasesize); - push @newfonts, $newfont; - } - my $newres = join(",", @newfonts); - font_apply_new($term, $newres, "font", $save); - - handle_type($term, "boldFont", $change, $newbasesize, $save); - handle_type($term, "italicFont", $change, $newbasesize, $save); - handle_type($term, "boldItalicFont", $change, $newbasesize, $save); - } - - if ($save > 1) { - # write the new values back to the file - my $xresources = readlink $ENV{"HOME"} . "/.Xresources"; - system("xrdb -edit " . $xresources); - } -} - -sub fonts_reset -{ - my ($term) = @_; - - foreach my $type (qw(font boldFont italicFont boldItalicFont)) { - my $initial = $term->{$type}; - if ($initial ne "undef") { - font_apply_new($term, $initial, $type, 0); - } - } -} - -sub handle_type -{ - my ($term, $type, $change, $basesize, $save) = @_; - - my $curres = $term->resource($type); - if (!$curres) { - return; - } - my @curfonts = split(/\s*,\s*/, $curres); - my @newfonts = (); - - foreach my $font (@curfonts) { - my ($newfont, $newsize) = handle_font($term, $font, $change, $basesize); - push @newfonts, $newfont; - } - - my $newres = join(",", @newfonts); - font_apply_new($term, $newres, $type, $save); -} - -sub handle_font -{ - my ($term, $font, $change, $basesize) = @_; - - my $newfont; - my $newsize; - my $prefix = 0; - - if ($font =~ /^\s*x:/) { - $font =~ s/^\s*x://; - $prefix = 1; - } - if ($font =~ /^\s*(\[.*\])?xft:/) { - ($newfont, $newsize) = font_change_size_xft($term, $font, $change, $basesize); - } elsif ($font =~ /^\s*-/) { - ($newfont, $newsize) = font_change_size_xlfd($term, $font, $change, $basesize); - } else { - # check whether the font is a valid alias and if yes resolve it to the - # actual font - my $lsfinfo = `xlsfonts -l $font 2>/dev/null`; - - if ($lsfinfo eq "") { - # not a valid alias, ring the bell if it is the base font and just - # return the current font - if ($basesize == 0) { - $term->scr_bell; - } - return ($font, $basesize); - } - - my $fontinfo = (split(/\n/, $lsfinfo))[-1]; - my ($fontfull) = ($fontinfo =~ /\s+([-a-z0-9]+$)/); - ($newfont, $newsize) = font_change_size_xlfd($term, $fontfull, $change, $basesize); - } - - # $term->scr_add_lines("\r\nNew font is $newfont\n"); - if ($prefix) { - $newfont = "x:$newfont"; - } - return ($newfont, $newsize); -} - -sub font_change_size_xft -{ - my ($term, $fontstring, $change, $basesize) = @_; - - my @pieces = split(/:/, $fontstring); - my @resized = (); - my $size = 0; - my $new_size = 0; - - foreach my $piece (@pieces) { - if ($piece =~ /^(?:(?:pixel)?size=|[^=-]+-)(\d+(\.\d*)?)$/) { - $size = $1; - - if ($basesize != 0) { - $new_size = $basesize; - } else { - $new_size = $size + $change - } - - $piece =~ s/(=|-)$size/$1$new_size/; - } - push @resized, $piece; - } - - my $resized_str = join(":", @resized); - - # don't make fonts too small - if ($new_size >= 6) { - return ($resized_str, $new_size); - } else { - if ($basesize == 0) { - $term->scr_bell; - } - return ($fontstring, $size); - } -} - -sub font_change_size_xlfd -{ - my ($term, $fontstring, $change, $basesize) = @_; - - #-xos4-terminus-medium-r-normal-*-12-*-*-*-*-*-*-1 - - my @fields = qw(foundry family weight slant setwidth style pixelSize pointSize Xresolution Yresolution spacing averageWidth registry encoding); - - my %font; - $fontstring =~ s/^-//; # Strip leading - before split - @font{@fields} = split(/-/, $fontstring); - - if ($font{pixelSize} eq '*') { - $term->scr_add_lines("\r\nWarning: Font size undefined, assuming 12.\r\nPlease set the 'URxvt.font' resource to a font with a concrete size."); - $font{pixelSize} = '12' - } - if ($font{registry} eq '*') { - $font{registry} ='iso8859'; - } - - # Blank out the size for the pattern - my %pattern = %font; - $pattern{foundry} = '*'; - $pattern{setwidth} = '*'; - $pattern{pixelSize} = '*'; - $pattern{pointSize} = '*'; - # if ($basesize != 0) { - # $pattern{Xresolution} = '*'; - # $pattern{Yresolution} = '*'; - # } - $pattern{averageWidth} = '*'; - # make sure there are no empty fields - foreach my $field (@fields) { - $pattern{$field} = '*' unless defined($pattern{$field}); - } - my $new_fontstring = '-' . join('-', @pattern{@fields}); - - my @possible; - # $term->scr_add_lines("\r\nPattern is $new_fontstring\n"); - open(FOO, "xlsfonts -fn '$new_fontstring' | sort -u |") or die $!; - while () { - chomp; - s/^-//; # Strip leading '-' before split - my @fontdata = split(/-/, $_); - - push @possible, [$fontdata[6], "-$_"]; - # $term->scr_add_lines("\r\npossibly $fontdata[6] $_\n"); - } - close(FOO); - - if (!@possible) { - die "No possible fonts!"; - } - - if ($basesize != 0) { - # sort by font size, descending - @possible = sort {$b->[0] <=> $a->[0]} @possible; - - # font is not the base font, so find the largest font that is at most - # as large as the base font. If the largest possible font is smaller - # than the base font bail and hope that a 0-size font can be found at - # the end of the function - if ($possible[0]->[0] > $basesize) { - foreach my $candidate (@possible) { - if ($candidate->[0] <= $basesize) { - return ($candidate->[1], $candidate->[0]); - } - } - } - } elsif ($change > 0) { - # sort by font size, ascending - @possible = sort {$a->[0] <=> $b->[0]} @possible; - - foreach my $candidate (@possible) { - if ($candidate->[0] >= $font{pixelSize} + $change) { - return ($candidate->[1], $candidate->[0]); - } - } - } elsif ($change < 0) { - # sort by font size, descending - @possible = sort {$b->[0] <=> $a->[0]} @possible; - - foreach my $candidate (@possible) { - if ($candidate->[0] <= $font{pixelSize} + $change && $candidate->[0] != 0) { - return ($candidate->[1], $candidate->[0]); - } - } - } - - # no fitting font available, check whether a 0-size font can be used to - # fit the size of the base font - @possible = sort {$a->[0] <=> $b->[0]} @possible; - if ($basesize != 0 && $possible[0]->[0] == 0) { - return ($possible[0]->[1], $basesize); - } else { - # if there is absolutely no smaller/larger font that can be used - # return the current one, and beep if this is the base font - if ($basesize == 0) { - $term->scr_bell; - } - return ("-$fontstring", $font{pixelSize}); - } -} - -sub font_apply_new -{ - my ($term, $newfont, $type, $save) = @_; - - # $term->scr_add_lines("\r\nnew font is $newfont\n"); - - $term->cmd_parse("\033]" . $escapecodes{$type} . ";" . $newfont . "\033\\"); - - # load the xrdb db - # system("xrdb -load " . X_RESOURCES); - - if ($save > 0) { - # merge the new values - open(XRDB_MERGE, "| xrdb -merge") || die "can't fork: $!"; - local $SIG{PIPE} = sub { die "xrdb pipe broken" }; - print XRDB_MERGE "URxvt." . $type . ": " . $newfont; - close(XRDB_MERGE) || die "bad xrdb: $! $?"; - } -} diff --git a/LICENSE.md b/LICENSE.md index 2ad6746..4fa45a5 100755 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2017-2021 Frieder Schlesier +Copyright (c) 2017-2022 Frieder Schlesier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in diff --git a/README.org b/README.org index e1a26f5..01d7f57 100644 --- a/README.org +++ b/README.org @@ -15,44 +15,31 @@ *** Firefox/Thunderbird customization - - goto ~.mozilla/firefox//~ + - goto ~.mozilla/firefox//~ - ~mkdir chrome/ && cp ~/dotfiles/userChrome.css ./chrome/~ - open Firefox: ~about:config~ and set ~toolkit.legacyUserProfileCustomizations.stylesheets~ to *true* *** Security -**** Hardening ssh +**** SSH Hardening - https://blog.g3rt.nl/upgrade-your-ssh-keys.html - https://stribika.github.io/2015/01/04/secure-secure-shell.html - https://wiki.mozilla.org/Security/Guidelines/OpenSSH#OpenSSH_client - - see `/etc/ssh/ssh_config` and `.ssh/config` + - see ~/etc/ssh/ssh_config~ and ~.ssh/config~ - add this to `~/.ssh/config`: +**** SSH key generation #+BEGIN_SRC bash - # Ensure KnownHosts are unreadable if leaked - it is otherwise easier to know which hosts your keys have access to. - HashKnownHosts yes - # Host keys the client accepts - order here is honored by OpenSSH - HostKeyAlgorithms ssh-ed25519-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-ed25519,ssh-rsa,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp521,ecdsa-sha2-nistp384,ecdsa-sha2-nistp256 - - KexAlgorithms curve25519-sha256@libssh.org,ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256,diffie-hellman-group-exchange-sha256 - MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,umac-128@openssh.com - Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr + # ED25519 keys are favored over RSA keys when backward compatibility ''is not required''. + # This is only compatible with OpenSSH 6.5+ and fixed-size (256 bytes). + $ ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519_host_$(date +%Y-%m-%d) -C "Key to HOST for user-xyz" - #+END_SRC - - *generating keys* - - #+BEGIN_SRC bash - # RSA keys are favored over ECDSA keys when backward compatibility ''is required'', - # thus, newly generated keys are always either ED25519 or RSA (NOT ECDSA or DSA). - $ ssh-keygen -t rsa -b 8192 -f ~/.ssh/id_rsa_host_$(date +%Y-%m-%d) -C "Key to HOST for user-xyz" - - # ED25519 keys are favored over RSA keys when backward compatibility ''is not required''. - # This is only compatible with OpenSSH 6.5+ and fixed-size (256 bytes). - $ ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519_host_$(date +%Y-%m-%d) -C "Key to HOST for user-xyz" + # Fallback for really old systems (why do you still have those??) + # RSA keys are favored over ECDSA keys when backward compatibility ''is required'', + # thus, newly generated keys are always either ED25519 or RSA (NOT ECDSA or DSA). + $ ssh-keygen -t rsa -b 8192 -f ~/.ssh/id_rsa_host_$(date +%Y-%m-%d) -C "Key to HOST for user-xyz" #+END_SRC **** GnuPG @@ -61,7 +48,7 @@ - https://keyring.debian.org/creating-key.html - https://wiki.debian.org/Subkeys - `~/.gnupg/gpg.conf`: + ~~/.gnupg/gpg.conf~: #+BEGIN_SRC bash personal-digest-preferences SHA512 SHA384 @@ -95,31 +82,21 @@ Solution: multi-boot! -**** thumb drive setup +**** Thumb Drive Setup 3 partitions: boot+isos, luks encrypted, unencrypted partition for non-sensitive data -**** building kali linux iso [0/7] - - - [ ] https://docs.kali.org/downloading/kali-linux-live-usb-install - - [ ] add encrypted persistence https://docs.kali.org/downloading/kali-linux-live-usb-persistence - - [ ] add kali meta packages https://www.kali.org/news/kali-linux-metapackages/ - - [ ] https://docs.kali.org/development/live-build-a-custom-kali-iso - - [ ] customize live image contents https://live-team.pages.debian.net/live-manual/html/live-manual/customizing-contents.en.html#517 - - [ ] add LUKS Nuke support https://www.kali.org/tutorials/nuke-kali-linux-luks/ - - [ ] OPTIONAL add PowerShell https://www.kali.org/tutorials/installing-powershell-on-kali-linux/ - ** TODO [0/5] - [ ] explain setup, ideas, practises - [ ] add HOWTO - - [ ] seperate sources.list setup for server/desktop/laptop - [ ] Check new bootable USB solution: https://ventoy.net/en/index.html - [ ] move to ansible for easier modularization of setup + - [ ] OR: give GUIX a shot ** Moving to Arch - official repository setup: https://wiki.archlinux.org/title/Official_repositories#multilib - - multiplib is required for wine + - ~multiplib~ is required for wine - Sound troubleshooting: https://wiki.archlinux.org/title/Advanced_Linux_Sound_Architecture/Troubleshooting#HDMI - - Skype: https://www.tecmint.com/install-skype-in-arch-linux/ + - Skype, VSCode: use ~yay~ diff --git a/alacritty.yml b/alacritty.yml deleted file mode 100644 index dcb35c1..0000000 --- a/alacritty.yml +++ /dev/null @@ -1,882 +0,0 @@ -# Configuration for Alacritty, the GPU enhanced terminal emulator. - -# Import additional configuration files -# -# Imports are loaded in order, skipping all missing files, with the importing -# file being loaded last. If a field is already present in a previous import, it -# will be replaced. -# -# All imports must either be absolute paths starting with `/`, or paths relative -# to the user's home directory starting with `~/`. -#import: -# - /path/to/alacritty.yml - -# Any items in the `env` entry below will be added as -# environment variables. Some entries may override variables -# set by alacritty itself. -#env: - # TERM variable - # - # This value is used to set the `$TERM` environment variable for - # each instance of Alacritty. If it is not present, alacritty will - # check the local terminfo database and use `alacritty` if it is - # available, otherwise `xterm-256color` is used. - #TERM: alacritty - -window: - # Window dimensions (changes require restart) - # - # Number of lines/columns (not pixels) in the terminal. The number of columns - # must be at least `2`, while using a value of `0` for columns and lines will - # fall back to the window manager's recommended size. - #dimensions: - # columns: 0 - # lines: 0 - - # Window position (changes require restart) - # - # Specified in number of pixels. - # If the position is not set, the window manager will handle the placement. - #position: - # x: 0 - # y: 0 - - # Window padding (changes require restart) - # - # Blank space added around the window in pixels. This padding is scaled - # by DPI and the specified value is always added at both opposing sides. - #padding: - # x: 0 - # y: 0 - - # Spread additional padding evenly around the terminal content. - #dynamic_padding: false - - # Window decorations - # - # Values for `decorations`: - # - full: Borders and title bar - # - none: Neither borders nor title bar - # - # Values for `decorations` (macOS only): - # - transparent: Title bar, transparent background and title bar buttons - # - buttonless: Title bar, transparent background and no title bar buttons - decorations: none - - # Startup Mode (changes require restart) - # - # Values for `startup_mode`: - # - Windowed - # - Maximized - # - Fullscreen - # - # Values for `startup_mode` (macOS only): - # - SimpleFullscreen - #startup_mode: Windowed - - # Window title - #title: Alacritty - - # Allow terminal applications to change Alacritty's window title. - #dynamic_title: true - - # Window class (Linux/BSD only): - #class: - # Application instance name - #instance: Alacritty - # General application class - #general: Alacritty - - # GTK theme variant (Linux/BSD only) - # - # Override the variant of the GTK theme. Commonly supported values are `dark` - # and `light`. Set this to `None` to use the default theme variant. - #gtk_theme_variant: None - -#scrolling: - # Maximum number of lines in the scrollback buffer. - # Specifying '0' will disable scrolling. - #history: 10000 - - # Scrolling distance multiplier. - #multiplier: 3 - -# Font configuration -font: - # Normal (roman) font face - #normal: - # Font family - # - # Default: - # - (macOS) Menlo - # - (Linux/BSD) monospace - # - (Windows) Consolas - #family: monospace - - # The `style` can be specified to pick a specific face. - #style: Regular - - # Bold font face - #bold: - # Font family - # - # If the bold family is not specified, it will fall back to the - # value specified for the normal font. - #family: monospace - - # The `style` can be specified to pick a specific face. - #style: Bold - - # Italic font face - #italic: - # Font family - # - # If the italic family is not specified, it will fall back to the - # value specified for the normal font. - #family: monospace - - # The `style` can be specified to pick a specific face. - #style: Italic - - # Bold italic font face - #bold_italic: - # Font family - # - # If the bold italic family is not specified, it will fall back to the - # value specified for the normal font. - #family: monospace - - # The `style` can be specified to pick a specific face. - #style: Bold Italic - - # Point size - size: 9.0 - - # Offset is the extra space around each character. `offset.y` can be thought - # of as modifying the line spacing, and `offset.x` as modifying the letter - # spacing. - #offset: - # x: 0 - # y: 0 - - # Glyph offset determines the locations of the glyphs within their cells with - # the default being at the bottom. Increasing `x` moves the glyph to the - # right, increasing `y` moves the glyph upward. - #glyph_offset: - # x: 0 - # y: 0 - - # Thin stroke font rendering (macOS only) - # - # Thin strokes are suitable for retina displays, but for non-retina screens - # it is recommended to set `use_thin_strokes` to `false`. - #use_thin_strokes: true - -# If `true`, bold text is drawn using the bright color variants. -#draw_bold_text_with_bright_colors: false - -# Colors (Solarized Dark) -colors: - # Default colors - primary: - # background: '0x002b36' - background: '0x001b26' - foreground: '0x839496' - - # Normal colors - normal: - black: '0x073642' - red: '0xdc322f' - green: '0x859900' - yellow: '0xb58900' - blue: '0x268bd2' - magenta: '0xd33682' - cyan: '0x2aa198' - white: '0xeee8d5' - - # Bright colors - bright: - black: '0x002b36' - red: '0xcb4b16' - green: '0x586e75' - yellow: '0x657b83' - blue: '0x839496' - magenta: '0x6c71c4' - cyan: '0x93a1a1' - white: '0x - -# Colors (Tomorrow Night) -#colors: - # Default colors - #primary: - # background: '#1d1f21' - # foreground: '#c5c8c6' - - # Bright and dim foreground colors - # - # The dimmed foreground color is calculated automatically if it is not - # present. If the bright foreground color is not set, or - # `draw_bold_text_with_bright_colors` is `false`, the normal foreground - # color will be used. - #dim_foreground: '#828482' - #bright_foreground: '#eaeaea' - - # Cursor colors - # - # Colors which should be used to draw the terminal cursor. - # - # Allowed values are CellForeground/CellBackground, which reference the - # affected cell, or hexadecimal colors like #ff00ff. - #cursor: - # text: CellBackground - # cursor: CellForeground - - # Vi mode cursor colors - # - # Colors for the cursor when the vi mode is active. - # - # Allowed values are CellForeground/CellBackground, which reference the - # affected cell, or hexadecimal colors like #ff00ff. - #vi_mode_cursor: - # text: CellBackground - # cursor: CellForeground - - # Search colors - # - # Colors used for the search bar and match highlighting. - #search: - # Allowed values are CellForeground/CellBackground, which reference the - # affected cell, or hexadecimal colors like #ff00ff. - #matches: - # foreground: '#000000' - # background: '#ffffff' - #focused_match: - # foreground: '#ffffff' - # background: '#000000' - - #bar: - # background: '#c5c8c6' - # foreground: '#1d1f21' - - # Keyboard regex hints - #hints: - # First character in the hint label - # - # Allowed values are CellForeground/CellBackground, which reference the - # affected cell, or hexadecimal colors like #ff00ff. - #start: - # foreground: '#1d1f21' - # background: '#e9ff5e' - - # All characters after the first one in the hint label - # - # Allowed values are CellForeground/CellBackground, which reference the - # affected cell, or hexadecimal colors like #ff00ff. - #end: - # foreground: '#e9ff5e' - # background: '#1d1f21' - - # Line indicator - # - # Color used for the indicator displaying the position in history during - # search and vi mode. - # - # By default, these will use the opposing primary color. - #line_indicator: - # foreground: None - # background: None - - # Selection colors - # - # Colors which should be used to draw the selection area. - # - # Allowed values are CellForeground/CellBackground, which reference the - # affected cell, or hexadecimal colors like #ff00ff. - #selection: - # text: CellBackground - # background: CellForeground - - # Normal colors - #normal: - # black: '#1d1f21' - # red: '#cc6666' - # green: '#b5bd68' - # yellow: '#f0c674' - # blue: '#81a2be' - # magenta: '#b294bb' - # cyan: '#8abeb7' - # white: '#c5c8c6' - - # Bright colors - #bright: - # black: '#666666' - # red: '#d54e53' - # green: '#b9ca4a' - # yellow: '#e7c547' - # blue: '#7aa6da' - # magenta: '#c397d8' - # cyan: '#70c0b1' - # white: '#eaeaea' - - # Dim colors - # - # If the dim colors are not set, they will be calculated automatically based - # on the `normal` colors. - #dim: - # black: '#131415' - # red: '#864343' - # green: '#777c44' - # yellow: '#9e824c' - # blue: '#556a7d' - # magenta: '#75617b' - # cyan: '#5b7d78' - # white: '#828482' - - # Indexed Colors - # - # The indexed colors include all colors from 16 to 256. - # When these are not set, they're filled with sensible defaults. - # - # Example: - # `- { index: 16, color: '#ff00ff' }` - # - #indexed_colors: [] - -# Bell -# -# The bell is rung every time the BEL control character is received. -#bell: - # Visual Bell Animation - # - # Animation effect for flashing the screen when the visual bell is rung. - # - # Values for `animation`: - # - Ease - # - EaseOut - # - EaseOutSine - # - EaseOutQuad - # - EaseOutCubic - # - EaseOutQuart - # - EaseOutQuint - # - EaseOutExpo - # - EaseOutCirc - # - Linear - #animation: EaseOutExpo - - # Duration of the visual bell flash in milliseconds. A `duration` of `0` will - # disable the visual bell animation. - #duration: 0 - - # Visual bell animation color. - #color: '#ffffff' - - # Bell Command - # - # This program is executed whenever the bell is rung. - # - # When set to `command: None`, no command will be executed. - # - # Example: - # command: - # program: notify-send - # args: ["Hello, World!"] - # - #command: None - -# Background opacity -# -# Window opacity as a floating point number from `0.0` to `1.0`. -# The value `0.0` is completely transparent and `1.0` is opaque. -background_opacity: 0.95 - -#selection: - # This string contains all characters that are used as separators for - # "semantic words" in Alacritty. - #semantic_escape_chars: ",│`|:\"' ()[]{}<>\t" - - # When set to `true`, selected text will be copied to the primary clipboard. - #save_to_clipboard: false - -#cursor: - # Cursor style - #style: - # Cursor shape - # - # Values for `shape`: - # - ▇ Block - # - _ Underline - # - | Beam - #shape: Block - - # Cursor blinking state - # - # Values for `blinking`: - # - Never: Prevent the cursor from ever blinking - # - Off: Disable blinking by default - # - On: Enable blinking by default - # - Always: Force the cursor to always blink - #blinking: Off - - # Vi mode cursor style - # - # If the vi mode cursor style is `None` or not specified, it will fall back to - # the style of the active value of the normal cursor. - # - # See `cursor.style` for available options. - #vi_mode_style: None - - # Cursor blinking interval in milliseconds. - #blink_interval: 750 - - # If this is `true`, the cursor will be rendered as a hollow box when the - # window is not focused. - #unfocused_hollow: true - - # Thickness of the cursor relative to the cell width as floating point number - # from `0.0` to `1.0`. - #thickness: 0.15 - -# Live config reload (changes require restart) -#live_config_reload: true - -# Shell -# -# You can set `shell.program` to the path of your favorite shell, e.g. -# `/bin/fish`. Entries in `shell.args` are passed unmodified as arguments to the -# shell. -# -# Default: -# - (macOS) /bin/bash --login -# - (Linux/BSD) user login shell -# - (Windows) powershell -shell: - program: /bin/bash - args: - - --login - -# Startup directory -# -# Directory the shell is started in. If this is unset, or `None`, the working -# directory of the parent process will be used. -#working_directory: None - -# Send ESC (\x1b) before characters when alt is pressed. -#alt_send_esc: true - -mouse: - # Click settings - # - # The `double_click` and `triple_click` settings control the time - # alacritty should wait for accepting multiple clicks as one double - # or triple click. - #double_click: { threshold: 300 } - #triple_click: { threshold: 300 } - - # If this is `true`, the cursor is temporarily hidden when typing. - hide_when_typing: true - -# Regex hints -# -# Terminal hints can be used to find text in the visible part of the terminal -# and pipe it to other applications. -#hints: - # Keys used for the hint labels. - #alphabet: "jfkdls;ahgurieowpq" - - # List with all available hints - # - # Each hint must have a `regex` and either an `action` or a `command` field. - # The fields `mouse`, `binding` and `post_processing` are optional. - # - # The fields `command`, `binding.key`, `binding.mods`, `binding.mode` and - # `mouse.mods` accept the same values as they do in the `key_bindings` section. - # - # The `mouse.enabled` field controls if the hint should be underlined while - # the mouse with all `mouse.mods` keys held or the vi mode cursor is above it. - # - # If the `post_processing` field is set to `true`, heuristics will be used to - # shorten the match if there are characters likely not to be part of the hint - # (e.g. a trailing `.`). This is most useful for URIs. - # - # Values for `action`: - # - Copy - # Copy the hint's text to the clipboard. - # - Paste - # Paste the hint's text to the terminal or search. - # - Select - # Select the hint's text. - # - MoveViModeCursor - # Move the vi mode cursor to the beginning of the hint. - #enabled: - # - regex: "(ipfs:|ipns:|magnet:|mailto:|gemini:|gopher:|https:|http:|news:|file:|git:|ssh:|ftp:)\ - # [^\u0000-\u001F\u007F-\u009F<>\"\\s{-}\\^⟨⟩`]+" - # command: xdg-open - # post_processing: true - # mouse: - # enabled: true - # mods: None - # binding: - # key: U - # mods: Control|Shift - -# Mouse bindings -# -# Mouse bindings are specified as a list of objects, much like the key -# bindings further below. -# -# To trigger mouse bindings when an application running within Alacritty -# captures the mouse, the `Shift` modifier is automatically added as a -# requirement. -# -# Each mouse binding will specify a: -# -# - `mouse`: -# -# - Middle -# - Left -# - Right -# - Numeric identifier such as `5` -# -# - `action` (see key bindings) -# -# And optionally: -# -# - `mods` (see key bindings) -#mouse_bindings: -# - { mouse: Middle, action: PasteSelection } - -# Key bindings -# -# Key bindings are specified as a list of objects. For example, this is the -# default paste binding: -# -# `- { key: V, mods: Control|Shift, action: Paste }` -# -# Each key binding will specify a: -# -# - `key`: Identifier of the key pressed -# -# - A-Z -# - F1-F24 -# - Key0-Key9 -# -# A full list with available key codes can be found here: -# https://docs.rs/glutin/*/glutin/event/enum.VirtualKeyCode.html#variants -# -# Instead of using the name of the keys, the `key` field also supports using -# the scancode of the desired key. Scancodes have to be specified as a -# decimal number. This command will allow you to display the hex scancodes -# for certain keys: -# -# `showkey --scancodes`. -# -# Then exactly one of: -# -# - `chars`: Send a byte sequence to the running application -# -# The `chars` field writes the specified string to the terminal. This makes -# it possible to pass escape sequences. To find escape codes for bindings -# like `PageUp` (`"\x1b[5~"`), you can run the command `showkey -a` outside -# of tmux. Note that applications use terminfo to map escape sequences back -# to keys. It is therefore required to update the terminfo when changing an -# escape sequence. -# -# - `action`: Execute a predefined action -# -# - ToggleViMode -# - SearchForward -# Start searching toward the right of the search origin. -# - SearchBackward -# Start searching toward the left of the search origin. -# - Copy -# - Paste -# - IncreaseFontSize -# - DecreaseFontSize -# - ResetFontSize -# - ScrollPageUp -# - ScrollPageDown -# - ScrollHalfPageUp -# - ScrollHalfPageDown -# - ScrollLineUp -# - ScrollLineDown -# - ScrollToTop -# - ScrollToBottom -# - ClearHistory -# Remove the terminal's scrollback history. -# - Hide -# Hide the Alacritty window. -# - Minimize -# Minimize the Alacritty window. -# - Quit -# Quit Alacritty. -# - ToggleFullscreen -# - SpawnNewInstance -# Spawn a new instance of Alacritty. -# - ClearLogNotice -# Clear Alacritty's UI warning and error notice. -# - ClearSelection -# Remove the active selection. -# - ReceiveChar -# - None -# -# - Vi mode exclusive actions: -# -# - Open -# Perform the action of the first matching hint under the vi mode cursor -# with `mouse.enabled` set to `true`. -# - ToggleNormalSelection -# - ToggleLineSelection -# - ToggleBlockSelection -# - ToggleSemanticSelection -# Toggle semantic selection based on `selection.semantic_escape_chars`. -# -# - Vi mode exclusive cursor motion actions: -# -# - Up -# One line up. -# - Down -# One line down. -# - Left -# One character left. -# - Right -# One character right. -# - First -# First column, or beginning of the line when already at the first column. -# - Last -# Last column, or beginning of the line when already at the last column. -# - FirstOccupied -# First non-empty cell in this terminal row, or first non-empty cell of -# the line when already at the first cell of the row. -# - High -# Top of the screen. -# - Middle -# Center of the screen. -# - Low -# Bottom of the screen. -# - SemanticLeft -# Start of the previous semantically separated word. -# - SemanticRight -# Start of the next semantically separated word. -# - SemanticLeftEnd -# End of the previous semantically separated word. -# - SemanticRightEnd -# End of the next semantically separated word. -# - WordLeft -# Start of the previous whitespace separated word. -# - WordRight -# Start of the next whitespace separated word. -# - WordLeftEnd -# End of the previous whitespace separated word. -# - WordRightEnd -# End of the next whitespace separated word. -# - Bracket -# Character matching the bracket at the cursor's location. -# - SearchNext -# Beginning of the next match. -# - SearchPrevious -# Beginning of the previous match. -# - SearchStart -# Start of the match to the left of the vi mode cursor. -# - SearchEnd -# End of the match to the right of the vi mode cursor. -# -# - Search mode exclusive actions: -# - SearchFocusNext -# Move the focus to the next search match. -# - SearchFocusPrevious -# Move the focus to the previous search match. -# - SearchConfirm -# - SearchCancel -# - SearchClear -# Reset the search regex. -# - SearchDeleteWord -# Delete the last word in the search regex. -# - SearchHistoryPrevious -# Go to the previous regex in the search history. -# - SearchHistoryNext -# Go to the next regex in the search history. -# -# - macOS exclusive actions: -# - ToggleSimpleFullscreen -# Enter fullscreen without occupying another space. -# -# - Linux/BSD exclusive actions: -# -# - CopySelection -# Copy from the selection buffer. -# - PasteSelection -# Paste from the selection buffer. -# -# - `command`: Fork and execute a specified command plus arguments -# -# The `command` field must be a map containing a `program` string and an -# `args` array of command line parameter strings. For example: -# `{ program: "alacritty", args: ["-e", "vttest"] }` -# -# And optionally: -# -# - `mods`: Key modifiers to filter binding actions -# -# - Command -# - Control -# - Option -# - Super -# - Shift -# - Alt -# -# Multiple `mods` can be combined using `|` like this: -# `mods: Control|Shift`. -# Whitespace and capitalization are relevant and must match the example. -# -# - `mode`: Indicate a binding for only specific terminal reported modes -# -# This is mainly used to send applications the correct escape sequences -# when in different modes. -# -# - AppCursor -# - AppKeypad -# - Search -# - Alt -# - Vi -# -# A `~` operator can be used before a mode to apply the binding whenever -# the mode is *not* active, e.g. `~Alt`. -# -# Bindings are always filled by default, but will be replaced when a new -# binding with the same triggers is defined. To unset a default binding, it can -# be mapped to the `ReceiveChar` action. Alternatively, you can use `None` for -# a no-op if you do not wish to receive input characters for that binding. -# -# If the same trigger is assigned to multiple actions, all of them are executed -# in the order they were defined in. -#key_bindings: - #- { key: Paste, action: Paste } - #- { key: Copy, action: Copy } - #- { key: L, mods: Control, action: ClearLogNotice } - #- { key: L, mods: Control, mode: ~Vi|~Search, chars: "\x0c" } - #- { key: PageUp, mods: Shift, mode: ~Alt, action: ScrollPageUp, } - #- { key: PageDown, mods: Shift, mode: ~Alt, action: ScrollPageDown } - #- { key: Home, mods: Shift, mode: ~Alt, action: ScrollToTop, } - #- { key: End, mods: Shift, mode: ~Alt, action: ScrollToBottom } - - # Vi Mode - #- { key: Space, mods: Shift|Control, mode: ~Search, action: ToggleViMode } - #- { key: Space, mods: Shift|Control, mode: Vi|~Search, action: ScrollToBottom } - #- { key: Escape, mode: Vi|~Search, action: ClearSelection } - #- { key: I, mode: Vi|~Search, action: ToggleViMode } - #- { key: I, mode: Vi|~Search, action: ScrollToBottom } - #- { key: C, mods: Control, mode: Vi|~Search, action: ToggleViMode } - #- { key: Y, mods: Control, mode: Vi|~Search, action: ScrollLineUp } - #- { key: E, mods: Control, mode: Vi|~Search, action: ScrollLineDown } - #- { key: G, mode: Vi|~Search, action: ScrollToTop } - #- { key: G, mods: Shift, mode: Vi|~Search, action: ScrollToBottom } - #- { key: B, mods: Control, mode: Vi|~Search, action: ScrollPageUp } - #- { key: F, mods: Control, mode: Vi|~Search, action: ScrollPageDown } - #- { key: U, mods: Control, mode: Vi|~Search, action: ScrollHalfPageUp } - #- { key: D, mods: Control, mode: Vi|~Search, action: ScrollHalfPageDown } - #- { key: Y, mode: Vi|~Search, action: Copy } - #- { key: Y, mode: Vi|~Search, action: ClearSelection } - #- { key: Copy, mode: Vi|~Search, action: ClearSelection } - #- { key: V, mode: Vi|~Search, action: ToggleNormalSelection } - #- { key: V, mods: Shift, mode: Vi|~Search, action: ToggleLineSelection } - #- { key: V, mods: Control, mode: Vi|~Search, action: ToggleBlockSelection } - #- { key: V, mods: Alt, mode: Vi|~Search, action: ToggleSemanticSelection } - #- { key: Return, mode: Vi|~Search, action: Open } - #- { key: K, mode: Vi|~Search, action: Up } - #- { key: J, mode: Vi|~Search, action: Down } - #- { key: H, mode: Vi|~Search, action: Left } - #- { key: L, mode: Vi|~Search, action: Right } - #- { key: Up, mode: Vi|~Search, action: Up } - #- { key: Down, mode: Vi|~Search, action: Down } - #- { key: Left, mode: Vi|~Search, action: Left } - #- { key: Right, mode: Vi|~Search, action: Right } - #- { key: Key0, mode: Vi|~Search, action: First } - #- { key: Key4, mods: Shift, mode: Vi|~Search, action: Last } - #- { key: Key6, mods: Shift, mode: Vi|~Search, action: FirstOccupied } - #- { key: H, mods: Shift, mode: Vi|~Search, action: High } - #- { key: M, mods: Shift, mode: Vi|~Search, action: Middle } - #- { key: L, mods: Shift, mode: Vi|~Search, action: Low } - #- { key: B, mode: Vi|~Search, action: SemanticLeft } - #- { key: W, mode: Vi|~Search, action: SemanticRight } - #- { key: E, mode: Vi|~Search, action: SemanticRightEnd } - #- { key: B, mods: Shift, mode: Vi|~Search, action: WordLeft } - #- { key: W, mods: Shift, mode: Vi|~Search, action: WordRight } - #- { key: E, mods: Shift, mode: Vi|~Search, action: WordRightEnd } - #- { key: Key5, mods: Shift, mode: Vi|~Search, action: Bracket } - #- { key: Slash, mode: Vi|~Search, action: SearchForward } - #- { key: Slash, mods: Shift, mode: Vi|~Search, action: SearchBackward } - #- { key: N, mode: Vi|~Search, action: SearchNext } - #- { key: N, mods: Shift, mode: Vi|~Search, action: SearchPrevious } - - # Search Mode - #- { key: Return, mode: Search|Vi, action: SearchConfirm } - #- { key: Escape, mode: Search, action: SearchCancel } - #- { key: C, mods: Control, mode: Search, action: SearchCancel } - #- { key: U, mods: Control, mode: Search, action: SearchClear } - #- { key: W, mods: Control, mode: Search, action: SearchDeleteWord } - #- { key: P, mods: Control, mode: Search, action: SearchHistoryPrevious } - #- { key: N, mods: Control, mode: Search, action: SearchHistoryNext } - #- { key: Up, mode: Search, action: SearchHistoryPrevious } - #- { key: Down, mode: Search, action: SearchHistoryNext } - #- { key: Return, mode: Search|~Vi, action: SearchFocusNext } - #- { key: Return, mods: Shift, mode: Search|~Vi, action: SearchFocusPrevious } - - # (Windows, Linux, and BSD only) - #- { key: V, mods: Control|Shift, mode: ~Vi, action: Paste } - #- { key: C, mods: Control|Shift, action: Copy } - #- { key: F, mods: Control|Shift, mode: ~Search, action: SearchForward } - #- { key: B, mods: Control|Shift, mode: ~Search, action: SearchBackward } - #- { key: C, mods: Control|Shift, mode: Vi|~Search, action: ClearSelection } - #- { key: Insert, mods: Shift, action: PasteSelection } - #- { key: Key0, mods: Control, action: ResetFontSize } - #- { key: Equals, mods: Control, action: IncreaseFontSize } - #- { key: Plus, mods: Control, action: IncreaseFontSize } - #- { key: NumpadAdd, mods: Control, action: IncreaseFontSize } - #- { key: Minus, mods: Control, action: DecreaseFontSize } - #- { key: NumpadSubtract, mods: Control, action: DecreaseFontSize } - - # (Windows only) - #- { key: Return, mods: Alt, action: ToggleFullscreen } - - # (macOS only) - #- { key: K, mods: Command, mode: ~Vi|~Search, chars: "\x0c" } - #- { key: K, mods: Command, mode: ~Vi|~Search, action: ClearHistory } - #- { key: Key0, mods: Command, action: ResetFontSize } - #- { key: Equals, mods: Command, action: IncreaseFontSize } - #- { key: Plus, mods: Command, action: IncreaseFontSize } - #- { key: NumpadAdd, mods: Command, action: IncreaseFontSize } - #- { key: Minus, mods: Command, action: DecreaseFontSize } - #- { key: NumpadSubtract, mods: Command, action: DecreaseFontSize } - #- { key: V, mods: Command, action: Paste } - #- { key: C, mods: Command, action: Copy } - #- { key: C, mods: Command, mode: Vi|~Search, action: ClearSelection } - #- { key: H, mods: Command, action: Hide } - #- { key: H, mods: Command|Alt, action: HideOtherApplications } - #- { key: M, mods: Command, action: Minimize } - #- { key: Q, mods: Command, action: Quit } - #- { key: W, mods: Command, action: Quit } - #- { key: N, mods: Command, action: SpawnNewInstance } - #- { key: F, mods: Command|Control, action: ToggleFullscreen } - #- { key: F, mods: Command, mode: ~Search, action: SearchForward } - #- { key: B, mods: Command, mode: ~Search, action: SearchBackward } - -#debug: - # Display the time it takes to redraw each frame. - #render_timer: false - - # Keep the log file after quitting Alacritty. - #persistent_logging: false - - # Log level - # - # Values for `log_level`: - # - Off - # - Error - # - Warn - # - Info - # - Debug - # - Trace - #log_level: Warn - - # Print all received window events. - #print_events: false diff --git a/bin/xrandr-toggle b/bin/xrandr-toggle deleted file mode 100755 index d54c60d..0000000 --- a/bin/xrandr-toggle +++ /dev/null @@ -1,311 +0,0 @@ -#!/usr/bin/python -# Copyright 2009 David Smith. GNU GPLv2 or, at your option, a later version. - -"""Fn-F7 toggle script for xrandr. - -How does it work? - -First, it's stateless, so it runs xrandr -q and parses the output into a -RandRState object. The RandRState object defines attributes and methods to -query and set xrandr options. - -Second, it proceeds through the state machine toggling to the next state in -order. The RandRStateMachine controls the transitions (i.e. it defines the -states). - -These steps are executed by the RandRToggleCommand that parses command line -arguments, instantiates the RandRState and RandRStateMachine instances, and -handles errors. - -This is one of those programs that should have existed eons ago... -""" -# ... it's a bit over engineered, I guess - -__author__ = 'david.daniel.smith@gmail.com (David Smith)' - -import logging -import subprocess -import re -import sys - - -def VecSum(*vecs): - # promise to never send me different sized vectors, ok? - size = len(vecs[0]) - result = [] - for i in range(0, size): - result.append(sum([vec[i] for vec in vecs])) - return result - - -def VecScale(scalar, vec): - return [el * scalar for el in vec] - - -class RandRState(object): - """XRandR state representation.""" - - # TODO: implement reflections, too, someday - REFLECT_NORMAL = 'reflect_normal' - REFLECT_X = 'reflect_x' - REFLECT_Y = 'reflect_y' - REFLECT_XY = 'reflect_xy' - ROTATE_NORMAL = 'rotate_normal' - ROTATE_INVERTED = 'rotate_inverted' - ROTATE_LEFT = 'rotate_left' - ROTATE_RIGHT = 'rotate_right' - - LEFT_OF = 'left_of' - RIGHT_OF = 'right_of' - ABOVE = 'above' - BELOW = 'below' - SAME_AS = 'same_as' - - def __init__(self): - """Constructor.""" - self._displays = set() # the list of display names - self._connected = set() # set of connected display names - self._position = {} # display -> (x,y) - self._resolution = {} # display -> (x,y) - - def _IterDisplays(self): - return iter(self._displays) - - def _SetDisplays(self, displays): - self._displays = set(displays) - - displays = property(_IterDisplays, _SetDisplays, None, 'display names') - - def AddDisplay(self, display): - self._displays.add(display) - - def RemoveDisplay(self, display): - self._displays.remove(display) - - def IsConnected(self, display): - return display in self._connected - - def SetConnected(self, connected): - self._connected = set(connected) - - def NumConnections(self): - return len(self._connected) - - def GetPosition(self, display): - result = self._position.get(display, None) - return result and tuple(result) or None - - def AddConnected(self, display): - self._connected.add(display) - - def RemoveConnected(self, display): - self._connected.remove(display) - - def SetPosition(self, display, position): - self._position[display] = tuple(position) - - def SetRelativePosition(self, display, relative_display, position): - logging.debug('setting %s %s %s' % (display, position, relative_display)) - rel_pos = self.GetPosition(relative_display) - rel_res = self.GetResolution(relative_display) - dis_res = self.GetResolution(display) - if position is self.LEFT_OF: - dis_pos, rel_pos = rel_pos, VecSum((dis_res[0], rel_pos[1]), - (rel_pos[0], 0)) - elif position is self.ABOVE: - dis_pos, rel_pos = rel_pos, VecSum((rel_pos[0], dis_res[1]), - (0, rel_pos[1])) - elif position is self.RIGHT_OF: - dis_pos = (rel_res[0], rel_pos[0]) - elif position is self.BELOW: - dis_pos = (rel_pos[0], rel_res[1]) - elif position is self.SAME_AS: - dis_pos = rel_pos - else: - raise RuntimeError('invalid position') - self.SetPosition(display, dis_pos) - self.SetPosition(relative_display, rel_pos) - - def GetResolution(self, display): - result = self._resolution.get(display, None) - return result and tuple(result) or None - - def SetResolution(self, display, resolution): - self._resolution[display] = tuple(resolution) - - def __str__(self): - result = 'XRandR State:\n' - for display in self.displays: - connected = ['disconnected', 'connected'][self.IsConnected(display)] - geometry = '' - resolution = self.GetResolution(display) - position = self.GetPosition(display) - if resolution is not None: - geometry += '%dx%d' % resolution - if position is not None: - geometry += '+%d+%d' % position - result += ' * ' + ' '.join((display, connected, geometry)) + '\n' - return result.strip() - - def Commit(self): - logging.info('Commiting %s' % self) - args = ['xrandr'] - for display in self.displays: - if self.IsConnected(display): - args.extend(['--output', display, - '--pos', '%dx%d' % self.GetPosition(display), - '--mode', '%dx%d' % self.GetResolution(display)]) - else: - args.extend(['--output', display, '--off']) - logging.debug('running "%s"' % ' '.join(args)) - proc = subprocess.Popen(' '.join(args), stderr=subprocess.PIPE, shell=1) - if proc.wait(): - error_msg = proc.stderr.read() - logging.error(error_msg) - raise RuntimeError(error_msg) - - @classmethod - def ParseXRandROutput(cls, xrandr_output): - screen_re = re.compile(r'^Screen') - display_re = re.compile(r'^(?P\S+)\s+((?Pdis))?' - + r'connected\s+((?P\d+)x(?P\d+)' - + r'\+(?P\d+)\+(?P\d+))?') - mode_re = re.compile(r'^\s+(?P\d+)x(?P\d+)\s+\d+') - state = cls() - line = xrandr_output.readline() - while line: - # look for a display line - match = display_re.search(line) - if not match: - line = xrandr_output.readline() - continue - # parse out the name and connection status - display = match.group('name') - connected = not bool(match.group('disconnected')) - logging.debug('Found %s display %s' % - (['disconnected', 'connected'][connected], - display)) - state.AddDisplay(display) - res = tuple((int(match.group(x) or 0) for x in ('res_x', 'res_y'))) - pos = tuple((int(match.group(x) or 0) for x in ('pos_x', 'pos_y'))) - if connected and res != (0, 0): - state.AddConnected(display) - state.SetResolution(display, res) - state.SetPosition(display, pos) - # skip until the next display line - line = xrandr_output.readline() - while line and not display_re.search(line): - line = xrandr_output.readline() - # else, look for a mode line and set the res to that - else: - while True: - line = xrandr_output.readline() - match = mode_re.match(line) - # if no mode lines, give up - if not match: - break - res = tuple((int(match.group(x)) for x in ('res_x', 'res_y'))) - state.AddConnected(display) - state.SetResolution(display, res) - state.SetPosition(display, (0, 0)) - # only need one so might as well end the loop here - break - logging.debug('Parsed %s' % state) - return state - - -class RandRStateMachine(object): - """State manipulator.""" - - def __init__(self, state): - """Constructor.""" - self._state = state - - def GetCurrentState(self): - return self._state - - def NextState(self): - # if we have a clone, then next pair to the left - if self.IsClone(): - logging.info('CLONE -> PAIR_RIGHT') - self.SetPairExtRight() - # if we have a pair to the left, then next pair to the right - elif self.IsPairExtRight(): - logging.info('PAIR_RIGHT -> PAIR_LEFT') - self.SetPairExtLeft() - # else, just set cloning - else: - logging.info('UNKNOWN (or PAIR_RIGHT) -> CLONE') - self.SetClone() - - def IsClone(self): - found_origin_count = 0 - for disp in self._state.displays: - if not self._state.IsConnected(disp): - continue - if self._state.GetPosition(disp) == (0, 0): - found_origin_count += 1 - return found_origin_count >= 2 - - def SetClone(self): - for disp in self._state.displays: - logging.info('Cloning display %s' % disp) - if not self._state.IsConnected(disp): - logging.info('Skipping disconnected display %s' % disp) - continue - self._state.SetPosition(disp, (0, 0)) - self._state.Commit() - - def _IsPairCmp(self): - if self._state.NumConnections() < 2: - return 0 - for disp in self._state.displays: - if not self._state.IsConnected(disp): - continue - if disp.startswith('LVDS'): - if self._state.GetPosition(disp) == (0, 0): - return 1 - else: - return -1 - return 0 - - def IsPairExtLeft(self): - return self._IsPairCmp() < 0 - - def IsPairExtRight(self): - return self._IsPairCmp() > 0 - - def _SetPairExt(self, direction): - lvds = '' - ext = '' - for disp in self._state.displays: - if not self._state.IsConnected(disp): - continue - if disp.startswith('LVDS'): - lvds = disp - else: - ext = disp - self._state.SetRelativePosition(ext, lvds, direction) - self._state.Commit() - - def SetPairExtLeft(self): - self._SetPairExt(self._state.LEFT_OF) - - def SetPairExtRight(self): - for disp in self._state.displays: - if disp.startswith('LVDS'): - self._state.SetPosition(disp, (0, 0)) - self._state.Commit() - self._SetPairExt(self._state.RIGHT_OF) - - -def main(): - logging.basicConfig(stream=sys.stdout, level=logging.DEBUG) - xrandr = subprocess.Popen('xrandr -q', stdout=subprocess.PIPE, shell=True) - xrandr.wait() - state = RandRState.ParseXRandROutput(xrandr.stdout) - sm = RandRStateMachine(state) - sm.NextState() - -if __name__ == '__main__': - main() diff --git a/scripts/install.sh b/scripts/install.sh index bf4c6c1..f5a5bbd 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -107,8 +107,6 @@ base_applications() { $SUDO apt autoremove $SUDO apt autoclean $SUDO apt clean - - } install_server_base() { @@ -116,17 +114,17 @@ install_server_base() { DEBIAN_FRONTEND=noninteractive - apt update - apt install -y \ + $SUDO apt update + $SUDO apt install -y \ fail2ban \ logwatch \ unattended-upgrades \ --no-install-recommends echo "... DONE... cleaning up\n\n" - apt autoremove - apt autoclean - apt clean + $SUDO apt autoremove + $SUDO apt autoclean + $SUDO apt clean echo "setting up logwatch..." echo "... TODO require email to be set as parameter" @@ -144,10 +142,9 @@ APT::Periodic::Update-Package-Lists "1"; APT::Periodic::Download-Upgradeable-Packages "1"; APT::Periodic::AutocleanInterval "7"; APT::Periodic::Unattended-Upgrade "1"; - EOF - echo " ... DONE" + echo " ... DONE" } no_suspend() { @@ -177,8 +174,8 @@ install_nvidia_docker() { } install_latex() { - apt update - apt install -y \ + $SUDO apt update + $SUDO apt install -y \ evince \ texlive \ texlive-bibtex-extra \ @@ -195,7 +192,6 @@ install_latex() { } install_workstation_apps() { - DEBIAN_FRONTEND=noninteractive $SUDO apt update @@ -246,8 +242,8 @@ install_workstation_apps() { install_sway() { echo " installing sway and wayland tools..." DEBIAN_FRONTEND=noninteractive - apt update - apt install -y \ + $SUDO apt update + $SUDO apt install -y \ brightnessctl \ mako \ sway \ @@ -270,8 +266,8 @@ install_sway() { # build swaylock-effects because its not available on Debian # https://github.com/voidgloom/swaylock-effects ( - apt update - apt install -y \ + $SUDO apt update + $SUDO apt install -y \ wayland-protocols \ libwayland-client++0 \ libcairo2-dev \ @@ -282,7 +278,7 @@ install_sway() { git clone https://github.com/voidgloom/swaylock-effects ${TARGET} cd ${TARGET} meson build && ninja -C build && sudo ninja -C build install - sudo chmod a+s /usr/local/bin/swaylock + $SUDO chmod a+s /usr/local/bin/swaylock ) } @@ -339,7 +335,7 @@ install_syncthing() { # Update and install syncthing: $SUDO apt-get update - $SUDO apt-get install syncthing + $SUDO apt-get install -y syncthing echo "... DONE... cleaning up\n\n" $SUDO apt autoremove $SUDO apt autoclean @@ -447,7 +443,7 @@ EOF docker-ce \ --no-install-recommends - $SUDO addgroup ${USERNAME} docker + $SUDO usermod -aG docker ${USERNAME} docker version docker info @@ -462,7 +458,6 @@ install_compose() { echo "installing docker-compose $VERS ... curling from github" curl -SL "https://github.com/docker/compose/releases/download/${VERS}/${FILE}" -o /tmp/${FILE} - curl -SL "https://github.com/docker/compose/releases/download/${VERS}/${FILE}.sha256" -o /tmp/${FILE}.sha256 if [ ! $(cat /tmp/${FILE}.sha256 | sha256sum -c -) ]; then @@ -541,21 +536,11 @@ install_virtualbox() { # deb [arch=amd64] https://download.docker.com/linux/debian buster nightly EOF - apt update - apt install -y \ - docker-ce \ - --no-install-recommends - - groupadd docker - addgroup ${USERNAME} docker - - docker version - docker info } # install/update golang from source install_golang() { - export GO_VERSION=1.17.3 + export GO_VERSION=1.18 export GO_SRC=/usr/local/go # if we are passing the version @@ -563,7 +548,6 @@ install_golang() { export GO_VERSION=$1 fi - # subshell because we `cd` ( curl -sSL "https://storage.googleapis.com/golang/go${GO_VERSION}.linux-amd64.tar.gz" | $SUDO tar -v -C /usr/local -xz ) @@ -573,8 +557,8 @@ install_rust() { echo "... rustup.sh ... " curl --proto 'https' --tlsv1.2 https://sh.rustup.rs | sh - eco "... adding dependencies for alacritty and i3status-rs ... " - sudo apt install -y \ + echo "... adding dependencies for alacritty and i3status-rs ... " + $SUDO apt install -y \ cmake \ fonts-font-awesome \ gcc \ @@ -588,8 +572,6 @@ install_rust() { python3 \ --no-install-recommends - # for whatever reason alacritty is not available in debian repos - cargo install alacritty cargo install du-dust ( @@ -600,7 +582,6 @@ install_rust() { cargo install --path . ./install.sh ) - } main() { @@ -617,7 +598,6 @@ main() { install_compose ;; server) - apt_sources buster base_applications install_server_base install_docker diff --git a/scripts/install_arch.sh b/scripts/install_arch.sh index 8f4daea..c5631e7 100755 --- a/scripts/install_arch.sh +++ b/scripts/install_arch.sh @@ -41,6 +41,7 @@ base_applications() { mount \ net-tools \ networkmanager \ + pacman-contrib \ rsync \ openssh \ sudo \ @@ -256,6 +257,8 @@ install_docker() { docker \ docker-compose + $SUDO usermod -aG docker $USERNAME + docker version docker info } diff --git a/wireguard/README.org b/wireguard/README.org index 5518a74..86965d1 100644 --- a/wireguard/README.org +++ b/wireguard/README.org @@ -68,7 +68,7 @@ *** Sync the configuration without restarting the interface - From `man wg-quick`: The strip command is useful for reloading configuration + From ~man wg-quick~: The strip command is useful for reloading configuration files without disrupting ac‐ tive sessions: #+begin_src bash