Browse Source

Closes #78

red-hat-laptop
Kevin Mok 5 years ago
parent
commit
a1fb583fbe
Signed by: Kevin-Mok GPG Key ID: AEA75288DC135CF5
  1. 37
      configs/i3/config
  2. 59
      configs/i3blocks-scripts/cpu_usage_old
  3. 4
      configs/i3blocks-scripts/name
  4. 4
      configs/i3blocks-scripts/spotify
  5. 15
      configs/i3blocks-scripts/spotify.py
  6. 16
      configs/i3blocks-scripts/spotify_old
  7. 4
      configs/i3blocks-scripts/time_short
  8. 2
      configs/i3blocks/i3blocks.conf
  9. 7
      configs/sam-i3blocks/sam-i3blocks.conf
  10. 4
      dotfiles/.zshrc

37
configs/i3/config

@ -167,7 +167,7 @@ set_from_resource $bg i3wm.color2 #f0f0f0
# class border backgr. text indicator child_border # class border backgr. text indicator child_border
client.focused $bg $bg $fg $bg $bg 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.urgent $bg $bg $fg $bg $bg
# client.placeholder $bg $bg $fg $bg $bg # client.placeholder $bg $bg $fg $bg $bg
# client.background $bg # client.background $bg
@ -365,28 +365,14 @@ set $white #ffffff
# set $inactive_ws_bg $white # set $inactive_ws_bg $white
set $inactive_ws_bg #444c52 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 96
set $inactive_ws_trans 00 set $inactive_ws_trans 00
# }}} inactive # # }}} 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 set $focused_ws_text #ffffff
# benq bar {{{ # # benq bar {{{ #
@ -402,10 +388,11 @@ bar {
# 0 (transparent) -> 255 (opaque) in hex # 0 (transparent) -> 255 (opaque) in hex
background $black$bar_trans background $black$bar_trans
# border, bg, text color # 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 = 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 tray_output none
# status_command i3blocks -c ~/.config/i3blocks/i3blocks.conf # status_command i3blocks -c ~/.config/i3blocks/i3blocks.conf
@ -428,11 +415,13 @@ bar {
colors { colors {
background $black$bar_trans background $black$bar_trans
# border, bg, text color # 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 tray_output none
wheel_up_cmd nop wheel_up_cmd nop
wheel_down_cmd nop wheel_down_cmd nop

59
configs/i3blocks-scripts/cpu_usage_old

@ -1,59 +0,0 @@
#!/usr/bin/perl
#
# Copyright 2014 Pierre Mavro <deimos@deimos.fr>
# Copyright 2014 Vivien Didelot <vivien@didelot.org>
# Copyright 2014 Andreas Guldstrand <andreas.guldstrand@gmail.com>
#
# 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 <warning>] [-c <critical>]\n";
print "-w <percent>: warning threshold to become yellow\n";
print "-c <percent>: 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 (<MPSTAT>) {
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;

4
configs/i3blocks-scripts/name

@ -1,8 +1,4 @@
#!/bin/bash #!/bin/bash
. "/home/kevin/.cache/wal/colors.sh" . "/home/kevin/.cache/wal/colors.sh"
# echo "Kevin"
printf "Kevin\n\n%s\n" "$color7" printf "Kevin\n\n%s\n" "$color7"
# echo "<span foreground=\"$foreground\">Kevin</span>"
# echo "<span foreground=\"$color2\">Kevin</span>"

4
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"

15
configs/i3blocks-scripts/spotify.py

@ -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

16
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

4
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"

2
configs/i3blocks/i3blocks.conf

@ -1,7 +1,7 @@
# The top properties below are applied to every block, but can be overridden. # The top properties below are applied to every block, but can be overridden.
# Each block command defaults to the script name to avoid boilerplate. # Each block command defaults to the script name to avoid boilerplate.
align=center align=center
command=~/linux-config/configs/i3blocks-scripts/$BLOCK_NAME
command=/home/kevin/linux-config/configs/i3blocks-scripts/$BLOCK_NAME
separator=true separator=true
separator_block_width=25 separator_block_width=25
markup=pango markup=pango

7
configs/sam-i3blocks/sam-i3blocks.conf

@ -2,6 +2,7 @@
# The top properties below are applied to every block, but can be overridden. # The top properties below are applied to every block, but can be overridden.
# Each block command defaults to the script name to avoid boilerplate. # Each block command defaults to the script name to avoid boilerplate.
align=center align=center
command=/home/kevin/linux-config/configs/i3blocks-scripts/$BLOCK_NAME
separator=true separator=true
separator_block_width=25 separator_block_width=25
markup=pango markup=pango
@ -9,7 +10,7 @@ color=#cbe4ff
# }}} Global properties # # }}} Global properties #
[spotify] [spotify]
command=python ~/linux-config/configs/i3blocks-scripts/spotify.py
# command=python ~/linux-config/configs/i3blocks-scripts/spotify.py
label= label=
# label=🎧 # label=🎧
# green # green
@ -18,8 +19,8 @@ label=
# color=#2d7272 # color=#2d7272
interval=10 interval=10
[time]
[time_short]
# label=🕓 # label=🕓
command=echo "$(date '+%H:%M')"
# command=echo "$(date '+%H:%M')"
interval=30 interval=30
# color=#acc0cd # color=#acc0cd

4
dotfiles/.zshrc

@ -121,8 +121,9 @@ fi
# pywal # pywal
export PATH="${PATH}:${HOME}/.local/bin/:${HOME}/linux-config/scripts:/opt/pycharm-2018.3.1/bin" export PATH="${PATH}:${HOME}/.local/bin/:${HOME}/linux-config/scripts:/opt/pycharm-2018.3.1/bin"
(cat ~/.cache/wal/sequences &) (cat ~/.cache/wal/sequences &)
# export pywal colors
source ~/.cache/wal/colors.sh source ~/.cache/wal/colors.sh
export COLOR7="${color7}"
export COLOR7=$color7
xset r rate 200 60 xset r rate 200 60
@ -165,7 +166,6 @@ fi
source /home/kevin/.shortcuts source /home/kevin/.shortcuts
source /home/kevin/coding/spotify-lib-vis/src/api-keys.sh source /home/kevin/coding/spotify-lib-vis/src/api-keys.sh
# export pywal colors
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
# add-zsh-hook -Uz chpwd (){ ls -a; } # add-zsh-hook -Uz chpwd (){ ls -a; }

Loading…
Cancel
Save