From cb34056f15cac6712a70d197508d894dd2d9035f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20K=C3=B6rber?= Date: Fri, 28 Dec 2018 18:19:00 +0100 Subject: [PATCH] Update --- _machines/notebook01.yml | 2 + _machines/tb-hak.yml | 10 ++++ autostart.sh | 115 +++++++++++++++++++++++++++++++++++++ autostart/10_cleanup.sh | 5 -- autostart/20_dunst.sh | 3 - autostart/20_screen.sh | 11 ---- autostart/20_xresources.sh | 4 -- autostart/30_keyboard.sh | 12 ---- autostart/30_touchpad.sh | 12 ---- autostart/40_wallpaper.sh | 6 -- autostart/50_bluetooth.sh | 4 -- autostart/50_network.sh | 4 -- autostart/50_pasystray.sh | 4 -- autostart/50_redshift.sh | 9 --- dotfiles.yml | 4 +- git/gitconfig.j2 | 13 ++++- i3/config.j2 | 29 +++++----- packages.yml | 26 ++++++++- playbook.yml | 5 +- vim/vimrc | 21 ++++++- x/xinitrc | 16 ++---- zsh/zprofile.j2 | 2 + zsh/zshrc.d/20_aliases.sh | 3 + 23 files changed, 214 insertions(+), 106 deletions(-) create mode 100755 autostart.sh delete mode 100755 autostart/10_cleanup.sh delete mode 100755 autostart/20_dunst.sh delete mode 100755 autostart/20_screen.sh delete mode 100755 autostart/20_xresources.sh delete mode 100755 autostart/30_keyboard.sh delete mode 100755 autostart/30_touchpad.sh delete mode 100755 autostart/40_wallpaper.sh delete mode 100755 autostart/50_bluetooth.sh delete mode 100755 autostart/50_network.sh delete mode 100755 autostart/50_pasystray.sh delete mode 100755 autostart/50_redshift.sh diff --git a/_machines/notebook01.yml b/_machines/notebook01.yml index 8068dcf..6c3276b 100644 --- a/_machines/notebook01.yml +++ b/_machines/notebook01.yml @@ -17,3 +17,5 @@ screen: 8: eDP-1 9: eDP-1 0: eDP-1 + +workspace: diff --git a/_machines/tb-hak.yml b/_machines/tb-hak.yml index 9231f2c..f5511cb 100644 --- a/_machines/tb-hak.yml +++ b/_machines/tb-hak.yml @@ -17,3 +17,13 @@ screen: 8: eDP-1 9: eDP-1 0: eDP-1 + +workspace: + 1: www + 2: www + 3: term-local + 4: term-remote + 7: time + 8: pass + 9: music + 10: pim diff --git a/autostart.sh b/autostart.sh new file mode 100755 index 0000000..19c2473 --- /dev/null +++ b/autostart.sh @@ -0,0 +1,115 @@ +#!/usr/bin/env bash + +set -o nounset +set -o xtrace + +run_raw() { + name="$1" + shift + + systemd-run \ + --user \ + --unit "${name}" \ + --no-block \ + --remain-after-exit \ + --setenv=DISPLAY=${DISPLAY} \ + "${@}" +} + +run() { + name="$1" + shift + + run_raw "$name" --property=Restart=always "${@}" +} + +run_oneshot_multiple() { + name="$1" + shift + + cmd=() + # hacky way to start two processes in oneshot mode + for c in "${@}" ; do + cmd+=(--property "ExecStart=/usr/bin/env ${c}") + done + cmd+=(true) + + echo $cmd + run_oneshot "$name" "${cmd[@]}" +} + +run_oneshot() { + name="$1" + shift + + run_raw "$name" --service-type=oneshot "${@}" +} + +schedule() { + name="$1"; shift + spec="$1"; shift + systemd-run \ + --user \ + --unit "${name}" \ + --no-block \ + --setenv=DISPLAY=${DISPLAY} \ + --on-calendar="${spec}" \ + "${@}" +} + + +# redshift settings +redshift_lat_long="49.5:11" +redshift_colortemp="6000:4000" + +# wallpaper config +wallpaper="$LIBDIR/wallpaper/current" + +# keyboard settings +keyboard_layout=de +keyboard_variant=nodeadkeys +keyboard_repeat_delay=150 +keyboard_repeat_speed=50 + +run_oneshot acpi bash -c 'grep "^${ACPI_LID_NAME}.*enabled" /proc/acpi/wakeup && echo " ${ACPI_LID_NAME}" | sudo tee /proc/acpi/wakeup' + +run_oneshot xresources xrdb -merge -I${HOME} ~/.Xresources + +run_oneshot_multiple keyboard \ + "setxkbmap -layout $keyboard_layout -variant $keyboard_variant" \ + "xset r rate $keyboard_repeat_delay $keyboard_repeat_speed" + +run_oneshot_multiple touchpad \ + "synclient VertEdgeScroll=0" \ + "synclient VertTwoFingerScroll=1" \ + "synclient MaxSpeed=2.2" \ + "synclient AccelFactor=0.08" \ + "synclient TapButton1=1" \ + "synclient CoastingSpeed=0" \ + "synclient PalmDetect=1" \ + "synclient PalmMinWidth=20" \ + "synclient PalmMinZ=180" + +run_oneshot pulseaudio start-pulseaudio-x11 --start --daemonize=false --fail=true --log-target=stderr + +# a service called dunst already exists and conflicts +run dunst_user dunst -config ~/.config/dunstrc + +# run compton compton --config ~/.config/compton.conf --backend glx --vsync opengl -CG -d :0 +# run xcompmgr xcompmgr + +run_oneshot feh --property=ExecStartPre="/bin/sleep 5" feh --bg-scale "${wallpaper}" + +run blueman blueman-applet + +run nm-applet nm-applet + +run pasystray pasystray + +run redshift redshift-gtk -b 1 -l "$redshift_lat_long" -t "$redshift_colortemp" + +run keepassx keepassx --keyfile ~/.secret/main.key ~/.secret/main.kdbx + +run spotify spotify + +schedule backup "Mon..Fri 12:00:00" ~/bin/gdrive-backup diff --git a/autostart/10_cleanup.sh b/autostart/10_cleanup.sh deleted file mode 100755 index 8e9bd9a..0000000 --- a/autostart/10_cleanup.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -set -o nounset - -find "$RUNDIR" -type f -name '*.pid' -delete diff --git a/autostart/20_dunst.sh b/autostart/20_dunst.sh deleted file mode 100755 index b8caffb..0000000 --- a/autostart/20_dunst.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -systemd-run --property=Restart=always --user --setenv=DISPLAY=${DISPLAY} dunst -config ~/.config/dunstrc & diff --git a/autostart/20_screen.sh b/autostart/20_screen.sh deleted file mode 100755 index e08d341..0000000 --- a/autostart/20_screen.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -printf '%s\n' "start compton" -systemd-run --property=Restart=always --user --setenv=DISPLAY=${DISPLAY} compton --backend xrender --vsync opengl & - -printf '%s\n' "disable screen blanking" -xset -dpms & -xset s off & - -printf '%s\n' "disable wakeup when lid switched" -grep "^${ACPI_LID_NAME}.*enabled" /proc/acpi/wakeup && echo " ${ACPI_LID_NAME}" | sudo tee /proc/acpi/wakeup diff --git a/autostart/20_xresources.sh b/autostart/20_xresources.sh deleted file mode 100755 index f55a194..0000000 --- a/autostart/20_xresources.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash - -printf '%s' "parsing .Xresources" -xrdb -merge -I${HOME} ~/.Xresources diff --git a/autostart/30_keyboard.sh b/autostart/30_keyboard.sh deleted file mode 100755 index a763bbd..0000000 --- a/autostart/30_keyboard.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash - -keyboard_layout=de -keyboard_variant=nodeadkeys -keyboard_repeat_delay=150 -keyboard_repeat_speed=50 - -printf '%s' "setting keyboard layout" >>"$LOGFILE" -setxkbmap -layout "$keyboard_layout" -variant "$keyboard_variant" & - -printf '%s' "setting key repeat delay" >>"$LOGFILE" -xset r rate "$keyboard_repeat_delay" "$keyboard_repeat_speed" & diff --git a/autostart/30_touchpad.sh b/autostart/30_touchpad.sh deleted file mode 100755 index 771fcf5..0000000 --- a/autostart/30_touchpad.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash - -printf '%s' "configuring synclient" -synclient VertEdgeScroll=0 -synclient VertTwoFingerScroll=1 -synclient MaxSpeed=2.2 -synclient AccelFactor=0.08 -synclient TapButton1=1 -synclient CoastingSpeed=0 -synclient PalmDetect=1 -synclient PalmMinWidth=20 -synclient PalmMinZ=180 diff --git a/autostart/40_wallpaper.sh b/autostart/40_wallpaper.sh deleted file mode 100755 index 9c79d40..0000000 --- a/autostart/40_wallpaper.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash - -wallpaper="$LIBDIR/wallpaper/current" - -printf '%s' "setting wallpaper" -systemd-run --property=Restart=always --user --setenv=DISPLAY=${DISPLAY} feh --bg-scale "${wallpaper}" diff --git a/autostart/50_bluetooth.sh b/autostart/50_bluetooth.sh deleted file mode 100755 index 38cbdad..0000000 --- a/autostart/50_bluetooth.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash - -printf '%s' "starting network tray application" -systemd-run --property=Restart=always --user --setenv=DISPLAY=${DISPLAY} blueman-applet diff --git a/autostart/50_network.sh b/autostart/50_network.sh deleted file mode 100755 index f4a31d8..0000000 --- a/autostart/50_network.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash - -printf '%s' "starting network tray application" -systemd-run --property=Restart=always --user --setenv=DISPLAY=${DISPLAY} nm-applet diff --git a/autostart/50_pasystray.sh b/autostart/50_pasystray.sh deleted file mode 100755 index 897c5c4..0000000 --- a/autostart/50_pasystray.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash - -printf '%s' "starting pasystray" -systemd-run --property=Restart=always --user --setenv=DISPLAY=${DISPLAY} pasystray diff --git a/autostart/50_redshift.sh b/autostart/50_redshift.sh deleted file mode 100755 index f11090a..0000000 --- a/autostart/50_redshift.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -# redshift settings -redshift_lat_long="49.5:11" -redshift_colortemp="6000:3300" - -printf '%s' "starting redshift-gtk" -systemd-run --property=Restart=always --user --setenv=DISPLAY=${DISPLAY} redshift-gtk -b 1 -l "$redshift_lat_long" -t "$redshift_colortemp" -printf '%s' $! > "$RUNDIR"/redshift.${XDG_SESSION_ID}.pid diff --git a/dotfiles.yml b/dotfiles.yml index 5d93c1f..c759ea8 100644 --- a/dotfiles.yml +++ b/dotfiles.yml @@ -1,8 +1,8 @@ empty_directories: - .i3 dotfiles: - - from: autostart - to: .autostart + - from: autostart.sh + to: .autostart.sh - from: git/gitconfig to: .gitconfig template: true diff --git a/git/gitconfig.j2 b/git/gitconfig.j2 index 040738e..13d777a 100644 --- a/git/gitconfig.j2 +++ b/git/gitconfig.j2 @@ -15,7 +15,7 @@ fe = "fetch --all --prune" co = "checkout" - cm = "commit --message" + cm = "!f() { git commit --message \"$*\" ; };f" ci = "commit" st = "status" br = "branch" @@ -46,6 +46,17 @@ drop = !git rebase --onto $1^ -- + up = !git pull --rebase --prune $@ && git submodule update --init --recursive && git branch-clean + + save = "!f() { set -x ; if ! [ $1 ]; then echo 'usage: git save '; return 1; fi; git add -A && git commit -m 'SAVEPOINT' && git branch save-$1 && git reset --hard HEAD~1; };f" + ;save = !f(){echo "x$1x" && test -n $1 && echo "wat $?" && }; echo x$1x ; f() + anchor = "!f() { if ! [ $1 ]; then echo 'usage: git anchor '; return 1; fi; git branch anchor-$1 ; };f" + load = reset HEAD~1 --mixed + amend = commit -a --amend + wipe = !git add -A && git commit -m 'WIPE SAVEPOINT' && git reset HEAD~1 --hard + + exec = "!exec " + [core] fileMode = true whitespace = "blank-at-eol,space-before-tab,blank-at-eof" diff --git a/i3/config.j2 b/i3/config.j2 index 2fafba0..367c694 100644 --- a/i3/config.j2 +++ b/i3/config.j2 @@ -37,16 +37,16 @@ set $signal_reboot reboot set $signal_shutdown shutdown - set $workspace1 1 - set $workspace2 2 - set $workspace3 3 - set $workspace4 4 - set $workspace5 5 - set $workspace6 6 - set $workspace7 7 - set $workspace8 8 - set $workspace9 9 - set $workspace10 10 + set $workspace1 "1{{ "" if machine.workspace.1 is not defined else ': ' ~ machine.workspace.1 }}" + set $workspace2 "2{{ "" if machine.workspace.2 is not defined else ': ' ~ machine.workspace.2 }}" + set $workspace3 "3{{ "" if machine.workspace.3 is not defined else ': ' ~ machine.workspace.3 }}" + set $workspace4 "4{{ "" if machine.workspace.4 is not defined else ': ' ~ machine.workspace.4 }}" + set $workspace5 "5{{ "" if machine.workspace.5 is not defined else ': ' ~ machine.workspace.5 }}" + set $workspace6 "6{{ "" if machine.workspace.6 is not defined else ': ' ~ machine.workspace.6 }}" + set $workspace7 "7{{ "" if machine.workspace.7 is not defined else ': ' ~ machine.workspace.7 }}" + set $workspace8 "8{{ "" if machine.workspace.8 is not defined else ': ' ~ machine.workspace.8 }}" + set $workspace9 "9{{ "" if machine.workspace.9 is not defined else ': ' ~ machine.workspace.9 }}" + set $workspace10 "10{{ "" if machine.workspace.10 is not defined else ': ' ~ machine.workspace.10 }}" set $key_workspace1 1 set $key_workspace2 2 @@ -110,6 +110,7 @@ workspace $workspace9 output {{ machine.screen.9 }} workspace $workspace10 output {{ machine.screen.0 }} assign [class="^Keepassx$"] $workspace8 +assign [class="^Spotify$"] $workspace9 ################################################################################ ### KEYBINDINGS ################################################################ @@ -210,16 +211,16 @@ assign [class="^Keepassx$"] $workspace8 bindsym $mod+$scratchpad scratchpad show bindsym $mod+$pim_toggle \ + unmark pim_toggle; \ workspace $workspace10; \ mark --add pim_toggle; \ workspace $workspace1; \ move container to workspace $workspace10; \ - [con_mark="pim_toggle"] focus; \ + [con_mark="^pim_toggle$"] focus; \ move container to workspace $workspace1; \ workspace $workspace1; \ - [con_mark="pim_toggle"] focus - - # bindsym $mod+$swap workspace $workspace1; move container to workspace $workspace10; workspace $workspace10; move container to workspace $workspace1; workspace $workspace1; + [con_mark="^pim_toggle$"] focus; \ + unmark pim_toggle; ################################################################################ ### MODES ###################################################################### diff --git a/packages.yml b/packages.yml index 35bcb54..93a4a28 100644 --- a/packages.yml +++ b/packages.yml @@ -165,7 +165,7 @@ packages: ubuntu: ["xcompmgr"] python: fedora: ["python"] - ubuntu: ["python3", "python3-pip", "python3-venv", "virtualenv"] + ubuntu: ["python3", "python3-pip", "python3-venv", "virtualenv", "pylint3"] xbacklight: fedora: ["xbacklight"] ubuntu: ["xbacklight"] @@ -268,3 +268,27 @@ packages: bluetooth: fedora: [] ubuntu: ["blueman"] + autorandr: + fedora: [] + ubuntu: ["autorandr"] + bwm-ng: + fedora: [] + ubuntu: ["bwm-ng"] + virtualbox: + fedora: [] + ubuntu: ["virtualbox"] + sshfs: + fedora: [] + ubuntu: ["sshfs"] + expect: + fedora: [] + ubuntu: ["expect"] + pluma: + fedora: [] + ubuntu: ["pluma"] + inotify: + fedora: [] + ubuntu: ["inotify-tools"] + rclone: + fedora: ["rclone"] + ubuntu: ["rclone"] diff --git a/playbook.yml b/playbook.yml index 7c1dbf3..c63a68f 100644 --- a/playbook.yml +++ b/playbook.yml @@ -73,7 +73,8 @@ state: stopped enabled: false name: "{{ item }}" - with_items: [] + with_items: + - ssh become: true - name: enable services @@ -83,6 +84,8 @@ name: "{{ item }}" with_items: - NetworkManager + - docker + - libvirtd become: true - name: set groups for fedora diff --git a/vim/vimrc b/vim/vimrc index 2dd788a..160a722 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -16,7 +16,7 @@ Plug 'saltstack/salt-vim' Plug 'sickill/vim-monokai' " Plug 'sjl/gundo.vim' Plug 'tpope/vim-commentary' -" Plug 'tpope/vim-fugitive' +Plug 'tpope/vim-fugitive' " Plug 'tpope/vim-speeddating' " Plug 'tpope/vim-surround' Plug 'airblade/vim-gitgutter' @@ -250,8 +250,27 @@ let g:tagbar_foldlevel = 99 " unfold all let g:lightline = { \ 'colorscheme': 'powerline', + \ 'active': { + \ 'left': [ [ 'mode', 'paste' ], + \ [ 'readonly', 'filename', 'modified', 'helloworld' ] ], + \ 'right': [ [ 'gitbranch' ], + \ [ 'lineinfo' ], + \ [ 'percent' ], + \ [ 'fileformat', 'fileencoding', 'filetype', 'charvaluehex' ], + \ [ 'directory' ] ], + \ }, + \ 'component_function': { + \ 'gitbranch': 'fugitive#head', + \ 'directory': 'LightLineFilename', + \ }, + \ 'component': { + \ }, \ } +function! LightLineFilename() + return fnamemodify(expand('%F'), ":~:h") +endfunction + " == pencil == let g:pencil#textwidth = 80 let g:pencil#autoformat = 1 diff --git a/x/xinitrc b/x/xinitrc index 5bdbcc9..a496e5e 100644 --- a/x/xinitrc +++ b/x/xinitrc @@ -19,23 +19,15 @@ fi start_wm() { log "starting i3" exec i3 -c "$HOME/.i3/config" >> "$LOGDIR/i3/i3.log" + # exec systemd-run --user --unit i3_user --pty --setenv=DISPLAY=${DISPLAY} 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" >>"${LOGFILE}" 2>&1 - fi - done - fi + autostart="$HOME/.autostart.sh" + log "Executing autostart file \"$autostart\"" + "$autostart" >>"${LOGFILE}" 2>&1 } exec >> "$LOGFILE" 2>&1 -set -x -log "the" autostart -log "fuck" start_wm diff --git a/zsh/zprofile.j2 b/zsh/zprofile.j2 index d7f3ed8..072564f 100644 --- a/zsh/zprofile.j2 +++ b/zsh/zprofile.j2 @@ -43,6 +43,8 @@ export PATH=$PATH:$(go env GOPATH)/bin export ACPI_LID_NAME=LID +umask 0022 + # 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 c4919cc..8c811dc 100644 --- a/zsh/zshrc.d/20_aliases.sh +++ b/zsh/zshrc.d/20_aliases.sh @@ -82,6 +82,9 @@ alias issh="ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" alias newpw="pwgen --secure 25 1" +alias sys="systemctl" +alias sysu="systemctl --user" + gitmaster() { git stash push -m gitmaster-$(date -uIseconds) -u || return 1 _branch=$(git rev-parse --abbrev-ref HEAD)