Parcourir la source

[i3] Add new config from EndeavourOS

Colin Powell il y a 3 ans
Parent
commit
b6d7a37219

+ 115 - 35
i3/.config/i3/config

@@ -12,6 +12,28 @@ set $firefox      firefox --new-window
 set $surf         surf
 set $term         alacritty
 
+# Power Profiles menu switcher (rofi)
+bindsym $mod+Shift+p exec ~/.config/i3/scripts/power-profiles
+
+# 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"
+
+#get auth work with polkit-gnome
+exec --no-startup-id /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
+
+# set powersavings for display:
+exec --no-startup-id xset s 480 dpms 600 600 600
+
 # DIR VARIABLES
 set $bin ~/bin
 
@@ -33,33 +55,82 @@ hide_edge_borders vertical
 #for_window [class="Emacs"] border pixel $thick
 for_window [class="st"] border pixel $thick
 
-# FLOATING APPLICATIONS
-#for_window [class="Orca"] floating enable
-for_window [class="Foliate"] floating enable
-for_window [class="Foliate"] floating_maximum_size 400 x 800
 
 #for_window [class="Surf"] floating enable
 #for_window [class="Surf"] floating_maximum_size 800 x 550
 
 # GAP VARIABLES
-set $inner 7
-set $outer 7
+set $inner 6
+set $outer 3
 
 # SET GAPS
 gaps inner $inner
 gaps outer $outer
 
+# set floating (nontiling) for apps needing it
+for_window [class="Yad" instance="yad"] floating enable
+for_window [class="Galculator" instance="galculator"] floating enable
+for_window [class="Blueberry.py" instance="blueberry.py"] floating enable
+
+# set floating (nontiling) for special apps
+for_window [class="Xsane" instance="xsane"] floating enable
+for_window [class="Pavucontrol" instance="pavucontrol"] floating enable
+for_window [class="qt5ct" instance="qt5ct"] floating enable
+for_window [class="Blueberry.py" instance="blueberry.py"] floating enable
+for_window [class="Bluetooth-sendto" instance="bluetooth-sendto"] floating enable
+for_window [class="Pamac-manager"] floating enable
+for_window [window_role="About"] floating enable
+for_window [class="Foliate"] floating enable
+for_window [class="Foliate"] floating_maximum_size 400 x 800
+
+# set border of floating window
+for_window [class="urxvt"] border pixel 1
+
+# Define colors variables:
+set $darkbluetrans	#08052be6
+set $darkblue		#08052b
+set $lightblue		#5294e2
+set $urgentred		#e53935
+set $white		#ffffff
+set $black		#000000
+set $purple		#e345ff
+set $darkgrey		#383c4a
+set $grey		#b0b5bd
+set $mediumgrey		#8b8b8b
+set $yellowbrown	#e1b700
+
+#class		        	border		bground		text		indicator	child_border
+client.focused		    $lightblue	$darkblue	$white		$purple		$mediumgrey
+client.unfocused	    $darkblue	$darkblue	$grey		$purple		$darkgrey
+client.focused_inactive	$darkblue	$darkblue	$grey		$purple		$black
+client.urgent		    $urgentred	$urgentred	$white		$purple		$yellowbrown
 
-# START POLYBAR
-#exec_always --no-startup-id ~/.config/polybar/launch.sh
 bar {
-    position bottom
-    position top
-    status_command i3status -c ~/.config/i3status/i3status.conf
-    colors {
-        statusline #deedee
-        separator #777777
-    }
+		font pango: Noto Sans Regular 10
+		status_command i3blocks -c ~/.config/i3/i3blocks.conf
+	    	position top
+#	    	i3bar_command i3bar --transparency
+# it could be that you have no primary display set: set one (xrandr --output <output> --primary)
+# reference: https://i3wm.org/docs/userguide.html#_tray_output
+		    tray_output primary
+		    tray_padding 0
+
+# When strip_workspace_numbers is set to yes,
+# any workspace that has a name of the form
+# “[n][:][NAME]” will display only the name.
+strip_workspace_numbers yes
+##strip_workspace_name no
+
+		    colors {
+		    separator          $purple
+		    background         $darkgrey
+		    statusline         $white
+#                          		border 		        bg		txt		indicator
+		focused_workspace	$mediumgrey	   	$grey		$darkgrey	$purple
+		active_workspace	$lightblue      	$mediumgrey	$darkgrey	$purple
+		inactive_workspace	$darkgrey   		$darkgrey	$grey		$purple
+		urgent_workspace	$urgentred	    	$urgentred	$white		$purple
+	}
 }
 
 # CUSTOM BINDINGS
@@ -153,8 +224,12 @@ bindsym $mod+c $center
 # DISPLAYS
 bindsym $mod+F1 exec ~/.screenlayout/titan-one.sh
 bindsym $mod+F2 exec ~/.screenlayout/titan-two.sh
-bindsym $mod+F3 exec ~/.screenlayout/titan-three.sh
-bindsym $mod+F4 exec ~/.screenlayout/titan-three-vert.sh
+
+# bind program to workspace and focus to them on startup:
+assign [class="Alacritty"] $ws1
+assign [class="(?i)firefox"] $ws2
+assign [class="Thunar"] $ws3
+assign [class="qutebrowser"] $ws4
 
 ##### WORKSPACES ##################################
 
@@ -272,7 +347,6 @@ bindsym F6 exec ~/.bin/fade up
 # ROFI
 bindsym $mod+space   exec rofi -show combi -display-window "W"
 bindsym $mod+P       exec --no-startup-id ~/.config/rofi/rofi-pass.sh
-bindsym $mod+Shift+p exec --no-startup-id ~/.config/rofi/rofi-otp.sh
 bindsym $mod+o       exec --no-startup-id ~/.config/rofi/www.sh
 bindsym $mod+Shift+o exec --no-startup-id ~/.config/rofi/www-incognito.sh
 bindsym $mod+s       exec --no-startup-id ~/.config/rofi/web-search.sh
@@ -325,14 +399,14 @@ bindsym $mod+Ctrl+e exec pkill emacs
 ##### LAUNCH ######################################
 
 # STARTUP
-exec --no-startup-id unclutter -grab
+exec_always --no-startup-id unclutter -grab
 exec --no-startup-id nm-applet
-exec --no-startup-id copyq
+exec_always --no-startup-id copyq
 
 # RELOAD
 #exec --no-startup-id picom --config ~/.config/compton/compton.conf
 exec --no-startup-id dunst
-exec --no-startup-id syncthing -no-qute
+exec_always --no-startup-id syncthing
 exec xrdb --merge ~/.Xresoureces
 
 
@@ -342,28 +416,34 @@ exec_always setxkbmap -model pc105 -layout us,ru -option grp:ctrls_toggle -optio
 
 ## Volume control
 # Pulse Audio controls
