From 679808a27a54fa4de0de8f7323dc975b2cccc026 Mon Sep 17 00:00:00 2001 From: Sebastian Schulze Date: Fri, 22 Mar 2019 22:08:57 +0100 Subject: [PATCH] [bin] Refactor bspwm and polybar start for both machines --- home/.config/bspwm/bspwmrc | 12 +++--- home/.config/polybar/config | 82 +++++++++++++++---------------------- home/bin/i3-autostart | 10 ++--- home/bin/i3-polybar | 20 +++++++-- 4 files changed, 60 insertions(+), 64 deletions(-) diff --git a/home/.config/bspwm/bspwmrc b/home/.config/bspwm/bspwmrc index 5f8d81d..9760d64 100755 --- a/home/.config/bspwm/bspwmrc +++ b/home/.config/bspwm/bspwmrc @@ -1,10 +1,12 @@ #! /bin/sh sxhkd & +xrdb -merge ~/.Xresources + if [[ "$HOSTNAME" == "zog"* ]]; then - bspc monitor 0x00400004 -d work web docs media files graphics - bspc monitor 0x00400002 -d comm dump + bspc monitor %DP-2 -d work web docs media files graphics + bspc monitor %DP-3.8 -d comm dump else bspc monitor -d work web comm docs media files graphics dump fi @@ -18,19 +20,15 @@ bspc config gapless_monocle true bspc config border_radius 10 bspc config normal_border_color "#7f8c8d" bspc config active_border_color "#c065db" -bspc config focused_border_color "#edeeeb" +bspc config focused_border_color "#1ABC9C" bspc config presel_feedback_color "#9B59B6" bspc config pointer_follows_monitor true bspc config focus_follows_pointer true bspc config click_to_focus true -# bspc rule -a Gimp desktop='^8' state=floating follow=on bspc rule -a Slack desktop='comm' bspc rule -a Vivaldi desktop='comm' bspc rule -a pcmanfm state=floating -# bspc rule -a mplayer2 state=floating -# bspc rule -a Kupfer.py focus=o -# bspc rule -a Screenkey manage=off i3-autostart & numlockx on diff --git a/home/.config/polybar/config b/home/.config/polybar/config index 774f142..3aab728 100644 --- a/home/.config/polybar/config +++ b/home/.config/polybar/config @@ -10,17 +10,15 @@ alert = #bd2c40 [global/wm] margin-top = 5 margin-bottom = 5 - -[bar/bascht] -monitor = ${env:MONITOR:eDP-1} -width = 100% -height = 30 ;offset-x = 0 ;offset-y = 0 ;override-redirect = true +[section/base] background = ${colors.background} foreground = ${colors.foreground} +width = 100% +height = 30 overline-size = 0 overline-color = #f00 @@ -43,15 +41,26 @@ font-3 = fixed:pixelsize=10;1 font-4 = unifont:fontformat=truetype:size=8:antialias=false;0 font-5 = siji:pixelsize=5;1 + +[bar/secondary] +monitor = ${env:MONITOR:DP-3.8} +inherit = section/base modules-left = ewmh xwindow -modules-center = -modules-right = mpd volume memory wlan eth battery temperature date +; modules-center = +; modules-right = mpd volume memory wlan eth battery temperature date ; wlan eth battery temperature date powermenu +[bar/bascht] +monitor = ${env:MONITOR:eDP1} +monitor-fallback = DP-2 +inherit = section/base +modules-left = ewmh xwindow +modules-center = +modules-right = ${env:BAR_MODULES:mpd volume memory wlan eth battery temperature date} +; wlan eth battery temperature date powermenu tray-position = right tray-padding = 0 -;scroll-up = i3wm-wsnext -;scroll-down = i3wm-wsprev + [module/xwindow] @@ -101,7 +110,7 @@ label-unmounted-foreground = ${colors.foreground-alt} ; label-separator = " " [module/ewmh] -type = internal/i3 +type = ${env:WINDOW_MODULE:internal/bspwm} index-sort = true wrapping-scroll = false strip-wsnumbers = false @@ -109,12 +118,12 @@ pin-workspaces = true enable-click = true inline-mode = false -label-focused = "● %name%" -label-visible = "● v%name%" -label-unfocused = "○ %name%" -label-empty = "○ %name%" -label-occupied = "◍ %name%" -label-urgent = "● %name%" +label-focused = "● %icon%" +label-visible = "● v%icon%" +label-unfocused = "○ %icon%" +label-empty = "○ %icon%" +label-occupied = "◍ %icon%" +label-urgent = "● %icon%" label-separator = " " label-occupied-padding = 1 @@ -274,13 +283,15 @@ animation-packetloss-framerate = 500 [module/eth] type = internal/network -interface = eth0 +interface = ${env:BAR_ETH_INTERFACE:eth0} interval = 10.0 format-connected-underline = #55aa55 -format-connected-prefix = "CC " +format-connected-prefix = " " format-connected-foreground-foreground = ${colors.foreground-alt} -label-connected = %local_ip% + +label-connected = %upspeed% %downspeed% + ;  format-disconnected-underline = ${self.format-connected-underline} label-disconnected = @@ -305,7 +316,7 @@ label = %date% %time% [module/volume] type = internal/pulseaudio format-volume = - +sink = ${env:BAR_PA_SINK} label-muted =  label-muted-foreground = #22 @@ -353,36 +364,11 @@ format-underline = #f50a4d format-warn = format-warn-underline = ${self.format-underline} -label = %temperature% -label-warn = %temperature% +label = %temperature-c% +label-warn = %temperature-c% label-warn-foreground = ${colors.secondary} ramp-0 =  ramp-1 =  ramp-2 =  -ramp-foreground = ${colors.foreground-alt} - -[module/powermenu] -type = custom/menu - -label-open =  power -label-open-foreground = ${colors.secondary} -label-close =  cancel -label-close-foreground = ${colors.secondary} -label-separator = | -label-separator-foreground = ${colors.foreground-alt} - -menu-0-0 = reboot -menu-0-0-exec = menu-open-1 -menu-0-1 = power off -menu-0-1-exec = menu-open-2 - -menu-1-0 = cancel -menu-1-0-exec = menu-open-0 -menu-1-1 = reboot -menu-1-1-exec = sudo reboot - -menu-2-0 = power off -menu-2-0-exec = sudo poweroff -menu-2-1 = cancel -menu-2-1-exec = menu-open-0 +ramp-foreground = ${colors.foreground-alt} \ No newline at end of file diff --git a/home/bin/i3-autostart b/home/bin/i3-autostart index 4bf1cdd..3c0c99b 100755 --- a/home/bin/i3-autostart +++ b/home/bin/i3-autostart @@ -4,17 +4,17 @@ if [[ $HOSTNAME == "zog"* ]]; then xrandr --output DP-3.8 --mode 2560x1440 --pos 0x0 --rotate left --output DVI-I-1 --off --output DP-1 --off --output DP-2 --mode 3440x1440 -r 49.99 --pos 1440x440 --rotate normal --output DP-2-1 --off feh --bg-fill ~/Pictures/Wallpapers/mountains-pale.jpg MONITOR=DP-2 - xinput --set-prop $(xinput |grep -oP "HUGE.*id=\K[0-9]+"|head -n 1) "libinput Natural Scrolling Enabled" 1 else xinput --set-prop $(xinput |grep -oP "TouchPad.*id=\K[0-9]+") "libinput Natural Scrolling Enabled" 1 - xinput set-button-map $(xinput |grep -oP "HUGE.*id=\K[0-9]+"|head -n 1) 1 10 3 4 5 6 7 8 9 2 11 12 - fi; +xinput --set-prop $(xinput |grep -oP "HUGE.*id=\K[0-9]+"|head -n 1) "libinput Natural Scrolling Enabled" 1 +xinput set-button-map $(xinput |grep -oP "HUGE.*id=\K[0-9]+"|head -n 1) 1 10 3 4 5 6 7 8 9 2 11 12 + python ~/.local/lib/python2.7/site-packages/mopidy & killall volumeicon; volumeicon & -kwalletd & -kwalletmanager & +kwalletd5 & +kwalletmanager5 & nm-applet & killall greenclip; greenclip daemon & dunst & diff --git a/home/bin/i3-polybar b/home/bin/i3-polybar index df70e7c..afca663 100755 --- a/home/bin/i3-polybar +++ b/home/bin/i3-polybar @@ -2,9 +2,21 @@ killall -9 polybar -if [[ $HOSTNAME == "zog"* ]]; then - MONITOR=DP-3.8 polybar bascht & - MONITOR=DP-2 polybar bascht & +if [[ $DESKTOP_SESSION == "i3" ]]; then + WINDOW_MODULE="internal/i3" + WS_LABEL="%name%" else - polybar bascht & + WINDOW_MODULE="internal/bspwm" + WS_LABEL="%icon%" fi; +export WINDOW_MODULE +export WS_LABEL + +if [[ $HOSTNAME == "zog"* ]]; then + export BAR_ETH_INTERFACE=eno1 + export BAR_MODULES="mpd volume memory eth temperature date" + export BAR_PA_SINK="alsa_output.pci-0000_00_1b.0.analog-stereo" + polybar secondary & +fi; + +polybar bascht &