commit 417daecfe755e157554d8c78ff3f21f193c18b2d Author: M1dgard Date: Tue Apr 3 15:55:41 2018 +0200 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5554b4d --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +nvim/plug +nvim/**/.* diff --git a/README.md b/README.md new file mode 100644 index 0000000..4d6b47d --- /dev/null +++ b/README.md @@ -0,0 +1,37 @@ +# Midgard's dotfiles + +Configuration based on elegant pure black. + +## Screenshots + +![Empty desktop](./desktop.png) +![Open Rofi launcher](./rofi.png) + +Background image shown: +* original by [Charlesjsharp](https://commons.wikimedia.org/wiki/User:Charlesjsharp): [Red-billed streamertail (Trochilus polytmus) female in flight 2](https://commons.wikimedia.org/wiki/File:Red-billed_streamertail_(Trochilus_polytmus)_female_in_flight_2.JPG). Licensed under [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/deed.en) +* modified by Midgard: darkened and made more green. Licensed under [CC0](https://creativecommons.org/publicdomain/zero/1.0/) (which means you only have to credit Charlesjsharp and mention that it was modified, you don't have to attribute it to me) + +## Requirements + +The Arch Linux package to install is between parentheses. + +* i3-gaps ([community/i3-gaps](https://www.archlinux.org/packages/community/x86_64/i3-gaps/)) +* Rofi ([community/rofi](https://www.archlinux.org/packages/community/x86_64/rofi/)) +* Polybar ([aur/polybar](https://aur.archlinux.org/packages/polybar)) +* python-notify2 ([aur/python-notify2](https://aur.archlinux.org/packages/python-notify2/)) +* Mozilla's Fira fonts ([community/otf-fira-mono](https://www.archlinux.org/packages/community/x86_64/otf-fira-mono/) and [community/otf-fira-sans](https://www.archlinux.org/packages/community/x86_64/otf-fira-sans/)). I might change this soon if I play with some patched Fira derivates +* xfce4-terminal ([extra/xfce4-terminal](https://www.archlinux.org/packages/extra/x86_64/xfce4-terminal/), but you can choose your own terminal of course if you want) +* NeoVim ([community/neovim](https://www.archlinux.org/packages/community/x86_64/neovim/)) +* acpilight ([aur/acpilight](https://aur.archlinux.org/packages/acpilight/), an xbacklight replacement that directly uses the kernel's API, works without X) +* unclutter ([community/unclutter](https://www.archlinux.org/packages/community/x86_64/unclutter/), hide the mouse when it hasn't moved for some time) +* driver for your video card that supports GLX + +## Installation + +You are encouraged to copy stuff you like to your own configuration files. If you want to copy my setup, you can use the script `install.sh` (that script is normally mostly for myself though). + +## TODO + +* Document more about how to get NeoVim and the plugins up and running. +* Expand and test the install script. +* Add my improved battery monitor script. diff --git a/desktop.png b/desktop.png new file mode 100644 index 0000000..db0629e Binary files /dev/null and b/desktop.png differ diff --git a/dunstrc.ini b/dunstrc.ini new file mode 100644 index 0000000..f2b2ec4 --- /dev/null +++ b/dunstrc.ini @@ -0,0 +1,327 @@ +[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 + follow = keyboard + + # 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 = "400x5-20+47" + + # 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 = 5 + + # 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 = 10 + + # Padding between text and separator. + padding = 10 + + # Horizontal padding. + horizontal_padding = 10 + + # Defines width in pixels of frame around the notification window. + # Set to 0 to disable. + frame_width = 0 + + # Defines color of the frame around the notification window. + frame_color = "#aaaaaa" + + # Draw a line of "separator_height" pixel height between two + # notifications. + # Set to 0 to disable. + separator_height = 0 + + # 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 = 30s + + ### Text ### + + font = Fira Sans 12 + + # 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: + # bold + # italic + # strikethrough + # underline + # + # For a complete reference see + # . + # + # 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 = %a %p\n\n%s\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 = 10 + + # 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 = right + + # 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/breeze-dark/32x32/status/:/usr/share/icons/breeze-dark/32x32/devices/:/usr/share/icons/Adwaita/32x32/status/:/usr/share/icons/Adwaita/32x32/devices/:/usr/share/icons/gnome/32x32/status/:/usr/share/icons/gnome/32x32/devices/ + + ### 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 = 100 + + ### Misc/Advanced ### + + # dmenu path. + dmenu = /usr/bin/rofi -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 = mod4+n + + # Close all notifications. + close_all = mod4+shift+n + + # 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 = mod4+Tab + + # Context menu. + context = mod4+shift+Tab + +[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 diff --git a/gitignore b/gitignore new file mode 100644 index 0000000..50f48ed --- /dev/null +++ b/gitignore @@ -0,0 +1,155 @@ +## Backup files +# Author: Midgard + +*.bak +*~ + + +## Things you just don't want in a Git repo +# Author: Midgard + +*.tar.xz +*.tar.gz +*.tar.bz2 +*.zip +*.7z +*.rar +id_rsa +id_dsa +id_ecdsa +id_ed25519 + + +## GPG files +# Source: https://github.com/github/gitignore/blob/master/Global/GPG.gitignore +# License: CC-0 + +secring.* + + +## KDevelop4 files +# Source: https://github.com/github/gitignore/blob/master/Global/KDevelop4.gitignore +# License: CC-0 + +*.kdev4 +.kdev4/ + + +## LibreOffice files +# Source: https://github.com/github/gitignore/blob/master/Global/LibreOffice.gitignore +# License: CC-0 + +# LibreOffice locks +.~lock.*# + + +## VirtualEnv files +# Source: https://github.com/github/gitignore/blob/master/Global/VirtualEnv.gitignore +# Which has source: http://iamzed.com/2009/05/07/a-primer-on-virtualenv/ +# License: CC-0 + +.Python +[Bb]in +#[Ii]nclude +#[Ll]ib +[Ll]ib64 +#[Ll]ocal +#[Ss]cripts +pyvenv.cfg +.venv +pip-selfcheck.json + + +## Vim files +# Source: https://github.com/github/gitignore/blob/master/Global/Vim.gitignore +# License: CC-0 + +# Swap +[._]*.s[a-v][a-z] +[._]*.sw[a-p] +[._]s[a-v][a-z] +[._]sw[a-p] + +# Session +Session.vim + +# Temporary +.netrwhist +*~ +# Auto-generated tag files +tags + + +## Eclipse and Aptana files +# Cut from: https://github.com/github/gitignore/blob/master/Global/Eclipse.gitignore +# License: CC0 + +#.metadata +bin/ +tmp/ +*.tmp +*.bak +*.swp +*~.nib +local.properties +.settings/ +.loadpath +.recommenders + +# External tool builders +.externalToolBuilders/ + +# Locally stored "Eclipse launch configurations" +*.launch + +# PyDev specific (Python IDE for Eclipse) +*.pydevproject + +# CDT-specific (C/C++ Development Tooling) +.cproject + +# Java annotation processor (APT) +.factorypath + +# PDT-specific (PHP Development Tools) +.buildpath + +# STS (Spring Tool Suite) +.springBeans + +# Code Recommenders +.recommenders/ + +# Scala IDE specific (Scala & Java development for Eclipse) +.cache-main +.scala_dependencies +.worksheet + + + +## Kate files +# Source: https://github.com/github/gitignore/blob/master/Global/Kate.gitignore +# License: CC-0 + +# Swap Files +.*.kate-swp +.swp.* + + +## Linux files +# Source: https://github.com/github/gitignore/blob/master/Global/Linux.gitignore +# License: CC-0 + +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* diff --git a/i3/backlight.sh b/i3/backlight.sh new file mode 100755 index 0000000..8693161 --- /dev/null +++ b/i3/backlight.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +# Don't start a new transition if the previous one isn't done yet +pgrep -u $UID -x xbacklight >/dev/null && exit + +# Calculate new target brightness +current_brightness=$(xbacklight -get) +case $1 in + up) + target=$((current_brightness * 15 / 10)) + [ $target -ne $current_brightness ] || target=$((target + 1)) + ;; + down) + target=$((current_brightness * 10 / 15)) + [ $target -ne $current_brightness ] || target=$((target - 1)) + ;; +esac + +# Boundaries: can't go higher than 100% or lower than 1% +[ $target -le 1 ] && target=1 +[ $target -ge 100 ] && target=100 + +# Smoothly set the new brightness +xbacklight -time 100 -fps 42 -set $target diff --git a/i3/battery.sh b/i3/battery.sh new file mode 100755 index 0000000..8421e75 --- /dev/null +++ b/i3/battery.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +level_critical=5 +level_low=10 +level_low_max_backlight=8 + +notif(){ + notify-send -a "Battery" "$@" +} + +lower_backlight() { + [ $(xbacklight -get) -le $level_low_max_backlight ] || xbacklight -set $(level_low_max_backlight) +} + +while true; do + now=$(cat /sys/class/power_supply/BAT0/energy_now 2>/dev/null) + full=$(cat /sys/class/power_supply/BAT0/energy_full 2>/dev/null) + + if [ ! -z $now ] && [ ! -z $full ]; then + percentage=$(( 100 * now / full )) + echo "Current level: $percentage" + + if [[ "$(cat /sys/class/power_supply/BAT0/status 2>/dev/null)" != "Charging" ]]; then + if [ $percentage -lt $level_critical ]; then + notif -u "critical" "Power level critical" "Less than $percentage% remaining." + lower_backlight + elif [ $percentage -lt $level_low ]; then + notif -t 59000 -u "critical" "Power supplies running low" "Less than $percentage% remaining." + lower_backlight + fi + else + if [ $percentage -ge 98 ]; then + notif -t 10000 -u low "Fully charged" "Unplug charger." + fi + fi + fi + sleep '1m' +done diff --git a/i3/config b/i3/config new file mode 100644 index 0000000..14261f0 --- /dev/null +++ b/i3/config @@ -0,0 +1,256 @@ +# i3 config file (v4) +# See http://i3wm.org/docs/userguide.html for a complete reference + +set $term $HOME/.config/i3/terminal.sh +set $barlaunchcmd $HOME/.config/polybar/launch.sh + +######################## +# i3 basic preferences # {{{1 +######################## + +# font for window titles +font pango:Fira Sans 9 + +# modifier key: Super (swapped below, so effective key is Alt) +set $mod Mod4 + +# use Mouse+$mod to drag floating windows to their wanted position +floating_modifier $mod + +# resize window +mode "resize" { + bindsym h resize shrink width 10 px or 10 ppt + bindsym j resize grow height 10 px or 10 ppt + bindsym k resize shrink height 10 px or 10 ppt + bindsym l resize grow width 10 px or 10 ppt + + bindsym Shift+h resize shrink width 30 px or 30 ppt + bindsym Shift+j resize grow height 30 px or 30 ppt + bindsym Shift+k resize shrink height 30 px or 30 ppt + bindsym Shift+l resize grow width 30 px or 30 ppt + + # back to normal: Enter, Escape or mod+r + bindsym Return mode "default" + bindsym KP_Enter mode "default" + bindsym Escape mode "default" + bindsym $mod+r mode "default" +} + +bindsym $mod+r mode "resize" + +# mouse following breaks keyboard window switching between terminals when the terminal tries to hide the mouse when you start typing, or something +# also, it's annoying to lose focus on your window when you move the mouse slightly +focus_follows_mouse no + +# gaps when more than one window is open on a workspace +for_window [class="^.*"] border pixel 0 +gaps inner 10 +smart_gaps on + + +############ +# Keyboard # {{{1 +############ + +# Belgian layout, swap Alt and Super, set caps lock as compose key ♥ +exec_always --no-startup-id setxkbmap \ + -layout be \ + -option altwin:swap_lalt_lwin \ + -option compose:caps + +# enable NumLock +exec_always --no-startup-id numlockx on + + +################ +# Applications # {{{1 +################ + +# program launcher +set $launcher rofi -show combi -display-combi $USER@$(cat /etc/hostname) +bindsym $mod+space exec --no-startup-id "$launcher" +#bindsym $mod+Shift+space exec --no-startup-id rofi -show window + +# open launcher when launching i3 +exec --no-startup-id $launcher + +# lock the screen +bindsym Mod1+l exec --no-startup-id i3lock --image="$HOME/Pictures/background/Red-billed_streamertail_Trochilus_polytmus_female_in_flight_2_lock.png" + +# start a terminal +bindsym $mod+Return exec $term +bindsym $mod+KP_Enter exec $term + +# start web browser +set $browser TZ=UTC firefox +bindsym XF86HomePage exec $browser + +# open file manager +set $filemanager thunar +bindsym XF86MyComputer exec $filemanager + +# change display layout +bindsym XF86Display exec arandr + + +############################# +# Keyboard function buttons # {{{1 +############################# + +set $volumeStep 5 +bindsym XF86AudioLowerVolume exec --no-startup-id pamixer -d $volumeStep +bindsym XF86AudioRaiseVolume exec --no-startup-id pamixer -i $volumeStep +bindsym XF86AudioMute exec --no-startup-id pamixer -t +bindsym XF86AudioMicMute exec --no-startup-id pamixer --source alsa_input.pci-0000_00_1b.0.analog-stereo -t + +bindsym XF86MonBrightnessDown exec --no-startup-id $HOME/.config/i3/backlight.sh down +bindsym XF86MonBrightnessUp exec --no-startup-id $HOME/.config/i3/backlight.sh up + +bindsym XF86PowerOff exec sudo shutdown -h now +bindsym XF86Sleep exec sudo zzz + +bindsym $mod+Print exec --no-startup-id scrot +bindsym $mod+Shift+Print exec --no-startup-id scrot -s + + +# Window stuff {{{2 + +# kill focused window +bindsym $mod+Shift+q kill + +# change focus +bindsym $mod+h focus left +bindsym $mod+j focus down +bindsym $mod+k focus up +bindsym $mod+l 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+h move left +bindsym $mod+Shift+j move down +bindsym $mod+Shift+k move up +bindsym $mod+Shift+l 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+m split h + +# split in vertical orientation +bindsym $mod+v split v + +# enter fullscreen mode for the focused container +bindsym $mod+f fullscreen toggle + +# change container layout +#bindsym $mod+s layout stacking +bindsym $mod+z layout tabbed +bindsym $mod+e layout toggle split + +# toggle tiling / floating +bindsym $mod+Shift+d floating toggle + +# change focus between tiling / floating windows +bindsym $mod+d focus mode_toggle + +# focus the parent container +bindsym $mod+a focus parent + +# focus the child container +#bindsym $mod+d focus child + + +# More window manager stuff {{{2 + +# reload the configuration file and restart the bar +bindsym $mod+Shift+c reload, exec $barlaunchcmd +# restart i3 inplace (preserves layout/session, can be used to upgrade i3) +bindsym $mod+Shift+r restart +# exit i3 +bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'Quit i3?' -b 'Yes' 'i3-msg exit'" +#bindsym $mod+Shift+e exec "i3-msg exit" + +bindsym $mod+p exec "sleep 8; notify-send -u critical -a Tasks \\"Urgent reminder\\" \\"You've got to leave now!\\"" + + + +# Workspace stuff {{{2 + +# 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+parenright workspace 11 +# this goes up to eleven! + +# 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 +bindsym $mod+Shift+degree move container to workspace 11 + + +# Monitor stuff {{{2 + +bindsym $mod+x move workspace to output right + + +# Start i3bar to display a workspace bar (plus the system information i3status +# finds out, if available) +#bar { + #status_command python /usr/lib/python3.6/site-packages/powerline/bindings/i3/powerline-i3.py + #font pango:PowerlineFont 12 + + ##status_command i3status + #position top +#} + +# launch Polybar, a nicer bar +exec_always --no-startup-id $barlaunchcmd + +exec --no-startup-id nm-applet + +# hide the mouse after some time +exec --no-startup-id unclutter -idle 2 + +# battery monitor script +exec --no-startup-id $HOME/Programs/own/battery/monitor.py + +# set background +exec_always --no-startup-id feh --bg-fill $HOME/Pictures/background/Red-billed_streamertail_Trochilus_polytmus_female_in_flight_2_modified_colours.jpg + +exec_always --no-startup-id notify-send -t 1500 -a 'i3' "i3 started" + + +################## +# Specific rules # {{{1 +################## + +for_window [class="Tor Browser"] floating enable +for_window [class="org-openstreetmap-josm-gui-MainApplication" instance="sun-awt-X11-XDialogPeer"] floating disable + + +# vim: set ft=i3 noet foldmethod=marker : diff --git a/i3/terminal.sh b/i3/terminal.sh new file mode 100755 index 0000000..4faa2a6 --- /dev/null +++ b/i3/terminal.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# If a window with a path in its title is focused, open a terminal with that location as working directory. +# Like this, terminals are opened in the same directory as the currently focused one, if no command is running. +# This is very hackish, but it works. + +if [[ $(xtitle) =~ (^| )(~?)(/.*) ]]; then + path="${BASH_REMATCH[3]}" + [[ ${BASH_REMATCH[2]} == "~" ]] && path="$HOME$path" + + while [[ $path != / && -n $path && ! -d $path ]]; do + path="$(dirname "$path")" + done +fi + +# Open terminal at specified path +cmd=i3-sensible-terminal +if [[ -n $path ]]; then + exec $cmd --default-working-directory="$path" +else + exec $cmd +fi diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..beee587 --- /dev/null +++ b/install.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +GUI=true +[[ $1 == --no-x ]] && GUI=false + +# shorthand for the default $XDG_CONFIG_HOME directory +DOT_CONF=$HOME/.config +mkdir -p $DOT_CONF + +# stuff that we only want when we're setting up a graphical environment +[[ $GUI == true ]] && { + ln -s $PWD/xinitrc $HOME/.xinitrc + + mkdir -p $DOT_CONF/dunst + ln -s $PWD/i3/ $DOT_CONF/i3/ + ln -s $PWD/dunstrc.ini $DOT_CONF/dunst/dunstrc + ln -s $PWD/rofi/ $DOT_CONF/rofi/ + ln -s $PWD/polybar/ $DOT_CONF/polybar/ +} + +ln -s $PWD/gitignore $DOT_CONF/.gitignore +mkdir -p $DOT_CONF/nvim/plug/ +ln -s $PWD/nvim-init.vim $DOT_CONF/nvim/init.vim diff --git a/nvim-init.vim b/nvim-init.vim new file mode 100644 index 0000000..6598afd --- /dev/null +++ b/nvim-init.vim @@ -0,0 +1,449 @@ +" General Options {{{1 +" ==================== +set nocompatible " ignored in NeoVim, tells Vim to break compatibility with vi + +let mapleader=';' " set + +syntax enable + +set mouse=a " enable mouse selection +set number " line numbers on the left side +set relativenumber " number+relativenumber = relative numbers for all but current line +set showcmd " show the commands while typing +set splitright " open new splits on the right +set splitbelow " open new splits below +set autoread " autoreload file on change +set scrolloff=4 " keep the cursor 4 lines away from the top/bottom +set ruler " show the lines/% bottomright +set encoding=utf-8 " set default encoding +set laststatus=2 " always show the status line + +set conceallevel=0 " don't use conceals, seriously +let g:tex_conceal='' " I said no conceals + +" toggle hybrid relative numbers when entering/leaving insert mode +":augroup numbertoggle +": autocmd! +": autocmd InsertLeave * set relativenumber +": autocmd InsertEnter * set norelativenumber +":augroup END + +" change cursor shape according to mode +:let $NVIM_TUI_ENABLE_CURSOR_SHAPE=1 + +set shell=/bin/zsh " use zsh instead of bash + +" wrap lines at 72 characters +"set formatprg=par\ -w72 +"set formatoptions=tcrqnlmj +"set textwidth=72 + +set ignorecase smartcase " don't match case if typing in all-lowercase + +" ignore motion for < > +nnoremap < << +nnoremap > >> +" make < > shifts keep selection +vnoremap < >gv + +inoremap  dbxa + +" Switching buffers {{{2 +nnoremap :bprev " s-F2 +nnoremap :bnext " s-F3 +nnoremap :bwipeout " s-F4 + +" Indentation {{{2 +set tabstop=2 " tab is 2 wide +set shiftwidth=2 " for use with > and < +set noexpandtab " tab key puts tabs +"set list listchars=tab:‧\ ,trail:· " display tabs with a leading \cdot. Alternatives: \mapsto ↦, U+16EB runic single punctuation ᛫ + " trailing whitespace looks like \cdot +set list listchars=tab:¦\ ,trail:· " show indentation lines for tabs, trailing whitespace looks like \cdot + +" Misc {{{2 + +set foldlevelstart=3 " Not too much folding + +" Escape from NeoVim terminals +tnoremap +" Just hit the [à0] button on an AZERTY, no need to do shift+à to for 0 +nnoremap à 0 +inoremap jj +" Clear highlighting after a search +nnoremap n :noh + +" Open a file in the current directory +nmap e :e =expand("%:p:h") . "/" + +" sudo save +command W :execute ':silent w !sudo tee % > /dev/null' | :edit! + +" Navigate to bookmark, AZERTY has no backtick key +noremap m ` + +" Consistent aliases to jump to first non-whitespace character and last character +noremap ^ +noremap $ +inoremap ^i +inoremap $a +noremap ^ +inoremap ^i + + +" System clipboard {{{2 +" Copy to clipboard " Paste from clipboard +vnoremap y "+y | nnoremap p "+p +nnoremap Y "+yg_ | nnoremap P "+P +nnoremap y "+y | vnoremap p "+p +nnoremap yy "+yy | vnoremap P "+P + +" Opening windows {{{2 +nnoremap n +nmap N +nnoremap v +nmap V + +imap +vmap + +nnoremap v :vnew +nnoremap V :let spr=&sprset nosprvnewlet &spr=spr +nnoremap N :let spr=&sprset nosprnewlet &spr=spr + +" Cool arrows {{{2 +inoremap arse ↘ +inoremap arsw ↙ +inoremap arne ↗ +inoremap arnw ↖ + +" Default visual block {{{2 +nnoremap v +nnoremap v + +" Color settings {{{2 +" Decent color schemes: ron, delek, peachpuff, slate, murphy, elflord, desert +source /usr/share/nvim/runtime/colors/ron.vim +highlight LineNr ctermfg=08 ctermbg=None +highlight link Whitespace Conceal + +" Adding modeline {{{2 +" Append modeline after last line in buffer. +" Use substitute() instead of printf() to handle '%%s' modeline in LaTeX +" files. +function! AppendModeline() + let l:modeline = printf(" vim: set ts=%d sw=%d tw=%d %set :", + \ &tabstop, &shiftwidth, &textwidth, &expandtab ? '' : 'no') + let l:modeline = substitute(&commentstring, "%s", l:modeline, "") + call append(line("$"), l:modeline) +endfunction +nnoremap ml :call AppendModeline() + + +" Plugins {{{1 +" ============ + +" Plug {{{2 +" ------------ +call plug#begin('~/.config/nvim/plug') + +" Colors +"Plug 'chriskempson/base16-vim' + +" Language support + Plug 'sheerun/vim-polyglot' " color, indentation support for 100+ languages + Plug 'chrisbra/csv.vim', { 'for': 'csv' } " CSV files +"Plug 'neovimhaskell/haskell-vim', { 'for': 'haskell' } " included in vim-polyglot +"Plug 'LaTeX-Box-Team/LaTeX-Box', { 'for': 'tex' } " included in vim-polyglot +"Plug 'rust-lang/rust.vim', { 'for': 'rust' } " included in vim-polyglot + +" C/C++ +"Plug 'vim-scripts/c.vim', { 'for': ['c', 'cpp', 'objc'] } " various IDE-like C features + Plug 'vim-scripts/DoxygenToolkit.vim', { 'for': ['c', 'cpp', 'python'] } " simplify Doxygen documentation in C, C++, Python +"Plug 'derekwyatt/vim-fswitch', { 'for': ['c', 'cpp', 'objc'] } " switch between companion source files (e.g. .h and .cpp) + Plug 'derekwyatt/vim-fswitch', { 'on': 'FSRight' } " switch between companion source files (e.g. .h and .cpp) +"Plug 'derekwyatt/vim-protodef', { 'for': ['c', 'cpp', 'objc'] } " pull in C++ function prototypes into implementation files + Plug 'vim-scripts/Conque-GDB', { 'for': ['c', 'cpp', 'objc'] } " GDB command line interface and terminal emulator +"Plug 'Shougo/vimproc.vim', { 'do': 'make' } " dependency of vim-vebugger, asynchronous execution library +"Plug 'idanarye/vim-vebugger', { 'for': ['c', 'cpp', 'objc', 'java', 'python', 'ruby'] } " debugger frontend for GDB, LDB, PDB, RDebug e.a. + +" Edit +"Plug 'jiangmiao/auto-pairs' " insert or delete [], (), '' etc. in pairs + Plug 'sjl/gundo.vim' " visualise your undo tree + Plug 'scrooloose/nerdcommenter' " intensely orgasmic commenting + Plug 'SirVer/ultisnips' " ultimate snippet solution + Plug 'fadein/vim-FIGlet', { 'on': 'FIGlet' } " ASCII art + Plug 'honza/vim-snippets' " snippets for ultisnips + Plug 'junegunn/vim-easy-align' " easily align text in Alexander Approved™ ways + Plug 'matze/vim-move' " move lines and selections up and down + Plug 'kana/vim-operator-user' " define your own operator easily +"Plug 'junegunn/vim-peekaboo' " preview registers when pressing \" or @ + Plug 'gcmt/wildfire.vim' " smart selection of the closest text object + Plug 'Valloric/YouCompleteMe', { 'do': 'git submodule update --init --recursive && ./install.py' } " code-completion engine + +" Navigation +"Plug 'ctrlpvim/ctrlp.vim' " fuzzy file, buffer, mru, tag, etc. finder + Plug 'dyng/ctrlsf.vim' " search for code and edit it in-place + Plug 'Yggdroot/indentLine' " display the indention levels with thin vertical lines + Plug 'scrooloose/nerdtree' " filesystem tree explorer + Plug 'majutsushi/tagbar' " display tags in a window, ordered by scope + Plug 'easymotion/vim-easymotion' " quickly jump to any location on the screen + Plug 'airblade/vim-gitgutter' " show a Git diff in the gutter, stage/undo hunks + Plug 'mhinz/vim-grepper', { 'on': 'Grepper' } " asynchronous git grep search +"Plug 'ludovicchabant/vim-gutentags' " unobtrusively manage tag files + Plug 'tpope/vim-obsession' " continuously updated session files + +" Powerline + Plug 'vim-airline/vim-airline' " statusline plugin in pure Vimscript + Plug 'vim-airline/vim-airline-themes' " themes for airline + + +" Analysis + Plug 'w0rp/ale' " asynchronous linting engine +"Plug 'dbmrq/vim-ditto' " highlight overused words + +" Misc + Plug 'kassio/neoterm', { 'on': 'T' } " wrapper of some neovim's :terminal functions +"Plug 'tpope/vim-fugitive' " a Git wrapper + Plug 'vim-scripts/TeTrIs.vim' " Tetris clone + +call plug#end()" + + +" Haskell {{{2 +" ------------ +let g:haskell_enable_quantification=1 +let g:haskell_enable_recursivedo=1 +let g:haskell_enable_arrowsyntax=1 +let g:haskell_enable_pattern_synonyms=1 +let g:haskell_enable_typeroles=1 +let g:haskell_enable_static_pointers=1 + +" Markdown {{{2 +" ------------- +let g:vim_markdown_conceal = 0 + +" CSV.vim {{{2 +" ------------ + +" Doxygen {{{2 +" ------------ +nnoremap df :Dox +nnoremap dl :DoxLic +nnoremap da :DoxAuthor +let g:DoxygenToolkit_authorName="Midgard" + +" FSwitch {{{2 +" ------------ +let b:fswitchdst = '' +au! BufEnter *.cpp let b:fswitchdst = 'hpp,h' | let b:fswitchlocs = '.' +au! BufEnter *.hpp let b:fswitchdst = 'cpp' | let b:fswitchlocs = '.' +au! BufEnter *.c let b:fswitchdst = 'h' | let b:fswitchlocs = '.' +au! BufEnter *.h let b:fswitchdst = 'c,cpp' | let b:fswitchlocs = '.' +nmap :FSRight + +" Protodef {{{2 +" ------------- +nnoremap ;def :call protodef#ReturnSkeletonsFromPrototypesForCurrentBuffer({}) + +" ConqueGDB {{{2 +" -------------- +let g:ConqueGdb_Leader = ',' +" Commented entries are the defaults +"let g:ConqueGdb_Run = g:ConqueGdb_Leader . 'r' +"let g:ConqueGdb_Continue = g:ConqueGdb_Leader . 'c' +let g:ConqueGdb_Next = g:ConqueGdb_Leader . 'o' " step over +let g:ConqueGdb_Step = g:ConqueGdb_Leader . 'i' " step in +"let g:ConqueGdb_Print = g:ConqueGdb_Leader . 'p' +"let g:ConqueGdb_ToggleBreak = g:ConqueGdb_Leader . 'b' +let g:ConqueGdb_Finish = g:ConqueGdb_Leader . 'O' " step out +"let g:ConqueGdb_Backtrace = g:ConqueGdb_Leader . 't' + +nnoremap :ConqueGdb --args build/tests --debug + +" Vebugger {{{2 +" ------------- +"let g:vebugger_leader='v' +" +"nnoremap :VBGstepOver +"nnoremap :VBGstepIn +"nnoremap :VBGstepOut +"nnoremap :VBGcontinue +"nnoremap :VBGstartGDB ./huffman + +" Auto-pairs {{{2 +" --------------- + +" Gundo {{{2 +" ---------- +nnoremap :GundoToggle + +" NERDCommenter {{{2 +" ------------------ +nmap & c +vmap & c + +" UltiSnips {{{2 +" --------------- +let g:UltiSnipsExpandTrigger='²' + +" EasyAlign {{{2 +" -------------- +xmap a (EasyAlign) +nmap a (EasyAlign) + +" Move (lines) {{{2 +" ----------------- + +" Operator user {{{2 +" ------------------ + +" Peekaboo {{{2 +" ------------- + +" Wildfire {{{2 +" ------------- + +" YouCompleteMe {{{2 +" ------------------ +noremap g :YcmCompleter GoToImprecise + +let g:ycm_error_symbol='!>' +let g:ycm_warning_symbol='-' +let g:ycm_enable_diagnostic_highlighting=0 +let g:ycm_complete_in_comments=1 + +let g:ycm_seed_identifiers_with_syntax=1 +let g:ycm_collect_identifiers_from_tags_files=1 +let g:ycm_add_preview_to_completeopt=1 +let g:ycm_autoclose_preview_window_after_insertion=1 + +let g:ycm_server_python_interpreter='/usr/bin/python3' +let g:ycm_global_ycm_extra_conf='~/.config/nvim/ycm_extra_conf.py' +let g:ycm_extra_conf_globlist = ['~/Nextcloud/*', '~/Documents/*','~/development/*','~/unief/*'] " ,'!~/*' +"let g:ycm_rust_src_path='/data/programming/rustc-1.7.0/src' +set completeopt=menu + +" CtrlP {{{2 +" ---------- +let g:ctrlp_map='l' +let g:ctrlp_user_command=['.git/', 'git --git-dir=%s/.git ls-files . -co --exclude-standard'] +nnoremap s :CtrlPTag" + +" Ctrl-S-F {{{2 +" ------------- + +" IndentLine {{{2 +" --------------- + +" NERDTree {{{2 +" ------------- +nnoremap t :NERDTreeToggle +let NERDTreeIgnore=[ + \ ".*\\.class$", + \ ".*\\.o$", + \ ".*\\.hi$", + \ ".*\\.pyc$", + \ ".*\\.bak$", + \ ".*\\~$" + \ ] + +" automatically open NERDTree when opening vi +"autocmd StdinReadPre * let s:std_in=1 +"autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif + +" Tagbar {{{2 +" ----------- +nnoremap o :Tagbar +let g:tagbar_autoclose=1 +let g:tagbar_autofocus=1 +let g:tagbar_sort=0 +let g:tagbar_compact=1 +let g:tagbar_iconchars=['▸', '▾'] +let g:tagbar_type_make={ + \ 'kinds': ['m:macros', 't:targets'] + \ } +let g:tagbar_type_rust={ + \ 'ctagstype': 'rust', + \ 'kinds': [ + \ 'n:modules', + \ 's:structs', + \ 'i:interfaces', + \ 'c:implementations', + \ 'f:functions', + \ 'g:enums', + \ 't:typedefs', + \ 'v:variables', + \ 'M:macros', + \ 'm:fields', + \ 'e:enumerators', + \ 'F:methods', + \ ] + \ } + +" EasyMotion {{{2 +" --------------- +let g:EasyMotion_do_mapping=0 +let g:EasyMotion_startofline=0 +map f (easymotion-s) +map j (easymotion-j) +map k (easymotion-k) +map w (easymotion-bd-w) +nmap w (easymotion-overwin-w) + +" GitGutter {{{2 +" -------------- + +" Grepper {{{2 +" ------------ +nnoremap G :Grepper +let g:grepper={ + \ 'tools': ['rg', 'git', 'grep'], + \ 'open': 1, + \ 'jump': 0, + \ } + +" Gutentags {{{2 +" -------------- +let g:gutentags_cache_dir = '~/.cache/gutentag' + +" Obsession {{{2 +" -------------- + +" Powerline {{{2 +" -------------- + +" Airline {{{2 +" ------------ +let g:airline_powerline_fonts=1 +let g:airline_theme='bubblegum' +let g:airline#extensions#ycm#enabled=1 +let g:airline#extensions#tabline#enabled=1 +let g:airline#extensions#ale#enabled=1 +let g:ale_linters = { +\ 'c': [], +\ 'cpp': [], +\} + +" Ale {{{2 +" -------- +let g:ale_lint_on_text_change='normal' +let g:ale_lint_on_insert_leave=1 +let g:ale_completion_delay='' +let g:ale_lint_delay=500 + +" Ditto {{{2 +" ---------- + +" Neoterm {{{2 +" ------------ + +" Fugitive {{{2 +" ------------- + +" TeTrIs {{{2 +" ----------- + +" vim: set foldmethod=marker foldlevel=1 et ts=2 sw=2 ft=vim nowrap : + diff --git a/polybar/config.ini b/polybar/config.ini new file mode 100644 index 0000000..9745be5 --- /dev/null +++ b/polybar/config.ini @@ -0,0 +1,400 @@ +;===================================================== +; +; To learn more about how to configure Polybar +; go to https://github.com/jaagr/polybar +; +; The README contains alot of information +; +;===================================================== + +[colors] +;background = ${xrdb:color0:#222} +background = #000 +background-alt = #444 +;foreground = ${xrdb:color7:#222} +foreground = #dfdfdf +foreground-alt = #555 +primary = #ffb52a +secondary = #e60053 +alert = #bd2c40 + +[bar/midbard] +;monitor = ${env:MONITOR:HDMI-1} +width = 100% +height = 27 +;offset-x = 1% +;offset-y = 1% +;radius = 6.0 +fixed-center = true + +background = ${colors.background} +foreground = ${colors.foreground} + +;line-size = 3 +;line-color = #f00 + +;border-size = 4 +;border-color = #00000000 + +padding-left = 0 +padding-right = 0 + +module-margin-left = 3 +module-margin-right = 3 + +font-0 = "Fira Sans:size=10;1" +font-1 = "Font Awesome 5 Free:size=10;1" + +font-2 = fixed:pixelsize=10;1 +font-3 = "Material Icons:pixelsize=14;3" +font-4 = "Fira Sans:size=12;1" +font-5 = "Fira Mono:size=10;1" +;font-3 = unifont:fontformat=truetype:size=8:antialias=false;0 +;font-4 = siji:pixelsize=10;1 + +;font-0 = "Tamsyn:pixelsize=12;0" +;font-1 = "Roboto:size=11:weight=bold;2" +;font-2 = "Noto Sans:size=11;1" + +modules-left = bspwm i3 xwindow +modules-center = date +modules-right = mpd volume battery temperature eth wlan + +tray-position = right +tray-padding = 2 +;tray-transparent = true +;tray-background = #0063ff + +;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 + +cursor-click = pointer +cursor-scroll = ns-resize + +[module/xwindow] +type = internal/xwindow +label = " %title:0:50:…%" +label-foreground = #777 + +[module/xkeyboard] +type = internal/xkeyboard +blacklist-0 = num lock + +format-prefix = " " +format-prefix-foreground = ${colors.foreground-alt} +format-prefix-underline = ${colors.secondary} + +label-layout = %layout% +label-layout-underline = ${colors.secondary} + +label-indicator-padding = 2 +label-indicator-margin = 1 +label-indicator-background = ${colors.secondary} +label-indicator-underline = ${colors.secondary} + +[module/filesystem] +type = internal/fs +interval = 25 + +mount-0 = / + +label-mounted = %{F#0a81f5}%mountpoint%%{F-}: %percentage_used%% +label-unmounted = %mountpoint% not mounted +label-unmounted-foreground = ${colors.foreground-alt} + +[module/bspwm] +type = internal/bspwm + +label-focused = %index% +label-focused-background = ${colors.background-alt} +label-focused-underline= ${colors.primary} +label-focused-padding = 2 + +label-occupied = %index% +label-occupied-padding = 2 + +label-urgent = %index%! +label-urgent-background = ${colors.alert} +label-urgent-padding = 2 + +label-empty = %index% +label-empty-foreground = ${colors.foreground-alt} +label-empty-padding = 2 + +[module/i3] +type = internal/i3 +format = +index-sort = true +wrapping-scroll = false + +; Only show workspaces on the same output as the bar +;pin-workspaces = true + +label-mode-padding = 2 +label-mode-foreground = #000 +label-mode-background = ${colors.primary} + +; focused = Active workspace on focused monitor +label-focused = " %index% " +label-focused-background = ${module/bspwm.label-focused-background} +label-focused-underline = ${module/bspwm.label-focused-underline} +label-focused-padding = ${module/bspwm.label-focused-padding} + +; unfocused = Inactive workspace on any monitor +label-unfocused = %index% +label-unfocused-padding = ${module/bspwm.label-occupied-padding} + +; visible = Active workspace on unfocused monitor +label-visible = %index% +label-visible-background = ${self.label-focused-background} +label-visible-underline = ${self.label-focused-underline} +label-visible-padding = ${self.label-focused-padding} + +; urgent = Workspace with urgency hint set +label-urgent = %index% +label-urgent-background = ${module/bspwm.label-urgent-background} +label-urgent-padding = ${module/bspwm.label-urgent-padding} + +[module/mpd] +type = internal/mpd +format-online = + +;icon-prev =  +;icon-stop =  +;icon-play =  +;icon-pause =  +;icon-next =  +icon-prev =  +icon-stop =  +icon-play =  +icon-pause =  +icon-next =  + +label-song-maxlen = 25 +label-song-ellipsis = true + +[module/xbacklight] +type = internal/xbacklight + +format =