1
0
mirror of https://github.com/frebib/dotfiles.git synced 2024-06-14 12:57:23 +00:00

Merge remote-tracking branch 'origin/master' into surface

This commit is contained in:
Joe Groocock 2018-11-22 09:13:00 +00:00
commit 7ec8be00be
Signed by: frebib
GPG Key ID: E0B16BEACFBB6A86
34 changed files with 637 additions and 1365 deletions

View File

@ -29,7 +29,7 @@
*.color15: #eceff1 *.color15: #eceff1
Xft.dpi: 136 Xft.dpi: 140
Xft.antialias: true Xft.antialias: true
Xft.rgba: rgb Xft.rgba: rgb
Xft.hinting: true Xft.hinting: true
@ -43,7 +43,7 @@ Xcursor.theme: Breeze_Obsidian
!!======================!! !!======================!!
urxvt.depth: 32 urxvt.depth: 32
urxvt.internalBorder: 6 urxvt.internalBorder: 16
urxvt.blurRadius: 25 urxvt.blurRadius: 25
urxvt.saveLines: 10000 urxvt.saveLines: 10000
urxvt.preeditType: Root urxvt.preeditType: Root

View File

@ -25,11 +25,11 @@ window:
# Window padding (changes require restart) # Window padding (changes require restart)
# #
# Blank space added around the window in pixels. This padding is not scaled # Blank space added around the window in pixels. This padding is scaled
# by DPI and the specified value is always added at both opposing sides. # by DPI and the specified value is always added at both opposing sides.
padding: padding:
x: 8 x: 15
y: 8 y: 15
# Window decorations # Window decorations
# #
@ -120,20 +120,9 @@ font:
x: 0 x: 0
y: 0 y: 0
# Scale the font size based on the monitor's DPI. This will lead to bigger text on HiDPI
# screens and make reading text a little easier.
# On X11 it is possible to change the DPI for each instance of alacritty by using
# `WINIT_HIDPI_FACTOR=1.0 alacritty` to scale the font.
scale_with_dpi: true
# Display the time it takes to redraw each frame. # Display the time it takes to redraw each frame.
render_timer: false render_timer: false
# Use custom cursor colors. If `true`, the `colors.cursor.foreground` and
# `colors.cursor.background` colors will be used to display the cursor.
# Otherwise the cell colors are inverted for the cursor.
custom_cursor_colors: true
# If `true`, bold text is drawn using the bright color variants. # If `true`, bold text is drawn using the bright color variants.
draw_bold_text_with_bright_colors: true draw_bold_text_with_bright_colors: true
@ -247,6 +236,22 @@ mouse:
double_click: { threshold: 300 } double_click: { threshold: 300 }
triple_click: { threshold: 300 } triple_click: { threshold: 300 }
# If this is `true`, the cursor is temporarily hidden when typing.
hide_when_typing: false
url:
# URL launcher
#
# This program is executed when clicking on a text which is recognized as a URL.
# The URL is always added to the command as the last parameter.
launcher: xdg-open
# URL modifiers
#
# These are the modifiers that need to be held down for opening URLs when clicking
# on them. The available modifiers are documented in the key binding section.
#modifiers: Control|Shift
selection: selection:
semantic_escape_chars: ",│`|:\"' ()[]{}<>" semantic_escape_chars: ",│`|:\"' ()[]{}<>"
@ -257,19 +262,18 @@ selection:
dynamic_title: true dynamic_title: true
hide_cursor_when_typing: false cursor:
# Cursor style
#
# Values for 'style':
# - ▇ Block
# - _ Underline
# - | Beam
style: Block
# Cursor style # If this is `true`, the cursor will be rendered as a hollow box when the
# # window is not focused.
# Values for 'cursor_style': unfocused_hollow: true
# - Block
# - Underline
# - Beam
cursor_style: Block
# If this is `true`, the cursor will be rendered as a hollow box when the
# window is not focused.
unfocused_hollow_cursor: true
# Live config reload (changes require restart) # Live config reload (changes require restart)
live_config_reload: true live_config_reload: true

View File

@ -31,9 +31,9 @@ alpha-step = 0.02; # XRender backend: Step size for alpha pictures. Increasin
# Blurring # Blurring
blur-method = "dual_kawase"; blur-method = "dual_kawase";
blur-strength = 5; blur-strength = 6;
blur-background = true; # Blur background of transparent windows. blur-background = true; # Blur background of transparent windows.
blur-background-exclude = [ "class_g = 'Peek'", "class_g = 'Onboard'", "class_g = 'slop'" ]; blur-background-exclude = [ "class_g = 'Peek'", "class_g = 'Onboard'", "class_g = 'slop'", "class_g = 'Polybar'" ];
blur-background-frame = true; # Blur background of opaque windows with transparent blur-background-frame = true; # Blur background of opaque windows with transparent
# frames as well. # frames as well.
blur-background-fixed = false; # Do not let blur radius adjust based on window opacity. blur-background-fixed = false; # Do not let blur radius adjust based on window opacity.

View File

@ -1,5 +1,5 @@
[global] [global]
font = sans-serif 9.5 font = sans 9
# Allow a small subset of html markup: # Allow a small subset of html markup:
# <b>bold</b> # <b>bold</b>
@ -64,8 +64,8 @@
# The width can be negative. In this case the actual width is the # The width can be negative. In this case the actual width is the
# screen width minus the width defined in within the geometry option. # screen width minus the width defined in within the geometry option.
# 58 = 30 + 28 (bar-height) # 53 = 30 + 23 (bar-height)
geometry = "350x6-30+58" geometry = "560x5-30+30"
# Shrink window if it's smaller than the width. Will be ignored if # Shrink window if it's smaller than the width. Will be ignored if
# width is 0. # width is 0.
@ -74,7 +74,7 @@
# The transparency of the window. Range: [0; 100]. # The transparency of the window. Range: [0; 100].
# This option will only work if a compositing windowmanager is # This option will only work if a compositing windowmanager is
# present (e.g. xcompmgr, compiz, etc.). # present (e.g. xcompmgr, compiz, etc.).
transparency = 10 transparency = 15
# Don't remove messages, if the user is idle (no mouse or keyboard input) # Don't remove messages, if the user is idle (no mouse or keyboard input)
# for longer than idle_threshold seconds. # for longer than idle_threshold seconds.
@ -118,7 +118,7 @@
separator_height = 2 separator_height = 2
# Padding between text and separator. # Padding between text and separator.
padding = 12 padding = 15
# Horizontal padding. # Horizontal padding.
horizontal_padding = 16 horizontal_padding = 16
@ -150,7 +150,7 @@
# Paths to default icons. # Paths to default icons.
icon_path = /usr/share/icons/Xenlism-Wildfire/Status/:/usr/share/icons/Xenlism-Wildfire/Devices/:/usr/share/icons/Adwaita/32x32/status:/usr/share/icons/Adwaita/32x32/devices icon_path = /usr/share/icons/Xenlism-Wildfire/Status/:/usr/share/icons/Xenlism-Wildfire/Devices/:/usr/share/icons/Adwaita/32x32/status:/usr/share/icons/Adwaita/32x32/devices
frame_width = 4 frame_width = 0
frame_color = "#404552" frame_color = "#404552"
[shortcuts] [shortcuts]

View File

@ -4,7 +4,7 @@
signingkey = CFBB6A86 signingkey = CFBB6A86
[core] [core]
autocrlf = input autocrlf = input
excludesfile = $HOME/.config/git/gitignore excludesfile = /home/frebib/.config/git/gitignore
pager = diff-highlight | $PAGER pager = diff-highlight | $PAGER
[interactive] [interactive]
diffFilter = diff-highlight diffFilter = diff-highlight

View File

@ -1,5 +1,15 @@
VteTerminal, VteTerminal,
TerminalScreen, TerminalScreen,
vte-terminal { vte-terminal {
padding: 9px; padding: 1.3em;
}
.window-frame, .window-frame:backdrop {
margin: 0;
border-style: none;
border-radius: 0;
}
.titlebar {
border-radius: 0;
} }

View File

@ -1,21 +0,0 @@
#!/bin/sh
# Set how much you want the brightness to change
DELTA=2
# Get the current light level, rounded to an integer
LIGHT=$(printf '%.*f' 0 $(xbacklight -get))
NEW_LIGHT=$LIGHT
# If called from i3blocks, and scrolling, then change light level
case $BLOCK_BUTTON in
5) NEW_LIGHT=$(expr $LIGHT + $DELTA) ;;
4) NEW_LIGHT=$(expr $LIGHT - $DELTA) ;;
esac
xbacklight -set $NEW_LIGHT -time 0 -steps 1
# Output the new light level
OUTPUT=$(printf '%.*f%%' 0 $(xbacklight -get))
echo $OUTPUT
echo $OUTPUT

View File

@ -1,90 +0,0 @@
#!/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 '%sk' "`echo "scale=1; $rx_kib / 1024" | bc`"
else
echo -n "${rx_kib}k"
fi
echo -n " "
# outgoing
echo -n " "
tx_kib=$(( $tx_rate >> 10 ))
if [[ "$tx_rate" -gt 1048576 ]]; then
printf '%sm' "`echo "scale=1; $tx_kib / 1024" | bc`"
else
echo -n "${tx_kib}k"
fi

