Browse Source

Add bspwm vnc session

nixos
Maxime Wack 4 years ago
parent
commit
9db8db57b1
6 changed files with 283 additions and 9 deletions
  1. +15
    -9
      .config/bin/wm
  2. +56
    -0
      .vnc/bspwmrc
  3. +9
    -0
      .vnc/config
  4. +43
    -0
      .vnc/panel
  5. +136
    -0
      .vnc/sxhkd
  6. +24
    -0
      .vnc/xstartup

+ 15
- 9
.config/bin/wm View File

@@ -1,7 +1,13 @@
#!/bin/bash

# High-level bspwm controls
### High-level bspwm controls

# Use settings if existing, else use default values
if [[ -z $LASTDESK ]]; then
LASTDESK="/tmp/lastdesk"
fi

# Usage
usage ()
{
echo "Usage :"
@@ -13,11 +19,11 @@ usage ()
exit 0
}

# Functions
### Functions

clear_desktop ()
{
last=`cat /tmp/lastdesk`
last=`cat $LASTDESK`
namelast=$last
namecurrent=`bspc query -d focused -D --names`
wincurrent=`bspc query -d focused -N`
@@ -51,7 +57,7 @@ clear_desktop ()
fi
fi

echo "$last" > /tmp/lastdesk
echo "$last" > $LASTDESK
}

popup ()
@@ -106,9 +112,9 @@ discard ()
# echo `bspc query -D -d focused --names` > /tmp/desk

# Create a new desktop at the end
last=`cat /tmp/lastdesk`
last=`cat $LASTDESK`
let "last += 1"
echo $last > /tmp/lastdesk
echo $last > $LASTDESK
bspc monitor -a $last

# Move the node and optionally --follow it
@@ -123,15 +129,15 @@ goto ()

case $1 in
next) # Create a new desktop if needed
last=`cat /tmp/lastdesk`
last=`cat $LASTDESK`
if [ `bspc query -D -d focused --names` -eq "$last" ]; then
let "last += 1"
echo $last > /tmp/lastdesk
echo $last > $LASTDESK
bspc monitor -a $last
fi
togo=$1
;;
last) togo=`cat /tmp/lastdesk` ;;
last) togo=`cat $LASTDESK` ;;
prev| | |1|2|3|4|5|6|7) togo=$1 ;;
*) usage ;;
esac


+ 56
- 0
.vnc/bspwmrc View File

@@ -0,0 +1,56 @@
#!/bin/zsh

bspc config border_width 0
bspc config window_gap 10

bspc config borderless_monocle true
bspc config gapless_monocle true
bspc config focus_by_distance true
bspc config initial_polarity second_child
bspc config split_ratio 0.6

bspc config remove_unplugged_monitors true
bspc config ignore_ewmh_focus true

bspc config click_to_focus any
bspc config pointer_modifier mod4
bspc config pointer_action1 move
bspc config pointer_action2 resize_corner

bspc config presel_feedback_color "#FFFFFF"

echo 1 > /tmp/lastdesk-vnc

# Monitors
bspc monitor VNC-0 -d  1

# Rules
bspc rule -a qutebrowser desktop=
bspc rule -a Arandr state=floating
bspc rule -a Zathura state=tiled
bspc rule -a Pinentry state=floating
bspc rule -a Soffice state=tiled
bspc rule -a Emacs state=tiled
bspc rule -a kitty:Meteo monitor=^1 sticky=on state=floating rectangle=880x580+500+70

# Popup CLI apps
bspc rule -a kitty:Ranger-vnc sticky=on state=floating rectangle=1820x900+0+0 center=on

wmname compiz
# dunst &
picom -b

# Wallpaper
hsetroot -fill .config/bspwm/cat_sitting_hegp.png

xsetroot -cursor_name left_ptr
conky -d -c .config/conky/conkyrc &
/home/maxx/.vnc/panel &

# Applications
# davmail &

unclutter &
bspc config top_padding 20
# sleep 1
# tray &

+ 9
- 0
.vnc/config View File

@@ -0,0 +1,9 @@
## Supported server options to pass to vncserver upon invocation can be listed
## in this file. See the following manpages for more: vncserver(1) Xvnc(1).
## Several common ones are shown below. Uncomment and modify to your liking.
##
# securitytypes=vncauth,tlsvnc
# desktop=sandbox
geometry=1920x1080
# localhost
# alwaysshared

+ 43
- 0
.vnc/panel View File

@@ -0,0 +1,43 @@
#!/bin/zsh

PANEL_FIFO=/tmp/panel-fifo-vnc

# If already started, kill utilities
if [ -e "$PANEL_FIFO" ]; then
rm "$PANEL_FIFO"
killall panel_bar
killall bspc
killall xtitle
killall clock
killall battery
killall volume
fi

