changed panel to i3status-rust panel

This commit is contained in:
bvn13 2020-06-25 12:41:50 +03:00
parent b2e3308e46
commit 7bc9a99c3c
6 changed files with 170 additions and 19 deletions

57
config
View File

@ -43,10 +43,10 @@ bindsym $mod+d exec j4-dmenu-desktop
# 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
#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
@ -55,10 +55,10 @@ 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+semicolon move right
#bindsym $mod+Shift+j move left
#bindsym $mod+Shift+k move down
#bindsym $mod+Shift+l move up
#bindsym $mod+Shift+semicolon move right
# alternatively, you can use the cursor keys:
bindsym $mod+Shift+Left move left
@ -137,7 +137,7 @@ bindsym $mod+Shift+r restart
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'"
bindsym $mod+Shift+grave move scratchpad
bindsym $mod+grave show
bindsym $mod+grave scratchpad show
# resize window (you can also use the mouse for that)
mode "resize" {
@ -147,10 +147,10 @@ mode "resize" {
# Pressing right will grow the windows width.
# Pressing up will shrink the windows height.
# Pressing down will grow the windows 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
# 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
@ -172,7 +172,8 @@ bindsym XF86MonBrightnessDown exec light -U 3
### Print screen
bindsym --release Print exec --no-startup-id scrot -m '%Y%m%d-%H%M%S.png' -e 'mv $f ~/Nextcloud/raffle/screenshots/'
bindsym --release $mod+Print exec --no-startup-id scrot -s '%Y%m%d-%H%M%S.png' -e 'mv $f ~/Nextcloud/raffle/screenshots/'
#bindsym --release $mod+Print exec --no-startup-id scrot -s '%Y%m%d-%H%M%S.png' -e 'mv $f ~/Nextcloud/raffle/screenshots/'
bindsym --release $mod+Print exec --no-startup-id scrot -s '/tmp/%F_%T_$wx$h.png' -e 'xclip -selection clipboard -target image/png -i $f'
### Audio volume
bindsym XF86AudioMute exec --no-startup-id "pactl set-sink-mute 1 toggle"
@ -194,17 +195,35 @@ mode "mode_mic" {
}
bindsym $mod+m mode "mode_mic"
# lock screen
bindsym Mod4+l exec i3lock
# Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available)
bar {
status_command i3status
# status_command i3status
# status_command i3status --config ~/.config/i3/i3status.conf
font pango:FontAwesome, DejaVu Sans Mono 9
position top
status_command i3status-rs ~/.config/i3/i3status-rust.toml
colors {
separator #666666
background #222222
statusline #dddddd
focused_workspace #0088CC #0088CC #ffffff
active_workspace #333333 #333333 #ffffff
inactive_workspace #333333 #333333 #888888
urgent_workspace #2f343a #900000 #ffffff
}
}
## my
exec --no-startup-id "setxkbmap -layout us,ru"
exec --no-startup-id "setxkbmap -option 'grp:caps_toggle'"
exec "compton -c -r4 -l-6 -t-4 -z -b -G -C -e0.85 -f -D30 -I0.45 -O0.45 --paint-on-overlay --unredir-if-possible --backend glx --glx-no-stencil --glx-no-rebind-pixmap --inactive-dim 0.2 --no-fading-openclose --inactive-dim-fixed --config /dev/null"
#exec "compton --vsync opengl --inactive-dim 0.2 --no-fading-openclose --inactive-dim-fixed --config /dev/null"
exec --no-startup-id setxkbmap -layout us,ru
exec --no-startup-id setxkbmap -option 'grp:caps_toggle'
exec "compton -c -r4 -l-6 -t-4 -z -b -G -C -e0.85 -f -D30 -I0.45 -O0.45 --paint-on-overlay --unredir-if-possible --backend glx --glx-no-stencil --glx-no-rebind-pixmap --inactive-dim 0.1 --no-fading-openclose --inactive-dim-fixed --config /dev/null"
exec --no-startup-id hsetroot -solid '#000000'
exec --no-startup-id dunst
exec --no-startup-id nm-applet

35
i3status-rust.toml Normal file
View File

@ -0,0 +1,35 @@
theme = "solarized-dark"
icons = "awesome"
[[block]]
block = "disk_space"
path = "/"
alias = "/"
info_type = "available"
unit = "GB"
interval = 20
warning = 20.0
alert = 10.0
[[block]]
block = "memory"
display_type = "memory"
format_mem = "{Mup}%"
format_swap = "{SUp}%"
[[block]]
block = "cpu"
interval = 1
[[block]]
block = "load"
interval = 1
format = "{1m}"
[[block]]
block = "sound"
[[block]]
block = "time"
interval = 60
format = "%a %d/%m %R"

20
scripts/getProgressString Executable file
View File

@ -0,0 +1,20 @@
#!/bin/bash
# getProgressString <TOTAL ITEMS> <FILLED LOOK> <NOT FILLED LOOK> <STATUS>
# For instance:
# $ getProgressString 10 "#" "-" 50
# #####-----
# Note: if you want to use | in your progress bar string you need to change the delimiter in the sed commands
ITEMS="$1" # The total number of items(the width of the bar)
FILLED_ITEM="$2" # The look of a filled item
NOT_FILLED_ITEM="$3" # The look of a not filled item
STATUS="$4" # The current progress status in percent
# calculate how many items need to be filled and not filled
FILLED_ITEMS=$(echo "((${ITEMS} * ${STATUS})/100 + 0.5) / 1" | bc)
NOT_FILLED_ITEMS=$(echo "$ITEMS - $FILLED_ITEMS" | bc)
# Assemble the bar string
msg=$(printf "%${FILLED_ITEMS}s" | sed "s| |${FILLED_ITEM}|g")
msg=${msg}$(printf "%${NOT_FILLED_ITEMS}s" | sed "s| |${NOT_FILLED_ITEM}|g")
echo "$msg"

32
scripts/lock Executable file
View File

@ -0,0 +1,32 @@
#!/bin/bash
SUSPEND_TIMEOUT=300
# There are occasions when you want to lock the screen after timeout but don't shutdown
# Make this function return 1 if you don't want to shutdown
function veto() {
if [[ "$(cmus-remote -Q | grep '^status ')" == "status playing" ]]; then
return 1
elif [[ -f "/tmp/i3-lock.no-suspend" ]]; then
return 1
else
return 0
fi
}
waitForSuspend() {
while [ True ]; do
sleep "$SUSPEND_TIMEOUT"
if veto; then
systemctl suspend
fi
done
}
resolution=$(xrandr | grep -E ' *[0-9]*x[0-9]* *[0-9][0-9]\.[0-9][0-9]\*\+' | awk '{print $1}')
waitForSuspend &
waitPID="$!"
trap "kill $waitPID" EXIT
image="$HOME/.cache/i3lock/lock_${resolution}"
[[ ! -d "$HOME/.cache/i3lock" ]] && mkdir "$HOME/.cache/i3lock"
if [[ ! -f "$image" ]]; then
convert "$HOME/.config/i3/lock.png" -resize "${resolution}^" -gravity Center -crop "${resolution}+0+0" "$image"
fi
i3lock -i "$image" -f -n

25
scripts/volume.sh Executable file
View File

@ -0,0 +1,25 @@
#!/bin/bash
# changeVolume
dir=$(pwd)
# Arbitrary but unique message id
msgId="991049"
# Change the volume using alsa(might differ if you use pulseaudio)
amixer -c 0 set Master "$@" > /dev/null
# Query amixer for the current volume and whether or not the speaker is muted
volume="$(amixer -c 0 get Master | tail -1 | awk '{print $4}' | sed 's/[^0-9]*//g')"
mute="$(amixer -c 0 get Master | tail -1 | awk '{print $6}' | sed 's/[^a-z]*//g')"
if [[ $volume == 0 || "$mute" == "off" ]]; then
# Show the sound muted notification
#dunstify -a "changeVolume" -u low -i audio-volume-muted -r "$msgId" "Volume muted"
notify-send -a "changeVolume" -u low -i audio-volume-muted "Volume muted"
else
# Show the volume notification
#dunstify -a "changeVolume" -u low -i audio-volume-high -r "$msgId" \
#"Volume: ${volume}%" "$($(dir)/getProgressString 10 "<b> </b>" " " $volume)"
notify-send -a "changeVolume" -u low -i audio-volume-high \
"Volume: ${volume}%" "$($dir/getProgressString 10 " " "* " $volume)"
fi

20
scripts/volume.sh~ Executable file
View File

@ -0,0 +1,20 @@
#!/bin/bash
# changeVolume
# Arbitrary but unique message id
msgId="991049"
# Change the volume using alsa(might differ if you use pulseaudio)
amixer -c 0 set Master "$@" > /dev/null
# Query amixer for the current volume and whether or not the speaker is muted
volume="$(amixer -c 0 get Master | tail -1 | awk '{print $4}' | sed 's/[^0-9]*//g')"
mute="$(amixer -c 0 get Master | tail -1 | awk '{print $6}' | sed 's/[^a-z]*//g')"
if [[ $volume == 0 || "$mute" == "off" ]]; then
# Show the sound muted notification
dunstify -a "changeVolume" -u low -i audio-volume-muted -r "$msgId" "Volume muted"
else
# Show the volume notification
dunstify -a "changeVolume" -u low -i audio-volume-high -r "$msgId" \
"Volume: ${volume}%" "$(getProgressString 10 "<b> </b>" " " $volume)"
fi