View File

@ -1,95 +0,0 @@
#!/usr/bin/perl
#
# Copyright 2014 Pierre Mavro <deimos@deimos.fr>
# Copyright 2014 Vivien Didelot <vivien@didelot.org>
#
# Licensed under the terms of the GNU GPL v3, or any later version.
#
# This script is meant to use with i3blocks. It parses the output of the "acpi"
# command (often provided by a package of the same name) to read the status of
# the battery, and eventually its remaining time (to full charge or discharge).
#
# The color will gradually change for a percentage below 85%, and the urgency
# (exit code 33) is set if there is less that 5% remaining.
use strict;
use warnings;
use Switch;
my $acpi;
my $status;
my $percent;
my $hours = -1;
my $mins;
my $full_text;
my $short_text;
my $bat_number = $ENV{BLOCK_INSTANCE} || 0;
# read the first line of the "acpi" command output
open (ACPI, "acpi -b | grep 'Battery $bat_number' |") or die;
$acpi = <ACPI>;
close(ACPI);
# fail on unexpected output
if ($acpi !~ /: (\w+), (\d+)%/) {
die "$acpi\n";
}
$status = $1;
$percent = $2;
if ($acpi =~ /, (\d+):(\d+)/) {
$hours = $1;
$mins = $2;
}
if ($status eq 'Discharging') {
if ($percent <= 10) {
$full_text = "";
} elsif ($percent <= 40) {
$full_text = "";
} elsif ($percent <= 75) {
$full_text = "";
} else {
$full_text = "";
}
} elsif ($status eq 'Charging') {
$full_text = '';
} else {
$full_text = '';
}
$full_text .= " $percent%";
$short_text = $full_text;
switch($ENV{BLOCK_BUTTON} || 0) {
case "1" {
if ($hours lt 0) {
$full_text .= " Charged";
} else {
$full_text .= " ($hours:$mins";
if ($status eq 'Discharging') {
$full_text .= ")";
} else {
$full_text .= " until full)";
}
}
}
}
# print text
print "$full_text\n";
print "$short_text\n";
# consider color and urgent flag only on discharge
if ($status eq 'Discharging') {
if ($percent < 20) {
print "#FF0000\n";
} elsif ($percent < 40) {
print "#FFCB00\n";
}
}
exit(0);

View File

@ -1,5 +0,0 @@
case $BLOCK_BUTTON in
1) printf " "$(date '+%d/%m/%y') ; exit ;;
2|3) i3-sensible-terminal -r i3blocks-clock-term --geometry 68x35 -e "$SHELL -c \"cal -y $(date +'%Y');$SHELL\"" &>/dev/null & ;;
*) printf " "$(date '+%H:%M')
esac

View File

@ -1,88 +0,0 @@
# i3blocks config file
#
# Please see man i3blocks for a complete reference!
# The man page is also hosted at http://vivien.github.io/i3blocks
#
# List of valid properties:
#
# align
# color
# command
# full_text
# instance
# interval
# label
# min_width
# name
# separator
# separator_block_width
# short_text
# signal
# urgent
# Global properties
#
# The top properties below are applied to every block, but can be overridden.
# Each block command defaults to the script name to avoid boilerplate.
command=~/.config/i3/blocks/$BLOCK_NAME
markup=none
#full_text=
align=center
color=#F3F4F5
separator=false
separator_block_width=14
[volume]
interval=persist
signal=10
[iface]
label=
interval=60
signal=15
[updates]
label=
interval=600
signal=5
[cpu_usage]
label=
interval=persist
[memory]
label=
interval=10
[temperature]
label=
interval=10
[backlight]
label=
interval=30
signal=12
[separator]
[rotation]
interval=once
[separator]
[keyboard]
label=
interval=30
[separator]
[battery]
interval=30
signal=11
[separator]
[clock]
interval=10
min_width=" 00:00"

View File

@ -1,31 +0,0 @@
#!/bin/bash
# by Paul Colby (http://colby.id.au), no rights reserved ;)
# https://github.com/Leo-G/DevopsWiki/wiki/How-Linux-CPU-Usage-Time-and-Percentage-is-calculated
PREV_TOTAL=0
PREV_IDLE=0
while true; do
# Get the total CPU statistics, discarding the 'cpu ' prefix.
CPU=(`sed -n 's/^cpu\s//p' /proc/stat`)
IDLE=${CPU[3]} # Just the idle CPU time.
# Calculate the total CPU time.
TOTAL=0
for VALUE in "${CPU[@]}"; do
let "TOTAL=$TOTAL+$VALUE"
done
# Calculate the CPU usage since we last checked.
let "DIFF_IDLE=$IDLE-$PREV_IDLE"
let "DIFF_TOTAL=$TOTAL-$PREV_TOTAL"
let "DIFF_USAGE=(1000*($DIFF_TOTAL-$DIFF_IDLE)/$DIFF_TOTAL+5)/10"
echo -e "$DIFF_USAGE%\n$DIFF_USAGE%"
# Remember the total and idle CPU times for the next check.
PREV_TOTAL="$TOTAL"
PREV_IDLE="$IDLE"
# Wait before checking again.
sleep 1
done

View File

@ -1,41 +0,0 @@
#!/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/>.
DIR="${BLOCK_INSTANCE:-$HOME}"
ALERT_LOW="${1:-10}" # color will turn red under this value (default: 10%)
df -h -P -l "$DIR" | awk -v alert_low=$ALERT_LOW '
/\/.*/ {
# full text
print $4
# short text
print $4
use=$5
# no need to continue parsing
exit 0
}
END {
gsub(/%$/,"",use)
if (100 - use < alert_low) {
# color
print "#FF0000"
}
}
'

View File

@ -1,62 +0,0 @@
#!/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/>.
#------------------------------------------------------------------------
# Use the provided interface, otherwise the device used for the default route.
if [[ -n $BLOCK_INSTANCE ]]; then
IF=$BLOCK_INSTANCE
else
IF=$(ip route | awk '/^default/ { print $5 ; exit }')
fi
#------------------------------------------------------------------------
# As per #36 -- It is transparent: e.g. if the machine has no battery or wireless
# connection (think desktop), the corresponding block should not be displayed.
[[ ! -d /sys/class/net/${IF} ]] && exit
#------------------------------------------------------------------------
if [[ -z $IF ]] || [[ "$(cat /sys/class/net/$IF/operstate)" = 'down' ]]; then
echo down # full text
echo down # short text
echo \#FF0000 # color
exit
fi
case $1 in
-4) AF=inet ;;
-6) AF=inet6 ;;
*) AF=inet6? ;;
esac
# if no interface is found, use the first device with a global scope
LOCIP=$(ip addr show $IF | perl -n -e "/$AF ([^\/]+).* scope global/ && print \$1 and exit")
#------------------------------------------------------------------------
case $BLOCK_BUTTON in
1) curl -s https://api.ipify.org;
break;;
2) curl -s https://api.ipify.org | tee >(xclip -i);
break;;
0|3) echo "$LOCIP" | tee >(xclip -i);
break;;
*) echo "$LOCIP"
break;;
esac

View File

@ -1,11 +0,0 @@
#!/bin/sh
[[ $BLOCK_BUTTON -eq 1 ]] && `$DOTFILES/scripts/togglekeyboard`
[[ $BLOCK_BUTTON -eq 3 ]] && onboard &
layout=$(setxkbmap -query | grep 'layout:' | awk '{print $2}')
variant=$(setxkbmap -query | grep 'variant:' | awk '{print $2}')
short=`([ "$variant" ] && echo $variant || echo $layout) | cut -c1-2`
echo -e "$short\n$short" | awk '{print toupper($0)}'

View File

@ -1,70 +0,0 @@
#!/usr/bin/perl
#
# Copyright 2014 Marcelo Cerri <mhcerri at gmail dot 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/>.
use strict;
use warnings;
use utf8;
use Getopt::Long;
use File::Basename;
# Default values
my $indicator = $ENV{BLOCK_INSTANCE} || "CAPS";
my $color_on = "#00FF00";
my $color_off = "#222222";
sub help {
my $program = basename($0);
printf "Usage: %s [-c <color on>] [-C <color off>]\n", $program;
printf " -c <color on>: hex color to use when indicator is on\n";
printf " -C <color off>: hex color to use when indicator is off\n";
printf "\n";
printf "Note: environment variable \$BLOCK_INSTANCE should be one of:\n";
printf " CAPS, NUM (default is CAPS).\n";
exit 0;
}
Getopt::Long::config qw(no_ignore_case);
GetOptions("help|h" => \&help,
"c=s" => \$color_on,
"C=s" => \$color_off) or exit 1;
# Key mapping
my %indicators = (
CAPS => 0x00000001,
NUM => 0x00000002,
);
# Retrieve key flags
my $mask = 0;
open(XSET, "xset -q |") or die;
while (<XSET>) {
if (/LED mask:\s*([0-9]+)/) {
$mask = $1;
last;
}
}
close(XSET);
# Output
printf "%s\n", $indicator;
printf "%s\n", $indicator;
if (($indicators{$indicator} || 0) & $mask) {
printf "%s\n", $color_on;
} else {
printf "%s\n", $color_off;
}
exit 0

View File

