added tsvsummaryin path. skel/disp automates lxpanel positioning
This commit is contained in:
65
skel/disp
65
skel/disp
@@ -4,17 +4,60 @@
|
||||
LAPTOP=LVDS1
|
||||
ANALOG=VGA1
|
||||
DIGITAL=HDMI1
|
||||
|
||||
# You hay have to change ANALOG/DIGITAL in the outputs, especially for Workstation choices
|
||||
# The choices may be the same!
|
||||
PRESENTATION=$ANALOG
|
||||
WORKSTATION=$ANALOG
|
||||
|
||||
#Helper functions when using lxpanel (Lubuntu / LXDE)
|
||||
function reset_lxpanel() {
|
||||
if lxpanel_running; then
|
||||
PROFILE=$( lxpanel_profile )
|
||||
sed -i -e 's,edge=.*,edge=bottom,' -e "s,allign=.*,allign=left," -e "s,widthtype=.*,widthtype=percent," -e "s,width=.*,width=100," $HOME/.config/lxpanel/${PROFILE}/panels/panel
|
||||
fi
|
||||
}
|
||||
|
||||
function side_lxpanel() {
|
||||
if lxpanel_running; then
|
||||
PROFILE=$( lxpanel_profile )
|
||||
sleep 1
|
||||
LAPTOPWIDTH=$( xrandr -q | grep $LAPTOP | cut -d" " -f3 | cut -dx -f1 )
|
||||
sed -i -e 's,edge=.*,edge=bottom,' -e "s,allign=.*,allign=$1," -e "s,widthtype=.*,widthtype=pixel," -e "s,width=.*,width=$LAPTOPWIDTH," $HOME/.config/lxpanel/${PROFILE}/panels/panel
|
||||
echo "Warning: if LAPTOP has more pixels in the vertical direction, panel is invisible! change configuration of this script, and/or current setup ( lxpanelctl config )"
|
||||
fi
|
||||
}
|
||||
|
||||
function restart_lxpanel() {
|
||||
if lxpanel_running; then
|
||||
LXCMD=$( ps -ocommand= --pid $( pgrep -u $USER -n lxpanel ) )
|
||||
lxpanelctl restart
|
||||
sleep 2
|
||||
lxpanel_running || {
|
||||
echo "lxpanel segfaulted. restarting..."
|
||||
$LXCMD &> /dev/null &
|
||||
}
|
||||
fi
|
||||
}
|
||||
|
||||
function lxpanel_running() {
|
||||
pgrep -u $USER -n lxpanel &> /dev/null
|
||||
}
|
||||
function lxpanel_profile() {
|
||||
ps -ocommand= --pid $( pgrep -u $USER -n lxpanel ) | sed 's/.*--profile \([^ ]\+\).*/\1/'
|
||||
}
|
||||
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo 'Choose display mode:
|
||||
1) Laptop only
|
||||
2) Presentation (2nd arg for gamma correction)
|
||||
3) Workstation with 2nd screen
|
||||
4) External display only
|
||||
3) Workstation: 2nd screen on the right
|
||||
4) Workstation: 2nd screen on the left
|
||||
5) Workstation: external display only
|
||||
'
|
||||
read i
|
||||
read -N 1 i
|
||||
echo ""
|
||||
else
|
||||
i=$1
|
||||
fi
|
||||
@@ -22,11 +65,15 @@ if [ -z "$2" ]
|
||||
then g=1
|
||||
else g=$2
|
||||
fi
|
||||
|
||||
oppos=left
|
||||
if [ "$2" = "left" ]
|
||||
then oppos=right
|
||||
fi
|
||||
case $i in
|
||||
1) xrandr --output $LAPTOP --auto --gamma $g:$g:$g --output $ANALOG --off --output $DIGITAL --off ;;
|
||||
2) xrandr --output $LAPTOP --mode 1024x768 --pos 0x0 --output $ANALOG --mode 1024x768 --pos 0x0 --gamma $g:$g:$g ;;
|
||||
3) xrandr --output $LAPTOP --auto --output $ANALOG --auto --right-of $LAPTOP ;;
|
||||
4) xrandr --output $LAPTOP --off --output $ANALOG --auto ;;
|
||||
1) xrandr --output $LAPTOP --auto --gamma $g:$g:$g --output $PRESENTATION --off --output $WORKSTATION --off; reset_lxpanel; ;;
|
||||
2) xrandr --output $LAPTOP --mode 1024x768 --pos 0x0 --output $PRESENTATION --mode 1024x768 --pos 0x0 --gamma $g:$g:$g; reset_lxpanel; ;;
|
||||
3) xrandr --output $LAPTOP --auto --output $WORKSTATION --auto --right-of $LAPTOP; side_lxpanel right; ;;
|
||||
4) xrandr --output $LAPTOP --auto --output $WORKSTATION --auto --left-of $LAPTOP; side_lxpanel left; ;;
|
||||
5) xrandr --output $LAPTOP --off --output $WORKSTATION --auto; reset_lxpanel; ;;
|
||||
esac
|
||||
|
||||
restart_lxpanel
|
||||
|
||||
Reference in New Issue
Block a user