mirror of
https://github.com/frebib/dotfiles.git
synced 2024-06-14 12:57:23 +00:00
Merge remote-tracking branch 'origin/master' into surface
This commit is contained in:
commit
d8b36c48bb
@ -1,4 +1,4 @@
|
||||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
|
||||
# Run all system xinitrc shell scripts
|
||||
xinitdir="/etc/X11/xinit/xinitrc.d"
|
||||
@ -11,35 +11,12 @@ if [ -d "$xinitdir" ]; then
|
||||
done
|
||||
fi
|
||||
|
||||
source $HOME/.profile
|
||||
|
||||
xrdb -merge $XDG_CONFIG_HOME/X11/xresources
|
||||
xrandr --dpi $(xrdb -query | grep -i xft.dpi | cut -d: -f2)
|
||||
xrandr --output eDP1 --primary
|
||||
|
||||
setxkbmap -option caps:none
|
||||
xset r rate 200 18
|
||||
|
||||
|
||||
export TERMINAL="termite"
|
||||
export BROWSER="chromium"
|
||||
export _JAVA_OPTIONS="-Dawt.useSystemAAFontSettings=on -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel"
|
||||
export QT_QPA_PLATFORMTHEME=gtk2
|
||||
export QT_STYLE_OVERRIDE=gtk2
|
||||
export XDG_CURRENT_DESKTOP="GNOME" # Fixes xdg-open
|
||||
|
||||
# Merge system clipboards
|
||||
if [ -n "$DISPLAY" ] && exists autocutsel && ! pidof autocutsel 1>/dev/null; then
|
||||
autocutsel -fork
|
||||
autocutsel -selection PRIMARY -fork
|
||||
fi
|
||||
# Source generic xprofile stuff
|
||||
source "$(dirname "${BASH_SOURCE[0]}")/xprofile"
|
||||
|
||||
# Start the gnome-keyring if it's installed
|
||||
if exists gnome-keyring-daemon; then
|
||||
export $(/usr/bin/gnome-keyring-daemon --start --components=pkcs11,secrets,ssh,gnupg)
|
||||
fi
|
||||
|
||||
~/.local/share/surface-scripts/pend &
|
||||
~/.local/share/surface-scripts/rotationd &
|
||||
|
||||
exec i3
|
||||
|
28
.config/X11/xprofile
Normal file
28
.config/X11/xprofile
Normal file
@ -0,0 +1,28 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Graphical-specific environment variables
|
||||
export TERMINAL="termite"
|
||||
export BROWSER="chromium"
|
||||
export _JAVA_OPTIONS="-Dawt.useSystemAAFontSettings=on -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel"
|
||||
export QT_QPA_PLATFORMTHEME=gtk2
|
||||
export QT_STYLE_OVERRIDE=gtk2
|
||||
export XDG_CURRENT_DESKTOP="GNOME" # Fixes xdg-open
|
||||
|
||||
|
||||
# Load Xorg resources and set the DPI
|
||||
xrdb -merge $XDG_CONFIG_HOME/X11/xresources
|
||||
xrandr --dpi $(xrdb -query | grep -i xft.dpi | cut -d: -f2)
|
||||
xrandr --output eDP1 --primary
|
||||
|
||||
setxkbmap -option caps:none
|
||||
xset r rate 200 18
|
||||
|
||||
|
||||
# Merge system clipboards
|
||||
if [ -n "$DISPLAY" ] && exists autocutsel && ! pidof autocutsel 1>/dev/null; then
|
||||
autocutsel -fork
|
||||
autocutsel -selection PRIMARY -fork
|
||||
fi
|
||||
|
||||
~/.local/share/surface-scripts/pend &
|
||||
~/.local/share/surface-scripts/rotationd &
|
463
.config/alacritty/alacritty.yml
Normal file
463
.config/alacritty/alacritty.yml
Normal file
@ -0,0 +1,463 @@
|
||||
# Configuration for Alacritty, the GPU enhanced terminal emulator.
|
||||
|
||||
|
||||
# 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: xterm-256color
|
||||
|
||||
window:
|
||||
# Window dimensions (changes require restart)
|
||||
#
|
||||
# Specified in number of columns/lines, not pixels.
|
||||
# If both are `0`, this setting is ignored.
|
||||
dimensions:
|
||||
columns: 80
|
||||
lines: 24
|
||||
|
||||
# Window padding (changes require restart)
|
||||
#
|
||||
# Blank space added around the window in pixels. This padding is not scaled
|
||||
# by DPI and the specified value is always added at both opposing sides.
|
||||
padding:
|
||||
x: 8
|
||||
y: 8
|
||||
|
||||
# Window decorations
|
||||
#
|
||||
# Values for `decorations`:
|
||||
# - full: Borders and title bar
|
||||
# - none: Neither borders nor title bar
|
||||
decorations: full
|
||||
|
||||
scrolling:
|
||||
# Maximum number of lines in the scrollback buffer.
|
||||
# Specifying '0' will disable scrolling.
|
||||
history: 10000
|
||||
|
||||
# Number of lines the viewport will move for every line scrolled when
|
||||
# scrollback is enabled (history > 0).
|
||||
multiplier: 3
|
||||
|
||||
# Faux Scrolling
|
||||
#
|
||||
# The `faux_multiplier` setting controls the number of lines the terminal
|
||||
# should scroll when the alternate screen buffer is active. This is used
|
||||
# to allow mouse scrolling for applications like `man`.
|
||||
#
|
||||
# Specifying `0` will disable faux scrolling.
|
||||
faux_multiplier: 3
|
||||
|
||||
# Scroll to the bottom when new text is written to the terminal.
|
||||
auto_scroll: false
|
||||
|
||||
# Spaces per Tab (changes require restart)
|
||||
#
|
||||
# This setting defines the width of a tab in cells.
|
||||
#
|
||||
# Some applications, like Emacs, rely on knowing about the width of a tab.
|
||||
# To prevent unexpected behavior in these applications, it's also required to
|
||||
# change the `it` value in terminfo when altering this setting.
|
||||
tabspaces: 8
|
||||
|
||||
# Font configuration (changes require restart)
|
||||
#
|
||||
# Important font attributes like antialiasing, subpixel aa, and hinting can be
|
||||
# controlled through fontconfig. Specifically, the following attributes should
|
||||
# have an effect:
|
||||
# - hintstyle
|
||||
# - antialias
|
||||
# - lcdfilter
|
||||
# - rgba
|
||||
#
|
||||
# For instance, if you wish to disable subpixel antialiasing, you might set the
|
||||
# rgba property to `none`. If you wish to completely disable antialiasing, you
|
||||
# can set antialias to `false`.
|
||||
#
|
||||
# Please see these resources for more information on how to use fontconfig:
|
||||
# - https://wiki.archlinux.org/index.php/font_configuration#Fontconfig_configuration
|
||||
# - file:///usr/share/doc/fontconfig/fontconfig-user.html
|
||||
font:
|
||||
# Normal (roman) font face
|
||||
normal:
|
||||
family: monospace
|
||||
# The `style` can be specified to pick a specific face.
|
||||
# style: Regular
|
||||
|
||||
# Bold font face
|
||||
bold:
|
||||
family: monospace
|
||||
# The `style` can be specified to pick a specific face.
|
||||
# style: Bold
|
||||
|
||||
# Italic font face
|
||||
italic:
|
||||
family: monospace
|
||||
# The `style` can be specified to pick a specific face.
|
||||
# style: 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 upwards.
|
||||
glyph_offset:
|
||||
x: 0
|
||||
y: 0
|
||||
|
||||
# Scale the font size based on the monitor's DPI. This will lead to bigger text on HiDPI
|
||||
# screens and make reading text a little easier.
|
||||
# On X11 it is possible to change the DPI for each instance of alacritty by using
|
||||
# `WINIT_HIDPI_FACTOR=1.0 alacritty` to scale the font.
|
||||
scale_with_dpi: true
|
||||
|
||||
# Display the time it takes to redraw each frame.
|
||||
render_timer: false
|
||||
|
||||
# Use custom cursor colors. If `true`, the `colors.cursor.foreground` and
|
||||
# `colors.cursor.background` colors will be used to display the cursor.
|
||||
# Otherwise the cell colors are inverted for the cursor.
|
||||
custom_cursor_colors: true
|
||||
|
||||
# If `true`, bold text is drawn using the bright color variants.
|
||||
draw_bold_text_with_bright_colors: true
|
||||
|
||||
colors:
|
||||
# Default colors
|
||||
primary:
|
||||
foreground: '0xeceff1'
|
||||
background: '0x383c4a'
|
||||
|
||||
# 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: '0x9a9a9a'
|
||||
#bright_foreground: '0xffffff'
|
||||
|
||||
# Cursor colors
|
||||
#
|
||||
# These will only be used when the `custom_cursor_colors` field is set to `true`.
|
||||
cursor:
|
||||
text: '0xeceff1'
|
||||
cursor: '0x5294e2'
|
||||
|
||||
# Normal colors
|
||||
normal:
|
||||
black: '0x333638'
|
||||
red: '0xf41f1c'
|
||||
green: '0x8bc34a'
|
||||
yellow: '0xffc107'
|
||||
blue: '0x0266f4'
|
||||
magenta: '0xcc17cc'
|
||||
cyan: '0x10aeba'
|
||||
white: '0x8b9396'
|
||||
|
||||
# Bright colors
|
||||
bright:
|
||||
black: '0x475760'
|
||||
red: '0xe53727'
|
||||
green: '0x9ccc65'
|
||||
yellow: '0xffa000'
|
||||
blue: '0x81b3f9'
|
||||
magenta: '0xa56ecc'
|
||||
cyan: '0x5ddae2'
|
||||
white: '0xeceff1'
|
||||
|
||||
# Indexed Colors
|
||||
#
|
||||
# The indexed colors include all colors from 16 to 256.
|
||||
# When these are not set, they're filled with sensible defaults.
|
||||
#
|
||||
#indexed_colors:
|
||||
# - { index: 16, color: '0x000000' }
|
||||
|
||||
# Visual Bell
|
||||
#
|
||||
# Any time the BEL code is received, Alacritty "rings" the visual bell. Once
|
||||
# rung, the terminal background will be set to white and transition back to the
|
||||
# default background color. You can control the rate of this transition by
|
||||
# setting the `duration` property (represented in milliseconds). You can also
|
||||
# configure the transition function by setting the `animation` property.
|
||||
#
|
||||
# Values for `animation`:
|
||||
# - Ease
|
||||
# - EaseOut
|
||||
# - EaseOutSine
|
||||
# - EaseOutQuad
|
||||
# - EaseOutCubic
|
||||
# - EaseOutQuart
|
||||
# - EaseOutQuint
|
||||
# - EaseOutExpo
|
||||
# - EaseOutCirc
|
||||
# - Linear
|
||||
#
|
||||
# Specifying a `duration` of `0` will disable the visual bell.
|
||||
visual_bell:
|
||||
animation: EaseOutExpo
|
||||
duration: 0
|
||||
|
||||
# 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
|
||||
|
||||
# Mouse bindings
|
||||
#
|
||||
# Available fields:
|
||||
# - mouse
|
||||
# - action
|
||||
# - mods (optional)
|
||||
#
|
||||
# Values for `mouse`:
|
||||
# - Middle
|
||||
# - Left
|
||||
# - Right
|
||||
# - Numeric identifier such as `5`
|
||||
#
|
||||
# All available `mods` and `action` values are documented in the key binding
|
||||
# section.
|
||||
mouse_bindings:
|
||||
- { mouse: Middle, action: PasteSelection }
|
||||
|
||||
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 }
|
||||
|
||||
selection:
|
||||
semantic_escape_chars: ",│`|:\"' ()[]{}<>"
|
||||
|
||||
# When set to `true`, selected text will be copied to both the primary and
|
||||
# the selection clipboard. Otherwise, it will only be copied to the selection
|
||||
# clipboard.
|
||||
save_to_clipboard: false
|
||||
|
||||
dynamic_title: true
|
||||
|
||||
hide_cursor_when_typing: false
|
||||
|
||||
# Cursor style
|
||||
#
|
||||
# Values for 'cursor_style':
|
||||
# - Block
|
||||
# - Underline
|
||||
# - Beam
|
||||
cursor_style: Block
|
||||
|
||||
# If this is `true`, the cursor will be rendered as a hollow box when the
|
||||
# window is not focused.
|
||||
unfocused_hollow_cursor: true
|
||||
|
||||
# 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.
|
||||
#
|
||||
#shell:
|
||||
# program: /bin/bash
|
||||
# args:
|
||||
# - --login
|
||||
|
||||
# Key bindings
|
||||
#
|
||||
# Key bindings are specified as a list of objects. Each binding will specify
|
||||
# a key and modifiers required to trigger it, terminal modes where the binding
|
||||
# is applicable, and what should be done when the key binding fires. It can
|
||||
# either send a byte sequnce to the running application (`chars`), execute
|
||||
# a predefined action (`action`) or fork and execute a specified command plus
|
||||
# arguments (`command`).
|
||||
#
|
||||
# Example:
|
||||
# `- { key: V, mods: Command, action: Paste }`
|
||||
#
|
||||
# Available fields:
|
||||
# - key
|
||||
# - mods (optional)
|
||||
# - chars | action | command (exactly one required)
|
||||
# - mode (optional)
|
||||
#
|
||||
# Values for `key`:
|
||||
# - `A` -> `Z`
|
||||
# - `F1` -> `F12`
|
||||
# - `Key1` -> `Key0`
|
||||
#
|
||||
# A full list with available key codes can be found here:
|
||||
# https://docs.rs/glutin/*/glutin/enum.VirtualKeyCode.html#variants
|
||||
#
|
||||
# Values for `mods`:
|
||||
# - Command
|
||||
# - Control
|
||||
# - Shift
|
||||
# - Alt
|
||||
#
|
||||
# Multiple `mods` can be combined using `|` like this: `mods: Control|Shift`.
|
||||
# Whitespace and capitalization is relevant and must match the example.
|
||||
#
|
||||
# Values for `chars`:
|
||||
# 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.
|
||||
#
|
||||
# Values for `action`:
|
||||
# - Paste
|
||||
# - PasteSelection
|
||||
# - Copy
|
||||
# - IncreaseFontSize
|
||||
# - DecreaseFontSize
|
||||
# - ResetFontSize
|
||||
# - ScrollPageUp
|
||||
# - ScrollPageDown
|
||||
# - ScrollToTop
|
||||
# - ScrollToBottom
|
||||
# - ClearHistory
|
||||
# - Hide
|
||||
# - Quit
|
||||
#
|
||||
# Values for `command`:
|
||||
# The `command` field must be a map containing a `program` string and
|
||||
# an `args` array of command line parameter strings.
|
||||
#
|
||||
# Example:
|
||||
# `command: { program: "alacritty", args: ["-e", "vttest"] }`
|
||||
#
|
||||
# Values for `mode`:
|
||||
# - ~AppCursor
|
||||
# - AppCursor
|
||||
# - ~AppKeypad
|
||||
# - AppKeypad
|
||||
key_bindings:
|
||||
- { key: V, mods: Control|Shift, action: Paste }
|
||||
- { key: C, mods: Control|Shift, action: Copy }
|
||||
- { key: Paste, action: Paste }
|
||||
- { key: Copy, action: Copy }
|
||||
- { key: Q, mods: Command, action: Quit }
|
||||
- { key: W, mods: Command, action: Quit }
|
||||
- { key: Insert, mods: Shift, action: PasteSelection }
|
||||
- { key: Key0, mods: Control, action: ResetFontSize }
|
||||
- { key: Equals, mods: Control, action: IncreaseFontSize }
|
||||
- { key: Subtract, mods: Control, action: DecreaseFontSize }
|
||||
- { key: Home, chars: "\x1bOH", mode: AppCursor }
|
||||
- { key: Home, chars: "\x1b[H", mode: ~AppCursor }
|
||||
- { key: End, chars: "\x1bOF", mode: AppCursor }
|
||||
- { key: End, chars: "\x1b[F", mode: ~AppCursor }
|
||||
- { key: PageUp, mods: Shift, chars: "\x1b[5;2~" }
|
||||
- { key: PageUp, mods: Control, chars: "\x1b[5;5~" }
|
||||
- { key: PageUp, chars: "\x1b[5~" }
|
||||
- { key: PageDown, mods: Shift, chars: "\x1b[6;2~" }
|
||||
- { key: PageDown, mods: Control, chars: "\x1b[6;5~" }
|
||||
- { key: PageDown, chars: "\x1b[6~" }
|
||||
- { key: Tab, mods: Shift, chars: "\x1b[Z" }
|
||||
- { key: Back, chars: "\x7f" }
|
||||
- { key: Back, mods: Alt, chars: "\x1b\x7f" }
|
||||
- { key: Insert, chars: "\x1b[2~" }
|
||||
- { key: Delete, chars: "\x1b[3~" }
|
||||
- { key: Left, mods: Shift, chars: "\x1b[1;2D" }
|
||||
- { key: Left, mods: Control, chars: "\x1b[1;5D" }
|
||||
- { key: Left, mods: Alt, chars: "\x1b[1;3D" }
|
||||
- { key: Left, chars: "\x1b[D", mode: ~AppCursor }
|
||||
- { key: Left, chars: "\x1bOD", mode: AppCursor }
|
||||
- { key: Right, mods: Shift, chars: "\x1b[1;2C" }
|
||||
- { key: Right, mods: Control, chars: "\x1b[1;5C" }
|
||||
- { key: Right, mods: Alt, chars: "\x1b[1;3C" }
|
||||
- { key: Right, chars: "\x1b[C", mode: ~AppCursor }
|
||||
- { key: Right, chars: "\x1bOC", mode: AppCursor }
|
||||
- { key: Up, mods: Shift, chars: "\x1b[1;2A" }
|
||||
- { key: Up, mods: Control, chars: "\x1b[1;5A" }
|
||||
- { key: Up, mods: Alt, chars: "\x1b[1;3A" }
|
||||
- { key: Up, chars: "\x1b[A", mode: ~AppCursor }
|
||||
- { key: Up, chars: "\x1bOA", mode: AppCursor }
|
||||
- { key: Down, mods: Shift, chars: "\x1b[1;2B" }
|
||||
- { key: Down, mods: Control, chars: "\x1b[1;5B" }
|
||||
- { key: Down, mods: Alt, chars: "\x1b[1;3B" }
|
||||
- { key: Down, chars: "\x1b[B", mode: ~AppCursor }
|
||||
- { key: Down, chars: "\x1bOB", mode: AppCursor }
|
||||
- { key: F1, chars: "\x1bOP" }
|
||||
- { key: F2, chars: "\x1bOQ" }
|
||||
- { key: F3, chars: "\x1bOR" }
|
||||
- { key: F4, chars: "\x1bOS" }
|
||||
- { key: F5, chars: "\x1b[15~" }
|
||||
- { key: F6, chars: "\x1b[17~" }
|
||||
- { key: F7, chars: "\x1b[18~" }
|
||||
- { key: F8, chars: "\x1b[19~" }
|
||||
- { key: F9, chars: "\x1b[20~" }
|
||||
- { key: F10, chars: "\x1b[21~" }
|
||||
- { key: F11, chars: "\x1b[23~" }
|
||||
- { key: F12, chars: "\x1b[24~" }
|
||||
- { key: F1, mods: Shift, chars: "\x1b[1;2P" }
|
||||
- { key: F2, mods: Shift, chars: "\x1b[1;2Q" }
|
||||
- { key: F3, mods: Shift, chars: "\x1b[1;2R" }
|
||||
- { key: F4, mods: Shift, chars: "\x1b[1;2S" }
|
||||
- { key: F5, mods: Shift, chars: "\x1b[15;2~" }
|
||||
- { key: F6, mods: Shift, chars: "\x1b[17;2~" }
|
||||
- { key: F7, mods: Shift, chars: "\x1b[18;2~" }
|
||||
- { key: F8, mods: Shift, chars: "\x1b[19;2~" }
|
||||
- { key: F9, mods: Shift, chars: "\x1b[20;2~" }
|
||||
- { key: F10, mods: Shift, chars: "\x1b[21;2~" }
|
||||
- { key: F11, mods: Shift, chars: "\x1b[23;2~" }
|
||||
- { key: F12, mods: Shift, chars: "\x1b[24;2~" }
|
||||
- { key: F1, mods: Control, chars: "\x1b[1;5P" }
|
||||
- { key: F2, mods: Control, chars: "\x1b[1;5Q" }
|
||||
- { key: F3, mods: Control, chars: "\x1b[1;5R" }
|
||||
- { key: F4, mods: Control, chars: "\x1b[1;5S" }
|
||||
- { key: F5, mods: Control, chars: "\x1b[15;5~" }
|
||||
- { key: F6, mods: Control, chars: "\x1b[17;5~" }
|
||||
- { key: F7, mods: Control, chars: "\x1b[18;5~" }
|
||||
- { key: F8, mods: Control, chars: "\x1b[19;5~" }
|
||||
- { key: F9, mods: Control, chars: "\x1b[20;5~" }
|
||||
- { key: F10, mods: Control, chars: "\x1b[21;5~" }
|
||||
- { key: F11, mods: Control, chars: "\x1b[23;5~" }
|
||||
- { key: F12, mods: Control, chars: "\x1b[24;5~" }
|
||||
- { key: F1, mods: Alt, chars: "\x1b[1;6P" }
|
||||
- { key: F2, mods: Alt, chars: "\x1b[1;6Q" }
|
||||
- { key: F3, mods: Alt, chars: "\x1b[1;6R" }
|
||||
- { key: F4, mods: Alt, chars: "\x1b[1;6S" }
|
||||
- { key: F5, mods: Alt, chars: "\x1b[15;6~" }
|
||||
- { key: F6, mods: Alt, chars: "\x1b[17;6~" }
|
||||
- { key: F7, mods: Alt, chars: "\x1b[18;6~" }
|
||||
- { key: F8, mods: Alt, chars: "\x1b[19;6~" }
|
||||
- { key: F9, mods: Alt, chars: "\x1b[20;6~" }
|
||||
- { key: F10, mods: Alt, chars: "\x1b[21;6~" }
|
||||
- { key: F11, mods: Alt, chars: "\x1b[23;6~" }
|
||||
- { key: F12, mods: Alt, chars: "\x1b[24;6~" }
|
||||
- { key: F1, mods: Super, chars: "\x1b[1;3P" }
|
||||
- { key: F2, mods: Super, chars: "\x1b[1;3Q" }
|
||||
- { key: F3, mods: Super, chars: "\x1b[1;3R" }
|
||||
- { key: F4, mods: Super, chars: "\x1b[1;3S" }
|
||||
- { key: F5, mods: Super, chars: "\x1b[15;3~" }
|
||||
- { key: F6, mods: Super, chars: "\x1b[17;3~" }
|
||||
- { key: F7, mods: Super, chars: "\x1b[18;3~" }
|
||||
- { key: F8, mods: Super, chars: "\x1b[19;3~" }
|
||||
- { key: F9, mods: Super, chars: "\x1b[20;3~" }
|
||||
- { key: F10, mods: Super, chars: "\x1b[21;3~" }
|
||||
- { key: F11, mods: Super, chars: "\x1b[23;3~" }
|
||||
- { key: F12, mods: Super, chars: "\x1b[24;3~" }
|
@ -149,7 +149,7 @@
|
||||
max_icon_size = 72
|
||||
|
||||
# Paths to default icons.
|
||||
icon_path = /usr/share/icons/Xenlism-Wildfire/Status/:/usr/share/icons/Xenlism-Wildfire/Devices/:/usr/share/icons/Adwaita/scalable/status:/usr/share/icons/Adwaita/scalable/devices
|
||||
icon_path = /usr/share/icons/Xenlism-Wildfire/Status/:/usr/share/icons/Xenlism-Wildfire/Devices/:/usr/share/icons/Adwaita/32x32/status:/usr/share/icons/Adwaita/32x32/devices
|
||||
frame_width = 4
|
||||
frame_color = "#404552"
|
||||
|
||||
|
@ -5,9 +5,9 @@
|
||||
[core]
|
||||
autocrlf = input
|
||||
excludesfile = $HOME/.config/git/gitignore
|
||||
pager = /usr/share/git/diff-highlight/diff-highlight | $PAGER
|
||||
pager = diff-highlight | $PAGER
|
||||
[interactive]
|
||||
diffFilter = /usr/share/git/diff-highlight/diff-highlight
|
||||
diffFilter = diff-highlight
|
||||
[commit]
|
||||
gpgsign = true
|
||||
[push]
|
||||
|
@ -14,15 +14,15 @@ bindsym $alt+F4 kill
|
||||
|
||||
# change window focus
|
||||
bindsym $mod+d focus left
|
||||
bindsym $mod+n focus right
|
||||
bindsym $mod+t focus up
|
||||
bindsym $mod+h focus down
|
||||
bindsym $mod+t focus up
|
||||
bindsym $mod+n focus right
|
||||
|
||||
# move focused window
|
||||
bindsym $mod+Shift+d move left
|
||||
bindsym $mod+Shift+n move down
|
||||
bindsym $mod+Shift+h move down
|
||||
bindsym $mod+Shift+t move up
|
||||
bindsym $mod+Shift+h move right
|
||||
bindsym $mod+Shift+n move right
|
||||
|
||||
# split in horizontal orientation
|
||||
bindsym $mod+m split h
|
||||
@ -131,49 +131,46 @@ new_float none
|
||||
|
||||
gaps inner 9
|
||||
gaps outer 1
|
||||
#smart_gaps on
|
||||
|
||||
focus_follows_mouse yes
|
||||
|
||||
# keybindings
|
||||
bindsym $mod+Shift+j reload
|
||||
#bindsym $mod+Shift+p restart
|
||||
bindsym $mod+c exec chromium
|
||||
bindsym $mod+v exec "i3-sensible-terminal -e \\"$SHELL -c vim;$SHELL\\"
|
||||
bindsym $mod+Ctrl+v exec "i3-sensible-terminal -r floating-term -e \\"$SHELL -c vim;$SHELL\\"
|
||||
bindsym Mod1+Tab exec ~/.config/i3/alt-tab.sh
|
||||
bindsym $mod+Return exec i3-sensible-terminal
|
||||
bindsym $mod+Ctrl+Return exec i3-sensible-terminal -r floating-term --geometry 96x30
|
||||
bindsym $mod+Shift+Return exec i3-sensible-terminal -d "`xcwd`"
|
||||
bindsym $mod+Ctrl+Shift+Return exec i3-sensible-terminal -r floating-term --geometry 96x30 -d "`xcwd`"
|
||||
bindsym $mod+l exec ~/.config/i3/lock.sh
|
||||
# -fg "#CCD3DAE3" -bg "#CC383C4A" -hlbg "#CC5294E2"
|
||||
bindsym $mod+space exec "pkill rofi; rofi -show run -sidebar-mode -terminal i3-sensible-terminal -normal-window"
|
||||
bindsym $mod+Shift+p exec rofi-pass
|
||||
bindsym $mod+Shift+e exec rofi-emoji
|
||||
bindsym $mod+Shift+i exec rofi-fontawesome
|
||||
bindsym --release Print exec imgur-screenshot
|
||||
bindsym --release $mod+Print exec imgur-screenshot -f
|
||||
bindsym $mod+$alt+space exec --no-startup-id ~/.config/i3/cycleaudio.py && pkill -RTMIN+10 i3blocks
|
||||
bindsym $mod+numbersign exec "termite -e 'sh -c xclip\ -o\ |\ gpg\ --decrypt\ 2>&1\ \;\ $SHELL'"
|
||||
bindsym $mod+r exec "bash -c 'pwgen -nc 32 1 | tee >(xargs notify-send Generated\ password\:) | xclip -i'"
|
||||
bindsym $mod+g exec "LINK=$(gist -PRpc); notify-send -c transfer \\"<a href=\\\\"$LINK\\\\">$LINK</a>\\""
|
||||
bindsym $mod+Shift+j reload
|
||||
bindsym $mod+c exec chromium
|
||||
bindsym $mod+v exec "i3-sensible-terminal -e \\"$SHELL -c vim;$SHELL\\"
|
||||
bindsym $mod+Ctrl+v exec "i3-sensible-terminal -r floating-term -e \\"$SHELL -c vim;$SHELL\\"
|
||||
bindsym Mod1+Tab exec ~/.config/i3/alt-tab.sh
|
||||
bindsym $mod+Return exec i3-sensible-terminal
|
||||
bindsym $mod+Ctrl+Return exec i3-sensible-terminal -r floating-term --geometry 96x30
|
||||
bindsym $mod+Shift+Return exec i3-sensible-terminal -d "`xcwd`"
|
||||
bindsym $mod+Ctrl+Shift+Return exec i3-sensible-terminal -r floating-term --geometry 96x30 -d "`xcwd`"
|
||||
bindsym $mod+l exec ~/.config/i3/lock.sh
|
||||
bindsym $mod+space exec "pkill rofi; rofi -show run -sidebar-mode -terminal i3-sensible-terminal -normal-window"
|
||||
bindsym $mod+Shift+p exec rofi-pass
|
||||
bindsym $mod+Shift+e exec rofi-emoji
|
||||
bindsym $mod+Shift+i exec rofi-fontawesome
|
||||
bindsym --release Print exec screenshot
|
||||
bindsym --release $mod+Print exec imgur-screenshot
|
||||
bindsym $mod+$alt+space exec --no-startup-id ~/.config/i3/cycleaudio.py && pkill -RTMIN+10 i3blocks
|
||||
bindsym $mod+numbersign exec "termite -e 'sh -c xclip\ -o\ |\ gpg\ --decrypt\ 2>&1\ \;\ $SHELL'"
|
||||
bindsym $mod+r exec "bash -c 'pwgen -nc 32 1 | tee >(xargs notify-send Generated\ password\:) | xclip -i'"
|
||||
bindsym $mod+g exec "LINK=$(gist -PRpc); notify-send -c transfer \\"<a href=\\\\"$LINK\\\\">$LINK</a>\\""
|
||||
|
||||
# Media player controls
|
||||
bindsym XF86AudioPlay exec --no-startup-id mpc toggle
|
||||
bindsym XF86AudioPause exec --no-startup-id mpc pause
|
||||
bindsym XF86AudioStop exec --no-startup-id mpc stop
|
||||
bindsym XF86AudioNext exec --no-startup-id mpc next
|
||||
bindsym XF86AudioPrev exec --no-startup-id mpc previous
|
||||
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +1000
|
||||
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -1000
|
||||
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle
|
||||
bindsym XF86MonBrightnessUp exec xbacklight -inc 5 && pkill -RTMIN+12 i3blocks
|
||||
bindsym XF86MonBrightnessDown exec xbacklight -dec 5 && pkill -RTMIN+12 i3blocks
|
||||
exec --no-startup-id "ip monitor | while read; do pkill -RTMIN+15 i3blocks; done"
|
||||
bindsym XF86AudioPlay exec --no-startup-id mpc toggle
|
||||
bindsym XF86AudioPause exec --no-startup-id mpc pause
|
||||
bindsym XF86AudioStop exec --no-startup-id mpc stop
|
||||
bindsym XF86AudioNext exec --no-startup-id mpc next
|
||||
bindsym XF86AudioPrev exec --no-startup-id mpc previous
|
||||
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +1000
|
||||
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -1000
|
||||
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle
|
||||
bindsym XF86MonBrightnessUp exec xbacklight -inc 5 && pkill -RTMIN+12 i3blocks
|
||||
bindsym XF86MonBrightnessDown exec xbacklight -dec 5 && pkill -RTMIN+12 i3blocks
|
||||
|
||||
# app launch shortcuts
|
||||
exec --no-startup-id ~/.config/i3/disable-standby-fs.py
|
||||
exec --no-startup-id "ip monitor | while read; do pkill -RTMIN+15 i3blocks; done"
|
||||
exec --no-startup-id feh --no-fehbg --no-xinerama --bg-fill ~/pictures/lakesidesunrise.jpg
|
||||
exec --no-startup-id xautolock -time 5 -locker ~/.config/i3/lock.sh -nocloseout -nocloseerr
|
||||
|
||||
@ -188,6 +185,7 @@ exec --no-startup-id solaar
|
||||
exec --no-startup-id pullover
|
||||
exec --no-startup-id onboard
|
||||
exec --no-startup-id touchegg
|
||||
exec --no-startup-id mailnag
|
||||
exec --no-startup-id compton -b --config ~/.config/compton.conf
|
||||
exec --no-startup-id chromium --no-startup-window
|
||||
exec --no-startup-id thunderbird
|
||||
|
29
.config/mailnag/mailnag.cfg
Normal file
29
.config/mailnag/mailnag.cfg
Normal file
@ -0,0 +1,29 @@
|
||||
[spamfilterplugin]
|
||||
filter_text = viagra
|
||||
|
||||
[core]
|
||||
imap_idle_timeout = 10
|
||||
enabled_plugins = dbusplugin, libnotifyplugin, soundplugin
|
||||
poll_interval = 10
|
||||
credentialstore = auto
|
||||
connectivity_test = auto
|
||||
autostart = 1
|
||||
|
||||
[soundplugin]
|
||||
soundfile = mailnag.ogg
|
||||
|
||||
[libnotifyplugin]
|
||||
notification_mode = 2
|
||||
max_visible_mails = 10
|
||||
|
||||
[account1]
|
||||
enabled = 1
|
||||
name = frebib.net
|
||||
user = me@frebib.net
|
||||
password =
|
||||
server = imappro.zoho.com
|
||||
port = 993
|
||||
ssl = 1
|
||||
imap = 1
|
||||
idle = 0
|
||||
folder = INBOX, Spam
|
42
.config/mimeapps.list
Normal file
42
.config/mimeapps.list
Normal file
@ -0,0 +1,42 @@
|
||||
[Default Applications]
|
||||
|
||||
# eog for images
|
||||
image/bmp=eog.desktop
|
||||
image/gif=eog.desktop
|
||||
image/jpeg=eog.desktop
|
||||
image/jpg=eog.desktop
|
||||
image/pjpeg=eog.desktop
|
||||
image/png=eog.desktop
|
||||
image/svg+xml-compressed=eog.desktop
|
||||
image/svg+xml=eog.desktop
|
||||
image/tiff=eog.desktop
|
||||
image/x-bmp=eog.desktop
|
||||
image/x-gray=eog.desktop
|
||||
image/x-icb=eog.desktop
|
||||
image/x-ico=eog.desktop
|
||||
image/x-png=eog.desktop
|
||||
image/x-portable-anymap=eog.desktop
|
||||
image/x-portable-bitmap=eog.desktop
|
||||
image/x-portable-graymap=eog.desktop
|
||||
image/x-portable-pixmap=eog.desktop
|
||||
|
||||
# evince for pdfs
|
||||
application/pdf=evince.desktop
|
||||
|
||||
# vim for textual files
|
||||
application/x-shellscript=vim.desktop
|
||||
text/english=vim.desktop
|
||||
text/plain=vim.desktop
|
||||
text/x-makefile=vim.desktop
|
||||
|
||||
# Chromium for web/html
|
||||
text/html=chromium.desktop
|
||||
x-scheme-handler/about=chromium.desktop
|
||||
x-scheme-handler/http=chromium.desktop
|
||||
x-scheme-handler/https=chromium.desktop
|
||||
x-scheme-handler/unknown=chromium.desktop
|
||||
|
||||
# Various desktop applications
|
||||
inode/directory=nautilus.desktop
|
||||
x-scheme-handler/magnet=deluge.desktop
|
||||
x-scheme-handler/tg=telegramdesktop.desktop
|
@ -5,7 +5,9 @@ set undodir=$XDG_CACHE_HOME/vim/undo//
|
||||
set directory=$XDG_CACHE_HOME/vim/swap//
|
||||
set backupdir=$XDG_CACHE_HOME/vim/backup//
|
||||
set viminfo+='1000,n$XDG_CACHE_HOME/vim/viminfo
|
||||
set runtimepath+=$XDG_CONFIG_HOME/vim,$VIMRUNTIME,$XDG_CONFIG_HOME/vim/after
|
||||
set runtimepath-=$HOME/.vim
|
||||
set runtimepath^=$XDG_CONFIG_HOME/vim,$VIMRUNTIME,$XDG_CONFIG_HOME/vim/after
|
||||
let g:netrw_home=$XDG_CACHE_HOME.'/vim'
|
||||
|
||||
silent !mkdir -p $XDG_CACHE_HOME/vim/swap $XDG_CACHE_HOME/vim/undo $XDG_CACHE_HOME/vim/backup
|
||||
|
||||
@ -47,6 +49,9 @@ endfunction
|
||||
set autowrite
|
||||
autocmd CursorHold,CursorHoldI,InsertLeave,FocusGained,FocusLost * call SaveIfExist()
|
||||
|
||||
" Auto-resize split on window resize
|
||||
autocmd VimResized * wincmd =
|
||||
|
||||
" Search options
|
||||
set hlsearch
|
||||
set ignorecase
|
||||
@ -100,13 +105,17 @@ Plug 'airblade/vim-gitgutter'
|
||||
Plug 'ryanoasis/vim-devicons'
|
||||
Plug 'vim-airline/vim-airline'
|
||||
Plug 'vim-airline/vim-airline-themes'
|
||||
Plug 'chr4/nginx.vim'
|
||||
Plug 'PotatoesMaster/i3-vim-syntax'
|
||||
Plug 'lervag/vimtex'
|
||||
Plug 'JamshedVesuna/vim-markdown-preview'
|
||||
Plug 'junegunn/fzf.vim'
|
||||
Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
|
||||
|
||||
" Syntax Highlighting
|
||||
Plug 'chr4/nginx.vim'
|
||||
Plug 'PotatoesMaster/i3-vim-syntax'
|
||||
Plug 'puppetlabs/puppet-syntax-vim'
|
||||
Plug 'arrufat/vala.vim'
|
||||
|
||||
call plug#end()
|
||||
|
||||
" Change to dvorak-mapped keys
|
||||
@ -213,10 +222,6 @@ if (exists("g:use_dvorak") && g:use_dvorak == 1)
|
||||
noremap h j
|
||||
noremap t k
|
||||
noremap n l
|
||||
noremap D H
|
||||
noremap H J
|
||||
noremap T K
|
||||
noremap N L
|
||||
|
||||
noremap gh gj
|
||||
noremap gt gk
|
||||
@ -274,6 +279,18 @@ if (exists("g:use_dvorak") && g:use_dvorak == 1)
|
||||
" NERDTree configuration
|
||||
let NERDTreeMapOpenInTab='\t' " prevent t opening file
|
||||
|
||||
" Also remap keys in :Explore
|
||||
augroup netrw_dvorak_fix
|
||||
autocmd!
|
||||
autocmd filetype netrw call Fix_netrw_maps_for_dvorak()
|
||||
augroup END
|
||||
function! Fix_netrw_maps_for_dvorak()
|
||||
noremap <buffer> d h
|
||||
noremap <buffer> h j
|
||||
noremap <buffer> t k
|
||||
noremap <buffer> n l
|
||||
endfunction
|
||||
|
||||
endif
|
||||
|
||||
" Save aliases.
|
||||
|
@ -58,7 +58,7 @@ source "$antigen_src"
|
||||
antigen bundle zsh-users/zsh-completions
|
||||
antigen bundle zsh-users/zsh-autosuggestions
|
||||
antigen bundle zsh-users/zsh-history-substring-search
|
||||
antigen bundle zsh-users/zsh-syntax-highlighting
|
||||
antigen bundle zsh-users/zsh-syntax-highlighting@feature/redrawhook
|
||||
antigen bundle mafredri/zsh-async
|
||||
|
||||
antigen apply
|
||||
@ -82,8 +82,21 @@ bindkey '^[[A' fzf-history-widget # Up (fzf)
|
||||
bindkey '^[[B' fzf-history-widget # Down (fzf)
|
||||
bindkey '^[[1;3A' history-substring-search-up # Alt+Up (hsh)
|
||||
bindkey '^[[1;3B' history-substring-search-down # Alt+Down (hsh)
|
||||
bindkey -M vicmd v edit-command-line
|
||||
|
||||
bindkey "^V" edit-command-line
|
||||
bindkey -M vicmd "^V" edit-command-line
|
||||
|
||||
bindkey -M vicmd d vi-backward-char
|
||||
bindkey -M vicmd h vi-down-line-or-history
|
||||
bindkey -M vicmd t vi-up-line-or-history
|
||||
bindkey -M vicmd n vi-forward-char
|
||||
bindkey -M vicmd k vi-delete
|
||||
bindkey -M vicmd K vi-kill-eol
|
||||
bindkey -M vicmd j vi-find-next-char-skip
|
||||
bindkey -M vicmd l vi-repeat-search
|
||||
|
||||
|
||||
ZSH_AUTOSUGGEST_USE_ASYNC=true
|
||||
ZSH_AUTOSUGGEST_CLEAR_WIDGETS=("${(@)ZSH_AUTOSUGGEST_CLEAR_WIDGETS:#(up|down)-line-or-history}")
|
||||
ZSH_AUTOSUGGEST_CLEAR_WIDGETS+=(history-substring-search-up history-substring-search-down)
|
||||
|
||||
@ -91,26 +104,31 @@ HISTORY_SUBSTRING_SEARCH_FUZZY=true
|
||||
HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE=true
|
||||
HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND='underline'
|
||||
|
||||
typeset -A ZSH_HIGHLIGHT_STYLES
|
||||
default='fg=12'
|
||||
prog='fg=blue'
|
||||
ZSH_HIGHLIGHT_STYLES=()
|
||||
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets root line)
|
||||
ZSH_HIGHLIGHT_STYLES[default]='fg=12'
|
||||
ZSH_HIGHLIGHT_STYLES[root]='bg=red'
|
||||
ZSH_HIGHLIGHT_STYLES[default]=$default
|
||||
ZSH_HIGHLIGHT_STYLES[arg0]=$prog
|
||||
ZSH_HIGHLIGHT_STYLES[unknown-token]='fg=red,bold'
|
||||
ZSH_HIGHLIGHT_STYLES[reserved-word]='fg=yellow'
|
||||
ZSH_HIGHLIGHT_STYLES[alias]='fg=blue'
|
||||
ZSH_HIGHLIGHT_STYLES[suffix-alias]='fg=green,underline'
|
||||
ZSH_HIGHLIGHT_STYLES[builtin]='fg=blue'
|
||||
ZSH_HIGHLIGHT_STYLES[function]='fg=blue'
|
||||
ZSH_HIGHLIGHT_STYLES[command]='fg=blue'
|
||||
ZSH_HIGHLIGHT_STYLES[precommand]='fg=blue'
|
||||
ZSH_HIGHLIGHT_STYLES[alias]=$prog
|
||||
ZSH_HIGHLIGHT_STYLES[suffix-alias]='fg=green'
|
||||
ZSH_HIGHLIGHT_STYLES[builtin]='fg=4'
|
||||
ZSH_HIGHLIGHT_STYLES[function]=$prog
|
||||
ZSH_HIGHLIGHT_STYLES[command]=$prog
|
||||
ZSH_HIGHLIGHT_STYLES[precommand]='fg=4'
|
||||
ZSH_HIGHLIGHT_STYLES[commandseparator]='fg=cyan'
|
||||
ZSH_HIGHLIGHT_STYLES[hashed-command]='fg=green'
|
||||
ZSH_HIGHLIGHT_STYLES[path]='fg=blue'
|
||||
ZSH_HIGHLIGHT_STYLES[path_prefix]='fg=yellow,bold'
|
||||
ZSH_HIGHLIGHT_STYLES[path]='fg=cyan'
|
||||
ZSH_HIGHLIGHT_STYLES[path_separator]='fg=cyan'
|
||||
ZSH_HIGHLIGHT_STYLES[path_prefix]='fg=208'
|
||||
ZSH_HIGHLIGHT_STYLES[globbing]='fg=red'
|
||||
ZSH_HIGHLIGHT_STYLES[comment]='fg=7'
|
||||
ZSH_HIGHLIGHT_STYLES[history-expansion]='fg=blue'
|
||||
ZSH_HIGHLIGHT_STYLES[single-hyphen-option]='fg=12'
|
||||
ZSH_HIGHLIGHT_STYLES[double-hyphen-option]='fg=12'
|
||||
ZSH_HIGHLIGHT_STYLES[history-expansion]=$default
|
||||
ZSH_HIGHLIGHT_STYLES[single-hyphen-option]=$default
|
||||
ZSH_HIGHLIGHT_STYLES[double-hyphen-option]=$default
|
||||
ZSH_HIGHLIGHT_STYLES[back-quoted-argument]='fg=magenta'
|
||||
ZSH_HIGHLIGHT_STYLES[single-quoted-argument]='fg=yellow'
|
||||
ZSH_HIGHLIGHT_STYLES[double-quoted-argument]='fg=yellow'
|
||||
@ -119,11 +137,13 @@ ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument]='fg=cyan'
|
||||
ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]='fg=cyan'
|
||||
ZSH_HIGHLIGHT_STYLES[back-dollar-quoted-argument]='fg=cyan'
|
||||
ZSH_HIGHLIGHT_STYLES[assign]='fg=green'
|
||||
ZSH_HIGHLIGHT_STYLES[redirection]='fg=cyan'
|
||||
ZSH_HIGHLIGHT_STYLES[redirection]='fg=cyan,bold'
|
||||
|
||||
source "$DOTFILES/aliases"
|
||||
|
||||
# Load some manual plugins
|
||||
source "$ZSH_DIR/plugins/sudo.zsh"
|
||||
source "$ZSH_DIR/plugins/fish-theme.zsh"
|
||||
source "$ZSH_DIR/plugins/git-rprompt.zsh"
|
||||
[ -f '/usr/share/fzf/key-bindings.zsh' ] && source /usr/share/fzf/key-bindings.zsh
|
||||
[ -f '/usr/share/doc/pkgfile/command-not-found.zsh' ] && source /usr/share/doc/pkgfile/command-not-found.zsh
|
||||
|
@ -4,57 +4,6 @@ _fishy_collapsed_wd() {
|
||||
pwd | sed -E 's|^'$HOME'|~|;s|(.*)/|\1%|;s|((^\|/)\.?[^/%]{1})[^/%]*|\1|g;s|(.*)%|\1/|'
|
||||
}
|
||||
|
||||
git_prompt_info() {
|
||||
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
|
||||
echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$ZSH_THEME_GIT_PROMPT_SUFFIX"
|
||||
}
|
||||
git_prompt_status() {
|
||||
# Get the status of the working tree
|
||||
INDEX=$(command git status --porcelain -b 2> /dev/null)
|
||||
STATUS=""
|
||||
if $(echo "$INDEX" | grep -E '^\?\? ' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_UNTRACKED$STATUS"
|
||||
fi
|
||||
if $(echo "$INDEX" | grep '^A ' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_ADDED$STATUS"
|
||||
elif $(echo "$INDEX" | grep '^M ' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_ADDED$STATUS"
|
||||
fi
|
||||
if $(echo "$INDEX" | grep '^ M ' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS"
|
||||
elif $(echo "$INDEX" | grep '^AM ' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS"
|
||||
elif $(echo "$INDEX" | grep '^ T ' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS"
|
||||
fi
|
||||
if $(echo "$INDEX" | grep '^R ' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_RENAMED$STATUS"
|
||||
fi
|
||||
if $(echo "$INDEX" | grep '^ D ' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS"
|
||||
elif $(echo "$INDEX" | grep '^D ' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS"
|
||||
elif $(echo "$INDEX" | grep '^AD ' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS"
|
||||
fi
|
||||
if $(command git rev-parse --verify refs/stash >/dev/null 2>&1); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_STASHED$STATUS"
|
||||
fi
|
||||
if $(echo "$INDEX" | grep '^UU ' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_UNMERGED$STATUS"
|
||||
fi
|
||||
if $(echo "$INDEX" | grep '^## .*ahead' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_AHEAD$STATUS"
|
||||
fi
|
||||
if $(echo "$INDEX" | grep '^## .*behind' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_BEHIND$STATUS"
|
||||
fi
|
||||
if $(echo "$INDEX" | grep '^## .*diverged' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_DIVERGED$STATUS"
|
||||
fi
|
||||
echo $STATUS
|
||||
}
|
||||
|
||||
# Required for dynamic prompt
|
||||
setopt prompt_subst
|
||||
|
||||
@ -62,17 +11,4 @@ local user_color='green'; [ $UID -eq 0 ] && user_color='red'
|
||||
PROMPT="%n@%m %F{$user_color}\$(_fishy_collapsed_wd)%f%(!.#.>) "
|
||||
PROMPT2='%F{red}\ %f'
|
||||
|
||||
local return_status="%F{red}%(?..%?)%f"
|
||||
RPROMPT='${return_status}$(git_prompt_info)$(git_prompt_status)%{$reset_color%}'
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX=" "
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX=""
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY=""
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN=""
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_ADDED="%{$fg_bold[green]%}+"
|
||||
ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg_bold[blue]%}!"
|
||||
ZSH_THEME_GIT_PROMPT_DELETED="%{$fg_bold[red]%}-"
|
||||
ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg_bold[magenta]%}>"
|
||||
ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg_bold[yellow]%}#"
|
||||
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg_bold[cyan]%}?"
|
||||
RPROMPT='%F{red}%(?.. %?)%f'
|
||||
|
74
.config/zsh/plugins/git-rprompt.zsh
Normal file
74
.config/zsh/plugins/git-rprompt.zsh
Normal file
@ -0,0 +1,74 @@
|
||||
# ZSH RPROMPT containing simple Git status
|
||||
|
||||
git_prompt_info() {
|
||||
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
|
||||
echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$ZSH_THEME_GIT_PROMPT_SUFFIX"
|
||||
}
|
||||
git_prompt_status() {
|
||||
# Get the status of the working tree
|
||||
INDEX=$(command git status --porcelain -b 2> /dev/null)
|
||||
RESET='%f'
|
||||
STATUS=""
|
||||
if $(echo "$INDEX" | grep -E '^\?\? ' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_UNTRACKED$RESET$STATUS"
|
||||
fi
|
||||
if $(echo "$INDEX" | grep '^A ' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_ADDED$RESET$STATUS"
|
||||
elif $(echo "$INDEX" | grep '^M ' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_ADDED$RESET$STATUS"
|
||||
fi
|
||||
if $(echo "$INDEX" | grep '^ M ' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$RESET$STATUS"
|
||||
elif $(echo "$INDEX" | grep '^AM ' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$RESET$STATUS"
|
||||
elif $(echo "$INDEX" | grep '^ T ' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$RESET$STATUS"
|
||||
fi
|
||||
if $(echo "$INDEX" | grep '^R ' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_RENAMED$RESET$STATUS"
|
||||
fi
|
||||
if $(echo "$INDEX" | grep '^ D ' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$RESET$STATUS"
|
||||
elif $(echo "$INDEX" | grep '^D ' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$RESET$STATUS"
|
||||
elif $(echo "$INDEX" | grep '^AD ' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$RESET$STATUS"
|
||||
fi
|
||||
if $(command git rev-parse --verify refs/stash >/dev/null 2>&1); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_STASHED$RESET$STATUS"
|
||||
fi
|
||||
if $(echo "$INDEX" | grep '^UU ' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_UNMERGED$RESET$STATUS"
|
||||
fi
|
||||
if $(echo "$INDEX" | grep '^## .*ahead' &> /dev/null); then
|
||||
AHEAD=$(echo "$INDEX" | sed -nE 's/.*ahead\s([0-9]*).*/\1/p')
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_AHEAD$AHEAD$RESET$STATUS"
|
||||
fi
|
||||
if $(echo "$INDEX" | grep '^## .*behind' &> /dev/null); then
|
||||
BEHIND=$(echo "$INDEX" | sed -nE 's/.*behind\s([0-9]*).*/\1/p')
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_BEHIND$BEHIND$RESET$STATUS"
|
||||
fi
|
||||
if $(echo "$INDEX" | grep '^## .*diverged' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_DIVERGED$RESET$STATUS"
|
||||
fi
|
||||
echo $STATUS
|
||||
}
|
||||
|
||||
# Required for dynamic prompt
|
||||
setopt prompt_subst
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX=" "
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX=""
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY=""
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN=""
|
||||
ZSH_THEME_GIT_PROMPT_AHEAD="%F{green}↑"
|
||||
ZSH_THEME_GIT_PROMPT_BEHIND="%F{red}↓"
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_ADDED="%F{green}+"
|
||||
ZSH_THEME_GIT_PROMPT_MODIFIED="%F{blue}~"
|
||||
ZSH_THEME_GIT_PROMPT_DELETED="%F{red}-"
|
||||
ZSH_THEME_GIT_PROMPT_RENAMED="%F{magenta}>"
|
||||
ZSH_THEME_GIT_PROMPT_UNMERGED="%F{yellow}#"
|
||||
ZSH_THEME_GIT_PROMPT_UNTRACKED="%F{cyan}?"
|
||||
|
||||
RPROMPT="\$(git_prompt_info)\$(git_prompt_status)%{\$reset_color%}$RPROMPT"
|
6
.profile
6
.profile
@ -14,8 +14,8 @@ case "$(basename "$(readlink -f /proc/$$/exe)")" in
|
||||
bash) thisfile="$(readlink -f "${BASH_SOURCE[0]}")";;
|
||||
*) thisfile="$(find /proc/$$/fd/ | xargs -n1 -r readlink -f | grep profile | head -n1)";;
|
||||
esac
|
||||
export DOTFILES="$(dirname "${thisfile:-$XDG_CONFIG_HOME/dotfiles}")"
|
||||
export PATH="${PATH}:$DOTFILES/scripts:$HOME/.local/share/surface-scripts"
|
||||
export DOTFILES="$(dirname "${thisfile:-$XDG_CONFIG_HOME/dotfiles/.profile}")"
|
||||
export PATH="${PATH}:/sbin:/usr/sbin:$DOTFILES/scripts:$HOME/.local/share/surface-scripts"
|
||||
|
||||
# Override paths for non-compliant programs
|
||||
# https://wiki.archlinux.org/index.php/XDG_Base_Directory_support
|
||||
@ -40,6 +40,8 @@ export CARGO_HOME="$XDG_DATA_HOME/cargo"
|
||||
export PASSWORD_STORE_DIR="$XDG_DATA_HOME/pass"
|
||||
# Python
|
||||
export PYTHONHISTFILE="$XDG_DATA_HOME/python/histfile"
|
||||
# Weechat
|
||||
export WEECHAT_HOME="$XDG_CONFIG_HOME/weechat"
|
||||
|
||||
# Go configuration
|
||||
export GOPATH="$XDG_DATA_HOME/go"
|
||||
|
25
aliases
25
aliases
@ -18,7 +18,7 @@ alias al=la # No, I don't need the Mono Assembly Linker
|
||||
|
||||
alias md="mkdir -p"
|
||||
alias rd="rmdir -p"
|
||||
mcd(){ mkdir -p $@ && cd $@; }
|
||||
mcd(){ mkdir -p -- $@ && cd -- $@; }
|
||||
alias -- -='cd -'
|
||||
alias cdt='cd `mktemp -d`'
|
||||
alias grep='grep --color'
|
||||
@ -36,7 +36,6 @@ alias -g NUL="&> /dev/null"
|
||||
alias -g BG="&;disown"
|
||||
alias -g COL="| column -t"
|
||||
alias -g CLIP="| xclip -i -selection primary -f | xclip -i -selection clipboard"
|
||||
calc() { bc -l <<< "$@"; }
|
||||
|
||||
alias svi=sudoedit
|
||||
alias svim=sudoedit
|
||||
@ -55,7 +54,6 @@ alias pacaur='pacaur --color=always'
|
||||
alias tree='tree --dirsfirst -C -F'
|
||||
alias make="make -j$(nproc)"
|
||||
alias dd='dd status=progress'
|
||||
alias env='env | sort | sed -r "s/\x1B\[(([0-9]+)(;[0-9]+)*)?[m,K,H,f,J]//g"'
|
||||
alias ssh="ssh -tt"
|
||||
alias wget="wget --hsts-file=$XDG_DATA_HOME/wget/hsts-file"
|
||||
vim --version 2>/dev/null | command grep -q +clientserver && \
|
||||
@ -80,6 +78,10 @@ alias abuild-sign='alpine-sdk abuild-sign'
|
||||
alias apk='alpine-sdk apk'
|
||||
alias hddtemps='find /sys/block/ -name sd\* | sed "s|sys/block|dev|g" | sudo xargs hddtemp | sort -t: -k3'
|
||||
alias stripansi='sed -r "s/\x1B\[(([0-9]+)(;[0-9]+)*)?[m,K,H,f,J]//g"'
|
||||
alias calc="noglob bc -l <<<" # noglob allows * without quoting
|
||||
|
||||
# Function aliases
|
||||
env() { command env $@ | stripansi | sort; }
|
||||
|
||||
# System aliases
|
||||
alias s="sudo systemctl"
|
||||
@ -91,10 +93,7 @@ alias kl='killall -s 9'
|
||||
alias chx='chmod +x'
|
||||
|
||||
# File default aliases
|
||||
pdf() {
|
||||
evince $@ NE BG
|
||||
}
|
||||
alias -s pdf=pdf
|
||||
alias -s pdf="open"
|
||||
alias -s zip="unzip -l"
|
||||
alias -s rar="unrar l"
|
||||
alias -s tar="tar tf"
|
||||
@ -118,6 +117,7 @@ alias gc="git commit"
|
||||
alias gcm="gc -m"
|
||||
gcmst() { git stash -u -k && git commit -m "$1" && git stash pop; }
|
||||
alias gca="git commit --amend"
|
||||
alias gcn="git commit --no-edit"
|
||||
alias gcan="git commit --amend --no-edit"
|
||||
alias gcam="git commit --amend -m"
|
||||
alias gst="git status"
|
||||
@ -250,9 +250,7 @@ _dsh() {
|
||||
}
|
||||
|
||||
alias dm='docker-machine'
|
||||
dm-con() {
|
||||
eval $(docker-machine env $1)
|
||||
}
|
||||
dm-con() { eval $(docker-machine env $1); }
|
||||
alias dmc=dm-con
|
||||
|
||||
alias dc='docker-compose'
|
||||
@ -262,6 +260,8 @@ alias zfs='sudo zfs'
|
||||
alias zpool='sudo zpool'
|
||||
alias z=zfs
|
||||
alias zp=zpool
|
||||
zl() { (set -o pipefail; command zfs list $@ | grep -Ev 'docker/[0-9a-f]{64}'); return $?; }
|
||||
_zl() { _zfs "list $@" }
|
||||
|
||||
# General Aliases
|
||||
alias ssha='eval `ssh-agent` ; ssh-add'
|
||||
@ -275,9 +275,8 @@ alias sshc="$EDITOR ~/.ssh/config"
|
||||
alias dotfiles="cd $DOTFILES"
|
||||
alias i3c="$EDITOR $XDG_CONFIG_HOME/i3/config ; i3-msg restart"
|
||||
alias i3bc="$EDITOR $XDG_CONFIG_HOME/i3/blocks/config ; i3-msg restart"
|
||||
i3b() {
|
||||
$EDITOR $XDG_CONFIG_HOME/i3/blocks/$@
|
||||
}
|
||||
i3b() { $EDITOR $XDG_CONFIG_HOME/i3/blocks/$@; }
|
||||
|
||||
alias sf=screenfetch
|
||||
alias nf=neofetch
|
||||
randstr() { tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w $1 | head -n 1; }
|
||||
|
289
scripts/diff-highlight
Executable file
289
scripts/diff-highlight
Executable file
@ -0,0 +1,289 @@
|
||||
#!/usr/bin/perl
|
||||
package DiffHighlight;
|
||||
|
||||
use 5.008;
|
||||
use warnings FATAL => 'all';
|
||||
use strict;
|
||||
|
||||
# Highlight by reversing foreground and background. You could do
|
||||
# other things like bold or underline if you prefer.
|
||||
my @OLD_HIGHLIGHT = (
|
||||
color_config('color.diff-highlight.oldnormal'),
|
||||
color_config('color.diff-highlight.oldhighlight', "\x1b[7m"),
|
||||
color_config('color.diff-highlight.oldreset', "\x1b[27m")
|
||||
);
|
||||
my @NEW_HIGHLIGHT = (
|
||||
color_config('color.diff-highlight.newnormal', $OLD_HIGHLIGHT[0]),
|
||||
color_config('color.diff-highlight.newhighlight', $OLD_HIGHLIGHT[1]),
|
||||
color_config('color.diff-highlight.newreset', $OLD_HIGHLIGHT[2])
|
||||
);
|
||||
|
||||
my $RESET = "\x1b[m";
|
||||
my $COLOR = qr/\x1b\[[0-9;]*m/;
|
||||
my $BORING = qr/$COLOR|\s/;
|
||||
|
||||
my @removed;
|
||||
my @added;
|
||||
my $in_hunk;
|
||||
my $graph_indent = 0;
|
||||
|
||||
our $line_cb = sub { print @_ };
|
||||
our $flush_cb = sub { local $| = 1 };
|
||||
|
||||
# Count the visible width of a string, excluding any terminal color sequences.
|
||||
sub visible_width {
|
||||
local $_ = shift;
|
||||
my $ret = 0;
|
||||
while (length) {
|
||||
if (s/^$COLOR//) {
|
||||
# skip colors
|
||||
} elsif (s/^.//) {
|
||||
$ret++;
|
||||
}
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
# Return a substring of $str, omitting $len visible characters from the
|
||||
# beginning, where terminal color sequences do not count as visible.
|
||||
sub visible_substr {
|
||||
my ($str, $len) = @_;
|
||||
while ($len > 0) {
|
||||
if ($str =~ s/^$COLOR//) {
|
||||
next
|
||||
}
|
||||
$str =~ s/^.//;
|
||||
$len--;
|
||||
}
|
||||
return $str;
|
||||
}
|
||||
|
||||
sub handle_line {
|
||||
my $orig = shift;
|
||||
local $_ = $orig;
|
||||
|
||||
# match a graph line that begins a commit
|
||||
if (/^(?:$COLOR?\|$COLOR?[ ])* # zero or more leading "|" with space
|
||||
$COLOR?\*$COLOR?[ ] # a "*" with its trailing space
|
||||
(?:$COLOR?\|$COLOR?[ ])* # zero or more trailing "|"
|
||||
[ ]* # trailing whitespace for merges
|
||||
/x) {
|
||||
my $graph_prefix = $&;
|
||||
|
||||
# We must flush before setting graph indent, since the
|
||||
# new commit may be indented differently from what we
|
||||
# queued.
|
||||
flush();
|
||||
$graph_indent = visible_width($graph_prefix);
|
||||
|
||||
} elsif ($graph_indent) {
|
||||
if (length($_) < $graph_indent) {
|
||||
$graph_indent = 0;
|
||||
} else {
|
||||
$_ = visible_substr($_, $graph_indent);
|
||||
}
|
||||
}
|
||||
|
||||
if (!$in_hunk) {
|
||||
$line_cb->($orig);
|
||||
$in_hunk = /^$COLOR*\@\@ /;
|
||||
}
|
||||
elsif (/^$COLOR*-/) {
|
||||
push @removed, $orig;
|
||||
}
|
||||
elsif (/^$COLOR*\+/) {
|
||||
push @added, $orig;
|
||||
}
|
||||
else {
|
||||
flush();
|
||||
$line_cb->($orig);
|
||||
$in_hunk = /^$COLOR*[\@ ]/;
|
||||
}
|
||||
|
||||
# Most of the time there is enough output to keep things streaming,
|
||||
# but for something like "git log -Sfoo", you can get one early
|
||||
# commit and then many seconds of nothing. We want to show
|
||||
# that one commit as soon as possible.
|
||||
#
|
||||
# Since we can receive arbitrary input, there's no optimal
|
||||
# place to flush. Flushing on a blank line is a heuristic that
|
||||
# happens to match git-log output.
|
||||
if (!length) {
|
||||
$flush_cb->();
|
||||
}
|
||||
}
|
||||
|
||||
sub flush {
|
||||
# Flush any queued hunk (this can happen when there is no trailing
|
||||
# context in the final diff of the input).
|
||||
show_hunk(\@removed, \@added);
|
||||
@removed = ();
|
||||
@added = ();
|
||||
}
|
||||
|
||||
sub highlight_stdin {
|
||||
while (<STDIN>) {
|
||||
handle_line($_);
|
||||
}
|
||||
flush();
|
||||
}
|
||||
|
||||
# Ideally we would feed the default as a human-readable color to
|
||||
# git-config as the fallback value. But diff-highlight does
|
||||
# not otherwise depend on git at all, and there are reports
|
||||
# of it being used in other settings. Let's handle our own
|
||||
# fallback, which means we will work even if git can't be run.
|
||||
sub color_config {
|
||||
my ($key, $default) = @_;
|
||||
my $s = `git config --get-color $key 2>/dev/null`;
|
||||
return length($s) ? $s : $default;
|
||||
}
|
||||
|
||||
sub show_hunk {
|
||||
my ($a, $b) = @_;
|
||||
|
||||
# If one side is empty, then there is nothing to compare or highlight.
|
||||
if (!@$a || !@$b) {
|
||||
$line_cb->(@$a, @$b);
|
||||
return;
|
||||
}
|
||||
|
||||
# If we have mismatched numbers of lines on each side, we could try to
|
||||
# be clever and match up similar lines. But for now we are simple and
|
||||
# stupid, and only handle multi-line hunks that remove and add the same
|
||||
# number of lines.
|
||||
if (@$a != @$b) {
|
||||
$line_cb->(@$a, @$b);
|
||||
return;
|
||||
}
|
||||
|
||||
my @queue;
|
||||
for (my $i = 0; $i < @$a; $i++) {
|
||||
my ($rm, $add) = highlight_pair($a->[$i], $b->[$i]);
|
||||
$line_cb->($rm);
|
||||
push @queue, $add;
|
||||
}
|
||||
$line_cb->(@queue);
|
||||
}
|
||||
|
||||
sub highlight_pair {
|
||||
my @a = split_line(shift);
|
||||
my @b = split_line(shift);
|
||||
|
||||
# Find common prefix, taking care to skip any ansi
|
||||
# color codes.
|
||||
my $seen_plusminus;
|
||||
my ($pa, $pb) = (0, 0);
|
||||
while ($pa < @a && $pb < @b) {
|
||||
if ($a[$pa] =~ /$COLOR/) {
|
||||
$pa++;
|
||||
}
|
||||
elsif ($b[$pb] =~ /$COLOR/) {
|
||||
$pb++;
|
||||
}
|
||||
elsif ($a[$pa] eq $b[$pb]) {
|
||||
$pa++;
|
||||
$pb++;
|
||||
}
|
||||
elsif (!$seen_plusminus && $a[$pa] eq '-' && $b[$pb] eq '+') {
|
||||
$seen_plusminus = 1;
|
||||
$pa++;
|
||||
$pb++;
|
||||
}
|
||||
else {
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
# Find common suffix, ignoring colors.
|
||||
my ($sa, $sb) = ($#a, $#b);
|
||||
while ($sa >= $pa && $sb >= $pb) {
|
||||
if ($a[$sa] =~ /$COLOR/) {
|
||||
$sa--;
|
||||
}
|
||||
elsif ($b[$sb] =~ /$COLOR/) {
|
||||
$sb--;
|
||||
}
|
||||
elsif ($a[$sa] eq $b[$sb]) {
|
||||
$sa--;
|
||||
$sb--;
|
||||
}
|
||||
else {
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
if (is_pair_interesting(\@a, $pa, $sa, \@b, $pb, $sb)) {
|
||||
return highlight_line(\@a, $pa, $sa, \@OLD_HIGHLIGHT),
|
||||
highlight_line(\@b, $pb, $sb, \@NEW_HIGHLIGHT);
|
||||
}
|
||||
else {
|
||||
return join('', @a),
|
||||
join('', @b);
|
||||
}
|
||||
}
|
||||
|
||||
# we split either by $COLOR or by character. This has the side effect of
|
||||
# leaving in graph cruft. It works because the graph cruft does not contain "-"
|
||||
# or "+"
|
||||
sub split_line {
|
||||
local $_ = shift;
|
||||
return utf8::decode($_) ?
|
||||
map { utf8::encode($_); $_ }
|
||||
map { /$COLOR/ ? $_ : (split //) }
|
||||
split /($COLOR+)/ :
|
||||
map { /$COLOR/ ? $_ : (split //) }
|
||||
split /($COLOR+)/;
|
||||
}
|
||||
|
||||
sub highlight_line {
|
||||
my ($line, $prefix, $suffix, $theme) = @_;
|
||||
|
||||
my $start = join('', @{$line}[0..($prefix-1)]);
|
||||
my $mid = join('', @{$line}[$prefix..$suffix]);
|
||||
my $end = join('', @{$line}[($suffix+1)..$#$line]);
|
||||
|
||||
# If we have a "normal" color specified, then take over the whole line.
|
||||
# Otherwise, we try to just manipulate the highlighted bits.
|
||||
if (defined $theme->[0]) {
|
||||
s/$COLOR//g for ($start, $mid, $end);
|
||||
chomp $end;
|
||||
return join('',
|
||||
$theme->[0], $start, $RESET,
|
||||
$theme->[1], $mid, $RESET,
|
||||
$theme->[0], $end, $RESET,
|
||||
"\n"
|
||||
);
|
||||
} else {
|
||||
return join('',
|
||||
$start,
|
||||
$theme->[1], $mid, $theme->[2],
|
||||
$end
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
# Pairs are interesting to highlight only if we are going to end up
|
||||
# highlighting a subset (i.e., not the whole line). Otherwise, the highlighting
|
||||
# is just useless noise. We can detect this by finding either a matching prefix
|
||||
# or suffix (disregarding boring bits like whitespace and colorization).
|
||||
sub is_pair_interesting {
|
||||
my ($a, $pa, $sa, $b, $pb, $sb) = @_;
|
||||
my $prefix_a = join('', @$a[0..($pa-1)]);
|
||||
my $prefix_b = join('', @$b[0..($pb-1)]);
|
||||
my $suffix_a = join('', @$a[($sa+1)..$#$a]);
|
||||
my $suffix_b = join('', @$b[($sb+1)..$#$b]);
|
||||
|
||||
return visible_substr($prefix_a, $graph_indent) !~ /^$COLOR*-$BORING*$/ ||
|
||||
visible_substr($prefix_b, $graph_indent) !~ /^$COLOR*\+$BORING*$/ ||
|
||||
$suffix_a !~ /^$BORING*$/ ||
|
||||
$suffix_b !~ /^$BORING*$/;
|
||||
}
|
||||
package main;
|
||||
|
||||
# Some scripts may not realize that SIGPIPE is being ignored when launching the
|
||||
# pager--for instance scripts written in Python.
|
||||
$SIG{PIPE} = 'DEFAULT';
|
||||
|
||||
DiffHighlight::highlight_stdin();
|
||||
exit 0;
|
55
scripts/screenshot
Executable file
55
scripts/screenshot
Executable file
@ -0,0 +1,55 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
NOTIFY_APPNAME="$(basename "$0")"
|
||||
NOTIFY_ICONPATH="/usr/share/icons/Xenlism-Wildfire/Apps/screenshot.svg"
|
||||
|
||||
SCROT_CMD="maim -m 10 -us %"
|
||||
FILENAME=`date "+$NOTIFY_APPNAME-%Y-%m-%d-%H%M%S.png"`
|
||||
DIRECTORY="$HOME/pictures/screenshots"
|
||||
|
||||
SCP_HOST=frebib@Poseidon.nerdhouse.io
|
||||
SCP_PATH=/dave/www/frebib.net/s
|
||||
URL_PATH=https://frebib.net/s
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
send_notification() {
|
||||
title="$1"
|
||||
body="$2"
|
||||
replace_id="$3"
|
||||
|
||||
notify-send \
|
||||
-a "$NOTIFY_APPNAME" \
|
||||
-i "$NOTIFY_ICONPATH" \
|
||||
"$title" "$body" \
|
||||
$(if [ -n "$replace_id" ]; then printf "%s" "-r $replace_id"; fi) \
|
||||
-p
|
||||
}
|
||||
|
||||
# Make the screenshot directory
|
||||
mkdir -p "$DIRECTORY"
|
||||
|
||||
# Take the screenshot and save it
|
||||
out_path="$DIRECTORY/$FILENAME"
|
||||
if ! error=$(eval ${SCROT_CMD//\%/$out_path} 2>&1); then
|
||||
send_notification "Screenshot error" "Failed to take a screenshot:<br><br>$error" >/dev/null
|
||||
exit 1
|
||||
fi
|
||||
|
||||
notif_id=$(send_notification "Screenshot uploading" "$FILENAME<br><br>The image is available in the clipboard immediately" || true)
|
||||
|
||||
# Add image to clipboard
|
||||
xclip -i "$out_path" -selection primary -t image/png
|
||||
|
||||
# 'Upload' the screenshot
|
||||
if ! error=$(scp -C $out_path $SCP_HOST:$SCP_PATH 2>&1); then
|
||||
send_notification "Screenshot upload error" "Failed to upload image:<br><br>$error" >/dev/null
|
||||
exit 2
|
||||
fi
|
||||
|
||||
# Add URL to clipboard
|
||||
out_url="$URL_PATH/$FILENAME"
|
||||
echo "$out_url" | xclip -i -selection clipboard
|
||||
send_notification "Screenshot uploaded!" "$out_url" $notif_id >/dev/null || true
|
||||
|
Loading…
Reference in New Issue
Block a user