i3exit script and tmpfs functions
This commit is contained in:
30
bin/i3exit
Executable file
30
bin/i3exit
Executable file
@@ -0,0 +1,30 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
lock() {
|
||||||
|
i3lock -f -c 000000
|
||||||
|
}
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
lock)
|
||||||
|
lock
|
||||||
|
;;
|
||||||
|
logout)
|
||||||
|
i3-msg exit
|
||||||
|
;;
|
||||||
|
suspend)
|
||||||
|
lock && systemctl suspend
|
||||||
|
;;
|
||||||
|
hibernate)
|
||||||
|
lock && systemctl hibernate
|
||||||
|
;;
|
||||||
|
reboot)
|
||||||
|
systemctl reboot
|
||||||
|
;;
|
||||||
|
shutdown)
|
||||||
|
systemctl poweroff
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Usage: $0 {lock|logout|suspend|hibernate|reboot|shutdown}"
|
||||||
|
exit 2
|
||||||
|
esac
|
||||||
|
|
||||||
|
exit 0
|
||||||
@@ -149,6 +149,21 @@ mode "resize" {
|
|||||||
|
|
||||||
bindsym $mod+r mode "resize"
|
bindsym $mod+r mode "resize"
|
||||||
|
|
||||||
|
set $mode_system System (l) lock, (e) logout, (s) suspend, (h) hibernate, (r) reboot, (Shift+s) shutdown
|
||||||
|
mode "$mode_system" {
|
||||||
|
bindsym l exec --no-startup-id i3exit lock, mode "default"
|
||||||
|
bindsym e exec --no-startup-id i3exit logout, mode "default"
|
||||||
|
bindsym s exec --no-startup-id i3exit suspend, mode "default"
|
||||||
|
bindsym h exec --no-startup-id i3exit hibernate, mode "default"
|
||||||
|
bindsym r exec --no-startup-id i3exit reboot, mode "default"
|
||||||
|
bindsym Shift+s exec --no-startup-id i3exit shutdown, mode "default"
|
||||||
|
|
||||||
|
# back to normal: Enter or Escape
|
||||||
|
bindsym Return mode "default"
|
||||||
|
bindsym Escape mode "default"
|
||||||
|
}
|
||||||
|
bindsym $mod+Pause mode "$mode_system"
|
||||||
|
|
||||||
# Start i3bar to display a workspace bar (plus the system information i3status
|
# Start i3bar to display a workspace bar (plus the system information i3status
|
||||||
# finds out, if available)
|
# finds out, if available)
|
||||||
bar {
|
bar {
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ Plugin 'alvan/vim-closetag'
|
|||||||
Plugin 'pangloss/vim-javascript'
|
Plugin 'pangloss/vim-javascript'
|
||||||
Plugin 'junegunn/goyo.vim'
|
Plugin 'junegunn/goyo.vim'
|
||||||
Plugin 'ctrlpvim/ctrlp.vim'
|
Plugin 'ctrlpvim/ctrlp.vim'
|
||||||
|
Plugin 'styled-components/vim-styled-components'
|
||||||
" All of your Plugins must be added before the following line
|
" All of your Plugins must be added before the following line
|
||||||
call vundle#end() " required
|
call vundle#end() " required
|
||||||
filetype plugin indent on " required
|
filetype plugin indent on " required
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ function android-backup() {
|
|||||||
adb backup -f "${filename}" --twrp system cache data boot recovery --compress
|
adb backup -f "${filename}" --twrp system cache data boot recovery --compress
|
||||||
}
|
}
|
||||||
function mountrepo() {
|
function mountrepo() {
|
||||||
if [ -e /dev/md1 ]; then
|
if [ -e /dev/md0 ]; then
|
||||||
sudo cryptsetup luksOpen /dev/md0 repo
|
sudo cryptsetup luksOpen /dev/md0 repo
|
||||||
if [ ! -d /mnt/repo ]; then
|
if [ ! -d /mnt/repo ]; then
|
||||||
sudo mkdir /mnt/repo
|
sudo mkdir /mnt/repo
|
||||||
@@ -40,3 +40,43 @@ function unmountrepo() {
|
|||||||
echo "Device /dev/md0 not found"
|
echo "Device /dev/md0 not found"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
alias dkr-clean="docker rm -f $(docker ps -aq) && docker rmi -f $(docker images -aq)"
|
||||||
|
alias dkr-inspect="docker inspect --format '{{ .NetworkSettings.IPAddress }}' $1"
|
||||||
|
|
||||||
|
function mktmpfs() {
|
||||||
|
if [ $# -eq 2 ]; then
|
||||||
|
if [ -e "$1" ]; then
|
||||||
|
echo "File/Folder ${1} already exists"
|
||||||
|
else
|
||||||
|
mkdir "$1"
|
||||||
|
sudo mount tmpfs "$1" -t tmpfs -o size="$2"
|
||||||
|
sudo chown -hR dan:dan $1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Create a temporary file system"
|
||||||
|
echo "e.g. mktmpfs ~/temp 32m"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function wipetmpfs() {
|
||||||
|
if [ $# -eq 1 ]; then
|
||||||
|
if [ -e "$1" ]; then
|
||||||
|
if mount | grep "$1 type tmpfs" > /dev/null; then
|
||||||
|
read "REPLY?Are you sure you want to wipe $1? (Y/N) "
|
||||||
|
if [[ ! $REPLY =~ ^[Y]$ ]]; then
|
||||||
|
echo "Aborted"
|
||||||
|
return 1
|
||||||
|
else
|
||||||
|
sudo umount $1
|
||||||
|
rm -rf $1
|
||||||
|
echo "Wiped"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "There's nothing at $1"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Kill a temporary file system"
|
||||||
|
echo "e.g. killtmpfs ~/temp"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user