Merge branch 'master' of github.com:danijoo/dotfiles

This commit is contained in:
Daniel Bauer
2019-12-07 13:43:02 +01:00
10 changed files with 279 additions and 42 deletions

View File

@@ -35,7 +35,7 @@
# if you are running pyplot inside a GUI and your backend choice
# conflicts, we will automatically try to find a compatible one for
# you if backend_fallback is True
#backend_fallback: True
backend_fallback: True
#interactive : False
#toolbar : toolbar2 # None | toolbar2 ("classic" is deprecated)
@@ -324,17 +324,10 @@ axes.spines.right : True
# http://en.wikipedia.org/wiki/Plus_and_minus_signs#Character_codes
#axes.prop_cycle: cycler('color', ['2864af', 'cc3f39', '2D882D', 'e8e634', '423687', '903c3f'])
#axes.prop_cycle : cycler('color', ['348ABD', '7A68A6', 'A60628', '467821', 'CF4457', '188487', 'E24A33'])
# E24A33 : orange
# 7A68A6 : purple
# 348ABD : blue
# 188487 : turquoise
# A60628 : red
# CF4457 : pink
# 467821 : green
axes.prop_cycle : cycler('color', ['e41a1c', '0971e6', '41933e', '853990', 'eb7f14', 'f7cf00', '444444', 'a1a1a1', 'ff728a', '37c7c5'])
patch.facecolor: 0072B2
patch.facecolor: FFFFFF #0072B2
axes.autolimit_mode : data # How to scale axes limits to the data.
# Use "data" to use data limits, plus some margin
# Use "round_number" move to the nearest "round" number
@@ -351,7 +344,7 @@ axes.ymargin : .00 # y margin See `axes.Axes.margins`
#xtick.minor.size : 10 # minor tick size in points
xtick.major.pad : 6 # distance to major tick label in points
xtick.minor.pad : 6 # distance to the minor tick label in points
xtick.color : 808080 # color of the tick labels
xtick.color : 797979 # color of the tick labels
#xtick.labelsize : medium # fontsize of the tick labels
xtick.direction : out # direction: in or out
@@ -359,7 +352,7 @@ xtick.direction : out # direction: in or out
#ytick.minor.size : 0 # minor tick size in points
ytick.major.pad : 6 # distance to major tick label in points
ytick.minor.pad : 6 # distance to the minor tick label in points
ytick.color : 808080 # color of the tick labels
ytick.color : 797979 # color of the tick labels
#ytick.labelsize : medium # fontsize of the tick labels
ytick.direction : out # direction: in or out
@@ -382,7 +375,7 @@ legend.edgecolor : 1 # background patch boundary color
#legend.numpoints : 1 # the number of marker points in the legend line
#legend.scatterpoints : 1 # number of scatter points
#legend.markerscale : 1.0 # the relative size of legend markers vs. original
legend.fontsize : 10
legend.fontsize : 8 # 10
# Dimensions as fraction of fontsize:
#legend.borderpad : 0.4 # border whitespace
#legend.labelspacing : 0.5 # the vertical space between the legend entries
@@ -398,7 +391,7 @@ legend.fontsize : 10
#figure.titleweight : normal # weight of the figure title
figure.figsize : 11,4.5 # figure size in inches
figure.dpi : 300 # figure dots per inch
#figure.facecolor : white # figure facecolor; 0.75 is scalar gray
#figure.facecolor : yellow #white # figure facecolor; 0.75 is scalar gray
# figure.edgecolor : white # figure edgecolor
figure.autolayout : True # When True, automatically adjust subplot
# parameters to make the plot fit the figure
@@ -442,7 +435,7 @@ figure.autolayout : True # When True, automatically adjust subplot
# installed, may also be `auto`
### SCATTER PLOTS
#scatter.marker : o # The default marker type for scatter plots.
scatter.marker : o # The default marker type for scatter plots.
### Agg rendering
### Warning: experimental, 2008/10/10
@@ -586,3 +579,4 @@ figure.autolayout : True # When True, automatically adjust subplot
# is also the name of a system tool.
pgf.rcfonts : False

View File

@@ -1,18 +0,0 @@
sm_autocomplete() {
# make zsh emulate bash if necessary
if [[ -n "$ZSH_VERSION" ]]; then
autoload bashcompinit
bashcompinit
fi
snakemake_options=$(snakemake --snakefile Snakefile --list)
complete -W "${snakemake_options}" 'snakemake'
}
cd() {
builtin cd "$@"
if [ -f "Snakefile" ]; then
sm_autocomplete
fi
}

View File

@@ -3,3 +3,5 @@
# Please adapt and uncomment the following lines:
name = Daniel Bauer
email = bauer@cbs.tu-darmstadt.de
[pack]
threads = 8

View File

@@ -9,7 +9,6 @@ if [ -f "$HOME/.environment.local" ]; then
source $HOME/.environment.local
fi
source $HOME/.aliases
source $HOME/.functions
# config specific to this machine
if [ -f $HOME/.zshrc_local ]; then
source $HOME/.zshrc_local
@@ -41,3 +40,7 @@ fi
unset __conda_setup
# <<< conda initialize <<<
# snakemake autocomplete
if hash snakemake 2>/dev/null; then
compdef _gnu_generic snakemake
fi

View File

@@ -186,6 +186,7 @@ workspace $workspace8 output DP-0
workspace $workspace9 output DP-0
for_window [window_role="pop-up"] floating enable
for_window [class="Chromium" window_role="pop-up"] floating disable
for_window [class="Tk"] floating enable
for_window [title="PyMOL Viewer"] floating enable
for_window [class="Toplevel"] floating enable

View File

@@ -51,9 +51,9 @@ monitor = ${env:MONITOR:HDMI-2}
[bar/workstation]
inherit = bar/base
monitor = ${env:MONITOR:DP-2}
monitor = ${env:MONITOR:DP-4}
modules-left = i3 xwindow
modules-right = spotify mpd volume filesystem cpu gpu memory date
modules-right = spotify previous playpause next mpd pulseaudio filesystem cpu gpu memory date xkeyboard
tray-position = false
tray-padding = 2
@@ -63,7 +63,7 @@ font-2 = FontAwesome:size=11;0
[bar/workstation2]
inherit = bar/workstation
monitor = ${env:MONITOR:DP-4}
monitor = ${env:MONITOR:DP-2}
tray-position = right
@@ -93,8 +93,8 @@ type = internal/fs
interval = 25
mount-0 = /
mount-1 = /scratch
mount-2 = /scratch2
mount-1 = /data
mount-2 = /backup
label-mounted = %{F#0a81f5}%mountpoint%%{F-}: %percentage_used%%
label-unmounted = %mountpoint% not mounted
@@ -293,6 +293,33 @@ format-prefix-foreground = ${colors.foreground-alt}
label = %time% %date%
format = <label>
[module/pulseaudio]
type = internal/pulseaudio
format-volume = <label-volume> <bar-volume>
label-volume = 
label-volume-foreground = ${root.foreground}
format-muted-foreground = ${colors.foreground-alt}
label-muted = sound muted
bar-volume-width = 20
bar-volume-foreground-0 = #55aa55
bar-volume-foreground-1 = #55aa55
bar-volume-foreground-2 = #55aa55
bar-volume-foreground-3 = #55aa55
bar-volume-foreground-4 = #55aa55
bar-volume-foreground-5 = #f5a70a
bar-volume-foreground-6 = #ff5555
bar-volume-gradient = false
bar-volume-indicator = ▐
bar-volume-indicator-font = 2
bar-volume-fill = ─
bar-volume-fill-font = 2
bar-volume-empty = ─
bar-volume-empty-font = 2
bar-volume-empty-foreground = ${colors.foreground-alt}
[module/volume]
type = internal/alsa
format-volume = <label-volume> <bar-volume>
@@ -420,3 +447,35 @@ ramp-capacity-4 = 
ramp-capacity-4-foreground = ${colors.green}
animation-discharging-0 = 
[module/previous]
type = custom/script
interval = 86400
format = "%{T3}<label>"
format-padding = 1
exec = echo ""
exec-if = "pgrep spotify"
line-size = 1
click-left = "dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous"
[module/playpause]
type = custom/script
interval = 86400
format = "%{T3}<label>"
format-padding = 1
exec = echo "/"
exec-if = "pgrep spotify"
line-size = 1
click-left = "dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause"
[module/next]
type = custom/script
interval = 86400
format = "%{T3}<label>"
format-padding = 1
exec = echo ""
exec-if = "pgrep spotify"
line-size = 1
click-left = "dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next"

View File

@@ -0,0 +1,3 @@
#!/usr/bin/env sh
/usr/bin/env python3 ~/scripts/spotify/py_spotify_listener.py

View File

@@ -0,0 +1,125 @@
#!/usr/bin/env python3
# Unwrap function: (C)2011-2015 Dennis Kaarsemaker
# License: GPL3+
"""Receiver related functionality."""
import dbus.service
import dbus.glib
from gi.repository import GObject
import dbus
class Test(dbus.service.Object):
"""Reciever test class."""
loop = None
def __init__(self, bus_name, object_path, loop):
"""Initialize the DBUS service object."""
dbus.service.Object.__init__(self, bus_name, object_path)
self.loop = loop
@dbus.service.method('tld.domain.sub.TestInterface')
def foo(self):
"""Return a string."""
return 'Foo'
# Stop the main loop
@dbus.service.method('tld.domain.sub.TestInterface')
def stop(self):
"""Stop the receiver."""
self.loop.quit()
return 'Quit loop'
# Pass an exception through dbus
@dbus.service.method('tld.domain.sub.TestInterface')
def fail(self):
"""Trigger an exception."""
raise Exception('FAIL!')
def catchall_handler(*args, **kwargs):
"""Catch all handler.
Catch and print information about all singals.
"""
print('---- Caught signal ----')
print('%s:%s\n' % (kwargs['dbus_interface'], kwargs['member']))
print("\n")
def quit_handler():
"""Signal handler for quitting the receiver."""
print('Quitting....')
loop.quit()
def event_handler(*args, **kwargs):
"""event handler for the receiver."""
"""arg[1] contains metadata"""
"""arg[1][1] contains PlaybackStatus"""
data = unwrap(args)
if data[1]['PlaybackStatus'] == "Playing":
print("Music is playing")
""" Send IPC hook 2 to the bottom bar pid for module playpause """
with open("/tmp/ipc-bottom", "w") as text_file:
print("hook:module/playpause2", file=text_file)
if data[1]['PlaybackStatus'] == "Paused":
print("Music is paused.")
""" Send IPC hook 3 to the bottom bar pid for module playpause """
with open("/tmp/ipc-bottom", "w") as text_file:
print("hook:module/playpause3", file=text_file)
""" Send IPC hook 2 to the bottom bar pid for module spotify """
with open("/tmp/ipc-bottom", "w") as text_file:
print("hook:module/spotify2", file=text_file)
def unwrap(val):
if isinstance(val, dbus.ByteArray):
return "".join([str(x) for x in val])
if isinstance(val, (dbus.Array, list, tuple)):
return [unwrap(x) for x in val]
if isinstance(val, (dbus.Dictionary, dict)):
return dict([(unwrap(x), unwrap(y)) for x, y in val.items()])
if isinstance(val, (dbus.Signature, dbus.String)):
return str(val)
if isinstance(val, dbus.Boolean):
return bool(val)
if isinstance(val, (dbus.Int16, dbus.UInt16, dbus.Int32, dbus.UInt32, dbus.Int64, dbus.UInt64)):
return int(val)
if isinstance(val, dbus.Byte):
return bytes([int(val)])
return val
loop = GObject.MainLoop()
"""
First we get the bus to attach to. This may be either the session bus, of the
system bus. For system bus root permission is required.
We claim a bus name on the chosen bus. The name should be in form of a
domain name.
"""
bus = dbus.SessionBus()
# bus = dbus.SystemBus()
bus_name = dbus.service.BusName('sub.domain.tld', bus=bus)
"""
We initialize our service object with our name and object path. Object
path should be in form of a reverse domain dame, delimited by / instead of .
and the Class name as last part.
The object path we set here is of importance for our invoker, since it will to
call it exactly as defined here.
"""
obj = Test(bus_name, '/tld/domain/sub/Test', loop)
"""
Attach signal handler.
Signal handlers may be attached in different ways, either by interface keyword
or DBUS interface and a signal name or member keyword.
You can easily gather all information by running the DBUS monitor.
"""
bus.add_signal_receiver(quit_handler,
dbus_interface='tld.domain.sub.event',
signal_name='quit_signal')
bus.add_signal_receiver(event_handler,
dbus_interface='org.freedesktop.DBus.Properties',
member_keyword='PropertiesChanged')
loop.run()

View File

@@ -0,0 +1,67 @@
#!/usr/bin/env python3
import sys
import dbus
import argparse
parser = argparse.ArgumentParser()
parser.add_argument(
'-t',
'--trunclen',
type=int,
metavar='trunclen'
)
parser.add_argument(
'-f',
'--format',
type=str,
metavar='custom format',
dest='custom_format'
)
args = parser.parse_args()
# Default parameters
output = '{artist}: {song}'
trunclen = 25
# parameters can be overwritten by args
if args.trunclen is not None:
trunclen = args.trunclen
if args.custom_format is not None:
output = args.custom_format
try:
session_bus = dbus.SessionBus()
spotify_bus = session_bus.get_object(
'org.mpris.MediaPlayer2.spotify',
'/org/mpris/MediaPlayer2'
)
spotify_properties = dbus.Interface(
spotify_bus,
'org.freedesktop.DBus.Properties'
)
metadata = spotify_properties.Get('org.mpris.MediaPlayer2.Player', 'Metadata')
artist = metadata['xesam:artist'][0]
song = metadata['xesam:title']
if len(song) > trunclen:
song = song[0:trunclen]
song += '...'
if ('(' in song) and (')' not in song):
song += ')'
# Python3 uses UTF-8 by default.
if sys.version_info.major == 3:
print(output.format(artist=artist, song=song))
else:
print(output.format(artist=artist, song=song).encode('UTF-8'))
except Exception as e:
if isinstance(e, dbus.exceptions.DBusException):
print('')
else:
print(e)

View File

@@ -43,14 +43,15 @@ set cartoon_highlight_color, gray
# spheres
set sphere_scale, 0.5
# custom colors
set_color sodium, [0.0, 0.5, 1.0]
# shortcuts
set_key F1, toggle sticks, solvent
set_key F2, toggle sticks, (r. POPC or r. POP) and not hydrogen
set_key F3, toggle spheres, inorganic and (n. NA or n. K)
set_key F4, toggle spheres, n. CL
set_key F9, set depth_cue
set_key F10, set depth_cue, off
set_key F11, ray 800,800
@@ -60,4 +61,4 @@ set_key F12, ray 1600,1600
alias clean, hide everything, hydrogen or n. 1M* or n. 2M* or n. MC*
alias sf_as_sticks, show sticks, residue 478-484 and (not hydrogen or (hydrogen and neighbor (elem O+N+S))) and not (n. 1M* or n. 2M* or n. MC*); hide cartoon, resi 479-483; show sticks, residue 475+468 and (not hydrogen or (hydrogen and neighbor (elem O+N+S))) and not (n. 1M* or n. 2M* or n. MC*)
alias dockfix, as sticks, bonded and not polymer