diff --git a/autostart/40_wallpaper.sh b/autostart/40_wallpaper.sh index c8e8299..867eab4 100755 --- a/autostart/40_wallpaper.sh +++ b/autostart/40_wallpaper.sh @@ -1,12 +1,8 @@ #!/usr/bin/env bash -wallpaper_directory="$LIBDIR/wallpaper/current" -wallchanger_pidfile="$RUNDIR/wallchanger.${XDG_SESSION_ID}.pid" -wallpaper_logfile="$LOGDIR/wallpaper.log" -wallpaper_interval="10800" +wallpaper="$LIBDIR/wallpaper/current" -printf '%s' "starting $path_wallchanger" >>"$LOGFILE" +printf '%s' "setting wallpaper" >>"$LOGFILE" { - wallchanger "$wallpaper_directory" "$wallpaper_interval" & - echo $! > "$wallchanger_pidfile" + feh --bg-scale "${wallpaper}" } & &>> $LOGFILE diff --git a/git/gitconfig b/git/gitconfig index de9ae68..ce61e8c 100644 --- a/git/gitconfig +++ b/git/gitconfig @@ -13,6 +13,7 @@ visual = "!gitk --all" staged = "diff --staged" + fe = "fetch --all --prune" co = "checkout" ci = "commit" st = "status" @@ -34,17 +35,19 @@ pushall = "!sh -c 'for r in $(git remote) ; do [[ "$r" != "upstream" ]] && { echo \"--- [$r] ---\" ; git push $r \"$@\" ; } ; done' -" - branch-clean = "!sh -c 'git branch --merged | grep -v master | xargs --no-run-if-empty git branch -d'" + branch-clean = "!sh -c 'git branch --merged | grep -v -e master -e develop -e '^*' | xargs --no-run-if-empty git branch -d'" + brc = "!git branch-clean" graph = log --graph --pretty=format:'%C(yellow)%h%Creset%C(bold red)% D%Creset %C(green)(%cr) %C(blue)%an<%ae>%Creset%n %C(bold white)%s%Creset' --all intercommit = !bash -c 'interdiff <(git show $1) <(git show $2) | less -FRS' - + drop = !git rebase --onto $1^ -- + [core] fileMode = true whitespace = "blank-at-eol,space-before-tab,blank-at-eof" abbrev = 8 - [color] ui = true [column] @@ -64,6 +67,7 @@ [commit] gpgSign = true cleanup = default + status = true [status] relativePaths = false submoduleSummary = true diff --git a/i3/config b/i3/config index 1218f27..13d0a1c 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############################################################# @@ -174,12 +192,16 @@ bindsym $mod+d exec --no-startup-id ~/.i3/scripts/appmenu bindsym $mod+Return exec $terminal - bindsym $mod+F1 exec firefox - bindsym Print exec --no-startup-id ~/.i3/scripts/shutdown-menu + bindsym F1 exec --no-startup-id ~/.i3/scripts/shutdown-menu + bindsym $mod+F1 exec --no-startup-id ~/.i3/scripts/i3exit lock + bindsym $mod+Home exec --no-startup-id ~/.i3/scripts/shutdown-menu bindsym $mod+Shift+v exec --no-startup-id redshift-toggle + bindsync $mod+Shift+$scratchpad move scratchpad + bindsync $mod+$scratchpad scratchpad show + ################################################################################ ### MODES ###################################################################### ################################################################################ @@ -238,7 +260,7 @@ floating_minimum_size 0 x 0 floating_maximum_size 0 x 0 - font pango:Insonsolata 9 + font pango:Inconsolata 10 ################################################################################ ### COLOR SETTINGS ############################################################# @@ -280,7 +302,18 @@ bindsym XF86MonBrightnessDown exec --no-startup-id xbacklight -inc 5 ; exec --no 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 ####################################################################### ################################################################################ # @@ -288,6 +321,8 @@ bar { mode dock position top + +#tray_output HDMI3 tray_output primary tray_padding 3 @@ -299,7 +334,7 @@ bar { id bar-0 - font pango:Inconsolata, Icons 9 + font pango:Inconsolata, FontAwesome 10 colors { background #222222 diff --git a/i3/i3status.conf b/i3/i3status.conf index e22dc1a..3200b1f 100644 --- a/i3/i3status.conf +++ b/i3/i3status.conf @@ -50,9 +50,9 @@ wifi { spotify { format = "  {title} - {artist} " - format_down = "  off " cache_timeout = 1 color_offline = '#FFFFFF' + format_down = "no Spotify" } online_status { @@ -60,7 +60,6 @@ online_status { } volume_status { - device = "12" cache_timeout = 10 format = "  {percentage}% " format_muted = "  mute " 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 3ee2cd9..4410bbf 100755 --- a/i3/scripts/i3exit +++ b/i3/scripts/i3exit @@ -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 7a38011..528015e 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) } @@ -80,6 +82,10 @@ update_status_bar() { } case "$1" in + "sink") + echo $SINKNAME + echo $SINK + ;; "get-vol") echo $(getvol) ;; @@ -111,5 +117,4 @@ case "$1" in ;; *) usage - ;; esac diff --git a/i3/scripts/shutdown-menu b/i3/scripts/shutdown-menu index 5911103..c82322c 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 'Inconsolata:size=9' -b -i -l 10 -p '>' -nb '#222222' -nf '#ffffff' -sb '#e16b40' -sf '#000000') +done | dmenu -fn 'Inconsolata: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-control b/i3/scripts/spotify-control index 21371f7..05618ad 100755 --- a/i3/scripts/spotify-control +++ b/i3/scripts/spotify-control @@ -17,3 +17,4 @@ previous) esac dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player."${cmd}" +~/.i3/scripts/bar-update spotify 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/install.yml b/install.yml index 41c77ec..8589f02 100644 --- a/install.yml +++ b/install.yml @@ -37,6 +37,7 @@ - mkdir -p ~/.var/lib - mkdir -p ~/.var/log - mkdir -p ~/.var/run + - mkdir -p ~/.usr/lib - command: curl --fail --location --create-dirs --output ~/.local/share/nvim/site/autoload/plug.vim https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim stdout: true stderr: true diff --git a/tmux/tmux.conf b/tmux/tmux.conf index 00b87ae..805d729 100644 --- a/tmux/tmux.conf +++ b/tmux/tmux.conf @@ -1,5 +1,9 @@ set -g default-command "${SHELL}" -set -g default-terminal "tmux-256color" +set -g default-terminal "rxvt-unicode" + +set -g set-titles on +set -g set-titles-string '#S' +setw -g automatic-rename set -g prefix C-a unbind C-b @@ -26,7 +30,7 @@ bind l select-pane -R set -g bell-action any -set -g history-limit 5000 +set -g history-limit 50000 set -g base-index 1 set-window-option -g pane-base-index 1 @@ -85,7 +89,6 @@ bind-key c new-window -c "#{pane_current_path}" bind-key -n S-down new-window bind-key -n S-left prev bind-key -n S-right next -bind-key -n C-q detach bind-key -n C-F1 command-prompt "split-window -h 'exec man %%'" bind-key -n C-F2 split-window -h "exec htop" @@ -94,3 +97,6 @@ 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 bf22cca..971832f 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -8,14 +8,14 @@ call plug#begin('~/.local/share/nvim/plugged') "Plug 'vim-airline/vim-airline-themes' Plug 'itchyny/lightline.vim' " Plug 'godlygeek/tabular' -" Plug 'lepture/vim-jinja' +Plug 'lepture/vim-jinja' Plug 'majutsushi/tagbar' " Plug 'nblock/vim-dokuwiki' Plug 'reedes/vim-pencil' " Plug 'saltstack/salt-vim' Plug 'sickill/vim-monokai' " Plug 'sjl/gundo.vim' -" Plug 'tpope/vim-commentary' +Plug 'tpope/vim-commentary' " Plug 'tpope/vim-fugitive' " Plug 'tpope/vim-speeddating' " Plug 'tpope/vim-surround' @@ -43,6 +43,10 @@ Plug 'scrooloose/nerdtree' Plug 'vimwiki/vimwiki' Plug 'blindFS/vim-taskwarrior' Plug 'tbabej/taskwiki' +Plug 'rodjek/vim-puppet' +Plug 'suan/vim-instant-markdown' +"Plug 'marshallward/vim-restructuredtext' +Plug 'vim-syntastic/syntastic' call plug#end() filetype plugin indent on @@ -114,7 +118,7 @@ set undodir=~/.vim/undo set undofile " == environment / directories == -set autochdir +set noautochdir set directory=/var/tmp,/tmp set viewdir=~/.vim/view @@ -184,7 +188,10 @@ inoremap jj nnoremap v vl +nnoremap m :InstantMarkdownPreview + nnoremap u :GundoToggle +nnoremap d :diffupdate nmap :Goyo:TogglePencil:Limelight!! nmap w :Goyo:TogglePencil:Limelight!! @@ -264,3 +271,8 @@ autocmd BufWritePre * :call DeleteTrailingWS() autocmd FileType yaml set shiftwidth=2 set completeopt-=preview let g:ycm_add_preview_to_completeopt = 0 + +set completeopt-=preview +let g:ycm_add_preview_to_completeopt = 0 + +let g:instant_markdown_autostart = 0 diff --git a/x/Xresources b/x/Xresources index 0c66da4..ecae0fe 100644 --- a/x/Xresources +++ b/x/Xresources @@ -2,11 +2,10 @@ Xcursor.theme: Vanilla-DMZ URxvt.scrollBar: false -URxvt.font: xft:Inconsolata:size=9, xft:FontAwesome:size=9 +URxvt.font: xft:Inconsolata:size=10 URxvt.letterSpace: -1 -URxvt.perl-ext-common: default,matcher,selection-to-clipboard - +URxvt.perl-ext-common: default,matcher,selection-to-clipboard,resize-font URxvt.url-launcher: /usr/bin/xdg-open URxvt.matcher.button: 1 URxvt.saveLines: 10000 @@ -60,4 +59,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 4f97237..00cca3a 100644 --- a/zsh/zprofile +++ b/zsh/zprofile @@ -17,7 +17,7 @@ export PATH export EDITOR="vim" export VISUAL="vim" -export BROWSER="/usr/bin/xdg-open" +export BROWSER="firefox" export PAGER="less" export LESS="FRX" diff --git a/zsh/zshrc b/zsh/zshrc index 016df15..77e1e71 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -14,3 +14,5 @@ for file in "${_zshdir}"/* ; do source "$file" fi done + +source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh diff --git a/zsh/zshrc.d/20_aliases.sh b/zsh/zshrc.d/20_aliases.sh index d77ce30..1efcfd1 100644 --- a/zsh/zshrc.d/20_aliases.sh +++ b/zsh/zshrc.d/20_aliases.sh @@ -1,8 +1,3 @@ -### TRANSLATIONS -alias vim="nvim" - -alias urxvt="urxvt256c" - ### COMMON OPERATIONS alias ll='ls -AlFh' alias la='ls -A' @@ -26,8 +21,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 @@ -69,3 +62,8 @@ alias tw="task" alias twl="task list" alias twa="task add" alias twd="task done" + +alias yaml2js="python -c 'import sys, yaml, json; json.dump(yaml.load(sys.stdin), sys.stdout, indent=4)'" + +alias currentbranch='git rev-parse --abbrev-ref HEAD' +alias gpush='git push origin $(currentbranch)' diff --git a/zsh/zshrc.d/40_functions.sh b/zsh/zshrc.d/40_functions.sh index 6a4a2c7..c8d9b95 100644 --- a/zsh/zshrc.d/40_functions.sh +++ b/zsh/zshrc.d/40_functions.sh @@ -148,6 +148,10 @@ resolvecd() { cd "$(readlink -f $(pwd))" } +sshmux () { + ssh -t $@ "tmux a || tmux"; +} + t() { if [[ "$1" ]] ; then tmux new-session -A -s "$1" @@ -155,3 +159,21 @@ t() { 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})" +}