@ -1,34 +0,0 @@
#!/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/>.
load="$(cut -d ' ' -f1 /proc/loadavg)"
cpus="$(nproc)"
# full text
echo "$load"
# short text
echo "$load"
# color if load is too high
awk -v cpus=$cpus -v cpuload=$load '
BEGIN {
if (cpus <= cpuload) {
print "#FF0000";
exit 33;
}
}
'

View File

@ -1,76 +0,0 @@
#!/usr/bin/perl
# Copyright (C) 2014 Tony Crisci <tony@dubstepdish.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/>.
# Requires playerctl binary to be in your path (except cmus)
# See: https://github.com/acrisci/playerctl
# Set instance=NAME in the i3blocks configuration to specify a music player
# (playerctl will attempt to connect to org.mpris.MediaPlayer2.[NAME] on your
# DBus session).
use Env qw(BLOCK_INSTANCE);
my @metadata = ();
my $player_arg = "";
if ($BLOCK_INSTANCE) {
$player_arg = "--player='$BLOCK_INSTANCE'";
}
if ($ENV{'BLOCK_BUTTON'} == 1) {
system("playerctl $player_arg previous");
} elsif ($ENV{'BLOCK_BUTTON'} == 2) {
system("playerctl $player_arg play-pause");
} elsif ($ENV{'BLOCK_BUTTON'} == 3) {
system("playerctl $player_arg next");
}
if ($player_arg eq '' or $player_arg =~ /cmus$/) {
# try cmus first
my @cmus = split /^/, qx(cmus-remote -Q);
if ($? == 0) {
foreach my $line (@cmus) {
my @data = split /\s/, $line;
if (shift @data eq 'tag') {
my $key = shift @data;
my $value = join ' ', @data;
@metadata[0] = $value if $key eq 'artist';
@metadata[1] = $value if $key eq 'title';
}
}
if (@metadata) {
# metadata found so we are done
print(join ' - ', @metadata);
exit 0;
}
}
# if cmus was given, we are done
exit 0 unless $player_arg eq '';
}
my $artist = qx(playerctl $player_arg metadata artist);
# exit status will be nonzero when playerctl cannot find your player
exit(0) if $?;
push(@metadata, $artist) if $artist;
my $title = qx(playerctl $player_arg metadata title);
exit(0) if $?;
push(@metadata, $title) if $title;
print(join(" - ", @metadata)) if @metadata;

View File

@ -1,65 +0,0 @@
#!/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}"
if [ ${BLOCK_BUTTON--1} -gt 0 ]; then
i3-sensible-terminal -r floating-term --geometry 100x54 -e 'top -d 0.1'
fi
awk -v type=$TYPE '
BEGIN {
swap_total=1
mem_total=1
}
/^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 {
if (type == "swap") {
swap_perc = (swap_total - swap_free) / swap_total * 100
printf("%.0f%\n", swap_perc)
printf("%.0f%\n", swap_perc)
perc = swap_perc
}
else{
mem_perc = (mem_total - mem_free) / mem_total * 100
printf("%.0f%\n", mem_perc)
printf("%.0f%\n", mem_perc)
perc = mem_perc
}
if (perc > 80)
print "#FFCB00"
else if (perc > 60)
print "#FFCB00"
}
' /proc/meminfo

View File

@ -1,149 +0,0 @@
#!/usr/bin/perl
# Made by Pierre Mavro/Deimosfr <deimos@deimos.fr>
# Licensed under the terms of the GNU GPL v3, or any later version.
# Version: 0.2
# Usage:
# 1. The configuration name of OpenVPN should be familiar for you (home,work...)
# 2. The device name in your configuration file should be fully named (tun0,tap1...not only tun or tap)
# 3. When you launch one or multiple OpenVPN connexion, be sure the PID file is written in the correct folder (ex: --writepid /run/openvpn/home.pid)
use strict;
use warnings;
use utf8;
use Getopt::Long;
my $openvpn_enabled='/dev/shm/openvpn_i3blocks_enabled';
my $openvpn_disabled='/dev/shm/openvpn_i3blocks_disabled';
# Print output
sub print_output {
my $ref_pid_files = shift;
my @pid_files = @$ref_pid_files;
my $change=0;
# Total pid files
my $total_pid = @pid_files;
if ($total_pid == 0) {
print "VPN: down\n"x2;
# Delete OpenVPN i3blocks temp files
if (-f $openvpn_enabled) {
unlink $openvpn_enabled or die "Can't delete $openvpn_enabled\n";
# Colorize if VPN has just went down
print '#FF0000\n';
}
unless (-f $openvpn_disabled) {
open(my $shm, '>', $openvpn_disabled) or die "Can't write $openvpn_disabled\n";
}
exit(0);
}
# Check if interface device is present
my $vpn_found=0;
my $pid;
my $cmd_line;
my @config_name;
my @config_path;
my $interface;
my $current_config_path;
my $current_config_name;
foreach (@pid_files) {
# Get current PID
$pid=0;
open(PID, '<', $_);
while(<PID>) {
chomp $_;
$pid = $_;
}
close(PID);
# Check if PID has been found
if ($pid ==0) {
print "Can't get PID $_: $!\n";
}
# Check if PID is still alive
$cmd_line='/proc/'.$pid.'/cmdline';
if (-f $cmd_line) {
# Get config name
open(CMD_LINE, '<', $cmd_line);
while(<CMD_LINE>) {
chomp $_;
if ($_ =~ /--config\s*(.*\.conf)/) {
# Get interface from config file
$current_config_path = $1;
# Remove unwanted escape chars
$current_config_path =~ s/\x{00}//g;
$interface = 'null';
# Get configuration name
if ($current_config_path =~ /(\w+).conf/) {
$current_config_name=$1;
} else {
$current_config_name='unknow';
}
# Get OpenVPN interface device name
open(CONFIG, '<', $current_config_path) or die "Can't read config file '$current_config_path': $!\n";
while(<CONFIG>) {
chomp $_;
if ($_ =~ /dev\s+(\w+)/) {
$interface=$1;
last;
}
}
close(CONFIG);
# check if interface exist
unless ($interface eq 'null') {
if (-d "/sys/class/net/$interface") {
push @config_name, $current_config_name;
$vpn_found=1;
# Write enabled file
unless (-f $openvpn_enabled) {
open(my $shm, '>', $openvpn_enabled) or die "Can't write $openvpn_enabled\n";
$change=1;
}
}
}
}
}
close(CMD_LINE);
}
}
# Check if PID found
my $names;
my $short_status;
if ($vpn_found == 1) {
$names = join('/', @config_name);
$short_status='up';
} else {
$short_status='down';
$names = $short_status;
}
print "VPN: $names\n";
print "VPN: $short_status\n";
# Print color if there were changes
print "#00FF00\n" if ($change == 1);
exit(0);
}
sub check_opts {
# Vars
my @pid_file=glob '/run/openvpn/*.pid';
# Set options
GetOptions( "help|h" => \&help,
"p=s" => \@pid_file);
print_output(\@pid_file);
}
sub help {
print "Usage: openvpn [-d pid folder files]\n";
print "-d : pid folder files (default /run/openvpn/*.pid)\n";
print "Note: devices in configuration file should be named with their number (ex: tun0, tap1)\n";
exit(1);
}
&check_opts;

View File

@ -1,20 +0,0 @@
#!/bin/sh
lock="/tmp/rotlock"
[[ -e $lock ]] || echo "unlocked" > "$lock"
status=$(<$lock)
if [ $BLOCK_BUTTON -gt 0 ]; then
case $status in
"unlocked") status="locked" ;;
"locked") status="unlocked";;
esac
echo $status > "$lock"
fi
case $status in
"locked") echo "";;
"unlocked") echo "";;
esac

View File

