diff options
| -rw-r--r-- | .bashrc | 2 | ||||
| -rw-r--r-- | des/i3/assets/wallpaper/yosemite_color_block.png | bin | 0 -> 278638 bytes | |||
| -rw-r--r-- | des/i3/config (renamed from configs/i3/config) | 17 | ||||
| -rw-r--r-- | des/i3/i3blocks/config (renamed from configs/i3/i3blocks/config) | 14 | ||||
| -rwxr-xr-x | des/i3/i3blocks/scripts/archupdates (renamed from configs/i3/i3blocks/scripts/archupdates) | 0 | ||||
| -rwxr-xr-x | des/i3/i3blocks/scripts/bandwidth (renamed from configs/i3/i3blocks/scripts/bandwidth) | 0 | ||||
| -rwxr-xr-x | des/i3/i3blocks/scripts/battery (renamed from configs/i3/i3blocks/scripts/battery) | 0 | ||||
| -rwxr-xr-x | des/i3/i3blocks/scripts/brightness (renamed from configs/i3/i3blocks/scripts/brightness) | 0 | ||||
| -rwxr-xr-x | des/i3/i3blocks/scripts/calendar (renamed from configs/i3/i3blocks/scripts/calendar) | 2 | ||||
| -rwxr-xr-x | des/i3/i3blocks/scripts/fan | 10 | ||||
| -rwxr-xr-x | des/i3/i3blocks/scripts/memory | 49 | ||||
| -rwxr-xr-x | des/i3/i3blocks/scripts/temperature | 69 | ||||
| -rwxr-xr-x | des/i3/i3blocks/scripts/volume (renamed from configs/i3/i3blocks/scripts/volume) | 0 | ||||
| -rwxr-xr-x | des/i3/i3lock.sh (renamed from configs/i3/i3lock.sh) | 2 | ||||
| -rwxr-xr-x | scripts/backup.sh | 9 | ||||
| -rwxr-xr-x | scripts/change_fan.sh | 79 | ||||
| -rwxr-xr-x | scripts/format_displays.sh (renamed from configs/i3/format_displays.sh) | 2 |
17 files changed, 238 insertions, 17 deletions
@@ -71,7 +71,7 @@ elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then alias ls='ls --color=auto' # Setup keychain - /usr/bin/keychain $HOME/.ssh/id_rsa $HOME/.ssh/id_ed25519 + /usr/bin/keychain $HOME/.ssh/id_rsa $HOME/.ssh/id_ed25519 $HOME/.ssh/nido_id_ed25519 /usr/bin/keychain --agents gpg AE38865D . $HOME/.keychain/${HOSTNAME}-sh . $HOME/.keychain/${HOSTNAME}-sh-gpg diff --git a/des/i3/assets/wallpaper/yosemite_color_block.png b/des/i3/assets/wallpaper/yosemite_color_block.png Binary files differnew file mode 100644 index 0000000..d90a311 --- /dev/null +++ b/des/i3/assets/wallpaper/yosemite_color_block.png diff --git a/configs/i3/config b/des/i3/config index e709703..0988813 100644 --- a/configs/i3/config +++ b/des/i3/config @@ -20,7 +20,7 @@ font pango:monospace 8 font pango:Source Code Pro 8 # Background -exec --no-startup-id feh --bg-fill ~/pictures/Yosemite-Color-Block.png +exec --no-startup-id feh --bg-fill ~/.setup/des/i3/assets/wallpaper/yosemite_color_block.png # Compositor exec --no-startup-id compton --config ~/.config/compton.conf -b @@ -93,10 +93,10 @@ bindsym $mod+Shift+Up move up bindsym $mod+Shift+Right move right # split in horizontal orientation -bindsym $mod+equal split h +bindsym $mod+Shift+v split h # split in vertical orientation -bindsym $mod+Shift+equal split v +bindsym $mod+v split v # enter fullscreen mode for the focused container bindsym $mod+f fullscreen toggle @@ -113,10 +113,10 @@ bindsym $mod+Shift+d floating toggle bindsym $mod+d focus mode_toggle # focus the parent container -bindsym $mod+a focus parent +bindsym $mod+p focus parent # focus the child container -#bindsym $mod+d focus child +bindsym $mod+n focus child # Define names for default workspaces for which we configure key bindings later on. # We use variables to avoid repeating the names in multiple places. @@ -131,6 +131,12 @@ set $ws8 "8" set $ws9 "9" set $ws10 "10" +# switch to monitor +bindsym $mod+Mod1+1 focus output eDP-1 +bindsym $mod+Mod1+2 focus output DP-1 +bindsym $mod+Mod1+3 focus output DP-2 +bindsym $mod+Mod1+4 focus output HDMI-1 + # switch to workspace bindsym $mod+1 workspace $ws1 bindsym $mod+2 workspace $ws2 @@ -197,6 +203,7 @@ bindsym $mod+r mode "resize" # custom bindings for i3blocks bar { + position top status_command i3blocks i3bar_command i3bar -t diff --git a/configs/i3/i3blocks/config b/des/i3/i3blocks/config index 34a7aef..0835c08 100644 --- a/configs/i3/i3blocks/config +++ b/des/i3/i3blocks/config @@ -1,28 +1,28 @@ -command=/usr/lib/i3blocks/$BLOCK_NAME +command=/usr/local/i3blocks/$BLOCK_NAME separator=false separator_block_width=15 markup=pango [battery] -command=/usr/local/i3blocks/$BLOCK_NAME interval=1 -color=#eee8d5 +color=#a8afb0 [brightness] -command=/usr/local/i3blocks/$BLOCK_NAME interval=once signal=9 color=#ffff33 [volume] -command=/usr/local/i3blocks/$BLOCK_NAME instance=Master interval=once signal=10 color=#4ca2df +[fan] +interval=1 +color=#a8afb0 + [bandwidth] -command=/usr/local/i3blocks/$BLOCK_NAME instance=wlp3s0 interval=1 # color=#859900 @@ -38,11 +38,9 @@ interval=10 color=#cb4b16 [archupdates] -command=/usr/local/i3blocks/$BLOCK_NAME interval=60 color=#49E20E [calendar] -command=/usr/local/i3blocks/calendar interval=60 color=#ffffff diff --git a/configs/i3/i3blocks/scripts/archupdates b/des/i3/i3blocks/scripts/archupdates index c07c45f..c07c45f 100755 --- a/configs/i3/i3blocks/scripts/archupdates +++ b/des/i3/i3blocks/scripts/archupdates diff --git a/configs/i3/i3blocks/scripts/bandwidth b/des/i3/i3blocks/scripts/bandwidth index d7db2a6..d7db2a6 100755 --- a/configs/i3/i3blocks/scripts/bandwidth +++ b/des/i3/i3blocks/scripts/bandwidth diff --git a/configs/i3/i3blocks/scripts/battery b/des/i3/i3blocks/scripts/battery index 802689b..802689b 100755 --- a/configs/i3/i3blocks/scripts/battery +++ b/des/i3/i3blocks/scripts/battery diff --git a/configs/i3/i3blocks/scripts/brightness b/des/i3/i3blocks/scripts/brightness index 64ea1d8..64ea1d8 100755 --- a/configs/i3/i3blocks/scripts/brightness +++ b/des/i3/i3blocks/scripts/brightness diff --git a/configs/i3/i3blocks/scripts/calendar b/des/i3/i3blocks/scripts/calendar index 7ad0363..27653a5 100755 --- a/configs/i3/i3blocks/scripts/calendar +++ b/des/i3/i3blocks/scripts/calendar @@ -2,7 +2,7 @@ WIDTH=${WIDTH:-100} HEIGHT=${HEIGHT:-100} -DATEFMT=${DATEFMT:-"+%Y-%M-%d %H:%m"} +DATEFMT=${DATEFMT:-"+%Y-%m-%d %H:%M"} SHORTFMT=${SHORTFMT:-"+%H:%M:%S"} OPTIND=1 diff --git a/des/i3/i3blocks/scripts/fan b/des/i3/i3blocks/scripts/fan new file mode 100755 index 0000000..84f1725 --- /dev/null +++ b/des/i3/i3blocks/scripts/fan @@ -0,0 +1,10 @@ +#!/usr/bin/bash + +FAN_DIR=/sys/devices/platform/applesmc.768 +MAX_FAN=$(cat $FAN_DIR/fan1_max) +CURR_FAN=$(cat $FAN_DIR/fan1_output) + +ICON_FAN="" +FAN_P=$(echo - | awk -v max="$MAX_FAN" -v curr="$CURR_FAN" '{printf "%1.0f\n", (curr / max)*100}') + +echo "$ICON_FAN $FAN_P%" diff --git a/des/i3/i3blocks/scripts/memory b/des/i3/i3blocks/scripts/memory new file mode 100755 index 0000000..e28af4e --- /dev/null +++ b/des/i3/i3blocks/scripts/memory @@ -0,0 +1,49 @@ +#!/bin/sh +# Copyright (C) 2014 Julien Bonjean <julien@bonjean.info> + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +TYPE="${BLOCK_INSTANCE:-mem}" + +awk -v type=$TYPE ' +/^MemTotal:/ { + mem_total=$2 +} +/^MemFree:/ { + mem_free=$2 +} +/^Buffers:/ { + mem_free+=$2 +} +/^Cached:/ { + mem_free+=$2 +} +/^SwapTotal:/ { + swap_total=$2 +} +/^SwapFree:/ { + swap_free=$2 +} +END { + # full text + if (type == "swap") + printf("%.1fG\n", (swap_total-swap_free)/1024/1024) + else + printf("%.1fG\n", mem_free/1024/1024) + + # TODO: short text + + # TODO: color (if less than X%) +} +' /proc/meminfo diff --git a/des/i3/i3blocks/scripts/temperature b/des/i3/i3blocks/scripts/temperature new file mode 100755 index 0000000..ad745c3 --- /dev/null +++ b/des/i3/i3blocks/scripts/temperature @@ -0,0 +1,69 @@ +#!/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> +# Copyright 2014 Benjamin Chretien <chretien at lirmm dot fr> + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +use strict; +use warnings; +use utf8; +use Getopt::Long; + +binmode(STDOUT, ":utf8"); + +# default values +my $t_warn = 70; +my $t_crit = 90; +my $chip = ""; +my $temperature = -9999; + +sub help { + print "Usage: temperature [-w <warning>] [-c <critical>] [--chip <chip>]\n"; + print "-w <percent>: warning threshold to become yellow\n"; + print "-c <percent>: critical threshold to become red\n"; + print "--chip <chip>: sensor chip\n"; + exit 0; +} + +GetOptions("help|h" => \&help, + "w=i" => \$t_warn, + "c=i" => \$t_crit, + "chip=s" => \$chip); + +# Get chip temperature +open (SENSORS, "sensors -u $chip |") or die; +while (<SENSORS>) { + if (/^\s+temp1_input:\s+[\+]*([\-]*\d+\.\d)/) { + $temperature = $1; + last; + } +} +close(SENSORS); + +$temperature eq -9999 and die 'Cannot find temperature'; + +# Print short_text, full_text +print "$temperature°C\n" x2; + +# Print color, if needed +if ($temperature >= $t_crit) { + print "#FF0000\n"; + exit 33; +} elsif ($temperature >= $t_warn) { + print "#FFFC00\n"; +} + +exit 0; diff --git a/configs/i3/i3blocks/scripts/volume b/des/i3/i3blocks/scripts/volume index 1e318a0..1e318a0 100755 --- a/configs/i3/i3blocks/scripts/volume +++ b/des/i3/i3blocks/scripts/volume diff --git a/configs/i3/i3lock.sh b/des/i3/i3lock.sh index 822451d..39bd8da 100755 --- a/configs/i3/i3lock.sh +++ b/des/i3/i3lock.sh @@ -1,6 +1,6 @@ #!/bin/bash -IMG="~/pictures/Yosemite-Color-Block.png" +IMG="~/.setup/des/i3/assets/wallpaper/yosemite_color_block.png" xautolock -time 1 -locker "i3lock -i $IMG" -notify 20 -notifier 'xset dpms force off' & xautolock -time 10 -locker "systemctl suspend" & diff --git a/scripts/backup.sh b/scripts/backup.sh new file mode 100755 index 0000000..caf5b7b --- /dev/null +++ b/scripts/backup.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +## +# Create full tree backups to specified media + +GLOBAL_MEDIA_BLOCK=$1 + +echo "Beginning rsync full system backup / -> $GLOBAL_MEDIA_BLOCK" +rsync -SHaAX --delete --info=progress2 --exclude={"/dev/*", "/proc/*", "/sys/*", "/tmp/*", "/run/*", "/mnt/*", "/lost+found"} / $1 diff --git a/scripts/change_fan.sh b/scripts/change_fan.sh new file mode 100755 index 0000000..b290700 --- /dev/null +++ b/scripts/change_fan.sh @@ -0,0 +1,79 @@ +#!/usr/bin/env bash + +## It would be nice to check the system and dynamically figure out which fan controller +## is being used...but I don't need that right now. + +# echo "1" > /sys/devices/platform/applesmc.768/fan1_manual +# echo "9000" > /sys/devices/platform/applesmc.768/fan1_output +# cat /sys/devices/platform/applesmc.768/fan1_output + +FAN_DIR=/sys/devices/platform/applesmc.768 +FAN_OUT=$FAN_DIR/fan1_output +FAN_MANUAL=$FAN_DIR/fan1_manual +MAX_FAN=$(cat $FAN_DIR/fan1_max) +MIN_FAN=$(cat $FAN_DIR/fan1_min) + +function toggle_mbpfan() { + SHOULD_DEACTIVE=$1 + IS_ACTIVE=$(systemctl is-active mbpfan) + if [[ "$SHOULD_DEACTIVE" == "false" ]]; then + echo "force deactive!" + echo "0" > "$FAN_MANUAL" + sudo systemctl start mbpfan + return + elif [[ "$IS_ACTIVE" == "active" || "$SHOULD_DEACTIVE" == "true" ]]; then + sudo systemctl stop mbpfan + echo "force active!" + echo "1" > "$FAN_MANUAL" + return + else + echo "force deactive and start mbpfan" + echo "there!" + echo "0" > "$FAN_MANUAL" + sudo systemctl start mbpfan + return + fi +} + +function increase_fan() { + CURR_SPEED=$(cat $FAN_DIR/fan1_output) + NEXT_SPEED=$(echo - | awk -v curr="$CURR_SPEED" '{printf "%1.0f", (curr + 500)}') + + # deactivate mbpfan + toggle_mbpfan "true" + + if [[ $NEXT_SPEED -lt $MAX_FAN ]]; then + echo $NEXT_SPEED > "$FAN_OUT" + else + echo $MAX_FAN > "$FAN_OUT" + fi +} + +function decrease_fan() { + CURR_SPEED=$(cat $FAN_DIR/fan1_output) + NEXT_SPEED=$(echo - | awk -v curr="$CURR_SPEED" '{printf "%1.0f", (curr - 500)}') + + # deactivate mbpfan + toggle_mbpfan "true" + + if [[ $NEXT_SPEED -gt $MIN_FAN ]]; then + echo $NEXT_SPEED > "$FAN_OUT" + else + # no reason to ever this low. + # let the system take back over, since the user probably forgot + toggle_mbpfan "false" + fi +} + +while getopts ":idt" opt; do + case ${opt} in + t) toggle_mbpfan + ;; + i) increase_fan + ;; + d) decrease_fan + ;; + \? ) + ;; + esac +done diff --git a/configs/i3/format_displays.sh b/scripts/format_displays.sh index 68279d7..acb2638 100755 --- a/configs/i3/format_displays.sh +++ b/scripts/format_displays.sh @@ -4,7 +4,7 @@ DISPLAYS=( $(xrandr | grep " connected" | awk '{print $1}') ) declare -A DISP_RES -BG_IMG="~/pictures/Yosemite-Color-Block.png" +BG_IMG="~/.setup/des/i3/assets/wallpaper/yosemite_color_block.png" VERBOSE="" if_echo () { |
