sway configuration and cleanup

This commit is contained in:
Johannes Loher 2020-09-14 12:40:03 +02:00
parent 031318073d
commit e19f602e00
11 changed files with 25 additions and 291 deletions

View file

@ -1,7 +1,11 @@
{ {
"workbench.colorTheme": "Atom One Dark", "workbench.colorTheme": "Atom One Dark",
"editor.fontFamily": "Fira Code", "editor.fontFamily": "Fira Code",
"editor.fontSize": 13,
"editor.minimap.enabled": false, "editor.minimap.enabled": false,
"editor.fontLigatures": true "editor.fontLigatures": true,
"editor.renderControlCharacters": false,
"editor.rulers": [
80,
120
]
} }

View file

@ -274,7 +274,6 @@ exec --no-startup-id feh --bg-fill /usr/share/backgrounds/custom/mountain.jpg
# applets # applets
exec --no-startup-id nm-applet exec --no-startup-id nm-applet
exec --no-startup-id cbatticon
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Workspace bar # Workspace bar

View file

@ -1,72 +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 utf8;
my $acpi;
my $status;
my $percent;
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;
$full_text = "$percent%";
if ($status eq 'Discharging') {
$full_text .= ' DIS';
} elsif ($status eq 'Charging') {
$full_text .= ' CHR';
}
$short_text = $full_text;
if ($acpi =~ /(\d\d:\d\d):/) {
$full_text .= " ($1)";
}
# print text
print "$full_text\n";
print "$short_text\n";
# consider color and urgent flag only on discharge
if ($status eq 'Discharging') {
if ($percent < 33) {
print "#ff5400\n";
} elsif ($percent < 66) {
print "#ffd400\n";
} else {
print "#a8ff00\n";
}
if ($percent < 5) {
exit(33);
}
}
exit(0);

View file

@ -1,55 +0,0 @@
#!/usr/bin/perl
#
# Copyright 2014 Pierre Mavro <deimos@deimos.fr>
# Copyright 2014 Vivien Didelot <vivien@didelot.org>
# Copyright 2014 Andreas Guldstrand <andreas.guldstrand@gmail.com>
#
# Licensed under the terms of the GNU GPL v3, or any later version.
use strict;
use warnings;
use utf8;
use Getopt::Long;
# default values
my $t_warn = 50;
my $t_crit = 80;
my $cpu_usage = -1;
sub help {
print "Usage: cpu_usage [-w <warning>] [-c <critical>]\n";
print "-w <percent>: warning threshold to become yellow\n";
print "-c <percent>: critical threshold to become red\n";
exit 0;
}
GetOptions("help|h" => \&help,
"w=i" => \$t_warn,
"c=i" => \$t_crit);
# Get CPU usage
$ENV{LC_ALL}="en_US"; # if mpstat is not run under en_US locale, things may break, so make sure it is
open (MPSTAT, 'mpstat 1 1 |') or die;
while (<MPSTAT>) {
if (/^.*\s+(\d+\.\d+)\s+$/) {
$cpu_usage = 100 - $1; # 100% - %idle
last;
}
}
close(MPSTAT);
$cpu_usage eq -1 and die 'Can\'t find CPU information';
# Print short_text, full_text
printf "%.2f%%\n", $cpu_usage;
printf "%.2f%%\n", $cpu_usage;
# Print color, if needed
if ($cpu_usage >= $t_crit) {
print "#ff5400\n";
#exit 33;
} elsif ($cpu_usage >= $t_warn) {
print "#ffd400\n";
}
exit 0;

View file

@ -1,67 +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 [[ "$(cat /sys/class/net/$IF/operstate)" = 'down' ]]; then
echo down # full text
echo down # short text
echo \#ff5400 # 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
IPADDR=$(ip addr show $IF | perl -n -e "/$AF ([^\/]+).* scope global/ && print \$1 and exit")
BSSID=$(iwgetid -r $IF)
if [[ $? -eq 0 ]]; then
OUTPUT="$BSSID ($IPADDR)"
else
OUTPUT="$IPADDR"
fi
case $BLOCK_BUTTON in
3) echo -n "$IPADDR" | xclip -q -se c ;;
esac
#------------------------------------------------------------------------
echo "$OUTPUT" # full text
echo "$OUTPUT" # short text

View file