mkfifo "$PANEL_FIFO"

bspc subscribe > "$PANEL_FIFO" &
xtitle -sf 'T%s\n' > "$PANEL_FIFO" &
clock -sf 'CD%a %d %b' > "$PANEL_FIFO" &
clock -sf 'CT%H:%M' > "$PANEL_FIFO" &

width=1900
height=24
size=10
volume -sf 'VS%s' > "$PANEL_FIFO" &
volume -sf 'VI%i' > "$PANEL_FIFO" &

# If given a width, use it
if [[ -n "$1" ]]; then
width="$1"
fi

cat "$PANEL_FIFO" \
| panel_bar \
| lemonbar -g "$width"x"$height"+10+0 \
-f "monofur\ for\ Powerline:size=$size" \
-f "FontAwesome:size=$size" \
-u 0 \
-B '#00AAAAAA' \
-F '#FF202020' &

wait

+ 136
- 0
.vnc/sxhkd View File

@@ -0,0 +1,136 @@
## System

# Quit bspwm
super + ctrl + Escape
pkill -x panel; bspc quit

# Reload sxhkd
super + Escape
pkill -USR1 -x sxhkd

# Lock
super + z
slimlock

## Monitors

# Move node to the other monitor
super + {_,shift} + percent
bspc {monitor -f next,node -m next --follow}

## Desktop

# Go to prev, next, nth or last desktop and back, optionally --carrying a node
super + {_,shift} + {v,l,n,quotedbl,guillemotleft,guillemotright,parenleft,parenright,Delete,at,plus,minus,slash}
carry={_,--carry}; \
wm goto {prev,next,last, , ,1,2,3,4,5,6,7} "$carry"

# Send node to a new empty desktop at the far right (and follow)
super + {_,shift} + j
wm discard {_,--follow}

# Rotate desktop
super + {q,h}
bspc node @focused:/ -R {270,90}

# Balance desktop
super + k
bspc node @focused:/ -B

# Show conky
super + c
wm peek left

# Show calendar
super + m
wm peek right

## Nodes

# Focus/swap to DIR
super + {_,shift + }{t,s,d,r}
bspc node -{f,s} {west,south,north,east}

# Focus to CYCLE_DIR
super + w
bspc node -f next.local

# Preselect node to DIR
super + ctrl + {t,s,d,r}
bspc node -p \~{west,south,north,east}

# Resize node to DIR
super + alt + {t,s,d,r}
bspc node @{west -r -100,south -r +100,north -r -100,east -r +100}
super + alt + shift + {t,s,d,r}
bspc node @{east -r -100,north -r +100,south -r -100,west -r +100}

# Toggle floating/pseudo_tiles/fullscreen
super + {y,x,period}
bspc node -t \~{floating,tiled,fullscreen}

# Move to presel
super + b
bspc node -n last.!automatic

# Close node
super + {g,agrave}
bspc node -c

## Externals

# Rnager
super + space
wm popup Ranger-vnc ranger

# Volume
super + e
wm popup Volume-vnc pulsemixer

# Weather
super + p
xdotool search --onlyvisible --classname Meteo windowkill ||\
kitty --override background_opacity=0 -o background='#000000' -o font_size=9 --hold --name Meteo meteo_display && meteo

# Pin pop-up window
super + shift + space
bspc node -g sticky=off -t tiled &&\
xdotool getactivewindow set_window --classname urxvt

# Launcher
super + alt + space
rofi -font "monofur for Powerline 18" -show

# Open terminal
super + ctrl + space
kitty

# Emacs client
super + Return
emacsclient -nc

# Arandr
XF86Display
arandr

## Brightness control

XF86MonBrightnessUp
xbacklight +5

XF86MonBrightnessDown
xbacklight -5

## Audio

XF86AudioPlay
mpc toggle;\
dunstify -r 1234 "`echo -e "\uf04b\uf04c"`"

## Screenshot

Print
scrot

alt + Print
scrot -s

+ 24
- 0
.vnc/xstartup View File

@@ -0,0 +1,24 @@
#!/bin/sh

export BSPWM_SOCKET=$HOME/.cache/bspwm-socket.vnc
export LASTDESK=/tmp/lastdesk-vnc

xrdb -merge ~/.Xresources
xset s off

# Environment and autostart:
source_these=(
"/etc/profile"
"${HOME}/.profile"
"${XDG_CONFIG_HOME:-"$HOME/.config"}/bspwm/autostart"
)

for file in "${source_these[@]}"; do
[ -r "${file}" ] && . "${file}"
done

# Launch sxhkd:
sxhkd -c /home/maxx/.vnc/sxhkd &

# # Launch bspwm:
bspwm -c /home/maxx/.vnc/bspwmrc

Loading…
Cancel
Save