feat: remove i3 scripts

This commit is contained in:
ineanto 2025-05-06 17:35:36 +02:00
parent f26435d640
commit cd365d5973
Signed by: ineanto
GPG key ID: E511F9CAA2F9CE84
18 changed files with 25 additions and 809 deletions

View file

@ -13,9 +13,9 @@ workspace_layout default
############################## ##############################
#border indicator on windows: #border indicator on windows:
default_border pixel 1 default_border pixel 2
default_floating_border pixel 1 default_floating_border pixel 2
for_window [class="^.*"] border pixel 1 for_window [class="^.*"] border pixel 2
# thin borders # thin borders
#hide_edge_borders both #hide_edge_borders both
@ -176,14 +176,11 @@ bindsym $mod+p exec /usr/local/bin/switch-audio-port
## App shortcuts ## App shortcuts
bindsym $mod+w exec /usr/bin/firefox bindsym $mod+w exec /usr/bin/firefox
# bindsym $mod+Shift+s exec kazam
########################################## ##########################################
# configuration for workspace behaviour: # # configuration for workspace behaviour: #
########################################## ##########################################
# 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:base" set $ws1 "1:base"
set $ws2 "2:term" set $ws2 "2:term"
set $ws3 "3:web" set $ws3 "3:web"
@ -195,18 +192,20 @@ set $ws8 "8"
set $ws9 "9" set $ws9 "9"
set $ws10 "10" set $ws10 "10"
# bind program to workspace and focus to them on startup: # Bind programs to workspace:
assign [class="alacritty"] $ws2 assign [class="alacritty"] $ws2
assign [class="(?i)firefox"] $ws3 assign [class="(?i)firefox"] $ws3
assign [class="Spotify"] $ws5
# then the current:
############################################# #############################################
# autostart applications/services on login: # # AUTO-START APPLICATIONS #
############################################# #############################################
# Display setup # Display setup
exec xrandr --auto exec xrandr --auto
exec autorandr -c
# Polybar
exec polybar --no-startup-id -rq
exec --no-startup-id gnome-keyring-daemon exec --no-startup-id gnome-keyring-daemon
@ -226,7 +225,7 @@ exec --no-startup-id picom -b --shadow
exec --no-startup-id nm-applet exec --no-startup-id nm-applet
# set wallpaper # set wallpaper
exec --no-startup-id feh --bg-fill /home/ineanto/Pictures/Background/Waves.png exec --no-startup-id feh --bg-scale /home/ineanto/Pictures/BG/wallpaper.png
# set powersavings for display: # set powersavings for display:
exec --no-startup-id xset s 480 dpms 600 600 600 exec --no-startup-id xset s 480 dpms 600 600 600
@ -234,67 +233,32 @@ exec --no-startup-id xset s 480 dpms 600 600 600
# Desktop notifications # Desktop notifications
exec --no-startup-id dbus-launch dunst --config ~/.config/dunst/dunstrc exec --no-startup-id dbus-launch dunst --config ~/.config/dunst/dunstrc
# set focus upon starting
for_window [class="Firefox" instance="firefox"] focus
for_window [title="Firefox"] focus
# set floating (nontiling) for special apps # 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="Pavucontrol" instance="pavucontrol"] floating enable
for_window [class="Blueberry.py" instance="blueberry.py"] 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="Bluetooth-sendto" instance="bluetooth-sendto"] floating enable
for_window [class="Pamac-manager"] floating enable
for_window [class="vlc"] sticky enable
###################################### ######################################
# color settings windows # # WINDOWS #
###################################### ######################################
# Define colors variables: # COLORS:
set $rosewater #f5e0dc set $green #538f45
set $flamingo #f2cdcd set $urgent #d42a2a
set $pink #f5c2e7 set $inactive #302428
set $mauve #cba6f7
set $red #f38ba8 set $black #0c0c0c
set $maroon #eba0ac
set $peach #fab387
set $green #a6e3a1
set $teal #94e2d5
set $sky #89dceb
set $sapphire #74c7ec
set $blue #89b4fa
set $lavender #b4befe
set $text #cdd6f4
set $subtext1 #bac2de
set $subtext0 #a6adc8
set $overlay2 #9399b2
set $overlay1 #7f849c
set $overlay0 #6c7086
set $surface2 #585b70
set $surface1 #45475a
set $surface0 #313244
set $base #1e1e2e
set $mantle #181825
set $crust #11111b
set $white #ffffff set $white #ffffff
# define colors for windows: # WINDOWS (updated 18/10/2024):
# target title bg text indicator border
client.focused $pink $base $text $rosewater $pink
client.focused_inactive $mauve $base $text $rosewater $mauve
client.unfocused $mauve $base $text $rosewater $mauve
client.urgent $peach $base $peach $overlay0 $peach
client.placeholder $overlay0 $base $text $overlay0 $overlay0
client.background $base
# Default bar # Target Title BG Text Indicator Border
bar { client.focused $white $black $white $green $green
status_command i3status client.focused_inactive $white $black $white $inactive $inactive
position top client.unfocused $white $black $white $inactive $inactive
font pango:DejaVu Sans Mono 13 client.urgent $white $black $white $urgent $urgent
strip_workspace_numbers yes client.placeholder $white $black $white $white $black
} client.background $base
##################################### #####################################
# Application menu handled by rofi: # # Application menu handled by rofi: #

