mirror of
https://github.com/sahinakkaya/dotfiles.git
synced 2024-12-23 07:39:36 +01:00
Add required files
This commit is contained in:
parent
dc71139796
commit
d33905058e
47
.config/qtile/polybar/launch.sh
Executable file
47
.config/qtile/polybar/launch.sh
Executable file
@ -0,0 +1,47 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
## Copyright (C) 2020-2021 Aditya Shakya <adi1090x@gmail.com>
|
||||||
|
## Everyone is permitted to copy and distribute copies of this file under GNU-GPL3
|
||||||
|
|
||||||
|
## Files and Directories
|
||||||
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
||||||
|
SFILE="$DIR/system.ini"
|
||||||
|
RFILE="$DIR/.system"
|
||||||
|
|
||||||
|
## Get system variable values for various modules
|
||||||
|
get_values() {
|
||||||
|
CARD=$(light -L | grep 'backlight' | head -n1 | cut -d'/' -f3)
|
||||||
|
BATTERY=$(upower -i `upower -e | grep 'BAT'` | grep 'native-path' | cut -d':' -f2 | tr -d '[:blank:]')
|
||||||
|
ADAPTER=$(upower -i `upower -e | grep 'AC'` | grep 'native-path' | cut -d':' -f2 | tr -d '[:blank:]')
|
||||||
|
INTERFACE=$(ip link | awk '/state UP/ {print $2}' | tr -d :)
|
||||||
|
}
|
||||||
|
|
||||||
|
## Write values to `system.ini` file
|
||||||
|
set_values() {
|
||||||
|
if [[ "$ADAPTER" ]]; then
|
||||||
|
sed -i -e "s/adapter = .*/adapter = $ADAPTER/g" ${SFILE}
|
||||||
|
fi
|
||||||
|
if [[ "$BATTERY" ]]; then
|
||||||
|
sed -i -e "s/battery = .*/battery = $BATTERY/g" ${SFILE}
|
||||||
|
fi
|
||||||
|
if [[ "$CARD" ]]; then
|
||||||
|
sed -i -e "s/graphics_card = .*/graphics_card = $CARD/g" ${SFILE}
|
||||||
|
fi
|
||||||
|
if [[ "$INTERFACE" ]]; then
|
||||||
|
sed -i -e "s/network_interface = .*/network_interface = $INTERFACE/g" ${SFILE}
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
## Launch Polybar with selected style
|
||||||
|
launch_bar() {
|
||||||
|
STYLE="default"
|
||||||
|
bash "$HOME"/.config/qtile/polybar/"$STYLE"/launch.sh
|
||||||
|
}
|
||||||
|
|
||||||
|
# Execute functions
|
||||||
|
if [[ ! -f "$RFILE" ]]; then
|
||||||
|
get_values
|
||||||
|
set_values
|
||||||
|
touch ${RFILE}
|
||||||
|
fi
|
||||||
|
launch_bar
|
27
.config/qtile/polybar/system.ini
Normal file
27
.config/qtile/polybar/system.ini
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
## Copyright (C) 2020-2021 Aditya Shakya <adi1090x@gmail.com>
|
||||||
|
## Everyone is permitted to copy and distribute copies of this file under GNU-GPL3
|
||||||
|
;; _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
|
||||||
|
;;
|
||||||
|
;; System Variables (Edit according to your system)
|
||||||
|
;;
|
||||||
|
;; Warning : DO NOT DELETE THIS FILE
|
||||||
|
;;
|
||||||
|
;; Run `ls -1 /sys/class/power_supply/` to list list batteries and adapters.
|
||||||
|
;;
|
||||||
|
;; Run `ls -1 /sys/class/backlight/` to list available graphics cards.
|
||||||
|
;;
|
||||||
|
;; Run `ip link | awk '/state UP/ {print $2}' | tr -d :` to get active network interface.
|
||||||
|
;;
|
||||||
|
;; Polybar Variables For Modules :
|
||||||
|
;; card = ${system.graphics_card}
|
||||||
|
;; battery = BAT0
|
||||||
|
;; adapter = AC
|
||||||
|
;; interface = ${system.network_interface}
|
||||||
|
|
||||||
|
[system]
|
||||||
|
adapter = AC0
|
||||||
|
battery = BAT0
|
||||||
|
graphics_card = intel_backlight
|
||||||
|
network_interface = enp3s0
|
||||||
|
|
||||||
|
;; _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
|
Loading…
Reference in New Issue
Block a user