mirror of
https://github.com/dnlbauer/dotfiles.git
synced 2026-09-10 13:35:30 +00:00
reorganize dotfiles
This commit is contained in:
6
profiles/i3/.config/i3/autoxrandr
Executable file
6
profiles/i3/.config/i3/autoxrandr
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
for output in $(xrandr | grep '\Wconnected' | awk '{ print $1 }'); do
|
||||
if [[ $output =~ ^eDP.*$ ]]; then
|
||||
xrandr --dpi 150
|
||||
fi
|
||||
done
|
||||
240
profiles/i3/.config/i3/config
Normal file
240
profiles/i3/.config/i3/config
Normal file
@@ -0,0 +1,240 @@
|
||||
# This file has been auto-generated by i3-config-wizard(1).
|
||||
# It will not be overwritten, so edit it as you like.
|
||||
#
|
||||
# Should you change your keyboard layout somewhen, delete
|
||||
# this file and re-run i3-config-wizard(1).
|
||||
#
|
||||
|
||||
# i3 config file (v4)
|
||||
#
|
||||
# Please see http://i3wm.org/docs/userguide.html for a complete reference!
|
||||
# exec xrandr --auto --output DP-4 --right-of HDMI-0 --primary --dpi 150
|
||||
exec --no-startup-id ~/.config/i3/xrandr.sh
|
||||
|
||||
|
||||
set $mod Mod4
|
||||
|
||||
# Font for window titles. Will also be used by the bar unless a different font
|
||||
# is used in the bar {} block below. ISO 10646 = Unicode
|
||||
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
||||
# The font above is very space-efficient, that is, it looks good, sharp and
|
||||
# clear in small sizes. However, if you need a lot of unicode glyphs or
|
||||
# right-to-left text rendering, you should instead use pango for rendering and
|
||||
# chose a FreeType font, such as:
|
||||
font pango:Source Code Pro for Powerline, FontAwesome Regular, Icons 12.5
|
||||
|
||||
new_window 1pixel
|
||||
|
||||
# Use Mouse+$mod to drag floating windows to their wanted position
|
||||
floating_modifier $mod
|
||||
|
||||
# start a terminal
|
||||
bindsym $mod+Return exec i3-sensible-terminal
|
||||
|
||||
# kill focused window
|
||||
bindsym $mod+Shift+q kill
|
||||
|
||||
# start dmenu (a program launcher)
|
||||
#bindsym $mod+d exec dmenu_run
|
||||
|
||||
# rofi
|
||||
bindsym $mod+Tab exec rofi -show window
|
||||
bindsym $mod+d exec "rofi -show combi -combi-modi window,drun"
|
||||
|
||||
|
||||
# There also is the (new) i3-dmenu-desktop which only displays applications
|
||||
# shipping a .desktop file. It is a wrapper around dmenu, so you need that
|
||||
# installed.
|
||||
# bindsym $mod+d exec --no-startup-id i3-dmenu-desktop
|
||||
|
||||
# change focus
|
||||
bindsym $mod+j focus left
|
||||
bindsym $mod+k focus down
|
||||
bindsym $mod+l focus up
|
||||
bindsym $mod+semicolon focus right
|
||||
|
||||
# alternatively, you can use the cursor keys:
|
||||
bindsym $mod+Left focus left
|
||||
bindsym $mod+Down focus down
|
||||
bindsym $mod+Up focus up
|
||||
bindsym $mod+Right focus right
|
||||
|
||||
# move focused window
|
||||
bindsym $mod+Shift+j move left
|
||||
bindsym $mod+Shift+k move down
|
||||
bindsym $mod+Shift+l move up
|
||||
bindsym $mod+Shift+colon move right
|
||||
|
||||
# alternatively, you can use the cursor keys:
|
||||
bindsym $mod+Shift+Left move left
|
||||
bindsym $mod+Shift+Down move down
|
||||
bindsym $mod+Shift+Up move up
|
||||
bindsym $mod+Shift+Right move right
|
||||
|
||||
# move workspace left/right
|
||||
bindsym $mod+Shift+greater move workspace to output left
|
||||
bindsym $mod+Shift+less move workspace to output right
|
||||
|
||||
# split in horizontal orientation
|
||||
bindsym $mod+h split h
|
||||
|
||||
# split in vertical orientation
|
||||
bindsym $mod+v split v
|
||||
|
||||
# enter fullscreen mode for the focused container
|
||||
bindsym $mod+f fullscreen
|
||||
|
||||
# change container layout (stacked, tabbed, toggle split)
|
||||
bindsym $mod+s layout stacking
|
||||
bindsym $mod+w layout tabbed
|
||||
bindsym $mod+e layout toggle split
|
||||
|
||||
# toggle tiling / floating
|
||||
bindsym $mod+Shift+space floating toggle
|
||||
|
||||
# change focus between tiling / floating windows
|
||||
bindsym $mod+space focus mode_toggle
|
||||
|
||||
# focus the parent container
|
||||
bindsym $mod+a focus parent
|
||||
|
||||
# focus the child container
|
||||
#bindsym $mod+d focus child
|
||||
|
||||
set $workspace1 1
|
||||
set $workspace2 2
|
||||
set $workspace3 3
|
||||
set $workspace4 4
|
||||
set $workspace5 5
|
||||
set $workspace6 6
|
||||
set $workspace7 7
|
||||
#
|
||||
set $workspace8 8
|
||||
#
|
||||
set $workspace9 9
|
||||
#
|
||||
|
||||
# switch to workspace
|
||||
bindsym $mod+1 workspace $workspace1
|
||||
bindsym $mod+2 workspace $workspace2
|
||||
bindsym $mod+3 workspace $workspace3
|
||||
bindsym $mod+4 workspace $workspace4
|
||||
bindsym $mod+5 workspace $workspace5
|
||||
bindsym $mod+6 workspace $workspace6
|
||||
bindsym $mod+7 workspace $workspace7
|
||||
bindsym $mod+8 workspace $workspace8
|
||||
bindsym $mod+9 workspace $workspace9
|
||||
|
||||
# move focused container to workspace
|
||||
bindsym $mod+Shift+1 move container to workspace $workspace1
|
||||
bindsym $mod+Shift+2 move container to workspace $workspace2
|
||||
bindsym $mod+Shift+3 move container to workspace $workspace3
|
||||
bindsym $mod+Shift+4 move container to workspace $workspace4
|
||||
bindsym $mod+Shift+5 move container to workspace $workspace5
|
||||
bindsym $mod+Shift+6 move container to workspace $workspace6
|
||||
bindsym $mod+Shift+7 move container to workspace $workspace7
|
||||
bindsym $mod+Shift+8 move container to workspace $workspace8
|
||||
bindsym $mod+Shift+9 move container to workspace $workspace9
|
||||
|
||||
# reload the configuration file
|
||||
bindsym $mod+Shift+c reload
|
||||
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
|
||||
bindsym $mod+Shift+r restart
|
||||
# exit i3 (logs you out of your X session)
|
||||
bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'"
|
||||
|
||||
# resize window (you can also use the mouse for that)
|
||||
mode "resize" {
|
||||
# These bindings trigger as soon as you enter the resize mode
|
||||
|
||||
# Pressing left will shrink the window’s width.
|
||||
# Pressing right will grow the window’s width.
|
||||
# Pressing up will shrink the window’s height.
|
||||
# Pressing down will grow the window’s height.
|
||||
bindsym j resize shrink width 10 px or 10 ppt
|
||||
bindsym k resize grow height 10 px or 10 ppt
|
||||
bindsym l resize shrink height 10 px or 10 ppt
|
||||
bindsym semicolon resize grow width 10 px or 10 ppt
|
||||
|
||||
# same bindings, but for the arrow keys
|
||||
bindsym Left resize shrink width 10 px or 10 ppt
|
||||
bindsym Down resize grow height 10 px or 10 ppt
|
||||
bindsym Up resize shrink height 10 px or 10 ppt
|
||||
bindsym Right resize grow width 10 px or 10 ppt
|
||||
|
||||
# back to normal: Enter or Escape
|
||||
bindsym Return mode "default"
|
||||
bindsym Escape mode "default"
|
||||
}
|
||||
|
||||
bindsym $mod+r mode "resize"
|
||||
|
||||
# Start i3bar to display a workspace bar (plus the system information i3status
|
||||
# finds out, if available)
|
||||
#bar {
|
||||
# position top
|
||||
# status_command i3blocks -c ~/.i3/i3blocks.conf
|
||||
#}
|
||||
|
||||
|
||||
# hide window border
|
||||
new_window 1pixel
|
||||
|
||||
exec_always --no-startup-id ~/.config/polybar/polybar.sh
|
||||
|
||||
workspace $workspace7 output DP-0
|
||||
workspace $workspace8 output DP-0
|
||||
workspace $workspace9 output DP-0
|
||||
|
||||
for_window [window_role="pop-up"] floating enable
|
||||
for_window [class="Tk"] floating enable
|
||||
for_window [title="PyMOL Viewer"] floating enable
|
||||
for_window [class="Toplevel"] floating enable
|
||||
for_window [title="VMD*"] floating enable
|
||||
for_window [title="Area per Lipid*"] floating enable
|
||||
for_window [title="MEMBPLUGIN"] floating enable
|
||||
for_window [title="Figure*"] floating enable
|
||||
for_window [window_role="conversation" class="Pidgin"] floating enable
|
||||
for_window [class="Spotify"] move to workspace $workspace8
|
||||
assign [class="Thunderbird"] → $workspace9
|
||||
assign [class="Mendeley"] → $workspace7
|
||||
#assign [class="Spotify"] → $workspace8
|
||||
assign [title="Buddy List"] → $workspace9
|
||||
exec --no-startup-id thunderbird
|
||||
#exec --no-startup-id mendeleydesktop
|
||||
#exec --no-startup-id spotify
|
||||
#exec --no-startup-id pidgin
|
||||
|
||||
|
||||
|
||||
exec feh --bg-scale ~/wallpaper.jpg
|
||||
#exec volumeicon
|
||||
exec thunar --daemon
|
||||
exec --no-startup-id xautolock -time 5 -locker 'i3lock -i ~/.lockscreen/`ls /home/bauer/lockscreens | shuf -n 1` -t -f'
|
||||
|
||||
# Pulse Audio controls
|
||||
bindsym --release XF86AudioLowerVolume exec --no-startup-id amixer sset Master 5%- #decrease sound volume
|
||||
bindsym --release XF86AudioRaiseVolume exec --no-startup-id amixer sset Master 5%+ #increase sound volume
|
||||
bindsym --release XF86AudioMute exec --no-startup-id amixer sset Master toggle # mute sound
|
||||
|
||||
# Sreen brightness controls
|
||||
bindsym XF86MonBrightnessUp exec xbacklight -inc 20 # increase screen brightness
|
||||
bindsym XF86MonBrightnessDown exec xbacklight -dec 20 # decrease screen brightness
|
||||
|
||||
# Touchpad controls
|
||||
bindsym XF86TouchpadToggle exec /some/path/toggletouchpad.sh # toggle touchpad
|
||||
|
||||
# Media player controls
|
||||
bindsym XF86AudioPlay exec playerctl play-pause
|
||||
bindsym XF86AudioNext exec playerctl next
|
||||
bindsym XF86AudioPrev exec playerctl previous
|
||||
bindsym XF86HomePage exec "i3lock -i ~/lockscreens/`ls ~/lockscreens | shuf -n 1` -t -f"
|
||||
|
||||
# change ouput
|
||||
bindsym $mod+Shift+s exec --no-startup-id ~/.config/i3/scripts/change_monitor.sh
|
||||
|
||||
# reload workspace layouts
|
||||
exec --no-startup-id "i3-msg 'workspace 9; append_layout /home/bauer/.i3/workspace-9.json'"
|
||||
|
||||
exec --no-startup-id nm-applet
|
||||
exec --no-startup-id xfsettingsd
|
||||
27
profiles/i3/.config/i3/scripts/change_monitor.sh
Executable file
27
profiles/i3/.config/i3/scripts/change_monitor.sh
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
EXTERNAL_OUTPUT="HDMI2"
|
||||
INTERNAL_OUTPUT="eDP1"
|
||||
|
||||
# if we don't have a file, start at zero
|
||||
if [ ! -f "/tmp/monitor_mode.dat" ] ; then
|
||||
monitor_mode="all"
|
||||
|
||||
# otherwise read the value from the file
|
||||
else
|
||||
monitor_mode=`cat /tmp/monitor_mode.dat`
|
||||
fi
|
||||
|
||||
if [ $monitor_mode = "all" ]; then
|
||||
monitor_mode="EXTERNAL"
|
||||
xrandr --output $INTERNAL_OUTPUT --off --output $EXTERNAL_OUTPUT --auto
|
||||
elif [ $monitor_mode = "EXTERNAL" ]; then
|
||||
monitor_mode="INTERNAL"
|
||||
xrandr --output $INTERNAL_OUTPUT --auto --output $EXTERNAL_OUTPUT --off
|
||||
elif [ $monitor_mode = "INTERNAL" ]; then
|
||||
monitor_mode="CLONES"
|
||||
xrandr --output $INTERNAL_OUTPUT --auto --output $EXTERNAL_OUTPUT --auto --same-as $INTERNAL_OUTPUT
|
||||
else
|
||||
monitor_mode="all"
|
||||
xrandr --output $INTERNAL_OUTPUT --auto --output $EXTERNAL_OUTPUT --auto --right-of $INTERNAL_OUTPUT
|
||||
fi
|
||||
echo "${monitor_mode}" > /tmp/monitor_mode.dat
|
||||
60
profiles/i3/.config/i3/scripts/cpu_usage
Executable file
60
profiles/i3/.config/i3/scripts/cpu_usage
Executable file
@@ -0,0 +1,60 @@
|
||||
#!/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;
|
||||
my $decimals = 0;
|
||||
|
||||
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+$/) {
|
||||
$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 "%.${decimals}f%%\n", $cpu_usage;
|
||||
printf "%.${decimals}f%%\n", $cpu_usage;
|
||||
|
||||
# Print color, if needed
|
||||
if ($cpu_usage >= $t_crit) {
|
||||
print "#fb4934\n";
|
||||
exit 33;
|
||||
} elsif ($cpu_usage >= $t_warn) {
|
||||
print "#fabd2f\n";
|
||||
}
|
||||
|
||||
exit 0;
|
||||
|
||||
4
profiles/i3/.config/i3/scripts/current_track
Executable file
4
profiles/i3/.config/i3/scripts/current_track
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
eval $($(dirname $0)/sp eval)
|
||||
echo ${SPOTIFY_ARTIST} - ${SPOTIFY_TITLE}
|
||||
42
profiles/i3/.config/i3/scripts/disk
Executable file
42
profiles/i3/.config/i3/scripts/disk
Executable file
@@ -0,0 +1,42 @@
|
||||
#!/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="/scratch"
|
||||
ALERT_LOW="${1:-10}" # color will turn red under this value (default: 10%)
|
||||
|
||||
df -h -P "$DIR" | awk -v alert_low=$ALERT_LOW '
|
||||
/\/.*/ {
|
||||
# full text
|
||||
print $4" ("$5")"
|
||||
|
||||
# short text
|
||||
print $4
|
||||
|
||||
use=$5
|
||||
|
||||
# no need to continue parsing
|
||||
exit 0
|
||||
}
|
||||
|
||||
END {
|
||||
gsub(/%$/,"",use)
|
||||
if (100 - use < alert_low) {
|
||||
# color
|
||||
print "#FF0000"
|
||||
}
|
||||
}
|
||||
'
|
||||
|
||||
12
profiles/i3/.config/i3/scripts/exit_menu
Executable file
12
profiles/i3/.config/i3/scripts/exit_menu
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
while [ "$select" != "NO" -a "$select" != "YES" ]; do
|
||||
select=$(echo -e 'NO\nYES' | dmenu -nb '#2f343f'
|
||||
-nf '#f3f4f5'
|
||||
-sb '#9575cd'
|
||||
-sf '#f3f4f5'
|
||||
-fn '-*-*-medium-r-normal-*-*-*-*-*-*-100-*-*' -
|
||||
i -p "Are you sure you want to logout?")
|
||||
[ -z "$select" ] && exit 0
|
||||
done
|
||||
[ "$select" = "NO" ] && exit 0
|
||||
i3-msg exit
|
||||
21
profiles/i3/.config/i3/scripts/gpu
Executable file
21
profiles/i3/.config/i3/scripts/gpu
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
t_warn=50
|
||||
t_crit=70
|
||||
|
||||
GPU=$(nvidia-smi -q | grep Gpu | awk '{print $3}')
|
||||
|
||||
if [ $GPU -gt $t_crit ]
|
||||
then
|
||||
printf " %d%%" "$GPU"
|
||||
printf "\n %d%%" "$GPU"
|
||||
printf "\n#fb4934\n"
|
||||
elif [ $GPU -gt $t_warn ]
|
||||
then
|
||||
printf " %d%%" "$GPU"
|
||||
printf "\n %d%%" "$GPU"
|
||||
printf "\n#fabd2f\n"
|
||||
else
|
||||
printf " %d%%" "$GPU"
|
||||
printf "\n %d%%" "$GPU"
|
||||
fi
|
||||
1
profiles/i3/.config/i3/scripts/keyboard_layout
Executable file
1
profiles/i3/.config/i3/scripts/keyboard_layout
Executable file
@@ -0,0 +1 @@
|
||||
xkb-switch
|
||||
35
profiles/i3/.config/i3/scripts/load_average
Executable file
35
profiles/i3/.config/i3/scripts/load_average
Executable file
@@ -0,0 +1,35 @@
|
||||
#!/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;
|
||||
}
|
||||
}
|
||||
'
|
||||
|
||||
67
profiles/i3/.config/i3/scripts/memory
Executable file
67
profiles/i3/.config/i3/scripts/memory
Executable file
@@ -0,0 +1,67 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) 2014 Julien Bonjean <julien@bonjean.info>
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
TYPE="${BLOCK_INSTANCE:-mem}"
|
||||
|
||||
awk -v type=$TYPE '
|
||||
/^MemTotal:/ {
|
||||
mem_total=$2
|
||||
}
|
||||
/^MemFree:/ {
|
||||
mem_free=$2
|
||||
}
|
||||
/^Buffers:/ {
|
||||
mem_free+=$2
|
||||
}
|
||||
/^Cached:/ {
|
||||
mem_free+=$2
|
||||
}
|
||||
/^SwapTotal:/ {
|
||||
swap_total=$2
|
||||
}
|
||||
/^SwapFree:/ {
|
||||
swap_free=$2
|
||||
}
|
||||
END {
|
||||
if (type == "swap") {
|
||||
free=swap_free/1024/102
|
||||
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=used/total*100
|
||||
|
||||
# full text
|
||||
printf("%.1fG / %.1fG ( %.f%% )\n", used, total, pct)
|
||||
|
||||
# short text
|
||||
printf("%.f%%\n", pct)
|
||||
|
||||
# color
|
||||
if (pct > 90) {
|
||||
print("#E53935\n")
|
||||
|
||||
} else if (pct > 80) {
|
||||
print("#FFAE00\n")
|
||||
} else if (pct > 70) {
|
||||
print("#FFF600\n")
|
||||
}
|
||||
}
|
||||
' /proc/meminfo
|
||||
|
||||
151
profiles/i3/.config/i3/scripts/openvpn
Executable file
151
profiles/i3/.config/i3/scripts/openvpn
Executable file
@@ -0,0 +1,151 @@
|
||||
#!/usr/bin/perl
|
||||
# Made by Pierre Mavro/Deimosfr <deimos@deimos.fr>
|
||||
# Minor contribution by Thor K. H. <thor@roht.no>
|
||||
# Licensed under the terms of the GNU GPL v3, or any later version.
|
||||
# Version: 0.3
|
||||
|
||||
# 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 "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 "$names\n";
|
||||
print "$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;
|
||||
|
||||
186
profiles/i3/.config/i3/scripts/shutdown_menu
Executable file
186
profiles/i3/.config/i3/scripts/shutdown_menu
Executable file
@@ -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/>.
|
||||
|
||||
#######################################################################
|
||||
# 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="Menu:"
|
||||
ROFI_OPTIONS="-width -11 -location 3 -hide-scrollbar -bw 2"
|
||||
|
||||
# Zenity options
|
||||
ZENITY_TITLE="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"
|
||||
[Hibernate]="systemctl hibernate"
|
||||
[Suspend]="systemctl suspend"
|
||||
[Halt]="systemctl halt"
|
||||
[Lock]="${LOCKSCRIPT:-i3lock --color=${BG_COLOR#"#"}}"
|
||||
[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
|
||||
|
||||
22
profiles/i3/.config/i3/scripts/song.awk
Executable file
22
profiles/i3/.config/i3/scripts/song.awk
Executable file
@@ -0,0 +1,22 @@
|
||||
/string *"xesam:artist/{
|
||||
while (1) {
|
||||
getline line
|
||||
if (line ~ /string "/) {
|
||||
sub(/.*string "/, "artist:", line)
|
||||
sub(/".*$/, "", line)
|
||||
print line
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
/string *"xesam:title/{
|
||||
while(1) {
|
||||
getline line
|
||||
if (line ~ /string "/) {
|
||||
sub(/.*string "/, "title:", line)
|
||||
sub(/".*$/, "", line)
|
||||
print line
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
12
profiles/i3/.config/i3/scripts/spotify.py
Executable file
12
profiles/i3/.config/i3/scripts/spotify.py
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import dbus
|
||||
try:
|
||||
bus = dbus.SessionBus()
|
||||
spotify = bus.get_object("org.mpris.MediaPlayer2.spotify", "/org/mpris/MediaPlayer2")
|
||||
spotify_iface = dbus.Interface(spotify, 'org.freedesktop.DBus.Properties')
|
||||
props = spotify_iface.Get('org.mpris.MediaPlayer2.Player', 'Metadata')
|
||||
print(str(props['xesam:artist'][0]) + " - " + str(props['xesam:title']))
|
||||
exit
|
||||
except dbus.exceptions.DBusException:
|
||||
exit
|
||||
40
profiles/i3/.config/i3/scripts/spotify_control
Executable file
40
profiles/i3/.config/i3/scripts/spotify_control
Executable file
@@ -0,0 +1,40 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ $# -lt 1 ]
|
||||
then
|
||||
echo "No command?"
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ "$(pidof spotify)" = "" ]
|
||||
then
|
||||
echo "Spotify is not running"
|
||||
exit
|
||||
fi
|
||||
|
||||
case $1 in
|
||||
"play")
|
||||
dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause
|
||||
;;
|
||||
"next")
|
||||
dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next
|
||||
;;
|
||||
"prev")
|
||||
dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous
|
||||
;;
|
||||
"getTitle")
|
||||
dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata'|egrep -A 1 "title"|egrep -v "title"|cut -b 44-|cut -d '"' -f 1|egrep -v ^$
|
||||
;;
|
||||
"getArtist")
|
||||
dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata'|egrep -A 2 "artist"|egrep -v "artist"|egrep -v "array"|cut -b 27-|cut -d '"' -f 1|egrep -v ^$
|
||||
;;
|
||||
"getAlbum")
|
||||
dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata'|egrep -A 2 "album"|egrep -v "album"|egrep -v "array"|cut -b 44-|cut -d '"' -f 1|egrep -v ^$
|
||||
;;
|
||||
"getStatus")
|
||||
dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'PlaybackStatus'|grep 'string "[^"]*"'|sed 's/.*"\(.*\)"[^"]*$/\1/'
|
||||
;;
|
||||
*)
|
||||
echo "Unknown command: " $1
|
||||
;;
|
||||
esac
|
||||
40
profiles/i3/.config/i3/scripts/spotify_control.bck
Executable file
40
profiles/i3/.config/i3/scripts/spotify_control.bck
Executable file
@@ -0,0 +1,40 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ $# -lt 1 ]
|
||||
then
|
||||
echo "No command?"
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ "$(pidof spotify)" = "" ]
|
||||
then
|
||||
echo "Spotify is not running"
|
||||
exit
|
||||
fi
|
||||
|
||||
case $1 in
|
||||
"play")
|
||||
dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause
|
||||
;;
|
||||
"next")
|
||||
dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next
|
||||
;;
|
||||
"prev")
|
||||
dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous
|
||||
;;
|
||||
"getTitle")
|
||||
dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata'|egrep -A 1 "title"|egrep -v "title"|cut -b 44-|cut -d '"' -f 1|egrep -v ^$
|
||||
;;
|
||||
"getArtist")
|
||||
dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata'|egrep -A 2 "artist"|egrep -v "artist"|egrep -v "array"|cut -b 27-|cut -d '"' -f 1|egrep -v ^$
|
||||
;;
|
||||
"getAlbum")
|
||||
dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata'|egrep -A 2 "album"|egrep -v "album"|egrep -v "array"|cut -b 44-|cut -d '"' -f 1|egrep -v ^$
|
||||
;;
|
||||
"getStatus")
|
||||
dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'PlaybackStatus'|grep 'string "[^"]*"'|sed 's/.*"\(.*\)"[^"]*$/\1/'
|
||||
;;
|
||||
*)
|
||||
echo "Unknown command: " $1
|
||||
;;
|
||||
esac
|
||||
41
profiles/i3/.config/i3/scripts/ssd
Executable file
41
profiles/i3/.config/i3/scripts/ssd
Executable file
@@ -0,0 +1,41 @@
|
||||
#!/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="/"
|
||||
ALERT_LOW="${1:-10}" # color will turn red under this value (default: 10%)
|
||||
|
||||
df -h -P "$DIR" | awk -v alert_low=$ALERT_LOW '
|
||||
/\/.*/ {
|
||||
# full text
|
||||
print $4" ("$5")"
|
||||
|
||||
# short text
|
||||
print $4
|
||||
use=$5
|
||||
|
||||
# no need to continue parsing
|
||||
exit 0
|
||||
}
|
||||
|
||||
END {
|
||||
gsub(/%$/,"",use)
|
||||
if (100 - use < alert_low) {
|
||||
# color
|
||||
print "#FF0000"
|
||||
}
|
||||
}
|
||||
'
|
||||
|
||||
4
profiles/i3/.config/i3/scripts/tmux
Executable file
4
profiles/i3/.config/i3/scripts/tmux
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
tmux list-sessions | wc -l
|
||||
|
||||
46
profiles/i3/.config/i3/scripts/volume
Executable file
46
profiles/i3/.config/i3/scripts/volume
Executable file
@@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
## The sink we are interested in should be given as the
|
||||
## 1st argument to the script.
|
||||
my $sink=$ARGV[0] || die("Need a sink number as the first argument\n");
|
||||
|
||||
## If the script has been run with a second argument,
|
||||
## that argument will be the volume threshold we are checking
|
||||
my $volume_limit=$ARGV[1]||undef;
|
||||
|
||||
## Run the pactl command and save the output in
|
||||
## ther filehandle $fh
|
||||
open(my $fh, '-|', 'pactl list sinks');
|
||||
|
||||
## Set the record separator to consecutive newlines (same as -000)
|
||||
## this means we read the info for each sink as a single "line".
|
||||
$/="\n\n";
|
||||
|
||||
## Go through the pactl output
|
||||
while (<$fh>) {
|
||||
## If this is the sink we are interested in
|
||||
if (/#$sink/) {
|
||||
## Extract the current colume of this sink
|
||||
/Volume:.*?(\d+)%/;
|
||||
my $volume=$1;
|
||||
## If the script has been run with a second argument,
|
||||
## check whether the volume is above or below that
|
||||
if ($volume_limit) {
|
||||
## If the volume os greater than or equal to the
|
||||
## value passed, print "y"
|
||||
if ($volume >= $volume_limit) {
|
||||
print "y\n";
|
||||
exit 0;
|
||||
}
|
||||
else {
|
||||
print "n\n";
|
||||
exit 1;
|
||||
}
|
||||
}
|
||||
## Else, if the script has been run with just one argument,
|
||||
## print the current volume.
|
||||
else {
|
||||
print "$volume%\n";
|
||||
}
|
||||
}#
|
||||
}
|
||||
162
profiles/i3/.config/i3/scripts/volume-pulseaudio
Executable file
162
profiles/i3/.config/i3/scripts/volume-pulseaudio
Executable file
@@ -0,0 +1,162 @@
|
||||
#!/bin/bash
|
||||
# Displays the default device, volume, and mute status for i3blocks
|
||||
|
||||
AUDIO_HIGH_SYMBOL=' '
|
||||
|
||||
AUDIO_MED_THRESH=50
|
||||
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=2
|
||||
USE_PERCENT=1
|
||||
USE_ALSA_NAME=0
|
||||
USE_DESCRIPTION=0
|
||||
|
||||
SUBSCRIBE=0
|
||||
|
||||
while getopts F:Sf:padH:M:L:X:T:t:C:c:i: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" ;;
|
||||
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] [-h]
|
||||
Options:
|
||||
-F, -f\tOutput format (-F long format, -f short format) to use, amonst:
|
||||
\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
|
||||
-h\tShow this help text
|
||||
" && exit 0;;
|
||||
esac
|
||||
done
|
||||
|
||||
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 pulse sset Master toggle ;;
|
||||
3) set_default_playback_device_next -1 ;;
|
||||
4) amixer -q -D pulse sset Master $AUDIO_INTERVAL%+ ;;
|
||||
5) amixer -q -D pulse sset Master $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
|
||||
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
|
||||
71
profiles/i3/.config/i3/scripts/volume_1
Executable file
71
profiles/i3/.config/i3/scripts/volume_1
Executable file
@@ -0,0 +1,71 @@
|
||||
#!/bin/bash
|
||||
# Copyright (C) 2014 Julien Bonjean <julien@bonjean.info>
|
||||
# Copyright (C) 2014 Alexander Keller <github@nycroth.com>
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
# The second parameter overrides the mixer selection
|
||||
# For PulseAudio users, use "pulse"
|
||||
# For Jack/Jack2 users, use "jackplug"
|
||||
# For ALSA users, you may use "default" for your primary card
|
||||
# or you may use hw:# where # is the number of the card desired
|
||||
MIXER="default"
|
||||
[ -n "$(lsmod | grep pulse)" ] && MIXER="pulse"
|
||||
[ -n "$(lsmod | grep jack)" ] && MIXER="jackplug"
|
||||
MIXER="${2:-$MIXER}"
|
||||
|
||||
# The instance option sets the control to report and configure
|
||||
# This defaults to the first control of your selected mixer
|
||||
# For a list of the available, use `amixer -D $Your_Mixer scontrols`
|
||||
SCONTROL="${BLOCK_INSTANCE:-$(amixer -D $MIXER scontrols |
|
||||
sed -n "s/Simple mixer control '\([A-Za-z ]*\)',0/\1/p" |
|
||||
head -n1
|
||||
)}"
|
||||
|
||||
# The first parameter sets the step to change the volume by (and units to display)
|
||||
# This may be in in % or dB (eg. 5% or 3dB)
|
||||
STEP="${1:-5%}"
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
capability() { # Return "Capture" if the device is a capture device
|
||||
amixer -D $MIXER get $SCONTROL |
|
||||
sed -n "s/ Capabilities:.*cvolume.*/Capture/p"
|
||||
}
|
||||
|
||||
volume() {
|
||||
amixer -D $MIXER get $SCONTROL $(capability)
|
||||
}
|
||||
|
||||
format() {
|
||||
perl_filter='if (/.*\[(\d+%)\] (\[(-?\d+.\d+dB)\] )?\[(on|off)\]/)'
|
||||
perl_filter+='{CORE::say $4 eq "off" ? "0%" : "'
|
||||
# If dB was selected, print that instead
|
||||
perl_filter+=$([[ $STEP = *dB ]] && echo '$3' || echo '$1')
|
||||
perl_filter+='"; exit}'
|
||||
perl -ne "$perl_filter"
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
case $BLOCK_BUTTON in
|
||||
3) amixer -q -D $MIXER sset $SCONTROL $(capability) toggle ;; # right click, mute/unmute
|
||||
4) amixer -q -D $MIXER sset $SCONTROL $(capability) ${STEP}+ unmute ;; # scroll up, increase
|
||||
5) amixer -q -D $MIXER sset $SCONTROL $(capability) ${STEP}- unmute ;; # scroll down, decrease
|
||||
esac
|
||||
|
||||
volume | format
|
||||
|
||||
49
profiles/i3/.config/i3/workspace-9.json
Normal file
49
profiles/i3/.config/i3/workspace-9.json
Normal file
@@ -0,0 +1,49 @@
|
||||
// vim:ts=4:sw=4:et
|
||||
{
|
||||
"border": "normal",
|
||||
"current_border_width": 2,
|
||||
"floating": "auto_off",
|
||||
"geometry": {
|
||||
"height": 1029,
|
||||
"width": 1531,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"name": "Inbox - Mozilla Thunderbird",
|
||||
"percent": 0.9,
|
||||
"swallows": [
|
||||
{
|
||||
"class": "^Thunderbird$",
|
||||
"instance": "^Mail$",
|
||||
// "title": "^Inbox\\ \\-\\ daniel\\.bauer\\@headlezz\\.net\\ \\-\\ Mozilla\\ Thunderbird$",
|
||||
"transient_for": "^$",
|
||||
"window_role": "^3pane$"
|
||||
}
|
||||
],
|
||||
"type": "con"
|
||||
}
|
||||
|
||||
{
|
||||
"border": "normal",
|
||||
"current_border_width": 2,
|
||||
"floating": "auto_off",
|
||||
"geometry": {
|
||||
"height": 1029,
|
||||
"width": 381,
|
||||
"x": 1920,
|
||||
"y": 49
|
||||
},
|
||||
"name": "Buddy List",
|
||||
"percent": 0.1,
|
||||
"swallows": [
|
||||
{
|
||||
"class": "^Pidgin$",
|
||||
"instance": "^Pidgin$",
|
||||
"title": "^Buddy\\ List$",
|
||||
"transient_for": "^$",
|
||||
"window_role": "^buddy_list$"
|
||||
}
|
||||
],
|
||||
"type": "con"
|
||||
}
|
||||
|
||||
5
profiles/i3/.config/i3/xrandr.sh
Executable file
5
profiles/i3/.config/i3/xrandr.sh
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ -f ~/.screenlayout/default.sh ]; then
|
||||
bash ~/.screenlayout/default.sh
|
||||
fi
|
||||
421
profiles/i3/.config/polybar/config
Normal file
421
profiles/i3/.config/polybar/config
Normal file
@@ -0,0 +1,421 @@
|
||||
[colors]
|
||||
background = #222
|
||||
background-alt = #444
|
||||
foreground = #dfdfdf
|
||||
foreground-alt = #555
|
||||
primary = #ffb52a
|
||||
secondary = #e60053
|
||||
alert = #bd2c40
|
||||
green = #689d6a
|
||||
yellow = #fabc2f
|
||||
red = #cc241d
|
||||
|
||||
[bar/base]
|
||||
width = 900 ;100%
|
||||
height = 35
|
||||
radius = 6.0
|
||||
fixed-center = false
|
||||
background = ${colors.background}
|
||||
foreground = ${colors.foreground}
|
||||
line-size = 3
|
||||
line-color = #f00
|
||||
border-size = 0
|
||||
border-color = #00000000
|
||||
padding-left = 0
|
||||
padding-right = 2
|
||||
module-margin-left = 1
|
||||
module-margin-right = 3
|
||||
|
||||
wm-restack = i3
|
||||
;override-redirect = true
|
||||
scroll-up = i3wm-wsnext
|
||||
scroll-down = i3wm-wsprev
|
||||
|
||||
|
||||
[bar/laptop]
|
||||
monitor = ${env:MONITOR:eDP-1}
|
||||
inherit = bar/base
|
||||
tray-position = right
|
||||
fixed-center = true
|
||||
tray-padding = 2
|
||||
modules-left = i3 xwindow
|
||||
modules-right = spotify volume cpu memory battery1 date
|
||||
|
||||
font-0 = "Noto Sans:size=14:style=Regular;1"
|
||||
font-1 = unifont:fontformat=truetype:size=14:antialias=false;0
|
||||
font-2 = FontAwesome:size=14;0
|
||||
|
||||
[bar/laptop_station]
|
||||
inherit = bar/laptop
|
||||
monitor = ${env:MONITOR:HDMI-2}
|
||||
[bar/workstation]
|
||||
inherit = bar/base
|
||||
monitor = ${env:MONITOR:DP-2}
|
||||
modules-left = i3 xwindow
|
||||
modules-right = spotify mpd volume filesystem cpu gpu memory date
|
||||
tray-position = right
|
||||
tray-padding = 2
|
||||
|
||||
font-0 = "Noto Sans:size=11:style=Regular;1"
|
||||
font-1 = unifont:fontformat=truetype:size=11:antialias=false;0
|
||||
font-2 = FontAwesome:size=11;0
|
||||
|
||||
[bar/workstation2]
|
||||
inherit = bar/workstation
|
||||
monitor = ${env:MONITOR:DP-4}
|
||||
tray-position = false
|
||||
|
||||
|
||||
[module/xwindow]
|
||||
type = internal/xwindow
|
||||
label = "> %title:0:75:...%"
|
||||
|
||||
|
||||
[module/xkeyboard]
|
||||
type = internal/xkeyboard
|
||||
blacklist-0 = num lock
|
||||
|
||||
format-prefix = " "
|
||||
format-prefix-foreground = ${colors.foreground-alt}
|
||||
format-prefix-underline = ${colors.secondary}
|
||||
|
||||
label-layout = %layout%
|
||||
label-layout-underline = ${colors.secondary}
|
||||
|
||||
label-indicator-padding = 2
|
||||
label-indicator-margin = 1
|
||||
label-indicator-background = ${colors.secondary}
|
||||
label-indicator-underline = ${colors.secondary}
|
||||
|
||||
[module/filesystem]
|
||||
type = internal/fs
|
||||
interval = 25
|
||||
|
||||
mount-0 = /
|
||||
mount-1 = /scratch
|
||||
mount-2 = /scratch2
|
||||
|
||||
label-mounted = %{F#0a81f5}%mountpoint%%{F-}: %percentage_used%%
|
||||
label-unmounted = %mountpoint% not mounted
|
||||
label-unmounted-foreground = ${colors.foreground-alt}
|
||||
|
||||
[module/bspwm]
|
||||
type = internal/bspwm
|
||||
|
||||
label-focused = %index%
|
||||
label-focused-background = ${colors.background-alt}
|
||||
label-focused-underline= ${colors.primary}
|
||||
label-focused-padding = 2
|
||||
|
||||
label-occupied = %index%
|
||||
label-occupied-padding = 2
|
||||
|
||||
label-urgent = %index%!
|
||||
label-urgent-background = ${colors.alert}
|
||||
label-urgent-padding = 2
|
||||
|
||||
label-empty = %index%
|
||||
label-empty-foreground = ${colors.foreground-alt}
|
||||
label-empty-padding = 2
|
||||
|
||||
[module/i3]
|
||||
type = internal/i3
|
||||
format = <label-state> <label-mode>
|
||||
index-sort = true
|
||||
wrapping-scroll = false
|
||||
strip-wsnumbers = true
|
||||
pin-workspaces = true
|
||||
|
||||
label-mode-padding = 2
|
||||
label-mode-foreground = #000
|
||||
label-mode-background = ${colors.primary}
|
||||
|
||||
label-focused = %icon%
|
||||
label-focused-background = ${colors.green}
|
||||
label-focused-underline = ${colors.green}
|
||||
label-focused-padding = ${module/bspwm.label-focused-padding}
|
||||
|
||||
label-unfocused = %icon%
|
||||
label-unfocused-padding = ${module/bspwm.label-occupied-padding}
|
||||
|
||||
label-urgent = %icon%
|
||||
label-urgent-background = ${colors.red}
|
||||
label-urgent-underline = ${colors.red}
|
||||
label-urgent-padding = ${module/bspwm.label-urgent-padding}
|
||||
|
||||
label-visible = %icon%
|
||||
label-visible-background = ${self.label-focused-background}
|
||||
label-visible-underline = ${self.label-focused-underline}
|
||||
label-visible-padding = ${self.label-focused-padding}
|
||||
ws-icon-0 = 1;1
|
||||
ws-icon-1 = 2;2
|
||||
ws-icon-2 = 3;3
|
||||
ws-icon-3 = 4;4
|
||||
ws-icon-4 = 5;5
|
||||
ws-icon-5 = 6;6
|
||||
ws-icon-6 = 7;
|
||||
ws-icon-7 = 8;
|
||||
ws-icon-8 = 9;
|
||||
|
||||
[module/mpd]
|
||||
type = internal/mpd
|
||||
format-online = <label-song> <icon-prev> <icon-stop> <toggle> <icon-next>
|
||||
|
||||
icon-prev =
|
||||
icon-stop =
|
||||
icon-play =
|
||||
icon-pause =
|
||||
icon-next =
|
||||
|
||||
label-song-maxlen = 25
|
||||
label-song-ellipsis = true
|
||||
|
||||
[module/xbacklight]
|
||||
type = internal/xbacklight
|
||||
|
||||
format = <label> <bar>
|
||||
label = BL
|
||||
|
||||
bar-width = 10
|
||||
bar-indicator = |
|
||||
bar-indicator-foreground = #ff
|
||||
bar-indicator-font = 2
|
||||
bar-fill = ─
|
||||
bar-fill-font = 2
|
||||
bar-fill-foreground = #9f78e1
|
||||
bar-empty = ─
|
||||
bar-empty-font = 2
|
||||
bar-empty-foreground = ${colors.foreground-alt}
|
||||
|
||||
[module/backlight-acpi]
|
||||
inherit = module/xbacklight
|
||||
type = internal/backlight
|
||||
card = intel_backlight
|
||||
|
||||
[module/cpu]
|
||||
type = internal/cpu
|
||||
interval = 0.5
|
||||
format = <label> <ramp-coreload>
|
||||
label = CPU
|
||||
ramp-font = 2
|
||||
ramp-coreload-0 = ▁
|
||||
ramp-coreload-font = 3
|
||||
ramp-coreload-0-foreground = ${colors.green}
|
||||
ramp-coreload-1 = ▂
|
||||
ramp-coreload-1-font = 2
|
||||
ramp-coreload-1-foreground = ${colors.green}
|
||||
ramp-coreload-2 = ▃
|
||||
ramp-coreload-2-font = 2
|
||||
ramp-coreload-2-foreground = ${colors.green}
|
||||
ramp-coreload-3 = ▄
|
||||
ramp-coreload-3-font = 2
|
||||
ramp-coreload-3-foreground = ${colors.green}
|
||||
ramp-coreload-4 = ▅
|
||||
ramp-coreload-4-font = 2
|
||||
ramp-coreload-4-foreground = ${colors.yellow}
|
||||
ramp-coreload-5 = ▆
|
||||
ramp-coreload-5-font = 2
|
||||
ramp-coreload-5-foreground = ${colors.yellow}
|
||||
ramp-coreload-6 = ▇
|
||||
ramp-coreload-6-font = 2
|
||||
ramp-coreload-6-foreground = ${colors.red}
|
||||
ramp-coreload-7 = █
|
||||
ramp-coreload-7-font = 2
|
||||
ramp-coreload-7-foreground = ${colors.red}
|
||||
|
||||
|
||||
|
||||
[module/memory]
|
||||
type = internal/memory
|
||||
format = <label> <bar-used>
|
||||
label = MEM
|
||||
|
||||
bar-used-indicator =
|
||||
bar-used-width = 20
|
||||
bar-used-foreground-0 = ${colors.green}
|
||||
bar-used-foreground-1 = ${colors.yellow}
|
||||
bar-used-foreground-2 = ${colors.red}
|
||||
bar-used-fill = ▐
|
||||
bar-used-empty = ▐
|
||||
bar-used-empty-foreground = #444444
|
||||
|
||||
[module/wlan]
|
||||
type = internal/network
|
||||
interface =
|
||||
interval = 3.0
|
||||
|
||||
format-connected = <ramp-signal> <label-connected>
|
||||
format-connected-underline = #9f78e1
|
||||
label-connected = %essid%
|
||||
|
||||
format-disconnected =
|
||||
;format-disconnected = <label-disconnected>
|
||||
;format-disconnected-underline = ${self.format-connected-underline}
|
||||
;label-disconnected = %ifname% disconnected
|
||||
;label-disconnected-foreground = ${colors.foreground-alt}
|
||||
|
||||
ramp-signal-0 =
|
||||
ramp-signal-1 =
|
||||
ramp-signal-2 =
|
||||
ramp-signal-3 =
|
||||
ramp-signal-4 =
|
||||
ramp-signal-foreground = ${colors.foreground-alt}
|
||||
|
||||
[module/eth]
|
||||
type = internal/network
|
||||
interface =
|
||||
interval = 3.0
|
||||
|
||||
format-connected-underline = #55aa55
|
||||
format-connected-prefix = " "
|
||||
format-connected-prefix-foreground = ${colors.foreground-alt}
|
||||
label-connected = %local_ip%
|
||||
|
||||
format-disconnected =
|
||||
;format-disconnected = <label-disconnected>
|
||||
;format-disconnected-underline = ${self.format-connected-underline}
|
||||
;label-disconnected = %ifname% disconnected
|
||||
;label-disconnected-foreground = ${colors.foreground-alt}
|
||||
|
||||
[module/date]
|
||||
type = internal/date
|
||||
interval = 1
|
||||
|
||||
date = %a %d %b %Y%%{F-}
|
||||
date-alt = %a %d %b %Y%%{F-}
|
||||
|
||||
time = %H:%M
|
||||
time-alt = %H:%M:%S
|
||||
|
||||
format-prefix-foreground = ${colors.foreground-alt}
|
||||
|
||||
label = %time% %date%
|
||||
format = <label>
|
||||
|
||||
[module/volume]
|
||||
type = internal/alsa
|
||||
format-volume = <label-volume> <bar-volume>
|
||||
label-volume =
|
||||
label-volume-foreground = ${root.foreground}
|
||||
|
||||
format-muted-foreground = ${colors.foreground-alt}
|
||||
label-muted = sound muted
|
||||
|
||||
bar-volume-width = 20
|
||||
bar-volume-foreground-0 = #55aa55
|
||||
bar-volume-foreground-1 = #55aa55
|
||||
bar-volume-foreground-2 = #55aa55
|
||||
bar-volume-foreground-3 = #55aa55
|
||||
bar-volume-foreground-4 = #55aa55
|
||||
bar-volume-foreground-5 = #f5a70a
|
||||
bar-volume-foreground-6 = #ff5555
|
||||
bar-volume-gradient = false
|
||||
bar-volume-indicator = ▐
|
||||
bar-volume-indicator-font = 2
|
||||
bar-volume-fill = ─
|
||||
bar-volume-fill-font = 2
|
||||
bar-volume-empty = ─
|
||||
bar-volume-empty-font = 2
|
||||
bar-volume-empty-foreground = ${colors.foreground-alt}
|
||||
|
||||
|
||||
[module/temperature]
|
||||
type = internal/temperature
|
||||
thermal-zone = 0
|
||||
warn-temperature = 60
|
||||
|
||||
format = <ramp> <label>
|
||||
format-underline = #f50a4d
|
||||
format-warn = <ramp> <label-warn>
|
||||
format-warn-underline = ${self.format-underline}
|
||||
|
||||
label = %temperature%
|
||||
label-warn = %temperature%
|
||||
label-warn-foreground = ${colors.secondary}
|
||||
|
||||
ramp-0 =
|
||||
ramp-1 =
|
||||
ramp-2 =
|
||||
ramp-foreground = ${colors.foreground-alt}
|
||||
|
||||
[module/powermenu]
|
||||
type = custom/menu
|
||||
|
||||
format-spacing = 1
|
||||
|
||||
label-open =
|
||||
label-open-foreground = ${colors.secondary}
|
||||
label-close = cancel
|
||||
label-close-foreground = ${colors.secondary}
|
||||
label-separator = |
|
||||
label-separator-foreground = ${colors.foreground-alt}
|
||||
|
||||
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
|
||||
|
||||
[global/wm]
|
||||
margin-top = 5
|
||||
margin-bottom = 5
|
||||
|
||||
[module/gpu]
|
||||
type=custom/script
|
||||
exec = /bin/bash ~/.config/polybar/gpu.sh
|
||||
interval = 1
|
||||
tail = false
|
||||
format = GPU <label>
|
||||
|
||||
[module/spotify]
|
||||
type=custom/script
|
||||
exec = python3 ~/.config/polybar/spotify.py
|
||||
interval = 1
|
||||
tail = false
|
||||
format = <label>
|
||||
; vim:ft=dosini
|
||||
|
||||
[module/battery1]
|
||||
type = internal/battery
|
||||
full-at = 95
|
||||
battery = BAT0
|
||||
adapter = ADP1
|
||||
time-format = %Hh:%Mm
|
||||
|
||||
label-charging = %time% full
|
||||
format-charging = <label-charging>
|
||||
|
||||
label-full = Fully charged
|
||||
format_full = <label-full>
|
||||
|
||||
label-discharging = %percentage%% %time% left
|
||||
format-discharging = <ramp-capacity> <label-discharging>
|
||||
|
||||
ramp-capacity-0 =
|
||||
ramp-capacity-0-foreground = ${colors.red}
|
||||
ramp-capacity-1 =
|
||||
ramp-capacity-1-foreground = ${colors.yellow}
|
||||
ramp-capacity-2 =
|
||||
ramp-capacity-2-foreground = ${colors.green}
|
||||
ramp-capacity-3 =
|
||||
ramp-capacity-3-foreground = ${colors.green}
|
||||
ramp-capacity-4 =
|
||||
ramp-capacity-4-foreground = ${colors.green}
|
||||
|
||||
animation-discharging-0 =
|
||||
21
profiles/i3/.config/polybar/gpu.sh
Executable file
21
profiles/i3/.config/polybar/gpu.sh
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
t_warn=50
|
||||
t_crit=70
|
||||
|
||||
GPU=$(nvidia-smi -q | grep Gpu | awk '{print $3}')
|
||||
|
||||
if [ $GPU -gt $t_crit ]
|
||||
then
|
||||
printf " %d%%" "$GPU"
|
||||
printf "\n %d%%" "$GPU"
|
||||
printf "\n#fb4934\n"
|
||||
elif [ $GPU -gt $t_warn ]
|
||||
then
|
||||
printf " %d%%" "$GPU"
|
||||
printf "\n %d%%" "$GPU"
|
||||
printf "\n#fabd2f\n"
|
||||
else
|
||||
printf " %d%%" "$GPU"
|
||||
printf "\n %d%%" "$GPU"
|
||||
fi
|
||||
14
profiles/i3/.config/polybar/polybar.sh
Executable file
14
profiles/i3/.config/polybar/polybar.sh
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
killall -q polybar
|
||||
|
||||
# Wait until the processes have been shut down
|
||||
while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done
|
||||
|
||||
# Launch bar1 and bar2
|
||||
polybar -c ~/.config/polybar/config workstation &
|
||||
polybar -c ~/.config/polybar/config workstation2 &
|
||||
polybar -c ~/.config/polybar/config laptop &
|
||||
polybar -c ~/.config/polybar/config laptop_station &
|
||||
|
||||
echo "Bars launched..."
|
||||
16
profiles/i3/.config/polybar/spotify.py
Executable file
16
profiles/i3/.config/polybar/spotify.py
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import dbus
|
||||
try:
|
||||
bus = dbus.SessionBus()
|
||||
spotify = bus.get_object("org.mpris.MediaPlayer2.spotify", "/org/mpris/MediaPlayer2")
|
||||
spotify_iface = dbus.Interface(spotify, 'org.freedesktop.DBus.Properties')
|
||||
props = spotify_iface.Get('org.mpris.MediaPlayer2.Player', 'Metadata')
|
||||
try:
|
||||
out = str(props['xesam:artist'][0]) + " - " + str(props['xesam:title'])
|
||||
except IndexError:
|
||||
out = ''
|
||||
print(out)
|
||||
exit
|
||||
except dbus.exceptions.DBusException:
|
||||
exit
|
||||
Reference in New Issue
Block a user