@ -1,69 +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>
# 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 = "coretemp-isa-0000";
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 int($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;

View File

@ -1,27 +0,0 @@
#!/bin/bash
CARDS=$(pacmd list-cards | grep -e index: -e alsa.card_name | xargs -n5 | awk '{print $2}')
if [[ ${#CARDS} != 3 ]]; # there is a space
then
echo "This script works only with 2 outputs, and you have ..."
pacmd list-cards | grep -e index: -e alsa.card_name | xargs -n5
exit
fi
i=1
for card_index in $CARDS ;
do
eval CARD$i=$card_index
let i+=1
done
LAST_SINK_LINE=$(pacmd list-sink-inputs | grep -e index: -e sink: | xargs -n5 | tail -n1)
last_sink_app_index=$( echo $LAST_SINK_LINE | awk '{print $2}' )
last_sink_out_index=$( echo $LAST_SINK_LINE | awk '{print $4}' )
[[ ${last_sink_out_index} == ${CARD1} ]] && new_sink_out=$CARD2 || new_sink_out=$CARD1
#echo "$last_sink_app_index > $last_sink_out_index > ${new_sink_out}"
pacmd move-sink-input ${last_sink_app_index} ${new_sink_out}

View File

@ -1,31 +0,0 @@
#!/bin/bash
set -e
for p in trizen pacaur yaourt pacman; do
if $p --version &>/dev/null; then
PAC="$p"
break;
fi
done
if [ -z "$PAC" ]; then
>&2 echo "Error: No Arch package manager found?"
fi
if [ "$BLOCK_BUTTON" == 1 ]; then
nohup i3-sensible-terminal -r i3blocks-update-term -e "sh -c '$PAC -Syu || exec zsh; pkill -RTMIN+5 i3blocks'" &>/dev/null &
disown
fi
if [ $p = "pacman" ]; then
exec 3< <(checkupdates)
else
exec 3< <({ checkupdates & cower -u & })
fi
count="$(wc -l <&3)"
if [ -n "$count" -a "$count" -gt 0 ]; then
echo $count
echo $count
fi

View File

@ -1,182 +0,0 @@
#!/bin/bash
# Displays the default device, volume, and mute status for i3blocks
AUDIO_HIGH_SYMBOL=' '
AUDIO_MED_THRESH=59
AUDIO_MED_SYMBOL=' '
AUDIO_LOW_THRESH=0
AUDIO_LOW_SYMBOL=' '
AUDIO_MUTED_SYMBOL=''
AUDIO_INTERVAL=5
DEFAULT_COLOR="#ffffff"
MUTED_COLOR="#a0a0a0"
LONG_FORMAT=0
SHORT_FORMAT=3
USE_PERCENT=0
USE_ALSA_NAME=0
USE_DESCRIPTION=0
SUBSCRIBE=1
while getopts F:Sf:padH:M:L:X:T:t:C:c:i:m:s:h opt; do
case "$opt" in
S) SUBSCRIBE=1 ;;
F) LONG_FORMAT="$OPTARG" ;;
f) SHORT_FORMAT="$OPTARG" ;;
p) USE_PERCENT=0 ;;
a) USE_ALSA_NAME=1 ;;
d) USE_DESCRIPTION=1 ;;
H) AUDIO_HIGH_SYMBOL="$OPTARG" ;;
M) AUDIO_MED_SYMBOL="$OPTARG" ;;
L) AUDIO_LOW_SYMBOL="$OPTARG" ;;
X) AUDIO_MUTED_SYMBOL="$OPTARG" ;;
T) AUDIO_MED_THRESH="$OPTARG" ;;
t) AUDIO_LOW_THRESH="$OPTARG" ;;
C) DEFAULT_COLOR="$OPTARG" ;;
c) MUTED_COLOR="$OPTARG" ;;
i) AUDIO_INTERVAL="$OPTARG" ;;
m) MIXER="$OPTARG" ;;
s) SCONTROL="$OPTARG" ;;
h) printf \
"Usage: volume-pulseaudio [-S] [-F format] [-f format] [-p] [-a|-d] [-H symb] [-M symb]
[-L symb] [-X symb] [-T thresh] [-t thresh] [-C color] [-c color] [-i inter]
[-m mixer] [-s scontrol] [-h]
Options:
-F, -f\tOutput format (-F long format, -f short format) to use, amongst:
\t0\t symb vol [index:name]\t (default long)
\t1\t symb vol [name]
\t2\t symb vol [index]\t (default short)
\t3\t symb vol
-S\tSubscribe to volume events (requires persistent block, always uses long format)
-p\tOmit the percent sign (%%) in volume
-a\tUse ALSA name if possible
-d\tUse device description instead of name if possible
-H\tSymbol to use when audio level is high. Default: '$AUDIO_HIGH_SYMBOL'
-M\tSymbol to use when audio level is medium. Default: '$AUDIO_MED_SYMBOL'
-L\tSymbol to use when audio level is low. Default: '$AUDIO_LOW_SYMBOL'
-X\tSymbol to use when audio is muted. Default: '$AUDIO_MUTED_SYMBOL'
-T\tThreshold for medium audio level. Default: $AUDIO_MED_THRESH
-t\tThreshold for low audio level. Default: $AUDIO_LOW_THRESH
-C\tColor for non-muted audio. Default: $DEFAULT_COLOR
-c\tColor for muted audio. Default: $MUTED_COLOR
-i\tInterval size of volume increase/decrease. Default: $AUDIO_INTERVAL
-m\tUse the given mixer.
-s\tUse the given scontrol.
-h\tShow this help text
" && exit 0;;
esac
done
if [[ -z "$MIXER" ]] ; then
MIXER="default"
if amixer -D pulse info >/dev/null 2>&1 ; then
MIXER="pulse"
fi
fi
if [[ -z "$SCONTROL" ]] ; then
SCONTROL=$(amixer -D "$MIXER" scontrols | sed -n "s/Simple mixer control '\([^']*\)',0/\1/p" | head -n1)
fi
CAPABILITY=$(amixer -D $MIXER get $SCONTROL | sed -n "s/ Capabilities:.*cvolume.*/Capture/p")
function move_sinks_to_new_default {
DEFAULT_SINK=$1
pacmd list-sink-inputs | grep index: | grep -o '[0-9]\+' | while read SINK
do
pacmd move-sink-input $SINK $DEFAULT_SINK
done
}
function set_default_playback_device_next {
inc=${1:-1}
num_devices=$(pacmd list-sinks | grep -c index:)
sink_arr=($(pacmd list-sinks | grep index: | grep -o '[0-9]\+'))
default_sink_index=$(( $(pacmd list-sinks | grep index: | grep -no '*' | grep -o '^[0-9]\+') - 1 ))
default_sink_index=$(( ($default_sink_index + $num_devices + $inc) % $num_devices ))
default_sink=${sink_arr[$default_sink_index]}
pacmd set-default-sink $default_sink
move_sinks_to_new_default $default_sink
}
case "$BLOCK_BUTTON" in
1) set_default_playback_device_next ;;
2) amixer -q -D $MIXER sset $SCONTROL $CAPABILITY toggle ;;
3) set_default_playback_device_next -1 ;;
4) amixer -q -D $MIXER sset $SCONTROL $CAPABILITY $AUDIO_INTERVAL%+ ;;
5) amixer -q -D $MIXER sset $SCONTROL $CAPABILITY $AUDIO_INTERVAL%- ;;
esac
function print_format {
PERCENT="%"
[[ $USE_PERCENT == 0 ]] && PERCENT=""
case "$1" in
1) echo "$SYMBOL$VOL$PERCENT [$NAME]" ;;
2) echo "$SYMBOL$VOL$PERCENT [$INDEX]";;
3) echo "$SYMBOL$VOL$PERCENT" ;;
*) echo "$SYMBOL$VOL$PERCENT [$INDEX:$NAME]" ;;
esac
}
function print_block {
for name in INDEX NAME VOL MUTED; do
read $name
done < <(pacmd list-sinks | grep "index:\|name:\|volume: front\|muted:" | grep -A3 '*')
INDEX=$(echo "$INDEX" | grep -o '[0-9]\+')
VOL=$(echo "$VOL" | grep -o "[0-9]*%" | head -1 )
VOL="${VOL%?}"
NAME=$(echo "$NAME" | sed \
's/.*<.*\.\(.*\)>.*/\1/; t;'\
's/.*<\(.*\)>.*/\1/; t;'\
's/.*/unknown/')
if [[ $USE_ALSA_NAME == 1 ]] ; then
ALSA_NAME=$(pacmd list-sinks |\
awk '/^\s*\*/{f=1}/^\s*index:/{f=0}f' |\
grep "alsa.name\|alsa.mixer_name" |\
head -n1 |\
sed 's/.*= "\(.*\)".*/\1/')
NAME=${ALSA_NAME:-$NAME}
elif [[ $USE_DESCRIPTION == 1 ]] ; then
DESCRIPTION=$(pacmd list-sinks |\
awk '/^\s*\*/{f=1}/^\s*index:/{f=0}f' |\
grep "device.description" |\
head -n1 |\
sed 's/.*= "\(.*\)".*/\1/')
NAME=${DESCRIPTION:-$NAME}
fi
if [[ $MUTED =~ "no" ]] ; then
SYMBOL=$AUDIO_HIGH_SYMBOL
[[ $VOL -le $AUDIO_MED_THRESH ]] && SYMBOL=$AUDIO_MED_SYMBOL
[[ $VOL -le $AUDIO_LOW_THRESH ]] && SYMBOL=$AUDIO_LOW_SYMBOL
COLOR=$DEFAULT_COLOR
else
SYMBOL=$AUDIO_MUTED_SYMBOL
COLOR=$MUTED_COLOR
VOL=""
fi
# if [[ $SUBSCRIBE == 1 ]] ; then
# print_format "$LONG_FORMAT"
# else
# print_format "$LONG_FORMAT"
print_format "$SHORT_FORMAT"
# echo "$COLOR"
# fi
}
print_block
if [[ $SUBSCRIBE == 1 ]] ; then
while read -r EVENT; do
print_block
done < <(pactl subscribe | stdbuf -oL grep change)
fi

View File

