diff options
| author | benj <benj@rse8.com> | 2019-09-09 15:22:07 -0700 |
|---|---|---|
| committer | benj <benj@rse8.com> | 2019-09-09 15:22:07 -0700 |
| commit | 29358b8d15ec1ddd8d2c11e2f2f6964ec49edc52 (patch) | |
| tree | 3d5647c6708af07fd34c88054eb9f94bf28d1451 /des/i3 | |
| parent | dd8097084fe0d159f0a357f426fca986895e5ef4 (diff) | |
| download | setup-29358b8d15ec1ddd8d2c11e2f2f6964ec49edc52.tar setup-29358b8d15ec1ddd8d2c11e2f2f6964ec49edc52.tar.gz setup-29358b8d15ec1ddd8d2c11e2f2f6964ec49edc52.tar.bz2 setup-29358b8d15ec1ddd8d2c11e2f2f6964ec49edc52.tar.lz setup-29358b8d15ec1ddd8d2c11e2f2f6964ec49edc52.tar.xz setup-29358b8d15ec1ddd8d2c11e2f2f6964ec49edc52.tar.zst setup-29358b8d15ec1ddd8d2c11e2f2f6964ec49edc52.zip | |
basic i3 setup
Diffstat (limited to 'des/i3')
| -rw-r--r-- | des/i3/assets/wallpaper/yosemite_color_block.png | bin | 0 -> 278638 bytes | |||
| -rw-r--r-- | des/i3/config | 224 | ||||
| -rw-r--r-- | des/i3/i3blocks/config | 46 | ||||
| -rwxr-xr-x | des/i3/i3blocks/scripts/archupdates | 10 | ||||
| -rwxr-xr-x | des/i3/i3blocks/scripts/bandwidth | 88 | ||||
| -rwxr-xr-x | des/i3/i3blocks/scripts/battery | 29 | ||||
| -rwxr-xr-x | des/i3/i3blocks/scripts/brightness | 10 | ||||
| -rwxr-xr-x | des/i3/i3blocks/scripts/calendar | 40 | ||||
| -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 | 70 | ||||
| -rwxr-xr-x | des/i3/i3lock.sh | 6 |
13 files changed, 651 insertions, 0 deletions
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/des/i3/config b/des/i3/config new file mode 100644 index 0000000..0988813 --- /dev/null +++ b/des/i3/config @@ -0,0 +1,224 @@ +# This file has been auto-generated by i3-config-wizard(1). +# It will not be overwritten, so edit it as you like. +# +# Should you change your keyboard layout some time, delete +# this file and re-run i3-config-wizard(1). +# +# i3 config file (v4) +# +# Please see https://i3wm.org/docs/userguide.html for a complete reference! + +set $mod Mod4 + +# Font for window titles. Will also be used by the bar unless a different font +# is used in the bar {} block below. +font pango:monospace 8 + +# This font is widely installed, provides lots of unicode glyphs, right-to-left +# text rendering and scalability on retina/hidpi displays (thanks to pango). +# font pango:DejaVu Sans Mono 8 +font pango:Source Code Pro 8 + +# Background +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 + +# The combination of xss-lock, nm-applet and pactl is a popular choice, so +# they are included here as an example. Modify as you see fit. + +# Lock screen with i3lock and custom wallpaper +exec --no-startup-id /usr/local/bin/i3lock + +## Allow yad to float for i3bar calendar +for_window [class="Yad"] floating enable + +# NetworkManager is the most popular way to manage wireless networks on Linux, +# and nm-applet is a desktop environment-independent system tray GUI for it. +exec --no-startup-id nm-applet + +# Use pactl to adjust volume in PulseAudio. +bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +5% && pkill -SIGRTMIN+10 i3blocks +bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -5% && pkill -SIGRTMIN+10 i3blocks +bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && pkill -SIGRTMIN+10 i3blocks + +# Use change_brightness (in .setup dir) to adjust backlight +bindsym XF86MonBrightnessUp exec --no-startup-id change_brightness -i 50 && pkill -SIGRTMIN+9 i3blocks +bindsym XF86MonBrightnessDown exec --no-startup-id change_brightness -d 50 && pkill -SIGRTMIN+9 i3blocks + +# Use format_displays (in .setup dir) to configure external displays +bindsym XF86LaunchA exec --no-startup-id format_displays + +# Use Mouse+$mod to drag floating windows to their wanted position +floating_modifier $mod + +# start a terminal +bindsym $mod+Return exec urxvt + +# kill focused window +bindsym $mod+q kill + +# start dmenu (a program launcher) +# bindsym $mod+space exec --no-startup-id dmenu_run +# There also is the (new) i3-dmenu-desktop which only displays applications +# shipping a .desktop file. It is a wrapper around dmenu, so you need that +# installed. +# bindsym $mod+space exec --no-startup-id i3-dmenu-desktop +bindsym $mod+space exec --no-startup-id rofi -lines 5 -padding 18 -width 60 -location 0 -show drun -sidebar-mode -columns 3 -font 'Source Code Pro 18' +bindsym $mod+Tab exec --no-startup-id rofi -lines 5 -padding 18 -width 60 -location 0 -show window -sidebar-mode -columns 4 -font 'Source Code Pro 18' + +# change focus +bindsym $mod+h focus left +bindsym $mod+j focus down +bindsym $mod+k focus up +bindsym $mod+l focus right + +# alternatively, you can use the cursor keys: +bindsym $mod+Left focus left +bindsym $mod+Down focus down +bindsym $mod+Up focus up +bindsym $mod+Right focus right + +# move focused window +bindsym $mod+Shift+h move left +bindsym $mod+Shift+j move down +bindsym $mod+Shift+k move up +bindsym $mod+Shift+l move right + +# alternatively, you can use the cursor keys: +bindsym $mod+Shift+Left move left +bindsym $mod+Shift+Down move down +bindsym $mod+Shift+Up move up +bindsym $mod+Shift+Right move right + +# split in horizontal orientation +bindsym $mod+Shift+v split h + +# split in vertical orientation +bindsym $mod+v split v + +# enter fullscreen mode for the focused container +bindsym $mod+f fullscreen toggle + +# change container layout (stacked, tabbed, toggle split) +bindsym $mod+s layout stacking +bindsym $mod+w layout tabbed +bindsym $mod+e layout toggle split + +# toggle tiling / floating +bindsym $mod+Shift+d floating toggle + +# change focus between tiling / floating windows +bindsym $mod+d focus mode_toggle + +# focus the parent container +bindsym $mod+p focus parent + +# focus the child container +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. +set $ws1 "1" +set $ws2 "2" +set $ws3 "3" +set $ws4 "4" +set $ws5 "5" +set $ws6 "6" +set $ws7 "7" +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 +bindsym $mod+3 workspace $ws3 +bindsym $mod+4 workspace $ws4 +bindsym $mod+5 workspace $ws5 +bindsym $mod+6 workspace $ws6 +bindsym $mod+7 workspace $ws7 +bindsym $mod+8 workspace $ws8 +bindsym $mod+9 workspace $ws9 +bindsym $mod+0 workspace $ws10 + +# move focused container to workspace +bindsym $mod+Shift+1 move container to workspace $ws1 +bindsym $mod+Shift+2 move container to workspace $ws2 +bindsym $mod+Shift+3 move container to workspace $ws3 +bindsym $mod+Shift+4 move container to workspace $ws4 +bindsym $mod+Shift+5 move container to workspace $ws5 +bindsym $mod+Shift+6 move container to workspace $ws6 +bindsym $mod+Shift+7 move container to workspace $ws7 +bindsym $mod+Shift+8 move container to workspace $ws8 +bindsym $mod+Shift+9 move container to workspace $ws9 +bindsym $mod+Shift+0 move container to workspace $ws10 + +# reload the configuration file +bindsym $mod+Shift+c reload +# restart i3 inplace (preserves your layout/session, can be used to upgrade i3) +bindsym $mod+Shift+r restart +# exit i3 (logs you out of your X session) +bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'" + +# fullscreen videos to small sticky in corner +bindsym $mod+y fullscreen disable; floating enable; resize set 844 480; sticky enable; move position 870 25 + +# resize window (you can also use the mouse for that) +mode "resize" { + # These bindings trigger as soon as you enter the resize mode + + # Pressing left will shrink the window’s width. + # Pressing right will grow the window’s width. + # Pressing up will shrink the window’s height. + # Pressing down will grow the window’s height. + bindsym h resize shrink width 10 px or 10 ppt + bindsym j resize grow height 10 px or 10 ppt + bindsym k resize shrink height 10 px or 10 ppt + bindsym l resize grow width 10 px or 10 ppt + + # same bindings, but for the arrow keys + bindsym Left resize shrink width 10 px or 10 ppt + bindsym Down resize grow height 10 px or 10 ppt + bindsym Up resize shrink height 10 px or 10 ppt + bindsym Right resize grow width 10 px or 10 ppt + + # back to normal: Enter or Escape or $mod+r + bindsym Return mode "default" + bindsym Escape mode "default" + bindsym $mod+r mode "default" +} + +bindsym $mod+r mode "resize" + +# Start i3bar to display a workspace bar (plus the system information i3status +# finds out, if available) + +# custom bindings for i3blocks +bar { + position top + status_command i3blocks + i3bar_command i3bar -t + + font pango:Font Awesome,Source Code Pro 9 + + position bottom + mode dock + colors { + statusline #76c2d6 + background #1d2021A0 + + # Type border background text + focused_workspace #191919 #191919 #bf3f34 + active_workspace #191919 #191919 #696f89 + inactive_workspace #191919 #191919 #696f89 + urgent_workspace #191919 #191919 #c7a551 + } +} diff --git a/des/i3/i3blocks/config b/des/i3/i3blocks/config new file mode 100644 index 0000000..0835c08 --- /dev/null +++ b/des/i3/i3blocks/config @@ -0,0 +1,46 @@ +command=/usr/local/i3blocks/$BLOCK_NAME +separator=false +separator_block_width=15 +markup=pango + +[battery] +interval=1 +color=#a8afb0 + +[brightness] +interval=once +signal=9 +color=#ffff33 + +[volume] +instance=Master +interval=once +signal=10 +color=#4ca2df + +[fan] +interval=1 +color=#a8afb0 + +[bandwidth] +instance=wlp3s0 +interval=1 +# color=#859900 + +[memory] +label= +interval=1 +color=#e6ccff + +[temperature] +label= +interval=10 +color=#cb4b16 + +[archupdates] +interval=60 +color=#49E20E + +[calendar] +interval=60 +color=#ffffff diff --git a/des/i3/i3blocks/scripts/archupdates b/des/i3/i3blocks/scripts/archupdates new file mode 100755 index 0000000..c07c45f --- /dev/null +++ b/des/i3/i3blocks/scripts/archupdates @@ -0,0 +1,10 @@ +#!/usr/bin/bash + +PAC_UPDATES=$(checkupdates | wc -l) +AUR_UPDATES=$(cower -u | wc -l) + +if [[ $PAC_UPDATES -gt 0 || $AUR_UPDATES -gt 0 ]]; then + echo " [$PAC_UPDATES .. $AUR_UPDATES]" +else + echo "<span color=\"#586e75\"> 0</span>" +fi
\ No newline at end of file diff --git a/des/i3/i3blocks/scripts/bandwidth b/des/i3/i3blocks/scripts/bandwidth new file mode 100755 index 0000000..d7db2a6 --- /dev/null +++ b/des/i3/i3blocks/scripts/bandwidth @@ -0,0 +1,88 @@ +#!/bin/bash +# Copyright (C) 2012 Stefan Breunig <stefan+measure-net-speed@mathphys.fsk.uni-heidelberg.de> +# Copyright (C) 2014 kaueraal +# Copyright (C) 2015 Thiago Perrotta <perrotta dot thiago at poli dot ufrj dot br> + +# 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 the provided interface, otherwise the device used for the default route. +if [[ -n $BLOCK_INSTANCE ]]; then + INTERFACE=$BLOCK_INSTANCE +else + INTERFACE=$(ip route | awk '/^default/ { print $5 ; exit }') +fi + +# Issue #36 compliant. +if ! [ -e "/sys/class/net/${INTERFACE}/operstate" ] || ! [ "`cat /sys/class/net/${INTERFACE}/operstate`" = "up" ] +then + echo "$INTERFACE down" + echo "$INTERFACE down" + echo "#FF0000" + exit 0 +fi + +# path to store the old results in +path="/dev/shm/$(basename $0)-${INTERFACE}" + +# grabbing data for each adapter. +read rx < "/sys/class/net/${INTERFACE}/statistics/rx_bytes" +read tx < "/sys/class/net/${INTERFACE}/statistics/tx_bytes" + +# get time +time=$(date +%s) + +# write current data if file does not exist. Do not exit, this will cause +# problems if this file is sourced instead of executed as another process. +if ! [[ -f "${path}" ]]; then + echo "${time} ${rx} ${tx}" > "${path}" + chmod 0666 "${path}" +fi + +# read previous state and update data storage +read old < "${path}" +echo "${time} ${rx} ${tx}" > "${path}" + +# parse old data and calc time passed +old=(${old//;/ }) +time_diff=$(( $time - ${old[0]} )) + +# sanity check: has a positive amount of time passed +[[ "${time_diff}" -gt 0 ]] || exit + +# calc bytes transferred, and their rate in byte/s +rx_diff=$(( $rx - ${old[1]} )) +tx_diff=$(( $tx - ${old[2]} )) +rx_rate=$(( $rx_diff / $time_diff )) +tx_rate=$(( $tx_diff / $time_diff )) + +# shift by 10 bytes to get KiB/s. If the value is larger than +# 1024^2 = 1048576, then display MiB/s instead + +# incoming +echo -n "⇘" +rx_kib=$(( $rx_rate >> 10 )) +if [[ "$rx_rate" -gt 1048576 ]]; then + printf '%sM' "`echo "scale=1; $rx_kib / 1024" | bc`" +else + echo -n "${rx_kib}K" +fi + +# outgoing +echo -n "<span color=\"#93a1a1\">⇖</span>" +tx_kib=$(( $tx_rate >> 10 )) +if [[ "$tx_rate" -gt 1048576 ]]; then + printf '%sM' "`echo "scale=1; $tx_kib / 1024" | bc`" +else + echo -n "<span color=\"#93a1a1\">${tx_kib}K</span>" +fi diff --git a/des/i3/i3blocks/scripts/battery b/des/i3/i3blocks/scripts/battery new file mode 100755 index 0000000..802689b --- /dev/null +++ b/des/i3/i3blocks/scripts/battery @@ -0,0 +1,29 @@ +#!/usr/bin/bash + +BAT_DIR=/sys/class/power_supply/BAT0 +CHARGE=$(cat $BAT_DIR/capacity) +CHARGE_FULL=$(cat $BAT_DIR/charge_full) +CHARGE_NOW=$(cat $BAT_DIR/charge_now) +STATUS=$(cat $BAT_DIR/status) + +ICON_BATTERY_25_P= +ICON_BATTERY_50_P= +ICON_BATTERY_75_P= +ICON_BATTERY_FULL= +ICON_BATTERY_CHARGING= +ICON_FULL= + +PERCENT_FULL=$(echo - | awk -v charge_full="$CHARGE_FULL" -v charge_now="$CHARGE_NOW" '{printf "%1.0f\n", (charge_now / charge_full)*100}') +if [[ $STATUS == "Full" ]]; then + echo "$ICON_FULL" +elif [[ $STATUS == "Charging" ]]; then + echo "$ICON_BATTERY_CHARGING ($PERCENT_FULL%)" +elif [[ $PERCENT_FULL -lt 100 ]]; then + echo "$ICON_BATTERY_FULL ($PERCENT_FULL%)" +elif [[ $PERCENT_FULL -lt 75 ]]; then + echo "$ICON_BATTERY_75_P ($PERCENT_FULL%)" +elif [[ $PERCENT_FULL -lt 50 ]]; then + echo "$ICON_BATTERY_50_P ($PERCENT_FULL%)" +elif [[ $PERCENT_FULL -lt 25 ]]; then + echo "$ICON_BATTERY_25_P ($PERCENT_FULL%)" +fi diff --git a/des/i3/i3blocks/scripts/brightness b/des/i3/i3blocks/scripts/brightness new file mode 100755 index 0000000..64ea1d8 --- /dev/null +++ b/des/i3/i3blocks/scripts/brightness @@ -0,0 +1,10 @@ +#!/usr/bin/bash + +BRIGHTNESS_DIR=/sys/class/backlight/intel_backlight +MAX_BRIGHTNESS=$(cat $BRIGHTNESS_DIR/max_brightness) +CURR_BRIGHTNESS=$(cat $BRIGHTNESS_DIR/actual_brightness) + +ICON_BRIGHT_SUN="☀" +BRIGHTNESS_P=$(echo - | awk -v max="$MAX_BRIGHTNESS" -v curr="$CURR_BRIGHTNESS" '{printf "%1.0f\n", (curr / max)*100}') + +echo "$ICON_BRIGHT_SUN $BRIGHTNESS_P%" diff --git a/des/i3/i3blocks/scripts/calendar b/des/i3/i3blocks/scripts/calendar new file mode 100755 index 0000000..27653a5 --- /dev/null +++ b/des/i3/i3blocks/scripts/calendar @@ -0,0 +1,40 @@ +#! /bin/sh + +WIDTH=${WIDTH:-100} +HEIGHT=${HEIGHT:-100} +DATEFMT=${DATEFMT:-"+%Y-%m-%d %H:%M"} +SHORTFMT=${SHORTFMT:-"+%H:%M:%S"} + +OPTIND=1 +while getopts ":f:W:H:" opt; do + case $opt in + f) DATEFMT="$OPTARG" ;; + W) WIDTH="$OPTARG" ;; + H) HEIGHT="$OPTARG" ;; + \?) + echo "Invalid option: -$OPTARG" >&2 + exit 1 + ;; + :) + echo "Option -$OPTARG requires an argument." >&2 + exit 1 + ;; + esac +done + +case "$BLOCK_BUTTON" in + 1|2|3) + + # the position of the upper left corner of the popup + posX=$(( ( $BLOCK_X - 230 ) - $WIDTH / 2 )) + posY=$(( ( $BLOCK_Y - 200 ) - $HEIGHT )) + + i3-msg -q "exec yad --calendar \ + --width=$WIDTH --height=$HEIGHT \ + --undecorated --fixed \ + --close-on-unfocus --no-buttons \ + --posx=$posX --posy=$posY \ + > /dev/null" +esac +echo "$LABEL$(date "$DATEFMT") " +echo "$LABEL$(date "$SHORTFMT") " 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/des/i3/i3blocks/scripts/volume b/des/i3/i3blocks/scripts/volume new file mode 100755 index 0000000..1e318a0 --- /dev/null +++ b/des/i3/i3blocks/scripts/volume @@ -0,0 +1,70 @@ +#!/bin/bash +# Copyright (C) 2014 Julien Bonjean <julien@bonjean.info> +# Copyright (C) 2014 Alexander Keller <github@nycroth.com> + +# 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/>. + +#------------------------------------------------------------------------ + +# The second parameter overrides the mixer selection +# For PulseAudio users, use "pulse" +# For Jack/Jack2 users, use "jackplug" +# For ALSA users, you may use "default" for your primary card +# or you may use hw:# where # is the number of the card desired +MIXER="default" +[ -n "$(lsmod | grep pulse)" ] && MIXER="pulse" +[ -n "$(lsmod | grep jack)" ] && MIXER="jackplug" +MIXER="${2:-$MIXER}" + +# The instance option sets the control to report and configure +# This defaults to the first control of your selected mixer +# For a list of the available, use `amixer -D $Your_Mixer scontrols` +SCONTROL="${BLOCK_INSTANCE:-$(amixer -D $MIXER scontrols | + sed -n "s/Simple mixer control '\([A-Za-z ]*\)',0/\1/p" | + head -n1 + )}" + +# The first parameter sets the step to change the volume by (and units to display) +# This may be in in % or dB (eg. 5% or 3dB) +STEP="${1:-5%}" + +#------------------------------------------------------------------------ + +capability() { # Return "Capture" if the device is a capture device + amixer -D $MIXER get $SCONTROL | + sed -n "s/ Capabilities:.*cvolume.*/Capture/p" +} + +volume() { + amixer -D $MIXER get $SCONTROL $(capability) +} + +format() { + perl_filter='if (/.*\[(\d+%)\] (\[(-?\d+.\d+dB)\] )?\[(on|off)\]/)' + perl_filter+='{CORE::say $4 eq "off" ? " MUTE" : "' + # If dB was selected, print that instead + perl_filter+=$([[ $STEP = *dB ]] && echo '$3' || echo ' $1') + perl_filter+='"; exit}' + perl -ne "$perl_filter" +} + +#------------------------------------------------------------------------ + +case $BLOCK_BUTTON in + 3) amixer -q -D $MIXER sset $SCONTROL $(capability) toggle ;; # right click, mute/unmute + 4) amixer -q -D $MIXER sset $SCONTROL $(capability) ${STEP}+ unmute ;; # scroll up, increase + 5) amixer -q -D $MIXER sset $SCONTROL $(capability) ${STEP}- unmute ;; # scroll down, decrease +esac + +volume | format diff --git a/des/i3/i3lock.sh b/des/i3/i3lock.sh new file mode 100755 index 0000000..39bd8da --- /dev/null +++ b/des/i3/i3lock.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +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" & |
