From 5d8731834e2db5b42fc60928d0ed2779ebb679ec Mon Sep 17 00:00:00 2001 From: Daryl Ronningen Date: Sat, 9 Jul 2022 11:46:03 -0700 Subject: [PATCH] dotfiles update --- .../bspwm/bspwm_window_titles_icon_map.txt | 1 + .config/bspwm/bspwmrc | 5 +- .config/bspwm/windows.sh | 158 +++++++++++++++ .config/picom/picom.conf | 185 ++++++++---------- .config/polybar/{config => config.ini} | 41 ++-- .config/polybar/launch.sh | 19 +- .xinitrc | 2 +- pipewire-media/PKGBUILD | 77 ++++++++ 8 files changed, 364 insertions(+), 124 deletions(-) create mode 100644 .config/bspwm/bspwm_window_titles_icon_map.txt create mode 100755 .config/bspwm/windows.sh rename .config/polybar/{config => config.ini} (89%) create mode 100644 pipewire-media/PKGBUILD diff --git a/.config/bspwm/bspwm_window_titles_icon_map.txt b/.config/bspwm/bspwm_window_titles_icon_map.txt new file mode 100644 index 0000000..1d76483 --- /dev/null +++ b/.config/bspwm/bspwm_window_titles_icon_map.txt @@ -0,0 +1 @@ +Fallback · diff --git a/.config/bspwm/bspwmrc b/.config/bspwm/bspwmrc index 1e3762a..a8598a3 100755 --- a/.config/bspwm/bspwmrc +++ b/.config/bspwm/bspwmrc @@ -9,10 +9,13 @@ pgrep -x polkit-gnome-au > /dev/null || /usr/lib/polkit-gnome/polkit-gnome-authe feh --bg-fill --randomize $HOME/backgrounds/* /usr/share/backgrounds/* & pgrep -x pasystray > /dev/null || pasystray & pgrep -x xscreensaver > /dev/null || xscreensaver -no-splash & -pgrep -x picom > /dev/null || picom --config $HOME/.config/picom/picom.conf & +pgrep -x picom > /dev/null || picom --config $HOME/.config/picom/picom.conf --experimental-backends & pgrep -x wmname > /dev/null || wmname LG3D & gnome-keyring-daemon --start & +while pgrep -u $UID -f windows.sh >/dev/null; do pkill -f windows.sh; done +~/.config/bspwm/windows.sh & + # Set workspaces bspc monitor DP-2 -d 1 2 3 4 5 bspc monitor HDMI-0 -d 6 7 8 9 0 diff --git a/.config/bspwm/windows.sh b/.config/bspwm/windows.sh new file mode 100755 index 0000000..ff819a8 --- /dev/null +++ b/.config/bspwm/windows.sh @@ -0,0 +1,158 @@ +#!/usr/bin/env bash + +# globals +version="1.1" +cache_path="${HOME}/.cache" +icon_map_path="$( dirname "$( readlink -f "$0" )" )/bspwm_window_titles_icon_map.txt" + +# defaults +polybar_mode="true" +monocle_mode="false" +format_focused="[ {NAME} ]" +format_normal="{NAME}" + +# wraps a text with polybar format command action +# $1 action +# $2 text +polybar_action_cmd() { + echo "%{A1:${1}:}${2}%{A}" +} + +# formats window name with given format +# $1 format +# $2 window name +polybar_format_window_name() { + echo "$1" | sed "s/{NAME}/$2/" +} + +help() { + echo "bspwm window titles" + echo "allows you to have bspwm window titles from each monitor in your bar" + echo "-------------------" + echo + echo "Syntax: bspwm_window_titles [-i |m|p|f |V]" + echo "options:" + echo "h Print this help." + echo "i Icon map path - custom path to file containing icon map" + echo "m Monocle mode - won't print window names when there is only one window on desktop." + echo "p Polybar action mode - will output window names wrapped with polybar action handlers." + echo " This allows you to directly click on a window name to focus it's window" + echo "f Format how focused/normal window names are displayed" + echo " You need to supply both polybar format tags (so need to use -f two times)" + echo " Example" + echo " bspwm_window_titles -f \"%{F#f00}{NAME}%{F-}\" -f \"{NAME}\"" + echo " focused window name font color red and normal window as is" + echo "V Print software version and exit." + echo +} + +while getopts ":hvmpf:i:" option; do + case $option in + h) + help + exit;; + m) + monocle_mode="true";; + i) + icon_map_path="$OPTARG";; + p) + polybar_mode="true";; + f) + formats+=("$OPTARG"); + [[ -n ${formats[0]} ]] && format_focused="${formats[0]}" + [[ -n ${formats[1]} ]] && format_normal="${formats[1]}";; + v) + echo "Version $version"; + exit;; + *) + echo "Error: Invalid option" + exit;; + esac +done + +icon_map=$( cat "${icon_map_path}" ) + +# subscribe to events on which the window title list will get updated +bspc subscribe node_focus node_remove desktop_focus | while read -r _; do + + # get all monitors + monitors=$( bspc query -M ) + + for monitor in $monitors; do + index=$((index + 1)) + + # get last focused desktop on given monitor + last_focused_desktop=$( bspc query -D -m "$monitor" -d .active ) + + # get windows from last focused desktop on given monitor + winids_on_desktop=$( bspc query -N -n .window -m "$monitor" -d "$last_focused_desktop" ) + + # get number of windows on desktop + number_of_windows=$( printf "$winids_on_desktop" | tr '\n' ' ' | wc -w ) + + # get a list of all windows + winlist=$( wmctrl -l -x ) + + for window_id in $winids_on_desktop; do + # replace all spaces and tabs with single spaces for easier cutting + window=$( echo "$winlist" | grep -i "$window_id" | tr -s '[:blank:]' ) + # get window name + window_name=$( echo "$window" | cut -d " " -f 5- ) + # longer window titles if there is only one window + [[ "$number_of_windows" == "1" ]] && char_cut="40" || char_cut="20" + # cut the window name + window_name_short=$( echo "$window_name" | cut -c1-"$char_cut" ) + + # get window class and match after a dot to get app name + window_class=$( echo "$window" | cut -d " " -f 3 | sed 's/.*\.//') + + # if window id matched with list == not empty + if [[ -n "$window_name" ]]; then + # trim window name + window_name=$( echo "$window_name_short" | sed -e 's/^[[:space:]]*//' ) + + # display instance name if there is no window title + if [[ "$window_name" == "N/A" ]]; then + window_name=$(echo "$window" | cut -d " " -f 3 | cut -d "." -f 2 ) + fi + + # get icon for class name + window_icon=$( grep "$window_class" <<< "$icon_map" | cut -d " " -f2 ) + + # fallback icon if class not found + if [[ -z "$window_icon" ]]; then + window_icon=$( grep "Fallback" <<< "$icon_map" | cut -d " " -f2 ) + fi + + # join icon and name + window_name_with_icon="${window_icon} ${window_name}" + + # apply formatting + if [[ $( bspc query -N -n focused) == "$window_id" ]]; then + formatted_window_name=$( polybar_format_window_name "$format_focused" "$window_name_with_icon" ) + else + formatted_window_name=$( polybar_format_window_name "$format_normal" "$window_name_with_icon" ) + fi + + # wrap with polybar action cmd + [[ "$polybar_mode" == "true" ]] && formatted_window_name=$( polybar_action_cmd "bspc node -f ${window_id}" "$formatted_window_name") + + curr_wins+="${formatted_window_name} " + fi + done + + # if monocle set to true then don't print names if there is only one + if [[ "$monocle_mode" == "true" && "$number_of_windows" == "1" ]]; then + windows_print="" + else + windows_print="$curr_wins" + fi + + # print out the window names to files for use in a bar + echo "$windows_print" > "${cache_path}/bspwm_windows_${index}.txt" + unset curr_wins + done + + unset index + +done diff --git a/.config/picom/picom.conf b/.config/picom/picom.conf index 2c39f9a..fa4e7e4 100644 --- a/.config/picom/picom.conf +++ b/.config/picom/picom.conf @@ -1,25 +1,3 @@ -################################# -# Corners # -################################# -# requires: https://github.com/sdhand/compton -corner-radius = 15.0; -rounded-corners-exclude = [ - "class_g = 'Polybar'" -]; -round-borders = 1; -round-borders-exclude = [ - "class_g = 'Polybar'" -]; - -# Specify a list of border width rules, in the format `PIXELS:PATTERN`, -# Note we don't make any guarantee about possible conflicts with the -# border_width set by the window manager. -# -# example: -# round-borders-rule = [ "2:class_g = 'URxvt'" ]; -# -round-borders-rule = []; - ################################# # Shadows # ################################# @@ -28,46 +6,49 @@ round-borders-rule = []; # Enabled client-side shadows on windows. Note desktop windows # (windows with '_NET_WM_WINDOW_TYPE_DESKTOP') never get shadow, # unless explicitly requested using the wintypes option. -shadow = true; +shadow = false; # The blur radius for shadows, in pixels. (defaults to 12) -shadow-radius = 12; +# shadow-radius = 7; # The opacity of shadows. (0.0 - 1.0, defaults to 0.75) -shadow-opacity = 0.75; +# shadow-opacity = .75 # The left offset for shadows, in pixels. (defaults to -15) -shadow-offset-x = -15; +# shadow-offset-x = -7; # The top offset for shadows, in pixels. (defaults to -15) -shadow-offset-y = -15; +# shadow-offset-y = -7; # Red color value of shadow (0.0 - 1.0, defaults to 0). -shadow-red = 0; +# shadow-red = 0 # Green color value of shadow (0.0 - 1.0, defaults to 0). -shadow-green = 0; +# shadow-green = 0 # Blue color value of shadow (0.0 - 1.0, defaults to 0). -shadow-blue = 0; +# shadow-blue = 0 # Hex string color value of shadow (#000000 - #FFFFFF, defaults to #000000). This option will override options set shadow-(red/green/blue) -shadow-color = "#000000"; +# shadow-color = "#000000" # Specify a list of conditions of windows that should have no shadow. # # examples: # shadow-exclude = "n:e:Notification"; -shadow-exclude = []; +# shadow-exclude = [] + +# Specify a list of conditions of windows that should have no shadow painted over, such as a dock window. +# clip-shadow-above = [] # Specify a X geometry that describes the region in which shadow should not # be painted in, such as a dock window region. Use # shadow-exclude-reg = "x10+0+0" # for example, if the 10 pixels on the bottom of the screen should not have shadows painted on. -shadow-exclude-reg = ""; +# shadow-exclude-reg = "" # Crop shadow of a window fully on a particular Xinerama screen to the screen. -xinerama-shadow-crop = false; +# xinerama-shadow-crop = false ################################# @@ -80,23 +61,22 @@ xinerama-shadow-crop = false; fading = true; # Opacity change between steps while fading in. (0.01 - 1.0, defaults to 0.028) -fade-in-step = 0.028; +fade-in-step = 0.03; # Opacity change between steps while fading out. (0.01 - 1.0, defaults to 0.03) -fade-out-step = 0.028; +fade-out-step = 0.03; # The time between steps in fade step, in milliseconds. (> 0, defaults to 10) -fade-delta = 5; +# fade-delta = 10 # Specify a list of conditions of windows that should not be faded. -# don't need this, we disable fading for all normal windows with wintypes: {} -fade-exclude = []; +# fade-exclude = [] # Do not fade on window open/close. -no-fading-openclose = false; +# no-fading-openclose = false # Do not fade destroyed ARGB windows with WM frame. Workaround of bugs in Openbox, Fluxbox, etc. -no-fading-destroyed-argb = false; +# no-fading-destroyed-argb = false ################################# @@ -110,21 +90,20 @@ inactive-opacity = 0.8; # Opacity of window titlebars and borders. (0.1 - 1.0, disabled by default) frame-opacity = 0.7; -# Let inactive opacity set by -i override the '_NET_WM_OPACITY' values of windows. -# inactive-opacity-override = true -inactive-opacity-override = false; +# Let inactive opacity set by -i override the '_NET_WM_WINDOW_OPACITY' values of windows. +inactive-opacity-override = true; # Default opacity for active windows. (0.0 - 1.0, defaults to 1.0) -active-opacity = 1.0; +# active-opacity = 1.0 # Dim inactive windows. (0.0 - 1.0, defaults to 0.0) -inactive-dim = 0.5; +# inactive-dim = 0.0 -# Specify a list of conditions of windows that should always be considered focused. -focus-exclude = []; +# Specify a list of conditions of windows that should never be considered focused. +# focus-exclude = [] # Use fixed inactive dim value, instead of adjusting according to window opacity. -#inactive-dim-fixed = 1.0 +# inactive-dim-fixed = 1.0 # Specify a list of opacity rules, in the format `PERCENT:PATTERN`, # like `50:name *= "Firefox"`. picom-trans is recommended over this. @@ -132,7 +111,22 @@ focus-exclude = []; # programs that set '_NET_WM_WINDOW_OPACITY' on frame or client windows. # example: # opacity-rule = [ "80:class_g = 'URxvt'" ]; -opacity-rule = []; +# opacity-rule = [] + + +################################# +# Corners # +################################# + +# Sets the radius of rounded window corners. When > 0, the compositor will +# round the corners of windows. Does not interact well with +# `transparent-clipping`. +corner-radius = 20 + +# Exclude conditions for rounded corners. +rounded-corners-exclude = [ + "class_g = 'Polybar'" +]; ################################# @@ -141,27 +135,25 @@ opacity-rule = []; # Parameters for background blurring, see the *BLUR* section for more information. -# blur-method = -# blur-size = 12 -# -# blur-deviation = false -# -# blur-strength = 5 +blur-method = "dual_kawase" +blur-size = 12 +blur-deviation = true +blur-strength = 7 # Blur background of semi-transparent / ARGB windows. # Bad in performance, with driver-dependent behavior. # The name of the switch may change without prior notifications. -blur-background = true; +blur-background = true # Blur background of windows when the window frame is not opaque. # Implies: # blur-background # Bad in performance, with driver-dependent behavior. The name may change. -blur-background-frame = false; +blur-background-frame = true # Use fixed blur strength rather than adjusting according to window opacity. -# blur-background-fixed = false; +blur-background-fixed = true # Specify the blur convolution kernel, with the following format: @@ -170,38 +162,28 @@ blur-background-frame = false; blur-kern = "3x3box"; -blur: { - # requires: https://github.com/ibhagwan/picom - method = "kawase"; - strength = 7; - deviation = 1.0; - kernel = "11x11gaussian"; - background = true; - background-frame = true; - background-fixed = true; - kern = "3x3box"; -} - # Exclude conditions for background blur. -blur-background-exclude = []; +# blur-background-exclude = [] ################################# # General Settings # ################################# +# Enable remote control via D-Bus. See the man page for more details. +# dbus = true + # Daemonize process. Fork to background after initialization. Causes issues with certain (badly-written) drivers. -daemon = false; +# daemon = false # Specify the backend to use: `xrender`, `glx`, or `xr_glx_hybrid`. # `xrender` is the default one. -experimental-backends = true; -backend = "glx"; +backend = "glx" # Enable/disable VSync. vsync = true; # Enable remote control via D-Bus. See the *D-BUS API* section below for more details. -dbus = false; +# dbus = false # Try to detect WM windows (a non-override-redirect window with no # child that has 'WM_STATE') and mark them as active. @@ -214,38 +196,35 @@ mark-ovredir-focused = true; # shaped windows. The accuracy is not very high, unfortunately. detect-rounded-corners = true; -# Detect '_NET_WM_OPACITY' on client windows, useful for window managers -# not passing '_NET_WM_OPACITY' of client windows to frame windows. +# Detect '_NET_WM_WINDOW_OPACITY' on client windows, useful for window managers +# not passing '_NET_WM_WINDOW_OPACITY' of client windows to frame windows. detect-client-opacity = true; -# Specify refresh rate of the screen. If not specified or 0, picom will -# try detecting this with X RandR extension. -refresh-rate = 0; - # Use EWMH '_NET_ACTIVE_WINDOW' to determine currently focused window, # rather than listening to 'FocusIn'/'FocusOut' event. Might have more accuracy, # provided that the WM supports it. -use-ewmh-active-win = true; +# use-ewmh-active-win = false # Unredirect all windows if a full-screen opaque window is detected, # to maximize performance for full-screen windows. Known to cause flickering # when redirecting/unredirecting windows. -unredir-if-possible = false; +# unredir-if-possible = false # Delay before unredirecting the window, in milliseconds. Defaults to 0. -unredir-if-possible-delay = 0; +# unredir-if-possible-delay = 0 # Conditions of windows that shouldn't be considered full-screen for unredirecting screen. -unredir-if-possible-exclude = []; +# unredir-if-possible-exclude = [] # Use 'WM_TRANSIENT_FOR' to group windows, and consider windows # in the same group focused at the same time. detect-transient = true; # Use 'WM_CLIENT_LEADER' to group windows, and consider windows in the same -# group focused at the same time. 'WM_TRANSIENT_FOR' has higher priority if -# detect-transient is enabled, too. -detect-client-leader = true; +# group focused at the same time. This usually means windows from the same application +# will be considered focused or unfocused at the same time. +# 'WM_TRANSIENT_FOR' has higher priority if detect-transient is enabled, too. +# detect-client-leader = false # Resize damaged region by a specific number of pixels. # A positive value enlarges it while a negative one shrinks it. @@ -257,25 +236,23 @@ detect-client-leader = true; # (e.g. with a 3x3 kernel, you should use `--resize-damage 1`, # with a 5x5 one you use `--resize-damage 2`, and so on). # May or may not work with *--glx-no-stencil*. Shrinking doesn't function correctly. -# # resize-damage = 1 # Specify a list of conditions of windows that should be painted with inverted color. # Resource-hogging, and is not well tested. -# # invert-color-include = [] # GLX backend: Avoid using stencil buffer, useful if you don't have a stencil buffer. # Might cause incorrect opacity when rendering transparent content (but never # practically happened) and may not work with blur-background. # My tests show a 15% performance boost. Recommended. -glx-no-stencil = true; +# glx-no-stencil = false # GLX backend: Avoid rebinding pixmap on window damage. # Probably could improve performance on rapid window content changes, # but is known to break things on some drivers (LLVMpipe, xf86-video-intel, etc.). # Recommended if it works. -glx-no-rebind-pixmap = true; +# glx-no-rebind-pixmap = false # Disable the use of damage information. # This cause the whole screen to be redrawn everytime, instead of the part of the screen @@ -286,7 +263,7 @@ use-damage = true; # Use X Sync fence to sync clients' draw calls, to make sure all draw # calls are finished before picom starts drawing. Needed on nvidia-drivers # with GLX backend for some users. -xrender-sync-fence = true; +# xrender-sync-fence = false # GLX backend: Use specified GLSL fragment shader for rendering window contents. # See `compton-default-fshader-win.glsl` and `compton-fake-transparency-fshader-win.glsl` @@ -295,28 +272,28 @@ xrender-sync-fence = true; # Force all windows to be painted with blending. Useful if you # have a glx-fshader-win that could turn opaque pixels transparent. -force-win-blend = false +# force-win-blend = false # Do not use EWMH to detect fullscreen windows. # Reverts to checking if a window is fullscreen based only on its size and coordinates. -no-ewmh-fullscreen = false +# no-ewmh-fullscreen = false # Dimming bright windows so their brightness doesn't exceed this set value. # Brightness of a window is estimated by averaging all pixels in the window, # so this could comes with a performance hit. # Setting this to 1.0 disables this behaviour. Requires --use-damage to be disabled. (default: 1.0) -max-brightness = 1.0 +# max-brightness = 1.0 # Make transparent windows clip other windows like non-transparent windows do, # instead of blending on top of them. -transparent-clipping = false +# transparent-clipping = false # Set the log level. Possible values are: # "trace", "debug", "info", "warn", "error" # in increasing level of importance. Case doesn't matter. # If using the "TRACE" log level, it's better to log into a file # using *--log-file*, since it can generate a huge stream of logs. -log-level = "info"; +log-level = "warn"; # Set the log file. # If *--log-file* is never specified, logs will be written to stderr. @@ -326,7 +303,7 @@ log-level = "info"; # log-file = "/path/to/your/log/file" # Show all X errors (for debugging) -show-all-xerrors = false +# show-all-xerrors = false # Write process ID to a file. # write-pid-path = "/path/to/your/log/file" @@ -355,10 +332,14 @@ show-all-xerrors = false # normally won't be able to see. Useful when the window has parts of it # transparent, and you want shadows in those areas. # +# clip-shadow-above::: +# Controls wether shadows that would have been drawn above the window should +# be clipped. Useful for dock windows that should have no shadow painted on top. +# # redir-ignore::: # Controls whether this type of windows should cause screen to become # redirected again after been unredirected. If you have unredir-if-possible # set, and doesn't want certain window to cause unnecessary screen redirection, # you can set this to `true`. -# -wintypes: {}; +wintypes: +{}; diff --git a/.config/polybar/config b/.config/polybar/config.ini similarity index 89% rename from .config/polybar/config rename to .config/polybar/config.ini index c203ec5..e60280a 100644 --- a/.config/polybar/config +++ b/.config/polybar/config.ini @@ -1,9 +1,9 @@ -[bar/display1] -monitor = ${env:MONITOR:DP-2} +[bar/top] +monitor = ${env:MONITOR} fixed-center = false -width = 100% +width = 98% height = 20 background = ${colors.background} @@ -17,18 +17,19 @@ modules-left = bspwm RightArrow RightStripe RightArrow modules-center = xwindow modules-right = LeftArrow3 LeftStripe LeftArrow3 pulseaudio LeftArrow1 filesystem LeftArrow2 cpu LeftArrow1 memory LeftArrow2 date -tray-position = right -tray-padding = 1 -tray-background = ${colors.cyan} - cursor-click = pointer cursor-scroll = ns-resize +offset-x = 1% +offset-y = 1% -[bar/display2] -monitor = ${env:MONITOR:HDMI-0} +radius = 10 -fixed-center = false + +[bar/bottom] +monitor = ${env:MONITOR} + +bottom = true width = 100% height = 20 @@ -40,9 +41,8 @@ font-0 = PowerlineSymbols:size=14;4 font-1 = Font Awesome 5 Free Solid:pixelsize=12;2 font-2 = FiraCode Nerd Font Mono:pixelsize=10;2 -modules-left = bspwm RightArrow RightStripe RightArrow -modules-center = xwindow -modules-right = LeftArrow3 LeftStripe LeftArrow3 pulseaudio LeftArrow1 filesystem LeftArrow2 cpu LeftArrow1 memory LeftArrow2 date +modules-center = windows +modules-right = tray cursor-click = pointer cursor-scroll = ns-resize @@ -128,7 +128,7 @@ mount-0 = / format-mounted-background = ${colors.red} -label-mounted =  %mountpoint%: %used%/%total% (%fsname%) +label-mounted =  %mountpoint%: %used%/%total% label-mounted-foreground = ${colors.text} @@ -175,9 +175,20 @@ label-muted =  Muted label-muted-foreground = ${colors.text} +[module/tray] +type = internal/tray + + +[module/windows] +type = custom/script +exec = ${env:P_BSPWM_WINDOW_CMD} +interval = 0.5 +format =