1
0
mirror of https://gitlab.com/linuxstuff/dotfiles.git synced 2026-06-19 04:06:00 +02:00

added scripts

This commit is contained in:
Simon
2020-12-27 20:43:51 +01:00
parent c334612df6
commit dc144ce896
9 changed files with 86564 additions and 100 deletions
@@ -91,6 +91,7 @@
<alias>
<family>sans-serif</family>
<prefer>
<family>Material Design Icons</family>
<family>Roboto</family>
<family>Open Sans</family>
<family>Noto Color Emoji</family>
@@ -100,6 +101,7 @@
<alias>
<family>serif</family>
<prefer>
<family>Material Design Icons</family>
<family>Noto Serif</family>
<family>Noto Color Emoji</family>
<family>Noto Emoji</family>
@@ -108,6 +110,7 @@
<alias>
<family>monospace</family>
<prefer>
<family>Material Design Icons</family>
<family>Hack Nerd Font Mono</family>
<family>JetBrains Mono Regular Nerd Font Complete Mono</family>
<family>Roboto Mono</family>
+25 -98
View File
@@ -39,7 +39,8 @@ module-margin-left = 1
module-margin-right = 1
padding-right= 2
font-0 = Hack Nerd Font:fontformat=truetype:pixelsize=10;1
font-1 = Font Awesome 5 Free:fontformat=truetype:pixelsize=10:antialias=true;0
font-1 = Font Font Awesome 5 Free Solid:style=Solid:fontformat=truetype:pixelsize=10:antialias=true;0
font-2 = Font Awesome 5 Free:fontformat=truetype:pixelsize=10:antialias=true;0
tray-position = left
tray-padding = 9
tray-detached = false
@@ -66,7 +67,8 @@ module-margin-left = 1
module-margin-right = 1
padding-right= 2
font-0 = Hack Nerd Font:fontformat=truetype:pixelsize=10;1
font-1 = Font Awesome 5 Free:fontformat=truetype:pixelsize=10:antialias=true;0
font-1 = Font Font Awesome 5 Free Solid:style=Solid:fontformat=truetype:pixelsize=10:antialias=true;0
font-2 = Font Awesome 5 Free:fontformat=truetype:pixelsize=10:antialias=true;0
tray-position = left
tray-padding = 9
tray-detached = false
@@ -78,7 +80,7 @@ enable-ipc = true
; Bars PC
[bar/pc_primary_landscape]
modules-left = disk_short_pc checkupd ovpn nvpn eth_pc
modules-left = disk_short_pc checkupdates ovpn nvpn eth_pc playerctl
modules-center = i3
modules-right = sensors_cpu_pc nvgpu memory date
monitor = ${env:MONITOR:DP-4}
@@ -94,7 +96,7 @@ module-margin-left = 1
module-margin-right = 1
padding-right= 2
font-0 = Hack Nerd Font:fontformat=truetype:pixelsize=10;1
font-1 = Font Awesome 5 Free:fontformat=truetype:pixelsize=10:antialias=true;0
font-1 = Material Design Icons:fontformat=truetype:pixelsize=11:antialias=true;1
tray-position = left
tray-padding = 9
tray-detached = false
@@ -120,7 +122,7 @@ module-margin-left = 1
module-margin-right = 1
padding-right= 2
font-0 = Hack Nerd Font:fontformat=truetype:pixelsize=10;1
font-1 = Font Awesome 5 Free:fontformat=truetype:pixelsize=10:antialias=true;0
font-1 = Material Design Icons:fontformat=truetype:pixelsize=10:antialias=true;0
tray-position = left
tray-padding = 9
tray-detached = false
@@ -129,46 +131,6 @@ tray-background = ${root.background}
tray-scale = 1.0
enable-ipc = true
[bar/pc_secondary_landscape]
modules-left =
modules-center = i3
modules-right = date
monitor = ${env:MONITOR:HDMI-0}
width = 100%
height = 18
fixed-center = true
background = ${colors.background}
foreground = ${colors.foreground}
line-size = 3
line-color = #000
separator =|
module-margin-left = 1
module-margin-right = 1
padding-right= 2
font-0 = Hack Nerd Font:fontformat=truetype:pixelsize=10;1
font-1 = Font Awesome 5 Free:fontformat=truetype:pixelsize=9:antialias=true;0
enable-ipc = true
[bar/pc_tertiary_landscape]
modules-left =
modules-center = i3
modules-right = date
monitor = ${env:MONITOR:HDMI-1}
width = 100%
height = 18
fixed-center = true
background = ${colors.background}
foreground = ${colors.foreground}
line-size = 3
line-color = #000
separator =|
module-margin-left = 1
module-margin-right = 1
padding-right= 2
font-0 = Hack Nerd Font:fontformat=truetype:pixelsize=10;1
font-1 = Font Awesome 5 Free:fontformat=truetype:pixelsize=9:antialias=true;0
enable-ipc = true
; Modules
; Module Date
@@ -176,7 +138,7 @@ enable-ipc = true
[module/date]
type = internal/date
interval = 1
date = tme:
date = 󰃭
date-alt = %d.%m.%Y,
time = %H:%M
time-alt = %H:%M:%S
@@ -184,58 +146,24 @@ label = %date% %time%
; Module Updates
[module/update]
[module/checkupdates]
type = custom/script
interval = 60
format = upd: <label>
label-maxlen=5
label-ellipsis=true
exec = "echo $(yay -Qu 2>/dev/null | wc -l | awk '$1 ~ /^[[:digit:]]+$/')"
click-left = "setsid alacritty -e sh -c 'echo ---UPDATE LIST---; echo; yay -Syy; yay -Qu; echo ; read -p ---END---'"
click-right = "setsid alacritty -e sh -c 'echo ---UPDATING---; echo ; yay -Syu --sudoloop; echo ; read -p ---END---'"
click-middle = "setsid alacritty -e sh -c 'echo ---UPDATING, NOCONFIRM---; echo ; yay -Syu --sudoloop --noconfirm; echo ; read -p ---END---'"
; This module uses 'checkupdates-aur' to fetch update count without database sync
[module/checkupd]
type = custom/script
interval = 60
format = upd: <label>
format = 󰂪 <label>
label-maxlen=500
label-ellipsis=true
exec = "echo $(/bin/checkupdates-aur | wc -l | awk '$1 ~ /^[[:digit:]]+$/') 2>&1"
click-left = "setsid alacritty -e sh -c 'echo ---UPDATE LIST---; echo; /bin/checkupdates-aur; echo ; read -p ---END---'"
click-right = "setsid alacritty -e sh -c 'echo ---UPDATING---; echo ; yay -Syu --sudoloop; echo ; read -p ---END---'"
click-middle = "setsid alacritty -e sh -c 'echo ---UPDATING, NOCONFIRM---; echo ; yay -Syu --sudoloop --noconfirm; echo ; read -p ---END---'"
; This module uses 'checkupdates-aur' to fetch update count without database sync
[module/checkupd_manjaro]
type = custom/script
interval = 60
format = upd: <label>
label-maxlen=5
label-ellipsis=true
exec = "echo $(checkupdates | wc -l | awk '$1 ~ /^[[:digit:]]+$/') 2>&1"
click-left = "setsid alacritty -e sh -c 'echo ---UPDATE LIST---; echo; checkupdates-aur; echo ; read -p ---END---'"
click-right = "setsid alacritty -e sh -c 'echo ---UPDATING---; echo ; yay -Syu --sudoloop; echo ; read -p ---END---'"
click-middle = "setsid alacritty -e sh -c 'echo ---UPDATING, NOCONFIRM---; echo ; yay -Syu --sudoloop --noconfirm; echo ; read -p ---END---'"
exec = "echo $(bash ~/.config/polybar/scripts/update.sh --count-short)"
click-left = "setsid alacritty -e bash ~/.config/polybar/scripts/update.sh --list"
click-right = "setsid alacritty -e bash ~/.config/polybar/scripts/update.sh --update"
click-middle = "setsid alacritty -e bash ~/.config/polybar/scripts/update.sh --update-noconfirm"
; Module HW-Statistics
[module/cpu]
type = internal/cpu
interval = 2
label = cpu: %percentage%%
[module/temperature]
type = internal/temperature
interval = 3
label = tmp: %temperature-c%
; run 'sensors-detect' from 'lm_sensors' first
[module/sensors_cpu_pc]
type = custom/script
interval = 2
format = cpu: <label>
format = 󰍛 <label>
label-maxlen=15
label-ellipsis=true
exec = "echo $((top -bn1 | grep 'Cpu(s)' | sed 's/.*, *\([0-9.]*\)%* id.*/\1/' | awk -F '.' '{print 100 - $1}' ; echo '%, ' ; sensors | grep "CPUTIN" | awk -F' ' '{print $2}' | awk -F'.' '{print $1}' | tr -d '+'; echo '°') | tr -d '\n')"
@@ -244,7 +172,7 @@ click-left = "setsid alacritty -e sh -c htop"
[module/sensors_cpu_yoga3]
type = custom/script
interval = 2
format = cpu: <label>
format = 󰍛 <label>
label-maxlen=15
label-ellipsis=true
exec = "echo $((top -bn1 | grep 'Cpu(s)' | sed 's/.*, *\([0-9.]*\)%* id.*/\1/' | awk -F '.' '{print 100 - $1}' ; echo '%, ' ; sensors | grep "Package id 0:" | awk -F' ' '{print $4}' | awk -F'.' '{print $1}' | tr -d '+'; echo '°') | tr -d '\n')"
@@ -253,12 +181,12 @@ click-left = "setsid alacritty -e sh -c htop"
[module/memory]
type = internal/memory
interval = 2
label = ram: %percentage_used%%
label = 󰆼 %percentage_used%%
[module/nvgpu]
type = custom/script
interval = 2
format = gpu: <label>
format = 󰹑 <label>
label-maxlen=15
label-ellipsis=true
;exec = "echo $(nvidia-settings -q GPUUtilization | awk -F'=' '{print $3}' | awk '{print $1}' | sed 's/\,/%/g')"
@@ -286,7 +214,7 @@ type = internal/network
interface = enp5s0
interval = 3
format-connected = <label-connected>
label-connected = eth: %local_ip%
label-connected = 󰈀 %local_ip%
[module/eth_yoga3]
type = internal/network
@@ -350,18 +278,17 @@ format-muted-foreground = ${root.foreground}
label-muted =  x
interval = 1
[module/songname]
[module/playerctl]
type = custom/script
interval = 3
tail = true
format-prefix = ""
format = <label>
label-maxlen=50
label-ellipsis=true
exec = echo $(printf "%s: %s" "$(playerctl metadata artist 2>&1)" "$(playerctl metadata title 2>&1)" | sed -r 's/No players found//g;' | awk 'length > 2')
exec = ~/.config/polybar/scripts/playerctl.sh
click-left = "playerctl play-pause"
click-right = "playerctl next"
click-middle = "playerctl previous"
[module/menu-media]
[module/playerctl-buttons]
type = custom/menu
expand-right = true
label-open = 
@@ -400,7 +327,7 @@ label-discharging = bat: %percentage%%
[module/disk_short_pc]
type = custom/script
format = | dsk: <label>
format = | 󰆓 <label>
interval = 10
exec = echo $(df -h / | tail +2 | awk -F ' ' '{print $3 " / " $2 " (" $5 ")"}' | tr -d 'G')
+1
View File
@@ -0,0 +1 @@
launch_polybar.sh##hostname.pc
+29
View File
@@ -0,0 +1,29 @@
#!/bin/bash
# Based on https://github.com/PrayagS/polybar-spotify/
# Set the max text length.
# Default is 10 characters
LENGTH=${1:-20}
# Set the source audio player here.
# Players supporting the MPRIS spec are supported.
# Examples: spotify, vlc, chrome, mpv and others.
# Use `playerctld` to always detect the latest player.
# See more here: https://github.com/altdesktop/playerctl/#selecting-players-to-control
PLAYER="playerctld"
# Format of the information displayed
# Eg. {{ artist }} - {{ album }} - {{ title }}
# See more attributes here: https://github.com/altdesktop/playerctl/#printing-properties-and-metadata
FORMAT="{{ title }} - {{ artist }}"
# see man zscroll for documentation of the following parameters
zscroll -l "$LENGTH" \
--delay 0.2 \
--scroll-padding " >> " \
--match-command "playerctl -s --player=$PLAYER status 2>/dev/null" \
--match-text "Playing" "--scroll 1" \
--match-text "Paused" "--scroll 0" \
--update-check true "playerctl -s --player=$PLAYER metadata --format '$FORMAT'" &
wait
+3
View File
@@ -0,0 +1,3 @@
Script started on 2020-12-27 19:30:46+01:00 [TERM="xterm-256color" TTY="/dev/pts/1" COLUMNS="104" LINES="16"]
Script done on 2020-12-27 19:30:46+01:00 [COMMAND_EXIT_CODE="0"]
+89
View File
@@ -0,0 +1,89 @@
#!/bin/bash
exe() { echo "\$ $@" ; "$@" ; }
# Dependencies:
# pacman-contrib, yay for AUR updates
ENA_UPDATES=$(command -v checkupdates)
CNT_UPDATES="0"
UPDATES="nA"
if [ "$ENA_UPDATES" ]; then
UPDATES=$(checkupdates)
CNT_UPDATES=$(echo "$UPDATES" | wc -l)
fi
ENA_UPDATES_AUR=$(command -v yay)
CNT_UPDATES_AUR="0"
UPDATES_AUR="nA"
if [ "$ENA_UPDATES_AUR" ]; then
UPDATES_AUR=$(yay -Qua)
CNT_UPDATES_AUR=$(echo "$UPDATES_AUR" | wc -l)
fi
CNT_UPDATES_TOTAL=$(("$CNT_UPDATES" + "$CNT_UPDATES_AUR"))
if [ "$1" == "--count" ]; then
echo "Official: $CNT_UPDATES, AUR: $CNT_UPDATES_AUR, Total: $CNT_UPDATES_TOTAL"
fi
if [ "$1" == "--count-short" ]; then
echo "$CNT_UPDATES / $CNT_UPDATES_AUR"
fi
if [ "$1" == "--count-total" ]; then
echo "$CNT_UPDATES_TOTAL"
fi
if [ "$1" == "--count-official" ]; then
echo "$CNT_UPDATES"
fi
if [ "$1" == "--count-aur" ]; then
echo "$CNT_UPDATES"
fi
if [ "$1" == "--update" ]; then
echo "--- Update all packages ($CNT_UPDATES_TOTAL) via yay ---"
echo
yay -Syu --sudoflags "--stdin" --sudoloop
echo
read -rp "Press any key to exit..."
fi
if [ "$1" == "--update-noconfirm" ]; then
echo "--- Update all packages ($CNT_UPDATES_TOTAL) via yay [noconfirm] ---"
echo
yay -Syu --sudoflags "--stdin" --sudoloop --noconfirm
echo
read -rp "Press any key to exit..."
fi
if [ "$1" == "--list" ]; then
echo "--- List of updates ($CNT_UPDATES_TOTAL) ---"
echo
if [ "$ENA_UPDATES" ]; then
echo "-- Official ($CNT_UPDATES):"
echo "$UPDATES"
echo
else
echo "-- Package 'checkupdates' is not installed!"
echo
fi
if [ "$ENA_UPDATES_AUR" ]; then
echo "-- AUR ($CNT_UPDATES_AUR):"
echo "$UPDATES_AUR"
echo
else
echo "-- Package 'yay' is not installed!"
echo
fi
echo
read -rp "Press any key to exit..."
fi
exit
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -35,7 +35,7 @@
padding: 5;
}
#mainbox {
border: 0;
border: 2px solid #00ff00;
padding: 0;
}
#message {
+3 -1
View File
@@ -7,6 +7,8 @@
}
#window {
border: 4px;
border-color: #434c5e;
background-color: #3b4252;
}
@@ -39,4 +41,4 @@ element {
element selected {
background-color: #4c566a;
text-color: #eceff4;
}
}