Fixed i3lock script to only run once at the same time.
parent
c6f99af469
commit
64f483c954
|
@ -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
|
||||
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
0
|
|
@ -9,7 +9,7 @@ def screenshot():
|
|||
os.system('scrot /tmp/i3lock.png')
|
||||
print('Screenshot: {}'.format(time.time() - ss_time))
|
||||
|
||||
|
||||
|
||||
def pixelate():
|
||||
pxl_time = time.time()
|
||||
pixelSize = 12
|
||||
|
@ -20,9 +20,9 @@ def pixelate():
|
|||
|
||||
image = image.resize((int(image_x / pixelSize), int(image_y / pixelSize)), Image.NEAREST)
|
||||
image_x, image_y = image.size
|
||||
|
||||
|
||||
image = image.resize((image_x * pixelSize, image_y * pixelSize),
|
||||
Image.NEAREST)
|
||||
Image.NEAREST)
|
||||
|
||||
image.save('/tmp/i3lock.png')
|
||||
print('pixelate: {}'.format(time.time() - pxl_time))
|
||||
|
@ -82,7 +82,7 @@ def lock_config():
|
|||
# Color of the circle if wrong | Color: transparent
|
||||
lock_wrong_color = '--insidewrongcolor 00000000 '
|
||||
indicator_inner = "{} {} {}".format(lock_rest_color, lock_wrong_color,
|
||||
lock_ver_color)
|
||||
lock_ver_color)
|
||||
|
||||
# indicator_outer_ring
|
||||
# Default Color of the ring | Color: torquoise
|
||||
|
@ -111,13 +111,13 @@ def lock_config():
|
|||
lock_radius = '--radius {}'.format(ring_size)
|
||||
lock_stats = '{} {}'.format(lock_pos, lock_radius)
|
||||
indicator_outer_ring = "{} {} {} {} {} {} {} {}".format(lock_ring,
|
||||
lock_ring_w,
|
||||
lock_ring_v,
|
||||
lock_press,
|
||||
lock_del,
|
||||
lock_sep_color,
|
||||
lock_stats,
|
||||
lock_texts)
|
||||
lock_ring_w,
|
||||
lock_ring_v,
|
||||
lock_press,
|
||||
lock_del,
|
||||
lock_sep_color,
|
||||
lock_stats,
|
||||
lock_texts)
|
||||
# done
|
||||
indicator = "{} {}".format(indicator_inner, indicator_outer_ring)
|
||||
|
||||
|
@ -126,7 +126,7 @@ def lock_config():
|
|||
|
||||
print('lock: {}'.format(time.time() - lock_time))
|
||||
return "{} {} {} {} {}".format(lock_core, clock, datetime, indicator,
|
||||
lock_pic)
|
||||
lock_pic)
|
||||
|
||||
|
||||
def lock():
|
||||
|
@ -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 = ''
|
||||
|
@ -151,11 +185,11 @@ def log(start_time):
|
|||
f.write("[{}] {} seconds runtime.\n".format(time.asctime(), program_duration))
|
||||
f.close()
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
start_time = time.time()
|
||||
screenshot()
|
||||
pixelate()
|
||||
lock()
|
||||
log(start_time)
|
||||
if not is_running():
|
||||
start_time = time.time()
|
||||
screenshot()
|
||||
pixelate()
|
||||
lock()
|
||||
log(start_time)
|
||||
|
|
50
zsh/.zshrc
50
zsh/.zshrc
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue