From 5207c3555937241d9eb5e441facefcfcd56944c5 Mon Sep 17 00:00:00 2001 From: D4VIDB2 Date: Fri, 1 Oct 2021 21:09:52 +0200 Subject: [PATCH] multimonitor i3 with polybar --- i3/.config/i3/config | 16 ++- nvim/.config/nvim/init.vim | 2 +- polybar/.config/polybar/config | 211 +++++++++++++++++++++++++++++- polybar/.config/polybar/launch.sh | 13 +- 4 files changed, 228 insertions(+), 14 deletions(-) diff --git a/i3/.config/i3/config b/i3/.config/i3/config index c3f93c5..bb2c56d 100644 --- a/i3/.config/i3/config +++ b/i3/.config/i3/config @@ -147,6 +147,12 @@ bindsym $mod+Shift+8 move container to workspace number $ws8 bindsym $mod+Shift+9 move container to workspace number $ws9 bindsym $mod+Shift+0 move container to workspace number $ws10 +# move workspace to another output/monitor +bindsym $mod+Control+Up move workspace to output up +bindsym $mod+Control+Down move workspace to output down +bindsym $mod+Control+Left move workspace to output left +bindsym $mod+Control+Right move workspace to output right + # reload the configuration file bindsym $mod+Shift+c reload # restart i3 inplace (preserves your layout/session, can be used to upgrade i3) @@ -211,12 +217,16 @@ exec_always "xset s noblank" exec_always "xset r rate 280 30" # keyboard key repeat # set touchpad tap to click to Enabled -exec_always "xinput set-prop '06CB0001:00 06CB:7FB4 Touchpad' 333 1" -#exec_always "xinput set-prop '06CB0001:00 06CB:7FB4 Touchpad' 332 1" -#exec_always "xinput set-prop '06CB0001:00 06CB:7FB4 Touchpad' 331 1" +exec_always "xinput set-prop '06CB0001:00 06CB:7FB4 Touchpad' 'libinput Tapping Enabled' 1" +exec_always "xinput set-prop '06CB0001:00 06CB:7FB4 Touchpad' 'libinput Scrolling Pixel Distance' 15" # Setup keyboard layout changing exec_always "setxkbmap -layout us,cz -variant ,qwerty -option 'grp:alt_shift_toggle'" # Policy Kit Agent for GUI apps running as root exec --no-startup-id /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 & + + + +exec --no-startup-id i3-msg 'workspace 1:Web; exec /usr/bin/firefox' +exec --no-startup-id i3-msg 'workspace 2:Discord; exec /usr/bin/discord' diff --git a/nvim/.config/nvim/init.vim b/nvim/.config/nvim/init.vim index 01bd61c..b4efaa2 100644 --- a/nvim/.config/nvim/init.vim +++ b/nvim/.config/nvim/init.vim @@ -288,7 +288,7 @@ augroup omnisharp_commands autocmd FileType cs nmap ossp (omnisharp_stop_server) "autocmd FileType cs nmap :vs | term dotnet run - autocmd FileType cs nmap run :vs:term dotnet run + autocmd FileType cs nmap run :vs:w:term dotnet run augroup END diff --git a/polybar/.config/polybar/config b/polybar/.config/polybar/config index b658e88..0929c02 100644 --- a/polybar/.config/polybar/config +++ b/polybar/.config/polybar/config @@ -27,16 +27,16 @@ primary = #ffb52a secondary = #e60053 alert = #bd2c40 -[bar/mybar] +[bar/primarybar] ; Use either of the following command to list available outputs: ; If unspecified, the application will pick the first one it finds. ; $ polybar -m | cut -d ':' -f 1 ; $ xrandr -q | grep " connected" | cut -d ' ' -f1 ; If no monitor is given, the primary monitor is used if it exists -;monitor = ${env:MONITOR:HDMI-1} +monitor = ${env:MONITOR:eDP1} ; Use the specified monitor as a fallback if the main one is not found. -;monitor-fallback = +; monitor-fallback = ${env:MONITOR:eDP1} ; Require the monitor to be in connected state ; XRandR sometimes reports my monitor as being disconnected (when in use) @@ -62,7 +62,7 @@ bottom = false ; more space. ; When false, the center block is centered in the space between ; the left and right block. -fixed-center = true +fixed-center = false ; Dimension defined as pixel value (e.g. 35) or percentage (e.g. 50%), ; the percentage can optionally be extended with a pixel offset like so: @@ -159,7 +159,7 @@ modules-right = xbacklight alsa pulseaudio cpu memory filesystem temperature wla ; The separator will be inserted between the output of each module ; This has the same properties as a label -separator = +separator = ; Opacity value between 0.0 and 1.0 used on fade in/out dim-value = 1.0 @@ -197,7 +197,7 @@ tray-offset-x = 0 tray-offset-y = 0 ; Pad the sides of each tray icon -tray-padding = 2 +tray-padding = 1 ; Scale factor for tray clients tray-scale = 1.0 @@ -216,6 +216,10 @@ tray-scale = 1.0 cursor-click = pointer cursor-scroll = ns-resize +;end of [bar/mybar] + + + [module/xwindow] type = internal/xwindow label = %title:0:30:...% @@ -265,7 +269,7 @@ index-sort = true wrapping-scroll = false ; Only show workspaces on the same output as the bar -;pin-workspaces = true +pin-workspaces = true label-mode-padding = 2 label-mode-foreground = #000 @@ -569,4 +573,197 @@ screenchange-reload = true margin-top = 5 margin-bottom = 5 + + + +[bar/secondarybar] +; Use either of the following command to list available outputs: +; If unspecified, the application will pick the first one it finds. +; $ polybar -m | cut -d ':' -f 1 +; $ xrandr -q | grep " connected" | cut -d ' ' -f1 +; If no monitor is given, the primary monitor is used if it exists +monitor = ${env:MONITOR:HDMI1} + +; Use the specified monitor as a fallback if the main one is not found. +; monitor-fallback = ${env:MONITOR:eDP1} + +; Require the monitor to be in connected state +; XRandR sometimes reports my monitor as being disconnected (when in use) +monitor-strict = false + +; Use fuzzy matching for monitors (only ignores dashes -) +; Useful when monitors are named differently with different drivers. +monitor-exact = true + +; Tell the Window Manager not to configure the window. +; Use this to detach the bar if your WM is locking its size/position. +; Note: With this most WMs will no longer reserve space for +; the bar and it will overlap other windows. You need to configure +; your WM to add a gap where the bar will be placed. +override-redirect = false + +; Put the bar at the bottom of the screen +bottom = false + +; Prefer fixed center position for the `modules-center` block. +; The center block will stay in the middle of the bar whenever +; possible. It can still be pushed around if other blocks need +; more space. +; When false, the center block is centered in the space between +; the left and right block. +fixed-center = false + +; Dimension defined as pixel value (e.g. 35) or percentage (e.g. 50%), +; the percentage can optionally be extended with a pixel offset like so: +; 50%:-10, this will result in a width or height of 50% minus 10 pixels +width = 100% +height = 27 + +; Offset defined as pixel value (e.g. 35) or percentage (e.g. 50%) +; the percentage can optionally be extended with a pixel offset like so: +; 50%:-10, this will result in an offset in the x or y direction +; of 50% minus 10 pixels +;offset-x = 1% +;offset-y = 1% + +; Background ARGB color (e.g. #f00, #ff992a, #ddff1023) +background = ${colors.background} + +; Foreground ARGB color (e.g. #f00, #ff992a, #ddff1023) +foreground = ${colors.foreground} + +; Background gradient (vertical steps) +; background-[0-9]+ = #aarrggbb +background-0 = + +; Value used for drawing rounded corners +; Note: This shouldn't be used together with border-size because the border +; doesn't get rounded. For this to work you may also need to enable +; pseudo-transparency or use a compositor like compton. +; Individual values can be defined using: +; radius-{top,bottom} +; or +; radius-{top,bottom}-{left,right} (unreleased) +; Polybar always uses the most specific radius definition for each corner. +radius = 0.0 + +; Under-/overline pixel size and argb color +; Individual values can be defined using: +; {overline,underline}-size +; {overline,underline}-color +line-size = 3 +line-color = #f00 + +; Values applied to all borders +; Individual side values can be defined using: +; border-{left,top,right,bottom}-size +; border-{left,top,right,bottom}-color +; The top and bottom borders are added to the bar height, so the effective +; window height is: +; height + border-top-size + border-bottom-size +; Meanwhile the effective window width is defined entirely by the width key and +; the border is placed within this area. So you effectively only have the +; following horizontal space on the bar: +; width - border-right-size - border-left-size +; border-size can be defined as pixel value (e.g. 35) or percentage (e.g. 50%), +; the percentage can optionally be extended with a pixel offset like so: +; 50%:-10, this will result in 50% minus 10 pixels. The percentage is relative +; to the monitor width or height depending on the border direction. +border-size = 0 +border-color = #00000000 + +; Number of spaces to add at the beginning/end of the bar +; Individual side values can be defined using: +; padding-{left,right} +;padding = 0 +padding-left = 0 +padding-right = 4 + +; Number of spaces to add before/after each module +; Individual side values can be defined using: +; module-margin-{left,right} +;module-margin = 0 +module-margin-left = 1 +module-margin-right = 1 + +; Fonts are defined using ; +; Font names are specified using a fontconfig pattern. +; font-0 = NotoSans-Regular:size=8;2 +; font-1 = MaterialIcons:size=10 +; font-2 = Termsynu:size=8;-1 +; font-3 = FontAwesome:size=10 +; See the Fonts wiki page for more details +font-0 = Verdana:pixelsize=10;1 +font-1 = unifont:fontformat=truetype:size=8:antialias=false;0 +font-2 = siji:pixelsize=10;1 +;font-3 = FontAwesome:size=10;1 + +; Modules are added to one of the available blocks +; modules-left = cpu ram +; modules-center = xwindow xbacklight +; modules-right = ipc clock +modules-left = bspwm i3 +modules-center = +; modules-right = xbacklight alsa pulseaudio cpu memory filesystem temperature wlan eth battery xkeyboard date +modules-right = date + +; The separator will be inserted between the output of each module +; This has the same properties as a label +separator = + +; Opacity value between 0.0 and 1.0 used on fade in/out +dim-value = 1.0 + +; Locale used to localize various module data (e.g. date) +; Expects a valid libc locale, for example: sv_SE.UTF-8 +locale = cs_CZ.UTF-8 + +; Position of the system tray window +; If empty or undefined, tray support will be disabled +; NOTE: A center aligned tray will cover center aligned modules +; +; Available positions: +; left +; center +; right +; none +tray-position = center + +; If true, the bar will not shift its +; contents when the tray changes +tray-detached = false + + +tray-maxsize = 16 + +; Background color for the tray container +; ARGB color (e.g. #f00, #ff992a, #ddff1023) +; By default the tray container will use the bar +; background color. +tray-background = ${root.background} + +; Tray offset defined as pixel value (e.g. 35) or percentage (e.g. 50%) +tray-offset-x = 0 +tray-offset-y = 0 + +; Pad the sides of each tray icon +tray-padding = 1 + +; Scale factor for tray clients +tray-scale = 1.0 + +;wm-restack = bspwm +;wm-restack = i3 + +;override-redirect = true + +;scroll-up = bspwm-desknext +;scroll-down = bspwm-deskprev + +;scroll-up = i3wm-wsnext +;scroll-down = i3wm-wsprev + +cursor-click = pointer +cursor-scroll = ns-resize + ; vim:ft=dosini diff --git a/polybar/.config/polybar/launch.sh b/polybar/.config/polybar/launch.sh index e80c184..588702b 100755 --- a/polybar/.config/polybar/launch.sh +++ b/polybar/.config/polybar/launch.sh @@ -5,8 +5,15 @@ killall -q polybar # If all your bars have ipc enabled, you can also use # polybar-msg cmd quit -# Launch bar1 and bar2 -echo "---" | tee -a /tmp/polybar.log -polybar mybar 2>&1 | tee -a /tmp/polybar.log & disown +#echo "---" | tee -a /tmp/polybar.log + +#for MON in $(xrandr -q | grep " connected" | cut -d ' ' -f1); do + #MONITOR=$MON polybar mybar 2>&1 | tee -a "/tmp/polybar$MON.log" & disown +#done + +#MONITOR="eDP1" polybar mybar 2>&1 | tee -a "/tmp/polybar.log" & disown + +polybar primarybar 2>&1 | tee -a "/tmp/polybar.log" & disown +polybar secondarybar 2>&1 | tee -a "/tmp/polybarHDMI.log" & disown echo "Bars launched..."