Compare commits
5 Commits
0256875460
...
a8d06672a0
Author | SHA1 | Date | |
---|---|---|---|
a8d06672a0 | |||
bbc5652451 | |||
5b8c7040be | |||
5df3a9898c | |||
331838de06 |
38
.bin/display
38
.bin/display
@ -1,36 +1,22 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
export DISPLAY=:0
|
export DISPLAY=:0
|
||||||
export XAUTHORITY=/home/tanguy/.Xauthority
|
export XAUTHORITY=~/.Xauthority
|
||||||
|
|
||||||
/home/tanguy/.screenlayout/base.sh
|
DOCK_ID=$(lsusb -d 0x17ef:0x30a9 -v | grep -i iserial | awk '{print $3}') > /dev/null 2>&1
|
||||||
# TODO : Configure each dock configuration with MAC addresses
|
|
||||||
|
|
||||||
if [[ "$(ip a | grep 'e0:4f:43:59:98:f4' | wc -l)" == 1 ]]; then
|
if [ -z "$DOCK_ID" ]; then
|
||||||
/home/tanguy/.screenlayout/tegl-e0-4f.sh
|
/bin/sh -c ~/.screenlayout/base.sh > /dev/null 2>&1
|
||||||
|
/bin/sh -c ~/.bin/workspacelayout/base.sh > /dev/null 2>&1
|
||||||
i3-msg "workspace 1, move workspace to output DVI-I-1-1";
|
exit 0;
|
||||||
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
|
||||||
|
|
||||||
if [[ "$(ip a | grep 'f4:a8:0d:41:e1:aa' | wc -l)" == 1 ]]; then
|
FILE=~/.screenlayout/$DOCK_ID.sh
|
||||||
/home/tanguy/.screenlayout/tegl-e1-aa.sh
|
if test -f $FILE; then
|
||||||
|
~/.screenlayout/$DOCK_ID.sh > /dev/null 2>&1
|
||||||
|
~/.bin/workspacelayout/$DOCK_ID.sh > /dev/null 2>&1
|
||||||
|
|
||||||
i3-msg "workspace 1, move workspace to output DP-2-2";
|
echo "Layout applied"
|
||||||
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
|
||||||
|
|
||||||
if [[ "$(ip a | grep '00:50:b6:f7:e5:d3' | wc -l)" == 1 ]]; then
|
#/home/tanguy/.config/polybar/launch.sh > /dev/null 2>&1
|
||||||
/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
|
|
||||||
|
@ -1,14 +1,23 @@
|
|||||||
#!/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," ]
|
if [ $charging_state = "Charging," ] && [ ! -f /tmp/charge_done ]
|
||||||
then
|
then
|
||||||
|
if [ $battery_level -ge 100 ]
|
||||||
|
then
|
||||||
|
/usr/bin/notify-send "Charge completed" "The battery reached 100% charge."
|
||||||
|
touch /tmp/charge_done
|
||||||
exit
|
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
|
||||||
|
@ -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"
|
set-option -g update-environment "SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY DISPLAY I3SOCK"
|
||||||
|
|
||||||
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
31
.zshrc
@ -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/tanguy/.oh-my-zsh"
|
export ZSH="$HOME/.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,6 +28,11 @@ 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
|
||||||
@ -118,6 +123,29 @@ 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}" ] \
|
||||||
@ -128,4 +156,3 @@ function wg-reload() {
|
|||||||
|
|
||||||
|
|
||||||
autoload -U +X bashcompinit && bashcompinit
|
autoload -U +X bashcompinit && bashcompinit
|
||||||
complete -o nospace -C /usr/bin/terraform terraform
|
|
||||||
|
Loading…
Reference in New Issue
Block a user