1
0
Fork 0

initial commit

This commit is contained in:
Massaki Archambault 2018-03-09 23:04:29 -05:00
commit 59aff43a2d
55 changed files with 3818 additions and 0 deletions

9
.gitignore vendored Normal file
View File

@ -0,0 +1,9 @@
files.local/
scripts.local/
.vagrant/
*.swp
files/.vim/swap/
files/.vim/bundle/
!files/.vim/bundle/repos/github.com/Shougo/dein.vim/

16
.gitmodules vendored Normal file
View File

@ -0,0 +1,16 @@
[submodule "files/.config/zsh/oh-my-zsh"]
path = files/.config/zsh/oh-my-zsh
url = https://github.com/robbyrussell/oh-my-zsh.git
branch = master
[submodule "files/.config/zsh/custom/plugins/zsh-syntax-highlighting"]
path = files/.config/zsh/custom/plugins/zsh-syntax-highlighting
url = https://github.com/zsh-users/zsh-syntax-highlighting.git
branch = master
[submodule "files/.config/zsh/custom/plugins/zsh-autosuggestions"]
path = files/.config/zsh/custom/plugins/zsh-autosuggestions
url = https://github.com/zsh-users/zsh-autosuggestions.git
branch = master
[submodule "files/.vim/bundle/repos/github.com/Shougo/dein.vim"]
path = files/.vim/bundle/repos/github.com/Shougo/dein.vim
url = https://github.com/Shougo/dein.vim.git
branch = master

18
README.md Normal file
View File