-bindsym XF86AudioRaiseVolume exec amixer -D pulse sset Master 5%+
-bindsym XF86AudioLowerVolume exec amixer -D pulse sset Master 5%-
-bindsym XF86AudioMute exec amixer -D pulse sset Master toggle
-bindsym XF86AudioMicMute exec amixer -D pulse sset Capture toggle
-bindsym F1 exec pulseaudio-ctl mute
-bindsym F2 exec pulseaudio-ctl down
-bindsym F3 exec pulseaudio-ctl up
-bindsym F4 exec pulseaudio-ctl mute-input
+bindsym XF86AudioRaiseVolume exec amixer -D pulse sset Master 5%+ && pkill -RTMIN+1 i3blocks
+bindsym XF86AudioLowerVolume exec amixer -D pulse sset Master 5%- && pkill -RTMIN+1 i3blocks
+bindsym XF86AudioMute exec amixer -D pulse sset Master toggle && pkill -RTMIN+1 i3blocks
+bindsym XF86AudioMicMute exec amixer -D pulse sset Capture toggle && pkill -RTMIN+1 i3blocks
+bindsym F1 exec amixer -D pulse sset Master toggle && pkill -RTMIN+1 i3blocks
+bindsym F2 exec amixer -D pulse sset Master 5%- && pkill -RTMIN+1 i3blocks
+bindsym F3 exec amixer -D pulse sset Master 5%+ && pkill -RTMIN+1 i3blocks
+bindsym F4 exec amixer -D pulse sset Capture toggle && pkill -RTMIN+1 i3blocks
+bindsym $mod+z exec amixer -D pulse sset Master 5%- && pkill -RTMIN+1 i3blocks
+bindsym $mod+x exec amixer -D pulse sset Master 5%+ && pkill -RTMIN+1 i3blocks
+bindsym $mod+a exec amixer -D pulse sset Master toggle && pkill -RTMIN+1 i3blocks
 bindsym $mod+Home exec --no-startup-id cvlc https://stream.unbl.ink/mopidy
 bindsym $mod+Shift+Home exec --no-startup-idcvlc https://playerservices.streamtheworld.com/api/livestream-redirect/WMEAFM.mp3
 bindsym $mod+End exec pkill vlc
 
-bindsym $mod+z exec pulseaudio-ctl down
-bindsym $mod+x exec pulseaudio-ctl up
-
 # Iapetus central volume
 #@bindsym $mod+. exec ssh iapetus.local down
 #@bindsym $mod+Shift+. exec ssh iapetus.local up
 #@bindsym $mod+Alt+. exec ssh iapetus.local playu
 #@bindsym $mod+Ctrl+. exec ssh iapetus.local "pkill vlc"
 
-#bindsym XF86AudioRaiseVolume exec mixer vol +5
-#bindsym XF86AudioLowerVolume exec mixer vol -5
-#bindsym XF86AudioMicMute     exec mixer mic toggle
+bindsym $mod+d exec rofi -modi drun -show drun \
+		-config ~/.config/rofi/rofidmenu.rasi
+
+#bindsym F9 exec rofi -modi drun -show drun \
+#		-config ~/.config/rofi/rofidmenu.rasi
+
+## rofi bindings for window menu ($mod+t /F10 optional disabled)
 
+bindsym $mod+t exec rofi -show window \
+		-config ~/.config/rofi/rofidmenu.rasi

+ 166 - 0
i3/.config/i3/i3blocks.conf

@@ -0,0 +1,166 @@
+# i3blocks config file changed for EndeavourOS-i3 setup
+
+# source is available here:
+# https://raw.githubusercontent.com/endeavouros-team/endeavouros-i3wm-setup/main/.config/i3/i3blocks.conf
+# Maintainer: joekamprad [joekamprad@endeavouros.com]
+# Former Visual Designer: Florent Valetti [@FLVAL EndeavourOS]
+# created for i3wm setup on EndeavourOS
+# https://endeavouros.com
+
+# cheatsheet for icon fonts used on the block-bar:
+# https://fontawesome.com/v4.7/cheatsheet/
+
+# --> to update this run the following command:
+# wget --backups=1 https://raw.githubusercontent.com/endeavouros-team/endeavouros-i3wm-setup/main/.config/i3/i3blocks.conf -P ~/.config/i3/
+
+# 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.
+separator=false
+markup=pango
+
+[terminal]
+full_text= 
+color=#807dfe
+command=i3-msg -q exec xfce4-terminal
+
+[browser]
+full_text= 
+color=#ff7f81
+command=i3-msg -q exec firefox
+
+[files]
+full_text= 
+color=#7f3fbf
+command=i3-msg -q exec thunar ~/
+
+#[mail]
+#full_text= 
+#color=#dbcb75
+#command=i3-msg -q exec thunderbird
+
+[simple-2]
+full_text=: :
+color=#717171
+
+# Disk usage
+#
+# The directory defaults to $HOME if the instance is not specified.
+# The script may be called with a optional argument to set the alert
+# (defaults to 10 for 10%).
+[disk]
+label=
+instance=/
+command=~/.config/i3/scripts/disk
+interval=30
+
+# Memory usage
+#
+# The type defaults to "mem" if the instance is not specified.
+[memory]
+label=
+command=~/.config/i3/scripts/memory
+interval=2
+
+[cpu_usage]
+label=
+command=~/.config/i3/scripts/cpu_usage
+#min_width=CPU: 100.00%
+interval=2
+
+[CPU-temperature]
+label=
+command=~/.config/i3/scripts/temperature
+interval=30
+#T_WARN=70
+#T_CRIT=90
+#SENSOR_CHIP=""
+# where SENSOR_CHIP can be find with sensors output
+# can be used also for GPU temperature or other temperature sensors lm-sensors detects.
+
+# showing name of connected network (enable for wifi use)
+#[net]
+#label=
+#command=echo "$(LANG=C nmcli d | grep connected  | awk '{print $4}')"
+#interval=30
+
+[bandwidth]
+command=~/.config/i3/scripts/bandwidth2
+interval=persist
+
+# Battery indicator
+[battery]
+command=~/.config/i3/scripts/battery2
+# for alternative battery script  change to battery1
+# change this to battery-pinebook-pro if you are running on pinebook-pro
+label=
+interval=30
+
+[simple-2]
+full_text=: :
+color=#717171
+
+[pavucontrol]
+full_text=
+command=pavucontrol
+
+[volume-pulseaudio]
+command=~/.config/i3/scripts/volume
+instance=Master
+interval=1
+
+# display keyboard layout name
+# for keyboard layouts switcher
+# see i3 config file
+#[keyboard-layout]
+#command=~/.config/i3/scripts/keyboard-layout
+#interval=2
+
+[keybindings]
+full_text=
+command=~/.config/i3/scripts/keyhint
+
+#set power-profile
+[ppd_menu]
+full_text=
+command=~/.config/i3/scripts/power-profiles
+color=#407437
+
+#Show the current power-profile
+[ppd-status]
+command=~/.config/i3/scripts/ppd-status
+interval=5
+
+[time]
+#label=
+command=date '+%a %d %b %H:%M:%S'
+interval=1
+
+[shutdown_menu]
+full_text=
+command=~/.config/i3/scripts/powermenu
+
+[simple-2]
+full_text=: :
+color=#717171

+ 103 - 0
i3/.config/i3/keybindings