@ -1,46 +0,0 @@
#!/bin/bash
# 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/>.
#------------------------------------------------------------------------
INTERFACE="${BLOCK_INSTANCE:-wlan0}"
#------------------------------------------------------------------------
# As per #36 -- It is transparent: e.g. if the machine has no battery or wireless
# connection (think desktop), the corresponding block should not be displayed.
[[ ! -d /sys/class/net/${INTERFACE}/wireless ]] ||
[[ "$(cat /sys/class/net/$INTERFACE/operstate)" = 'down' ]] && exit
#------------------------------------------------------------------------
QUALITY=$(grep $INTERFACE /proc/net/wireless | awk '{ print int($3 * 100 / 70) }')
#------------------------------------------------------------------------
echo $QUALITY% # full text
echo $QUALITY% # short text
# color
if [[ $QUALITY -ge 80 ]]; then
echo "#00FF00"
elif [[ $QUALITY -lt 80 ]]; then
echo "#FFF600"
elif [[ $QUALITY -lt 60 ]]; then
echo "#FFAE00"
elif [[ $QUALITY -lt 40 ]]; then
echo "#FF0000"
fi

View File

@ -94,27 +94,7 @@ client.unfocused $inactive-bg-color $inactive-bg-color $inactive-text-co
client.focused_inactive $inactive-bg-color $inactive-bg-color $inactive-text-color $bg-color client.focused_inactive $inactive-bg-color $inactive-bg-color $inactive-text-color $bg-color
client.urgent $urgent-bg-color $urgent-bg-color $text-color $bg-color client.urgent $urgent-bg-color $urgent-bg-color $text-color $bg-color
bar { exec_always --no-startup-id killall -q polybar; while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done; exec polybar -r i3bar
status_command i3blocks -c ~/.config/i3/blocks/config
workspace_buttons yes
strip_workspace_numbers yes
tray_output primary
tray_padding 2
height 28
output primary
position top
colors {
separator #757575
background #2f343f
# border background text
focused_workspace $bg-color $bg-color $text-color
inactive_workspace $inactive-bg-color $inactive-bg-color $inactive-text-color
urgent_workspace $urgent-bg-color $urgent-bg-color $text-color
}
}
# Window rules # Window rules
for_window [class="Pinentry"] floating enable for_window [class="Pinentry"] floating enable
@ -126,11 +106,11 @@ for_window [window_role="i3blocks-update-term"] floating enable
for_window [window_role="i3blocks-clock-term"] floating enable for_window [window_role="i3blocks-clock-term"] floating enable
for_window [title="^rofi$"] floating enable for_window [title="^rofi$"] floating enable
new_window pixel 5 new_window none
new_float none new_float none
gaps inner 9 gaps inner 12
gaps outer 1 gaps outer 4
focus_follows_mouse yes focus_follows_mouse yes
@ -141,9 +121,9 @@ bindsym $mod+v exec "i3-sensible-terminal -e \\"$SHELL -c vim;$
bindsym $mod+Ctrl+v exec "i3-sensible-terminal -r floating-term -e \\"$SHELL -c vim;$SHELL\\" bindsym $mod+Ctrl+v exec "i3-sensible-terminal -r floating-term -e \\"$SHELL -c vim;$SHELL\\"
bindsym Mod1+Tab exec ~/.config/i3/alt-tab.sh bindsym Mod1+Tab exec ~/.config/i3/alt-tab.sh
bindsym $mod+Return exec i3-sensible-terminal bindsym $mod+Return exec i3-sensible-terminal
bindsym $mod+Ctrl+Return exec i3-sensible-terminal -r floating-term --geometry 96x30 bindsym $mod+Ctrl+Return exec i3-sensible-terminal -r floating-term
bindsym $mod+Shift+Return exec i3-sensible-terminal -d "`xcwd`" bindsym $mod+Shift+Return exec i3-sensible-terminal -d "`xcwd`"
bindsym $mod+Ctrl+Shift+Return exec i3-sensible-terminal -r floating-term --geometry 96x30 -d "`xcwd`" bindsym $mod+Ctrl+Shift+Return exec i3-sensible-terminal -r floating-term -d "`xcwd`"
bindsym $mod+l exec ~/.config/i3/lock.sh bindsym $mod+l exec ~/.config/i3/lock.sh
bindsym $mod+space exec "pkill rofi; rofi -show run -sidebar-mode -terminal i3-sensible-terminal -normal-window" bindsym $mod+space exec "pkill rofi; rofi -show run -sidebar-mode -terminal i3-sensible-terminal -normal-window"
bindsym $mod+Shift+p exec rofi-pass bindsym $mod+Shift+p exec rofi-pass
@ -152,7 +132,7 @@ bindsym $mod+Shift+i exec rofi-fontawesome
bindsym --release Print exec screenshot bindsym --release Print exec screenshot
bindsym --release $mod+Print exec imgur-screenshot bindsym --release $mod+Print exec imgur-screenshot
bindsym $mod+$alt+space exec --no-startup-id ~/.config/i3/cycleaudio.py && pkill -RTMIN+10 i3blocks bindsym $mod+$alt+space exec --no-startup-id ~/.config/i3/cycleaudio.py && pkill -RTMIN+10 i3blocks
bindsym $mod+numbersign exec "termite -e 'sh -c xclip\ -o\ |\ gpg\ --decrypt\ 2>&1\ \;\ $SHELL'" bindsym $mod+numbersign exec "i3-sensible-terminal -e 'sh -c xclip\ -o\ |\ gpg\ --decrypt\ 2>&1\ \;\ $SHELL'"
bindsym $mod+r exec "bash -c 'pwgen -nc 32 1 | tee >(xargs notify-send Generated\ password\:) | xclip -i'" bindsym $mod+r exec "bash -c 'pwgen -nc 32 1 | tee >(xargs notify-send Generated\ password\:) | xclip -i'"
bindsym $mod+g exec "LINK=$(gist -PRpc); notify-send -c transfer \\"<a href=\\\\"$LINK\\\\">$LINK</a>\\"" bindsym $mod+g exec "LINK=$(gist -PRpc); notify-send -c transfer \\"<a href=\\\\"$LINK\\\\">$LINK</a>\\""
@ -170,7 +150,6 @@ bindsym XF86MonBrightnessDown exec xbacklight -dec 5 && pkill -RTMIN+12 i3bloc
# app launch shortcuts # app launch shortcuts
exec --no-startup-id ~/.config/i3/disable-standby-fs.py exec --no-startup-id ~/.config/i3/disable-standby-fs.py
exec --no-startup-id "ip monitor | while read; do pkill -RTMIN+15 i3blocks; done"
exec --no-startup-id feh --no-fehbg --no-xinerama --bg-fill ~/pictures/lakesidesunrise.jpg exec --no-startup-id feh --no-fehbg --no-xinerama --bg-fill ~/pictures/lakesidesunrise.jpg
exec --no-startup-id xautolock -time 5 -locker 'dm-tool lock' -nocloseout -nocloseerr exec --no-startup-id xautolock -time 5 -locker 'dm-tool lock' -nocloseout -nocloseerr

313
.config/polybar/config Normal file
View File

