diff --git a/git/gitconfig b/git/gitconfig index 44aaa63..ffb9b6f 100644 --- a/git/gitconfig +++ b/git/gitconfig @@ -2,6 +2,8 @@ name = Hannes Körber email = hannes.koerber@haktec.de signingkey = 0x078A167A8741BD30 +[github] + user = hakoerber [alias] untrack = "rm --cached" unstage = "reset HEAD" @@ -16,7 +18,9 @@ st = "status" br = "branch" rb = "rebase" - rbi = "rebase -i" + rbi = "rebase --interactive" + rbc = "rebase --continue" + rba = "rebase --abort" df = "diff" gr = "! git graph" @@ -36,11 +40,17 @@ intercommit = !bash -c 'interdiff <(git show $1) <(git show $2) | less -FRS' - + drop = !git rebase --onto $1^ -- + [core] - whitespace = "" - excludesfile = "~/.gitignore_global" + fileMode = true + whitespace = "blank-at-eol,space-before-tab,blank-at-eof" + ; excludesfile = "~/.gitignore_global" + abbrev = 8 [color] ui = true +[column] + ui = auto [push] default = simple [merge] @@ -49,15 +59,29 @@ auto = 0 [advice] pushNonFastForward = false + pushUpdateRejected = false statusHints = false commitBeforeMerge = false + detachedHead = false [commit] gpgSign = true + cleanup = default + status = true [status] relativePaths = false + submoduleSummary = true [pager] log = less show = less diff = less [gpg] program = gpg2 +[rebase] + autoSquash = true +[diff] + submodule = log + mnemonicPrefix = true +[branch] + autoSetupMerge = true +[clean] + requireForce = true diff --git a/git/gitignore_global b/git/gitignore_global deleted file mode 100644 index 5948fb9..0000000 --- a/git/gitignore_global +++ /dev/null @@ -1,81 +0,0 @@ -# http://github.com/github/gitignore - -### Linux -!.gitignore -*~ - -### Windows -# image file caches -Thumbs.db -ehthumbs.db -# Folder config file -Desktop.ini -# Recycle Bin used on file shares -$RECYCLE.BIN/ - -### Mac OSX -.DS_Store -.AppleDouble -.LSOverride -Icon -# Thumbnails -._* -# Files that might appear on external disk -.Spotlight-V100 -.Trashes - -### compiled source -*.com -*.class -*.dll -*.exe -*.o -*.so - -### packages -# it's better to unpack these files and commit the raw source -# git has its own built in compression methods -*.7z -*.jar -*.rar -*.zip -*.gz -*.bzip -*.bz2 -*.xz -*.lzma - -### packing-only formats -*.iso -*.tar - -### package management formats -*.dmg -*.xpi -*.gem -*.egg -*.deb -*.rpm - -### logs and databases -*.log -*.sql -*.sqlite - -### eclipse specific -*.pydevproject -.project -.metadata -local.properties -.classpath -.settings/ -.loadpath -# External tool builders -.externalToolBuilders/ -# Locally stored "Eclipse launch configurations" -*.launch -# CDT-specific -.cproject -# PDT-specific -.buildpath - diff --git a/i3/config b/i3/config index 5778215..eafd6e1 100644 --- a/i3/config +++ b/i3/config @@ -92,6 +92,24 @@ set $kill Shift+Q + +################################################################################ +### WORKSPACE ASSIGNMENTS ###################################################### +################################################################################ + +workspace $workspace1 output HDMI3 +workspace $workspace2 output HDMI3 +workspace $workspace3 output HDMI2 +workspace $workspace4 output HDMI2 +workspace $workspace5 output HDMI2 +workspace $workspace6 output HDMI2 +workspace $workspace7 output LVDS1 +workspace $workspace8 output LVDS1 +workspace $workspace9 output LVDS1 +workspace $workspace10 output LVDS1 + +assign [class="^Keepassx$"] $workspace8 + ################################################################################ ### KEYBINDINGS ################################################################ ##################9############################################################# @@ -238,7 +256,7 @@ floating_minimum_size 0 x 0 floating_maximum_size 0 x 0 - font pango:Insonsolata 9 + font pango:Inconsolata 10 ################################################################################ ### COLOR SETTINGS ############################################################# @@ -254,12 +272,6 @@ client.urgent #2f343a #900000 #ffffff #900000 ### APPLICATION SPECIFIC SETTINGS ############################################## ################################################################################ -assign [class="^Mumble$"] $workspace6 -assign [class="^TeamSpeak 3$"] $workspace6 -assign [class="^Clementine$"] $workspace7 -assign [class="^quassel$"] $workspace8 -assign [class="^Thunderbird$"] $workspace9 -assign [class="^Evolution$"] $workspace9 bindsym $mod+F6 exec --no-startup-id mumble bindsym $mod+F7 exec --no-startup-id clementine @@ -270,23 +282,35 @@ bindsym $mod+F9 exec --no-startup-id evolution ### SPECIAL KEYBINDS ########################################################### ################################################################################ +#bindsym XF86Sleep exec --no-stratup-id dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Pause ; exec --no-startup-id $scriptdir/i3exit suspend bindsym XF86Sleep exec --no-startup-id $scriptdir/i3exit suspend -bindsym XF86AudioMute exec --no-startup-id amixer set Master toggle ; exec --no-startup-id $update-status -bindsym XF86AudioRaiseVolume exec --no-startup-id $scriptdir/pa-volume set-vol +5 ; exec --no-startup-id $scriptdir/update-status -bindsym XF86AudioLowerVolume exec --no-startup-id $scriptdir/pa-volume set-vol -5 ; exec --no-startup-id $scriptdir/update-status +bindsym XF86AudioMute exec --no-startup-id $scriptdir/pa-volume mute-toggle ; exec --no-startup-id $update-status +bindsym XF86AudioRaiseVolume exec --no-startup-id $scriptdir/pa-volume set-vol +3 ; exec --no-startup-id $scriptdir/update-status +bindsym XF86AudioLowerVolume exec --no-startup-id $scriptdir/pa-volume set-vol -3 ; exec --no-startup-id $scriptdir/update-status + +bindsym XF86AudioPlay exec dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause +bindsym XF86AudioNext exec dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next +bindsym XF86AudioPrev exec dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous # keys seemingly switched bindsym XF86MonBrightnessUp exec --no-startup-id xbacklight -dec 5 ; exec --no-startup-id $scriptdir/update-status bindsym XF86MonBrightnessDown exec --no-startup-id xbacklight -inc 5 ; exec --no-startup-id $scriptdir/update-status -bindsym XF86AudioPlay exec --no-startup-id mpc toggle -bindsym XF86AudioPrev exec --no-startup-id mpc prev -bindsym XF86AudioNext exec --no-startup-id mpc next - bindsym $mod+o exec --no-startup-id xautorandr ; exec --no-startup-id kill -SIGUSR2 $(cat $RUNDIR/wallchanger.$XDG_SESSION_ID.pid)'" bindsym $mod+p exec --no-startup-id kill -SIGUSR1 $(cat $RUNDIR/wallchanger.$XDG_SESSION_ID.pid) -################################################################################ + + + +exec --no-startup-id autostart + + + + + + + +############################################################################### ### BARS ####################################################################### ################################################################################ # @@ -294,6 +318,8 @@ bar { mode dock position top + +#tray_output HDMI3 tray_output primary tray_padding 3 @@ -305,7 +331,7 @@ bar { id bar-0 - font pango:Inconsolata, Icons 9 + font pango:DejaVu Sans, Icons 10 colors { background #222222 diff --git a/i3/i3.log b/i3/i3.log new file mode 100644 index 0000000..e69de29 diff --git a/i3/scripts/appmenu b/i3/scripts/appmenu index 73aa529..aa5744f 100755 --- a/i3/scripts/appmenu +++ b/i3/scripts/appmenu @@ -1,2 +1,3 @@ #!/usr/bin/env bash -i3-dmenu-desktop --dmenu="dmenu -fn 'DejaVu Sans:size=11' -i -p '>' -nb '#000000' -nf '#ffffff' -sb '#e16b40' -sf '#000000'" +rofi -show run +#j4-dmenu-desktop --dmenu="dmenu -fn 'DejaVu Sans:size=11' -i -p '>' -nb '#000000' -nf '#ffffff' -sb '#e16b40' -sf '#000000'" diff --git a/i3/scripts/i3exit b/i3/scripts/i3exit index ee65f01..75da219 100755 --- a/i3/scripts/i3exit +++ b/i3/scripts/i3exit @@ -5,7 +5,7 @@ _logfile="$LOGDIR/i3/i3exit.log" LOCKSCREEN="$LIBDIR/wallpaper/lockscreen" -_fallback_color=000000 +_fallback_color="000000" touch "$_logfile" @@ -17,6 +17,13 @@ log() lock() { + set -x + playing=0 + if dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'PlaybackStatus'|grep -q Playing ; then + playing=1 + fi + echo $playing + (( $playing )) && dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Pause if [[ -f "$LOCKSCREEN" ]] ; then i3lock --nofork --show-failed-attempts --ignore-empty-password \ --pointer win --image "$LOCKSCREEN" @@ -24,9 +31,13 @@ lock() i3lock --nofork --show-failed-attempts --ignore-empty-password \ --color "$_fallback_color" fi + screen_off + wait + (( $playing )) && dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Play } screen_off() { + : xset dpms force off } diff --git a/i3/scripts/pa-volume b/i3/scripts/pa-volume index 413c83e..6a28c0e 100755 --- a/i3/scripts/pa-volume +++ b/i3/scripts/pa-volume @@ -1,11 +1,13 @@ #!/bin/bash # name of the sink. execute pactl list sinks to get a list -SINKNAME="alsa_output.pci-0000_00_1b.0.analog-stereo" +SINKNAME="$(pactl info | grep '^Default Sink:' | cut -d ' ' -f 3-)" +SINKNAME="alsa_output.usb-Logitech_Logitech_Wireless_Headset_88C626354D45-00.analog-stereo" # this is the worst SINK=$(( $(pactl list sinks | grep "Name: " | grep -n "${SINKNAME}"$ | grep -o "^[[:digit:]]*") -1)) + getvol() { echo $(pactl list sinks | grep "^[[:space:]]*Volume" | head -n $(( $SINK + 1 )) | tail -n 1 | grep -o "[[:digit:]]*%" | head -n 1 | cut -d "%" -f 1) } @@ -49,15 +51,15 @@ ismuted() { } mute() { - pactl set-sink-mute $SINK 1 + pactl set-sink-mute $SINKNAME 1 } unmute() { - pactl set-sink-mute $SINK 0 + pactl set-sink-mute $SINKNAME 0 } mute-toggle() { - pactl set-sink-mute $SINK toggle + pactl set-sink-mute $SINKNAME toggle } status() { @@ -76,6 +78,10 @@ usage() { } case "$1" in + "sink") + echo $SINKNAME + echo $SINK + ;; "get-vol") echo $(getvol) ;; diff --git a/i3/scripts/shutdown-menu b/i3/scripts/shutdown-menu index 6fa3f91..ac530b5 100755 --- a/i3/scripts/shutdown-menu +++ b/i3/scripts/shutdown-menu @@ -14,6 +14,6 @@ output=$( for option in "${options[@]}"; do echo "($i) $option" (( i++ )) -done | dmenu -fn 'DejaVu Sans Mono:size=11' -b -i -l 10 -p '>' -nb '#222222' -nf '#ffffff' -sb '#e16b40' -sf '#000000') +done | dmenu -fn 'DejaVu Sans Mono:size=10' -b -i -l 10 -p '>' -nb '#222222' -nf '#ffffff' -sb '#e16b40' -sf '#000000') [[ "$output" ]] && "$(dirname "$0")"/i3exit "${output#(*) }" diff --git a/i3/scripts/spotify-current b/i3/scripts/spotify-current new file mode 100755 index 0000000..2a01e6e --- /dev/null +++ b/i3/scripts/spotify-current @@ -0,0 +1,20 @@ +#!/usr/bin/env python3 +import dbus +session_bus = dbus.SessionBus() +spotify_bus = session_bus.get_object("org.mpris.MediaPlayer2.spotify", + "/org/mpris/MediaPlayer2") +spotify_properties = dbus.Interface(spotify_bus, + "org.freedesktop.DBus.Properties") +metadata = spotify_properties.Get("org.mpris.MediaPlayer2.Player", "Metadata") + +# The property Metadata behaves like a python dict +# for key, value in metadata.items(): +# print(key, value) + +# To just print the title +print("{}: {} - [{}]".format( + metadata['xesam:artist'][0], + metadata['xesam:title'], + metadata['xesam:album'] +)) + diff --git a/tmux/tmux.conf b/tmux/tmux.conf index 24a3277..28523be 100644 --- a/tmux/tmux.conf +++ b/tmux/tmux.conf @@ -92,3 +92,8 @@ bind-key -n C-F2 split-window -h "exec htop" bind-key -n C-F3 set-option status bind-key r source-file ~/.tmux.conf \; display-message "~/.tmux.conf sourced" + +bind P paste-buffer +bind-key -t vi-copy 'v' begin-selection +bind-key -t vi-copy 'y' copy-selection +bind-key -t vi-copy 'r' rectangle-toggle diff --git a/vim/vimrc b/vim/vimrc index 2a4ec6f..121b41e 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -118,7 +118,7 @@ set undodir=~/.vim/undo set undofile " == environment / directories == -set autochdir +set noautochdir set directory=/var/tmp,/tmp set viewdir=~/.vim/view @@ -234,6 +234,7 @@ let g:airline#extensions#disable_rtp_load = 1 let g:airline_extensions = ['whitespace'] let g:airline_theme='powerlineish' let g:airline_powerline_fonts = 1 + let g:airline_section_x = airline#section#create(['%{tagbar#currenttag("%s", "", "f")}','' , ' %{PencilMode()}', ' [', 'filetype', ']']) let g:pencil#mode_indicators = {'hard': 'H', 'auto': 'A', 'soft': 'S', 'off': '',} let g:airline#extensions#whitespace#enabled = 1 @@ -262,3 +263,6 @@ endfunction autocmd BufWritePre * :call DeleteTrailingWS() autocmd FileType yaml set shiftwidth=2 + +set completeopt-=preview +let g:ycm_add_preview_to_completeopt = 0 diff --git a/x/Xresources b/x/Xresources index e34d615..748b607 100644 --- a/x/Xresources +++ b/x/Xresources @@ -1,12 +1,10 @@ Xcursor.theme: Vanilla-DMZ URxvt.scrollBar: false - -URxvt.font: xft:Inconsolata:size=9 +URxvt.font: xft:Inconsolata:size=10 URxvt.letterSpace: -1 URxvt.perl-ext-common: default,matcher,selection-to-clipboard - URxvt.url-launcher: /usr/bin/xdg-open URxvt.matcher.button: 1 URxvt.saveLines: 10000 @@ -60,4 +58,3 @@ URxvt.fading: 15 ! white *.color7: #f8f8f2 *.color15: #f9f8f5 - diff --git a/x/xinitrc b/x/xinitrc index 4b90445..c9e7ceb 100755 --- a/x/xinitrc +++ b/x/xinitrc @@ -6,7 +6,6 @@ log() { echo "[$(date +%FT%T)] $*" >> "$LOGFILE" } - if [ -d /etc/X11/xinit/xinitrc.d ]; then for f in /etc/X11/xinit/xinitrc.d/*; do [ -x "$f" ] && . "$f" @@ -22,18 +21,5 @@ start_wm() { exec i3 -c "$HOME/.i3/config" >> "$LOGDIR/i3/i3.log" } -autostart() { - if [[ -d "$HOME/.autostart" ]] ; then - log "Looking for autostart files." - for f in "$HOME/.autostart/"*.sh ; do - if [[ -x "$f" ]] ; then - log "Executing autostart file \"$f\"" - "$f" - fi - done - fi -} - -autostart start_wm diff --git a/zsh/zprofile b/zsh/zprofile index 1d7cf51..eea6146 100644 --- a/zsh/zprofile +++ b/zsh/zprofile @@ -9,7 +9,7 @@ _path=("$HOME/bin" "/usr/games") PATH="" -for part in ${_path} ; do +for part in ${_path[@]} ; do PATH="$PATH:${part}" done PATH="${PATH#:}" @@ -17,9 +17,10 @@ export PATH export EDITOR="vim" export VISUAL="vim" -export BROWSER="chromium" +export BROWSER="firefox-trunk" export PAGER="less" +export LESS="FRX" export VIMRC="$HOME/.vimrc" @@ -34,6 +35,9 @@ export LANG=en_US.UTF-8 export LC_TIME=de_DE.UTF-8 export LC_COLLATE=C +export DOTFILES=~/dotfiles + + # Start the gpg-agent if not already running if ! pgrep -x --uid "${USER}" gpg-agent >/dev/null 2>&1; then eval $(gpg-agent --daemon --sh) diff --git a/zsh/zshrc.d/20_aliases.sh b/zsh/zshrc.d/20_aliases.sh index a0e361c..55a6f9b 100644 --- a/zsh/zshrc.d/20_aliases.sh +++ b/zsh/zshrc.d/20_aliases.sh @@ -1,7 +1,4 @@ ### TRANSLATIONS -alias vim="vim -u $VIMRC" - -alias urxvt="urxvt256c" ### COMMON OPERATIONS alias ll='ls -AlFh' @@ -26,8 +23,6 @@ alias calc='python3 -ic "from math import *; import cmath"' alias le_haxxor_1='clear && dmesg | pv -qL 20' alias le_haxxor_2='clear && hexdump -C /dev/urandom | pv -qlL 2' -alias b='cd $OLDPWD' - alias root='sudo -sE' ### USEFUL DEFAULT OPTIONS @@ -51,17 +46,15 @@ alias du='du -h' alias df='df -h' # show non-printable characters by default -alias cat="cat -v" +# alias cat="cat -v" ### SHORTENING COMMAND NAMES alias cs="cryptsetup" alias v="vim" alias g="git" -alias t="tmux" alias c="cd" alias l="ls" alias s="sudo" -alias t="tmux" alias cl="clear" alias nocolor="sed -r \"s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g\"" diff --git a/zsh/zshrc.d/40_functions.sh b/zsh/zshrc.d/40_functions.sh index d680493..9dd9352 100644 --- a/zsh/zshrc.d/40_functions.sh +++ b/zsh/zshrc.d/40_functions.sh @@ -143,3 +143,33 @@ man() { embiggen() { enscript --no-header --media=A4 --landscape --font="DejaVuSansMono30" -o - | ps2pdf - | zathura - } + +sshmux () { + ssh -t $@ "tmux a || tmux"; +} + +t() { + if [[ "$1" ]] ; then + tmux new-session -A -s "$1" + else + tmux attach-session + fi +} + +b() { + bookmarks=${DOTFILES}/bookmarks + bookmark="$1" + if ! [[ "${bookmark}" ]] ; then + printf 'Need a bookmark' >&2 + return 1 + fi + if ! [[ -r "${bookmark}" ]] ; then + printf 'Invalid bookmark %s' "${bookmark}" >&2 + return 1 + fi + target="$(head -1 ${bookmark})" + if ! [[ -e "${target}" ]] ; then + printf 'Traget not found: %s' "${target}" >&2 + fi + cd "$(eval ${target})" +}