From fcdd8272618d5474f621ca2502a54c853dbef7ba Mon Sep 17 00:00:00 2001 From: Quentin Duchemin Date: Thu, 14 Nov 2019 15:35:59 +0100 Subject: [PATCH] i3 configuration merge for different environments Also, init_config will copy external configuration files only if they have been changed. It is also now capable of deleting existing files is they have been deleted on the repo --- .config/ardour5/config | 214 -------------------- .config/i3/config.d/desk | 45 +++++ .config/i3/config.d/laptop | 42 ++++ .config/i3/config.laptop | 224 --------------------- .config/i3/{config.desk => config_common} | 229 ++++++++++------------ .init_config.sh | 34 +++- 6 files changed, 221 insertions(+), 567 deletions(-) delete mode 100644 .config/ardour5/config create mode 100644 .config/i3/config.d/desk create mode 100644 .config/i3/config.d/laptop delete mode 100644 .config/i3/config.laptop rename .config/i3/{config.desk => config_common} (57%) diff --git a/.config/ardour5/config b/.config/ardour5/config deleted file mode 100644 index 46c48b5..0000000 --- a/.config/ardour5/config +++ /dev/null @@ -1,214 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.config/i3/config.d/desk b/.config/i3/config.d/desk new file mode 100644 index 0000000..eac767f --- /dev/null +++ b/.config/i3/config.d/desk @@ -0,0 +1,45 @@ +################################## +# STARTING CONFIGURATION +################################## + +# ALSA key binding (media keys do not even have keycode...) +bindsym XF86AudioRaiseVolume exec --no-startup-id amixer -D hw:PCH -M sset Master 5%+ +bindsym XF86AudioLowerVolume exec --no-startup-id amixer -D hw:PCH -M sset Master 5%- +bindsym KP_Multiply exec --no-startup-id amixer set 'Master' toggle +bindsym XF86AudioPlay exec --no-startup-id playerctl play-pause +bindsym XF86AudioPrev exec --no-startup-ip playerctl prev +bindsym XF86AudioNext exec --no-startup-id playerctl next + +################################## +# PROGRAMS STARTED AUTOMATICALLY +################################## + +# cadence will take care of all we need : +# - Config tells Cadence to start LADISH, export MIDI hw and start A2J ; +# - LADISH implies JACK starts, then it will starts needed apps (e.g. Non-Mixer) +exec --no-startup-id cadence-session-start --start +exec --no-startup-id catia + +# automate port mapping for applications +exec --no-startup-id jack-matchmaker -p ~/.config/jack-matchmaker/patterns + +# set mouse acceleration +exec --no-startup-id xinput set-prop 'pointer:Razer Razer DeathAdder Chroma' --type=float 'libinput Accel Speed' -.4 + +################################## +# BINDINGS FOR STARTING PROGRAMS +################################## + +################################## +# BINDINGS FOR STANDARD OPERATIONS +################################## + +################################## +# OPERATIONS FOR SPECIFIC WINDOWS +################################## + +# scratchpad +for_window [class="Non-Mixer"] mark "mixer", move scratchpad +for_window [class="Catia*"] mark "jack", move scratchpad +bindsym $mod+Shift+j [con_mark="jack"] scratchpad show +bindsym $mod+Shift+m [con_mark="mixer"] scratchpad show diff --git a/.config/i3/config.d/laptop b/.config/i3/config.d/laptop new file mode 100644 index 0000000..167bad4 --- /dev/null +++ b/.config/i3/config.d/laptop @@ -0,0 +1,42 @@ +################################## +# STARTING CONFIGURATION +################################## + +# alterning workspace between each screen +workspace 1 output DVI-D-0 +workspace 2 output HDMI-0 +workspace 3 output DVI-D-0 +workspace 4 output HDMI-0 +workspace 5 output DVI-D-0 +workspace 6 output HDMI-0 + +# ALSA keybinding +bindsym XF86AudioRaiseVolume exec --no-startup-id amixer -D hw:PCH -M sset Master 5%+ +bindsym XF86AudioLowerVolume exec --no-startup-id aimxer -D hw:PCH -M sset Master 5%- +bindsym XF86AudioMute exec --no-startup-id amixer -D hw:PCH -M sset 'Master' toggle +bindsym XF86AudioPlay exec --no-startup-id playerctl play-pause +bindsym XF86AudioPrev exec --no-startup-ip playerctl prev +bindsym XF86AudioNext exec --no-startup-id playerctl next + +# set DPI along with .Xresources +exec xrandr --dpi 160 + +################################## +# PROGRAMS STARTED AUTOMATICALLY +################################## + +# set mouse acceleration +exec --no-startup-id xinput set-prop 'FocalTechPS/2 FocalTech Touchpad' 'libinput Accel Speed' 0.8 +exec --no-startup-id xinput set-prop 'Microsoft Microsoft 3-Button Mouse with IntelliEye(TM)' 'libinput Accel Speed' 0.8 + +################################## +# BINDINGS FOR STARTING PROGRAMS +################################## + +################################## +# BINDINGS FOR STANDARD OPERATIONS +################################## + +################################## +# OPERATIONS FOR SPECIFIC WINDOWS +################################## diff --git a/.config/i3/config.laptop b/.config/i3/config.laptop deleted file mode 100644 index dc6da25..0000000 --- a/.config/i3/config.laptop +++ /dev/null @@ -1,224 +0,0 @@ -# This file has been auto-generated by i3-config-wizard(1). -# It will not be overwritten, so edit it as you like. -# -# Should you change your keyboard layout some time, delete -# this file and re-run i3-config-wizard(1). -# - -# i3 config file (v4) -# -# Please see https://i3wm.org/docs/userguide.html for a complete reference! - -set $mod Mod1 - -# Font for window titles. Will also be used by the bar unless a different font -# is used in the bar {} block below. -font pango:Roboto, Bold 10 - -# Use Mouse+$mod to drag floating windows to their wanted position -floating_modifier $mod - -# start a terminal -bindsym $mod+Return exec i3-sensible-terminal - -# kill focused window -bindsym $mod+q kill - -# start dmenu (a program launcher) -bindsym $mod+d exec rofi -show run -theme sidebar -bindsym $mod+Shift+d exec ~/.config/rofi/emoji-picker.py - -# alternatively, you can use the cursor keys: -bindsym $mod+Left focus left -bindsym $mod+Down focus down -bindsym $mod+Up focus up -bindsym $mod+Right focus right - -# alternatively, you can use the cursor keys: -bindsym $mod+Shift+Left move left -bindsym $mod+Shift+Down move down -bindsym $mod+Shift+Up move up -bindsym $mod+Shift+Right move right - -# split in horizontal orientation -bindsym $mod+h split h - -# split in vertical orientation -bindsym $mod+v split v - -# enter fullscreen mode for the focused container -bindsym $mod+f fullscreen toggle - -# change container layout (stacked, tabbed, toggle split) -bindsym $mod+s layout stacking -bindsym $mod+z layout tabbed -bindsym $mod+e layout toggle split - -# toggle tiling / floating -bindsym $mod+Shift+space floating toggle - -# change focus between tiling / floating windows -bindsym $mod+space focus mode_toggle - -# focus the parent container -bindsym $mod+Shift+q focus parent - -# switch to workspace -bindsym $mod+ampersand workspace number 1 -bindsym $mod+eacute workspace number 2 -bindsym $mod+quotedbl workspace number 3 -bindsym $mod+apostrophe workspace number 4 -bindsym $mod+parenleft workspace number 5 -bindsym $mod+minus workspace number 6 -bindsym $mod+egrave workspace number 7 -bindsym $mod+underscore workspace number 8 -bindsym $mod+ccedilla workspace number 9 -bindsym $mod+agrave workspace number 10 - -# move focused container to workspace -bindsym $mod+Shift+ampersand move container to workspace 1 -bindsym $mod+Shift+eacute move container to workspace 2 -bindsym $mod+Shift+quotedbl move container to workspace 3 -bindsym $mod+Shift+apostrophe move container to workspace 4 -bindsym $mod+Shift+5 move container to workspace 5 -bindsym $mod+Shift+minus move container to workspace 6 -bindsym $mod+Shift+egrave move container to workspace 7 -bindsym $mod+Shift+underscore move container to workspace 8 -bindsym $mod+Shift+ccedilla move container to workspace 9 -bindsym $mod+Shift+agrave move container to workspace 10 - -# reload the configuration file -bindsym $mod+Shift+c reload -# restart i3 inplace (preserves your layout/session, can be used to upgrade i3) -bindsym $mod+Shift+r restart -# exit i3 (logs you out of your X session) -bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'" - -# no border nor title -new_window none - -# hide borders when touching edges -hide_edge_borders both - -#do not sync mouse position and focus -focus_follows_mouse no - -# resize window (you can also use the mouse for that) -mode "resize" { - # These bindings trigger as soon as you enter the resize mode - - # Pressing left will shrink the window’s width. - # Pressing right will grow the window’s width. - # Pressing up will shrink the window’s height. - # Pressing down will grow the window’s height. - - # same bindings, but for the arrow keys - bindsym Left resize shrink width 10 px or 10 ppt - bindsym Down resize grow height 10 px or 10 ppt - bindsym Up resize shrink height 10 px or 10 ppt - bindsym Right resize grow width 10 px or 10 ppt - - # back to normal: Enter or Escape - bindsym Return mode "default" - bindsym Escape mode "default" -} - -bindsym $mod+r mode "resize" - -#start compositor -exec --no-startup-id compton - -#start polybar -exec_always --no-startup-id $HOME/.config/polybar/scripts/launch_polybar.sh - -#fr -exec setxkbmap fr - -#numlock -exec numlockx on - -#popup config Firefox / Terminator / General Purpose -for_window [window_role="Steam"] floating enable -for_window [window_role="About"] floating enable -for_window [window_role="Organizer"] floating enable -for_window [title="^Terminator *"] floating enable -for_window [window_role="pop-up"] floating enable -for_window [window_role="task_dialog"] floating enable -for_window [title="Preferences$"] floating enable - -set $Locker ~/.config/i3/lock/lock.sh -#Just lock the screen -bindsym $mod+l exec --no-startup-id $Locker && sleep 1 - -#Lock and suspend to RAM -bindsym $mod+Shift+l exec --no-startup-id $Locker && systemctl suspend -exec_always --no-startup-id xset dpms 600 -exec_always --no-startup-id xautolock -time 9 -locker $Locker - -#Notifications -exec --no-startup-id dunst - -#i3 gaps -gaps inner 10 -gaps outer 0 -smart_gaps on - -# Set mouse acceleration -exec_always --no-startup-id xinput set-prop 'FocalTechPS/2 FocalTech Touchpad' 'libinput Accel Speed' 0.8 -exec_always --no-startup-id xinput set-prop 'Microsoft Microsoft 3-Button Mouse with IntelliEye(TM)' 'libinput Accel Speed' 0.8 - -# ALSA key binding (media keys do not even have keycode...) -bindsym XF86AudioRaiseVolume exec --no-startup-id amixer -D hw:PCH -M sset Master 5%+ -bindsym XF86AudioLowerVolume exec --no-startup-id aimxer -D hw:PCH -M sset Master 5%- -bindsym XF86AudioMute exec --no-startup-id amixer -D hw:PCH -M sset 'Master' toggle -bindsym XF86AudioPlay exec --no-startup-id playerctl play-pause -bindsym XF86AudioPrev exec --no-startup-ip playerctl prev -bindsym XF86AudioNext exec --no-startup-id playerctl next - -# Luminosity on laptop (not xorg-xbacklight but the compatible and working acpilight) -bindsym XF86MonBrightnessDown exec --no-startup-id xbacklight -dec 10 -steps 200 -bindsym XF86MonBrightnessUp exec --no-startup-id xbacklight -inc 10 -steps 200 -bindsym XF86KbdBrightnessDown exec --no-startup-id xbacklight -ctrl asus::kbd_backlight -dec 30 -bindsym XF86KbdBrightnessUp exec --no-startup-id xbacklight -ctrl asus::kbd_backlight -inc 30 - -#Open explorer without last tabs -bindsym Mod4+e exec spacefm -n -#Open explorer with last tabs (sym to Ctrl+T, Ctrl+Maj+T) -bindsym Mod4+Shift+e exec spacefm - -#Gamma, color temp and brightness night adjuster -exec --no-startup-id redshift-gtk - -# Set ALSA initial volume -exec-always --no-startup-id amixer -D hw:PCH -M sset Master 50% -exec --no-startup-id pavucontrol -exec standardnotes-desktop -exec atom -exec firefox - -for_window [class="^Firefox*"] move to workspace 3 -for_window [class="^Thunderbird*"] move scratchpad -bindsym $mod+Shift+t [class="^Thunderbird*"] scratchpad show -for_window [class="^Signa*"] move scratchpad -bindsym $mod+Shift+s [class="^Signa*"] scratchpad show -for_window [class="^Pavucontrol"] move scratchpad -bindsym $mod+Shift+p [class="^Pavucontrol"] move scratchpad -for_window [class="Atom"] move to workspace 2 -for_window [class="Tor Browser"] move to workspace 5 -for_window [class="Standard Notes"] move to workspace 4 - -# Automate port mapping for applications -exec --no-startup-id jack-matchmaker -p ~/.config/jack-matchmaker/patterns - -# Set DPI along with .Xresources -exec xrandr --dpi 160 - -# Communication -exec thunderbird -exec signal-desktop - -# Screenshot -# Save to file -bindsym $mod+Print exec ~/.config/i3/scripts/screenshot.py -s -# Upload to Lychee -bindsym Print exec ~/.config/i3/scripts/screenshot.py -u diff --git a/.config/i3/config.desk b/.config/i3/config_common similarity index 57% rename from .config/i3/config.desk rename to .config/i3/config_common index 12d816c..9ef56e6 100644 --- a/.config/i3/config.desk +++ b/.config/i3/config_common @@ -1,40 +1,112 @@ -# This file has been auto-generated by i3-config-wizard(1). -# It will not be overwritten, so edit it as you like. -# -# Should you change your keyboard layout some time, delete -# this file and re-run i3-config-wizard(1). -# - # i3 config file (v4) -# -# Please see https://i3wm.org/docs/userguide.html for a complete reference! +################################## +# STARTING CONFIGURATION +################################## +# Mod1 = alt set $mod Mod1 -# Font for window titles. Will also be used by the bar unless a different font -# is used in the bar {} block below. +# font for window titles. font pango:Roboto, Bold 10 -# Use Mouse+$mod to drag floating windows to their wanted position +# use Mouse+$mod to drag floating windows to their wanted position floating_modifier $mod +# no border nor title +new_window none + +# hide borders when touching edges +hide_edge_borders both + +# do not sync mouse position and focus +focus_follows_mouse no + +# script to lock the screen +set $Locker ~/.config/i3/lock/lock.sh + +# settings for i3 gaps +gaps inner 10 +gaps outer 0 +smart_gaps on + +################################## +# PROGRAMS STARTED AUTOMATICALLY +################################## + +#start compositor +exec --no-startup-id compton + +#start polybar +exec --no-startup-id $HOME/.config/polybar/scripts/launch_polybar.sh + +# configure keyboard layout +exec setxkbmap fr + +# set numlock on +exec numlockx on + +# turn to black screen after 9 minutes of doing nothing +exec --no-startup-id xset dpms 600 + +# autolock after 9 minutes of doing nothing +exec --no-startup-id xautolock -time 9 -locker $Locker -corners ---- + +# notifications +exec dunst + +# gamma, color temp and brightness night adjuster +exec redshift-gtk + +# set ALSA initial volume +exec --no-startup-id amixer -D hw:PCH -M sset Master 50% + +# standard apps for working +exec standardnotes-desktop +exec atom +exec firefox +exec terminator +exec thunderbird +exec signal-desktop + +################################## +# BINDINGS FOR STARTING PROGRAMS +################################## # start a terminal bindsym $mod+Return exec i3-sensible-terminal -# kill focused window -bindsym $mod+q kill - -# start dmenu (a program launcher) +# start rofi (a program launcher) bindsym $mod+d exec rofi -show run -theme sidebar bindsym $mod+Shift+d exec ~/.config/rofi/emoji-picker.py -# alternatively, you can use the cursor keys: +# just lock the screen +bindsym $mod+l exec --no-startup-id $Locker && sleep 1 + +# lock and suspend to RAM +bindsym $mod+Shift+l exec --no-startup-id $Locker && systemctl suspend + +# open explorer without last tabs +bindsym Mod4+e exec spacefm -n +# open explorer with last tabs (sym to Ctrl+T, Ctrl+Maj+T) +bindsym Mod4+Shift+e exec spacefm + +# screenshot and save to file +bindsym $mod+Print exec ~/.config/i3/scripts/screenshot.py -s +# screenshot and upload to Lychee +bindsym Print exec ~/.config/i3/scripts/screenshot.py -u + +################################## +# BINDINGS FOR STANDARD OPERATIONS +################################## +# kill focused window +bindsym $mod+q kill + +# change focus bindsym $mod+Left focus left bindsym $mod+Down focus down bindsym $mod+Up focus up bindsym $mod+Right focus right -# alternatively, you can use the cursor keys: +# move containers bindsym $mod+Shift+Left move left bindsym $mod+Shift+Down move down bindsym $mod+Shift+Up move up @@ -51,17 +123,17 @@ bindsym $mod+f fullscreen toggle # change container layout (stacked, tabbed, toggle split) bindsym $mod+s layout stacking -bindsym $mod+z layout tabbed +bindsym $mod+t layout tabbed bindsym $mod+e layout toggle split # toggle tiling / floating -bindsym $mod+Shift+space floating toggle +bindsym $mod+space floating toggle # change focus between tiling / floating windows -bindsym $mod+space focus mode_toggle +bindsym $mod+Shift+space focus mode_toggle # focus the parent container -bindsym $mod+Shift+q focus parent +bindsym $mod+a focus parent # switch to workspace bindsym $mod+ampersand workspace number 1 @@ -89,63 +161,34 @@ bindsym $mod+Shift+agrave move container to workspace 10 # reload the configuration file bindsym $mod+Shift+c reload + # restart i3 inplace (preserves your layout/session, can be used to upgrade i3) bindsym $mod+Shift+r restart -# exit i3 (logs you out of your X session) -bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'" - -# no border nor title -new_window none - -# hide borders when touching edges -hide_edge_borders both - -#do not sync mouse position and focus -focus_follows_mouse no # resize window (you can also use the mouse for that) mode "resize" { - # These bindings trigger as soon as you enter the resize mode - # Pressing left will shrink the window’s width. # Pressing right will grow the window’s width. # Pressing up will shrink the window’s height. # Pressing down will grow the window’s height. # same bindings, but for the arrow keys - bindsym Left resize shrink width 10 px or 10 ppt + bindsym Left resize grow width 10 px or 10 ppt bindsym Down resize grow height 10 px or 10 ppt bindsym Up resize shrink height 10 px or 10 ppt - bindsym Right resize grow width 10 px or 10 ppt + bindsym Right resize shrink width 10 px or 10 ppt # back to normal: Enter or Escape - bindsym Return mode "default" bindsym Escape mode "default" } bindsym $mod+r mode "resize" -#put workspace 1 on main screen -workspace 1 output DVI-D-0 -workspace 2 output HDMI-0 -workspace 3 output DVI-D-0 -workspace 4 output HDMI-0 -workspace 5 output DVI-D-0 -workspace 6 output HDMI-0 +################################## +# OPERATIONS FOR SPECIFIC WINDOWS +################################## -#start compositor -exec --no-startup-id compton - -#start polybar -exec --no-startup-id $HOME/.config/polybar/scripts/launch_polybar.sh - -#fr -exec setxkbmap fr - -#numlock -exec numlockx on - -#popup config Firefox / Terminator / General Purpose +# some windows will float automatically for_window [window_role="Steam"] floating enable for_window [window_role="About"] floating enable for_window [window_role="Organizer"] floating enable @@ -154,79 +197,15 @@ for_window [window_role="pop-up"] floating enable for_window [window_role="task_dialog"] floating enable for_window [title="Preferences$"] floating enable -set $Locker ~/.config/i3/lock/lock.sh -#Just lock the screen -bindsym $mod+l exec --no-startup-id $Locker && sleep 1 - -#Lock and suspend to RAM -bindsym $mod+Shift+l exec --no-startup-id $Locker && systemctl suspend -exec_always --no-startup-id xset dpms 600 -exec_always --no-startup-id xautolock -time 9 -locker $Locker -corners ---- - -#Notifications -exec --no-startup-id dunst - -#i3 gaps -gaps inner 10 -gaps outer 0 -smart_gaps on - -# ALSA key binding (media keys do not even have keycode...) -bindsym KP_Add exec --no-startup-id amixer -D hw:PCH -M sset Master 5%+ -bindsym KP_Subtract exec --no-startup-id amixer -D hw:PCH -M sset Master 5%- -bindsym XF86AudioMute exec --no-startup-id amixer set 'Master' toggle -bindsym XF86AudioPlay exec --no-startup-id playerctl play-pause -bindsym XF86AudioPrev exec --no-startup-ip playerctl prev -bindsym XF86AudioNext exec --no-startup-id playerctl next - -#Open explorer without last tabs -bindsym Mod4+e exec spacefm -n -#Open explorer with last tabs (sym to Ctrl+T, Ctrl+Maj+T) -bindsym Mod4+Shift+e exec spacefm - -#Gamma, color temp and brightness night adjuster -exec --no-startup-id redshift-gtk - -# Set ALSA initial volume -exec-always --no-startup-id amixer -D hw:PCH -M sset Master 50% - -for_window [class="Non-Mixer"] mark "jack", move scratchpad -for_window [class="Catia*"] move to workspace 4 -for_window [class="^Signal"] mark "msg", move scratchpad +# scratchpad +for_window [class="Signal"] mark "msg", move scratchpad for_window [class="Thunderbird"] mark "mail", move scratchpad bindsym $mod+Shift+t [con_mark="mail"] scratchpad show -bindsym $mod+Shift+j [con_mark="jack"] scratchpad show bindsym $mod+Shift+s [con_mark="msg"] scratchpad show +# automatic workspace for_window [class="Terminator"] move to workspace 1 for_window [class="Atom"] move to workspace 2 for_window [class="Firefox"] move to workspace 3 for_window [class="Standard Notes"] move to workspace 4 for_window [class="Tor Browser"] move to workspace 5 - -exec standardnotes-desktop -exec atom -exec firefox -exec terminator - -# Cadence will take care of all we need : -# - Config tells Cadence to start LADISH, export MIDI hw and start A2J ; -# - LADISH implies JACK starts, then it will starts needed apps (e.g. Non-Mixer) -exec --no-startup-id cadence-session-start --start -exec --no-startup-id catia - -# Automate port mapping for applications -exec --no-startup-id jack-matchmaker -p ~/.config/jack-matchmaker/patterns - -# Set mouse acceleration -exec --no-startup-id xinput set-prop 'pointer:Razer Razer DeathAdder Chroma' --type=float 'libinput Accel Speed' -.4 - -# Communication -exec thunderbird -exec signal-desktop - -# Screenshot -# Save to file -bindsym $mod+Print exec ~/.config/i3/scripts/screenshot.py -s -# Upload to Lychee -bindsym Print exec ~/.config/i3/scripts/screenshot.py -u diff --git a/.init_config.sh b/.init_config.sh index 52e8560..751c0d9 100755 --- a/.init_config.sh +++ b/.init_config.sh @@ -4,6 +4,24 @@ LAPTOP="laptop" DESKTOP="desk" DEST_FILENAME="dest" +# Check if a file has been modified and deleted since last commit, if so perform an action +# $1 : path of file +# $2 : command to launch if file has been created of modifed +# $3 : command to launch if file has been deleted +function check_copy() { + echo "$changed_files" | grep --quiet "$1" + if [ $? == "0" ]; then + echo "$changed_files" | cut -f 1 | grep --quiet "R" + if [ $? == "0" ]; then + echo "* $1 has been removed" + echo "* Running $3" && eval "$3" + else + echo "* Changes detected in $1" + echo "* Running $2" && eval "$2" + fi + fi +} + function usage() { echo "$0: creates symlink for divergent config between laptop and desktop (e.g. battery management...) and copy configuration to external locations" echo "usage: $0 [${LAPTOP}|${DESKTOP}]" @@ -22,6 +40,8 @@ if [ "${1}" != "${LAPTOP}" ] && [ "${1}" != "${DESKTOP}" ]; then usage fi +changed_files="$(git --git-dir=$HOME/.cfg/ --work-tree=$HOME diff-tree -r --name-status --no-commit-id HEAD@{1} HEAD)" + echo "=== Create symlink to *.${1} regular files ===" # Take all specific files and create a symlink pointing to it without the extension # This file will be used by applications @@ -36,7 +56,7 @@ for f in `find ${HOME} -maxdepth 1 -mindepth 1 -type f -name "*.${1}"`; do ln -sf ${f} ${f%.*} done -echo -e "\n=== Copy configuration which resides in outer directory ===" +echo -e "\n=== Copy changed configuration which resides in outer directory ===" # Destination files are regular files for f in `find ${CONFIG} -type f -name ${DEST_FILENAME}`; do DIR=`dirname "${f}"` @@ -45,7 +65,13 @@ for f in `find ${CONFIG} -type f -name ${DEST_FILENAME}`; do # This is because if desktop/laptop files exist, they already have a symlink pointing to them at this stage for config_file in `find ${DIR} -maxdepth 1 -mindepth 1 -not \( -name "*.${LAPTOP}" -o -name "*.${DESKTOP}" -o -name "${DEST_FILENAME}" \)`; do # Now copy to destination - echo "Copying ${config_file} to ${DEST}..." - sudo cp ${config_file} ${DEST} + check_copy "${config_file}" "sudo cp ${config_file} ${DEST}" "sudo rm ${DEST}" done -done \ No newline at end of file +done + +echo -e "\n=== Generate i3 config file ===" +cp ${CONFIG}/i3/config_common ${CONFIG}/i3/config +for f in `find ${CONFIG}/i3/config.d -type f -name "${1}"`; do + echo "Found ${f}, add to regular config file" + cat "${f}" >> ${CONFIG}/i3/config +done