@ -0,0 +1,313 @@
[colours]
background = transparent
text = #eceff1
icon = #147a82
warning = #bd2c40
critical = #bd2c40
[settings]
format-foreground = ${colours.text}
format-background = ${colours.background}
format-spacing = 0
format-margin = 2.5
format-offset = 0
[bar/i3bar]
monitor = ${env:MONITOR:eDP1}
dpi = ${xrdb:Xft.dpi:-1}
fixed-center = false
enable-ipc = true
width = 100%
height = 44
bottom = true
radius = 0
foreground = ${colours.text}
background = ${colours.background}
line-size = 0
line-colour = #f00
padding-left = 2
padding-right = 2
module-margin-left = 0
module-margin-right = 1
font-0 = sans:pixelsize=9;1
font-1 = FontAwesome5Pro:pixelsize=10;2
modules-left = i3
modules-center =
# modules-right = volume updates weather xkeyboard wlan eth memory cpu xbacklight battery temperature date
modules-right = volume updates weather wlan eth memory cpu xbacklight battery temperature date
tray-position = right
tray-detached = false
tray-background = ${root.background}
tray-offset-x = -6
tray-offset-y = -2
tray-maxsize = 24
tray-padding = 2
tray-scale = 1.0
cursor-click = pointer
cursor-scroll = ns-resize
[module/updates]
type = custom/script
exec = $XDG_CONFIG_HOME/polybar/update.sh
tail = true
format-prefix = " "
format-prefix-foreground = ${colours.icon}
click-left = i3-msg exec -- i3-sensible-terminal -r i3blocks-update-term -e "yay && kill -USR1 %pid% || kill --USR1 %pid%"
[module/weather]
type = custom/script
exec = $XDG_CONFIG_HOME/polybar/weather.sh
interval = 120
click-left = i3-msg exec "i3-sensible-terminal -r floating-term -e 'sh -c \"xdotool getactivewindow windowsize 910 680 && curl wttr.in && sleep infinity\"'"
[module/xkeyboard]
type = internal/xkeyboard
format = <label-layout> <label-indicator>
format-prefix = " "
format-prefix-foreground = ${colours.icon}
format-prefix-underline = ${colours.background}
label-layout = %name%
label-indicator = %name%
[module/i3]
type = internal/i3
format = <label-state> <label-mode>
index-sort = true
wrapping-scroll = false
; Only show workspaces on the same output as the bar
; pin-workspaces = true
label-mode-padding = 3
label-mode-foreground = ${colours.text}
label-mode-background = ${colours.background}
; focused = Active workspace on focused monitor
label-focused = %index%
label-focused-padding = ${self.label-mode-padding}
label-focused-foreground = ${colours.text}
label-focused-background = ${colours.background}
label-focused-underline = ${colours.background}
; unfocused = Inactive workspace on any monitor
label-unfocused = ${self.label-focused}
label-unfocused-padding = ${self.label-focused-padding}
label-unfocused-foreground= ${colours.icon}
label-unfocused-underline = ${self.label-focused-underline}
; visible = Active workspace on unfocused monitor
label-visible = ${self.label-focused}
label-visible-foreground= ${colours.icon}
label-visible-padding = ${self.label-focused-padding}
label-visible-background = ${self.label-focused-background}
label-visible-underline = ${self.label-focused-underline}
; urgent = Workspace with urgency hint set
label-urgent = ${self.label-focused}
label-urgent-foreground = ${colours.warning}
label-urgent-padding = ${self.label-focused-padding}
[module/xbacklight]
type = internal/xbacklight
label = %percentage%
format = <label>
format-prefix = " "
format-prefix-foreground = ${colours.icon}
[module/backlight-acpi]
inherit = module/xbacklight
type = internal/backlight
card = intel_backlight
[module/cpu]
type = internal/cpu
interval = 2
format-prefix = " "
format-prefix-foreground = ${colours.icon}
format-underline = ${colours.background}
label = %percentage%%
[module/memory]
type = internal/memory
interval = 2
format-prefix = " "
format-prefix-foreground = ${colours.icon}
label = %percentage_used%%
[module/wlan]
type = internal/network
interface = wlp1s0
interval = 3.0
format-connected = <ramp-signal> <label-connected>
format-connected-underline = ${colours.background}
label-connected = %essid%
format-disconnected =
;format-disconnected = <label-disconnected>
;format-disconnected-underline = ${self.format-connected-underline}
;label-disconnected = %ifname% disconnected
;label-disconnected-foreground = ${colours.icon}
ramp-signal-0 = 
ramp-signal-1 = 
ramp-signal-2 = 
ramp-signal-foreground = ${colours.icon}
[module/eth]
type = internal/network
interface = eth0
interval = 3.0
label-connected = %local_ip%
format-connected-prefix = " "
format-connected-prefix-foreground = ${colours.icon}
format-connected-underline = ${colours.background}
;format-disconnected = RIP
;format-disconnected = <label-disconnected>
;format-disconnected-underline = ${self.format-connected-underline}
;label-disconnected = %ifname% disconnected
label-disconnected-foreground = ${colours.critical}
[module/date]
type = internal/date
interval = 1
label = %{A3:i3-sensible-terminal -r i3blocks-clock-term -e "sh -c \"xdotool getactivewindow windowsize 500 600; cal -y $(date +%Y); stty -echo; exec sleep infinity\"" &:}%date% %time%%{A}
time = %H:%M
time-alt = %a %e %b %Y %H:%M:%S
format-prefix = " "
format-prefix-foreground = ${colours.icon}
[module/volume]
type = internal/pulseaudio
label-volume = %percentage%
format-volume = %{A3:pavucontrol:}<ramp-volume> <label-volume>%{A}
format-muted = %{A3:pavucontrol:}<label-muted>%{A}
label-volume-foreground = ${root.foreground}
format-muted-foreground = ${colours.icon}
ramp-volume-foreground = ${colours.icon}
label-muted = ""
ramp-volume-0 = ""
ramp-volume-1 = ""
ramp-volume-2 = ""
ramp-volume-3 = ""
ramp-volume-4 = ""
ramp-volume-5 = ""
[module/battery]
type = internal/battery
battery = BAT0
adapter = AC0
full-at = 95
format-full = <label-full>
format-charging = <label-charging>
format-discharging = <ramp-capacity> <label-discharging>
format-full-underline = ${self.format-charging-underline}
format-charging-underline = ${colours.background}
format-discharging-underline = ${self.format-charging-underline}
format-full-prefix = " "
format-charging-prefix = " "
ramp-capacity-0 = 
ramp-capacity-1 = 
ramp-capacity-2 = 
ramp-capacity-3 = 
ramp-capacity-4 = 
format-full-prefix-foreground = ${colours.icon}
format-charging-prefix-foreground = ${colours.icon}
ramp-capacity-foreground = ${colours.icon}
ramp-capacity-0-foreground = ${colours.critical}
ramp-capacity-1-foreground = ${colours.warning}
[module/temperature]
type = internal/temperature
thermal-zone = 1
warn-temperature = 70
format = <ramp> <label>
format-warn = <ramp> <label-warn>
label = %temperature-c%
label-warn = %temperature-c%
label-warn-foreground = ${colours.background}
ramp-0 = 
ramp-1 = 
ramp-2 = 
ramp-3 = 
ramp-4 = 
ramp-5 = 
ramp-6 = 
ramp-7 = 
ramp-foreground = ${colours.icon}
[module/powermenu]
type = custom/menu
expand-right = true
label-open = 
label-close = cancel
label-separator = |
label-open-foreground = ${colours.icon}
label-close-foreground = ${colours.background}
label-separator-foreground = ${colours.icon}
menu-0-0 = reboot
menu-0-0-exec = menu-open-1
menu-0-1 = power off
menu-0-1-exec = menu-open-2
menu-1-0 = cancel
menu-1-0-exec = menu-open-0
menu-1-1 = reboot
menu-1-1-exec = sudo reboot
menu-2-0 = power off
menu-2-0-exec = sudo poweroff
menu-2-1 = cancel
menu-2-1-exec = menu-open-0
[settings]
screenchange-reload = true
;compositing-background = xor
;compositing-background = screen
;compositing-foreground = source
;compositing-border = over
; vim:ft=dosini

11
.config/polybar/update.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh
dothething() { count=$( (checkupdates & yay -Qum) 2>/dev/null | wc -l); test $count -gt 0 && echo $count || echo; }
trap 'true' HUP USR1
while true; do
dothething
sleep 120 &
wait
done

141
.config/polybar/weather.sh Executable file
View File

