More configuration

Notably polybar
This commit is contained in:
Vincent Bernat 2021-07-04 18:25:28 +02:00
parent f306d92a0d
commit 662db00e36
8 changed files with 204 additions and 25 deletions

14
bin/polybar Executable file
View file

@ -0,0 +1,14 @@
#!/bin/sh
export LAN=$(nmcli -t device | awk -F: '($2 == "ethernet") {print $1; exit}')
export WLAN=$(nmcli -t device | awk -F: '($2 == "wifi") {print $1; exit}')
export DPI=$(xrdb -query | sed -nE 's/^Xft\.dpi:\s*//p')
export HEIGHT=$((20 * DPI / 96))
MONITOR=$(polybar --list-monitors | awk -F: '($0 ~ /primary/) {print $1; exit}') \
polybar --reload primary &
for MONITOR in $(polybar --list-monitors | awk -F: '($0 !~ /primary/) {print $1}'); do
export MONITOR
polybar --reload secondary &
done
wait

View file

@ -40,3 +40,6 @@ xrandr --dpi $dpi
echo Gdk/WindowScalingFactor $(( $dpi/96 ))
echo Gdk/UnscaledDPI $(( $dpi*1024/($dpi/96) ))
} > ~/.xsettingsd
# Restart polybar to take changes
systemctl --user restart --no-block polybar.service

20
config
View file

@ -6,6 +6,7 @@ set $left h
set $right l
set $mod Mod4
set $term vbeterm
set $mediaplayer spotify
font pango:Terminus 9
@ -20,11 +21,28 @@ client.urgent #2f343a #d00000 #ffffff #d00000 #d00000
client.placeholder #000000 #0c0c0c #ffffff #000000 #0c0c0c
client.background #ffffff
# Use pactl to adjust volume in PulseAudio.
# Audio
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +5%
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -5%
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle
bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle
bindsym XF86AudioPlay exec --no-startup-id playerctl -p $mediaplayer play-pause
bindsym XF86AudioPause exec --no-startup-id playerctl -p $mediaplayer pause
bindsym XF86AudioStop exec --no-startup-id playerctl -p $mediaplayer stop
bindsym XF86AudioNext exec --no-startup-id playerctl -p $mediaplayer next
bindsym XF86AudioPrev exec --no-startup-id playerctl -p $mediaplayer previous
mode "mediaplayer" {
bindsym "z" exec --no-startup-id playerctl -p $mediaplayer previous; mode "default"
bindsym "x" exec --no-startup-id playerctl -p $mediaplayer play-pause; mode "default"
bindsym "c" exec --no-startup-id playerctl -p $mediaplayer pause; mode "default"
bindsym "v" exec --no-startup-id playerctl -p $mediaplayer stop; mode "default"
bindsym "b" exec --no-startup-id playerctl -p $mediaplayer next; mode "default"
bindsym "m" exec pavucontrol; mode "default"
bindsym "s" [class="(?i)$mediaplayer"] focus; mode "default"
bindsym Escape mode "default"
bindsym Return mode "default"
}
bindsym $mod+m mode "mediaplayer"
# use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod

133
dotfiles/polybar.conf Normal file
View file

