From 56af90de632262988184bd1c7eee74462918eeea Mon Sep 17 00:00:00 2001 From: Fabio Scotto di Santolo Date: Thu, 4 Sep 2025 00:02:37 +0200 Subject: [PATCH] Setting Polybar --- i3/.config/i3/config | 22 +- i3/.config/polybar/config.ini | 313 ++++++------ i3/.config/polybar/launch.sh | 2 +- i3/.config/polybar/modules.ini | 457 ++++++++++++++++++ .../polybar/scripts/get_spotify_status.sh | 51 ++ i3/.config/polybar/scripts/launch.sh | 65 +++ .../polybar/scripts/scroll_spotify_status.sh | 13 + 7 files changed, 766 insertions(+), 157 deletions(-) create mode 100644 i3/.config/polybar/modules.ini create mode 100755 i3/.config/polybar/scripts/get_spotify_status.sh create mode 100644 i3/.config/polybar/scripts/launch.sh create mode 100755 i3/.config/polybar/scripts/scroll_spotify_status.sh diff --git a/i3/.config/i3/config b/i3/.config/i3/config index 0affc47..69b95b8 100644 --- a/i3/.config/i3/config +++ b/i3/.config/i3/config @@ -80,12 +80,12 @@ exec --no-startup-id /usr/lib/policykit-1-gnome/polkit-gnome-authentication-agen # Use pactl to adjust volume in PulseAudio. set $refresh_i3status killall -SIGUSR1 i3status -bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% && $refresh_i3status -bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10% && $refresh_i3status -bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status -bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_i3status -# bindsym XF86MonBrightnessUp exec --no-startup-id swayosd-client --brightness +5 -# bindsym XF86MonBrightnessDown exec --no-startup-id swayosd-client --brightness -5 +bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +5% # && $refresh_i3status +bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -5% # && $refresh_i3status +bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle # && $refresh_i3status +bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle # && $refresh_i3status +bindsym XF86MonBrightnessUp exec --no-startup-id brightnessctl set +5% +bindsym XF86MonBrightnessDown exec --no-startup-id brightnessctl set 5%- bindsym $mod+Mod1+l exec ~/.config/i3/scripts/lockscreen.sh # use these keys for focus, movement, and resize directions when reaching for @@ -300,19 +300,19 @@ bindsym $mod+r mode "resize" # exec i3-config-wizard ### Apply wallpaper -exec feh --bg-scale ~/.config/i3/wallpaper.jpg +exec_always feh --bg-scale ~/.config/i3/wallpaper.jpg ### Run status bar -exec ~/.config/polybar/launch.sh +exec_always ~/.config/polybar/launch.sh ### Run in background X11 compositor -exec picom --config ~/.config/picom/picom.conf +exec_always picom --config ~/.config/picom/picom.conf ### Run in background notification daemon -exec $notification +exec_always $notification ### Enable autolock -exec xautolock -time 5 -locker ~/.config/i3/scripts/lockscreen.sh -detectsleep +exec_always xautolock -time 5 -locker ~/.config/i3/scripts/lockscreen.sh -detectsleep ### Screenshot tool exec flameshot diff --git a/i3/.config/polybar/config.ini b/i3/.config/polybar/config.ini index 7a20631..5565acd 100644 --- a/i3/.config/polybar/config.ini +++ b/i3/.config/polybar/config.ini @@ -1,6 +1,5 @@ ;========================================================== ; -; ; ██████╗ ██████╗ ██╗ ██╗ ██╗██████╗ █████╗ ██████╗ ; ██╔══██╗██╔═══██╗██║ ╚██╗ ██╔╝██╔══██╗██╔══██╗██╔══██╗ ; ██████╔╝██║ ██║██║ ╚████╔╝ ██████╔╝███████║██████╔╝ @@ -9,179 +8,203 @@ ; ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ; ; -; To learn more about how to configure Polybar -; go to https://github.com/polybar/polybar +; To learn more about how to configure Polybar +; go to https://github.com/polybar/polybar ; -; The README contains a lot of information +; The README contains a lot of information ; ;========================================================== [global/wm] include-file = $HOME/.config/polybar/themes/mocha.ini +include-file = $HOME/.config/polybar/modules.ini +margin-top = 0 +margin-bottom = 0 -[colors] +; FIXME remove radius on left and right borders +[bar/mainbar] +; monitor = eDP-1 ; xrandr --query | grep " connected" +; monitor = ${env:POLYBAR_MONITOR:} + +; Require the monitor to be in connected state +; XRandR sometimes reports my monitor as being disconnected (when in use) +monitor-strict = false + +; Tell the Window Manager not to configure the window. +; Use this to detach the bar if your WM is locking its size/position. +override-redirect = false + +; Put the bar at the bottom of the screen +bottom = false + +; Prefer fixed center position for the `modules-center` block +; +; When false, the center position will be based on the size of the other blocks. +fixed-center = true + +; 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 = 0% +offset-y = 0% + +; Background ARGB color (e.g. #f00, #ff992a, #ddff1023) background = ${colors.base} -background-alt = ${colors.mantle} + +; Foreground ARGB color (e.g. #f00, #ff992a, #ddff1023) foreground = ${colors.text} -primary = ${colors.blue} -secondary = ${colors.sapphire} -alert = ${colors.red} -disabled = ${colors.crust} -[bar/mybar] +; Dimension defined as pixel value (e.g. 35) or percentage (e.g. 50%), +; 50%:-10, this will result in a width or height of 50% minus 10 pixels +; the percentage can optionally be extended with a pixel offset like so: width = 100% -height = 28pt -radius = 6 +height = 26pt -; dpi = 96 +; Value used for drawing rounded corners +; Note: This shouldn't be used together with border-size because the border +; doesn't get rounded +; Individual top/bottom values can be defined using: +; radius-{top,bottom} +radius-top = 0 +radius-bottom = 0.0 -background = ${colors.background} -foreground = ${colors.foreground} +; Under-/overline pixel size and argb color +; Individual values can be defined using: +; {overline,underline}-size +; {overline,underline}-color +underline-size = 2 +underline-color = ${color.foreground} -line-size = 3pt - -border-size = 4pt -border-color = #00000000 +; 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 withing this area. So you effectively only have the +; following horizontal space on the bar: +; width - border-right-size - border-left-size +border-size = 0 +border-color = ${colors.base} +; Number of spaces to add at the beginning/end of the bar +; Individual side values can be defined using: +; padding-{left,right} padding-left = 0 padding-right = 0 +; Number of spaces to add before/after each module +; Individual side values can be defined using: +; module-margin-{left,right} +;module-margin-left = 0 +;module-margin-right = 0 module-margin = 1 +; The separator will be inserted between the output of each module separator = | -separator-foreground = ${colors.disabled} +separator-foreground = ${colors.crust} -font-0 = ComicShannsMono Nerd Font;2 +; 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 = "JetBrainsMono Nerd Font:size=12;2" -modules-left = xworkspaces xwindow -modules-right = filesystem pulseaudio memory cpu xkeyboard date systray +; Modules are added to one of the available blocks +; modules-center = xwindow xbacklight +; modules-right = ipc clock +modules-left = xworkspaces +modules-center = +modules-right = spotify filesystem memory cpu pulseaudio backlight battery xkeyboard date systray -cursor-click = pointer -cursor-scroll = ns-resize +; Value to be used to set the WM_NAME atom +; If the value is empty or undefined, the atom value +; will be created from the following template: polybar-[BAR]_[MONITOR] +; NOTE: The placeholders are not available for custom values +;wm-name = +; Locale used to localize various module data (e.g. date) +; Expects a valid libc locale, for example: sv_SE.UTF-8 +;locale = + +; 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 = none + +; If true, the bar will not shift its +; contents when the tray changes +tray-detached = false + +; Tray icon max size +tray-maxsize = 20 + +; 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 = ${color.base} + +; 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 = 0 + +; Scale factor for tray clients +tray-scale = 0.5 + +; Restack the bar window and put it above the +; selected window manager's root +; +; Fixes the issue where the bar is being drawn +; on top of fullscreen window's +; +; Currently supported WM's: +; bspwm +; i3 (requires: `override-redirect = true`) +wm-restack = i3 + +; Set a DPI values used when rendering text +; This only affects scalable fonts +; dpi = + +; Enable support for inter-process messaging +; See the Messaging wiki page for more details. enable-ipc = true -; wm-restack = generic -; wm-restack = bspwm -; wm-restack = i3 +; Fallback click handlers that will be called if +; there's no matching module handler found. +click-left = +click-middle = +click-right = +scroll-up = +scroll-down = +double-click-left = +double-click-middle = +double-click-right = -; override-redirect = true - -; This module is not active by default (to enable it, add it to one of the -; modules-* list above). -; Please note that only a single tray can exist at any time. If you launch -; multiple bars with this module, only a single one will show it, the others -; will produce a warning. Which bar gets the module is timing dependent and can -; be quite random. -; For more information, see the documentation page for this module: -; https://polybar.readthedocs.io/en/stable/user/modules/tray.html -[module/systray] -type = internal/tray - -format-margin = 8pt -tray-spacing = 16pt - -[module/xworkspaces] -type = internal/xworkspaces - -label-active = %name% -label-active-background = ${colors.background-alt} -label-active-underline= ${colors.primary} -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/xwindow] -type = internal/xwindow -label = %title:0:60:...% - -[module/filesystem] -type = internal/fs -interval = 25 - -mount-0 = / - -label-mounted = %{F#F0C674}%mountpoint%%{F-} %percentage_used%% - -label-unmounted = %mountpoint% not mounted -label-unmounted-foreground = ${colors.disabled} - -[module/pulseaudio] -type = internal/pulseaudio - -format-volume-prefix = "VOL " -format-volume-prefix-foreground = ${colors.primary} -format-volume = - -label-volume = %percentage%% - -label-muted = muted -label-muted-foreground = ${colors.disabled} - -[module/xkeyboard] -type = internal/xkeyboard -blacklist-0 = num lock - -label-layout = %layout% -label-layout-foreground = ${colors.primary} - -label-indicator-padding = 2 -label-indicator-margin = 1 -label-indicator-foreground = ${colors.background} -label-indicator-background = ${colors.secondary} - -[module/memory] -type = internal/memory -interval = 2 -format-prefix = "RAM " -format-prefix-foreground = ${colors.primary} -label = %percentage_used:2%% - -[module/cpu] -type = internal/cpu -interval = 2 -format-prefix = "CPU " -format-prefix-foreground = ${colors.primary} -label = %percentage:2%% - -[network-base] -type = internal/network -interval = 5 -format-connected = -format-disconnected = -label-disconnected = %{F#F0C674}%ifname%%{F#707880} disconnected - -[module/wlan] -inherit = network-base -interface-type = wireless -label-connected = %{F#F0C674}%ifname%%{F-} %essid% %local_ip% - -[module/eth] -inherit = network-base -interface-type = wired -label-connected = %{F#F0C674}%ifname%%{F-} %local_ip% - -[module/date] -type = internal/date -interval = 1 - -date = %H:%M -date-alt = %Y-%m-%d %H:%M:%S - -label = %date% -label-foreground = ${colors.primary} +; Requires polybar to be built with xcursor support (xcb-util-cursor) +; Possible values are: +; - default : The default pointer as before, can also be an empty string (default) +; - pointer : Typically in the form of a hand +; - ns-resize : Up and down arrows, can be used to indicate scrolling +cursor-click = pointer +cursor-scroll = ns-resize [settings] screenchange-reload = true pseudo-transparency = true - -; vim:ft=dosini diff --git a/i3/.config/polybar/launch.sh b/i3/.config/polybar/launch.sh index 3bb3dac..26e1e8c 100755 --- a/i3/.config/polybar/launch.sh +++ b/i3/.config/polybar/launch.sh @@ -8,6 +8,6 @@ polybar-msg cmd quit # Launch barxs echo "---" | tee -a /tmp/polybar-mybar.log -polybar mybar 2>&1 | tee -a /tmp/polybar-mybar.log & disown +polybar mainbar 2>&1 | tee -a /tmp/polybar-mybar.log & disown echo "Bars launched..." diff --git a/i3/.config/polybar/modules.ini b/i3/.config/polybar/modules.ini new file mode 100644 index 0000000..b289266 --- /dev/null +++ b/i3/.config/polybar/modules.ini @@ -0,0 +1,457 @@ +; FIXME adapt systray icons to other status bar icons +[module/systray] +type = internal/tray +format-margin = 8pt +tray-spacing = 14pt + +[module/xworkspaces] +type = internal/xworkspaces +label-active = %name% +label-active-background = ${colors.mantle} +label-active-foreground = ${colors.mauve} +label-active-underline= ${colors.mauve} +label-active-padding = 1 +label-occupied = %name% +label-occupied-padding = 1 +label-urgent = %name% +label-urgent-background = ${colors.red} +label-urgent-padding = 1 +label-empty = %name% +label-empty-foreground = ${colors.crust} +label-empty-padding = 1 + +[module/xwindow] +type = internal/xwindow +label = %title:0:60:...% + +[module/filesystem] +type = internal/fs +interval = 25 +mount-0 = / +mount-1 = /home +label-mounted = %{F#F2CDCD}%mountpoint%%{F-} %percentage_used%% +label-unmounted = %mountpoint% not mounted +label-unmounted-foreground = ${colors.crust} + +[module/pulseaudio] +type = internal/pulseaudio + +;format-volume-prefix = "VOL " +;format-volume-prefix-foreground = ${colors.blue} + +format-volume = +label-volume = %percentage%% +ramp-volume-foreground = ${colors.rosewater} + +format-muted = +label-muted =  %percentage%% +ramp-muted-foreground = ${colors.red} + +ramp-volume-0 =  +ramp-volume-1 =  +ramp-volume-2 =  + +[module/xkeyboard] +type = internal/xkeyboard +blacklist-0 = num lock +label-layout = %layout% +label-layout-foreground = ${colors.maroon} +label-indicator-padding = 2 +label-indicator-margin = 1 +label-indicator-foreground = ${colors.base} +label-indicator-background = ${colors.peach} + +[module/memory] +type = internal/memory +interval = 2 +format-prefix = " " +format-prefix-foreground = ${colors.teal} +label = %percentage_used:2%% + +[module/cpu] +type = internal/cpu +interval = 2 +format-prefix = " " +format-prefix-foreground = ${colors.pink} +label = %percentage:2%% + +[network-base] +type = internal/network +interval = 5 +format-connected = +format-disconnected = +label-disconnected = %{F#F0C674}%ifname%%{F#707880} disconnected + +[module/wlan] +inherit = network-base +interface-type = wireless +label-connected = %{F#F0C674}%ifname%%{F-} %essid% %local_ip% + +[module/eth] +inherit = network-base +interface-type = wired +label-connected = %{F#F0C674}%ifname%%{F-} %local_ip% + +[module/date] +type = internal/date +interval = 1 +date = %H:%M +date-alt = %Y-%m-%d %H:%M:%S +label = %date% +;label-foreground = ${colors.blue} + +[module/battery] +type = internal/battery + +; This is useful in case the battery never reports 100% charge +; Default: 100 +full-at = 100 + +; format-low once this charge percentage is reached +; Default: 10 +; New in version 3.6.0 +low-at = 20 + +; Use the following command to list batteries and adapters: +; $ ls -1 /sys/class/power_supply/ +battery = BAT0 +adapter = ADP1 + +; If an inotify event haven't been reported in this many +; seconds, manually poll for new values. +; +; Needed as a fallback for systems that don't report events +; on sysfs/procfs. +; +; Disable polling by setting the interval to 0. +; +; Default: 5 +poll-interval = 5 + +; see "man date" for details on how to format the time string +; NOTE: if you want to use syntax tags here you need to use %%{...} +; Default: %H:%M:%S +time-format = %H:%M + +; Available tags: +; (default) +; +; +; +format-charging = +animation-charging-foreground = ${colors.green} + +; Available tags: +; (default) +; +; +; +format-discharging = +ramp-capacity-foreground = ${colors.yellow} + +; Available tags: +; (default) +; +; +format-full = +format-full-foreground = ${colors.green} + +; Format used when battery level drops to low-at +; If not defined, format-discharging is used instead. +; Available tags: +; +; +; +; +; New in version 3.6.0 +format-low = +format-low-foreground = ${colors.red} + +; Available tokens: +; %percentage% (default) - is set to 100 if full-at is reached +; %percentage_raw% +; %time% +; %consumption% (shows current charge rate in watts) +;label-charging = Charging %percentage%% + +; Available tokens: +; %percentage% (default) - is set to 100 if full-at is reached +; %percentage_raw% +; %time% +; %consumption% (shows current discharge rate in watts) +;label-discharging = Discharging %percentage%% + +; Available tokens: +; %percentage% (default) - is set to 100 if full-at is reached +; %percentage_raw% +;label-full = Fully charged + +; Available tokens: +; %percentage% (default) - is set to 100 if full-at is reached +; %percentage_raw% +; %time% +; %consumption% (shows current discharge rate in watts) +; New in version 3.6.0 +; label-low = BATTERY LOW + +; Only applies if is used +ramp-capacity-0 =  +ramp-capacity-1 =  +ramp-capacity-2 =  +ramp-capacity-3 =  +ramp-capacity-4 =  + +; Only applies if is used +bar-capacity-width = 10 + +; Only applies if is used +animation-charging-0 =  +animation-charging-1 =  +animation-charging-2 =  +animation-charging-3 =  +animation-charging-4 =  +; Framerate in milliseconds +animation-charging-framerate = 750 + +; Only applies if is used +animation-discharging-0 =  +animation-discharging-1 =  +animation-discharging-2 =  +animation-discharging-3 =  +animation-discharging-4 =  +; Framerate in milliseconds +animation-discharging-framerate = 500 + +; Only applies if is used +; New in version 3.6.0 +animation-low-0 = ! +animation-low-1 = +animation-low-framerate = 200 + +[module/backlight] +type = internal/backlight + +; Use the following command to list available cards: +; $ ls -1 /sys/class/backlight/ +; Default: first usable card in /sys/class/backlight (new in version 3.7.0) +card = intel_backlight + +; Use the `/sys/class/backlight/.../actual-brightness` file +; rather than the regular `brightness` file. +; New in version 3.6.0 +; Changed in version: 3.7.0: Defaults to true also on amdgpu backlights +; Default: true +use-actual-brightness = true + +; Interval in seconds after which after which the current brightness is read +; (even if no update is detected). +; Use this as a fallback if brightness updates are not registering in polybar +; (which happens if the use-actual-brightness is false). +; There is no guarantee on the precisio of this timing. +; Set to 0 to turn off +; New in version 3.7.0 +; Default: 0 (5 if use-actual-brightness is false) +poll-interval = 0 + +; Enable changing the backlight with the scroll wheel +; NOTE: This may require additional configuration on some systems. Polybar will +; write to `/sys/class/backlight/${self.card}/brightness` which requires polybar +; to have write access to that file. +; DO NOT RUN POLYBAR AS ROOT. +; The recommended way is to add the user to the +; `video` group and give that group write-privileges for the `brightness` file. +; See the ArchWiki for more information: +; https://wiki.archlinux.org/index.php/Backlight#ACPI +; Default: false +enable-scroll = true + +; Interval for changing the brightness (in percentage points). +; New in version 3.7.0 +; Default: 5 +scroll-interval = 10 + +; Available tags: +;