@@ -0,0 +1,103 @@
+EndeavourOS i3wm Keybindings cheat sheet:
+
+--> to update this run the following command:
+wget --backups=1 https://raw.githubusercontent.com/endeavouros-team/endeavouros-i3wm-setup/main/.config/i3/keybindings -P ~/.config/i3/
+
+All sources and updates are available at GitHub:
+https://github.com/endeavouros-team/endeavouros-i3wm-setup
+
+For reference consult our WIKI:
+https://discovery.endeavouros.com/window-tiling-managers/i3-wm/
+
+ = windows key
+
+# start xfce4-terminal
++Return 
+
+# kill focused window
++q
+
+# Application menu search by typing (fancy Rofi menu):
++d
+
+# Window switcher menu (fancy Rofi menu):
++t
+
+# fancy exit-menu on bottom right:
++Shift+e
+
+# Lock the system
+# lock with a picture or blurring the screen (options in config)
++l
+
+# reload the configuration file
++Shift+c
+
+# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
++Shift+r
+
+# full keybinding list in editor:
++F1
+
+# change window focus
++j focus left
++k focus down
++b focus up
++o focus right
+
+# alternatively, you can use the cursor keys:
++Left focus left
++Down focus down
++Up focus up
++Right focus right
+
+# move a focused window
++Shift+j move left
++Shift+k move down
++Shift+b move up
++Shift+o move right
+
+# alternatively, you can use the cursor keys:
++Shift+Left move left
++Shift+Down move down
++Shift+Up move up
++Shift+Right move right
+
+# split in horizontal orientation
++h split h
+
+# split in vertical orientation
++v split v
+
+# enter fullscreen mode for the focused container
++f fullscreen toggle
+
+# change container layout (stacked, tabbed, toggle split)
++s layout stacking
++g layout tabbed
++e layout toggle split
+
+# toggle tiling / floating
++Shift+space floating toggle
+
+# change focus between tiling / floating windows
++space focus mode_toggle
+
+# focus the parent container
++a focus parent
+
+# focus the child container
+#+d focus child
+
+# resize floating window
++right mouse button
+
+## Multimedia Keys
+
+# Redirect sound to headphones
++p
+
+## App shortcuts
++w starts Firefox
++n starts Thunar
+ Button screenshot

+ 104 - 0
i3/.config/i3/scripts/bandwidth2

