Compare commits

..

No commits in common. "a8d06672a09019f0ceae813493bc643b9da0d333" and "02568754603a4e1773141433f480c5ee318db0a1" have entirely different histories.

4 changed files with 31 additions and 53 deletions

View File

@ -1,22 +1,36 @@
#!/bin/sh #!/bin/sh
export DISPLAY=:0 export DISPLAY=:0
export XAUTHORITY=~/.Xauthority export XAUTHORITY=/home/tanguy/.Xauthority
DOCK_ID=$(lsusb -d 0x17ef:0x30a9 -v | grep -i iserial | awk '{print $3}') > /dev/null 2>&1 /home/tanguy/.screenlayout/base.sh
# TODO : Configure each dock configuration with MAC addresses
if [ -z "$DOCK_ID" ]; then if [[ "$(ip a | grep 'e0:4f:43:59:98:f4' | wc -l)" == 1 ]]; then
/bin/sh -c ~/.screenlayout/base.sh > /dev/null 2>&1 /home/tanguy/.screenlayout/tegl-e0-4f.sh
/bin/sh -c ~/.bin/workspacelayout/base.sh > /dev/null 2>&1
exit 0; i3-msg "workspace 1, move workspace to output DVI-I-1-1";
i3-msg "workspace 2, move workspace to output DCI-I-2-2";
i3-msg "workspace 3, move workspace to output eDP-1"
i3-msg "workspace 4, move workspace to output eDP-1"
fi fi
FILE=~/.screenlayout/$DOCK_ID.sh if [[ "$(ip a | grep 'f4:a8:0d:41:e1:aa' | wc -l)" == 1 ]]; then
if test -f $FILE; then /home/tanguy/.screenlayout/tegl-e1-aa.sh
~/.screenlayout/$DOCK_ID.sh > /dev/null 2>&1
~/.bin/workspacelayout/$DOCK_ID.sh > /dev/null 2>&1
echo "Layout applied" i3-msg "workspace 1, move workspace to output DP-2-2";
i3-msg "workspace 2, move workspace to output DP-2-3";
i3-msg "workspace 3, move workspace to output eDP-1"
i3-msg "workspace 4, move workspace to output eDP-1"
fi fi
#/home/tanguy/.config/polybar/launch.sh > /dev/null 2>&1 if [[ "$(ip a | grep '00:50:b6:f7:e5:d3' | wc -l)" == 1 ]]; then
/home/tanguy/.screenlayout/tegl-e5-d3.sh
i3-msg "workspace 1, move workspace to output DVI-I-2-2";
i3-msg "workspace 2, move workspace to output DVI-I-1-1";
i3-msg "workspace 3, move workspace to output eDP-1"
i3-msg "workspace 4, move workspace to output eDP-1"
fi
/home/tanguy/.config/polybar/launch.sh > /dev/null 2>&1

View File

@ -1,23 +1,14 @@
#!/bin/bash #!/bin/bash
# Crontab entry
# */5 * * * * XDG_RUNTIME_DIR=/run/user/$(id -u) <path to script>
battery_level=$(acpi -b | grep -P -o -m1 "[0-9]+(?=%)") battery_level=$(acpi -b | grep -P -o -m1 "[0-9]+(?=%)")
charging_state=$(acpi -b | grep -P -o -m1 "([A-Z])\w+,") charging_state=$(acpi -b | grep -P -o -m1 "([A-Z])\w+,")
# If laptop is charging, do not make further tests # If laptop is charging, do not make further tests
if [ $charging_state = "Charging," ] && [ ! -f /tmp/charge_done ] if [ $charging_state = "Charging," ]
then then
if [ $battery_level -ge 100 ] exit
then
/usr/bin/notify-send "Charge completed" "The battery reached 100% charge."
touch /tmp/charge_done
exit
fi
fi fi
rm -f /tmp/charge_done
if [ $battery_level -le 5 ] if [ $battery_level -le 5 ]
then then
/usr/bin/notify-send "Battery level critical" "Battery level critically low, plug to avoid shutdown" --urgency=critical /usr/bin/notify-send "Battery level critical" "Battery level critically low, plug to avoid shutdown" --urgency=critical

View File

@ -25,7 +25,7 @@ set-option -g display-panes-colour colour166 #orange
set-window-option -g clock-mode-colour green #green set-window-option -g clock-mode-colour green #green
# disable DISPLAY requirement when opening pane/window # disable DISPLAY requirement when opening pane/window
set-option -g update-environment "SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY DISPLAY I3SOCK" set-option -g update-environment "SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY"
set -g status-interval 1 set -g status-interval 1
set -g status-justify centre # center align window list set -g status-justify centre # center align window list

31
.zshrc
View File

@ -6,7 +6,7 @@ if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]
fi fi
# Path to your oh-my-zsh installation. # Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh" export ZSH="/home/tanguy/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will # Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case, # load a random theme each time oh-my-zsh is loaded, in which case,
@ -28,11 +28,6 @@ then
source <(kubectl completion zsh) source <(kubectl completion zsh)
fi fi
if [[ $(command -v terraform) ]];
then
complete -o nospace -C /usr/bin/terraform terraform
fi
# User configuration # User configuration
# You may need to manually set your language environment # You may need to manually set your language environment
@ -123,29 +118,6 @@ function wg-reload() {
sudo bash -c 'cd /etc/wireguard && wg syncconf $0 <(wg-quick strip $0)' $1 sudo bash -c 'cd /etc/wireguard && wg syncconf $0 <(wg-quick strip $0)' $1
} }
if [ -n "$TMUX" ]; then
function refresh {
sshauth=$(tmux show-environment | grep "^SSH_AUTH_SOCK")
if [ $sshauth ]; then
export $sshauth
fi
display=$(tmux show-environment | grep "^DISPLAY")
if [ $display ]; then
export $display
fi
i3sock=$(tmux show-environment | grep "^I3SOCK")
if [ $i3sock ]; then
export $i3sock
fi
}
else
function refresh { }
fi
function preexec {
refresh
}
# Finally, start a tmux session # Finally, start a tmux session
[ -x "$(command -v tmux)" ] \ [ -x "$(command -v tmux)" ] \
&& [ -z "${TMUX}" ] \ && [ -z "${TMUX}" ] \
@ -156,3 +128,4 @@ function preexec {
autoload -U +X bashcompinit && bashcompinit autoload -U +X bashcompinit && bashcompinit
complete -o nospace -C /usr/bin/terraform terraform