@ -0,0 +1,141 @@
#!/bin/sh
get_icon_day() {
case $1 in
210) echo;; # light thunderstorm
211) echo;; # thunderstorm
500) echo;; # light rain
721) echo;; # haze
800) echo;; # clear sky
801) echo;; # few clouds
802) echo;; # scattered clouds
803) echo;; # broken clouds
804) echo;; # overcast clouds
*) return 1;;
esac
}
get_icon_night() {
case $1 in
210) echo;; # light thunderstorm
211) echo;; # thunderstorm
500) echo;; # light rain
800) echo;; # clear sky
801) echo;; # few clouds
802) echo;; # scattered clouds
803) echo;; # broken clouds
804) echo;; # overcast clouds
*) return 1;;
esac
}
get_icon() {
case $1 in
d) fn=get_icon_day;;
n) fn=get_icon_night;;
esac
if $fn $2; then
return
fi
case $2 in
200) echo;; # thunderstorm with light rain
201) echo;; # thunderstorm with rain
202) echo;; # thunderstorm with heavy rain
210) echo;; # light thunderstorm
211) echo;; # thunderstorm
212) echo;; # heavy thunderstorm
221) echo;; # ragged thunderstorm
230) echo;; # thunderstorm with light drizzle
231) echo;; # thunderstorm with drizzle
232) echo;; # thunderstorm with heavy drizzle
300) echo;; # light intensity drizzle
301) echo;; # drizzle
302) echo;; # heavy intensity drizzle
310) echo;; # light intensity drizzle rain
311) echo;; # drizzle rain
312) echo;; # heavy intensity drizzle rain
313) echo;; # shower rain and drizzle
314) echo;; # heavy shower rain and drizzle
321) echo;; # shower drizzle
500) echo;; # light rain
501) echo;; # moderate rain
502) echo;; # heavy intensity rain
503) echo;; # very heavy rain
504) echo;; # extreme rain
511) echo;; # freezing rain
520) echo;; # light intensity shower rain
521) echo;; # shower rain
522) echo;; # heavy intensity shower rain
531) echo;; # ragged shower rain
600) echo;; # light snow
601) echo;; # snow
602) echo;; # heavy snow
611) echo;; # sleet
612) echo;; # shower sleet
615) echo;; # light rain and snow
616) echo;; # rain and snow
620) echo;; # light shower snow
621) echo;; # shower snow
622) echo;; # heavy shower snow
701) echo;; # mist
711) echo;; # smoke
721) echo;; # haze
741) echo;; # fog
762) echo;; # volcanic ash
781) echo;; # tornado
800) echo ;; # clear sky
801) echo ;; # few clouds
802) echo ;; # scattered clouds
803) echo ;; # broken clouds
804) echo ;; # overcast clouds
# 731) echo ;; # sand, dust whirls
# 751) echo ;; # sand
# 761) echo ;; # dust
# 771) echo ;; # squalls
*) echo;;
esac
}
KEY="$OPENWEATHERMAP_API_KEY"
CITY=""
UNITS="metric"
SYMBOL="°"
ICON_COL="147a82"
API="https://api.openweathermap.org/data/2.5"
if [ ! -z $CITY ]; then
if [ "$CITY" -eq "$CITY" ] 2>/dev/null; then
CITY_PARAM="id=$CITY"
else
CITY_PARAM="q=$CITY"
fi
weather=$(curl -sf "$API/weather?appid=$KEY&$CITY_PARAM&units=$UNITS")
else
location=$(curl -sf https://location.services.mozilla.com/v1/geolocate?key=geoclue)
if [ ! -z "$location" ]; then
location_lat="$(echo "$location" | jq '.location.lat')"
location_lon="$(echo "$location" | jq '.location.lng')"
weather=$(curl -sf "$API/weather?appid=$KEY&lat=$location_lat&lon=$location_lon&units=$UNITS")
else
echo "%{F#$ICON_COL}%{F-}"
fi
fi
if [ ! -z "$weather" ]; then
# weather_desc=$(echo "$weather" | jq -r ".weather[0].description")
weather_temp=$(echo "$weather" | jq '.main.temp' | cut -d "." -f 1)
weather_code=$(echo "$weather" | jq -r '.weather[0].id')
time_of_day=$(echo "$weather" | jq -r '.weather[0].icon | split("") | last')
icon=$(get_icon "$time_of_day" "$weather_code")
echo "%{F#$ICON_COL}$icon%{F-} $weather_temp$SYMBOL"
fi

View File

@ -1,5 +1,5 @@
[options] [options]
font = monospace 9.8 font = monospace 9.5
scrollback_lines = 1000000 scrollback_lines = 1000000
cursor_blink = off cursor_blink = off
size_hints = true size_hints = true

View File

@ -14,44 +14,37 @@ case "$(basename "$(readlink -f /proc/$$/exe)")" in
bash) thisfile="$(readlink -f "${BASH_SOURCE[0]}")";; bash) thisfile="$(readlink -f "${BASH_SOURCE[0]}")";;
*) thisfile="$(find /proc/$$/fd/ | xargs -n1 -r readlink -f | grep profile | head -n1)";; *) thisfile="$(find /proc/$$/fd/ | xargs -n1 -r readlink -f | grep profile | head -n1)";;
esac esac
export DOTFILES="$(dirname "${thisfile:-$XDG_CONFIG_HOME/dotfiles/.profile}")"
export PATH="${PATH}:/sbin:/usr/sbin:$DOTFILES/scripts:$HOME/.local/share/surface-scripts" export EDITOR="vim"
export VISUAL="vim"
# Override paths for non-compliant programs # Override paths for non-compliant programs
# https://wiki.archlinux.org/index.php/XDG_Base_Directory_support # https://wiki.archlinux.org/index.php/XDG_Base_Directory_support
# Vim
export CARGO_HOME="$XDG_DATA_HOME/cargo"
export GNUPGHOME="$XDG_CONFIG_HOME/gnupg"
export GOPATH="$XDG_DATA_HOME/go"
export GTK2_RC_FILES="$XDG_CONFIG_HOME/gtk-2.0/settings.ini"
export PASSWORD_STORE_DIR="$XDG_DATA_HOME/pass"
export PYTHONHISTFILE="$XDG_DATA_HOME/python/histfile"
export RUSTUP_HOME="$XDG_DATA_HOME/rustup"
export TERMINFO="$XDG_DATA_HOME/terminfo"
export TERMINFO_DIRS="$XDG_DATA_HOME/terminfo:/usr/share/terminfo"
export VIMDIR="$XDG_CONFIG_HOME/vim" export VIMDIR="$XDG_CONFIG_HOME/vim"
export VIMRC="$VIMDIR/vimrc" export VIMRC="$VIMDIR/vimrc"
export VIMINIT=":so $VIMRC" export VIMINIT=":so $VIMRC"
export EDITOR="vim"
export VISUAL="vim"
# ZSH
export ZDOTDIR="$XDG_CONFIG_HOME/zsh"
# Gnupg
export GNUPGHOME="$XDG_CONFIG_HOME/gnupg"
# X11
export XAUTHORITY="$XDG_RUNTIME_DIR/Xauthority"
export XINITRC="$XDG_CONFIG_HOME/X11/xinitrc"
# GTK2
export GTK2_RC_FILES="$XDG_CONFIG_HOME"/gtk-2.0/settings.ini
# Cargo/Rust
export CARGO_HOME="$XDG_DATA_HOME/cargo"
# Pass
export PASSWORD_STORE_DIR="$XDG_DATA_HOME/pass"
# Python
export PYTHONHISTFILE="$XDG_DATA_HOME/python/histfile"
# Weechat
export WEECHAT_HOME="$XDG_CONFIG_HOME/weechat" export WEECHAT_HOME="$XDG_CONFIG_HOME/weechat"
export XINITRC="$XDG_CONFIG_HOME/X11/xinitrc"
export ZDOTDIR="$XDG_CONFIG_HOME/zsh"
# Go configuration export DOTFILES="$(dirname "${thisfile:-$XDG_CONFIG_HOME/dotfiles/.profile}")"
export GOPATH="$XDG_DATA_HOME/go" export PATH="${PATH}:/sbin:/usr/sbin:$DOTFILES/scripts:$HOME/.local/share/surface-scripts:$GOPATH/bin"
export PATH="$PATH:$GOPATH/bin"
exists() { which $@ 0<&- 1>/dev/null 2>/dev/null; } exists() { which $@ 0<&- 1>/dev/null 2>/dev/null; }
# Configure less and add colours # Configure less and add colours
export LESS="-RI" export LESS="-RI"
export PAGER="less $LESS" export PAGER="less"
export MANPAGER="less -+N" export MANPAGER="less -+N"
# Disable histfile # Disable histfile
export LESSHISTFILE=- export LESSHISTFILE=-

123
aliases
View File