@@ -0,0 +1,104 @@
+#!/usr/bin/env bash
+#
+# Copyright (C) 2015 James Murphy
+# Licensed under the terms of the GNU GPL v2 only.
+#
+# i3blocks blocklet script to monitor bandwidth usage
+
+iface="${BLOCK_INSTANCE}"
+iface="${IFACE:-$iface}"
+dt="${DT:-3}"
+unit="${UNIT:-MB}"
+LABEL="${LABEL:-<span font='FontAwesome'> </span>}" # down arrow up arrow
+printf_command="${PRINTF_COMMAND:-"printf \"${LABEL}%1.0f/%1.0f %s/s\\n\", rx, wx, unit;"}"
+
+function default_interface {
+    ip route | awk '/^default via/ {print $5; exit}'
+}
+
+function check_proc_net_dev {
+    if [ ! -f "/proc/net/dev" ]; then
+        echo "/proc/net/dev not found"
+        exit 1
+    fi
+}
+
+function list_interfaces {
+    check_proc_net_dev
+    echo "Interfaces in /proc/net/dev:"
+    grep -o "^[^:]\\+:" /proc/net/dev | tr -d " :"
+}
+
+while getopts i:t:u:p:lh opt; do
+    case "$opt" in
+        i) iface="$OPTARG" ;;
+        t) dt="$OPTARG" ;;
+        u) unit="$OPTARG" ;;
+        p) printf_command="$OPTARG" ;;
+        l) list_interfaces && exit 0 ;;
+        h) printf \
+"Usage: bandwidth3 [-i interface] [-t time] [-u unit] [-p printf_command] [-l] [-h]
+Options:
+-i\tNetwork interface to measure. Default determined using \`ip route\`.
+-t\tTime interval in seconds between measurements. Default: 3
+-u\tUnits to measure bytes in. Default: Mb
+\tAllowed units: Kb, KB, Mb, MB, Gb, GB, Tb, TB
+\tUnits may have optional it/its/yte/ytes on the end, e.g. Mbits, KByte
+-p\tAwk command to be called after a measurement is made. 
+\tDefault: printf \"<span font='FontAwesome'>  </span>%%-5.1f/%%5.1f %%s/s\\\\n\", rx, wx, unit;
+\tExposed variables: rx, wx, tx, unit, iface
+-l\tList available interfaces in /proc/net/dev
+-h\tShow this help text
+" && exit 0;;
+    esac
+done
+
+check_proc_net_dev
+
+iface="${iface:-$(default_interface)}"
+while [ -z "$iface" ]; do
+    echo No default interface
+    sleep "$dt"
+    iface=$(default_interface)
+done
+
+case "$unit" in
+    Kb|Kbit|Kbits)   bytes_per_unit=$((1024 / 8));;
+    KB|KByte|KBytes) bytes_per_unit=$((1024));;
+    Mb|Mbit|Mbits)   bytes_per_unit=$((1024 * 1024 / 8));;
+    MB|MByte|MBytes) bytes_per_unit=$((1024 * 1024));;
+    Gb|Gbit|Gbits)   bytes_per_unit=$((1024 * 1024 * 1024 / 8));;
+    GB|GByte|GBytes) bytes_per_unit=$((1024 * 1024 * 1024));;
+    Tb|Tbit|Tbits)   bytes_per_unit=$((1024 * 1024 * 1024 * 1024 / 8));;
+    TB|TByte|TBytes) bytes_per_unit=$((1024 * 1024 * 1024 * 1024));;
+    *) echo Bad unit "$unit" && exit 1;;
+esac
+
+scalar=$((bytes_per_unit * dt))
+init_line=$(cat /proc/net/dev | grep "^[ ]*$iface:")
+if [ -z "$init_line" ]; then
+    echo Interface not found in /proc/net/dev: "$iface"
+    exit 1
+fi
+
+init_received=$(awk '{print $2}' <<< $init_line)
+init_sent=$(awk '{print $10}' <<< $init_line)
+
+(while true; do cat /proc/net/dev; sleep "$dt"; done) |\
+    stdbuf -oL grep "^[ ]*$iface:" |\
+    awk -v scalar="$scalar" -v unit="$unit" -v iface="$iface" '
+BEGIN{old_received='"$init_received"';old_sent='"$init_sent"'}
+{
+    received=$2
+    sent=$10
+    rx=(received-old_received)/scalar;
+    wx=(sent-old_sent)/scalar;
+    tx=rx+wr;
+    old_received=received;
+    old_sent=sent;
+    if(rx >= 0 && wx >= 0){
+        '"$printf_command"';
+        fflush(stdout);
+    }
+}
+'

+ 18 - 0
i3/.config/i3/scripts/battery-pinebook-pro

@@ -0,0 +1,18 @@
+#!/usr/bin/env bash
+#simple Shellscript for i3blocks on Pinebook pro
+#05012020 geri123@gmx.net Gerhard S.
+#battery-symbols: on Manjaro you need the awesome-terminal-fonts package installed!
+PERCENT=$(cat /sys/class/power_supply/cw2015-battery/capacity)
+STATUS=$(cat /sys/class/power_supply/cw2015-battery/status)
+case $((
+ $PERCENT >= 0 && $PERCENT <= 20 ? 1 :
+ $PERCENT > 20 && $PERCENT <= 40 ? 2 :
+ $PERCENT > 40 && $PERCENT <= 60 ? 3 :
+ $PERCENT > 60 && $PERCENT <= 80 ? 4 : 5)) in
+#
+       (1) echo $STATUS:"" :$PERCENT%;;
+       (2) echo $STATUS:"" :$PERCENT%;;
+       (3) echo $STATUS:"" :$PERCENT%;;
+       (4) echo $STATUS:"" :$PERCENT%;;
+       (5) echo $STATUS:"" :$PERCENT%;;
+esac

+ 114 - 0
i3/.config/i3/scripts/battery1

@@ -0,0 +1,114 @@
+#!/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.
+
+# Edited by Andreas Lindlbauer <endeavouros.mousily@aleeas.com>
+
+use strict;
+use warnings;
+use utf8;
+
+# otherwise we get in console "Wide character in print at"
+binmode(STDOUT, ':utf8');
+
+# my $acpi;
+my $upower;
+my $percent;
+my $bat_state;
+my $status;
+my $ac_adapt;
+my $full_text;
+my $short_text;
+my $label = '😅';
+my $bat_number = $ENV{BLOCK_INSTANCE} || 0;
+
+open (UPOWER, "upower -i /org/freedesktop/UPower/devices/battery_BAT$bat_number | grep 'percentage' |") or die;
+$upower = <UPOWER>;
+close(UPOWER);
+
+# fail on unexpected output
+if ($upower !~ /:          (\d+)%/) {
+	die "$upower\n";
+}
+
+$percent = $1;
+$full_text = "$percent%";
+
+open (BAT_STATE, "upower -i /org/freedesktop/UPower/devices/battery_BAT$bat_number | grep 'state' |") or die;
+$bat_state = <BAT_STATE>;
+close(BAT_STATE);
+
+if ($bat_state !~ /:               (\w+)/) {
+	die "$bat_state\n";
+}
+$status = $1;
+
+if ($status eq 'discharging') {
+	$full_text .= ' ';
+} elsif ($status eq 'charging') {
+	$full_text .= ' ';
+} elsif ($status eq 'Unknown') {
+	open (AC_ADAPTER, "acpi -a |") or die;
+	$ac_adapt = <AC_ADAPTER>;
+	close(AC_ADAPTER);
+
+	if ($ac_adapt =~ /: ([\w-]+)/) {
+		$ac_adapt = $1;
+
+		if ($ac_adapt eq 'on-line') {
+			$full_text .= ' CHR';
+		} elsif ($ac_adapt eq 'off-line') {
+			$full_text .= ' DIS';
+		}
+	}
+}
+
+$short_text = $full_text;
+
+if ($percent < 20) {
+  $label = '';
+} elsif ($percent < 45) {
+  $label = '';
+} elsif ($percent < 70) {
+  $label = '';
+} elsif ($percent < 95) {
+  $label = '';
+} else {
+  $label = '';
+}
+
+# print text
+print " ${label}";
+print " $full_text\n";
+print " ${label}";
+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 "#FFAE00\n";
+	} elsif ($percent < 60) {
+		print "#FFF600\n";
+	} elsif ($percent < 85) {
+		print "#A8FF00\n";
+	}
+
+	if ($percent < 5) {
+		exit(33);
+	}
+}
+
+exit(0);

+ 106 - 0
i3/.config/i3/scripts/battery2

@@ -0,0 +1,106 @@
+#!/usr/bin/env python3
+#
+# Copyright (C) 2016 James Murphy
+# Licensed under the GPL version 2 only
+#
+# A battery indicator blocklet script for i3blocks
+
+from subprocess import check_output
+import os
+import re
+
+config = dict(os.environ)
+status = check_output(['acpi'], universal_newlines=True)
+
+if not status:
+    # stands for no battery found
+    color = config.get("color_10", "red")
+    fulltext = "<span color='{}'><span font='FontAwesome'>\uf00d \uf240</span></span>".format(color)
+    percentleft = 100
+else:
+    # if there is more than one battery in one laptop, the percentage left is
+    # available for each battery separately, although state and remaining
+    # time for overall block is shown in the status of the first battery
+    batteries = status.split("\n")
+    state_batteries=[]
+    commasplitstatus_batteries=[]
+    percentleft_batteries=[]
+    time = ""
+    for battery in batteries:
+        if battery!='':
+            state_batteries.append(battery.split(": ")[1].split(", ")[0])
+            commasplitstatus = battery.split(", ")
+            if not time:
+                time = commasplitstatus[-1].strip()
+                # check if it matches a time
+                time = re.match(r"(\d+):(\d+)", time)
+                if time:
+                    time = ":".join(time.groups())
+                    timeleft = " ({})".format(time)
+                else:
+                    timeleft = ""
+
+            p = int(commasplitstatus[1].rstrip("%\n"))
+            if p>0:
+                percentleft_batteries.append(p)
+            commasplitstatus_batteries.append(commasplitstatus)
+    state = state_batteries[0]
+    commasplitstatus = commasplitstatus_batteries[0]
+    if percentleft_batteries:
+        percentleft = int(sum(percentleft_batteries)/len(percentleft_batteries))
+    else:
+        percentleft = 0
+
+    # stands for charging
+    color = config.get("color_charging", "yellow")
+    FA_LIGHTNING = "<span color='{}'><span font='FontAwesome'>\uf0e7</span></span>".format(color)
+
+    # stands for plugged in
+    FA_PLUG = "<span font='FontAwesome'>\uf1e6</span>"
+
+    # stands for using battery
+    FA_BATTERY = "<span font='FontAwesome'>\uf240</span>"
+
+    # stands for unknown status of battery
+    FA_QUESTION = "<span font='FontAwesome'>\uf128</span>"
+
+
+    if state == "Discharging":
+        fulltext = FA_BATTERY + " "
+    elif state == "Full":
+        fulltext = FA_PLUG + " "
+        timeleft = ""
+    elif state == "Unknown":
+        fulltext = FA_QUESTION + " " + FA_BATTERY + " "
+        timeleft = ""
+    else:
+        fulltext = FA_LIGHTNING + " " + FA_PLUG + " "
+
+    def color(percent):
+        if percent < 10:
+            # exit code 33 will turn background red
+            return config.get("color_10", "#FFFFFF")
+        if percent < 20:
+            return config.get("color_20", "#FF3300")
+        if percent < 30:
+            return config.get("color_30", "#FF6600")
+        if percent < 40:
+            return config.get("color_40", "#FF9900")
+        if percent < 50:
+            return config.get("color_50", "#FFCC00")
+        if percent < 60:
+            return config.get("color_60", "#FFFF00")
+        if percent < 70:
+            return config.get("color_70", "#FFFF33")
+        if percent < 80:
+            return config.get("color_80", "#FFFF66")
+        return config.get("color_full", "#FFFFFF")
+
+    form =  '<span color="{}">{}%</span>'
+    fulltext += form.format(color(percentleft), percentleft)
+    #fulltext += timeleft
+
+print(fulltext)
+print(fulltext)
+if percentleft < 10:
+    exit(33)

+ 11 - 0
i3/.config/i3/scripts/blur-lock

@@ -0,0 +1,11 @@
+#!/usr/bin/env bash
+
+PICTURE=/tmp/i3lock.png
+SCREENSHOT="scrot -z $PICTURE"
+
+BLUR="5x4"
+
+$SCREENSHOT
+convert $PICTURE -blur $BLUR $PICTURE
+i3lock -i $PICTURE
+rm $PICTURE

+ 62 - 0
i3/.config/i3/scripts/cpu_usage

@@ -0,0 +1,62 @@
+#!/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 = $ENV{T_WARN} // 50;
+my $t_crit = $ENV{T_CRIT} // 80;
+my $cpu_usage = -1;
+my $decimals = $ENV{DECIMALS} // 0;
+my $label = $ENV{LABEL} // "";
+
+sub help {
+    print "Usage: cpu_usage [-w <warning>] [-c <critical>] [-d <decimals>]\n";
+    print "-w <percent>: warning threshold to become yellow\n";
+    print "-c <percent>: critical threshold to become red\n";
+    print "-d <decimals>:  Use <decimals> decimals for percentage (default is $decimals) \n"; 
+    exit 0;
+}
+
+GetOptions("help|h" => \&help,
+           "w=i"    => \$t_warn,
+           "c=i"    => \$t_crit,
+           "d=i"    => \$decimals,
+);
+
+# 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\x00]?$/) {
+        $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
+print "${label}";
+printf "%02.${decimals}f%%\n", $cpu_usage;
+print "${label}";
+printf "%02.${decimals}f%%\n", $cpu_usage;
+
+# Print color, if needed
+if ($cpu_usage >= $t_crit) {
+    print "#FF0000\n";
+    exit 33;
+} elsif ($cpu_usage >= $t_warn) {
+    print "#FFFC00\n";
+}
+
+exit 0;

+ 48 - 0
i3/.config/i3/scripts/disk

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

+ 10 - 0
i3/.config/i3/scripts/empty_workspace

@@ -0,0 +1,10 @@
+#!/usr/bin/env bash
+
+MAX_DESKTOPS=20
+
+WORKSPACES=$(seq -s '\n' 1 1 ${MAX_DESKTOPS})
+
+EMPTY_WORKSPACE=$( (i3-msg -t get_workspaces | tr ',' '\n' | grep num | awk -F:  '{print int($2)}' ; \
+            echo -e ${WORKSPACES} ) | sort -n | uniq -u | head -n 1)
+
+i3-msg workspace ${EMPTY_WORKSPACE}

+ 5 - 0
i3/.config/i3/scripts/keyboard-switch

@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+
+KBD=$(/usr/bin/xkblayout-state print '%s')
+echo $KBD
+

+ 25 - 0
i3/.config/i3/scripts/keyhint

@@ -0,0 +1,25 @@
+#!/bin/bash
+
+Main() {
+    source /usr/share/endeavouros/scripts/eos-script-lib-yad || return 1
+
+    local command=(
+        eos_yad --title="EndeavourOS i3-wm keybindings:" --no-buttons --geometry=400x345-15-400 --list
+        --column=key: --column=description: --column=command:
+        "ESC" "close this app" ""
+        "=" "modkey" "(set mod Mod4)"
+        "+enter" "open a terminal" ""
+        "+Shift+n" "new empty workspace" ""
+        "+w" "open Browser" ""
+        "+n" "open Filebrowser" ""
+        "+d" "app menu" ""
+        "+q" "close focused app" ""
+        "Print-key" "screenshot" ""
+        "+Shift+e" "logout menu" ""
+        "F1" "open keybinding helper" ""
+    )
+
+    "${command[@]}"
+}
+
+Main "$@"

+ 6 - 0
i3/.config/i3/scripts/keyhint-2

@@ -0,0 +1,6 @@
+I3_CONFIG=$HOME/.config/i3/config
+mod_key=$(sed -nre 's/^set \$mod (.*)/\1/p' ${I3_CONFIG})
+grep "^bindsym" ${I3_CONFIG} \
+    | sed "s/-\(-\w\+\)\+//g;s/\$mod/${mod_key}/g;s/Mod1/Alt/g;s/exec //;s/bindsym //;s/^\s\+//;s/^\([^ ]\+\) \(.\+\)$/\2: \1/;s/^\s\+//" \
+    | tr -s ' ' \
+    | rofi -dmenu -theme ~/.config/rofi/rofikeyhint.rasi

+ 69 - 0
i3/.config/i3/scripts/memory

@@ -0,0 +1,69 @@
+#!/usr/bin/env bash
+# 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 {
+	if (type == "swap") {
+		free=swap_free/1024/1024
+		used=(swap_total-swap_free)/1024/1024
+		total=swap_total/1024/1024
+	} else {
+		free=mem_free/1024/1024
+		used=(mem_total-mem_free)/1024/1024
+		total=mem_total/1024/1024
+	}
+
+	pct=0
+	if (total > 0) {
+		pct=used/total*100
+	}
+
+	# full text
+	# printf("%.1fG/%.1fG (%.f%%)\n", used, total, pct)
+
+	# short text
+	printf("%.f%%\n", pct)
+
+	# color
+	if (pct > 90) {
+		print("#FF0000")
+	} else if (pct > 80) {
+		print("#FFAE00")
+	} else if (pct > 70) {
+		print("#FFF600")
+	}
+}
+' /proc/meminfo

+ 93 - 0
i3/.config/i3/scripts/openweather

@@ -0,0 +1,93 @@
+#!/usr/bin/env bash
+# Edited by Andreas Lindlbauer <endeavouros.mousily@aleeas.com>
+
+temps=("#0600FF" "#0500FF" "#0400FF" "#0300FF" "#0200FF" "#0100FF" "#0000FF" "#0002FF" "#0012FF" "#0022FF" "#0032FF" "#0044FF" "#0054FF" "#0064FF" "#0074FF" "#0084FF" "#0094FF" "#00A4FF" "#00B4FF" "#00C4FF" "#00D4FF" "#00E4FF" "#00FFF4" "#00FFD0" "#00FFA8" "#00FF83" "#00FF5C" "#00FF36" "#00FF10" "#17FF00" "#3EFF00" "#65FF00" "#B0FF00" "#FDFF00" "#FFF000" "#FFDC00" "#FFC800" "#FFB400" "#FFA000" "#FF8C00" "#FF7800" "#FF6400" "#FF5000" "#FF3C00" "#FF2800" "#FF1400" "#FF0000")
+
+command -v jq >/dev/null 2>&1 || { echo >&2 "Program 'jq' required but it is not installed.  
+Aborting."; exit 1; }
+command -v wget >/dev/null 2>&1 || { echo >&2 "Program 'wget' required but is not installed.  
+Aborting."; exit 1; }
+
+APIKEY="get your key first"
+#ZIPCODE="1234"
+#CITY_ID="Get your City ID first"
+#URL="http://api.openweathermap.org/data/2.5/weather?id=${CITY_ID}&units=metric&APPID=${APIKEY}"
+LAT="Find out your position with your latitude"
+LON="and longitude"
+URL="http://api.openweathermap.org/data/2.5/onecall?lat=${LAT}&lon=${LON}&units=metric&exclude=minutely,hourly,daily&APPID=${APIKEY}"
+WEATHER_RESPONSE=$(wget -qO- "${URL}")
+
+WEATHER_CONDITION=$(echo "$WEATHER_RESPONSE" | jq '.current.weather[0].main' | sed 's/"//g')
+WEATHER_TEMP=$(echo "$WEATHER_RESPONSE" | jq '.current.feels_like')
+WEATHER_INT=${WEATHER_TEMP%.*}
+
+TIME_NOW=$( echo "$WEATHER_RESPONSE" | jq '.current.dt')
+SUNRISE=$( echo "$WEATHER_RESPONSE" | jq '.current.sunrise')
+SUNSET=$( echo "$WEATHER_RESPONSE" | jq '.current.sunset')
+DESCRIPTION=$( echo "$WEATHER_RESPONSE" | jq '.current.weather[0].description' | sed 's/"//g')
+WEATHER_ALERT=$( echo "$WEATHER_RESPONSE" | jq '.alerts[0].event' | sed 's/"//g')
+DAYTIME="n"
+
+if [[ "$TIME_NOW" > "$SUNRISE" ]] && [[ "$TIME_NOW" < "$SUNSET" ]]; then
+    DAYTIME="d"
+fi
+
+case $WEATHER_CONDITION in
+  'Clouds')
+    if [ "$DAYTIME" == "d" ]; then
+        WEATHER_ICON=""
+    else
+        WEATHER_ICON=""
+    fi
+    ;;
+  'Rain')
+    WEATHER_ICON=""
+    ;;
+  'Drizzle')
+    if [ "$DAYTIME" == "d" ]; then
+        WEATHER_ICON="" 
+    else
+        WEATHER_ICON=""
+    fi
+    ;;
+  'Thunderstorm')
+    WEATHER_ICON=""
+    ;;
+  'Snow')
+    WEATHER_ICON=""
+    ;;
+  'Clear')
+    if [ "$DAYTIME" == "d" ]; then
+        WEATHER_ICON=""
+    else
+        WEATHER_ICON=""
+    fi
+    ;;
+  *)
+    WEATHER_ICON="🌫"
+    ;;
+esac
+
+WEATHER_COLOR="#FFFFFF"
+if [ "$WEATHER_INT" -lt "-11" ]; then
+    WEATHER_COLOR="#0000FF"
+elif [ "$WEATHER_INT" -gt 35 ]; then
+    WEATHER_COLOR="#FF0000"
+else
+    WEATHER_INT=$(( WEATHER_INT + 11 )) 
+    WEATHER_COLOR="${temps[$WEATHER_INT]}"
+fi
+
+full_text="${WEATHER_ICON}  ${WEATHER_TEMP}°C: ${DESCRIPTION} "
+if [ "$WEATHER_ALERT" != "null" ]; then
+    WARN_START=$(echo "$WEATHER_RESPONSE" | jq '.alerts[0].start')
+    WARN_END=$(echo "$WEATHER_RESPONSE" | jq '.alerts[0].end')
+    WARN_START=$(date -d @"$WARN_START" +%a_%k:%M)
+    WARN_END=$(date -d @"$WARN_END" +%a_%k:%M)
+    full_text="${WEATHER_ICON}  ${WEATHER_TEMP}°C: ${DESCRIPTION}  ${WEATHER_ALERT} from ${WARN_START} to ${WARN_END}  "
+fi
+
+
+echo "${full_text}"
+echo "${WEATHER_TEMP}°C "
+echo "${WEATHER_COLOR}"

+ 5 - 0
i3/.config/i3/scripts/openweather.conf

@@ -0,0 +1,5 @@
+# Weather
+[Weather]
+command=~/.config/i3/scripts/openweather
+interval=1800
+color=#7275b3

+ 184 - 0
i3/.config/i3/scripts/power-profiles

@@ -0,0 +1,184 @@
+#!/usr/bin/env bash
+#
+# Use rofi/zenity to change system runstate thanks to systemd.
+#
+# Note: this currently relies on associative array support in the shell.
+#
+# Inspired from i3pystatus wiki:
+# https://github.com/enkore/i3pystatus/wiki/Shutdown-Menu
+#
+# Copyright 2015 Benjamin Chrétien <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/>.
+
+#######################################################################
+#                            BEGIN CONFIG                             #
+#######################################################################
+
+# Use a custom lock script
+#LOCKSCRIPT="i3lock-extra -m pixelize"
+
+# Colors: FG (foreground), BG (background), HL (highlighted)
+FG_COLOR="#bbbbbb"
+BG_COLOR="#111111"
+HLFG_COLOR="#111111"
+HLBG_COLOR="#bbbbbb"
+BORDER_COLOR="#222222"
+
+# Options not related to colors
+#ROFI_TEXT=":"
+#ROFI_OPTIONS=(-width -11 -location 0 -hide-scrollbar -bw 30 -color-window "#dd310027,#dd0310027,#dd310027" -padding 5)
+#ROFI_OPTIONS=(-width -18 -location 4 -hide-scrollbar -color-window "#cc310027,#00a0009a,#cc310027" -padding 5 -font "Sourcecode Pro Regular 10, FontAwesome 9")
+ROFI_OPTIONS=(-theme ~/.config/rofi/power-profiles.rasi)
+# Zenity options
+ZENITY_TITLE="Power Profiles"
+ZENITY_TEXT="Set Profiles:"
+ZENITY_OPTIONS=(--column= --hide-header)
+
+#######################################################################
+#                             END CONFIG                              #
+#######################################################################
+
+# Whether to ask for user's confirmation
+enable_confirmation=false
+
+# Preferred launcher if both are available
+preferred_launcher="rofi"
+
+usage="$(basename "$0") [-h] [-c] [-p name] -- display a menu for shutdown, reboot, lock etc.
+
+where:
+    -h  show this help text
+    -c  ask for user confirmation
+    -p  preferred launcher (rofi or zenity)
+
+This script depends on:
+  - systemd,
+  - i3,
+  - rofi or zenity."
+
+# Check whether the user-defined launcher is valid
+launcher_list=(rofi zenity)
+function check_launcher() {
+  if [[ ! "${launcher_list[@]}" =~ (^|[[:space:]])"$1"($|[[:space:]]) ]]; then
+    echo "Supported launchers: ${launcher_list[*]}"
+    exit 1
+  else
+    # Get array with unique elements and preferred launcher first
+    # Note: uniq expects a sorted list, so we cannot use it
+    i=1
+    launcher_list=($(for l in "$1" "${launcher_list[@]}"; do printf "%i %s\n" "$i" "$l"; let i+=1; done \
+      | sort -uk2 | sort -nk1 | cut -d' ' -f2- | tr '\n' ' '))
+  fi
+}
+
+# Parse CLI arguments
+while getopts "hcp:" option; do
+  case "${option}" in
+    h) echo "${usage}"
+       exit 0
+       ;;
+    c) enable_confirmation=true
+       ;;
+    p) preferred_launcher="${OPTARG}"
+       check_launcher "${preferred_launcher}"
+       ;;
+    *) exit 1
+       ;;
+  esac
+done
+
+# Check whether a command exists
+function command_exists() {
+  command -v "$1" &> /dev/null 2>&1
+}
+
+# systemctl required
+if ! command_exists systemctl ; then
+  exit 1
+fi
+
+# menu defined as an associative array
+typeset -A menu
+
+# Menu with keys/commands
+
+menu=(
+  [ Performance]="powerprofilesctl set performance"
+  [ Balanced]="powerprofilesctl set balanced"
+  [ Power Saver]="powerprofilesctl set power-saver"
+  [ Cancel]=""
+)
+
+menu_nrows=${#menu[@]}
+
+# Menu entries that may trigger a confirmation message
+menu_confirm="Shutdown Reboot Hibernate Suspend Halt Logout"
+
+launcher_exe=""
+launcher_options=""
+rofi_colors=""
+
+function prepare_launcher() {
+  if [[ "$1" == "rofi" ]]; then
+    rofi_colors=(-bc "${BORDER_COLOR}" -bg "${BG_COLOR}" -fg "${FG_COLOR}" \
+        -hlfg "${HLFG_COLOR}" -hlbg "${HLBG_COLOR}")
+    launcher_exe="rofi"
+    launcher_options=(-dmenu -i -lines "${menu_nrows}" -p "${ROFI_TEXT}" \
+        "${rofi_colors}" "${ROFI_OPTIONS[@]}")
+  elif [[ "$1" == "zenity" ]]; then
+    launcher_exe="zenity"
+    launcher_options=(--list --title="${ZENITY_TITLE}" --text="${ZENITY_TEXT}" \
+        "${ZENITY_OPTIONS[@]}")
+  fi
+}
+
+for l in "${launcher_list[@]}"; do
+  if command_exists "${l}" ; then
+    prepare_launcher "${l}"
+    break
+  fi
+done
+
+# No launcher available
+if [[ -z "${launcher_exe}" ]]; then
+  exit 1
+fi
+
+launcher=(${launcher_exe} "${launcher_options[@]}")
+selection="$(printf '%s\n' "${!menu[@]}" | sort | "${launcher[@]}")"
+
+function ask_confirmation() {
+  if [ "${launcher_exe}" == "rofi" ]; then
+    confirmed=$(echo -e "Yes\nNo" | rofi -dmenu -i -lines 2 -p "${selection}?" \
+      "${rofi_colors}" "${ROFI_OPTIONS[@]}")
+    [ "${confirmed}" == "Yes" ] && confirmed=0
+  elif [ "${launcher_exe}" == "zenity" ]; then
+    zenity --question --text "Are you sure you want to ${selection,,}?"
+    confirmed=$?
+  fi
+
+  if [ "${confirmed}" == 0 ]; then
+    i3-msg -q "exec ${menu[${selection}]}"
+  fi
+}
+
+if [[ $? -eq 0 && ! -z ${selection} ]]; then
+  if [[ "${enable_confirmation}" = true && \
+        ${menu_confirm} =~ (^|[[:space:]])"${selection}"($|[[:space:]]) ]]; then
+    ask_confirmation
+  else
+    i3-msg -q "exec ${menu[${selection}]}"
+  fi
+fi

+ 186 - 0
i3/.config/i3/scripts/powermenu

@@ -0,0 +1,186 @@
+#!/usr/bin/env bash
+#
+# Use rofi/zenity to change system runstate thanks to systemd.
+#
+# Note: this currently relies on associative array support in the shell.
+#
+# Inspired from i3pystatus wiki:
+# https://github.com/enkore/i3pystatus/wiki/Shutdown-Menu
+#
+# Copyright 2015 Benjamin Chrétien <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/>.
+
+# modified to work with latest rofi update by joekamprad <joekamprad@endeavouros.com>
+
+#######################################################################
+#                            BEGIN CONFIG                             #
+#######################################################################
+
+# Use a custom lock script
+#LOCKSCRIPT="i3lock-extra -m pixelize"
+
+# Colors: FG (foreground), BG (background), HL (highlighted)
+FG_COLOR="#bbbbbb"
+BG_COLOR="#111111"
+HLFG_COLOR="#111111"
+HLBG_COLOR="#bbbbbb"
+BORDER_COLOR="#222222"
+
+# Options not related to colors (most rofi options do not work anymore)
+ROFI_OPTIONS=(-theme ~/.config/rofi/powermenu.rasi)
+# Zenity options
+ZENITY_TITLE="Power Menu"
+ZENITY_TEXT="Action:"
+ZENITY_OPTIONS=(--column= --hide-header)
+
+#######################################################################
+#                             END CONFIG                              #
+#######################################################################
+
+# Whether to ask for user's confirmation
+enable_confirmation=false
+
+# Preferred launcher if both are available
+preferred_launcher="rofi"
+
+usage="$(basename "$0") [-h] [-c] [-p name] -- display a menu for shutdown, reboot, lock etc.
+
+where:
+    -h  show this help text
+    -c  ask for user confirmation
+    -p  preferred launcher (rofi or zenity)
+
+This script depends on:
+  - systemd,
+  - i3,
+  - rofi or zenity."
+
+# Check whether the user-defined launcher is valid
+launcher_list=(rofi zenity)
+function check_launcher() {
+  if [[ ! "${launcher_list[@]}" =~ (^|[[:space:]])"$1"($|[[:space:]]) ]]; then
+    echo "Supported launchers: ${launcher_list[*]}"
+    exit 1
+  else
+    # Get array with unique elements and preferred launcher first
+    # Note: uniq expects a sorted list, so we cannot use it
+    i=1
+    launcher_list=($(for l in "$1" "${launcher_list[@]}"; do printf "%i %s\n" "$i" "$l"; let i+=1; done \
+      | sort -uk2 | sort -nk1 | cut -d' ' -f2- | tr '\n' ' '))
+  fi
+}
+
+# Parse CLI arguments
+while getopts "hcp:" option; do
+  case "${option}" in
+    h) echo "${usage}"
+       exit 0
+       ;;
+    c) enable_confirmation=true
+       ;;
+    p) preferred_launcher="${OPTARG}"
+       check_launcher "${preferred_launcher}"
+       ;;
+    *) exit 1
+       ;;
+  esac
+done
+
+# Check whether a command exists
+function command_exists() {
+  command -v "$1" &> /dev/null 2>&1
+}
+
+# systemctl required
+if ! command_exists systemctl ; then
+  exit 1
+fi
+
+# menu defined as an associative array
+typeset -A menu
+
+# Menu with keys/commands
+
+menu=(
+  [ Shutdown]="systemctl poweroff"
+  [ Reboot]="systemctl reboot"
+  [ Suspend]="systemctl suspend"
+  [ Hibernate]="systemctl hibernate"
+  [ Lock]="~/.config/i3/scripts/blur-lock"
+  [ Logout]="i3-msg exit"
+  [ Cancel]=""
+)
+
+menu_nrows=${#menu[@]}
+
+# Menu entries that may trigger a confirmation message
+menu_confirm="Shutdown Reboot Hibernate Suspend Halt Logout"
+
+launcher_exe=""
+launcher_options=""
+rofi_colors=""
+
+function prepare_launcher() {
+  if [[ "$1" == "rofi" ]]; then
+    rofi_colors=(-bc "${BORDER_COLOR}" -bg "${BG_COLOR}" -fg "${FG_COLOR}" \
+        -hlfg "${HLFG_COLOR}" -hlbg "${HLBG_COLOR}")
+    launcher_exe="rofi"
+    launcher_options=(-dmenu -i -lines "${menu_nrows}" -p "${ROFI_TEXT}" \
+        "${rofi_colors}" "${ROFI_OPTIONS[@]}")
+  elif [[ "$1" == "zenity" ]]; then
+    launcher_exe="zenity"
+    launcher_options=(--list --title="${ZENITY_TITLE}" --text="${ZENITY_TEXT}" \
+        "${ZENITY_OPTIONS[@]}")
+  fi
+}
+
+for l in "${launcher_list[@]}"; do
+  if command_exists "${l}" ; then
+    prepare_launcher "${l}"
+    break
+  fi
+done
+
+# No launcher available
+if [[ -z "${launcher_exe}" ]]; then
+  exit 1
+fi
+
+launcher=(${launcher_exe} "${launcher_options[@]}")
+selection="$(printf '%s\n' "${!menu[@]}" | sort | "${launcher[@]}")"
+
+function ask_confirmation() {
+  if [ "${launcher_exe}" == "rofi" ]; then
+    confirmed=$(echo -e "Yes\nNo" | rofi -dmenu -i -lines 2 -p "${selection}?" \
+      "${rofi_colors}" "${ROFI_OPTIONS[@]}")
+    [ "${confirmed}" == "Yes" ] && confirmed=0
+  elif [ "${launcher_exe}" == "zenity" ]; then
+    zenity --question --text "Are you sure you want to ${selection,,}?"
+    confirmed=$?
+  fi
+
+  if [ "${confirmed}" == 0 ]; then
+    i3-msg -q "exec ${menu[${selection}]}"
+  fi
+}
+
+if [[ $? -eq 0 && ! -z ${selection} ]]; then
+  if [[ "${enable_confirmation}" = true && \
+        ${menu_confirm} =~ (^|[[:space:]])"${selection}"($|[[:space:]]) ]]; then
+    ask_confirmation
+  else
+    i3-msg -q "exec ${menu[${selection}]}"
+  fi
+fi

+ 7 - 0
i3/.config/i3/scripts/ppd-status

@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+#
+
+#A script to show current power profile
+
+current_profile=$(/usr/bin/powerprofilesctl get)
+echo "$current_profile"

+ 86 - 0
i3/.config/i3/scripts/temperature

@@ -0,0 +1,86 @@
+#!/usr/bin/env 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/>.
+#
+# Edited by Andreas Lindlbauer <endeavouros.mousily@aleeas.com>
+
+use strict;
+use warnings;
+use utf8;
+use Getopt::Long;
+
+binmode(STDOUT, ":utf8");
+
+# default values
+my $t_warn = $ENV{T_WARN} || 70;
+my $t_crit = $ENV{T_CRIT} || 90;
+my $chip = $ENV{SENSOR_CHIP} || "";
+my $temperature = -9999;
+my $label = "😀 ";
+
+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';
+
+if ($temperature < 45) {
+  $label = '';
+} elsif ($temperature < 55) {
+  $label = '';
+} elsif ($temperature < 65) {
+  $label = '';
+} elsif ($temperature < 75) {
+  $label = '';
+} else {
+  $label = '';
+}
+# Print short_text, full_text
+print "${label}";
+print " $temperature°C\n";
+print "${label}";
+print " $temperature°C\n";
+
+# Print color, if needed
+if ($temperature >= $t_crit) {
+    print "#FF0000\n";
+    exit 33;
+} elsif ($temperature >= $t_warn) {
+    print "#FFFC00\n";
+}
+
+exit 0;

+ 83 - 0
i3/.config/i3/scripts/volume

@@ -0,0 +1,83 @@
+#!/usr/bin/env 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, eventually 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
+if [[ -z "$MIXER" ]] ; then
+    MIXER="pulse"
+    if command -v pulseaudio >/dev/null 2>&1 && pulseaudio --check ; then
+        # pulseaudio is running, but not all installations use "pulse"
+        if amixer -D pulse info >/dev/null 2>&1 ; then
+            MIXER="pulse"
+        fi
+    fi
+    [ -n "$(lsmod | grep jack)" ] && MIXER="jackplug"
+    MIXER="${2:-$MIXER}"
+fi
+
+# 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`
+if [[ -z "$SCONTROL" ]] ; then
+    SCONTROL="${BLOCK_INSTANCE:-$(amixer -D $MIXER scontrols |
+                      sed -n "s/Simple mixer control '\([^']*\)',0/\1/p" |
+                      head -n1
+                    )}"
+fi
+
+# 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)
+if [[ -z "$STEP" ]] ; then
+    STEP="${1:-5%}"
+fi
+
+#------------------------------------------------------------------------
+
+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}'
+  output=$(perl -ne "$perl_filter")
+  echo "$LABEL$output"
+}
+
+#------------------------------------------------------------------------
+
+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

