From c2cafe592eacfe43bf518467fbdb149b829e6cad Mon Sep 17 00:00:00 2001 From: Urbain Vaes Date: Fri, 27 Oct 2017 01:07:11 +0200 Subject: Clean up --- bin/bin/auto-open-download | 13 ----- bin/bin/downloads | 7 ++- bin/bin/email | 16 ------ bin/bin/monitor | 2 +- bin/bin/move_workspace | 21 -------- bin/bin/references | 2 +- bin/bin/run | 6 +-- bin/bin/touchpad | 9 ---- bin/bin/username | 7 +-- bin/bin/vimin | 4 -- bin/bin/workspace | 69 +++++++++++++++++--------- conky/.config/conky/conky.conf | 82 ------------------------------- crontab/crontab | 3 +- i3/.config/i3/config | 8 +-- khal/.config/khal/config | 15 ------ ncmpcpp/error.log | 0 qutebrowser/.config/qutebrowser/config.py | 11 +++++ vdirsyncer/.config/vdirsyncer/.gitignore | 1 - vdirsyncer/.config/vdirsyncer/config | 20 -------- vim/.vimrc | 4 +- vimperator/.vimperatorrc | 2 - w3m/.w3m/keymap | 27 ---------- zsh/.zsh/alias | 3 +- zsh/.zshrc | 8 +++ 24 files changed, 81 insertions(+), 259 deletions(-) delete mode 100755 bin/bin/auto-open-download delete mode 100755 bin/bin/email delete mode 100755 bin/bin/move_workspace delete mode 100755 bin/bin/touchpad delete mode 100755 bin/bin/vimin delete mode 100644 conky/.config/conky/conky.conf delete mode 100644 khal/.config/khal/config delete mode 100644 ncmpcpp/error.log delete mode 100644 vdirsyncer/.config/vdirsyncer/.gitignore delete mode 100644 vdirsyncer/.config/vdirsyncer/config delete mode 100644 vimperator/.vimperatorrc delete mode 100644 w3m/.w3m/keymap diff --git a/bin/bin/auto-open-download b/bin/bin/auto-open-download deleted file mode 100755 index 1ebeac2..0000000 --- a/bin/bin/auto-open-download +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash - -inotifywait -m -q -e create $HOME/Downloads | while read line -do - extension=${line##*.} - file=$HOME/Downloads/$(echo "$line" | cut -d " " -f 3-) - if [[ $extension =~ (pdf|PDF|ps|djvu) ]] ; then - while test $(find "$file" -mmin "-0.02"); do - sleep 0.02 - done - zathura "$file" - fi -done diff --git a/bin/bin/downloads b/bin/bin/downloads index b3583b9..46d64bd 100755 --- a/bin/bin/downloads +++ b/bin/bin/downloads @@ -1,5 +1,4 @@ #!/bin/bash -DOWNLOAD_DIR="$HOME/Downloads" -PDF=$(ls -t $DOWNLOAD_DIR/*.pdf $DOWNLOAD_DIR/*.PDF $DOWNLOAD_DIR/*.djvu $DOWNLOAD_DIR/*.ps) -TARGET=$(echo "${PDF//"$DOWNLOAD_DIR/"/}" | dmenu -i -p "Open File:") -[[ -n $TARGET ]] && zathura "$DOWNLOAD_DIR/$TARGET" & +download_dir="$HOME/Downloads" +target=$(find $download_dir -regex '.*\.\(pdf\|PDF\|djvu\|ps\)' -printf "%f\n" | dmenu -i -p "Open File:") +[[ -n $target ]] && exec zathura "$download_dir/$target" diff --git a/bin/bin/email b/bin/bin/email deleted file mode 100755 index c2f9998..0000000 --- a/bin/bin/email +++ /dev/null @@ -1,16 +0,0 @@ -#! /usr/bin/env bash - -# Necessary to see the notification -export DISPLAY=:0 - -# Get all emails -mbsync -a - -new_mails=$(find $HOME/.mail -path '*/new/*' -type f -not -path '*/rss/*') - -if [[ ! -z ${new_mails} ]]; then - subjects=$(cat $(echo -e ${new_mails/'\n'/' '}) | grep "^Subject: " | sed "s/^Subject: //g") - DISPLAY=:0 /usr/bin/notify-send -t 3 "New mail(s)!" "${subjects}" -fi - -echo "Email last checked on $(date)". diff --git a/bin/bin/monitor b/bin/bin/monitor index 6f4267e..c3b81db 100755 --- a/bin/bin/monitor +++ b/bin/bin/monitor @@ -54,7 +54,7 @@ do then TILES[$index]="Dual Screen ${MONITORS[$entry_a]} -> ${MONITORS[$entry_b]}" COMMANDS[$index]="xrandr --output ${MONITORS[$entry_a]} --auto \ - --left-of ${MONITORS[$entry_b]} --auto" + --output ${MONITORS[$entry_b]} --auto --right-of ${MONITORS[$entry_a]}" index+=1 fi diff --git a/bin/bin/move_workspace b/bin/bin/move_workspace deleted file mode 100755 index a56ff3f..0000000 --- a/bin/bin/move_workspace +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env bash - -wkspces=$(i3-msg -t get_workspaces | grep -Po '"name":.*?[^\\]"' | sed 's/"name":"\([^"]\+\)"/\1/g') -focused=$(i3-msg -t get_workspaces | grep -Po '{[^}]*"focused":true[^}]*}' | sed 's/.*"name":"\([^"]*\)".*$/\1/g') - -focused_number=${focused%%:*} -focused_name=${focused#*:} - -[[ $1 = 'n' ]] && new_number=$((focused_number + 1)) -[[ $1 = 'p' ]] && new_number=$((focused_number - 1)) - -next=$(echo "${wkspces}" | grep "^${new_number}") - -i3-msg rename workspace to ${new_number}:${focused_name} - -if [[ ! -z "${next// }" ]]; then - name_next=${next#*:} - i3-msg "workspace ${next};\ - rename workspace to ${focused_number}:${name_next};\ - workspace ${new_number}:${focused_name}" -fi diff --git a/bin/bin/references b/bin/bin/references index 4e6346a..a4662d2 100755 --- a/bin/bin/references +++ b/bin/bin/references @@ -2,4 +2,4 @@ REF_DIR="$HOME/phd/references" PDF=$(find $REF_DIR -name "*.pdf" -printf "%P\n") TARGET=$(echo "${PDF//"$REF_DIR/"/}" | dmenu -i -p "Open File:") -[[ -n $TARGET ]] && (zathura "$REF_DIR/$TARGET" &) +[[ -n $TARGET ]] && exec zathura "$REF_DIR/$TARGET" diff --git a/bin/bin/run b/bin/bin/run index b5ff85d..aef09ea 100755 --- a/bin/bin/run +++ b/bin/bin/run @@ -1,5 +1,3 @@ #!/bin/bash -SCRIPTS_DIR="$HOME/bin" && cd $SCRIPTS_DIR -SCRIPTS=$(ls -A $SCRIPTS_DIR) -TARGET=$(echo "${SCRIPTS//"$SCRIPTS_DIR/"/}" | dmenu -i -p "Run script:") -[[ -n $TARGET ]] && "$TARGET" +target=$(find $HOME/dotfiles/bin/ -type f -not -name ".*" -printf "%f\n" | dmenu -i -p "Run script:") +[[ -n $target ]] && exec $target diff --git a/bin/bin/touchpad b/bin/bin/touchpad deleted file mode 100755 index 17649fa..0000000 --- a/bin/bin/touchpad +++ /dev/null @@ -1,9 +0,0 @@ -#! /usr/bin/env bash - -# Touchpad status -status=$(synclient -l | grep TouchpadOff) -if [[ $status = *1 ]]; then - synclient TouchpadOff=0 -elif [[ $status = *0 ]]; then - synclient TouchpadOff=1 -fi diff --git a/bin/bin/username b/bin/bin/username index 37da88a..704ea98 100755 --- a/bin/bin/username +++ b/bin/bin/username @@ -1,6 +1,3 @@ #!/bin/bash -PWD_DIR="$HOME/.password-store" -[[ ! -z $(readlink ${PWD_DIR}) ]] && PWD_DIR=$(readlink ${PWD_DIR}) -PASSWORDS=$(locate "${PWD_DIR}/**/*.gpg") -TARGET=$(echo "${PASSWORDS//"$PWD_DIR/"/}" | dmenu -i -p "Get identifier for:") -basename $TARGET .gpg | xclip -i +target=$(find $HOME/.password-store/ -name "*.gpg" -exec sh -c 'echo ${1#*password-store/}' _ {} \; | dmenu -i -p "Get identifier for:") +basename $target .gpg | xclip -i diff --git a/bin/bin/vimin b/bin/bin/vimin deleted file mode 100755 index b00d8fa..0000000 --- a/bin/bin/vimin +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash -tempfile=$(mktemp) -urxvt -e nvim ${tempfile} +star -cat ${tempfile} | xclip -i diff --git a/bin/bin/workspace b/bin/bin/workspace index 79ff834..51c488a 100755 --- a/bin/bin/workspace +++ b/bin/bin/workspace @@ -1,33 +1,54 @@ -#!/bin/zsh - -# Command to use -[[ $1 = 'n' ]] && cmd="workspace" -[[ $1 = 'm' ]] && cmd="move container to workspace" +#!/usr/bin/env bash # List of workspaces -workspaces=$(i3-msg -t get_workspaces | grep -Po '"name":.*?[^\\]"' | sed 's/"name":"\([^"]\+\)"/\1/g') +workspaces=$(i3-msg -t get_workspaces | awk 'BEGIN { + RS="(},{)|(\\[{)|(}\\])"; + FPAT="([^,:]+)|([^,]+{[^}]+})|(\"[^\"]+\")" + } + $0 !~ "^\\s*$" { + gsub(/"/, "", $4) + print $2, $4, $8, $11 + }' | sort) + +act_on_container() { + # Get desired workspace + target=$(echo "$workspaces" | awk '{print $2}' | dmenu -i -p "Select workspace: ") + + # Exit if empty + [[ -z $target ]] && exit -# Keep only the ones containing : -workspaces=$(echo $workspaces | sed '/:/!d') + # If new workspace has to be created + if [[ ! $target = [0-9]* ]]; then -# Get desired workspace -target=$(echo $workspaces | dmenu "Go to workspace:") + # Add number to workspace name + new_number=$(echo "$workspaces" | awk '$1!=p+1{exit;}{p=$1} END {print p+1}') + target=$new_number:$target + fi -# Exit if empty -[[ -z $target ]] && exit + # Execute command + exec i3-msg $1 $target +} -# If new workspace has to be created -if [[ ! $target = [0-9]* ]]; then +act_on_workspace() { + focused_number=$(echo "$workspaces" | awk '$3 ~ "true" {print $1}') + focused_name=$(echo "$workspaces" | awk '$3 ~ "true" {print $2}' | cut -d":" -f2) - # Calculate number for new workspace - used_numbers=$(echo $workspaces | awk 'BEGIN { FS = ":" } ; { print $1 }' | sort) - max_number=$(echo $used_numbers | tail -1) - lowest_gap=$(echo $used_numbers | awk '$1!=p+1{print p+1}{p=$1}' | head -1) - [[ -z $lowest_gap ]] && new_number=$(($max_number + 1)) || new_number=$lowest_gap + [[ $1 = 'n' ]] && new_number=$((focused_number + 1)) + [[ $1 = 'p' ]] && new_number=$((focused_number - 1)) - # Add number to workspace name - target=$new_number:$target -fi + next=$(echo "${workspaces}" | awk '$1 ~ /'$new_number'/ {print $2}') -# Execute command -exec i3-msg $cmd $target + i3-msg rename workspace to ${new_number}:${focused_name} + + if [[ ! -z "${next// }" ]]; then + name_next=${next#*:} + i3-msg "workspace ${next};\ + rename workspace to ${focused_number}:${name_next};\ + workspace ${new_number}:${focused_name}" + fi +} + +# Command to use +[[ $1 = 'gw' ]] && act_on_container "workspace" +[[ $1 = 'mc' ]] && act_on_container "move container to workspace" +[[ $1 = 'mw' ]] && act_on_workspace "$2" diff --git a/conky/.config/conky/conky.conf b/conky/.config/conky/conky.conf deleted file mode 100644 index 5499b07..0000000 --- a/conky/.config/conky/conky.conf +++ /dev/null @@ -1,82 +0,0 @@ --- vim: ts=4 sw=4 noet ai cindent syntax=lua ---[[ -Conky, a system monitor, based on torsmo - -Any original torsmo code is licensed under the BSD license - -All code written since the fork of torsmo is licensed under the GPL - -Please see COPYING for details - -Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen -Copyright (c) 2005-2012 Brenden Matthews, Philip Kovacs, et. al. (see AUTHORS) -All rights reserved. - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program. If not, see . -]] - -conky.config = { - alignment = 'top_right', - background = true, - border_width = 1, - cpu_avg_samples = 2, - default_color = 'white', - default_outline_color = 'white', - default_shade_color = 'white', - double_buffer = true, - draw_borders = false, - draw_graph_borders = true, - draw_outline = false, - draw_shades = false, - use_xft = true, - font = 'DejaVu Sans Mono:size=12', - gap_x = 10, - gap_y = 10, - minimum_height = 5, - minimum_width = 5, - net_avg_samples = 2, - no_buffers = true, - out_to_console = false, - out_to_stderr = false, - extra_newline = false, - own_window = false, - stippled_borders = 0, - update_interval = 1.0, - uppercase = false, - use_spacer = 'none', - show_graph_scale = false, - show_graph_range = false -} - -conky.text = [[ -$hr -${color grey}Uptime:$color $uptime -${color grey}Frequency (in MHz):$color $freq -${color grey}Frequency (in GHz):$color $freq_g -${color grey}RAM Usage:$color $mem/$memmax - $memperc% ${membar 4} -${color grey}Swap Usage:$color $swap/$swapmax - $swapperc% ${swapbar 4} -${color grey}CPU Usage:$color $cpu% ${cpubar 4} -${color grey}Processes:$color $processes ${color grey}Running:$color $running_processes -$hr -${color grey}File systems: - / $color${fs_used /}/${fs_size /} ${fs_bar 6 /} - /home $color${fs_used /home}/${fs_size /home} ${fs_bar 6 /home} -${color grey}Networking: -Up:$color ${upspeed eth0} ${color grey} - Down:$color ${downspeed eth0} -$hr -${color grey}Name PID CPU% MEM% -${color lightgrey} ${top name 1} ${top pid 1} ${top cpu 1} ${top mem 1} -${color lightgrey} ${top name 2} ${top pid 2} ${top cpu 2} ${top mem 2} -${color lightgrey} ${top name 3} ${top pid 3} ${top cpu 3} ${top mem 3} -${color lightgrey} ${top name 4} ${top pid 4} ${top cpu 4} ${top mem 4} -]] diff --git a/crontab/crontab b/crontab/crontab index a6b27a3..1713ba8 100644 --- a/crontab/crontab +++ b/crontab/crontab @@ -1,2 +1 @@ -*/5 * * * * /home/urbain/bin/email >> /home/urbain/.cron_email_log -*/5 * * * * /usr/bin/vdirsyncer sync >> /home/urbain/.cron_calendar_log +*/5 * * * * /usr/bin/env mbsync -a diff --git a/i3/.config/i3/config b/i3/.config/i3/config index 48e75bd..8592fea 100644 --- a/i3/.config/i3/config +++ b/i3/.config/i3/config @@ -160,10 +160,10 @@ bindsym $mod+m bar mode toggle bindsym $mod+Tab workspace back_and_forth bindsym $mod+comma workspace prev bindsym $mod+period workspace next -bindsym $mod+Shift+comma exec $HOME/bin/move_workspace p -bindsym $mod+Shift+period exec $HOME/bin/move_workspace n -bindsym $mod+n exec $HOME/bin/workspace n -bindsym $mod+Shift+n exec $HOME/bin/workspace m +bindsym $mod+Shift+comma exec $HOME/bin/workspace mw p +bindsym $mod+Shift+period exec $HOME/bin/workspace mw n +bindsym $mod+n exec $HOME/bin/workspace gw +bindsym $mod+Shift+n exec $HOME/bin/workspace mc # Programs shortcuts bindsym $mod+b exec --no-startup-id qutebrowser diff --git a/khal/.config/khal/config b/khal/.config/khal/config deleted file mode 100644 index 2cfb434..0000000 --- a/khal/.config/khal/config +++ /dev/null @@ -1,15 +0,0 @@ -[calendars] - - [[home]] - path = ~/.calendars/home/ - color = dark green - - [[work]] - path = ~/.calendars/work/ - color = dark blue - -[default] - default_calendar = home - print_new = event - timedelta = 7d - highlight_event_days = True diff --git a/ncmpcpp/error.log b/ncmpcpp/error.log deleted file mode 100644 index e69de29..0000000 diff --git a/qutebrowser/.config/qutebrowser/config.py b/qutebrowser/.config/qutebrowser/config.py index 7d2ae2c..8b4271e 100644 --- a/qutebrowser/.config/qutebrowser/config.py +++ b/qutebrowser/.config/qutebrowser/config.py @@ -19,6 +19,7 @@ config.bind(",t", 'spawn --userscript explorer -t') config.bind(",h", 'spawn --userscript explorer -h') config.bind(",b", 'spawn --userscript explorer -b') config.bind(",d", 'spawn --userscript dictionary-search') +config.bind('f', 'hint all current') # Bindings for insert mode config.bind("", 'fake-key ', mode='insert') @@ -33,6 +34,16 @@ config.bind("", 'fake-key ', mode='insert') # Bindings for command mode config.bind('', 'fake-key -g ', mode='command') +# Search engines +# c.url.searchengines = {'DEFAULT': 'https://duckduckgo.com/?q={}'} +c.url.searchengines = { + 'DEFAULT': 'https://startpage.com/do/search?query={}', + 'yt': 'https://www.youtube.com/results?search_query={}', + 'ddg': 'https://duckduckgo.com/?q={}', + 'google': 'https://duckduckgo.com/?q={}', + 'aw': 'https://wiki.archlinux.org/index.php?search={}', +} + ## Autogenerated config.py ## Documentation: ## qute://help/configuring.html diff --git a/vdirsyncer/.config/vdirsyncer/.gitignore b/vdirsyncer/.config/vdirsyncer/.gitignore deleted file mode 100644 index 8be5547..0000000 --- a/vdirsyncer/.config/vdirsyncer/.gitignore +++ /dev/null @@ -1 +0,0 @@ -status diff --git a/vdirsyncer/.config/vdirsyncer/config b/vdirsyncer/.config/vdirsyncer/config deleted file mode 100644 index a547af9..0000000 --- a/vdirsyncer/.config/vdirsyncer/config +++ /dev/null @@ -1,20 +0,0 @@ -[general] -status_path = "~/.config/vdirsyncer/status/" - -# CALDAV -[pair calendar] -a = "calendar_local" -b = "calendar_remote" -collections = ["from b"] -conflict_resolution = "b wins" - -[storage calendar_local] -type = "filesystem" -path = "~/.calendars/" -fileext = ".ics" - -[storage calendar_remote] -type = "caldav" -url = "https://cal.urbainvaes.com/" -username = "urbain" -password.fetch = ["command", "pass", "show", "radicale/urbain"] diff --git a/vim/.vimrc b/vim/.vimrc index bb6dc15..cbea96a 100644 --- a/vim/.vimrc +++ b/vim/.vimrc @@ -123,8 +123,8 @@ nnoremap gd :Gdiff " Iron let g:iron_map_defaults=0 nmap yr (iron-send-motion) -nmap yryr Vyr -xmap yr (iron-send-motion) +nmap yryr VR +xmap R (iron-send-motion) " Easy align xmap ga (EasyAlign) diff --git a/vimperator/.vimperatorrc b/vimperator/.vimperatorrc deleted file mode 100644 index 1944fc6..0000000 --- a/vimperator/.vimperatorrc +++ /dev/null @@ -1,2 +0,0 @@ -highlight Hint font-size:100%;color:black;background-color:yellow;padding:2px;text-transform:uppercase; -set hintchars=uhetonasidcrpg diff --git a/w3m/.w3m/keymap b/w3m/.w3m/keymap deleted file mode 100644 index beaa644..0000000 --- a/w3m/.w3m/keymap +++ /dev/null @@ -1,27 +0,0 @@ -keymap f LIST_MENU -keymap o GOTO -keymap O OPTIONS -keymap gg BEGIN -keymap GG END -keymap zz CENTER_V -keymap ^ LINE_BEGIN -keymap $ LINE_END -keymap w NEXT_WORD -keymap b PREV_WORD - -keymap L NEXT -keymap H PREV - -keymap C-f NEXT_PAGE -keymap C-b PREV_PAGE - -keymap r RELOAD - -keymap q EXIT -keymap ZZ EXIT -keymap ZQ EXIT - -keymap d CLOSE_TAB -keymap gt NEXT_TAB -keymap gT PREV_TAB -keymap t TAB_GOTO diff --git a/zsh/.zsh/alias b/zsh/.zsh/alias index 1ad7711..5f6a856 100644 --- a/zsh/.zsh/alias +++ b/zsh/.zsh/alias @@ -1,8 +1,6 @@ #!/bin/zsh # Commands -alias c='clear' -alias ca='printf "\ec"' alias cdd='cd ~/dotfiles' # Programs @@ -15,6 +13,7 @@ alias n='nvim' alias ns='nvim -S Session.vim' alias v='vim' alias vs="vim -S Session.vim" +alias email="mbsync -a" # Git alias g='git' diff --git a/zsh/.zshrc b/zsh/.zshrc index 493978f..b709285 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -2,6 +2,14 @@ export PATH="${PATH}:$HOME/bin:/usr/lib/surfraw" export EDITOR=vim export HISTSIZE=1000000 + +source /home/urbain/.nix-profile/etc/profile.d/nix.sh + +# Guix stuff +export PATH="/home/urbain/.guix-profile/bin${PATH:+:}$PATH" +export GUIX_LOCPATH=$HOME/.guix-profile/lib/locale +alias p='guix package' + # Source configuration files source "$HOME/.zsh/plugins" source "$HOME/.zsh/functions" -- cgit v1.2.3