From f2b18aab5a84d04a36f4194473680ad70bdb5578 Mon Sep 17 00:00:00 2001 From: Peter Son Struschka Date: Sun, 2 Feb 2020 12:50:32 +0800 Subject: script to find and edit config files --- Makefile | 9 +- basics/.bin/battery-monitor | 41 -- basics/.config/alacritty/alacritty.yml | 9 - basics/.local/bin/battery-monitor | 41 ++ basics/.local/bin/edit-config | 6 + basics/.local/bin/locate-config | 24 + basics/.local/share/config-files/alacritty | 1 + basics/.local/share/config-files/dotfiles | 1 + basics/.local/share/config-files/dunst | 1 + basics/.local/share/config-files/kitty | 1 + basics/.local/share/config-files/ranger | 1 + basics/.local/share/config-files/rofi | 1 + bspwm/.config/bspwm/bspwmrc | 31 + bspwm/.config/polybar/config | 637 +++++++++++++++++++++ bspwm/.config/polybar/launch.sh | 19 + bspwm/.config/polybar/task_polybar.sh | 7 + bspwm/.config/sxhkd/sxhkdrc | 146 +++++ bspwm/.local/bin/rofi_goto_workspace | 4 + bspwm/.local/bin/rofi_moveto_workspace | 4 + bspwm/.local/bin/rofi_workspace_prompt | 3 + bspwm/.local/bin/scratch | 3 + bspwm/.local/bin/spotifycl | 207 +++++++ bspwm/.local/share/config-files/bspwm | 1 + bspwm/.local/share/config-files/polybar | 1 + bspwm/.local/share/config-files/sxhkd | 1 + bspwm/.local/share/images/wallpaper.jpg | Bin 0 -> 651668 bytes bspwm/.local/share/lock/lock.png | Bin 0 -> 3959 bytes bspwm/.local/share/lock/rick_lock.png | Bin 0 -> 113100 bytes bspwm/.local/share/scripts/lock.sh | 15 + doom-emacs/.doom.d/config.el | 50 +- doom-emacs/.doom.d/config.org | 50 +- doom-emacs/.doom.d/init.el | 38 +- doom-emacs/.emacs.d | 2 +- doom-emacs/.local/bin/doom | 1 + doom-emacs/.local/bin/org-capture | 1 + doom-emacs/.local/bin/org-tangle | 1 + .../.local/share/config-files/doom-emacs_config | 1 + .../.local/share/config-files/doom-emacs_init | 1 + git/.gitconfig | 7 +- i3wm/.bin/rofiworkspace | 4 - i3wm/.bin/spotifycl | 207 ------- i3wm/.config/i3/config | 10 +- i3wm/.config/polybar/config | 10 +- i3wm/.local/bin/lock.sh | 15 + i3wm/.local/bin/rofi_goto_workspace | 4 + i3wm/.local/bin/rofi_moveto_workspace | 4 + i3wm/.local/bin/rofi_workspace_prompt | 3 + i3wm/.local/bin/spotifycl | 207 +++++++ i3wm/.local/share/config-files/i3 | 1 + i3wm/.local/share/config-files/polybar | 1 + i3wm/.local/share/images/lock.png | Bin 0 -> 3959 bytes i3wm/.local/share/images/rick_lock.png | Bin 0 -> 113100 bytes i3wm/.local/share/images/wallpaper.jpg | Bin 0 -> 651668 bytes i3wm/.lock.png | Bin 3959 -> 0 bytes i3wm/.lock.sh | 15 - i3wm/.rick_lock.png | Bin 113100 -> 0 bytes i3wm/.wallpaper.jpg | Bin 651668 -> 0 bytes meta/bspwm_deps | 11 + vim/.local/share/config-files/vim | 1 + x/.local/share/config-files/xinit | 1 + x/.xinitrc | 1 + zsh/.local/share/config-files/zprofile | 1 + zsh/.local/share/config-files/zshrc | 1 + zsh/.zprofile | 15 +- zsh/.zshrc | 65 +-- 65 files changed, 1549 insertions(+), 395 deletions(-) delete mode 100755 basics/.bin/battery-monitor create mode 100755 basics/.local/bin/battery-monitor create mode 100755 basics/.local/bin/edit-config create mode 100755 basics/.local/bin/locate-config create mode 120000 basics/.local/share/config-files/alacritty create mode 120000 basics/.local/share/config-files/dotfiles create mode 120000 basics/.local/share/config-files/dunst create mode 120000 basics/.local/share/config-files/kitty create mode 120000 basics/.local/share/config-files/ranger create mode 120000 basics/.local/share/config-files/rofi create mode 100755 bspwm/.config/bspwm/bspwmrc create mode 100644 bspwm/.config/polybar/config create mode 100755 bspwm/.config/polybar/launch.sh create mode 100755 bspwm/.config/polybar/task_polybar.sh create mode 100644 bspwm/.config/sxhkd/sxhkdrc create mode 100755 bspwm/.local/bin/rofi_goto_workspace create mode 100755 bspwm/.local/bin/rofi_moveto_workspace create mode 100755 bspwm/.local/bin/rofi_workspace_prompt create mode 100755 bspwm/.local/bin/scratch create mode 100755 bspwm/.local/bin/spotifycl create mode 120000 bspwm/.local/share/config-files/bspwm create mode 120000 bspwm/.local/share/config-files/polybar create mode 120000 bspwm/.local/share/config-files/sxhkd create mode 100644 bspwm/.local/share/images/wallpaper.jpg create mode 100644 bspwm/.local/share/lock/lock.png create mode 100644 bspwm/.local/share/lock/rick_lock.png create mode 100755 bspwm/.local/share/scripts/lock.sh create mode 120000 doom-emacs/.local/bin/doom create mode 120000 doom-emacs/.local/bin/org-capture create mode 120000 doom-emacs/.local/bin/org-tangle create mode 120000 doom-emacs/.local/share/config-files/doom-emacs_config create mode 120000 doom-emacs/.local/share/config-files/doom-emacs_init delete mode 100755 i3wm/.bin/rofiworkspace delete mode 100755 i3wm/.bin/spotifycl create mode 100755 i3wm/.local/bin/lock.sh create mode 100755 i3wm/.local/bin/rofi_goto_workspace create mode 100755 i3wm/.local/bin/rofi_moveto_workspace create mode 100755 i3wm/.local/bin/rofi_workspace_prompt create mode 100755 i3wm/.local/bin/spotifycl create mode 120000 i3wm/.local/share/config-files/i3 create mode 120000 i3wm/.local/share/config-files/polybar create mode 100644 i3wm/.local/share/images/lock.png create mode 100644 i3wm/.local/share/images/rick_lock.png create mode 100644 i3wm/.local/share/images/wallpaper.jpg delete mode 100644 i3wm/.lock.png delete mode 100755 i3wm/.lock.sh delete mode 100644 i3wm/.rick_lock.png delete mode 100644 i3wm/.wallpaper.jpg create mode 100644 meta/bspwm_deps create mode 120000 vim/.local/share/config-files/vim create mode 120000 x/.local/share/config-files/xinit create mode 120000 zsh/.local/share/config-files/zprofile create mode 120000 zsh/.local/share/config-files/zshrc diff --git a/Makefile b/Makefile index db572f7..e9ff619 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -all_files := basics emacs spacemacs doom-emacs git i3wm vim nvim tmux x zsh fish +all_files := basics emacs spacemacs doom-emacs git i3wm bspwm vim nvim tmux x zsh fish simple_files := emacs spacemacs doom-emacs vim x zsh fish @@ -12,12 +12,19 @@ $(simple_files): basics: yay yay -Q - < meta/basic_deps || yay -S --needed - < meta/basic_deps stow -t ~ $@ + git: pacman -Q git || sudo pacman -S git stow -t ~ $@ + i3wm: yay pacman -Q - < meta/i3wm_deps || yay -S --needed - < meta/i3wm_deps stow -t ~ $@ + +bspwm: yay + pacman -Q - < meta/bspwm_deps || yay -S --needed - < meta/bspwm_deps + stow -t ~ $@ + yay: git pacman -Q yay || (git clone aur:yay && pushd yay && makepkg -si && popd) diff --git a/basics/.bin/battery-monitor b/basics/.bin/battery-monitor deleted file mode 100755 index ff1ef8b..0000000 --- a/basics/.bin/battery-monitor +++ /dev/null @@ -1,41 +0,0 @@ -battery_level=`acpi -b | cut -d ' ' -f 4 | grep -o '[0-9]*'` -battery_state=$(acpi | grep 'Battery' | sed 's/Battery\s[0-9]*: //' | sed 's/, [0-9][0-9]*\%.*//') -battery_remaining=$(acpi | grep -oh '[0-9:]* remaining' | sed 's/:\w\w remaining$/ Minutes/' | sed 's/00://' | sed 's/:/h /') - -if [ ! -f "/tmp/.battery" ]; then - echo "$battery_level" > /tmp/.battery - echo "$battery_state" >> /tmp/.battery - exit -fi - -previous_battery_level=$(cat /tmp/.battery | head -n 1) -previous_battery_state=$(cat /tmp/.battery | tail -n 1) -echo "$battery_level" > /tmp/.battery -echo "$battery_state" >> /tmp/.battery - -checkBatteryLevel() { - if [ $battery_state != "Discharging" ] || [ "${battery_level}" == "${previous_battery_level}" ]; then - exit - fi - - if [ $battery_level -le 3 ]; then - sudo systemctl suspend - elif [ $battery_level -le 5 ]; then - notify-send "Low Battery" "Your computer will suspend soon unless plugged into a power outlet." -u critical - elif [ $battery_level -le 10 ]; then - notify-send "Low Battery" "${battery_level}% (${battery_remaining}) of battery remaining." -u normal - fi -} - -checkBatteryStateChange() { - if [ "$battery_state" != "Discharging" ] && [ "$previous_battery_state" == "Discharging" ]; then - notify-send "Charging" "Battery is now plugged in." -u low - fi - - if [ "$battery_state" == "Discharging" ] && [ "$previous_battery_state" != "Discharging" ]; then - notify-send "Power Unplugged" "Your computer has been disconnected from power." -u low - fi -} - -checkBatteryStateChange -checkBatteryLevel \ No newline at end of file diff --git a/basics/.config/alacritty/alacritty.yml b/basics/.config/alacritty/alacritty.yml index 8c2ad85..aba774a 100644 --- a/basics/.config/alacritty/alacritty.yml +++ b/basics/.config/alacritty/alacritty.yml @@ -59,15 +59,6 @@ scrolling: # scrollback is enabled (history > 0). multiplier: 3 - # Faux Scrolling - # - # The `faux_multiplier` setting controls the number of lines the terminal - # should scroll when the alternate screen buffer is active. This is used - # to allow mouse scrolling for applications like `man`. - # - # Specifying `0` will disable faux scrolling. - faux_multiplier: 3 - # Scroll to the bottom when new text is written to the terminal. auto_scroll: false diff --git a/basics/.local/bin/battery-monitor b/basics/.local/bin/battery-monitor new file mode 100755 index 0000000..ff1ef8b --- /dev/null +++ b/basics/.local/bin/battery-monitor @@ -0,0 +1,41 @@ +battery_level=`acpi -b | cut -d ' ' -f 4 | grep -o '[0-9]*'` +battery_state=$(acpi | grep 'Battery' | sed 's/Battery\s[0-9]*: //' | sed 's/, [0-9][0-9]*\%.*//') +battery_remaining=$(acpi | grep -oh '[0-9:]* remaining' | sed 's/:\w\w remaining$/ Minutes/' | sed 's/00://' | sed 's/:/h /') + +if [ ! -f "/tmp/.battery" ]; then + echo "$battery_level" > /tmp/.battery + echo "$battery_state" >> /tmp/.battery + exit +fi + +previous_battery_level=$(cat /tmp/.battery | head -n 1) +previous_battery_state=$(cat /tmp/.battery | tail -n 1) +echo "$battery_level" > /tmp/.battery +echo "$battery_state" >> /tmp/.battery + +checkBatteryLevel() { + if [ $battery_state != "Discharging" ] || [ "${battery_level}" == "${previous_battery_level}" ]; then + exit + fi + + if [ $battery_level -le 3 ]; then + sudo systemctl suspend + elif [ $battery_level -le 5 ]; then + notify-send "Low Battery" "Your computer will suspend soon unless plugged into a power outlet." -u critical + elif [ $battery_level -le 10 ]; then + notify-send "Low Battery" "${battery_level}% (${battery_remaining}) of battery remaining." -u normal + fi +} + +checkBatteryStateChange() { + if [ "$battery_state" != "Discharging" ] && [ "$previous_battery_state" == "Discharging" ]; then + notify-send "Charging" "Battery is now plugged in." -u low + fi + + if [ "$battery_state" == "Discharging" ] && [ "$previous_battery_state" != "Discharging" ]; then + notify-send "Power Unplugged" "Your computer has been disconnected from power." -u low + fi +} + +checkBatteryStateChange +checkBatteryLevel \ No newline at end of file diff --git a/basics/.local/bin/edit-config b/basics/.local/bin/edit-config new file mode 100755 index 0000000..7d1baae --- /dev/null +++ b/basics/.local/bin/edit-config @@ -0,0 +1,6 @@ +#/bin/sh + +FILE=$(locate-config) +[ -z "$FILE" ] && exit 1 + +$EDITOR $FILE diff --git a/basics/.local/bin/locate-config b/basics/.local/bin/locate-config new file mode 100755 index 0000000..d798a39 --- /dev/null +++ b/basics/.local/bin/locate-config @@ -0,0 +1,24 @@ +#! /usr/bin/env bash + +set -e + +CONFIG_FILES=`ls -1 ~/.local/share/config-files | cut -d "" -f 1 | sort -d` +CONFIG_ARRAY=(`find ~/.local/share/config-files/ -maxdepth 1 -mindepth 1 -print0 | sort -z | xargs -r0 echo`) + +INDEX=`echo "$CONFIG_FILES" | rofi -dmenu -format "i" -no-custom -mesg "Find config file for..."` +[ -z "$INDEX" ] && exit 1 +SOURCE=${CONFIG_ARRAY[$INDEX]} +#echo "$CONFIG_FILES" +#for item in ${CONFIG_ARRAY[*]} +#do +# printf " %s\n" $item +#done +# (https://stackoverflow.com/questions/59895/get-the-source-directory-of-a-bash-script-from-within-the-script-itself) +while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink + DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )" + SOURCE="$(readlink "$SOURCE")" + [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located +done +DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )" + +echo $SOURCE diff --git a/basics/.local/share/config-files/alacritty b/basics/.local/share/config-files/alacritty new file mode 120000 index 0000000..2f6fb52 --- /dev/null +++ b/basics/.local/share/config-files/alacritty @@ -0,0 +1 @@ +../../../.config/alacritty/alacritty.yml \ No newline at end of file diff --git a/basics/.local/share/config-files/dotfiles b/basics/.local/share/config-files/dotfiles new file mode 120000 index 0000000..11a54ed --- /dev/null +++ b/basics/.local/share/config-files/dotfiles @@ -0,0 +1 @@ +../../../../ \ No newline at end of file diff --git a/basics/.local/share/config-files/dunst b/basics/.local/share/config-files/dunst new file mode 120000 index 0000000..0faa1f8 --- /dev/null +++ b/basics/.local/share/config-files/dunst @@ -0,0 +1 @@ +../../../.config/dunst/dunstrc \ No newline at end of file diff --git a/basics/.local/share/config-files/kitty b/basics/.local/share/config-files/kitty new file mode 120000 index 0000000..71c3f1a --- /dev/null +++ b/basics/.local/share/config-files/kitty @@ -0,0 +1 @@ +../../../.config/kitty/kitty.conf \ No newline at end of file diff --git a/basics/.local/share/config-files/ranger b/basics/.local/share/config-files/ranger new file mode 120000 index 0000000..5ecd95a --- /dev/null +++ b/basics/.local/share/config-files/ranger @@ -0,0 +1 @@ +../../../.config/ranger/rc.conf \ No newline at end of file diff --git a/basics/.local/share/config-files/rofi b/basics/.local/share/config-files/rofi new file mode 120000 index 0000000..2695e7e --- /dev/null +++ b/basics/.local/share/config-files/rofi @@ -0,0 +1 @@ +../../../.config/rofi/config \ No newline at end of file diff --git a/bspwm/.config/bspwm/bspwmrc b/bspwm/.config/bspwm/bspwmrc new file mode 100755 index 0000000..b514a7a --- /dev/null +++ b/bspwm/.config/bspwm/bspwmrc @@ -0,0 +1,31 @@ +#! /bin/sh + +# reset polybar +$HOME/.config/polybar/launch.sh & + +# Autostart +[[ ! $(pidof -x sxhkd) ]] && sxhkd & +[[ ! $(pidof -x compton) ]] && compton & +[[ ! $(pidof -x nm-applet) ]] && nm-applet & +[[ ! $(pidof -x feh ) ]] && feh --bg-scale "$HOME/.local/share/images/wallpaper.jpg" & + +# locker +[[ ! $(pidof -x xautolock) ]] && xautolock -locker "$HOME/.local/share/scripts/lock.sh" -time 60 -detectsleep -notify 10 & + +bspc monitor -d I II III IV V VI VII VIII IX X + +bspc config border_width 2 +bspc config window_gap 12 + +bspc config split_ratio 0.52 +bspc config borderless_monocle true +bspc config gapless_monocle true + +bspc rule -a Gimp desktop='^8' state=floating follow=on +bspc rule -a Chromium desktop='^2' +bspc rule -a mplayer2 state=floating +bspc rule -a Kupfer.py focus=on +bspc rule -a Screenkey manage=off + +bspc rule -a scratchpad sticky=on state=floating hidden=on +alacritty --class scratchpad,scratchpad -e ~/code/dotfiles/bspwm/.bin/scratch & diff --git a/bspwm/.config/polybar/config b/bspwm/.config/polybar/config new file mode 100644 index 0000000..05d6334 --- /dev/null +++ b/bspwm/.config/polybar/config @@ -0,0 +1,637 @@ +;========================================================== +; +; +; ██████╗ ██████╗ ██╗ ██╗ ██╗██████╗ █████╗ ██████╗ +; ██╔══██╗██╔═══██╗██║ ╚██╗ ██╔╝██╔══██╗██╔══██╗██╔══██╗ +; ██████╔╝██║ ██║██║ ╚████╔╝ ██████╔╝███████║██████╔╝ +; ██╔═══╝ ██║ ██║██║ ╚██╔╝ ██╔══██╗██╔══██║██╔══██╗ +; ██║ ╚██████╔╝███████╗██║ ██████╔╝██║ ██║██║ ██║ +; ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ +; +; +; 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 = #222 +background-alt = #444 +;foreground = ${xrdb:color7:#222} +foreground = #dfdfdf +foreground-alt = #555 +primary = #ffb52a +secondary = #e60053 +alert = #bd2c40 + +[bar/topbar] +monitor = ${env:MONITOR:eDP-1} +width = 100% +height = 40 +dpi = 96 +;offset-x = 1% +;offset-y = 1% +radius = 6.0 +fixed-center = false + +background = ${colors.background} +foreground = ${colors.foreground} + +line-size = 3 +line-color = #f00 + +border-size = 10 +border-bottom-size = 0 +border-color = #00000000 + +padding-left = 2 +padding-right = 2 + +font-0 = fixed:pixelsize=10;1 +font-1 = unifont:fontformat=truetype:size=8:antialias=false;0 +font-2 = siji:pixelsize=10;1 +font-3 = "Font Awesome 5 Brands:style=Regular:pixelsize=8;1" +font-4 = "Font Awesome 5 Free:style=Regular:pixelsize=8;1" +font-5 = "Font Awesome 5 Free:style=Solid:pixelsize=8;1" + +tray-position = right +tray-padding = 2 +;tray-transparent = true +;tray-background = #0063ff +tray-scale = 1 +tray-detached = false + +wm-restack = bspwm +override-redirect = false + +scroll-up = bspwm-desknext +scroll-down = bspwm-deskprev +cursor-click = pointer +cursor-scroll = ns-resize + +module-margin-left = 2 +module-margin-right = 2 +modules-left = hostname xwindow +modules-center = +modules-right = filesystem backlight pulseaudio xkeyboard memory cpu wlan eth ethvpn battery temperature + +[bar/topbar-second] +monitor = ${env:MONITOR:eDP-1} +width = 100% +height = 40 +dpi = 96 +;offset-x = 1% +offset-y = 50 +radius = 6.0 +fixed-center = true + +background = ${colors.background} +foreground = ${colors.foreground} + +line-size = 3 +line-color = #f00 + +border-size = 10 +border-top-size = 0 +border-bottom-size = 0 +border-color = #00000000 + +padding-left = 2 +padding-right = 2 + +font-0 = fixed:pixelsize=10;1 +font-1 = unifont:fontformat=truetype:size=8:antialias=false;0 +font-2 = siji:pixelsize=10;1 +font-3 = "Font Awesome 5 Brands:style=Regular:pixelsize=8;1" +font-4 = "Font Awesome 5 Free:style=Regular:pixelsize=8;1" +font-5 = "Font Awesome 5 Free:style=Solid:pixelsize=8;1" + +wm-restack = bspwm +override-redirect = false + +scroll-up = bspwm-desknext +scroll-down = bspwm-deskprev +cursor-click = pointer +cursor-scroll = ns-resize + +module-margin-left = 2 +module-margin-right = 2 +modules-left = bspwm +modules-center = spotify +modules-right = taskwarrior date + +[module/hostname] +type = custom/script +interval = 256 +format = "