@ -0,0 +1,18 @@
# Dotfiles
![xkcd 1806](https://imgs.xkcd.com/comics/borrow_your_laptop.png)
## Install
Clone the repository with the submodules and run the install script to symlink the files your `$HOME` directory:
```
git clone --recurse-submodules https://github.com/badjware/dotfiles.git ~/.dotfiles
cd ~/.dotfiles
./install.sh
```
The install script supports some options. For exemple:
* Don't ask for confirmation: `./install.sh --yes`
* Copy instead of creating symlinks: `./install.sh --copy`
For a full list of options, run `./install.sh --help`.

150
files/.Xresources Normal file
View File

@ -0,0 +1,150 @@
#define C_BACKGROUND #1c1c1c
#define C_FOREGROUND #B7BBB7
#define C_BLACK #2C2F33
#define C_RED #B04C50
#define C_GREEN #919652
#define C_YELLOW #E2995C
#define C_BLUE #66899D
#define C_MAGENTA #8D6494
#define C_CYAN #527C77
#define C_LIGHT_GREY #606360
#define C_DARK_GREY #4B5056
#define C_WHITE #DDE3DC
#define C_PRIMARY C_YELLOW
#define C_SECONDARY C_MAGENTA
#define C_ERROR C_RED
#define C_FG C_FOREGROUND
#define C_FG_ENABLED C_WHITE
#define C_FG_DISABLED C_LIGHT_GREY
#define C_BG #111314
#define C_BG_ENABLED #2c2f33
#define C_BG_DISABLED C_BACKGROUND
! Fonts
#define F_MONO Knack Nerd Font
#define F_SANS Roboto
#define F_ICON_1 Material Icons
#define F_ICON_2 material\-wifi
! Colors
*color.bg: C_BG
*color.bg-enabled: C_BG_ENABLED
*color.bg-disabled: C_BG_DISABLED
*color.fg: C_FG
*color.fg-enabled: C_FG_ENABLED
*color.fg-disabled: C_FG_DISABLED
*color.primary: C_PRIMARY
*color.secondary: C_SECONDARY
*color.error: C_ERROR
! X
Xcursor.size: 16
! Rofi
! State: 'bg', 'fg', 'bgalt', 'hlbg', 'hlfg'
rofi.color-normal: C_BG, C_FG, C_BG_DISABLED, C_BG_ENABLED, C_FG_ENABLED
rofi.color-urgent: C_BG, C_SECONDARY, C_BG_DISABLED, C_BG_ENABLED, C_SECONDARY
rofi.color-active: C_BG, C_PRIMARY, C_BG_DISABLED, C_BG_ENABLED, C_PRIMARY
! 'background', 'border', 'separator'
rofi.color-window: C_BG_DISABLED, C_FG_DISABLED, C_FG_DISABLED
rofi.separator-style: none
rofi.bw: 0
rofi.width: 40
rofi.location: 0
rofi.font: F_SANS 12
! i3
i3wm*font: F_MONO
! lock
lock.font: F_SANS
! urxvt
Xft.dpi: 96
Xft.antialias: true
Xft.hinting: full
urxvt.font: xft:F_MONO:size=11
urxvt.cursorBlink: on
urxvt.scrollBar: false
urxvt.scrollTtykeypress: true
urxvt.secondaryScreen: 1
urxvt.secondaryWheel: 1
urxvt.secondaryScroll: 0
!urxvt.transparent: true
!urxvt.shading: 20
urxvt.depth: 32
urxvt.background: rgba:0200/0200/0200/c800
!urxvt.background: C_BACKGROUND
urxvt.foreground: C_FOREGROUND
urxvt.color0: C_BLACK
urxvt.color8: C_DARK_GREY
urxvt.color1: C_RED
urxvt.color9: C_RED
urxvt.color2: C_GREEN
urxvt.color10: C_GREEN
urxvt.color3: C_YELLOW
urxvt.color11: C_YELLOW
urxvt.color4: C_CYAN
urxvt.color12: C_CYAN
urxvt.color5: C_MAGENTA
urxvt.color13: C_MAGENTA
urxvt.color6: C_BLUE
urxvt.color14: C_BLUE
urxvt.color7: C_LIGHT_GREY
urxvt.color15: C_WHITE
! xterm
xterm.termName: xterm-256color
xterm.vt100.locale: true
xterm*borderWidth: 0
! font
xterm*renderFont: true
xterm*faceName: F_MONO
xterm*faceSize: 11
! encoding
xterm.ttyModes: erase ^?
xterm.vt100.backarrowKey: false
xterm.vt100.metaSendsEscape: true
xterm.vt100.translations: #override \n\
Ctrl <Key> minus: smaller-vt-font() \n\
Ctrl <Key> plus: larger-vt-font() \n\
Ctrl <Key> 0: set-vt-font(d) \n\
Ctrl Shift <Key>C: copy-selection(CLIPBOARD) \n\
Ctrl Shift <Key>V: insert-selection(CLIPBOARD) \n\
Shift <Btn1Up>: exec-formatted("xdg-open '%t'", PRIMARY)
! mouse selection
xterm*on3Clicks: regex ([[:alpha:]]+://)?([[:alnum:]!#+,./=?@_~-]|(%[[:xdigit:]][[:xdigit:]]))+
xterm*highlightSelection: true
xterm*trimSelection: true
! color
xterm*background: C_BACKGROUND
xterm*foreground: C_FOREGROUND
xterm*color0: C_BLACK
xterm*color8: C_DARK_GREY
xterm*color1: C_RED
xterm*color9: C_RED
xterm*color2: C_GREEN
xterm*color10: C_GREEN
xterm*color3: C_YELLOW
xterm*color11: C_YELLOW
xterm*color4: C_CYAN
xterm*color12: C_CYAN
xterm*color5: C_MAGENTA
xterm*color13: C_MAGENTA
xterm*color6: C_BLUE
xterm*color14: C_BLUE
xterm*color7: C_LIGHT_GREY
xterm*color15: C_WHITE

View File

@ -0,0 +1,254 @@
# Thank you code_nomad: http://9m.no/ꪯ鵞
#################################
#
# Backend
#
#################################
# Backend to use: "xrender" or "glx".
# GLX backend is typically much faster but depends on a sane driver.
backend = "glx";
#################################
#
# GLX backend
#
#################################
glx-no-stencil = true;
# GLX backend: Copy unmodified regions from front buffer instead of redrawing them all.
# My tests with nvidia-drivers show a 10% decrease in performance when the whole screen is modified,
# but a 20% increase when only 1/4 is.
# My tests on nouveau show terrible slowdown.
# Useful with --glx-swap-method, as well.
glx-copy-from-front = false;
# GLX backend: Use MESA_copy_sub_buffer to do partial screen update.
# My tests on nouveau shows a 200% performance boost when only 1/4 of the screen is updated.
# May break VSync and is not available on some drivers.
# Overrides --glx-copy-from-front.
glx-use-copysubbuffermesa = false;
# GLX backend: Avoid rebinding pixmap on window damage.
# Probably could improve performance on rapid window content changes, but is known to break things on some drivers (LLVMpipe).
# Recommended if it works.
glx-no-rebind-pixmap = true;
# GLX backend: GLX buffer swap method we assume.
# Could be undefined (0), copy (1), exchange (2), 3-6, or buffer-age (-1).
# undefined is the slowest and the safest, and the default value.
# copy is fastest, but may fail on some drivers,
# 2-6 are gradually slower but safer (6 is still faster than 0).
# Usually, double buffer means 2, triple buffer means 3.
# buffer-age means auto-detect using GLX_EXT_buffer_age, supported by some drivers.
# Useless with --glx-use-copysubbuffermesa.
# Partially breaks --resize-damage.
# Defaults to undefined.
glx-swap-method ="-1";
#################################
#
# Shadows
#
#################################
# Enabled client-side shadows on windows.
shadow = true;
# Don't draw shadows on DND windows.
no-dnd-shadow = true;
# Avoid drawing shadows on dock/panel windows.
no-dock-shadow = true;
# Zero the part of the shadow's mask behind the window. Fix some weirdness with ARGB windows.
clear-shadow = true;
# The blur radius for shadows. (default 12)
shadow-radius = 5;
# The left offset for shadows. (default -15)
shadow-offset-x = -5;
# The top offset for shadows. (default -15)
shadow-offset-y = -5;
# The translucency for shadows. (default .75)
shadow-opacity = 0.5;
# Set if you want different colour shadows
# shadow-red = 0.0;
# shadow-green = 0.0;
# shadow-blue = 0.0;
# The shadow exclude options are helpful if you have shadows enabled. Due to the way compton draws its shadows, certain applications will have visual glitches
# (most applications are fine, only apps that do weird things with xshapes or argb are affected).
# This list includes all the affected apps I found in my testing. The "! name~=''" part excludes shadows on any "Unknown" windows, this prevents a visual glitch with the XFWM alt tab switcher.
shadow-exclude = [
"! name~=''",
"name = 'Notification'",
"name = 'Plank'",
"name = 'Docky'",
"name = 'Kupfer'",
"name = 'xfce4-notifyd'",
"name *= 'VLC'",
"name *= 'compton'",
"name *= 'Chromium'",
"name *= 'Chrome'",
"class_g = 'Conky'",
"class_g = 'Kupfer'",
"class_g = 'Synapse'",
"class_g ?= 'Notify-osd'",
"class_g ?= 'Cairo-dock'",
"class_g ?= 'Xfce4-notifyd'",
"class_g ?= 'Xfce4-power-manager'",
"_GTK_FRAME_EXTENTS@:c"
];
# Avoid drawing shadow on all shaped windows (see also: --detect-rounded-corners)
shadow-ignore-shaped = false;
#################################
#
# Opacity
#
#################################
menu-opacity = 1;
inactive-opacity = 1;
active-opacity = 1;
frame-opacity = 1;
inactive-opacity-override = true;
alpha-step = 0.06;
# Dim inactive windows. (0.0 - 1.0)
#inactive-dim = 0.3;
# Do not let dimness adjust based on window opacity.
# inactive-dim-fixed = true;
# Blur background of transparent windows. Bad performance with X Render backend. GLX backend is preferred.
blur-background = false;
# Blur background of opaque windows with transparent frames as well.
blur-background-frame = false;
# Do not let blur radius adjust based on window opacity.
blur-background-fixed = false;
blur-kern = "7x7box";
blur-background-exclude = [
"window_type = 'dock'",
"window_type = 'desktop'"
];
opacity-rule = [
"0:_NET_WM_STATE@:32a *= '_NET_WM_STATE_HIDDEN'",
"90:class_g = 'UXTerm' && _NET_WM_STATE@:32a != '_NET_WM_STATE_HIDDEN' && _NET_WM_STATE@:32a != '_NET_WM_STATE_FULLSCREEN'"
]
#################################
#
# Fading
#
#################################
# Fade windows during opacity changes.
fading = true;
# The time between steps in a fade in milliseconds. (default 10).
fade-delta = 4;
# Opacity change between steps while fading in. (default 0.028).
fade-in-step = 0.03;
# Opacity change between steps while fading out. (default 0.03).
fade-out-step = 0.03;
# Fade windows in/out when opening/closing
# no-fading-openclose = true;
# Specify a list of conditions of windows that should not be faded.
fade-exclude = [
];
#################################
#
# Other
#
#################################
# Try to detect WM windows and mark them as active.
mark-wmwin-focused = true;
# Mark all non-WM but override-redirect windows active (e.g. menus).
mark-ovredir-focused = true;
# Use EWMH _NET_WM_ACTIVE_WINDOW to determine which window is focused instead of using FocusIn/Out events.
# Usually more reliable but depends on a EWMH-compliant WM.
use-ewmh-active-win = true;
# Detect rounded corners and treat them as rectangular when --shadow-ignore-shaped is on.
detect-rounded-corners = true;
# Detect _NET_WM_OPACITY on client windows, useful for window managers not passing _NET_WM_OPACITY of client windows to frame windows.
# This prevents opacity being ignored for some apps.
# For example without this enabled my xfce4-notifyd is 100% opacity no matter what.
detect-client-opacity = true;
# Specify refresh rate of the screen.
# If not specified or 0, compton will try detecting this with X RandR extension.
refresh-rate = 0;
# Set VSync method. VSync methods currently available:
# none: No VSync
# drm: VSync with DRM_IOCTL_WAIT_VBLANK. May only work on some drivers.
# opengl: Try to VSync with SGI_video_sync OpenGL extension. Only work on some drivers.
# opengl-oml: Try to VSync with OML_sync_control OpenGL extension. Only work on some drivers.
# opengl-swc: Try to VSync with SGI_swap_control OpenGL extension. Only work on some drivers. Works only with GLX backend. Known to be most effective on many drivers. Does not actually control paint timing, only buffer swap is affected, so it doesnt have the effect of --sw-opti unlike other methods. Experimental.
# opengl-mswc: Try to VSync with MESA_swap_control OpenGL extension. Basically the same as opengl-swc above, except the extension we use.
# (Note some VSync methods may not be enabled at compile time.)
vsync = "none";
# Enable DBE painting mode, intended to use with VSync to (hopefully) eliminate tearing.
# Reported to have no effect, though.
dbe = false;
# Painting on X Composite overlay window. Recommended.
paint-on-overlay = true;
# Limit compton to repaint at most once every 1 / refresh_rate second to boost performance.
# This should not be used with --vsync drm/opengl/opengl-oml as they essentially does --sw-opti's job already,
# unless you wish to specify a lower refresh rate than the actual value.
sw-opti = true;
# Unredirect all windows if a full-screen opaque window is detected, to maximize performance for full-screen windows, like games.
# Known to cause flickering when redirecting/unredirecting windows.
# paint-on-overlay may make the flickering less obvious.
unredir-if-possible = true;
# Specify a list of conditions of windows that should always be considered focused.
focus-exclude = [ ];
# Use WM_TRANSIENT_FOR to group windows, and consider windows in the same group focused at the same time.
detect-transient = true;
# Use WM_CLIENT_LEADER to group windows, and consider windows in the same group focused at the same time.
# WM_TRANSIENT_FOR has higher priority if --detect-transient is enabled, too.
detect-client-leader = true;
#################################
#
# Window type settings
#
#################################
wintypes:
{
tooltip =
{
fade = true;
shadow = false;
opacity = 0.85;
focus = true;
};
dropdown_menu =
{
fade = false;
};
popup_menu =
{
fade = false;
};
combo =
{
fade = false;
};
};

326
files/.config/dunst/dunstrc Normal file
View File

@ -0,0 +1,326 @@
[global]
### Display ###
# Which monitor should the notifications be displayed on.
monitor = 0
# Display notification on focused monitor. Possible modes are:
# mouse: follow mouse pointer
# keyboard: follow window with keyboard focus
# none: don't follow anything
#
# "keyboard" needs a window manager that exports the
# _NET_ACTIVE_WINDOW property.
# This should be the case for almost all modern window managers.
#
# If this option is set to mouse or keyboard, the monitor option
# will be ignored.
follow = mouse
# The geometry of the window:
# [{width}]x{height}[+/-{x}+/-{y}]
# The geometry of the message window.
# The height is measured in number of notifications everything else
# in pixels. If the width is omitted but the height is given
# ("-geometry x2"), the message window expands over the whole screen
# (dmenu-like). If width is 0, the window expands to the longest
# message displayed. A positive x is measured from the left, a
# negative from the right side of the screen. Y is measured from
# the top and down respectively.
# The width can be negative. In this case the actual width is the
# screen width minus the width defined in within the geometry option.
geometry = "300x5-30+20"
# Show how many messages are currently hidden (because of geometry).
indicate_hidden = yes
# Shrink window if it's smaller than the width. Will be ignored if
# width is 0.
shrink = no
# The transparency of the window. Range: [0; 100].
# This option will only work if a compositing window manager is
# present (e.g. xcompmgr, compiz, etc.).
transparency = 0
# The height of the entire notification. If the height is smaller
# than the font height and padding combined, it will be raised
# to the font height and padding.
notification_height = 0
# Draw a line of "separator_height" pixel height between two
# notifications.
# Set to 0 to disable.
separator_height = 2
# Padding between text and separator.
padding = 8
# Horizontal padding.
horizontal_padding = 8
# Defines width in pixels of frame around the notification window.
# Set to 0 to disable.
frame_width = 3
# Defines color of the frame around the notification window.
frame_color = "#aaaaaa"
# Define a color for the separator.
# possible values are:
# * auto: dunst tries to find a color fitting to the background;
# * foreground: use the same color as the foreground;
# * frame: use the same color as the frame;
# * anything else will be interpreted as a X color.
separator_color = frame
# Sort messages by urgency.
sort = yes
# Don't remove messages, if the user is idle (no mouse or keyboard input)
# for longer than idle_threshold seconds.
# Set to 0 to disable.
# Transient notifications ignore this setting.
idle_threshold = 120
### Text ###
font = Monospace 8
# The spacing between lines. If the height is smaller than the
# font height, it will get raised to the font height.
line_height = 0
# Possible values are:
# full: Allow a small subset of html markup in notifications:
# <b>bold</b>
# <i>italic</i>
# <s>strikethrough</s>
# <u>underline</u>
#
# For a complete reference see
# <http://developer.gnome.org/pango/stable/PangoMarkupFormat.html>.
#
# strip: This setting is provided for compatibility with some broken
# clients that send markup even though it's not enabled on the
# server. Dunst will try to strip the markup but the parsing is
# simplistic so using this option outside of matching rules for
# specific applications *IS GREATLY DISCOURAGED*.
#
# no: Disable markup parsing, incoming notifications will be treated as
# plain text. Dunst will not advertise that it has the body-markup
# capability if this is set as a global setting.
#
# It's important to note that markup inside the format option will be parsed
# regardless of what this is set to.
markup = full
# The format of the message. Possible variables are:
# %a appname
# %s summary
# %b body
# %i iconname (including its path)
# %I iconname (without its path)
# %p progress value if set ([ 0%] to [100%]) or nothing
# %n progress value if set without any extra characters
# %% Literal %
# Markup is allowed
format = "<b>%s</b>\n%b"
# Alignment of message text.
# Possible values are "left", "center" and "right".
alignment = left
# Show age of message if message is older than show_age_threshold
# seconds.
# Set to -1 to disable.
show_age_threshold = 60
# Split notifications into multiple lines if they don't fit into
# geometry.
word_wrap = yes
# When word_wrap is set to no, specify where to ellipsize long lines.
# Possible values are "start", "middle" and "end".
ellipsize = middle
# Ignore newlines '\n' in notifications.
ignore_newline = no
# Merge multiple notifications with the same content
stack_duplicates = true
# Hide the count of merged notifications with the same content
hide_duplicate_count = false
# Display indicators for URLs (U) and actions (A).
show_indicators = yes
### Icons ###
# Align icons left/right/off
icon_position = off
# Scale larger icons down to this size, set to 0 to disable
max_icon_size = 32
# Paths to default icons.
icon_path = /usr/share/icons/Vibrancy-Vibrancy-Colors/status/16/:/usr/share/icons/Vibrancy-Colors/devices/16
### History ###
# Should a notification popped up from history be sticky or timeout
# as if it would normally do.
sticky_history = yes
# Maximum amount of notifications kept in history
history_length = 20
### Misc/Advanced ###
# dmenu path.
dmenu = /usr/bin/dmenu -p dunst:
# Browser for opening urls in context menu.
browser = /usr/bin/firefox -new-tab
# Always run rule-defined scripts, even if the notification is suppressed
always_run_script = true
# Define the title of the windows spawned by dunst
title = Dunst
# Define the class of the windows spawned by dunst
class = Dunst
# Print a notification on startup.
# This is mainly for error detection, since dbus (re-)starts dunst
# automatically after a crash.
startup_notification = false
### Legacy
# Use the Xinerama extension instead of RandR for multi-monitor support.
# This setting is provided for compatibility with older nVidia drivers that
# do not support RandR and using it on systems that support RandR is highly
# discouraged.
#
# By enabling this setting dunst will not be able to detect when a monitor
# is connected or disconnected which might break follow mode if the screen
# layout changes.
force_xinerama = false
# Experimental features that may or may not work correctly. Do not expect them
# to have a consistent behaviour across releases.
[experimental]
# Calculate the dpi to use on a per-monitor basis.
# If this setting is enabled the Xft.dpi value will be ignored and instead
# dunst will attempt to calculate an appropriate dpi value for each monitor
# using the resolution and physical size. This might be useful in setups
# where there are multiple screens with very different dpi values.
per_monitor_dpi = false
[shortcuts]
# Shortcuts are specified as [modifier+][modifier+]...key
# Available modifiers are "ctrl", "mod1" (the alt-key), "mod2",
# "mod3" and "mod4" (windows-key).
# Xev might be helpful to find names for keys.
# Close notification.
close = ctrl+space
# Close all notifications.
close_all = ctrl+shift+space
# Redisplay last message(s).
# On the US keyboard layout "grave" is normally above TAB and left
# of "1". Make sure this key actually exists on your keyboard layout,
# e.g. check output of 'xmodmap -pke'
history = ctrl+grave
# Context menu.
context = ctrl+shift+period
[urgency_low]
# IMPORTANT: colors have to be defined in quotation marks.
# Otherwise the "#" and following would be interpreted as a comment.
background = "#222222"
foreground = "#888888"
timeout = 10
# Icon for notifications with low urgency, uncomment to enable
#icon = /path/to/icon
[urgency_normal]
background = "#285577"
foreground = "#ffffff"
timeout = 10
# Icon for notifications with normal urgency, uncomment to enable
#icon = /path/to/icon
[urgency_critical]
background = "#900000"
foreground = "#ffffff"
frame_color = "#ff0000"
timeout = 0
# Icon for notifications with critical urgency, uncomment to enable
#icon = /path/to/icon
# Every section that isn't one of the above is interpreted as a rules to
# override settings for certain messages.
# Messages can be matched by "appname", "summary", "body", "icon", "category",
# "msg_urgency" and you can override the "timeout", "urgency", "foreground",
# "background", "new_icon" and "format".
# Shell-like globbing will get expanded.
#
# SCRIPTING
# You can specify a script that gets run when the rule matches by
# setting the "script" option.
# The script will be called as follows:
# script appname summary body icon urgency
# where urgency can be "LOW", "NORMAL" or "CRITICAL".
#
# NOTE: if you don't want a notification to be displayed, set the format
# to "".
# NOTE: It might be helpful to run dunst -print in a terminal in order
# to find fitting options for rules.
#[espeak]
# summary = "*"
# script = dunst_espeak.sh
#[script-test]
# summary = "*script*"
# script = dunst_test.sh
#[ignore]
# # This notification will not be displayed
# summary = "foobar"
# format = ""
#[history-ignore]
# # This notification will not be saved in history
# summary = "foobar"
# history_ignore = yes
#[signed_on]
# appname = Pidgin
# summary = "*signed on*"
# urgency = low
#
#[signed_off]
# appname = Pidgin
# summary = *signed off*
# urgency = low
#
#[says]
# appname = Pidgin
# summary = *says*
# urgency = critical
#
#[twitter]
# appname = Pidgin
# summary = *twitter.com*
# urgency = normal
#
# vim: ft=cfg

View File

@ -0,0 +1,16 @@
[Settings]
gtk-icon-theme-name=custom
gtk-theme-name=Vertex
gtk-application-prefer-dark-theme=0
gtk-font-name=Cantarell 11
gtk-cursor-theme-name=Breeze_Snow
gtk-cursor-theme-size=0
gtk-toolbar-style=GTK_TOOLBAR_TEXT
gtk-toolbar-icon-size=GTK_ICON_SIZE_MENU
gtk-button-images=1
gtk-menu-images=1
gtk-enable-event-sounds=1
gtk-enable-input-feedback-sounds=1
gtk-xft-antialias=1
gtk-xft-hinting=0
gtk-xft-hintstyle=hintfull

232
files/.config/i3/config Normal file
View File

@ -0,0 +1,232 @@
# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout some time, delete
# this file and re-run i3-config-wizard(1).
#
# i3 config file (v4)
#
# Please see http://i3wm.org/docs/userguide.html for a complete reference!
# Set colors from Xresources
# Change 'color7' and 'color2' to whatever colors you want i3 to use
# from the generated scheme.
# NOTE: The '#f0f0f0' in the lines below is the color i3 will use if
# it fails to get colors from Xresources for some reason.
set_from_resource $fg i3wm.color.fg #000000
set_from_resource $fg_disabled i3wm.color.fg-disabled #000000
set_from_resource $bg i3wm.color.bg #FFFFFF
set_from_resource $bg_enabled i3wm.color.bg-enabled #FFFFFF
set_from_resource $primary i3wm.color.primary #FF0000
set_from_resource $secondary i3wm.color.secondary #FF0000
# class border backgr. text indicator child_border
client.focused $bg_enabled $bg_enabled $fg $secondary $primary
client.focused_inactive $bg $bg $fg $secondary $bg
client.unfocused $bg $bg $fg_disabled $secondary $bg
client.urgent $bg $bg $primary $secondary $bg
client.placeholder $bg $bg $fg_disabled $secondary $bg
client.background $bg
# Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below.
set_from_resource $font i3wm.color.font monospace
font pango:$font 8
# This font is widely installed, provides lots of unicode glyphs, right-to-left
# text rendering and scalability on retina/hidpi displays (thanks to pango).
#font pango:DejaVu Sans Mono 8
# Before i3 v4.8, we used to recommend this one as the default:
# font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
# The font above is very space-efficient, that is, it looks good, sharp and
# clear in small sizes. However, its unicode glyph coverage is limited, the old
# X core fonts rendering does not support right-to-left and this being a bitmap
# font, it doesnt scale on retina/hidpi displays.
# window title
for_window [class="^.*"] border pixel 1 title_format " %title"
for_window [floating] border pixel 2
smart_borders on
# Gaps
gaps inner 16
gaps outer -8
smart_gaps on
# Floating mod
for_window [class="^Pavucontrol$"] floating enable
for_window [class="Remmina" title="Remmina Remote Desktop Client"] floating enable
for_window [class="feh" title="pinned screenshot"] floating enable sticky enable
for_window [class="TeamViewer" title="Computers & Contacts"] floating enable
# https://github.com/ValveSoftware/steam-for-linux/issues/1040
for_window [class="^Steam$" title="^Friends$"] floating enable
for_window [class="^Steam$" title="Steam - News"] floating enable
for_window [class="^Steam$" title=".* - Chat"] floating enable
for_window [class="^Steam$" title="^Settings$"] floating enable
for_window [class="^Steam$" title=".* - event started"] floating enable
for_window [class="^Steam$" title=".* CD key"] floating enable
for_window [class="^Steam$" title="^Steam - Self Updater$"] floating enable
for_window [class="^Steam$" title="^Screenshot Uploader$"] floating enable
for_window [class="^Steam$" title="^Steam Guard - Computer Authorization Required$"] floating enable
for_window [title="^Steam Keyboard$"] floating enable
# mod key
set $mod Mod4
# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod
# start a terminal
bindsym $mod+Return exec i3-sensible-terminal
# kill focused window
bindsym $mod+Shift+q kill
# start rofi (a program launcher)
bindsym $mod+Control+Return exec /bin/bash ~/.config/i3/rofi.bash
# start rofi-pass for password autotype
bindsym $mod+Shift+Return exec rofi-pass
# change focus
bindsym $mod+j focus left
bindsym $mod+k focus down
bindsym $mod+l focus up
bindsym $mod+semicolon focus right
# alternatively, you can use the cursor keys:
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right
# move focused window
bindsym $mod+Shift+j move left
bindsym $mod+Shift+k move down
bindsym $mod+Shift+l move up
bindsym $mod+Shift+semicolon move right
# alternatively, you can use the cursor keys:
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right
# split in horizontal orientation
bindsym $mod+Shift+backslash split h # |
bindsym $mod+backslash split h
# split in vertical orientation
bindsym $mod+minus split v
# enter fullscreen mode for the focused container
bindsym $mod+f fullscreen toggle
# change container layout (stacked, tabbed, toggle split)
bindsym $mod+s layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split
# toggle tiling / floating
bindsym $mod+Shift+space floating toggle
# change focus between tiling / floating windows
bindsym $mod+space focus mode_toggle
# focus the parent container
bindsym $mod+a focus parent
# focus the child container
bindsym $mod+d focus child
# switch to workspace
bindsym $mod+1 workspace 1
bindsym $mod+2 workspace 2
bindsym $mod+3 workspace 3
bindsym $mod+4 workspace 4
bindsym $mod+5 workspace 5
bindsym $mod+6 workspace 6
bindsym $mod+7 workspace 7
bindsym $mod+8 workspace 8
bindsym $mod+9 workspace 9
bindsym $mod+0 workspace 10
#bindsym $mod+Ctrl+Up workspace next
#bindsym $mod+Ctrl+Down workspace prev
# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace 1
bindsym $mod+Shift+2 move container to workspace 2
bindsym $mod+Shift+3 move container to workspace 3
bindsym $mod+Shift+4 move container to workspace 4
bindsym $mod+Shift+5 move container to workspace 5
bindsym $mod+Shift+6 move container to workspace 6
bindsym $mod+Shift+7 move container to workspace 7
bindsym $mod+Shift+8 move container to workspace 8
bindsym $mod+Shift+9 move container to workspace 9
bindsym $mod+Shift+0 move container to workspace 10
# Assignation
assign [class="^Slack$"] 1
assign [class="^Discord$"] 1
assign [class="^looking-glass-client$"] 3
# screen
workspace 1 output HDMI-2
workspace 2 output HDMI-2
workspace 3 output HDMI-1
workspace 4 output HDMI-1
workspace 5 output HDMI-1
workspace 6 output HDMI-1
workspace 7 output HDMI-1
workspace 8 output HDMI-1
workspace 9 output HDMI-1
workspace 10 output HDMI-1
# reload the configuration file
bindsym $mod+Shift+c reload
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym $mod+Shift+r restart
# exit i3 (logs you out of your X session)
bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'"
# toggle compton
bindsym $mod+c exec --no-startup-id killall compton || compton --config ~/.config/compton/compton.conf
# lock the screen
bindsym $mod+Pause exec lock
# suspend
bindsym $mod+Shift+Pause exec systemctl suspend
# resize window (you can also use the mouse for that)
mode "resize" {
# These bindings trigger as soon as you enter the resize mode
# Pressing left will shrink the windows width.
# Pressing right will grow the windows width.
# Pressing up will shrink the windows height.
# Pressing down will grow the windows height.
bindsym j resize shrink width 10 px or 10 ppt
bindsym k resize grow height 10 px or 10 ppt
bindsym l resize shrink height 10 px or 10 ppt
bindsym semicolon resize grow width 10 px or 10 ppt
# same bindings, but for the arrow keys
bindsym Left resize shrink width 10 px or 10 ppt
bindsym Down resize grow height 10 px or 10 ppt
bindsym Up resize shrink height 10 px or 10 ppt
bindsym Right resize grow width 10 px or 10 ppt
# back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $mod+r mode "resize"
exec --no-startup-id compton --config ~/.config/compton/compton.conf
exec --no-startup-id polybar top
exec --no-startup-id /bin/bash ~/.config/i3/startup.bash

3
files/.config/i3/rofi.bash Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
rofi -combi drun -show drun -modi drun,window

15
files/.config/i3/startup.bash Executable file
View File

@ -0,0 +1,15 @@
#!/bin/bash
# Set wallpaper
#wal -i "$(< "${HOME}/.cache/wal/wal")"
# Initial workspace and startup app
i3-msg "workspace 2"
i3-sensible-terminal &
# sleep a bit to allow polybar to fully load
sleep 3
nextcloud &
remmina --icon &
slack &

View File

@ -0,0 +1,14 @@
#!/bin/bash
if rfkill list bluetooth | grep "yes" >/dev/null; then
if [[ "$1" == "toggle" ]]; then
rfkill unblock bluetooth
fi
echo "$ICO_BLU_OFF"
else
if [[ "$1" == "toggle" ]]; then
rfkill block bluetooth
fi
echo "$ICO_BLU_ON"
fi

View File

@ -0,0 +1,262 @@
;=====================================================
;
; To learn more about how to configure Polybar
; go to https://github.com/jaagr/polybar
;
; The README contains alot of information
;
;=====================================================
[colors]
bg = ${xrdb:polybar.color.bg}
bg-enabled = ${xrdb:polybar.color.bg-enabled}
fg = ${xrdb:polybar.color.fg}
fg-disabled = ${xrdb:polybar.color.fg-disabled}
primary = ${xrdb:polybar.color.primary}
secondary = ${xrdb:polybar.color.secondary}
[bar/top]
monitor = ${env:PRIMARY_MONITOR:HDMI-1}
width = 100%
height = 28
fixed-center = true
background = ${colors.bg}
foreground = ${colors.fg}
;line-size = 3
;line-color = ${colors.background-highlight}
;border-bottom-size = 2
;border-color =${colors.bg}
padding-left = 0
padding-right = 0
module-margin-left = 0
module-margin-right = 1
font-0 = Hack:pixelsize=10;3
font-1 = FontAwesome:pixelsize=10;3
font-2 = material\-wifi:pizelsize=10;3
font-3 = Material Icons:pizelsize=11;4
modules-left = i3
modules-center = title
modules-right = date memory cpu battery openvpn wireless-network bluetooth volume backlight
tray-position = right
tray-padding = 7
tray-maxsize = 16
tray-transparent = false
tray-background = ${colors.bg}
;wm-restack = bspwm
;wm-restack = i3
;override-redirect = true
;scroll-up = bspwm-desknext
;scroll-down = bspwm-deskprev
scroll-up = i3wm-wsnext
scroll-down = i3wm-wsprev
[module/base]
icon-foreground = ${colors.fg}
[module/labeled-base]
label-margin = 1
label-foreground = ${colors.fg}
[module/i3]
type = internal/i3
format = <label-state> <label-mode>
index-sort = true
wrapping-scroll = false
; Only show workspaces on the same output as the bar
pin-workspaces = false
; ws-icon-default = ${env:ICO_WS2}
label-mode-foreground = ${colors.primary}
label-mode-padding = 1
; unfocused = Inactive workspace on any monitor
label-unfocused = " %index% "
label-unfocused-foreground = ${colors.fg-disabled}
label-unfocused-padding = ${self.label-mode-padding}
; focused = Active workspace on focused monitor
label-focused = ${self.label-unfocused}
label-focused-foreground = ${colors.fg}
label-focused-background = ${colors.bg-enabled}
label-focused-padding = ${self.label-mode-padding}
label-visible = ${self.label-focused}
label-visible-foreground = ${module/labeled-base.label-foreground}
label-visible-padding = ${self.label-mode-padding}
; urgent = Workspace with urgency hint set
label-urgent = ${self.label-unfocused}
label-urgent-foreground = ${colors.primary}
label-urgent-padding = ${self.label-mode-padding}
[module/xbacklight]
type = internal/xbacklight
inherit = module/base
format = <ramp>
ramp-0 = ${env:ICO_BL1}
ramp-1 = ${env:ICO_BL2}
ramp-2 = ${env:ICO_BL3}
ramp-3 = ${env:ICO_BL4}
ramp-4 = ${env:ICO_BL5}
ramp-5 = ${env:ICO_BL6}
ramp-6 = ${env:ICO_BL7}
ramp-foreground = ${colors.fg}
[module/backlight]
type = internal/backlight
inherit = module/xbacklight
card = intel_backlight
scroll-up = "brightnessctl set +5%"
scroll-down = "brightnessctl set 5%-"
[module/cpu]
type = internal/cpu
inherit = module/labeled-base
interval = 5
format-prefix = ${env:ICO_CPU}
label-margin = 0
label = "%percentage:3%% "
[module/memory]
type = internal/memory
inherit = module/labeled-base
interval = 5
format-prefix = ${env:ICO_MEM}
label-margin = 0
label = "%percentage_used:3%% "
[module/wireless-network]
type = internal/network
interface = wlan0
interval = 5
format-connected = <ramp-signal>
format-disconnected = <label-disconnected>
label-connected-foreground = ${module/labeled-base.label-foreground}
label-connected-margin = ${module/labeled-base.label-margin}
label-connected = %essid%
label-disconnected = ${env:ICO_WDC}
label-disconnected-foreground = ${colors.fg-disabled}
ramp-signal-0 = ${env:ICO_WC1}
ramp-signal-1 = ${env:ICO_WC2}
ramp-signal-2 = ${env:ICO_WC3}
ramp-signal-3 = ${env:ICO_WC4}
click-left = ~/.config/polybar/wifi_toggle.bash
[module/date]
type = internal/date
inherit = module/labeled-base
interval = 1
format-prefix = ${env:ICO_DATE}
date = "%Y-%m-%d %H:%M"
label = "%date%"
[module/title]
type = internal/xwindow
label = %title%
label-maxlen = 50
[module/volume]
type = internal/volume
inherit = module/base
format-muted-foreground = ${colors.fg-disabled}
format-volume = <ramp-volume>
label-muted = ${env:ICO_MUTE}
ramp-volume-0 = ${env:ICO_VOL1}
ramp-volume-1 = ${env:ICO_VOL2}
ramp-volume-2 = ${env:ICO_VOL3}
click-right = pavucontrol
[module/battery]
type = internal/battery
inherit = module/labeled-base
battery = BAT0
adapter = AC0
full-at = 95
time-format = %H:%M
label-charging-foreground = ${module/labeled-base.label-foreground}
label-charging-margin = 0
label-charging = "%percentage:3%% "
#label-charging = %time%
format-charging = <animation-charging><label-charging>
#label-discharging = %time%
label-discharging-foreground = ${module/labeled-base.label-foreground}
label-discharging-margin = 0
label-discharging = "%percentage:3%% "
format-discharging = <ramp-capacity><label-discharging>
format-full-prefix = ${env:ICO_PLUG}
format-full-foreground-prefix = ${colors.fg}
label-full = " "
ramp-capacity-0 = ${env:ICO_BAT1}
ramp-capacity-1 = ${env:ICO_BAT2}
ramp-capacity-2 = ${env:ICO_BAT3}
ramp-capacity-3 = ${env:ICO_BAT4}
ramp-capacity-4 = ${env:ICO_BAT5}
ramp-capacity-foreground = ${colors.fg}
ramp-capacity-0-foreground = ${colors.secondary}
animation-charging-0 = ${env:ICO_BAT2}
animation-charging-1 = ${env:ICO_BAT3}
animation-charging-2 = ${env:ICO_BAT4}
animation-charging-3 = ${env:ICO_BAT5}
animation-charging-foreground = ${colors.fg}
animation-charging-framerate = 750
[module/redshift]
type = custom/script
inherit = module/base
interval = 1
exec = ~/.config/polybar/redshift.bash status
click-left = ~/.config/polybar/redshift.bash toggle
[module/bluetooth]
type = custom/script
inherit = module/base
interval = 1
exec = ~/.config/polybar/bluetooth.bash
click-left = ~/.config/polybar/bluetooth.bash toggle
[module/openvpn]
type = custom/script
inherit = module/base
interval = 1
exec = /bin/bash ~/.config/polybar/openvpn.bash
click-left = sudo systemctl restart openvpn-client@vpn.massaki.ca
; vim:ft=dosini

View File

@ -0,0 +1,7 @@
#!/bin/bash
if ! pgrep "openvpn" &>/dev/null || ! ip link | grep -q tun; then
echo "$ICO_VPN_OFF "
else
echo "$ICO_VPN_ON "
fi

View File

@ -0,0 +1,24 @@
#!/bin/bash
systemctl --user status redshift >/dev/null
redshift_status=$?
if [[ $1 = "toggle" ]]; then
if [[ redshift_status -eq 0 ]]; then
systemctl --user stop redshift &
redshift_status=1
else
systemctl --user start redshift &
redshift_status=0
fi
fi
if [[ redshift_status -eq 0 ]]; then
#temp="$(redshift -p | egrep -o '[0-9]+K$')"
#echo "$STR_RED_ON $temp"
echo "$ICO_RED_ON"
else
#echo "$STR_RED_OFF ----k"
echo "$ICO_RED_OFF"
fi

View File

@ -0,0 +1,8 @@
#!/bin/bash
if rfkill list wifi | grep "yes" >/dev/null; then
rfkill unblock wifi
else
rfkill block wifi
fi

View File

@ -0,0 +1,61 @@
# This is a sample commands.py. You can add your own commands here.
#
# Please refer to commands_full.py for all the default commands and a complete
# documentation. Do NOT add them all here, or you may end up with defunct
# commands when upgrading ranger.
# You always need to import ranger.api.commands here to get the Command class:
from ranger.api.commands import *
# A simple command for demonstration purposes follows.
# -----------------------------------------------------------------------------
# You can import any python module as needed.
import os
# Any class that is a subclass of "Command" will be integrated into ranger as a
# command. Try typing ":my_edit<ENTER>" in ranger!
class my_edit(Command):
# The so-called doc-string of the class will be visible in the built-in
# help that is accessible by typing "?c" inside ranger.
""":my_edit <filename>
A sample command for demonstration purposes that opens a file in an editor.
"""
# The execute method is called when you run this command in ranger.
def execute(self):
# self.arg(1) is the first (space-separated) argument to the function.
# This way you can write ":my_edit somefilename<ENTER>".
if self.arg(1):
# self.rest(1) contains self.arg(1) and everything that follows
target_filename = self.rest(1)
else:
# self.fm is a ranger.core.filemanager.FileManager object and gives
# you access to internals of ranger.
# self.fm.thisfile is a ranger.container.file.File object and is a
# reference to the currently selected file.
target_filename = self.fm.thisfile.path
# This is a generic function to print text in ranger.
self.fm.notify("Let's edit the file " + target_filename + "!")
# Using bad=True in fm.notify allows you to print error messages:
if not os.path.exists(target_filename):
self.fm.notify("The given file does not exist!", bad=True)
return
# This executes a function from ranger.core.acitons, a module with a
# variety of subroutines that can help you construct commands.
# Check out the source, or run "pydoc ranger.core.actions" for a list.
self.fm.edit_file(target_filename)
# The tab method is called when you press tab, and should return a list of
# suggestions that the user will tab through.
# tabnum is 1 for <TAB> and -1 for <S-TAB> by default
def tab(self, tabnum):
# This is a generic tab-completion function that iterates through the
# content of the current directory.
return self._tab_directory_content()

View File

@ -0,0 +1,612 @@
# ===================================================================
# This file contains the default startup commands for ranger.
# To change them, it is recommended to create the file
# ~/.config/ranger/rc.conf and add your custom commands there.
#
# If you copy this whole file there, you may want to set the environment
# variable RANGER_LOAD_DEFAULT_RC to FALSE to avoid loading it twice.
#
# The purpose of this file is mainly to define keybindings and settings.
# For running more complex python code, please create a plugin in "plugins/" or
# a command in "commands.py".
#
# Each line is a command that will be run before the user interface
# is initialized. As a result, you can not use commands which rely
# on the UI such as :delete or :mark.
# ===================================================================
# ===================================================================
# == Options
# ===================================================================
# Which viewmode should be used? Possible values are:
# miller: Use miller columns which show multiple levels of the hierarchy
# multipane: Midnight-commander like multipane view showing all tabs next
# to each other
#set viewmode miller
#set viewmode multipane
# How many columns are there, and what are their relative widths?
#set column_ratios 1,3,4
# Which files should be hidden? (regular expression)
#set hidden_filter ^\.|\.(?:pyc|pyo|bak|swp)$|^lost\+found$|^__(py)?cache__$
# Show hidden files? You can toggle this by typing 'zh'
#set show_hidden false
# Ask for a confirmation when running the "delete" command?
# Valid values are "always", "never", "multiple" (default)
# With "multiple", ranger will ask only if you delete multiple files at once.
#set confirm_on_delete multiple
# Which script is used to generate file previews?
# ranger ships with scope.sh, a script that calls external programs (see
# README.md for dependencies) to preview images, archives, etc.
#set preview_script ~/.config/ranger/scope.sh
# Use the external preview script or display simple plain text or image previews?
#set use_preview_script true
# Automatically count files in the directory, even before entering them?
#set automatically_count_files true
# Open all images in this directory when running certain image viewers
# like feh or sxiv? You can still open selected files by marking them.
#set open_all_images true
# Be aware of version control systems and display information.
#set vcs_aware false
# State of the three backends git, hg, bzr. The possible states are
# disabled, local (only show local info), enabled (show local and remote
# information).
#set vcs_backend_git enabled
#set vcs_backend_hg disabled
#set vcs_backend_bzr disabled
# Use one of the supported image preview protocols
set preview_images true
# Set the preview image method. Supported methods:
#
# * w3m (default):
# Preview images in full color with the external command "w3mimgpreview"?
# This requires the console web browser "w3m" and a supported terminal.
# It has been successfully tested with "xterm" and "urxvt" without tmux.
#
# * iterm2:
# Preview images in full color using iTerm2 image previews
# (http://iterm2.com/images.html). This requires using iTerm2 compiled
# with image preview support.
#
# * urxvt:
# Preview images in full color using urxvt image backgrounds. This
# requires using urxvt compiled with pixbuf support.
#
# * urxvt-full:
# The same as urxvt but utilizing not only the preview pane but the
# whole terminal window.
#set preview_images_method w3m
# Use a unicode "..." character to mark cut-off filenames?
#set unicode_ellipsis false
# Show dotfiles in the bookmark preview box?
#set show_hidden_bookmarks true
# Which colorscheme to use? These colorschemes are available by default:
# default, jungle, snow, solarized
#set colorscheme default
# Preview files on the rightmost column?
# And collapse (shrink) the last column if there is nothing to preview?
#set preview_files true
#set preview_directories true
#set collapse_preview true
# Save the console history on exit?
#set save_console_history true
# Draw the status bar on top of the browser window (default: bottom)
#set status_bar_on_top false
# Draw a progress bar in the status bar which displays the average state of all
# currently running tasks which support progress bars?
#set draw_progress_bar_in_status_bar true
# Draw borders around columns?
#set draw_borders false
# Display the directory name in tabs?
#set dirname_in_tabs false
# Enable the mouse support?
#set mouse_enabled true
# Display the file size in the main column or status bar?
#set display_size_in_main_column true
#set display_size_in_status_bar true
# Display files tags in all columns or only in main column?
#set display_tags_in_all_columns true
# Set a title for the window?
#set update_title false
# Set the title to "ranger" in the tmux program?
#set update_tmux_title false
# Shorten the title if it gets long? The number defines how many
# directories are displayed at once, 0 turns off this feature.
#set shorten_title 3
# Abbreviate $HOME with ~ in the titlebar (first line) of ranger?
#set tilde_in_titlebar false
# How many directory-changes or console-commands should be kept in history?
#set max_history_size 20
#set max_console_history_size 50
# Try to keep so much space between the top/bottom border when scrolling:
#set scroll_offset 8
# Flush the input after each key hit? (Noticeable when ranger lags)
#set flushinput true
# Padding on the right when there's no preview?
# This allows you to click into the space to run the file.
#set padding_right true
# Save bookmarks (used with mX and `X) instantly?
# This helps to synchronize bookmarks between multiple ranger
# instances but leads to *slight* performance loss.
# When false, bookmarks are saved when ranger is exited.
#set autosave_bookmarks true
# You can display the "real" cumulative size of directories by using the
# command :get_cumulative_size or typing "dc". The size is expensive to
# calculate and will not be updated automatically. You can choose
# to update it automatically though by turning on this option:
#set autoupdate_cumulative_size false
# Turning this on makes sense for screen readers:
#set show_cursor false
# One of: size, natural, basename, atime, ctime, mtime, type, random
#set sort natural
# Additional sorting options
#set sort_reverse false
#set sort_case_insensitive true
#set sort_directories_first true
#set sort_unicode false
# Enable this if key combinations with the Alt Key don't work for you.
# (Especially on xterm)
#set xterm_alt_key false
# Whether to include bookmarks in cd command
#set cd_bookmarks true
# Avoid previewing files larger than this size, in bytes. Use a value of 0 to
# disable this feature.
#set preview_max_size 0
# Add the highlighted file to the path in the titlebar
#set show_selection_in_titlebar true
# The delay that ranger idly waits for user input, in milliseconds, with a
# resolution of 100ms. Lower delay reduces lag between directory updates but
# increases CPU load.
#set idle_delay 2000
# When the metadata manager module looks for metadata, should it only look for
# a ".metadata.json" file in the current directory, or do a deep search and
# check all directories above the current one as well?
#set metadata_deep_search false
# Clear all existing filters when leaving a directory
#set clear_filters_on_dir_change false
# Disable displaying line numbers in main column
#set line_numbers false
# ===================================================================
# == Local Options
# ===================================================================
# You can set local options that only affect a single directory.
# Examples:
# setlocal path=~/downloads sort mtime
# ===================================================================
# == Command Aliases in the Console
# ===================================================================
#alias e edit
#alias q quit
#alias q! quitall
#alias qa quitall
#alias qall quitall
#alias setl setlocal
#alias filter scout -prt
#alias find scout -aeit
#alias mark scout -mr
#alias unmark scout -Mr
#alias search scout -rs
#alias search_inc scout -rts
#alias travel scout -aefiklst
# ===================================================================
# == Define keys for the browser
# ===================================================================
# Basic
#map Q quit!
#map q quit
#copymap q ZZ ZQ
#map R reload_cwd
#map <C-r> reset
#map <C-l> redraw_window
#map <C-c> abort
#map <esc> change_mode normal
#map ~ set viewmode!
#map i display_file
#map ? help
#map W display_log
#map w taskview_open
#map S shell $SHELL
#map : console
#map ; console
#map ! console shell%space
#map @ console -p6 shell %%s
#map # console shell -p%space
#map s console shell%space
#map r chain draw_possible_programs; console open_with%%space
#map f console find%space
#map cd console cd%space
# Change the line mode
#map Mf linemode filename
#map Mi linemode fileinfo
#map Mm linemode mtime
#map Mp linemode permissions
#map Ms linemode sizemtime
#map Mt linemode metatitle
# Tagging / Marking
#map t tag_toggle
#map ut tag_remove
#map "<any> tag_toggle tag=%any
#map <Space> mark_files toggle=True
#map v mark_files all=True toggle=True
#map uv mark_files all=True val=False
#map V toggle_visual_mode
#map uV toggle_visual_mode reverse=True
# For the nostalgics: Midnight Commander bindings
#map <F1> help
#map <F3> display_file
#map <F4> edit
#map <F5> copy
#map <F6> cut
#map <F7> console mkdir%space
#map <F8> console delete
#map <F10> exit
# In case you work on a keyboard with dvorak layout
#map <UP> move up=1
#map <DOWN> move down=1
#map <LEFT> move left=1
#map <RIGHT> move right=1
#map <HOME> move to=0
#map <END> move to=-1
#map <PAGEDOWN> move down=1 pages=True
#map <PAGEUP> move up=1 pages=True
#map <CR> move right=1
#map <DELETE> console delete
#map <INSERT> console touch%space
# VIM-like
#copymap <UP> k
#copymap <DOWN> j
#copymap <LEFT> h
#copymap <RIGHT> l
#copymap <HOME> gg
#copymap <END> G
#copymap <PAGEDOWN> <C-F>
#copymap <PAGEUP> <C-B>
#map J move down=0.5 pages=True
#map K move up=0.5 pages=True
#copymap J <C-D>
#copymap K <C-U>
# Jumping around
#map H history_go -1
#map L history_go 1
#map ] move_parent 1
#map [ move_parent -1
#map } traverse
#map gh cd ~
#map ge cd /etc
#map gu cd /usr
#map gd cd /dev
#map gl cd -r .
#map gL cd -r %f
#map go cd /opt
#map gv cd /var
#map gm cd /media
#map gM cd /mnt
#map gs cd /srv
#map gr cd /
#map gR eval fm.cd(ranger.RANGERDIR)
#map g/ cd /
#map g? cd /usr/share/doc/ranger
# External Programs
#map E edit
#map du shell -p du --max-depth=1 -h --apparent-size
#map dU shell -p du --max-depth=1 -h --apparent-size | sort -rh
#map yp shell -f echo -n %d/%f | xsel -i; xsel -o | xsel -i -b
#map yd shell -f echo -n %d | xsel -i; xsel -o | xsel -i -b
#map yn shell -f echo -n %f | xsel -i; xsel -o | xsel -i -b
# Filesystem Operations
#map = chmod
#map cw console rename%space
#map a rename_append
#map A eval fm.open_console('rename ' + fm.thisfile.relative_path.replace("%", "%%"))
#map I eval fm.open_console('rename ' + fm.thisfile.relative_path.replace("%", "%%"), position=7)
#map pp paste
#map po paste overwrite=True
#map pP paste append=True
#map pO paste overwrite=True append=True
#map pl paste_symlink relative=False
#map pL paste_symlink relative=True
#map phl paste_hardlink
#map pht paste_hardlinked_subtree
#map dD console delete
#map dd cut
#map ud uncut
#map da cut mode=add
#map dr cut mode=remove
#map dt cut mode=toggle
#map yy copy
#map uy uncut
#map ya copy mode=add
#map yr copy mode=remove
#map yt copy mode=toggle
# Temporary workarounds
#map dgg eval fm.cut(dirarg=dict(to=0), narg=quantifier)
#map dG eval fm.cut(dirarg=dict(to=-1), narg=quantifier)
#map dj eval fm.cut(dirarg=dict(down=1), narg=quantifier)
#map dk eval fm.cut(dirarg=dict(up=1), narg=quantifier)
#map ygg eval fm.copy(dirarg=dict(to=0), narg=quantifier)
#map yG eval fm.copy(dirarg=dict(to=-1), narg=quantifier)
#map yj eval fm.copy(dirarg=dict(down=1), narg=quantifier)
#map yk eval fm.copy(dirarg=dict(up=1), narg=quantifier)
# Searching
#map / console search%space
#map n search_next
#map N search_next forward=False
#map ct search_next order=tag
#map cs search_next order=size
#map ci search_next order=mimetype
#map cc search_next order=ctime
#map cm search_next order=mtime
#map ca search_next order=atime
# Tabs
#map <C-n> tab_new ~
#map <C-w> tab_close
#map <TAB> tab_move 1
#map <S-TAB> tab_move -1
#map <A-Right> tab_move 1
#map <A-Left> tab_move -1
#map gt tab_move 1
#map gT tab_move -1
#map gn tab_new ~
#map gc tab_close
#map uq tab_restore
#map <a-1> tab_open 1
#map <a-2> tab_open 2
#map <a-3> tab_open 3
#map <a-4> tab_open 4
#map <a-5> tab_open 5
#map <a-6> tab_open 6
#map <a-7> tab_open 7
#map <a-8> tab_open 8
#map <a-9> tab_open 9
# Sorting
#map or set sort_reverse!
#map oz set sort=random
#map os chain set sort=size; set sort_reverse=False
#map ob chain set sort=basename; set sort_reverse=False
#map on chain set sort=natural; set sort_reverse=False
#map om chain set sort=mtime; set sort_reverse=False
#map oc chain set sort=ctime; set sort_reverse=False
#map oa chain set sort=atime; set sort_reverse=False
#map ot chain set sort=type; set sort_reverse=False
#map oe chain set sort=extension; set sort_reverse=False
#map oS chain set sort=size; set sort_reverse=True
#map oB chain set sort=basename; set sort_reverse=True
#map oN chain set sort=natural; set sort_reverse=True
#map oM chain set sort=mtime; set sort_reverse=True
#map oC chain set sort=ctime; set sort_reverse=True
#map oA chain set sort=atime; set sort_reverse=True
#map oT chain set sort=type; set sort_reverse=True
#map oE chain set sort=extension; set sort_reverse=True
#map dc get_cumulative_size
# Settings
#map zc set collapse_preview!
#map zd set sort_directories_first!
#map zh set show_hidden!
#map <C-h> set show_hidden!
#map zI set flushinput!
#map zi set preview_images!
#map zm set mouse_enabled!
#map zp set preview_files!
#map zP set preview_directories!
#map zs set sort_case_insensitive!
#map zu set autoupdate_cumulative_size!
#map zv set use_preview_script!
#map zf console filter%space
# Bookmarks
#map `<any> enter_bookmark %any
#map '<any> enter_bookmark %any
#map m<any> set_bookmark %any
#map um<any> unset_bookmark %any
#map m<bg> draw_bookmarks
#copymap m<bg> um<bg> `<bg> '<bg>
# Generate all the chmod bindings with some python help:
#eval for arg in "rwxXst": cmd("map +u{0} shell -f chmod u+{0} %s".format(arg))
#eval for arg in "rwxXst": cmd("map +g{0} shell -f chmod g+{0} %s".format(arg))
#eval for arg in "rwxXst": cmd("map +o{0} shell -f chmod o+{0} %s".format(arg))
#eval for arg in "rwxXst": cmd("map +a{0} shell -f chmod a+{0} %s".format(arg))
#eval for arg in "rwxXst": cmd("map +{0} shell -f chmod u+{0} %s".format(arg))
#eval for arg in "rwxXst": cmd("map -u{0} shell -f chmod u-{0} %s".format(arg))
#eval for arg in "rwxXst": cmd("map -g{0} shell -f chmod g-{0} %s".format(arg))
#eval for arg in "rwxXst": cmd("map -o{0} shell -f chmod o-{0} %s".format(arg))
#eval for arg in "rwxXst": cmd("map -a{0} shell -f chmod a-{0} %s".format(arg))
#eval for arg in "rwxXst": cmd("map -{0} shell -f chmod u-{0} %s".format(arg))
# ===================================================================
# == Define keys for the console
# ===================================================================
# Note: Unmapped keys are passed directly to the console.
# Basic
#cmap <tab> eval fm.ui.console.tab()
#cmap <s-tab> eval fm.ui.console.tab(-1)
#cmap <ESC> eval fm.ui.console.close()
#cmap <CR> eval fm.ui.console.execute()
#cmap <C-l> redraw_window
#copycmap <ESC> <C-c>
#copycmap <CR> <C-j>
# Move around
#cmap <up> eval fm.ui.console.history_move(-1)
#cmap <down> eval fm.ui.console.history_move(1)
#cmap <left> eval fm.ui.console.move(left=1)
#cmap <right> eval fm.ui.console.move(right=1)
#cmap <home> eval fm.ui.console.move(right=0, absolute=True)
#cmap <end> eval fm.ui.console.move(right=-1, absolute=True)
#cmap <a-left> eval fm.ui.console.move_word(left=1)
#cmap <a-right> eval fm.ui.console.move_word(right=1)
# Line Editing
#cmap <backspace> eval fm.ui.console.delete(-1)
#cmap <delete> eval fm.ui.console.delete(0)
#cmap <C-w> eval fm.ui.console.delete_word()
#cmap <A-d> eval fm.ui.console.delete_word(backward=False)
#cmap <C-k> eval fm.ui.console.delete_rest(1)
#cmap <C-u> eval fm.ui.console.delete_rest(-1)
#cmap <C-y> eval fm.ui.console.paste()
# And of course the emacs way
#copycmap <up> <C-p>
#copycmap <down> <C-n>
#copycmap <left> <C-b>
#copycmap <right> <C-f>
#copycmap <home> <C-a>
#copycmap <end> <C-e>
#copycmap <delete> <C-d>
#copycmap <backspace> <C-h>
# Note: There are multiple ways to express backspaces. <backspace> (code 263)
# and <backspace2> (code 127). To be sure, use both.
#copycmap <backspace> <backspace2>
# This special expression allows typing in numerals:
#cmap <allow_quantifiers> false
# ===================================================================
# == Pager Keybindings
# ===================================================================
# Movement
#pmap <down> pager_move down=1
#pmap <up> pager_move up=1
#pmap <left> pager_move left=4
#pmap <right> pager_move right=4
#pmap <home> pager_move to=0
#pmap <end> pager_move to=-1
#pmap <pagedown> pager_move down=1.0 pages=True
#pmap <pageup> pager_move up=1.0 pages=True
#pmap <C-d> pager_move down=0.5 pages=True
#pmap <C-u> pager_move up=0.5 pages=True
#copypmap <UP> k <C-p>
#copypmap <DOWN> j <C-n> <CR>
#copypmap <LEFT> h
#copypmap <RIGHT> l
#copypmap <HOME> g
#copypmap <END> G
#copypmap <C-d> d
#copypmap <C-u> u
#copypmap <PAGEDOWN> n f <C-F> <Space>
#copypmap <PAGEUP> p b <C-B>
# Basic
#pmap <C-l> redraw_window
#pmap <ESC> pager_close
#copypmap <ESC> q Q i <F3>
#pmap E edit_file
# ===================================================================
# == Taskview Keybindings
# ===================================================================
# Movement
#tmap <up> taskview_move up=1
#tmap <down> taskview_move down=1
#tmap <home> taskview_move to=0
#tmap <end> taskview_move to=-1
#tmap <pagedown> taskview_move down=1.0 pages=True
#tmap <pageup> taskview_move up=1.0 pages=True
#tmap <C-d> taskview_move down=0.5 pages=True
#tmap <C-u> taskview_move up=0.5 pages=True
#copytmap <UP> k <C-p>
#copytmap <DOWN> j <C-n> <CR>
#copytmap <HOME> g
#copytmap <END> G
#copytmap <C-u> u
#copytmap <PAGEDOWN> n f <C-F> <Space>
#copytmap <PAGEUP> p b <C-B>
# Changing priority and deleting tasks
#tmap J eval -q fm.ui.taskview.task_move(-1)
#tmap K eval -q fm.ui.taskview.task_move(0)
#tmap dd eval -q fm.ui.taskview.task_remove()
#tmap <pagedown> eval -q fm.ui.taskview.task_move(-1)
#tmap <pageup> eval -q fm.ui.taskview.task_move(0)
#tmap <delete> eval -q fm.ui.taskview.task_remove()
# Basic
#tmap <C-l> redraw_window
#tmap <ESC> taskview_close
#copytmap <ESC> q Q w <C-c>

View File

@ -0,0 +1,213 @@
# vim: ft=cfg
#
# This is the configuration file of "rifle", ranger's file executor/opener.
# Each line consists of conditions and a command. For each line the conditions
# are checked and if they are met, the respective command is run.
#
# Syntax:
# <condition1> , <condition2> , ... = command
#
# The command can contain these environment variables:
# $1-$9 | The n-th selected file
# $@ | All selected files
#
# If you use the special command "ask", rifle will ask you what program to run.
#
# Prefixing a condition with "!" will negate its result.
# These conditions are currently supported:
# match <regexp> | The regexp matches $1
# ext <regexp> | The regexp matches the extension of $1
# mime <regexp> | The regexp matches the mime type of $1
# name <regexp> | The regexp matches the basename of $1
# path <regexp> | The regexp matches the absolute path of $1
# has <program> | The program is installed (i.e. located in $PATH)
# env <variable> | The environment variable "variable" is non-empty
# file | $1 is a file
# directory | $1 is a directory
# number <n> | change the number of this command to n
# terminal | stdin, stderr and stdout are connected to a terminal
# X | $DISPLAY is not empty (i.e. Xorg runs)
#
# There are also pseudo-conditions which have a "side effect":
# flag <flags> | Change how the program is run. See below.
# label <label> | Assign a label or name to the command so it can
# | be started with :open_with <label> in ranger
# | or `rifle -p <label>` in the standalone executable.
# else | Always true.
#
# Flags are single characters which slightly transform the command:
# f | Fork the program, make it run in the background.
# | New command = setsid $command >& /dev/null &
# r | Execute the command with root permissions
# | New command = sudo $command
# t | Run the program in a new terminal. If $TERMCMD is not defined,
# | rifle will attempt to extract it from $TERM.
# | New command = $TERMCMD -e $command
# Note: The "New command" serves only as an illustration, the exact
# implementation may differ.
# Note: When using rifle in ranger, there is an additional flag "c" for
# only running the current file even if you have marked multiple files.
has xdg-open, flag f = xdg-open "$1"
#-------------------------------------------
# Websites
#-------------------------------------------
# Rarely installed browsers get higher priority; It is assumed that if you
# install a rare browser, you probably use it. Firefox/konqueror/w3m on the
# other hand are often only installed as fallback browsers.
ext x?html?, has surf, X, flag f = surf -- file://"$1"
ext x?html?, has vimprobable, X, flag f = vimprobable -- "$@"
ext x?html?, has vimprobable2, X, flag f = vimprobable2 -- "$@"
ext x?html?, has qutebrowser, X, flag f = qutebrowser -- "$@"
ext x?html?, has dwb, X, flag f = dwb -- "$@"
ext x?html?, has jumanji, X, flag f = jumanji -- "$@"
ext x?html?, has luakit, X, flag f = luakit -- "$@"
ext x?html?, has uzbl, X, flag f = uzbl -- "$@"
ext x?html?, has uzbl-tabbed, X, flag f = uzbl-tabbed -- "$@"
ext x?html?, has uzbl-browser, X, flag f = uzbl-browser -- "$@"
ext x?html?, has uzbl-core, X, flag f = uzbl-core -- "$@"
ext x?html?, has midori, X, flag f = midori -- "$@"
ext x?html?, has chromium, X, flag f = chromium -- "$@"
ext x?html?, has opera, X, flag f = opera -- "$@"
ext x?html?, has firefox, X, flag f = firefox -- "$@"
ext x?html?, has seamonkey, X, flag f = seamonkey -- "$@"
ext x?html?, has iceweasel, X, flag f = iceweasel -- "$@"
ext x?html?, has epiphany, X, flag f = epiphany -- "$@"
ext x?html?, has konqueror, X, flag f = konqueror -- "$@"
ext x?html?, has elinks, terminal = elinks "$@"
ext x?html?, has links2, terminal = links2 "$@"
ext x?html?, has links, terminal = links "$@"
ext x?html?, has lynx, terminal = lynx -- "$@"
ext x?html?, has w3m, terminal = w3m "$@"
#-------------------------------------------
# Misc
#-------------------------------------------
# Define the "editor" for text files as first action
mime ^text, label editor = $EDITOR -- "$@"
mime ^text, label pager = "$PAGER" -- "$@"
!mime ^text, label editor, ext xml|json|csv|tex|py|pl|rb|js|sh|php = $EDITOR -- "$@"
!mime ^text, label pager, ext xml|json|csv|tex|py|pl|rb|js|sh|php = "$PAGER" -- "$@"
ext 1 = man "$1"
ext s[wmf]c, has zsnes, X = zsnes "$1"
ext s[wmf]c, has snes9x-gtk,X = snes9x-gtk "$1"
ext nes, has fceux, X = fceux "$1"
ext exe = wine "$1"
name ^[mM]akefile$ = make
#--------------------------------------------
# Code
#-------------------------------------------
ext py = python -- "$1"
ext pl = perl -- "$1"
ext rb = ruby -- "$1"
ext js = node -- "$1"
ext sh = sh -- "$1"
ext php = php -- "$1"
#--------------------------------------------
# Audio without X
#-------------------------------------------
mime ^audio|ogg$, terminal, has mpv = mpv -- "$@"
mime ^audio|ogg$, terminal, has mplayer2 = mplayer2 -- "$@"
mime ^audio|ogg$, terminal, has mplayer = mplayer -- "$@"
ext midi?, terminal, has wildmidi = wildmidi -- "$@"
#--------------------------------------------
# Video/Audio with a GUI
#-------------------------------------------
mime ^video|audio, has gmplayer, X, flag f = gmplayer -- "$@"
mime ^video|audio, has smplayer, X, flag f = smplayer "$@"
mime ^video, has mpv, X, flag f = mpv -- "$@"
mime ^video, has mpv, X, flag f = mpv --fs -- "$@"
mime ^video, has mplayer2, X, flag f = mplayer2 -- "$@"
mime ^video, has mplayer2, X, flag f = mplayer2 -fs -- "$@"
mime ^video, has mplayer, X, flag f = mplayer -- "$@"
mime ^video, has mplayer, X, flag f = mplayer -fs -- "$@"
mime ^video|audio, has vlc, X, flag f = vlc -- "$@"
mime ^video|audio, has totem, X, flag f = totem -- "$@"
mime ^video|audio, has totem, X, flag f = totem --fullscreen -- "$@"
#--------------------------------------------
# Video without X:
#-------------------------------------------
mime ^video, terminal, !X, has mpv = mpv -- "$@"
mime ^video, terminal, !X, has mplayer2 = mplayer2 -- "$@"
mime ^video, terminal, !X, has mplayer = mplayer -- "$@"
#-------------------------------------------
# Documents
#-------------------------------------------
ext pdf, has llpp, X, flag f = llpp "$@"
ext pdf, has zathura, X, flag f = zathura -- "$@"
ext pdf, has mupdf, X, flag f = mupdf "$@"
ext pdf, has mupdf-x11,X, flag f = mupdf-x11 "$@"
ext pdf, has apvlv, X, flag f = apvlv -- "$@"
ext pdf, has xpdf, X, flag f = xpdf -- "$@"
ext pdf, has evince, X, flag f = evince -- "$@"
ext pdf, has atril, X, flag f = atril -- "$@"
ext pdf, has okular, X, flag f = okular -- "$@"
ext pdf, has epdfview, X, flag f = epdfview -- "$@"
ext pdf, has qpdfview, X, flag f = qpdfview "$@"
ext docx?, has catdoc, terminal = catdoc -- "$@" | "$PAGER"
ext sxc|xlsx?|xlt|xlw|gnm|gnumeric, has gnumeric, X, flag f = gnumeric -- "$@"
ext sxc|xlsx?|xlt|xlw|gnm|gnumeric, has kspread, X, flag f = kspread -- "$@"
ext pptx?|od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has libreoffice, X, flag f = libreoffice "$@"
ext pptx?|od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has soffice, X, flag f = soffice "$@"
ext pptx?|od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has ooffice, X, flag f = ooffice "$@"
ext djvu, has zathura,X, flag f = zathura -- "$@"
ext djvu, has evince, X, flag f = evince -- "$@"
ext djvu, has atril, X, flag f = atril -- "$@"
#-------------------------------------------
# Image Viewing:
#-------------------------------------------
mime ^image/svg, has inkscape, X, flag f = inkscape -- "$@"
mime ^image/svg, has display, X, flag f = display -- "$@"
mime ^image, has pqiv, X, flag f = pqiv -- "$@"
mime ^image, has sxiv, X, flag f = sxiv -- "$@"
mime ^image, has feh, X, flag f = feh -- "$@"
mime ^image, has mirage, X, flag f = mirage -- "$@"
mime ^image, has ristretto, X, flag f = ristretto "$@"
mime ^image, has eog, X, flag f = eog -- "$@"
mime ^image, has eom, X, flag f = eom -- "$@"
mime ^image, has gimp, X, flag f = gimp -- "$@"
ext xcf, X, flag f = gimp -- "$@"
#-------------------------------------------
# Archives
#-------------------------------------------
# avoid password prompt by providing empty password
ext 7z, has 7z = 7z -p l "$@" | "$PAGER"
# This requires atool
ext ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz, has als = als -- "$@" | "$PAGER"
ext iso|jar|msi|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has als = als -- "$@" | "$PAGER"
ext 7z|ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz, has aunpack = aunpack -- "$@"
ext iso|jar|msi|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has aunpack = aunpack -- "$@"
# Fallback:
ext tar|gz, has tar = tar vvtf "$@" | "$PAGER"
ext tar|gz, has tar = tar vvxf "$@"
#-------------------------------------------
# Misc
#-------------------------------------------
label wallpaper, number 11, mime ^image, has feh, X = feh --bg-scale "$1"
label wallpaper, number 12, mime ^image, has feh, X = feh --bg-tile "$1"
label wallpaper, number 13, mime ^image, has feh, X = feh --bg-center "$1"
label wallpaper, number 14, mime ^image, has feh, X = feh --bg-fill "$1"
# Define the editor for non-text files + pager as last action
!mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php = ask
label editor, !mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php = $EDITOR -- "$@"
label pager, !mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php = "$PAGER" -- "$@"
# The very last action, so that it's never triggered accidentally, is to execute a program:
mime application/x-executable = "$1"

121
files/.config/ranger/scope.sh Executable file
View File

@ -0,0 +1,121 @@
#!/usr/bin/env sh
# ranger supports enhanced previews. If the option "use_preview_script"
# is set to True and this file exists, this script will be called and its
# output is displayed in ranger. ANSI color codes are supported.
# NOTES: This script is considered a configuration file. If you upgrade
# ranger, it will be left untouched. (You must update it yourself.)
# Also, ranger disables STDIN here, so interactive scripts won't work properly
# Meanings of exit codes:
# code | meaning | action of ranger
# -----+------------+-------------------------------------------
# 0 | success | success. display stdout as preview
# 1 | no preview | failure. display no preview at all
# 2 | plain text | display the plain content of the file
# 3 | fix width | success. Don't reload when width changes
# 4 | fix height | success. Don't reload when height changes
# 5 | fix both | success. Don't ever reload
# 6 | image | success. display the image $cached points to as an image preview
# 7 | image | success. display the file directly as an image
# Meaningful aliases for arguments:
path="$1" # Full path of the selected file
width="$2" # Width of the preview pane (number of fitting characters)
height="$3" # Height of the preview pane (number of fitting characters)
cached="$4" # Path that should be used to cache image previews
preview_images="$5" # "True" if image previews are enabled, "False" otherwise.
maxln=200 # Stop after $maxln lines. Can be used like ls | head -n $maxln
# Find out something about the file:
mimetype=$(file --mime-type -Lb "$path")
extension=$(/bin/echo "${path##*.}" | awk '{print tolower($0)}')
# Functions:
# runs a command and saves its output into $output. Useful if you need
# the return value AND want to use the output in a pipe
try() { output=$(eval '"$@"'); }
# writes the output of the previously used "try" command
dump() { /bin/echo "$output"; }
# a common post-processing function used after most commands
trim() { head -n "$maxln"; }
# wraps highlight to treat exit code 141 (killed by SIGPIPE) as success
safepipe() { "$@"; test $? = 0 -o $? = 141; }
# Image previews, if enabled in ranger.
if [ "$preview_images" = "True" ]; then
case "$mimetype" in
# Image previews for SVG files, disabled by default.
###image/svg+xml)
### convert "$path" "$cached" && exit 6 || exit 1;;
# Image previews for image files. w3mimgdisplay will be called for all
# image files (unless overriden as above), but might fail for
# unsupported types.
image/*)
exit 7;;
# Image preview for video, disabled by default.:
###video/*)
### ffmpegthumbnailer -i "$path" -o "$cached" -s 0 && exit 6 || exit 1;;
esac
fi
case "$extension" in
# Archive extensions:
a|ace|alz|arc|arj|bz|bz2|cab|cpio|deb|gz|jar|lha|lz|lzh|lzma|lzo|\
rpm|rz|t7z|tar|tbz|tbz2|tgz|tlz|txz|tZ|tzo|war|xpi|xz|Z|zip)
try als "$path" && { dump | trim; exit 0; }
try acat "$path" && { dump | trim; exit 3; }
try bsdtar -lf "$path" && { dump | trim; exit 0; }
exit 1;;
rar)
# avoid password prompt by providing empty password
try unrar -p- lt "$path" && { dump | trim; exit 0; } || exit 1;;
7z)
# avoid password prompt by providing empty password
try 7z -p l "$path" && { dump | trim; exit 0; } || exit 1;;
# PDF documents:
pdf)
try pdftotext -l 10 -nopgbrk -q "$path" - && \
{ dump | trim | fmt -s -w $width; exit 0; } || exit 1;;
# BitTorrent Files
torrent)
try transmission-show "$path" && { dump | trim; exit 5; } || exit 1;;
# ODT Files
odt|ods|odp|sxw)
try odt2txt "$path" && { dump | trim; exit 5; } || exit 1;;
# HTML Pages:
htm|html|xhtml)
try w3m -dump "$path" && { dump | trim | fmt -s -w $width; exit 4; }
try lynx -dump "$path" && { dump | trim | fmt -s -w $width; exit 4; }
try elinks -dump "$path" && { dump | trim | fmt -s -w $width; exit 4; }
;; # fall back to highlight/cat if the text browsers fail
esac
case "$mimetype" in
# Syntax highlight for text files:
text/* | */xml)
if [ "$(tput colors)" -ge 256 ]; then
pygmentize_format=terminal256
highlight_format=xterm256
else
pygmentize_format=terminal
highlight_format=ansi
fi
try safepipe highlight --out-format=${highlight_format} "$path" && { dump | trim; exit 5; }
try safepipe pygmentize -f ${pygmentize_format} "$path" && { dump | trim; exit 5; }
exit 2;;
# Ascii-previews of images:
image/*)
img2txt --gamma=0.6 --width="$width" "$path" && exit 4 || exit 1;;
# Display information about media files:
video/* | audio/*)
exiftool "$path" && exit 5
# Use sed to remove spaces so the output fits into the narrow window
try mediainfo "$path" && { dump | trim | sed 's/ \+:/: /;'; exit 5; } || exit 1;;
esac
exit 1

View File

@ -0,0 +1,56 @@
; Global settings for redshift
[redshift]
; Set the day and night screen temperatures (Neutral is 6500K)
temp-day=6000
temp-night=3000
; Enable/Disable a smooth transition between day and night
; 0 will cause a direct change from day to night screen temperature.
; 1 will gradually increase or decrease the screen temperature.
transition=1
; Set the screen brightness. Default is 1.0.
;brightness=0.9
; It is also possible to use different settings for day and night
; since version 1.8.
;brightness-day=1.0
;brightness-night=0.9
; Set the screen gamma (for all colors, or each color channel
; individually)
;gamma=0.8
;gamma=0.8:0.7:0.8
; This can also be set individually for day and night since
; version 1.10.
;gamma-day=0.8:0.7:0.8
;gamma-night=0.6
; Set the location-provider: 'geoclue2' or 'manual'
; type 'redshift -l list' to see possible values.
; The location provider settings are in a different section.
location-provider=manual
; Set the adjustment-method: 'randr', 'vidmode'
; type 'redshift -m list' to see all possible values.
; 'randr' is the preferred method, 'vidmode' is an older API.
; but works in some cases when 'randr' does not.
; The adjustment method settings are in a different section.
adjustment-method=randr
; Configuration of the location-provider:
; type 'redshift -l PROVIDER:help' to see the settings.
; ex: 'redshift -l manual:help'
; Keep in mind that longitudes west of Greenwich (e.g. the Americas)
; are negative numbers.
[manual]
lat=45.5
lon=-73.5
; Configuration of the adjustment-method
; type 'redshift -m METHOD:help' to see the settings.
; ex: 'redshift -m randr:help'
; In this example, randr is configured to adjust screen 1.
; Note that the numbering starts from 0, so this is actually the
; second screen. If this option is not specified, Redshift will try
; to adjust _all_ screens.
[randr]
;screen=1

View File

@ -0,0 +1,79 @@
# permanently set alternative root dir
# root=/path/to/root
# rofi command. Make sure to have "$@" as last argument
_rofi () {
domain="$(xdotool getactivewindow getwindowname | grep -Eo 'https?://\S+' | sed -E 's%^https?://(www.)?([a-zA-Z0-9\-\.]+).+%\2%')"
if [[ -n "$domain" ]]; then
extra_arg="-select $domain"
fi
rofi -i -no-auto-select $extra_arg "$@"
}
# xdotool needs the keyboard layout to be set using setxkbmap
# You can do this in your autostart scripts (e.g. xinitrc)
# If for some reason, you cannot do this, you can set the command here.
# and set fix_layout to true
fix_layout=false
layout_cmd () {
setxkbmap -rules evdev -model evdev -layout us -variant altgr-intl
}
# fields to be used
URL_field='url'
USERNAME_field='user'
AUTOTYPE_field='autotype'
# delay to be used for :delay keyword
delay=2
# rofi-pass needs to close itself before it can type passwords. Set delay here.
wait=0.2
## Programs to be used
# Editor
EDITOR='gvim -f'
# Browser
#BROWSER='chromium'
## Misc settings
default_do='menu' # menu, autotype, copyPass, typeUser, typePass, copyUser, copyUrl, viewEntry, typeMenu, actionMenu, copyMenu, openUrl
auto_enter='true'
notify='false'
default_autotype='user :tab pass'
# color of the help messages
# leave empty for autodetection
help_color="#4872FF"
# Clipboard settings
# Possible options: primary, clipboard, both
clip=primary
# Options for generating new password entries
# default_user is also used for password files that have no user field.
#default_user=john_doe
#default_user2=mary_ann
password_length=16
# Custom Keybindings
autotype="Alt+1"
type_user="Alt+2"
type_pass="Alt+3"
open_url="Alt+4"
copy_name="Alt+u"
copy_url="Alt+l"
copy_pass="Alt+p"
show="Alt+o"
copy_entry="Alt+2"
type_entry="Alt+1"
copy_menu="Alt+c"
action_menu="Alt+a"
type_menu="Alt+t"
help="Alt+h"
switch="Alt+x"
insert_pass="Alt+n"

0
files/.config/zsh/.@dir Normal file
View File

View File

@ -0,0 +1,27 @@
# ZSH
setopt SH_WORD_SPLIT
# Evaluate if root user
if uname -s | egrep -q '^(CYGWIN)|(MINGW)|(MSYS)'; then
#windows
if id -G | grep -q 544; then
IS_ROOT=true
else
IS_ROOT=false
fi
else
#'nix
if [[ $UID -eq 0 ]]; then
IS_ROOT=true
else
IS_ROOT=false
fi
fi
export IS_ROOT
# gpg-agent
export GPG_TTY=$(tty)
gpg-connect-agent updatestartuptty /bye >/dev/null
source ~/.local/profile.d/*

View File

@ -0,0 +1,24 @@
alias svim="sudo -e"
alias vissh="$EDITOR ~/.ssh/config"
alias vihosts="sudo -e /etc/hosts"
if type htop >/dev/null; then
alias top="htop"
fi
alias http-server="python -m http.server"
alias nmap-libvirt="nmap 192.168.122.0/24"
alias xsel="xsel -b"
alias drun-it="docker run -it"
alias dexec-it="docker exec -it"
# network stuff must always be run with sudo anyway
alias wifi-menu="sudo wifi-menu -o"
alias netctl="sudo netctl"
# serial
alias minicom="docker run --device=/dev/ttyUSB0 -it minicom"
# open-sourced build of vs code is named code-oss
alias code="code-oss"

View File

@ -0,0 +1,13 @@
mkcdir() {
mkdir -p "$1" && cd "$1"
}
vialias() {
$EDITOR $ZSH_CUSTOM/100-alias.zsh
source $ZSH_CUSTOM/100-alias.zsh
}
vifunction() {
$EDITOR $ZSH_CUSTOM/101-function.zsh
source $ZSH_CUSTOM/101-function.zsh
}

View File

@ -0,0 +1,17 @@
if [ "$IS_ROOT" = false ]; then
neofetch --config "$ZSH_CUSTOM/config/neofetch-splash.bash"
echo -e "\e[2A"
# Updates
#update_count="$(pacman -Qu | wc -l)"
#[[ $update_count -ne 1 ]] && s="s"
#[[ $update_count -ne 0 ]] && echo "$update_count package$s to update"
#unset s update_count
# Check tmux
if tmux info &>/dev/null; then
tmux ls
echo " "
fi
fi

View File

@ -0,0 +1,27 @@
#ZSH_HIGHLIGHT_STYLES[default]="none"
#ZSH_HIGHLIGHT_STYLES[unknown-token]="fg=red,bold"
#ZSH_HIGHLIGHT_STYLES[reserved-word]="fg=magenta"
ZSH_HIGHLIGHT_STYLES[alias]="none"
ZSH_HIGHLIGHT_STYLES[builtin]="magenta,bold"
ZSH_HIGHLIGHT_STYLES[function]="none"
ZSH_HIGHLIGHT_STYLES[command]="none"
ZSH_HIGHLIGHT_STYLES[precommand]="none"
ZSH_HIGHLIGHT_STYLES[commandseparator]="none"
ZSH_HIGHLIGHT_STYLES[hashed-command]="none"
ZSH_HIGHLIGHT_STYLES[path]="fg=white,bold"
ZSH_HIGHLIGHT_STYLES[globbing]="fg=white,bold"
#ZSH_HIGHLIGHT_STYLES[history-expansion]="fg=blue"
ZSH_HIGHLIGHT_STYLES[single-hyphen-option]="fg=cyan"
ZSH_HIGHLIGHT_STYLES[double-hyphen-option]="fg=cyan,bold"
#ZSH_HIGHLIGHT_STYLES[back-quoted-argument]="none"
ZSH_HIGHLIGHT_STYLES[single-quoted-argument]="fg=green"
ZSH_HIGHLIGHT_STYLES[double-quoted-argument]="fg=green"
ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument]="fg=yellow"
ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]="fg=yellow"
#ZSH_HIGHLIGHT_STYLES[assign]="none"
#ZSH_HIGHLIGHT_STYLES[bracket-level-1]="fg=cyan,bold"
#ZSH_HIGHLIGHT_STYLES[bracket-level-2]="fg=blue,bold"
#ZSH_HIGHLIGHT_STYLES[bracket-level-3]="fg=yellow,bold"
#ZSH_HIGHLIGHT_STYLES[bracket-level-4]="fg=magenta,bold"

View File

@ -0,0 +1,7 @@
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=0"
ZSH_AUTOSUGGEST_STRATEGY="match_prev_cmd"
#ZSH_AUTOSUGGEST_USE_ASYNC=1
ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=20
bindkey '^ ' autosuggest-accept

View File

@ -0,0 +1,13 @@
ascii_distro="arch_small"
print_info () {
info line_break
info "OS" distro
info "Shell" shell
info "Kernel" kernel
info line_break
info "Packages" packages "$update_msg"
}

View File

@ -0,0 +1,131 @@
setopt prompt_subst # enable command substitution in prompt
PROMPT='$(prompt_cmd)'
RPROMPT=''
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[white]%} on %{$fg[cyan]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX=""
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]%}?"
ZSH_THEME_GIT_PROMPT_AHEAD="%{$fg_bold[white]%}↑"
ZSH_THEME_GIT_PROMPT_BEHIND="%{$fg_bold[white]%}↓"
# Evaluate if root user
is_root() {
if uname -s | egrep '^(CYGWIN)|(MINGW)|(MSYS)' 2>&1 >/dev/null; then
id -G | grep 544 2>&1 >/dev/null
else
[ $UID -eq 0 ]
fi
}
prompt_cmd() {
# exit code
local exit_code=$?
local exit_code_hex=$(printf '(%02x)' $exit_code)
if [[ exit_code -eq 0 ]]; then
exit_code_hex="%{$fg[white]%}$exit_code_hex"
else
exit_code_hex="%{$fg[red]%}$exit_code_hex"
fi
# name@hostname
local default_color="green"
local user_color="$default_color"
if is_root; then
local user_color="red"
fi
local name_hostname="%{$fg[$user_color]%}$USER%{$fg[$default_color]%}@%m"
# working directory
local wd_arr=($(grep -Eo '[^/]+' <<<"${PWD/$HOME/~}"))
local dir_count=${#wd_arr[@]}
local dir_abbr=$((dir_count-3))
for ((i=dir_count; i >= 1 ; i--)); do
local dir="${wd_arr[i]}"
if [ $i -lt $dir_abbr ]; then
wd="${dir:0:1}/$wd"
else
wd="$dir/$wd"
fi
done
if [ -z "$wd" ]; then
wd="//"
elif [ "${wd:0:1}" != "~" ]; then
wd="/$wd"
fi
wd="%{$fg[yellow]%}${wd:0:-1}"
# prompt
if [ "$IS_ROOT" = true ]; then
local prompt="%{$fg[red]%}#"
else
local prompt="%{$fg[white]%}$"
fi
printf "%s %s %s\n%s %s" "$exit_code_hex" "$name_hostname" "$wd" "$prompt" "%{$reset_color%}"
}
rprompt_cmd() {
# git
if git rev-parse --git-dir >/dev/null 2>&1; then
local prompt_info="$(git_prompt_info)"
if [[ -z "$prompt_info" ]]; then
local git_rev="$(git_prompt_short_sha)"
else
local git_rev="$prompt_info"
fi
local prompt_status="$(git_prompt_status)"
if [[ -n "$prompt_status" ]]; then
local git_status="$(printf "%s[%s%s]" "%{$fg[white]%}" "$prompt_status" "%{$reset_color%}%{$fg[white]%}")"
fi
fi
printf "%s %s%s" "$git_rev" "$git_status" "%{$reset_color%}"
}
# Based on http://www.anishathalye.com/2015/02/07/an-asynchronous-shell-prompt/
ASYNC_PROC=0
function precmd() {
function async() {
# save to temp file
printf "%s" "$(rprompt_cmd)" > "/tmp/zsh_prompt_$$"
# signal parent
kill -s USR1 $$
}
# do not clear RPROMPT, let it persist
# kill child if necessary
if [[ "${ASYNC_PROC}" != 0 ]]; then
kill -s HUP $ASYNC_PROC >/dev/null 2>&1 || :
fi
# start background computation
async &!
ASYNC_PROC=$!
}
function TRAPUSR1() {
# read from temp file
RPROMPT="$(cat /tmp/zsh_prompt_$$)"
# reset proc number
ASYNC_PROC=0
# redisplay
zle && zle reset-prompt
}
# vim: syn=zsh

View File

View File

@ -0,0 +1,10 @@
# You can put files here to add functionality separated per file, which
# will be ignored by git.
# Files on the custom/ directory will be automatically loaded by the init
# script, in alphabetical order.
# For example: add yourself some shortcuts to projects you often work on.
#
# brainstormr=~/Projects/development/planetargon/brainstormr
# cd $brainstormr
#

View File

@ -0,0 +1,2 @@
# Add your own custom plugins in the custom/plugins directory. Plugins placed
# here will override ones with the same name in the main plugins directory.

View File

18
files/.gtkrc-2.0 Normal file
View File

@ -0,0 +1,18 @@
# DO NOT EDIT! This file will be overwritten by LXAppearance.
# Any customization should be done in ~/.gtkrc-2.0.mine instead.
include "/home/marchambault/.gtkrc-2.0.mine"
gtk-theme-name="Vertex"
gtk-icon-theme-name="custom"
gtk-font-name="Cantarell 11"
gtk-cursor-theme-name="Breeze_Snow"
gtk-cursor-theme-size=0
gtk-toolbar-style=GTK_TOOLBAR_TEXT
gtk-toolbar-icon-size=GTK_ICON_SIZE_MENU
gtk-button-images=1
gtk-menu-images=1
gtk-enable-event-sounds=1
gtk-enable-input-feedback-sounds=1
gtk-xft-antialias=1
gtk-xft-hinting=0
gtk-xft-hintstyle="hintfull"

View File

@ -0,0 +1,5 @@
# This file is written by LXAppearance. Do not edit.
[Icon Theme]
Name=Default
Comment=Default Cursor Theme
Inherits=Breeze_Snow

27
files/.local/bin/apod Executable file
View File

@ -0,0 +1,27 @@
#!/bin/bash -e
api_response="$(curl -sS https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY)"
filename="$HOME/Pictures/apod/$(echo $api_response | jq --join-output '.date+" "+.title').jpg"
wallpaper_filename="$HOME/Pictures/wallpaper"
url="$(echo $api_response | jq --raw-output '.hdurl')"
screen_size="$(xrandr --screen 0 | grep '^Screen' | grep -Eo 'current [0-9]+ x [0-9]+' | sed -E 's/current ([0-9]+) x ([0-9]+)/\1x\2/g')"
mkdir -p "$(dirname $filename)"
if [[ -f "$filename" ]]; then
echo "Image already downloaded"
else
curl -sS -o "$filename" "$url"
fi
if [[ "$1" == "--wallpaper" ]]; then
[[ -f "$wallpaper_filename" ]] && rm "$wallpaper_filename"
img_size="$(identify "$filename" | grep -Eo '[0-9]+x[0-9]+' | head -n 1)"
if [[ "$(echo "$img_size" | grep -Eo '^[0-9]+')" -lt "$(echo "$screen_size" | grep -Eo '^[0-9]+')"
|| "$(echo "$img_size" | grep -Eo '[0-9]+$')" -lt "$(echo "$screen_size" | grep -Eo '[0-9]+$')" ]]; then
convert "$filename" -filter Lanczos -gravity center -unsharp 0x1 -resize "$screen_size^" "$wallpaper_filename"
else
ln -s "$filename" "$wallpaper_filename"
fi
feh --bg-fill "$wallpaper_filename"
fi

80
files/.local/bin/emp Executable file
View File

@ -0,0 +1,80 @@
#!/bin/bash
#pvid: streamlink wrapper
print_help() {
echo "A streamlink wrapper"
echo ""
echo "Usage: emp [options] url"
echo ""
echo "Options:"
echo " -h, --help Print this help text"
echo " -b, --bg Play the video on the root window"
echo " -a, --audio Play only the audio"
echo ""
exit 0
}
short_args=hba
long_args=help,bg,audio
# default
default_stream="best"
mpv_cmd="mpv"
player_args="--wid="$(xdotool getactivewindow)""
streamlink_args="--retry-stream 30"
# Parse arguments
parsed_args=$(getopt --options $short_args --longoptions $long_args --name "$0" -- "$@")
if [[ $? -ne 0 ]]; then
echo "Failed to parse arguments"
exit 2
fi
eval set -- "$parsed_args"
while true; do
case "$1" in
-h|--help)
print_help
;;
-b|--bg)
a=y
streamlink_args="$streamlink_args --quiet"
mpv_cmd="xwinwrap -ov -fs -- mpv"
player_args="--no-osc --wid WID"
shift
;;
-a|--audio)
a=y
streamlink_args="$streamlink_args --quiet"
player_args="--no-video"
shift
;;
--)
shift
break
;;
*)
#the following args will be passed to streamlink
break
;;
esac
done
if [[ -z "$@" ]]; then
print_help
fi
streamlink \
$streamlink_args \
--default-stream "$default_stream" \
--player="$mpv_cmd" \
--player-args "$player_args -- {filename}" \
$@ &
if [[ -n "$a" ]]; then
cava
fi
wait
exit $?

24
files/.local/bin/lock Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
query_color() {
xrdb -query | grep -m 1 "color.$1" | sed -E 's/^.+:\s*#?//g'
}
query_prop() {
xrdb -query | grep -m 1 "lock.$1" | sed -E 's/^.+:\s*//g'
}
# flush gpg-agent cache
echo RELOADAGENT | gpg-connect-agent
exec i3lock --image="$HOME/Pictures/wallpaper" --indicator --force-clock \
--textcolor="00000000" --insidevercolor="00000000" --insidewrongcolor="00000000" --insidecolor="00000000" \
--ringvercolor="$(query_color primary)FF" --ringwrongcolor="$(query_color error)FF" --ringcolor="$(query_color fg-enabled)FF" \
--keyhlcolor="$(query_color primary)FF" --bshlcolor="$(query_color secondary)FF" \
--separatorcolor="00000000" --line-uses-inside \
--radius=50 --indpos="x+100:h-150" \
--timefont="$(query_color font)" --timecolor="$(query_color fg-enabled)FF" --timesize=72 \
--time-align=1 --timepos="ix+r+30:iy-50" --timestr="%H:%M" \
--datefont="$(query_prop font_sans)" --datecolor="$(query_color fg-enabled)FF" --datesize=48 \
--date-align=1 --datepos="tx:ty-70" --datestr="%A, %b %e"

29
files/.local/bin/mvn-findclass Executable file
View File

@ -0,0 +1,29 @@
#!/bin/bash
#Colors
col_normal=$(tput sgr0)
col_red=$(tput setaf 1)
col_green=$(tput setaf 2)
col_magenta=$(tput setaf 5)
col_cyan=$(tput setaf 6)
#validation
if [[ -z $1 ]]
then
echo 'USAGE: mvn-findclass [classname]'
exit 1
fi
query="$(echo "$1" | sed 's%\.%/%g')"
find ~/.m2 -type f -name '*.jar' -print0 | while read -d '' -r jar
do
unzip -l "$jar" | sed -r 's%^.* .* (.*)$%\1%gm' | while read -r file
do
if [[ "$file" == *"$query.class" ]]
then
echo "$file" | sed -r "s%^(.*)($query)(.*)$%Found \1${col_green}\2${col_normal}\3%"
echo " in ${col_cyan}$jar${col_normal}"
fi
done
done

View File

@ -0,0 +1,7 @@
#!/bin/bash
cd ~/.local/share/remmina
ls -1 *.remmina | while read a; do
N=`grep '^name=' "$a" | cut -f2 -d=`;
[ "$a" == "$N.remmina" ] || mv "$a" "$N".remmina;
done

54
files/.local/bin/sshot Executable file
View File

@ -0,0 +1,54 @@
#!/bin/bash
## sshot - Take a screenshot
if [[ "$1" == "--partial" ]]; then
ARG_PARTIAL=1
elif [[ "$1" == "--pin" ]]; then
ARG_PARTIAL=1
ARG_PIN=1
elif [[ "$1" == "--window" ]]; then
ARG_WINDOW=1
fi
file="$HOME/Pictures/screenshots/$(date --iso-8601=seconds).png"
mkdir -p "$(dirname $file)" 2>/dev/null
if [[ -n "$ARG_PARTIAL" ]]; then
# prompt the user for the area to take a screenshot from
read -r geometry < <(slop --highlight --color="0.6,0.4,0.3,0.4" --tolerance=0 --format "%wx%h+%x+%y")
if [ -z "$geometry" ]; then
exit 1
fi
elif [[ -n $ARG_WINDOW ]]; then
# get the active window geometry
while read -r line; do
if echo "$line" | grep -q "Position"; then
p="$(echo "$line" | grep -Eo '[0-9]+,[0-9]+' | sed 's/,/+/')"
elif echo "$line" | grep -q "Geometry"; then
g="$(echo "$line" | grep -Eo '[0-9]+x[0-9]+')"
fi
done <<< "$(xdotool getactivewindow getwindowgeometry)"
geometry="$g"+"$p"
fi
# take a screenshot
scrot "$file"
if [[ -n "$geometry" ]]; then
# crop the screenshot to geometry
convert "$file" -crop "$geometry" "$file"
fi
# place to image in the clipboard
xclip -selection clipboard -target image/png "$file"
if [[ -n "$ARG_PIN" ]]; then
# pin the screenshot
feh --title "pinned screenshot" --geometry "$geometry" "$file" &
fi
# print the file name
echo "$file"

128
files/.local/bin/to7zip Executable file
View File

@ -0,0 +1,128 @@
#!/bin/bash
print_help() {
echo ""
echo "Convert an archive to the 7zip format, or create a new archive"
echo ""
echo "Usage: to7zip [options] ...files"
echo ""
echo "Options:"
echo " -h, --help Print this help text"
echo " -d, --delete-old Delete converted file"
echo " -f, --force Replace the file with the converted file even if the file exists"
echo " -r, --rezip Extract and archive again even if the converted file is already a 7zip archive"
echo " -t, --thread Set the number of threads for archive extraction and creation (default: $thread_count)"
echo ""
}
short_args=hdfrt:
long_args=help,delete-old,force,rezip,thread:
# default
rezip=
delete_old=
force=
thread_count=8
params=""
# Parse arguments
parsed_args=$(getopt --options $short_args --longoptions $long_args --name "$0" -- "$@")
if [[ $? -ne 0 ]]; then
echo "Failed to parse arguments"
exit 2
fi
eval set -- "$parsed_args"
while true; do
case "$1" in
-h|--help)
print_help
exit 0
;;
-d|--delete-old)
delete_old=y
shift
;;
-f|--force)
force=y
shift
;;
-r|--rezip)
rezip=y
shift
;;
-t|--thread)
thread_count="$2"
shift 2
;;
--)
shift
break
;;
*)
break
;;
esac
done
out_dir="$PWD"
for f in "$@"; do
tmp_dir="$(mktemp -d /tmp/to7zip.XXX)"
output="$(echo "$f" | sed -E 's/\.(zip|rar|7z)$//g').7z"
backup_file="$output".backup
do_backup=
if [[ ! -r "$f" ]]; then
echo "$f : No such file or directory"
continue
fi
echo "$f -> $output"
if [[ -f "$output" ]]; then
if [[ -n "$force" ]] || [[ "$f" =~ .7z$ && -n "$rezip" ]]; then
do_backup=y
else
echo "$output : file exists, refusing to continue (-f to force)"
continue
fi
fi
if [[ "$f" =~ \.tar|gz|bz2|zip|7z$ ]]; then
if ! 7z e -mmt="$thread_count" -o"$tmp_dir" "$f" >/dev/null; then
echo "$f : extract failed"
continue
fi
elif [[ "$f" =~ \.rar$ ]]; then
if ! unrar x "$f" "$tmp_dir" >/dev/null; then
echo "$f : unrar failed"
continue
fi
else
cp -r "$f" "$tmp_dir"
fi
if [[ -n "$do_backup" ]]; then
mv "$output" "$backup_file"
fi
pushd "$tmp_dir" >/dev/null
7z a -t7z -m0=lzma2 -mx=9 -ms=on -mmt="$thread_count" "$out_dir/$output" >/dev/null
return_val=$?
popd >/dev/null
if [[ $return_val -eq 0 ]]; then
if [[ -n "$do_backup" ]]; then
rm -r "$backup_file"
elif [[ -n "$delete_old" ]]; then
rm -r "$f"
fi
else
if [[ -n "$do_backup" ]]; then
mv "$backup_file" "$output"
fi
echo "$f : 7z archive failed"
fi
rm -r "$tmp_dir"
done