@ -0,0 +1,133 @@
[colors]
background = #a0000000
foreground = #eaeaea
highlight = #4c7899
[settings]
screenchange-reload = false
[bar/secondary]
enable-ipc = true
width = 100%
height = ${env:HEIGHT:}
monitor = ${env:MONITOR:}
monitor-strict = true
dpi = ${env:DPI:}
border-size = 0
tray-position = none
fixed-center = true
module-margin = 1
background = ${colors.background}
foreground = ${colors.foreground}
font-0 = Hack:style=Regular:size=10;2
font-1 = Font Awesome 5 Pro:style=Solid:size=10;2
font-2 = Font Awesome 5 Brands:style=Regular:size=10;2
modules-left = i3
modules-right = date
[bar/primary]
inherit = bar/secondary
modules-center = cpu memory pulseaudio ethernet wlan battery
[module/i3]
type = internal/i3
format = <label-state> <label-mode>
index-sort = true
wrapping-scroll = false
pin-workspaces = true
enable-click = false
enable-scroll = false
label-mode-background = ${colors.highlight}
label-mode-padding = 1
label-focused = %index%
label-focused-background = ${colors.highlight}
label-focused-padding = 1
label-unfocused = %index%
label-unfocused-padding = 1
label-visible = %index%
label-visible-background = ${self.label-focused-background}
label-visible-padding = ${self.label-focused-padding}
label-urgent = %index%
label-urgent-background = #a00000
label-urgent-padding = 1
[module/cpu]
type = internal/cpu
interval = 2
label =  %percentage: 2%%
[module/memory]
type = internal/memory
interval = 5
label =  %percentage_used: 2%%
[module/wlan]
type = internal/network
interface = ${env:WLAN:}
interval = 5
format-connected = <ramp-signal> <label-connected>
label-connected = %essid% %downspeed:8% %upspeed:8%
format-disconnected = 
ramp-signal-0 = 
ramp-signal-1 = 
ramp-signal-2 = 
[module/ethernet]
type = internal/network
interface = ${env:LAN:}
interval = 2
format-connected = <label-connected>
label-connected =  %downspeed:8% %upspeed:8%
format-disconnected =
[module/date]
type = internal/date
interval = 2
date = %a %d.%m
time = %H:%M
label = %date% %time%
[module/battery]
type = internal/battery
battery = BAT0
adapter = ADP1
full-at = 99
interval = 5
format-charging = <animation-charging> <label-charging>
label-charging = %percentage: 2%%
format-discharging = <animation-discharging> <label-discharging>
label-discharging = %percentage: 2%%
format-full = <label-full>
label-full = 
animation-charging-0 = 
animation-charging-1 = 
animation-charging-2 = 
animation-charging-3 = 
animation-charging-4 = 
animation-charging-framerate = 1000
animation-discharging-0 = 
animation-discharging-1 = 
animation-discharging-2 = 
animation-discharging-3 = 
animation-discharging-4 = 
animation-discharging-framerate = 1000
[module/pulseaudio]
type = internal/pulseaudio
use-ui-max = false
format-volume = <ramp-volume> <label-volume>
format-muted = <label-muted>
label-volume = %percentage: 2%%
label-muted = 
ramp-volume-0 = 
ramp-volume-1 = 
ramp-volume-2 = 
ramp-volume-3 = 
ramp-volume-4 = 
ramp-volume-5 = 
ramp-volume-6 = 
ramp-volume-7 = 

View file

@ -7,6 +7,7 @@ After=xsettingsd.service
After=tmux.service
After=ssh-agent.service
Before=wallpaper.service
Before=polybar.service
[Service]
ExecStart=/usr/bin/i3

View file

@ -0,0 +1,8 @@
[Unit]
Description=Status bar for i3
PartOf=graphical-session.target
[Service]
ExecStart=%h/.config/i3/bin/polybar
ExecStop=/usr/bin/polybar-msg cmd quit
Restart=on-failure

View file

@ -2,17 +2,18 @@
Description=X session
BindsTo=graphical-session.target
Wants=autorandr.service
Wants=dunst.socket
Wants=i3.service
Wants=picom.service
Wants=inputplug.service
Wants=misc-x.service
Wants=picom.service
Wants=policykit-agent.service
Wants=polybar.service
Wants=pulseaudio.service
Wants=redshift.service
Wants=ssh-agent.service
Wants=tmux.service
Wants=wallpaper.timer
Wants=xiccd.service
Wants=xsettingsd.service
Wants=xss-lock.service
Wants=tmux.service
Wants=ssh-agent.service
Wants=pulseaudio.service
Wants=dunst.socket

View file

@ -30,6 +30,7 @@ gtk3.css .config/gtk-3.0/gtk.css
qt5ct.conf .config/qt5ct/qt5ct.conf
systemd .config/systemd/user
dunstrc .config/dunst/dunstrc
polybar.conf .config/polybar/config
firefox.js .mozilla/firefox/*/user.js
EOF
rm -f ~/.config/gtk-3.0/settings.ini