diff --git a/i3/i3.nix b/i3/i3.nix index d9a5dce..e2af6ec 100644 --- a/i3/i3.nix +++ b/i3/i3.nix @@ -5,13 +5,13 @@ haskellPackages, polybar, procps, with_lock ? true, compton_name ? "default"}: let + kill-and-then = kill: thn: +''exec_always --no-startup-id "pkill ${kill}; while pgrep -x ${kill} >/dev/null; do sleep 1; done; ${thn}"''; kill-and-restart = pkg: as: with lib; let name = head (splitString " " as); args = concatStringsSep " " (tail (splitString " " as)); -in -''exec_always --no-startup-id "pkill ${name}; while pgrep -x ${name} >/dev/null; do sleep 1; done; exec ${pkg}/bin/${name} ${args}" -''; +in kill-and-then name "exec ${pkg}/bin/${name} ${args}"; locker = writeScript "dlock.sh" '' #!/bin/sh revert() { @@ -170,7 +170,7 @@ ${kill-and-restart compton-git "compton --config /home/yorick/dotfiles/x/compton '' + (lib.optionalString with_lock '' ${kill-and-restart xorg.xf86inputsynaptics "syndaemon -i 0.5 -k -t"} -${kill-and-restart polybar "polybar -c /home/yorick/dotfiles/i3/polybar $(hostname)"} +${kill-and-then "polybar" "PATH=${polybar}/bin:$PATH /home/yorick/dotfiles/i3/polybar.sh"} ${kill-and-restart xss-lock "xss-lock -l -- ${locker}"} ${kill-and-restart libinput-gestures "libinput-gestures"} ${kill-and-restart haskellPackages.arbtt "arbtt-capture"} diff --git a/i3/polybar b/i3/polybar index ab4082c..a206fe2 100644 --- a/i3/polybar +++ b/i3/polybar @@ -18,23 +18,76 @@ primary = #ffb52a secondary = #e60053 alert = #bd2c40 -[bar/jarvis] +[bar/common] +monitor = ${env:MONITOR:} +width = 100% +fixed-center = true + +height = 20 +radius = 6.0 + +background = ${colors.background} +foreground = ${colors.foreground} + +scroll-up = i3wm-wsnext +scroll-down = i3wm-wsprev + +font-0 = FontAwesome:size=10;1 +font-1 = FiraMono:size=10;0 + + + +;tray-padding = 2 +tray-scale = 1.0 +;tray-transparent = true +tray-background = ${colors.background} + +;override-redirect = true + + +line-size = 3 +line-color = #f00 + +border-size = 4 +border-color = #00000000 + +padding-left = 0 +padding-right = 2 + +module-margin-left = 1 +module-margin-right = 2 + + +[bar/ascanius_primary] +inherit = bar/common + +modules-left = i3 xwindow +modules-center = +modules-right = spotify filesystem volume eth memory battery temperature date + + +tray-position = right + +[bar/ascanius_other] +inherit = bar/common + +modules-left = i3 xwindow +modules-center = +modules-right = date + +; jarvis: retina screen +[bar/jarvis_primary] +inherit = bar/common monitor = eDP-1 width = 100% height = 40 ;offset-x = 1% ;offset-y = 1% radius = 6.0 -fixed-center = true - -background = ${colors.background} -foreground = ${colors.foreground} line-size = 6 -line-color = #f00 border-size = 4 -border-color = #00000000 padding-left = 0 padding-right = 2 @@ -53,16 +106,9 @@ modules-right = spotify filesystem volume backlight-acpi wlan battery temperatur tray-position = right tray-padding = 2 tray-scale = 1.0 -;tray-transparent = true -;tray-background = #0063ff -;wm-restack = bspwm -;wm-restack = i3 -;override-redirect = true - -scroll-up = i3wm-wsnext -scroll-down = i3wm-wsprev +; modules [module/xwindow] type = internal/xwindow @@ -94,25 +140,6 @@ label-mounted = %{F#0a81f5}%mountpoint%%{F-}: %percentage_used%% label-unmounted = %mountpoint% not mounted label-unmounted-foreground = ${colors.foreground-alt} -[module/bspwm] -type = internal/bspwm - -label-focused = %index% -label-focused-background = ${colors.background-alt} -label-focused-underline= ${colors.primary} -label-focused-padding = 2 - -label-occupied = %index% -label-occupied-padding = 2 - -label-urgent = %index%! -label-urgent-background = ${colors.alert} -label-urgent-padding = 2 - -label-empty = %index% -label-empty-foreground = ${colors.foreground-alt} -label-empty-padding = 2 - [module/i3] type = internal/i3 format = @@ -120,7 +147,7 @@ index-sort = true wrapping-scroll = false ;strip-wsnumbers = true ; Only show workspaces on the same output as the bar -;pin-workspaces = true +pin-workspaces = true label-mode-padding = 2 label-mode-foreground = #000 @@ -128,24 +155,24 @@ label-mode-background = ${colors.primary} ; focused = Active workspace on focused monitor label-focused = %index% %icon% -label-focused-background = ${module/bspwm.label-focused-background} -label-focused-underline = ${module/bspwm.label-focused-underline} -label-focused-padding = ${module/bspwm.label-focused-padding} +label-focused-background = ${colors.background-alt} +label-focused-underline= ${colors.primary} +label-focused-padding = 2 ; unfocused = Inactive workspace on any monitor label-unfocused = %index% %icon% -label-unfocused-padding = ${module/bspwm.label-occupied-padding} +label-unfocused-padding = 2 ; visible = Active workspace on unfocused monitor -label-visible = %index% %icon% +label-visible = %index% %icon% label-visible-background = ${self.label-focused-background} label-visible-underline = ${self.label-focused-underline} label-visible-padding = ${self.label-focused-padding} ; urgent = Workspace with urgency hint set -label-urgent = %index% %icon% -label-urgent-background = ${module/bspwm.label-urgent-background} -label-urgent-padding = ${module/bspwm.label-urgent-padding} +label-urgent = %index% %icon% +label-urgent-background = ${colors.alert} +label-urgent-padding = 2 ws-icon-0 = 1; ws-icon-1 = 2; @@ -155,18 +182,6 @@ ws-icon-3 = 6; ws-icon-4 = 7; ; ; -[module/mpd] -type = internal/mpd -format-online = - -icon-prev =  -icon-stop =  -icon-play =  -icon-pause =  -icon-next =  - -label-song-maxlen = 25 -label-song-ellipsis = true [module/xbacklight] type = internal/xbacklight @@ -236,11 +251,11 @@ ramp-signal-foreground = ${colors.foreground-alt} [module/eth] type = internal/network -interface = net0 +interface = eth0 interval = 3.0 format-connected-underline = #55aa55 -format-connected-prefix = " " +format-connected-prefix = " " format-connected-prefix-foreground = ${colors.foreground-alt} label-connected = %local_ip% diff --git a/i3/polybar.sh b/i3/polybar.sh new file mode 100755 index 0000000..61c588a --- /dev/null +++ b/i3/polybar.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +for m in $(xrandr --listactivemonitors | grep ": +" | cut -d " " -f 3 -); do + MONITOR=$(echo $m | tr -d +*) polybar -c ~/dotfiles/i3/polybar $(hostname)_$(echo $m | grep -q "*" && echo primary || echo other) & +done diff --git a/i3/spotify.sh b/i3/spotify.sh index 0eb3fc8..deaeac6 100755 --- a/i3/spotify.sh +++ b/i3/spotify.sh @@ -12,6 +12,8 @@ spotify_control(){ then echo "%{F#FF1DB954}%{A:i3-msg [class=Spotify] focus:}%{A}%{F-} %{A:playerctl -p spotify previous:}  %{A}%{A:playerctl -p spotify play-pause:} $(spotify_status) %{A}%{A:playerctl -p spotify next:}  %{A}" elif echo $current_status | grep -q "Paused" then echo "%{F#FF1DB954}%{A:i3-msg [class=Spotify] focus:}%{A}%{F-} %{A:playerctl -p spotify previous:}  %{A}%{A:playerctl -p spotify play-pause:}  $(spotify_status) %{A}%{A:playerctl -p spotify next:}  %{A}" + else + echo "" fi }