+ 25 - 0
i3/.config/i3/scripts/vpn

@@ -0,0 +1,25 @@
+#!/usr/bin/env bash
+#
+# Copyright (C) 2021 Andreas Lindlbauer
+# Licensed under the terms of EUPLv1.2.
+#
+# i3blocks blocklet script to monitor the (nord)vpn connection
+
+vpnstatus="📢"
+nordvpn_output=$(nordvpn status | cat -v | head -1 | sed -e 's/\^M-^M  ^M//g' )
+if [ "${nordvpn_output}" = "Status: Connected" ]; then
+    vpnstatus="🥸"
+elif [ "${nordvpn_output}" = "A new version of NordVPN is available! Please update the application." ]; then
+    nordvpn_output=$(nordvpn status | cat -v | head -2 | tail -1 | sed -e 's/\^M-^M  ^M//g' )
+    if [ "${nordvpn_output}" = "Status: Connected" ]; then
+        vpnstatus="🥴"
+    elif [ "${nordvpn_output}" = "Status: Disconnected" ]; then
+        vpnstatus="📢"
+    fi
+elif [ "${nordvpn_output}" = "Status: Disconnected" ]; then
+    vpnstatus="📢"
+elif [[ "$nordvpn_output" == *\/* ]] || [[ "$nordvpn_output" == *\\* ]]; then
+    vpnstatus="Something's very wrong"
+fi
+
+echo "$vpnstatus"