@ -1,24 +0,0 @@
#!/bin/bash
# Copyright (C) 2016 Johannes Loher <johannes.loher@fg4f.de>
# 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/>.
#------------------------------------------------------------------------
OUTPUT=`xkb-switch`
#------------------------------------------------------------------------
echo "$OUTPUT" # full text
echo "$OUTPUT" # short text

View file

@ -1,44 +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 70 ]]; then
echo "#a8ff00"
elif [[ $QUALITY -lt 70 ]]; then
echo "#ffd400"
elif [[ $QUALITY -lt 40 ]]; then
echo "#ff5400"
fi

View file

@ -11,7 +11,7 @@ rofi.color-window: #1f222d, #1f222d, #7780a1
! ------------------------------------------------------------------------------ ! ------------------------------------------------------------------------------
rofi.location: 0 rofi.location: 0
rofi.lines: 7 rofi.lines: 7
rofi.font: Roboto Regular 30 rofi.font: Roboto Regular 14
rofi.bw: 0 rofi.bw: 0
rofi.separator-style: none rofi.separator-style: none
rofi.width: 25 rofi.width: 25

View file

@ -16,13 +16,23 @@ set $color_blue #5ac8fa
set $font Roboto Regular 14 set $font Roboto Regular 14
# ------------------------------------------------------------------------------
# Inputs
# ------------------------------------------------------------------------------
input * { input * {
xkb_layout "de" xkb_layout "de,us"
xkb_variant "nodeadkeys" xkb_variant "nodeadkeys,"
xkb_model "pc105" xkb_options grp:win_space_toggle
} }
output "*" bg /usr/share/backgrounds/custom/mountain.jpg fill input 9456:311:Metadot_-_Das_Keyboard_Das_Keyboard_Model_S xkb_model "pc105"
# ------------------------------------------------------------------------------
# Outputs
# ------------------------------------------------------------------------------
output eDP-1 pos 0 0 res 3840x2400 scale 2
output DP-3 pos 1920 0 res 1920x120
output * bg /usr/share/backgrounds/custom/mountain.jpg fill
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Font # Font
@ -181,8 +191,8 @@ bindsym XF86Explorer exec --no-startup-id thunar
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Audio shortcuts # Audio shortcuts
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
set $audio_out alsa_output.pci-0000_00_1b.0.analog-stereo set $audio_out alsa_output.pci-0000_00_1f.3.analog-stereo
set $audio_in alsa_input.pci-0000_00_1b.0.analog-stereo set $audio_in alsa_input.pci-0000_00_1f.3.analog-stereo
bindsym XF86AudioRaiseVolume exec --no-startup-id "pactl set-sink-volume $audio_out +5%; pkill -RTMIN+10 i3blocks" bindsym XF86AudioRaiseVolume exec --no-startup-id "pactl set-sink-volume $audio_out +5%; pkill -RTMIN+10 i3blocks"
bindsym XF86AudioLowerVolume exec --no-startup-id "pactl set-sink-volume $audio_out -5%; pkill -RTMIN+10 i3blocks" bindsym XF86AudioLowerVolume exec --no-startup-id "pactl set-sink-volume $audio_out -5%; pkill -RTMIN+10 i3blocks"
@ -274,15 +284,8 @@ default_border pixel 2
gaps inner 10 gaps inner 10
# gaps outer -5 # gaps outer -5
# compositor
exec --no-startup-id compton
# backgorund
exec --no-startup-id feh --bg-fill /usr/share/backgrounds/custom/mountain.jpg
# applets # applets
exec --no-startup-id nm-applet exec --no-startup-id nm-applet --indicator
exec --no-startup-id cbatticon
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Workspace bar # Workspace bar

View file

@ -1,5 +1,5 @@
[options] [options]
font = Fira Code 13 font = Fira Code 14
cursor_blink = off cursor_blink = off
scrollback_lines = 4096 scrollback_lines = 4096
urgent_on_bell = true urgent_on_bell = true

View file

@ -26,16 +26,6 @@ signal=10
[separator] [separator]
full_text= full_text=
[keyboard_layout]
label=
command=~/.config/i3blocks/scripts/keyboard_layout
color=#d1d4e0
interval=once
signal=12
[separator]
full_text=
[datetime] [datetime]
label= label=
command=date "+%d.%m.%Y" command=date "+%d.%m.%Y"