add notice with 'Dunst'
This commit is contained in:
parent
81ca9ac556
commit
5a89716567
28
battery_notice.sh
Normal file
28
battery_notice.sh
Normal file
|
@ -0,0 +1,28 @@
|
|||
#!/bin/bash
|
||||
# Low battery notifier
|
||||
|
||||
# Kill already running processes
|
||||
already_running="$(ps -fC 'grep' -N | grep 'battery_notice.sh' | wc -l)"
|
||||
if [[ $already_running -gt 1 ]]; then
|
||||
pkill -f --older 1 'battery_notice.sh'
|
||||
fi
|
||||
|
||||
# Get path
|
||||
path="$( dirname "$(readlink -f "$0")" )"
|
||||
|
||||
while [[ 0 -eq 0 ]]; do
|
||||
battery_status="$(cat /sys/class/power_supply/BAT1/status)"
|
||||
battery_charge="$(cat /sys/class/power_supply/BAT1/capacity)"
|
||||
|
||||
if [[ $battery_status == 'Discharging' && $battery_charge -le 40 ]]; then
|
||||
if [[ $battery_charge -le 20 ]]; then
|
||||
notify-send --replace-id=0 --icon=" " --urgency=critical "Battery critical!" "${battery_charge}% 🪫"
|
||||
sleep 120
|
||||
elif [[ $battery_charge -eq 40 ]]; then
|
||||
notify-send --replace-id=1 --icon=" " --urgency=normal "Battery low!" "${battery_charge}% 🪫" --expire-time=30000
|
||||
sleep 240
|
||||
fi
|
||||
else
|
||||
sleep 60
|
||||
fi
|
||||
done
|
20
init.vim
20
init.vim
|
@ -1,13 +1,18 @@
|
|||
syntax on
|
||||
set showmatch
|
||||
set number
|
||||
set relativenumber
|
||||
set autoindent
|
||||
set smarttab
|
||||
set expandtab
|
||||
set smartindent
|
||||
set shiftwidth=4
|
||||
set softtabstop=4
|
||||
set tabstop=4
|
||||
set mouse=a
|
||||
|
||||
"set list
|
||||
"set listchars=tab:>.
|
||||
set shiftwidth=4
|
||||
set smarttab
|
||||
set softtabstop=4
|
||||
set mouse=a
|
||||
|
||||
" tab is space in python, patch
|
||||
autocmd FileType python setlocal noexpandtab
|
||||
|
@ -34,12 +39,15 @@ Plug 'https://github.com/preservim/tagbar' " Tagbar for code navigation
|
|||
Plug 'norcalli/nvim-colorizer.lua' "Color Hexadecimal
|
||||
Plug 'https://github.com/chrisbra/unicode.vim' "For utf-8 emoji
|
||||
|
||||
call plug#end()
|
||||
|
||||
"Theme
|
||||
colorscheme industry
|
||||
|
||||
" for vim-devicons
|
||||
set encoding=UTF-8
|
||||
let g:airline_powerline_fonts = 1
|
||||
|
||||
call plug#end()
|
||||
|
||||
" If there are only terminal and NerdTree, all close
|
||||
autocmd bufenter * if (winnr("$") == 2 && IsNerdTreeEnabled() && g:terminal_id != -1) | qa | endif
|
||||
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
#!/bin/sh
|
||||
|
||||
#sway
|
||||
mkdir -p ~/.config/sway
|
||||
cp -v sway-config ~/.config/sway/config
|
||||
cp -v status.sh ~/.config/sway/status.sh
|
||||
cp -v battery_notice.sh ~/.config/sway/battery_notice.sh
|
||||
|
||||
#other
|
||||
cp -v config.fish ~/.config/fish
|
||||
cp -v bashrc ~/.bashrc
|
||||
cp -v ssh-config ~/.ssh/config
|
||||
|
|
|
@ -11,9 +11,7 @@ battery_status=$(cat /sys/class/power_supply/BAT1/status)
|
|||
battery_level=$(cat /sys/class/power_supply/BAT1/capacity)
|
||||
|
||||
battery_symbol=🔋
|
||||
if [ "$battery_level" -ge 20 ]; then
|
||||
battery_symbol=🔋
|
||||
elif [ "$battery_level" -lt 20 ]; then
|
||||
if [ "$battery_level" -lt 20 ]; then
|
||||
battery_symbol=🪫
|
||||
fi
|
||||
|
||||
|
|
17
sway-config
17
sway-config
|
@ -23,7 +23,7 @@ set $menu dmenu_path | dmenu | xargs swaymsg exec --
|
|||
### Output configuration
|
||||
#
|
||||
# Default wallpaper (more resolutions are available in /usr/share/backgrounds/sway/)
|
||||
output * bg /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill
|
||||
# output * bg /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill
|
||||
#
|
||||
# Example configuration:
|
||||
#
|
||||
|
@ -220,10 +220,11 @@ mode "resize" {
|
|||
bar {
|
||||
position top
|
||||
mode hide
|
||||
modifier $mod
|
||||
|
||||
# When the status_command prints a new line to stdout, swaybar updates.
|
||||
# The default just shows the current date and time.
|
||||
status_command while bash ~/.config/sway/status.sh; do sleep 1; done
|
||||
status_command while bash ~/.config/sway/status.sh; do sleep 0; done
|
||||
|
||||
colors {
|
||||
statusline #ffffff
|
||||
|
@ -251,7 +252,15 @@ bindsym XF86MonBrightnessUp exec brightnessctl set 2%+
|
|||
bindsym $mod+XF86MonBrightnessUp exec brightnessctl set 100%
|
||||
bindsym $mod+XF86MonBrightnessDown exec brightnessctl set 1
|
||||
|
||||
# Sound button
|
||||
bindsym XF86AudioMute exec amixer sset Master toggle
|
||||
bindsym XF86AudioLowerVolume exec amixer sset Master 5%-
|
||||
bindsym XF86AudioRaiseVolume exec amixer sset Master 5%+
|
||||
bindsym XF86AudioLowerVolume exec amixer sset Master 6%-
|
||||
bindsym XF86AudioRaiseVolume exec amixer sset Master 6%+
|
||||
bindsym Ctrl+XF86AudioLowerVolume exec amixer sset Master 1%-
|
||||
bindsym Ctrl+XF86AudioRaiseVolume exec amixer sset Master 1%+
|
||||
bindsym $mod+XF86AudioLowerVolume exec amixer sset Master 6%-
|
||||
bindsym $mod+XF86AudioRaiseVolume exec amixer sset Master 6%+
|
||||
bindsym $mod+Ctrl+XF86AudioLowerVolume exec amixer sset Master 1%-
|
||||
bindsym $mod+Ctrl+XF86AudioRaiseVolume exec amixer sset Master 1%+
|
||||
|
||||
exec_always bash /home/xamo/.config/sway/battery_notice.sh
|
||||
|
|
Loading…
Reference in a new issue