From a1fb583fbee3c174ebe8d8c33483003891201495 Mon Sep 17 00:00:00 2001 From: Kevin Mok Date: Mon, 10 Dec 2018 03:38:51 -0500 Subject: [PATCH] Closes #78 --- configs/i3/config | 37 ++++++---------- configs/i3blocks-scripts/cpu_usage_old | 59 -------------------------- configs/i3blocks-scripts/name | 4 -- configs/i3blocks-scripts/spotify | 4 ++ configs/i3blocks-scripts/spotify.py | 15 ------- configs/i3blocks-scripts/spotify_old | 16 +++++++ configs/i3blocks-scripts/time_short | 4 ++ configs/i3blocks/i3blocks.conf | 2 +- configs/sam-i3blocks/sam-i3blocks.conf | 7 +-- dotfiles/.zshrc | 4 +- 10 files changed, 44 insertions(+), 108 deletions(-) delete mode 100755 configs/i3blocks-scripts/cpu_usage_old create mode 100755 configs/i3blocks-scripts/spotify delete mode 100644 configs/i3blocks-scripts/spotify.py create mode 100755 configs/i3blocks-scripts/spotify_old create mode 100755 configs/i3blocks-scripts/time_short diff --git a/configs/i3/config b/configs/i3/config index 8e1af0d..c8ffde1 100644 --- a/configs/i3/config +++ b/configs/i3/config @@ -167,7 +167,7 @@ set_from_resource $bg i3wm.color2 #f0f0f0 # class border backgr. text indicator child_border client.focused $bg $bg $fg $bg $bg -# client.unfocused $bg $bg $fg $bg $bg +# client.unfocused $fg $bg $fg $bg $fg # client.urgent $bg $bg $fg $bg $bg # client.placeholder $bg $bg $fg $bg $bg # client.background $bg @@ -365,28 +365,14 @@ set $white #ffffff # set $inactive_ws_bg $white set $inactive_ws_bg #444c52 -# set $inactive_ws_text #bcccd7 -# set $inactive_ws_text #838e96 -set $inactive_ws_text #cbe4ff -# set $inactive_ws_text $bg - -# set $inactive_ws_trans c8 # set $inactive_ws_trans 96 set $inactive_ws_trans 00 # }}} inactive # -# active vars {{{ # - -set $active_ws_bg #444c52 -# set $active_ws_bg #566066 - -# set $active_ws_trans c8 -set $active_ws_trans 91 - -# }}} active # +# set $active_ws_trans 91 +set $active_ws_trans 4b -# set $focused_ws_text $white set $focused_ws_text #ffffff # benq bar {{{ # @@ -402,10 +388,11 @@ bar { # 0 (transparent) -> 255 (opaque) in hex background $black$bar_trans # border, bg, text color - focused_workspace $inactive_ws_bg $bg $focused_ws_text + # focused_workspace $inactive_ws_bg $bg $focused_ws_text + focused_workspace $inactive_ws_bg $bg $fg # active = focused on other screen - active_workspace $inactive_ws_bg $active_ws_bg$active_ws_trans $focused_ws_text - inactive_workspace $inactive_ws_bg $inactive_ws_bg$inactive_ws_trans $inactive_ws_text + active_workspace $inactive_ws_bg $fg$active_ws_trans $fg + inactive_workspace $inactive_ws_bg $inactive_ws_bg$inactive_ws_trans $fg } tray_output none # status_command i3blocks -c ~/.config/i3blocks/i3blocks.conf @@ -428,11 +415,13 @@ bar { colors { background $black$bar_trans # border, bg, text color - focused_workspace $inactive_ws_bg $bg $focused_ws_text - active_workspace $inactive_ws_bg $active_ws_bg$active_ws_trans $focused_ws_text - inactive_workspace $inactive_ws_bg $inactive_ws_bg$inactive_ws_trans $inactive_ws_text + # focused_workspace $inactive_ws_bg $bg $focused_ws_text + focused_workspace $inactive_ws_bg $bg $fg + active_workspace $inactive_ws_bg $fg$active_ws_trans $fg + inactive_workspace $inactive_ws_bg $inactive_ws_bg$inactive_ws_trans $fg } - status_command i3blocks -c ~/.config/sam-i3blocks/sam-i3blocks.conf + # status_command i3blocks -c ~/.config/sam-i3blocks/sam-i3blocks.conf + status_command 2>/tmp/i3blocks-sam.err i3blocks -vvv -c ~/.config/sam-i3blocks/sam-i3blocks.conf | tee /tmp/i3blocks-sam.out tray_output none wheel_up_cmd nop wheel_down_cmd nop diff --git a/configs/i3blocks-scripts/cpu_usage_old b/configs/i3blocks-scripts/cpu_usage_old deleted file mode 100755 index f81ca45..0000000 --- a/configs/i3blocks-scripts/cpu_usage_old +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/perl -# -# Copyright 2014 Pierre Mavro -# Copyright 2014 Vivien Didelot -# Copyright 2014 Andreas Guldstrand -# -# Licensed under the terms of the GNU GPL v3, or any later version. - -use strict; -use warnings; -use utf8; -use Getopt::Long; -# use Env::Modify qw(:ksh source); - -# default values -my $t_warn = 50; -my $t_crit = 80; -my $cpu_usage = -1; - -sub help { - print "Usage: cpu_usage [-w ] [-c ]\n"; - print "-w : warning threshold to become yellow\n"; - print "-c : critical threshold to become red\n"; - exit 0; -} - -GetOptions("help|h" => \&help, - "w=i" => \$t_warn, - "c=i" => \$t_crit); - -# Get CPU usage -$ENV{LC_ALL}="en_US"; # if mpstat is not run under en_US locale, things may break, so make sure it is -open (MPSTAT, 'mpstat 1 1 -P ALL |') or die; -while () { - if (/^.*\s+(\d+\.\d+)\s+$/) { - $cpu_usage = 100 - $1; # 100% - %idle - last; - } -} -close(MPSTAT); - -$cpu_usage eq -1 and die 'Can\'t find CPU information'; - -# Print short_text, full_text -printf "%.0f%%\n", $cpu_usage; -printf "%.0f%%\n", $cpu_usage; - -system("sudo source \"/home/kevin/.cache/wal/colors.sh\" 2> /dev/null"); -printf "%s\n", $ENV{'COLOR7'}; - -# Print color, if needed -# if ($cpu_usage >= $t_crit) { - # print "#FF0000\n"; - # exit 33; -# } elsif ($cpu_usage >= $t_warn) { - # print "#FFFC00\n"; -# } - -exit 0; diff --git a/configs/i3blocks-scripts/name b/configs/i3blocks-scripts/name index 022fa0c..5f4bc57 100755 --- a/configs/i3blocks-scripts/name +++ b/configs/i3blocks-scripts/name @@ -1,8 +1,4 @@ #!/bin/bash . "/home/kevin/.cache/wal/colors.sh" - -# echo "Kevin" printf "Kevin\n\n%s\n" "$color7" -# echo "Kevin" -# echo "Kevin" diff --git a/configs/i3blocks-scripts/spotify b/configs/i3blocks-scripts/spotify new file mode 100755 index 0000000..e553cf1 --- /dev/null +++ b/configs/i3blocks-scripts/spotify @@ -0,0 +1,4 @@ +#!/bin/bash + +. "/home/kevin/.cache/wal/colors.sh" +printf "$(spotify-now -i '%artist - %title')\n\n%s\n" "$color7" diff --git a/configs/i3blocks-scripts/spotify.py b/configs/i3blocks-scripts/spotify.py deleted file mode 100644 index 7d1d18e..0000000 --- a/configs/i3blocks-scripts/spotify.py +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/python - -import dbus -try: - bus = dbus.SessionBus() - spotify = bus.get_object("org.mpris.MediaPlayer2.spotify", "/org/mpris/MediaPlayer2") - spotify_iface = dbus.Interface(spotify, 'org.freedesktop.DBus.Properties') - props = spotify_iface.Get('org.mpris.MediaPlayer2.Player', 'Metadata') - print(str(props['xesam:artist'][0]) + " - " + str(props['xesam:title'])) - exit -except dbus.exceptions.DBusException: - exit - - - diff --git a/configs/i3blocks-scripts/spotify_old b/configs/i3blocks-scripts/spotify_old new file mode 100755 index 0000000..6e5fd9a --- /dev/null +++ b/configs/i3blocks-scripts/spotify_old @@ -0,0 +1,16 @@ +#!/usr/bin/python + +import dbus +import os + +try: + bus = dbus.SessionBus() + spotify = bus.get_object("org.mpris.MediaPlayer2.spotify", "/org/mpris/MediaPlayer2") + spotify_iface = dbus.Interface(spotify, 'org.freedesktop.DBus.Properties') + props = spotify_iface.Get('org.mpris.MediaPlayer2.Player', 'Metadata') + song_str = str(props['xesam:artist'][0]) + " - " + str(props['xesam:title']) + print("{}\n\n{}\n".format(song_str, os.environ['COLOR7'])) + # print('COLOR7' in os.environ) + exit +except dbus.exceptions.DBusException: + exit diff --git a/configs/i3blocks-scripts/time_short b/configs/i3blocks-scripts/time_short new file mode 100755 index 0000000..809ec13 --- /dev/null +++ b/configs/i3blocks-scripts/time_short @@ -0,0 +1,4 @@ +#!/bin/bash + +. "/home/kevin/.cache/wal/colors.sh" +printf "$(date '+%H:%M')\n\n%s\n" "$color7" diff --git a/configs/i3blocks/i3blocks.conf b/configs/i3blocks/i3blocks.conf index f39fb0d..1cbd344 100644 --- a/configs/i3blocks/i3blocks.conf +++ b/configs/i3blocks/i3blocks.conf @@ -1,7 +1,7 @@ # The top properties below are applied to every block, but can be overridden. # Each block command defaults to the script name to avoid boilerplate. align=center -command=~/linux-config/configs/i3blocks-scripts/$BLOCK_NAME +command=/home/kevin/linux-config/configs/i3blocks-scripts/$BLOCK_NAME separator=true separator_block_width=25 markup=pango diff --git a/configs/sam-i3blocks/sam-i3blocks.conf b/configs/sam-i3blocks/sam-i3blocks.conf index 0925afc..5f006a6 100644 --- a/configs/sam-i3blocks/sam-i3blocks.conf +++ b/configs/sam-i3blocks/sam-i3blocks.conf @@ -2,6 +2,7 @@ # The top properties below are applied to every block, but can be overridden. # Each block command defaults to the script name to avoid boilerplate. align=center +command=/home/kevin/linux-config/configs/i3blocks-scripts/$BLOCK_NAME separator=true separator_block_width=25 markup=pango @@ -9,7 +10,7 @@ color=#cbe4ff # }}} Global properties # [spotify] -command=python ~/linux-config/configs/i3blocks-scripts/spotify.py +# command=python ~/linux-config/configs/i3blocks-scripts/spotify.py label= # label=🎧 # green @@ -18,8 +19,8 @@ label= # color=#2d7272 interval=10 -[time] +[time_short] # label=🕓 -command=echo "$(date '+%H:%M')" +# command=echo "$(date '+%H:%M')" interval=30 # color=#acc0cd diff --git a/dotfiles/.zshrc b/dotfiles/.zshrc index e3f19ee..1c807e7 100644 --- a/dotfiles/.zshrc +++ b/dotfiles/.zshrc @@ -121,8 +121,9 @@ fi # pywal export PATH="${PATH}:${HOME}/.local/bin/:${HOME}/linux-config/scripts:/opt/pycharm-2018.3.1/bin" (cat ~/.cache/wal/sequences &) +# export pywal colors source ~/.cache/wal/colors.sh -export COLOR7="${color7}" +export COLOR7=$color7 xset r rate 200 60 @@ -165,7 +166,6 @@ fi source /home/kevin/.shortcuts source /home/kevin/coding/spotify-lib-vis/src/api-keys.sh -# export pywal colors [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh # add-zsh-hook -Uz chpwd (){ ls -a; }