From 3bf0736b56948274961db6cbdf6b28453fdffbdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Sun, 24 Sep 2017 13:00:02 +0200 Subject: Add mpd-remote to i3blocks --- config/i3blocks/config | 5 +++++ config/i3blocks/scripts/mpd | 54 ++++++++++++++++++++++++++++++++++++--------- 2 files changed, 49 insertions(+), 10 deletions(-) (limited to 'config') diff --git a/config/i3blocks/config b/config/i3blocks/config index 8ae24c8..1a62f50 100644 --- a/config/i3blocks/config +++ b/config/i3blocks/config @@ -33,6 +33,11 @@ command=~/.config/i3blocks/scripts/mpd interval=5 signal=12 +[mpd-remote] +command=~/.config/i3blocks/scripts/mpd +interval=5 +instance=remote + [keymap] command=~/.config/i3/scripts/keyboard_layout interval=once diff --git a/config/i3blocks/scripts/mpd b/config/i3blocks/scripts/mpd index 637623e..113f6e8 100755 --- a/config/i3blocks/scripts/mpd +++ b/config/i3blocks/scripts/mpd @@ -1,30 +1,64 @@ #!/bin/bash +HOME="192.168.0.217" +HOST="" +# Let's be sneaky and verify that we are on relevant network before we try to ping +if ip a | grep -q 'inet 192.168.0.' && \ + ping -c 1 -w 1 "$HOME" >/dev/null 2>&1; then + # TODO check that mpd is running? + HOST="-h $HOME" +fi + +# Handle remote volume +if [ "$BLOCK_INSTANCE" = "remote" ]; then + [ -n "$HOST" ] || exit 0 + case "$BLOCK_BUTTON" in + 1) + mpc $HOST volume 40 >/dev/null + ;; + 3) + mpc $HOST volume 0 >/dev/null + ;; + 4) + mpc $HOST volume +2 >/dev/null + ;; + 5) + mpc $HOST volume -2 >/dev/null + ;; + esac + + echo "♫ $(mpc $HOST volume | sed 's/volume: //')" + exit 0 +fi + +# Handle user input case "$BLOCK_BUTTON" in 1) - mpc toggle >/dev/null + mpc $HOST toggle >/dev/null ;; 2) - mpc stop >/dev/null + mpc $HOST stop >/dev/null ;; 3) - nohup urxvt -title "Music player daemon client" -e ncmpcpp 2>&1 >/dev/null & + # TODO this doesn't work with host + nohup urxvt -title "Music player daemon client" -hold -e ncmpcpp 2>&1 >/dev/null & ;; 4) - mpc prev >/dev/null + mpc $HOST prev >/dev/null ;; 5) - mpc next >/dev/null + mpc $HOST next >/dev/null ;; esac -if [ -n "`mpc status | grep -E "(playing|paused)"`" ]; then - echo `mpc -f "♫ %artist%, %album%, %title%" status | head -1` +STATUS="$(mpc $HOST status)" +if echo "$STATUS" | grep -qE "(playing|paused)"; then + echo `mpc $HOST -f "♫ %artist%, %album%, %title%" status | head -1` echo - if [ -n `mpc status | grep playing` ]; then - echo "#ffff00" - elif [ -n `mpc status | grep paused` ]; then + if echo "$STATUS" | grep -q playing; then echo "#00ff00" + elif echo "$STATUS" | grep -q paused; then + echo "#ffff00" fi else echo "♫" -- cgit v1.2.3 From 48120fbbb4f2b46e44c92d09f90a244717b1812d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Sat, 30 Sep 2017 23:39:43 +0200 Subject: Fix mpd and usbkey --- config/i3blocks/scripts/mpd | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'config') diff --git a/config/i3blocks/scripts/mpd b/config/i3blocks/scripts/mpd index 113f6e8..12f0fdd 100755 --- a/config/i3blocks/scripts/mpd +++ b/config/i3blocks/scripts/mpd @@ -1,14 +1,16 @@ #!/bin/bash -HOME="192.168.0.217" -HOST="" +HOST_HOME="192.168.0.51" +HOST="" # Let's be sneaky and verify that we are on relevant network before we try to ping if ip a | grep -q 'inet 192.168.0.' && \ - ping -c 1 -w 1 "$HOME" >/dev/null 2>&1; then + ping -c 1 -w 1 "$HOST_HOME" >/dev/null 2>&1; then # TODO check that mpd is running? - HOST="-h $HOME" + HOST="-h $HOST_HOME" fi +STATUS="$(mpc $HOST status)" + # Handle remote volume if [ "$BLOCK_INSTANCE" = "remote" ]; then [ -n "$HOST" ] || exit 0 @@ -27,7 +29,9 @@ if [ "$BLOCK_INSTANCE" = "remote" ]; then ;; esac - echo "♫ $(mpc $HOST volume | sed 's/volume: //')" + if echo "$STATUS" | grep -qE "(playing|paused)"; then + echo "♫ $(mpc $HOST volume | sed 's/volume: //')" + fi exit 0 fi @@ -40,8 +44,7 @@ case "$BLOCK_BUTTON" in mpc $HOST stop >/dev/null ;; 3) - # TODO this doesn't work with host - nohup urxvt -title "Music player daemon client" -hold -e ncmpcpp 2>&1 >/dev/null & + nohup urxvt -title "Music player daemon client" -e ncmpcpp $HOST 2>&1 >/dev/null & ;; 4) mpc $HOST prev >/dev/null -- cgit v1.2.3 From 5193d42151091b2d15b28f1095a5ee19589bc312 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Thu, 5 Oct 2017 23:33:18 +0200 Subject: Add htop configuration --- config/htop/htoprc | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 config/htop/htoprc (limited to 'config') diff --git a/config/htop/htoprc b/config/htop/htoprc new file mode 100644 index 0000000..0492e91 --- /dev/null +++ b/config/htop/htoprc @@ -0,0 +1,26 @@ +# Beware! This file is rewritten by htop when settings are changed in the interface. +# The parser is also very primitive, and not human-friendly. +fields=0 48 17 18 38 39 40 2 46 47 49 1 +sort_key=46 +sort_direction=1 +hide_threads=1 +hide_kernel_threads=1 +hide_userland_threads=1 +shadow_other_users=0 +show_thread_names=0 +show_program_path=1 +highlight_base_name=0 +highlight_megabytes=1 +highlight_threads=1 +tree_view=1 +header_margin=1 +detailed_cpu_time=0 +cpu_count_from_zero=0 +update_process_names=0 +account_guest_in_cpu_meter=0 +color_scheme=0 +delay=15 +left_meters=LeftCPUs Memory Swap +left_meter_modes=1 1 1 +right_meters=RightCPUs Tasks LoadAverage Uptime +right_meter_modes=1 2 2 2 -- cgit v1.2.3