View file

@ -1,53 +0,0 @@
# i3blocks config file changed for EndeavourOS-i3 setup
# 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
[battery]
command=~/.config/i3/scripts/battery2
interval=60
[simple]
fulltext=" "
interval=persist
[pavucontrol]
full_text=
command=pavucontrol
[volume-pulseaudio]
command=~/.config/i3/scripts/volume
instance=Master
interval=1
[simple2]
full_text=<big><b>/</b></big>
color=#bdae93
[time]
full_text=" "
command=date '+%a %d %b %H:%M'
interval=60
[shutdown_menu]
full_text=" "
command=~/.config/i3/scripts/powermenu

View file

@ -1,103 +0,0 @@
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

View file

@ -1,87 +0,0 @@
#!/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 re
status = check_output(['acpi'], universal_newlines=True)
if not status:
# stands for no battery found
fulltext = "<span font='FontAwesome' color='#fb4934'>\uf00d \uf240</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=[]
for battery in batteries:
if battery!='':
state_batteries.append(battery.split(": ")[1].split(", ")[0])
commasplitstatus = battery.split(", ")
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
def color(percent):
if percent < 35:
return colors.get("low")
if percent < 50 and percent > 35:
return colors.get("mid")
if percent > 50:
return colors.get("high")
return "#FFFFFF"
B_TEMPLATE = "<span font='FontAwesome'>{}</span>"
B_FULL = B_TEMPLATE.format("\uf240")
B_MID = B_TEMPLATE.format("\uf242")
B_DISCHARING = B_TEMPLATE.format("\uf241")
B_CHARGING = B_TEMPLATE.format("\uf1e6")
B_DOWN = B_TEMPLATE.format("\uf06a")
B_UNKNOWN = B_TEMPLATE.format("\uf128")
colors = {
'low': '#d32f2f',
'mid': '#ffa000',
'high': '#d4e157'
}
display = "<span color=\"{}\">{}{}%</span>"
battery = ""
color = color(percentleft)
if(percentleft >= 99):
state = "Full"
if state == "Discharging":
battery = B_DISCHARING + " "
elif state == "Full":
battery = B_FULL + " "
elif state == "Charging":
battery = B_CHARGING + " "
elif state == "Unknown":
battery = B_UNKNOWN + " "
else:
battery = B_UNKNOWN + " " + B_MID + " "
display = display.format(color, battery, percentleft)
print(display)
if percentleft < 15:
exit(33)

View file

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

View file

@ -1,62 +0,0 @@
#!/usr/bin/perl
#
# Copyright 2014 Pierre Mavro <deimos@deimos.fr>
# Copyright 2014 Vivien Didelot <vivien@didelot.org>
# Copyright 2014 Andreas Guldstrand <andreas.guldstrand@gmail.com>
#
# Licensed under the terms of the GNU GPL v3, or any later version.
use strict;
use warnings;
use utf8;
use Getopt::Long;
# default values
my $t_warn = $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 "%.${decimals}f%%\n", $cpu_usage;
print "${label}";
printf "%.${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;

View file

@ -1,48 +0,0 @@
#!/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"
}
}
'

View file

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

View file

@ -1,25 +0,0 @@
#!/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 "$@"

View file

@ -1,6 +0,0 @@
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

View file

@ -1,10 +0,0 @@
#!/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}

View file

@ -1,69 +0,0 @@
#!/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

View file

@ -1,93 +0,0 @@
#!/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}"

View file

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

View file

@ -1,87 +0,0 @@
#!/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 = "GPU:";
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;

View file

@ -1,83 +0,0 @@
#!/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

View file

@ -1 +0,0 @@
/home/aro/.dotfiles/config/i3/scripts/powermenu