@ -1,8 +1,35 @@
# Common Aliases # Global aliases for ZSH
alias -g ...=../.. if alias -g 2>/dev/null; then
alias -g ....=../../.. alias -g ...=../..
alias -g .....=../../../.. alias -g ....=../../..
alias -g ......=../../../../.. alias -g .....=../../../..
alias -g ......=../../../../..
alias -g H='| head'
alias -g T='| tail'
alias -g G='| grep'
alias -g L="| less"
alias -g C="| wc -l"
alias -g S="| sort"
alias -g U="| uniq"
alias -g count="| wc -l"
alias -g NO="1> /dev/null"
alias -g NE="2> /dev/null"
alias -g NUL="&> /dev/null"
alias -g BG="&;disown"
alias -g COL="| column -t"
alias -g CLIP="| xclip -i -selection primary -f | xclip -i -selection clipboard"
fi
# File default aliases
if alias -s 2>/dev/null; then
alias -s pdf="open"
alias -s zip="unzip -l"
alias -s rar="unrar l"
alias -s tar="tar tf"
alias -s gz="tar tf"
alias -s jar="java -jar"
alias -s git="git clone --recursive"
fi
alias ..la="cd ..;la" alias ..la="cd ..;la"
alias ..ll="cd..;ll" alias ..ll="cd..;ll"
@ -18,24 +45,8 @@ alias al=la # No, I don't need the Mono Assembly Linker
alias md="mkdir -p" alias md="mkdir -p"
alias rd="rmdir -p" alias rd="rmdir -p"
mcd(){ mkdir -p -- $@ && cd -- $@; }
alias -- -='cd -' alias -- -='cd -'
alias cdt='cd `mktemp -d`' alias cdt='cd `mktemp -d`'
alias grep='grep --color'
alias -g H='| head'
alias -g T='| tail'
alias -g G='| grep'
alias -g L="| less"
alias -g C="| wc -l"
alias -g S="| sort"
alias -g U="| uniq"
alias -g count="| wc -l"
alias -g NO="1> /dev/null"
alias -g NE="2> /dev/null"
alias -g NUL="&> /dev/null"
alias -g BG="&;disown"
alias -g COL="| column -t"
alias -g CLIP="| xclip -i -selection primary -f | xclip -i -selection clipboard"
alias svi=sudoedit alias svi=sudoedit
alias svim=sudoedit alias svim=sudoedit
@ -49,20 +60,13 @@ alias open=xdg-open
alias rm='rm -i' alias rm='rm -i'
alias mv='mv -i' alias mv='mv -i'
alias cp='cp -ir' alias cp='cp -ir'
alias pacman='pacman --color=always'
alias pacaur='pacaur --color=always'
alias tree='tree --dirsfirst -C -F'
alias make="make -j$(nproc)"
alias dd='dd status=progress' alias dd='dd status=progress'
alias ssh="ssh -tt" alias ssh="ssh -tt"
alias wget="wget --hsts-file=$XDG_DATA_HOME/wget/hsts-file" alias wget="wget --hsts-file=$XDG_DATA_HOME/wget/hsts-file"
vim --version 2>/dev/null | command grep -q +clientserver && \
alias vim="vim --servername vim -p"
alias vi=vim alias vi=vim
alias grip='grip --user=frebib --pass=$GRIP_API_KEY' alias grip='grip --user=frebib --pass=$GRIP_API_KEY'
alias acme.sh='$XDG_CONFIG_HOME/acme.sh/acme.sh --home $XDG_CONFIG_HOME/acme.sh --config-home $XDG_CONFIG_HOME/acme.sh --log $XDG_CONFIG_HOME/acme.sh/acme.sh.log' alias acme.sh='$XDG_CONFIG_HOME/acme.sh/acme.sh --home $XDG_CONFIG_HOME/acme.sh --config-home $XDG_CONFIG_HOME/acme.sh --log $XDG_CONFIG_HOME/acme.sh/acme.sh.log'
alias acmesh='$XDG_CONFIG_HOME/acme.sh/acme.sh --home $XDG_CONFIG_HOME/acme.sh --config-home $XDG_CONFIG_HOME/acme.sh --log $XDG_CONFIG_HOME/acme.sh/acme.sh.log' alias acmesh='$XDG_CONFIG_HOME/acme.sh/acme.sh --home $XDG_CONFIG_HOME/acme.sh --config-home $XDG_CONFIG_HOME/acme.sh --log $XDG_CONFIG_HOME/acme.sh/acme.sh.log'
exists gopass && alias pass='gopass'
alias alpine-sdk='docker run -ti --rm \ alias alpine-sdk='docker run -ti --rm \
-e USER \ -e USER \
-e UID="$(id -u)" \ -e UID="$(id -u)" \
@ -80,27 +84,34 @@ alias hddtemps='find /sys/block/ -name sd\* | sed "s|sys/block|dev|g" | sudo xar
alias stripansi='sed -r "s/\x1B\[(([0-9]+)(;[0-9]+)*)?[m,K,H,f,J]//g"' alias stripansi='sed -r "s/\x1B\[(([0-9]+)(;[0-9]+)*)?[m,K,H,f,J]//g"'
alias calc="noglob bc -l <<<" # noglob allows * without quoting alias calc="noglob bc -l <<<" # noglob allows * without quoting
exists pacman && \
alias pacman='pacman --color=always'
exists yay && \
alias p='yay'
exists tree && \
alias tree='tree --dirsfirst -C -F'
exists make && \
alias make="make -j$(nproc)"
exists gopass && \
alias pass='gopass'
echo | busybox grep --color '' >/dev/null 2>&1 && \
alias grep='grep --color'
vim --version 2>/dev/null | command grep -q +clientserver && \
alias vim="vim --servername vim -p"
# Function aliases # Function aliases
env() { command env $@ | stripansi | sort; } env() { command env $@ | stripansi | sort; }
mcd(){ mkdir -p -- $@ && cd -- $@; }
randstr() { tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w $1 | head -n 1; }
# System aliases # System aliases
alias s="sudo systemctl" alias s="sudo systemctl"
alias j=journalctl alias j=journalctl
alias p=pacaur
alias ps='ps aux' alias ps='ps aux'
alias catn='tail -n +1 --' alias catn='tail -n +1 --'
alias kl='killall -s 9' alias kl='killall -s 9'
alias chx='chmod +x' alias chx='chmod +x'
# File default aliases
alias -s pdf="open"
alias -s zip="unzip -l"
alias -s rar="unrar l"
alias -s tar="tar tf"
alias -s gz="tar tf"
alias -s jar="java -jar"
alias -s git="git clone --recursive"
# Git Aliases # Git Aliases
alias g=git alias g=git
alias gignore='$EDITOR .gitignore' alias gignore='$EDITOR .gitignore'
@ -111,6 +122,8 @@ alias gco="git checkout"
alias gcom="git checkout master" alias gcom="git checkout master"
alias ga="git add" alias ga="git add"
alias gap="git add -p" alias gap="git add -p"
alias gau="git add -u"
alias gaN="git add -N"
alias gaa="ga -A" alias gaa="ga -A"
alias grm="git rm" alias grm="git rm"
alias gc="git commit" alias gc="git commit"
@ -136,14 +149,7 @@ alias gpsuom="git push --set-upstream origin master"
alias gpall="git remote | xargs -L1 git push" alias gpall="git remote | xargs -L1 git push"
alias gl="git pull --rebase" alias gl="git pull --rebase"
alias glp="gl && gp" alias glp="gl && gp"
gd() { alias gd="git diff"
local commit=$1
if [ -z "$commit" ] || [ ${commit:0:1} != '@' ]; then
git diff $@
else
git diff "@~${commit:1}^!"
fi
}
alias gds="git diff --staged" alias gds="git diff --staged"
alias gsh="git show" alias gsh="git show"
alias glg="git log --stat --color" alias glg="git log --stat --color"
@ -177,7 +183,7 @@ alias dbl='docker build --pull'
alias dbl.='docker build --pull .' alias dbl.='docker build --pull .'
alias drun='docker run -ti' alias drun='docker run -ti'
alias dkl='docker kill' alias dkl='docker kill'
dklrm() { docker kill $@ ; docker rm $@ } dklrm() { docker kill $@ ; docker rm $@; }
alias dst='docker stop' alias dst='docker stop'
alias drst='docker restart' alias drst='docker restart'
alias dnet='docker network' alias dnet='docker network'
@ -187,13 +193,15 @@ alias dalpine='docker run -ti --rm spritsail/alpine /bin/sh'
alias drm-stopped='docker container prune' alias drm-stopped='docker container prune'
alias drmi-untag='docker image prune' alias drmi-untag='docker image prune'
alias dprune='docker system prune -f' alias dprune='docker system prune -f'
alias dsh='_CMD=dsh _dsh 2 exec' dsh() { do_dsh 2 exec $@; return $?; }
alias drsh='_CMD=drsh _dsh 4 run --rm --entrypoint=' _dsh() { __docker_complete_running_containers $@; }
_dsh() { drsh() { do_dsh 4 run --rm --entrypoint= $@; return $?; }
minargs=$1 _drsh() { __docker_container_subcommand $@; }
do_dsh() {
local minargs=$1
shift shift
if [ $# -lt $minargs ]; then if [ $# -lt $minargs ]; then
echo "Usage: ${_CMD:-$0} [user@]container [program [args]]" >&2 echo "Usage: ${funcstack[2]} [user@]container [program [args]]" >&2
return 64 return 64
fi fi
@ -249,11 +257,9 @@ _dsh() {
docker $dowhat ${docker_args[@]} -ti $usercmd $host $(xargs <<< $prog) docker $dowhat ${docker_args[@]} -ti $usercmd $host $(xargs <<< $prog)
} }
alias dm='docker-machine'
dm-con() { eval $(docker-machine env $1); }
alias dmc=dm-con
alias dc='docker-compose' alias dc='docker-compose'
alias dm='docker-machine'
alias dmc='eval $(docker-machine env $1)'
# ZFS aliases # ZFS aliases
alias zfs='sudo zfs' alias zfs='sudo zfs'
@ -261,7 +267,7 @@ alias zpool='sudo zpool'
alias z=zfs alias z=zfs
alias zp=zpool alias zp=zpool
zl() { (set -o pipefail; command zfs list $@ | grep -Ev 'docker/[0-9a-f]{64}'); return $?; } zl() { (set -o pipefail; command zfs list $@ | grep -Ev 'docker/[0-9a-f]{64}'); return $?; }
_zl() { _zfs "list $@" } _zl() { _zfs "list $@"; }
# General Aliases # General Aliases
alias ssha='eval `ssh-agent` ; ssh-add' alias ssha='eval `ssh-agent` ; ssh-add'
@ -274,12 +280,9 @@ alias xresources="$EDITOR $XDG_CONFIG_HOME/X11/xresources ; xrdb merge $XDG_CONF
alias sshc="$EDITOR ~/.ssh/config" alias sshc="$EDITOR ~/.ssh/config"
alias dotfiles="cd $DOTFILES" alias dotfiles="cd $DOTFILES"
alias i3c="$EDITOR $XDG_CONFIG_HOME/i3/config ; i3-msg restart" alias i3c="$EDITOR $XDG_CONFIG_HOME/i3/config ; i3-msg restart"
alias i3bc="$EDITOR $XDG_CONFIG_HOME/i3/blocks/config ; i3-msg restart"
i3b() { $EDITOR $XDG_CONFIG_HOME/i3/blocks/$@; }
alias sf=screenfetch alias sf=screenfetch
alias nf=neofetch alias nf=neofetch
randstr() { tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w $1 | head -n 1; }
alias rot13="tr '[A-Za-z]' '[N-ZA-Mn-za-m]'" alias rot13="tr '[A-Za-z]' '[N-ZA-Mn-za-m]'"
# vim: ft=sh # vim: ft=sh

31
scripts/dpi Executable file
View File

@ -0,0 +1,31 @@
#!/bin/sh
set -e
# Based on https://github.com/vincentbernat/awesome-configuration/blob/master/bin/xsettingsd-setup
dpi=$1
if [ -z "$1" ]; then
>&2 printf "Usage\n\t%s: <dpi>" "$(basename "$0")"
exit 1
fi
CONF_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/xsettingsd"
mkdir -p "$CONF_DIR"
# Build xsettingsd.local
{
cat $CONF_DIR/xsettingsd.conf 2>/dev/null || true
echo Xft/DPI $(( $dpi*1024 ))
echo Gdk/WindowScalingFactor $(( $dpi/96 ))
echo Gdk/UnscaledDPI $(( $dpi*1024/($dpi/96) ))
} > $CONF_DIR/xsettingsd.local
pid=$(xprop -name xsettingsd _NET_WM_PID 2> /dev/null | awk '{print $NF}')
if [ -z "$pid" ]; then
xsettingsd -c $CONF_DIR/xsettingsd.local &
else
kill -HUP $pid
fi
echo Xft.dpi: $dpi | xrdb -merge