Advertisement
Guest User

my_dkrc

a guest
Nov 12th, 2022
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.65 KB | Source Code | 0 0
  1. #!/bin/bash
  2.  
  3. # DK WINDOW MANAGER CONFIGURATION FILE
  4.  
  5. # let's include windows rules function
  6. source "$XDG_CONFIG_HOME"/dk/_WindowsRules
  7.  
  8. # workspaces/monitors settings using xrandr.
  9. if [[ -n $(pidof nvidia-persistenced) ]]; then
  10.     xrandr --output DVI-D-0 --primary --mode 1920x1080 --pos 0x0 --rotate normal \
  11.            --output HDMI-0 --mode 1920x1080 --pos 1920x0 --rotate normal \
  12.            --output DP-0 --mode 1920x1080 --pos 3840x0 --rotate normal
  13.             MONITOR1=DVI-D-0
  14.             MONITOR2=HDMI-0
  15.             MONITOR3=DP-0
  16. else
  17.     xrandr --output DVI-D-1 --primary --mode 1920x1080 --pos 0x0 --rotate normal \
  18.            --output HDMI-1 --mode 1920x1080 --pos 1920x0 --rotate normal \
  19.            --output DP-1 --mode 1920x1080 --pos 3840x0 --rotate normal
  20.             MONITOR1=DVI-D-1
  21.             MONITOR2=HDMI-1
  22.             MONITOR3=DP-1
  23. fi
  24.  
  25. # initialize 10 workspaces (1-10) (default: 1/monitor)
  26. dkcmd set numws=10
  27.  
  28. # default workspace '_' values used when allocating new workspaces
  29. # can be applied to all existing workspaces when passed 'apply' after ws=_
  30. dkcmd set ws=_ apply layout=tile master=1 stack=3 gap=0 msplit=0.55 ssplit=0.5
  31. dkcmd set ws=7 layout=none
  32.  
  33. function _wslayout {
  34.     awk '
  35.    /^workspaces:/ {sub(/^workspaces: /, ""); gsub(/(*)?[0-9]*:\w*:/, ""); print; exit}
  36.    ' <(dkcmd status type=full num=1) \
  37.     | sed 's/dwindle/D/g;s/grid/G/g;s/mono/M/g;
  38.    s/none/N/g;s/rtile/R/g;s/spiral/S/g;s/tile/T/g;s/tstack/W/g'
  39. }
  40.  
  41. # Indicates the active startup workspace layout beside the name.
  42. # The polybar ewmh module will look like this:
  43. # 1:T 2:S 3:N etc...(name:layout)
  44. # dwindle=D grid=G mono=M none=N rtile=R spiral=S tile=T tstack=W
  45. dkcmd set static_ws=true \
  46.     ws=1 name=1:$(_wslayout | awk '{print $1}') mon="$MONITOR1" \
  47.     ws=2 name=2:$(_wslayout | awk '{print $2}') mon="$MONITOR1" \
  48.     ws=3 name=3:$(_wslayout | awk '{print $3}') mon="$MONITOR1" \
  49.     ws=4 name=4:$(_wslayout | awk '{print $4}') mon="$MONITOR1" \
  50.     ws=5 name=5:$(_wslayout | awk '{print $5}') mon="$MONITOR2" \
  51.     ws=6 name=6:$(_wslayout | awk '{print $6}') mon="$MONITOR2" \
  52.     ws=7 name=7:$(_wslayout | awk '{print $7}') mon="$MONITOR2" \
  53.     ws=8 name=8:$(_wslayout | awk '{print $8}') mon="$MONITOR3" \
  54.     ws=9 name=9:$(_wslayout | awk '{print $9}') mon="$MONITOR3" \
  55.     ws=10 name=10:$(_wslayout | awk '{print $10}') mon="$MONITOR3"
  56.  
  57. if ! hash polybar wmctrl >/dev/null 2>&1; then
  58.     notify-send 'polybar wmctrl should be installed...'
  59. fi
  60.  
  61. # checking external scripts
  62. _check() { command -v "$1" >/dev/null; }
  63.  
  64. _check launch_polybar && launch_polybar &
  65. _check sxhkd-start && sxhkd-start &
  66.  
  67. # polybar "witness" module for static/dynamic workspaces option.
  68. polybar-msg -p \
  69.     $(pgrep --full $(wmctrl -m | awk '/Name/{print $2}')-bar-3) \
  70.     action "#static_ws-ipc.hook.0" >/dev/null 2>&1
  71.  
  72. # global settings
  73. dkcmd set focus_{open,urgent,mouse}=true
  74. dkcmd set tile_{tohead,hints}=true
  75. dkcmd set win_minwh=50 win_minxy=10
  76. dkcmd set smart_{gap,border}=true
  77. dkcmd set mouse mod=alt move=button1 resize=button3
  78.  
  79.  
  80. function _colours {
  81.    
  82.     local blu cyn grn mag red
  83.    
  84.     blu=$(xrdb -query | awk '/color4:/{print $NF}')
  85.     cyn=$(xrdb -query | awk '/color6:/{print $NF}')
  86.     grn=$(xrdb -query | awk '/color2:/{print $NF}')
  87.     red=$(xrdb -query | awk '/color1:/{print $NF}')
  88.     ylw=$(xrdb -query | awk '/color3:/{print $NF}')
  89.    
  90.     dkcmd set border width=2 outer_width=1 \
  91.     colour \
  92.     focus="$cyn" \
  93.     urgent="$red" \
  94.     unfocus="$ylw" \
  95.     outer_focus="$blu" \
  96.     outer_urgent="$grn" \
  97.     outer_unfocus="$ylw"
  98. }
  99.  
  100. [[ -f $HOME/.Xresources ]] && _colours
  101.  
  102. _WindowsRules
  103.  
  104. dkcmd rule apply '*'
  105. dkcmd ws 1
  106.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement