Merge branch 'work'

This commit is contained in:
2017-09-01 11:27:23 +02:00
16 changed files with 162 additions and 136 deletions

View File

@@ -1,2 +1,3 @@
#!/usr/bin/env bash
i3-dmenu-desktop --dmenu="dmenu -fn 'DejaVu Sans:size=11' -i -p '>' -nb '#000000' -nf '#ffffff' -sb '#e16b40' -sf '#000000'"
rofi -show run
#j4-dmenu-desktop --dmenu="dmenu -fn 'DejaVu Sans:size=11' -i -p '>' -nb '#000000' -nf '#ffffff' -sb '#e16b40' -sf '#000000'"

View File

@@ -5,7 +5,7 @@
_logfile="$LOGDIR/i3/i3exit.log"
LOCKSCREEN="$LIBDIR/wallpaper/lockscreen"
_fallback_color=000000
_fallback_color="000000"
touch "$_logfile"
@@ -17,6 +17,13 @@ log()
lock()
{
set -x
playing=0
if dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'PlaybackStatus'|grep -q Playing ; then
playing=1
fi
echo $playing
(( $playing )) && dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Pause
if [[ -f "$LOCKSCREEN" ]] ; then
i3lock --nofork --show-failed-attempts --ignore-empty-password \
--pointer win --image "$LOCKSCREEN"
@@ -24,9 +31,13 @@ lock()
i3lock --nofork --show-failed-attempts --ignore-empty-password \
--color "$_fallback_color"
fi
screen_off
wait
(( $playing )) && dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Play
}
screen_off() {
:
xset dpms force off
}

View File

@@ -1,11 +1,13 @@
#!/bin/bash
# name of the sink. execute pactl list sinks to get a list
SINKNAME="alsa_output.pci-0000_00_1b.0.analog-stereo"
SINKNAME="$(pactl info | grep '^Default Sink:' | cut -d ' ' -f 3-)"
SINKNAME="alsa_output.usb-Logitech_Logitech_Wireless_Headset_88C626354D45-00.analog-stereo"
# this is the worst
SINK=$(( $(pactl list sinks | grep "Name: " | grep -n "${SINKNAME}"$ | grep -o "^[[:digit:]]*") -1))
getvol() {
echo $(pactl list sinks | grep "^[[:space:]]*Volume" | head -n $(( $SINK + 1 )) | tail -n 1 | grep -o "[[:digit:]]*%" | head -n 1 | cut -d "%" -f 1)
}
@@ -49,15 +51,15 @@ ismuted() {
}
mute() {
pactl set-sink-mute $SINK 1
pactl set-sink-mute $SINKNAME 1
}
unmute() {
pactl set-sink-mute $SINK 0
pactl set-sink-mute $SINKNAME 0
}
mute-toggle() {
pactl set-sink-mute $SINK toggle
pactl set-sink-mute $SINKNAME toggle
}
status() {
@@ -76,6 +78,10 @@ usage() {
}
case "$1" in
"sink")
echo $SINKNAME
echo $SINK
;;
"get-vol")
echo $(getvol)
;;

View File

@@ -14,6 +14,6 @@ output=$(
for option in "${options[@]}"; do
echo "($i) $option"
(( i++ ))
done | dmenu -fn 'DejaVu Sans Mono:size=11' -b -i -l 10 -p '>' -nb '#222222' -nf '#ffffff' -sb '#e16b40' -sf '#000000')
done | dmenu -fn 'DejaVu Sans Mono:size=10' -b -i -l 10 -p '>' -nb '#222222' -nf '#ffffff' -sb '#e16b40' -sf '#000000')
[[ "$output" ]] && "$(dirname "$0")"/i3exit "${output#(*) }"

20
i3/scripts/spotify-current Executable file
View File

@@ -0,0 +1,20 @@
#!/usr/bin/env python3
import dbus
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")
# The property Metadata behaves like a python dict
# for key, value in metadata.items():
# print(key, value)
# To just print the title
print("{}: {} - [{}]".format(
metadata['xesam:artist'][0],
metadata['xesam:title'],
metadata['xesam:album']
))