Fixed i3lock script to only run once at the same time.

clean_emacs
Tuan-Dat Tran 2018-09-12 22:42:41 +02:00
parent c6f99af469
commit 64f483c954
No known key found for this signature in database
GPG Key ID: 0DA1B0B23302CA72
4 changed files with 81 additions and 44 deletions

View File

@ -5,5 +5,5 @@ map f console scout -ftsea%space
map gg console mkdir%space
map np shell cp -r ~/Templates/LaTeX/Protokoll $(date +%g.%m.%%d)
map ny shell cp %f ../Protokoll_$(echo $(basename $(pwd)) | awk '{gsub("\\.","-");print}' $2).pdf
map nr shell cp ~/Templates/LaTeX/Invoice/invoice.tex Gefeba_Engineering_-_Rechnung_$(date +%g.%m)_-Elektro-1.tex
map nr shell cp ~/Templates/LaTeX/Invoice/invoice.tex Gefeba_Engineering_-_Rechnung_$(date +%g.%m)_-Elektro.tex

View File

@ -1 +0,0 @@
0

View File

@ -135,6 +135,40 @@ def lock():
os.system(command)
def proc_exists(proc_name):
proc_check = time.time()
this_proc = "i3lock.py"
proc_path = '/proc'
proc = next(os.walk('{}/'.format(proc_path)))[1]
counter = 0
for process in proc:
counter+=1
cmdline_path = '{}/{}/cmdline'.format(proc_path,process)
try:
with open(cmdline_path, 'r') as cmd:
proc_content = cmd.readline()
proc_content = '{}: {}'.format(counter, proc_content)
if proc_content:
if proc_name in proc_content:
# print(proc_name)
# print(proc_content)
# print(proc_name in proc_content)
if 'xss-lock' not in proc_content:
# print('xss-lock' not in proc_content)
if this_proc not in proc_content:
# print(this_proc not in proc_content)
print('Process Exists: {}'.format(time.time() - proc_check))
return True
except FileNotFoundError:
pass
print('Process Exists: {}'.format(time.time() - proc_check))
return False
def is_running():
return proc_exists("i3lock")
def log(start_time):
write_mode = ''
@ -153,7 +187,7 @@ def log(start_time):
if __name__ == '__main__':
if not is_running():
start_time = time.time()
screenshot()
pixelate()

View File

@ -27,43 +27,47 @@ POWERLEVEL9k_SHORTEN_STRATEGY="trunctuate_middle"
POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
# Alias
alias matrix="cmatrix"
alias df="df -h"
alias mkvirtenv="python -m virtualenv --system-site-packages"
alias e="emacsclient -t"
alias ek="pkill emacs"
alias ej="emacs --daemon"
alias nyan="nyancat"
alias rm="rm -I"
alias -s tex=vim
alias -s cpp=vim
alias -s org=vim
alias diff="diff -s"
alias stunden="et $HOME/Nextcloud/Arbeit/Stunden/Stundenzettel.xlsx &; disown %1;"
alias -s tex=vim
alias budget="emacs -nw $HOME/Nextcloud/orgs/Budget/MyBudget.ledger"
alias vudget="vim $HOME/Nextcloud/orgs/Budget/MyBudget.ledger"
alias df="df -h"
alias diff="diff -s"
alias e="emacsclient -t"
alias ej="emacs --daemon"
alias ek="pkill emacs"
alias erc='emacs -nw ~/.emacs.d/config.org'
alias matrix="cmatrix"
alias mkvirtenv="python -m virtualenv --system-site-packages"
alias mp3='youtube-dl --embed-thumbnail -x --audio-format mp3 -o "./%(title)s.%(ext)s"'
alias nyan="nyancat"
alias pastebin='vim ~/Nextcloud/pastebin.txt'
alias q="exit"
alias ranger='ranger --choosedir=$HOME/.rangerdir; LASTDIR=`cat $HOME/.rangerdir`; cd "$LASTDIR"'
alias rm="rm -I"
alias steam='steam'
alias vrc='vim ~/.vimrc'
alias erc='emacs -nw ~/.emacs.d/config.org'
alias mp3='youtube-dl -x --audio-format mp3 -o "./%(title)s.%(ext)s"'
alias zrc='vim ~/.zshrc'
alias stunden="et $HOME/Nextcloud/Arbeit/Stunden/Stundenzettel.xlsx &; disown %1;"
alias vpn_eu='sudo openvpn --config Downloads/AirVPN_Europe_UDP-443.ovpn'
alias vpn_us='sudo openvpn --config Downloads/AirVPN_America_UDP-443.ovpn'
alias vrc='vim ~/.vimrc'
alias vudget="vim $HOME/Nextcloud/orgs/Budget/MyBudget.ledger"
alias watch='watch --color'
alias zrc='vim ~/.zshrc'
source $ZSH/oh-my-zsh.sh
# Variables
export TERM="xterm-256color" # in case you are using urxvt, to bypass an error during sshing
export GPG_TTY=$(tty)
export LC_ALL=en_GB.UTF-8
PATH=$PATH:$HOME/.local/bin:/usr/lib/jvm/java-10-openjdk/bin
export EDITOR='vim'
export DEFAULT_EDITOR=$EDITOR
export EDITOR='vim'
export GOPATH="$HOME/workspace/go/"
export GPG_TTY=$(tty)
export HIGHLIGHT_DATADIR="~/.config/highlight/"
export LC_ALL=en_GB.UTF-8
export STEAM_FRAME_FORCE_CLOSE=1
export TERM="xterm-256color" # in case you are using urxvt, to bypass an error during sshing
export VISUAL=$EDITOR
export VISUAL_EDITOR=$EDITOR
export STEAM_FRAME_FORCE_CLOSE=1
export HIGHLIGHT_DATADIR="~/.config/highlight/"
export GOPATH="$HOME/workspace/go/"
# Functions