66
files/.profile Normal file
View File

@ -0,0 +1,66 @@
# PATH
export PATH="$PATH:$HOME/.local/bin:$HOME/bin"
# applications
export TERMINAL=uxterm
export BROWSER=firefox
export VISUAL=vim
export EDITOR=vim
export PAGER=less
# firefox
export MOZ_USE_XINPUT2=1
# qt5
export DESKTOP_SESSION=gnome
export QT_STYLE_OVERRIDE=gtk
export QT_QPA_PLATFORMTHEME=gtk2
# java
export _JAVA_OPTIONS="-XX:MaxPermSize=128m -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel -Dsun.java2d.opengl=true"
export JAVA_FONTS=/usr/share/fonts/TTF
# polybar
export ICO_WS1="$(echo -e "\uf0c8")"
export ICO_WS2="$(echo -e "\uf096")"
export ICO_DATE="$(echo -e "\uf017")"
export ICO_CPU="$(echo -e "\ue322")"
export ICO_MEM="$(echo -e "\uf2db")"
export ICO_BL1="$(echo -e "\ue3a6")"
export ICO_BL2="$(echo -e "\ue3a7")"
export ICO_BL3="$(echo -e "\ue3a8")"
export ICO_BL4="$(echo -e "\ue3a9")"
export ICO_BL5="$(echo -e "\ue3aa")"
export ICO_BL6="$(echo -e "\ue3ab")"
export ICO_BL7="$(echo -e "\ue3ac")"
export ICO_VOL1="$(echo -e "\ue04e")"
export ICO_VOL2="$(echo -e "\ue04d")"
export ICO_VOL3="$(echo -e "\ue050")"
export ICO_MUTE="$(echo -e "\ue04f")"
export ICO_BAT1="$(echo -e "\uf244")"
export ICO_BAT2="$(echo -e "\uf243")"
export ICO_BAT3="$(echo -e "\uf242")"
export ICO_BAT4="$(echo -e "\uf241")"
export ICO_BAT5="$(echo -e "\uf240")"
export ICO_PLUG="$(echo -e "\uf0e7")"
export ICO_WDC="$(echo -e "\ue1da")"
export ICO_WC1="$(echo -e "\ue905")"
export ICO_WC2="$(echo -e "\ue903")"
export ICO_WC3="$(echo -e "\ue901")"
export ICO_WC4="$(echo -e "\ue900")"
export ICO_RED_ON="$(echo -e "%{F#B7BBB7}\uf0eb%{F#606360}")"
export ICO_RED_OFF="$(echo -e "%{F#606360}\uf0eb")"
export ICO_VPN_ON="$(echo -e "%{F#B7BBB7}\uf023%{F#606360}")"
export ICO_VPN_OFF="$(echo -e "%{F#E2995C}\uf13e")"
export ICO_BLU_ON="$(echo -e "%{F#B7BBB7}\ue1a7%{F#606360}")"
export ICO_BLU_OFF="$(echo -e "%{F#606360}\ue1a9")"

54
files/.tmux.conf Normal file
View File

@ -0,0 +1,54 @@
# Rebind prefix to `
unbind C-b
set-option -g prefix `
bind-key ` send-prefix
# Rebind split to - and |
unbind '"'
unbind %
bind | split-window -h
bind - split-window -v
# Rebind pane switch to Meta-arrow
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
# Bind config reloading
bind r source-file ~/.tmux.conf \; display-message "Config reloaded..."
# Mouse
set -g mouse on
# Terminal
set -g default-terminal "screen-256color"
set -ga terminal-overrides ",screen-256color:Tc"
# Window
set -g base-index 1
# Pane
setw -g pane-base-index 1
setw -g allow-rename off
set -g pane-border-fg "colour7"
set -g pane-active-border-fg "colour5"
# Status bar
set -g status-position top
set -g status-bg "default"
setw -g window-status-fg "colour7"
setw -g window-status-bg "default"
setw -g window-status-format " #I:#W"
setw -g window-status-current-fg "colour15"
setw -g window-status-current-bg "default"
setw -g window-status-current-format " [#I:#W]"
setw -g window-status-activity-attr bold
set -g status-left-fg "colour7"
set -g status-left '{#[fg=colour6]#S#[fg=default]}'
set -g status-right-length 100
set -g status-right-fg "colour7"
set -g status-right '#(__tmux_status)'

0
files/.vim/.@dir Normal file
View File

@ -0,0 +1 @@
Subproject commit 5bbff63c09126580ed1ef0df8ed2496d4c0fee82

231
files/.vim/vimrc Normal file
View File

@ -0,0 +1,231 @@
set nocompatible
" Syntax highlighting
syntax on
" Line numbering
set number
" highlight
set cursorline
" Auto-indentation
set ai
set tabstop=4
set shiftwidth=4
set expandtab
" Matching paren highlighting
set showmatch
" Sane colors
set background=dark
" Show cursor pos
set ruler
" Make the status line always show up
set laststatus=2
set ttimeoutlen=50
" Shut the annoying bell
set novisualbell
" Set the updatetime
set updatetime=1000
" Ignore case for ex command completion
set smartcase
nnoremap / /\C
nnoremap / /\C
" Remap arrow keys
noremap <Up> <NOP>
noremap <Down> <NOP>
nnoremap <Left> :bprev<CR>
nnoremap <Right> :bnext<CR>
" write the file when you accidentally opened it without the right (root)privileges
cmap w!! w !sudo tee % > /dev/null
" Remember mouse cursor position
augroup resCur
autocmd!
autocmd BufReadPost * call setpos(".", getpos("'\""))
augroup END
" Plugins
let deinpath=$HOME."/.vim/bundle/repos/github.com/Shougo/dein.vim"
let pluginpath=$HOME."/.vim/bundle"
let &rtp.=",".deinpath
if dein#load_state(pluginpath)
call dein#begin(pluginpath)
"call dein#add(deinpath)
" Colorscheme
call dein#add("ajh17/Spacegray.vim.git")
" Interface
call dein#add("itchyny/lightline.vim")
call dein#add('taohex/lightline-buffer')
call dein#add("airblade/vim-gitgutter")
call dein#add("christoomey/vim-tmux-navigator")
call dein#add("scrooloose/nerdtree")
" Tools / Commands
call dein#add("tpope/vim-surround")
call dein#add("jiangmiao/auto-pairs")
call dein#add("tpope/vim-endwise")
call dein#add("chrisbra/unicode.vim")
call dein#add("ctrlpvim/ctrlp.vim")
" Linting / Completion
call dein#add("w0rp/ale")
call dein#add("maralla/completor.vim")
" Language
call dein#add("sheerun/vim-polyglot")
call dein#end()
call dein#save_state()
endif
filetype plugin indent on
syntax enable
" Automatically install plugins
if dein#check_install()
call dein#install()
endif
" Completor
" TAB to choose completion
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
"inoremap <expr> <cr> pumvisible() ? "\<C-y>\<cr>" : "\<cr>"
let g:completor_python_binary = '/usr/bin/python'
let g:completor_node_binary = '/usr/bin/node'
let g:completor_clang_binary = '/usr/bin/clang'
" ALE
let g:ale_sign_error = ''
let g_sign_warning = ''
" nerdtree
map <C-n> :NERDTreeToggle<CR>
" ctrlp
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
let g:ctrlp_show_hidden = 1
" From lightline help
let g:ctrlp_status_func = {
\ 'main': 'CtrlPStatusFunc_1',
\ 'prog': 'CtrlPStatusFunc_2',
\ }
function! CtrlPStatusFunc_1(focus, byfname, regex, prev, item, next, marked)
return lightline#statusline(0)
endfunction
function! CtrlPStatusFunc_2(str)
return lightline#statusline(0)
endfunction
" gitgutter
let g:gitgutter_realtime = 1
let g:gitgutter_eager = 0
let g:gitgutter_sign_added = ''
let g:gitgutter_sign_modified = ''
let g:gitgutter_sign_removed = ''
let g:gitgutter_sign_removed_first_line = ''
let g:gitgutter_sign_modified_removed = ''
" lightline
set noshowmode
set showtabline=2
let g:lightline = {
\ 'colorscheme': 'wombat',
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ],
\ [ 'readonly', 'filename' ],
\ [ 'ctrlpmark' ] ],
\ 'right': [ [ 'lineinfo' ],
\ [ 'percent' ],
\ [ 'linter_errors' ],
\ [ 'fileformat', 'fileencoding', 'filetype', 'linter_ok', 'linter_warnings' ] ],
\ },
\ 'tabline': {
\ 'left': [ [ 'bufferinfo' ], [ 'bufferbefore', 'buffercurrent', 'bufferafter' ], ],
\ 'right': [ ],
\ },
\ 'component_expand': {
\ 'buffercurrent': 'lightline#buffer#buffercurrent2',
\ 'linter_warnings': 'LightlineLinterWarnings',
\ 'linter_errors': 'LightlineLinterErrors',
\ 'linter_ok': 'LightlineLinterOK'
\ },
\ 'component_type': {
\ 'buffercurrent': 'tabsel',
\ 'readonly': 'error',
\ 'linter_errors': 'error',
\ 'linter_warning': 'warning',
\ },
\ 'component_function': {
\ 'filename': 'LightlineFilename',
\ 'ctrlpmark': 'CtrlPMark',
\ 'bufferbefore': 'lightline#buffer#bufferbefore',
\ 'bufferafter': 'lightline#buffer#bufferafter',
\ 'bufferinfo': 'lightline#buffer#bufferinfo',
\ },
\ }
function! LightlineFilename()
let filename = expand('%:t') !=# '' ? expand('%:t') : '[No Name]'
let modified = &modified ? ' +' : ''
return filename . modified
endfunction
function! CtrlPMark()
if expand('%:t') =~ 'ControlP' && has_key(g:lightline, 'ctrlp_item')
call lightline#link('iR'[g:lightline.ctrlp_regex])
return lightline#concatenate([g:lightline.ctrlp_prev, g:lightline.ctrlp_item
\ , g:lightline.ctrlp_next], 0)
else
return ''
endif
endfunction
function! LightlineLinterWarnings() abort
let l:counts = ale#statusline#Count(bufnr(''))
let l:all_errors = l:counts.error + l:counts.style_error
let l:all_non_errors = l:counts.total - l:all_errors
return l:counts.total == 0 ? '' : printf('%d ', all_non_errors)
endfunction
function! LightlineLinterErrors() abort
let l:counts = ale#statusline#Count(bufnr(''))
let l:all_errors = l:counts.error + l:counts.style_error
let l:all_non_errors = l:counts.total - l:all_errors
return l:counts.total == 0 ? '' : printf('%d ', all_errors)
endfunction
function! LightlineLinterOK() abort
let l:counts = ale#statusline#Count(bufnr(''))
let l:all_errors = l:counts.error + l:counts.style_error
let l:all_non_errors = l:counts.total - l:all_errors
return l:counts.total == 0 ? '0 ' : ''
endfunction
autocmd User ALELint call s:MaybeUpdateLightline()
" Update and show lightline but only if it's visible (e.g., not in Goyo)
function! s:MaybeUpdateLightline()
if exists('#lightline')
call lightline#update()
end
endfunction
" Color scheme
colorscheme spacegray
" 16 millions colors
"set termguicolors
" Disable background
"hi Normal guibg=NONE ctermbg=NONE
let g:spacegray_underline_search = 1
"let g:spacegray_italicize_comments = 1
" Italic comments
highlight Comment cterm=italic
set t_ZH=
set t_ZR=

30
files/.xbindkeysrc Normal file
View File

@ -0,0 +1,30 @@
# backlight
"brightnessctl set +5%"
XF86MonBrightnessUp
"brightnessctl set 5%-"
XF86MonBrightnessDown
# volume
"amixer sset Master toggle"
XF86AudioMute
"amixer sset Master unmute 5%+"
XF86AudioRaiseVolume
"amixer sset Master unmute 5%-"
XF86AudioLowerVolume
# printscreen
"sshot --pin"
Shift + Print
"sshot --partial"
Control + Print
"sshot --window"
Alt + Print
"sshot"
Print

3
files/.xinitrc Normal file
View File

@ -0,0 +1,3 @@
[ -f ~/.xprofile ] && source ~/.xprofile
exec i3

29
files/.xprofile Normal file
View File

@ -0,0 +1,29 @@
systemctl --user import-environment DISPLAY
# screen layout
if xrandr | grep 'HDMI-1 connected'; then
xrandr \
--output HDMI-1 --auto --pos 1080x420 --primary \
--output HDMI-2 --rotate right --auto --pos 0x0
fi
export PRIMARY_MONITOR="$(xrandr | grep 'primary' | grep -Eo '^[^ ]+')"
# lockscreen
xss-lock -- lock &
# key binding
[ -f ~/.xbindkeysrc ] && xbindkeys
[ -f ~/.Xmodmap ] && xmodmap ~/.Xmodmap
# xrdb
[ -f ~/.Xresources ] && xrdb -I"$HOME" ~/.Xresources
# wallpaper and colorschemes
sh ~/.fehbg || \
feh --bg-fill --no-fehbg /usr/share/pixmaps/wallpaper.png
# set screen blanking to 30 minutes
xset s 1800 1800
source ~/.local/profile.d/*

3
files/.zprofile Normal file
View File

@ -0,0 +1,3 @@
emulate sh
. ~/.profile
emulate zsh

92
files/.zshrc Normal file
View File

@ -0,0 +1,92 @@
# Autostart Xorg if we are on tty1
if [ -z "$DISPLAY" ] && [ "$(tty)" = "/dev/tty1" ]; then
exec startx
fi
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="$HOME/.config/zsh/oh-my-zsh/"
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="noglyph"
# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"
# Uncomment the following line to use hyphen-insensitive completion. Case
# sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"
# Uncomment the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true"
# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13
# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"
# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"
# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"
# Uncomment the following line to display red dots whilst waiting for completion.
# COMPLETION_WAITING_DOTS="true"
# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"
# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# HIST_STAMPS="mm/dd/yyyy"
# Would you like to use another custom folder than $ZSH/custom?
ZSH_CUSTOM="$HOME/.config/zsh/custom/"
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git archlinux tmux thefuck zsh-syntax-highlighting zsh-autosuggestions)
source $ZSH/oh-my-zsh.sh
# User configuration
# export MANPATH="/usr/local/man:$MANPATH"
# You may need to manually set your language environment
# export LANG=en_US.UTF-8
# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
# export EDITOR='vim'
# else
# export EDITOR='mvim'
# fi
# Compilation flags
# export ARCHFLAGS="-arch x86_64"
# ssh
# export SSH_KEY_PATH="~/.ssh/rsa_id"
# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
#

170
install.sh Executable file
View File

@ -0,0 +1,170 @@
#!/bin/bash
log() {
printf '[%s] %s\n' "$1" "$2"
}
print_help() {
cat <<EOF
Install the dotfiles.
USAGE
install.sh [OPTIONS]
OPTIONS
-h, --help Display this help message.
--symlink Symlink the files. This is the default behavior.
--copy Copy the files.
--noscript Skip the post-install script
EOF
}
# Filter dir to keep only the lowest in the tree
# format to be readable by find
# assume reverse sorted
filter_path() {
# the first occurence is not prefixed
prefix=
previous_dir=
printf "("
while IFS= read -r dir; do
if [[ -z "$previous_dir" || "$dir" != "$previous_dir"* ]]; then
printf -- "%s -path %s " "$prefix" "${dir%/}"
previous_dir="$dir"
prefix="-o"
fi
done
printf ")"
}
# List all the files in path, except if it find a file name .@dir
get_path() {
pushd "$1" >/dev/null
shopt -s dotglob
[[ "$(find . -mindepth 1 -maxdepth 1 | wc -c)" -eq 0 ]] && return
# find dirs .@dir files
find_dir_args="$(find * -mindepth 1 -name '.@dir' -type f -empty -printf "%h\n" | sort -r | filter_path)"
# find files and exclude paths that containe a .@dir
if [[ $find_dir_args = "()" ]]; then
find * ! -type d
else
find * -type d $find_dir_args -prune -o ! -type d
fi
shopt -u dotglob
popd >/dev/null
}
# Link the dotfile
make_link() {
repo_f="$1"
home_f="$HOME/$2"
if [[ -L "$home_f" || -e "$home_f" ]]; then
# Check if it's already symlinked
if [[ ! "$OPT_COPY" && -L "$home_f" && "$(readlink -- "$home_f")" ]]; then
return;
fi
# File exists, ask to delete
if [[ "$OPT_YES" ]]; then
rm -rf $home_f
else
while true; do
read -r -p "Override $2? [Y/n] " a
if [[ "${a,,}" = "y" ]]; then
rm -r $home_f
break
elif [[ "${a,,}" = "n" ]]; then
echo "skipping..."
return
fi
done
fi
fi
mkdir -p "$(dirname $home_f)" &>/dev/null
if [[ -n "$OPT_COPY" ]]; then
log + "Creating copy $repo_f > $home_f"
cp -r $repo_f $home_f
else
log + "Creating symlink $repo_f > $home_f"
ln -s $repo_f $home_f
fi
}
post_install() {
# install vim plugins
vim -E +"call dein#update()" +"qall!" /dev/null &>/dev/null
}
short_args=hy
long_args=help,yes,symlink,copy,noscript
# Parse arguments
parsed_args=$(getopt --options $short_args --longoptions $long_args --name "$0" -- "$@")
if [[ $? -ne 0 ]]; then
echo "Failed to parse arguments"
exit 2
fi
eval set -- "$parsed_args"
while true; do
case "$1" in
-h|--help)
print_help
exit
;;
-y|--yes)
OPT_YES="--yes"
OPT_NOCONFIRM="--noconfirm"
shift
;;
--symlink)
OPT_SYMLINK=true
shift
;;
--copy)
OPT_COPY=true
shift
;;
--noscript)
OPT_NOSCRIPT=true
shift
;;
--)
shift
break
;;
*)
break
;;
esac
done
if [[ "$OPT_SYMLINK" && "$OPT_COPY" ]]; then
log E "Cannot use --symlink and --copy at the same time!"
exit 1
fi
pushd "${0%/*}" >/dev/null
for file_source in "files"; do
log "*" "Processing $file_source"
for file_path in $(get_path "$file_source"); do
make_link "$PWD/$file_source/$file_path" "$file_path"
done
done
if [[ -z "$OPT_NOSCRIPT" ]]; then
log "*" "Running post-install"
post_install
fi
popd >/dev/null