Merge pull request #2 from Mastermindzh/experiment/polybar

Experiment/polybar
This commit is contained in:
Rick van Lieshout 2023-04-27 17:48:34 +02:00 committed by GitHub
commit 2bca0d2231
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 438 additions and 42 deletions

View File

@ -4,16 +4,17 @@ This repository holds my Linux config files.
## Mandatory unixporn screenshots
New version as of Nov 2022:
New version as of January 2023:
[![dotfiles](media/dotfiles5.png)](https://raw.githubusercontent.com/Mastermindzh/dotfiles/master/media/dotfiles5.png)
[![dotfiles](media/dotfiles6.png)](media/dotfiles6.png)
I changed color of the terminal to match the i3bar:
I changed the color of the terminal to match the i3bar:
<img src = "media/dotfiles-small-5.png" width="200">
Older versions:
- [dotfiles5](media/dotfiles5.png)
- [dotfiles4](https://raw.githubusercontent.com/Mastermindzh/dotfiles/master/media/dotfiles4.jpg)
- [dotfiles3](media/dotfiles3.png)
- [dotfiles2](media/dotfiles2.png)
@ -24,6 +25,7 @@ Older versions:
| Purpose | Tool |
| ---------------- | ---------------------------------------------------------------------- |
| WM | i3 (i3-gaps) |
| bar | polybar |
| App launcher | rofi |
| Shell | Bash |
| Package managers | Pacman & Trizen |
@ -34,11 +36,10 @@ Older versions:
| Browser | Firefox |
| File manager | If I have to use one ... Thunar |
| Music | Tidal through [Tidal-hifi](https://github.com/Mastermindzh/tidal-hifi) |
| | |
## computer specifc setup
Nowadays I use a few different computers and I'd used to apply the base config and configure each pc on its own.
Nowadays I use a few different computers and I used to apply the base config and configure each pc on its own.
I've grown tired of this approach however so I added a "pc specific" setup in the installer.
The pc specific setup bit will read the folder names in computers, offer you a choice, and execute the install.sh inside that folder.
@ -46,14 +47,17 @@ This allows me to get pc specific settings synced with git and applied easily.
## Getting x info to use in i3
Some things are handled by window class/title or have custom resolutions set, the tools below help obtaining the info required:
Some things are handled by window class/title or have custom resolutions set, the tools below help obtain the info required:
- xprop -> displays static xwindow info including Window class
- xwininfo -> displays xwindow info including current size/position
## getting icons
Copy/paste icons from this url: [https://fontawesome.com/v5/cheatsheet](https://fontawesome.com/v5/cheatsheet)
Copy/paste icons from these URLs:
- [https://fontawesome.com/v5/cheatsheet](https://fontawesome.com/v5/cheatsheet)
- [https://fonts.google.com/noto/specimen/Noto+Color+Emoji/glyphs?noto.query=noto+color+emoji](https://fonts.google.com/noto/specimen/Noto+Color+Emoji/glyphs?noto.query=noto+color+emoji)
## after-install

View File

@ -114,6 +114,7 @@ alias cal='cal -mw --color'
alias chrome='google-chrome-stable'
alias teams='teams-insiders --disable-seccomp-filter-sandbox'
alias cat='bat'
alias grep='grep -i'
## command overrides
df() {

View File

@ -2,4 +2,3 @@
export GDK_DPI_SCALE=1
export ELM_SCALE=1
export QT_AUTO_SCREEN_SCALE_FACTOR=1
xrandr --output DVI-I-0 --off --output DVI-I-1 --off --output HDMI-0 --primary --mode 3840x2160 --pos 0x0 --rotate normal --output DP-0 --off --output DP-1 --off --output DVI-D-0 --off

35
config/autorandr/postswitch Executable file
View File

@ -0,0 +1,35 @@
#!/bin/bash -x
move_workspace() {
workspace="$1"
output="$2"
i3-msg "[workspace=\"$workspace\"]" move workspace to output "$output"
}
export -f move_workspace
# get primary
primary=$(xrandr | awk '/ primary / {print $1}')
declare -a movers=(
"1: "
"2: "
"3: "
"4: "
"5: "
"6: "
"7: "
"8: "
"9: "
"10: "
# "11:  "
"12: "
"13: "
)
for workspace in "${movers[@]}"; do
move_workspace "$workspace" "$primary" &
done
# restart i3.
i3-msg restart

View File

@ -3,7 +3,7 @@
enable_image_support = true
history_file = "/home/mastermindzh/.cache/greenclip.history"
image_cache_directory = "/tmp/greenclip"
max_history_length = 25
max_history_length = 50
max_selection_size_bytes = 0
static_history = []
trim_space_from_selection = true

View File

@ -1,7 +1,7 @@
[Settings]
gtk-theme-name=Adwaita-dark
gtk-icon-theme-name=Adwaita
gtk-font-name=Cantarell 11
gtk-icon-theme-name="Papirus-Dark"
gtk-font-name="Ubuntu 12"
gtk-cursor-theme-name=Adwaita
gtk-cursor-theme-size=0
gtk-toolbar-style=GTK_TOOLBAR_BOTH

26
config/polybar/config.ini Normal file
View File

@ -0,0 +1,26 @@
;==========================================================
;
;
; ██████╗ ██████╗ ██╗ ██╗ ██╗██████╗ █████╗ ██████╗
; ██╔══██╗██╔═══██╗██║ ╚██╗ ██╔╝██╔══██╗██╔══██╗██╔══██╗
; ██████╔╝██║ ██║██║ ╚████╔╝ ██████╔╝███████║██████╔╝
; ██╔═══╝ ██║ ██║██║ ╚██╔╝ ██╔══██╗██╔══██║██╔══██╗
; ██║ ╚██████╔╝███████╗██║ ██████╔╝██║ ██║██║ ██║
; ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝
;
;
; To learn more about how to configure Polybar
; go to https://github.com/polybar/polybar
;
; The README contains a lot of information
;
;==========================================================
[settings]
screenchange-reload = true
pseudo-transparency = true
; theme
include-file = ~/.config/polybar/themes/main/modules.ini
include-file = ~/.config/polybar/themes/main/colors.ini
include-file = ~/.config/polybar/themes/main/bars.ini

25
config/polybar/launch.sh Executable file
View File

@ -0,0 +1,25 @@
#!/bin/bash
killall -q polybar
# Launch Polybar, using default config location ~/.config/polybar/config.ini
PRIMARY=$(xrandr --query | grep -i "connected primary" | cut -d" " -f1)
export MONITOR=$PRIMARY
polybar -r 2>&1 | tee -a /tmp/polybar.log &
# show-bar on all monitors
# idk whether I like this at the moment, I don't really use external displays unless they are the primary or they are duplicated
# if type "xrandr"; then
# PRIMARY=$(xrandr --query | grep -i "connected primary" | cut -d" " -f1)
# for m in $(xrandr --query | grep -i " connected" | cut -d" " -f1); do
# export TRAY_POSITION=none
# if [[ $m == "$PRIMARY" ]]; then
# TRAY_POSITION=right
# fi
# export MONITOR=$m
# polybar -r 2>&1 | tee -a /tmp/polybar.log &
# done
# else
# polybar -r 2>&1 | tee -a /tmp/polybar.log &
# fi
disown
echo "Polybar launched..."

View File

@ -0,0 +1,59 @@
#!/bin/sh
status() {
MUTED=$(pacmd list-sources | awk '/\*/,EOF {print}' | awk '/muted/ {print $2; exit}')
if [ "$MUTED" = "yes" ]; then
echo "🙊 muted"
else
OUTPUT=$(pacmd list-sources | grep "\* index:" -A 7 | grep volume | awk -F/ '{print $2}' | awk -F, '{ print $1 }' | tr -d ' ')
echo "🎙️ $OUTPUT"
fi
}
listen() {
status
LANG=EN
pactl subscribe | while read -r event; do
if echo "$event" | grep -q "source" || echo "$event" | grep -q "server"; then
status
fi
done
}
toggle() {
MUTED=$(pacmd list-sources | awk '/\*/,EOF {print}' | awk '/muted/ {print $2; exit}')
DEFAULT_SOURCE=$(pacmd list-sources | awk '/\*/,EOF {print $3; exit}')
if [ "$MUTED" = "yes" ]; then
pactl set-source-mute "$DEFAULT_SOURCE" 0
else
pactl set-source-mute "$DEFAULT_SOURCE" 1
fi
}
increase() {
DEFAULT_SOURCE=$(pacmd list-sources | awk '/\*/,EOF {print $3; exit}')
pactl set-source-volume "$DEFAULT_SOURCE" +5%
}
decrease() {
DEFAULT_SOURCE=$(pacmd list-sources | awk '/\*/,EOF {print $3; exit}')
pactl set-source-volume "$DEFAULT_SOURCE" -5%
}
case "$1" in
--toggle)
toggle
;;
--increase)
increase
;;
--decrease)
decrease
;;
*)
listen
;;
esac

View File

@ -0,0 +1,37 @@
[bar/main]
monitor = ${env:MONITOR:}
width = 100%
height = 18pt
radius = 0
padding-right = 0
padding-left = 0
module-margin = 1
separator = |
dpi = ${xrdb:Xft.dpi:-1}
; colors
background = ${colors.background}
foreground = ${colors.foreground}
border-color = #00000000
separator-foreground = ${colors.disabled}
; modules
modules-left = xworkspaces i3
modules-center = tidal
modules-right = pulseaudio pulseaudio-microphone weather temperature updates ping battery date
; fonts (fc-list)
; offset = height - size / 2 (for vertical center, icons are weird and need to be even numbers)
font-0 = Ubuntu regular:style=regular:size=12;3
font-1 = FontAwesome:style=Regular;2
font-2 = Noto Color Emoji:style=Regular:scale=10;2
cursor-click = pointer
cursor-scroll = ns-resize
enable-ipc = true
tray-position = ${env:TRAY_POSITION:right}
wm-restack = i3
tray-reparent = true
; override-redirect = true

View File

@ -0,0 +1,11 @@
[colors]
background = #1e1e1e
background-alt = #252526
foreground = #848484
primary = #f6f6f7
secondary = #f6f6f7
alert = #ef5350
disabled = #707880
accent = #fff
yellow = #ebc034
tidal = #00ffff

View File

@ -0,0 +1,180 @@
[module/xworkspaces]
type = internal/xworkspaces
pin-workspaces = true
label-active = %name%
label-active-background = ${colors.background-alt}
; label-active-underline= ${colors.primary}
label-active-foreground= ${colors.accent}
label-active-padding = 1
label-occupied = %name%
label-occupied-padding = 1
label-urgent = %name%
label-urgent-background = ${colors.alert}
label-urgent-padding = 1
label-empty = %name%
label-empty-foreground = ${colors.disabled}
label-empty-padding = 1
[module/pulseaudio]
type = internal/pulseaudio
format-volume-prefix = "🔊 "
; format-volume-prefix = " "
format-volume-prefix-foreground = ${colors.primary}
format-volume = <label-volume>
label-volume = %percentage%%
; label-muted = 🔇 muted
label-muted = 🙉 muted
label-muted-foreground = ${colors.disabled}
[module/memory]
type = internal/memory
interval = 2
format-prefix = " "
format-prefix-foreground = ${colors.primary}
label = %percentage_used:2%%
[module/cpu]
type = internal/cpu
interval = 2
format-prefix = " "
format-prefix-foreground = ${colors.primary}
label = %percentage:2%%
[module/date]
type = internal/date
interval = 1
date = %Y-%m-%d %H:%M:%S
format-prefix = "📅 "
; format-prefix = " "
format-prefix-foreground = ${colors.primary}
label =%date%
[module/temperature]
type = internal/temperature
base-temperature = 40
warn-temperature = 80
# format-prefix = " "
# format-warn-prefix = " "
format-prefix = "🌡️"
format-warn-prefix = "🌡️"
format-prefix-foreground = ${colors.accent}
label = %temperature-c%
format-warn = <label>
format-warn-foreground = ${colors.alert}
[module/battery]
type = internal/battery
full-at = 98
time-format = %H:%M
format-charging = <animation-charging> <label-charging>
label-charging = %percentage%% (%time%)
format-discharging = <ramp-capacity> <label-discharging>
label-discharging = %percentage%% (%time%)
format-full = <label-full>
format-full-prefix = "⚡ "
; format-full-prefix = " "
format-full-prefix-foreground = #666
ramp-capacity-0 = ""
ramp-capacity-1 = ""
ramp-capacity-2 = ""
ramp-capacity-3 = ""
ramp-capacity-4 = ""
ramp-capacity-foreground = ${colors.accent}
animation-charging-0 = ""
animation-charging-1 = ""
animation-charging-2 = ""
animation-charging-3 = ""
animation-charging-4 = ""
animation-charging-foreground = ${colors.yellow}
animation-charging-framerate = 750
[module/xwindow]
type = internal/xwindow
format = <label>
label-maxlen = 75
[module/updates]
type = custom/script
interval = 300
exec = "checkupdates 2>/dev/null | wc -l"
format = "<label>"
format-prefix = "📥 "
; format-prefix = " "
format-prefix-foreground = ${colors.accent}
label = %output%
[module/ping]
type = custom/script
interval = 60
exec = "ping -c 3 8.8.8.8 2>/dev/null | tail -1 | awk '{print $4}' | cut -d '/' -f 2 | cut -f1 -d'.'"
format = "<label>"
format-prefix = "📡 "
; format-prefix = " "
format-prefix-foreground = ${colors.accent}
label = %output%
click-left = firefox https://speedtest.net
[module/weather]
type = custom/script
interval = 900
exec = "curl -s wttr.in?format=1"
format = "<label>"
format-prefix-foreground = ${colors.accent}
label = %output%
click-left = xfce4-terminal -H -e "curl wttr.in"
[module/i3]
type = internal/i3
index-sort = true
format = <label-mode>
label-mode = %mode%
format-foreground = ${colors.alert}
[module/tidal]
type=custom/script
interval = 1
; format-prefix="🎵 "
format-prefix=" "
format-prefix-foreground = ${colors.tidal}
format-foreground = ${colors.tidal}
format = "<label>"
label = %output:0:45:...%
exec = "~/.config/i3/scripts/tidal-cli.sh info"
click-left = "~/.config/i3/scripts/tidal-cli.sh playpause"
scroll-up = "~/.config/i3/scripts/tidal-cli.sh next"
scrolldown = "~/.config/i3/scripts/tidal-cli.sh previous"
click-right = "~/.config/i3/scripts/tidal-cli.sh songwhip | xclip -selection clipboard"
[module/pulseaudio-microphone]
type = custom/script
exec = ~/.config/polybar/scripts/pulse-microphone.sh
tail = true
click-left = ~/.config/polybar/scripts/pulse-microphone.sh --toggle &
scroll-up = ~/.config/polybar/scripts/pulse-microphone.sh --increase &
scroll-down = ~/.config/polybar/scripts/pulse-microphone.sh --decrease &

View File

@ -1,6 +1,5 @@
visual-studio-code-bin
i3blocks-contrib
enpass-bin
insync
ttf-font-awesome-4
awesome-terminal-fonts-git
@ -24,3 +23,4 @@ dive
gnome-text-editor
greenclip
kind
pulseaudio-ctl

View File

@ -98,3 +98,8 @@ thunar-archive-plugin
engrampa
bat
ctop
polybar
noto-fonts-emoji
autorandr
papirus-icon-theme
bitwarden

View File

@ -141,7 +141,7 @@ bindsym $mod+shift+b exec /bin/bash ~/.config/i3/scripts/brightness.sh
bindsym control+shift+Escape exec sysmontask
# Rofi
bindsym $mod+d exec "rofi -show run"
bindsym $mod+d exec "rofi -show run -show-icons"
bindsym $mod+Tab exec "rofi -show"
bindsym $mod+s exec "rofi -show ssh"
bindsym $mod+n exec $vpnmanager
@ -207,24 +207,6 @@ bindsym $mod+Shift+g move container to workspace $workspace13
############################################
# Set the default font
font pango:Ubuntu regular 12
# Bar decoration
bar {
status_command i3blocks -c ~/.config/i3/i3blocks.conf
position top
strip_workspace_numbers no
tray_output primary
colors {
separator $textColour
background $primaryBackgroundColour
statusline $statusLineColour
# border background text
focused_workspace $primaryBackgroundColour $primaryBackgroundColour $focusedTextColour
active_workspace $primaryBackgroundColour $secondaryBackgroundColour $textColour
inactive_workspace $primaryBackgroundColour $primaryBackgroundColour $textColour
urgent_workspace $primaryBackgroundColour $primaryBackgroundColour $urgentTextColour
}
}
new_window 1pixel
hide_edge_borders both
@ -235,6 +217,24 @@ client.focused_inactive $secondaryBackgroundColour $secondaryBackgroundColour $
client.unfocused $secondaryBackgroundColour $secondaryBackgroundColour $textColour $indicatorColour
client.urgent $secondaryBackgroundColour $urgentTextBackgroundColour $urgentTextColour $indicatorColour
# Bar decoration (currently using polybar)
# bar {
# status_command i3blocks -c ~/.config/i3/i3blocks.conf
# position top
# strip_workspace_numbers no
# tray_output primary
# colors {
# separator $textColour
# background $primaryBackgroundColour
# statusline $statusLineColour
# # border background text
# focused_workspace $primaryBackgroundColour $primaryBackgroundColour $focusedTextColour
# active_workspace $primaryBackgroundColour $secondaryBackgroundColour $textColour
# inactive_workspace $primaryBackgroundColour $primaryBackgroundColour $textColour
# urgent_workspace $primaryBackgroundColour $primaryBackgroundColour $urgentTextColour
# }
# }
# Floating windows
for_window [class="Pavucontrol"] floating enable
for_window [class="Lxappearance"] floating enable
@ -248,12 +248,13 @@ for_window [class="Sysmontask"] resize set 930 665
# Workspace specific tools #
# Use xprop to determine class #
############################################
# assign [class="Enpass"] $workspace12 # moves all windows... including the browser popup
assign [class="Bitwarden"] $workspace12 # moves all windows... including the browser popup
assign [class="VirtualBox Machine"] $workspace11
# database stuff
assign [class="MongoDB Compass"] $workspace8
assign [class="robo3t"] $workspace8
assign [class="Brave-browser"] $workspace7
assign [class="Mysql-workbench-bin"] $workspace8
assign [class="azuredatastudio"] $workspace8
assign [class="beekeeper"] $workspace8
@ -323,12 +324,14 @@ mode "$mode_gaps_outer" {
# Autorun #
############################################
# exec_always --no-startup-id picom -b
exec_always feh --bg-scale $(find ~/Pictures/wallpapers/ -type f -name "*" | shuf -n 1)
exec_always --no-startup-id ~/.config/polybar/launch.sh
exec_always --no-startup-id "autorandr --change"
exec --no-startup-id i3-msg 'workspace $workspace2; exec xfce4-terminal' && i3-msg 'workspace $workspace1'
exec --no-startup-id i3-msg 'workspace $workspace12; exec enpass'
exec --no-startup-id i3-msg 'workspace $workspace12; exec bitwarden-desktop'
exec --no-startup-id /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
exec --no-startup-id nm-applet
exec --no-startup-id blueman-applet
exec_always feh --bg-scale $(find ~/Pictures/wallpapers/ -type f -name "*" | shuf -n 1)
exec /usr/bin/compton
exec /bin/bash ~/.config/i3/scripts/startup.sh
exec --no-startup-id greenclip daemon

View File

@ -4,12 +4,10 @@
insync start
# Wait for the programs to start then remove attention (e.g red blinking)
sleep 1
wmctrl -r "Enpass" -b remove,demands_attention
# sleep 1
# wmctrl -r "Enpass" -b remove,demands_attention
# Start gkraken if the command exists
if command -v gkraken &> /dev/null
then
if command -v gkraken &>/dev/null; then
gkraken --hide-window &
fi

View File

@ -37,6 +37,14 @@ case $1 in
echo "$INFO"
fi
;;
"songwhip")
JSON=$(httpGet current)
URL=$(echo "$JSON" | jq -r '.url')
WHIPPED_URL="https://songwhip.com$(curl -s -X POST 'https://songwhip.com/api/songwhip/create' -H 'Content-Type: application/json' --data-raw '{"url":"'"$URL"'","country":"NL"}' | jq -r '.data.item.url')"
echo "$WHIPPED_URL"
;;
"status")
if httpGet current | grep "paused" >/dev/null; then
echo "paused"

View File

@ -90,6 +90,7 @@ function install_config {
linkDir "$PWD"/i3 ~/.config/i3
linkDir "$PWD"/config/notify-osd/notify-osd ~/.notify-osd
linkDir "$PWD"/config/terminal/xfce4-term ~/.config/xfce4/terminal
linkDir "$PWD"/config/polybar ~/.config/polybar
# link user files
ln -sf "$PWD"/bash/.bashrc ~/.bashrc
@ -115,6 +116,10 @@ function install_config {
ln -sf "$PWD"/config/pulse/daemon.conf ~/.pulse/daemon.conf
ln -sf "$PWD"/config/picom.conf ~/.config/picom.conf
# link autorandr files
mkdir -p "$HOME/.config/autorandr"
ln -sf "$PWD"/config/autorandr/postswitch ~/.config/autorandr/postswitch
# link system files / directories
sudo ln -sf "$PWD"/config/package-managers/pacman.conf /etc/pacman.conf
sudo ln -sf "$PWD"/config/package-managers/makepkg.conf /etc/makepkg.conf

BIN
media/dotfiles6.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 MiB