Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # $OpenBSD: Xsetup_0.in,v 1.1 2021/08/30 15:38:27 matthieu Exp $
- xrandr --output default --dpi 96
- xbacklight -set 50
- xset b off
- # requires pkg_add terminus-font
- xset fp+ /usr/local/share/fonts/terminus
- XRES=$(xrdb -query)
- # set background color
- BG_COLOR=$(echo "$XRES" | awk '/xroot.background/ { print $2 }')
- xsetroot -solid $BG_COLOR
- # show the date and time as two different widgets
- for CLK in date time; do
- FACE=$(echo "$XRES" | grep "xclock.${CLK}Face" | xargs | cut -d ' ' -f 2-)
- GEOM=$(echo "$XRES" | grep "xclock.${CLK}Geom" | xargs | cut -d ' ' -f 2-)
- STR=$(echo "$XRES" | grep "xclock.${CLK}Str" | xargs | cut -d ' ' -f 2-)
- xclock -face "$FACE" -geometry "$GEOM" -strftime "$STR" &
- done
- # show the Sleep / Restart / Shutdown bar
- # in case of sleep, pop xmessage again after waking up
- (
- while true; do
- xmessage -geometry -32-32 -buttons "[ Sleep ]":20,"[ Restart ]":21,"[ Shutdown ]":22 ""
- ACTION=$?
- echo "S/R/S bar: code $ACTION"
- if [ $ACTION -eq 20 ]; then
- /usr/sbin/zzz;
- elif [ $ACTION -eq 21 ]; then
- xsetroot -cursor_name watch
- /sbin/shutdown -r now
- elif [ $ACTION -eq 22 ]; then
- xsetroot -cursor_name watch
- /sbin/shutdown -p now
- else
- echo "S/R/S bar: $ACTION is not a button code."
- fi
- # stop looping if xclock died (killed by GiveConsole)
- if [ -z "$(pgrep -U root xclock)" ]; then break; fi
- done
- ) &
- # session chooser bar
- (
- # get session list
- . /etc/X11/xenodm/session-list
- # set default session
- if [ ! -s /tmp/xenodm-session ]; then
- echo "LXQt" > /tmp/xenodm-session
- fi
- # make button list
- for _session in $SESSIONLIST; do
- if [ -z $XBUTTONS ]; then
- XBUTTONS="[ ${_session%_*} ]:${_session#*_}"
- else
- XBUTTONS="$XBUTTONS,[ ${_session%_*} ]:${_session#*_}"
- fi
- done
- # start bar
- while true; do
- xmessage -geometry +32-32 -buttons "${XBUTTONS}" "Session: $(cat /tmp/xenodm-session)"
- CACTION=$?
- echo "Session Chooser: code $CACTION"
- if [ $CACTION -ge 30 ] && [ $CACTION -le 39 ]; then
- echo $SESSIONLIST | sed "s/_$CACTION.*//;s/.* //" > /tmp/xenodm-session
- else
- echo "Session Chooser: $CACTION is not a button code."
- fi
- # stop looping if xclock died (killed by GiveConsole)
- if [ -z "$(pgrep -U root xclock)" ]; then break; fi
- done
- ) &
- # uname
- (
- XUNAMES=$(uname -sr)
- XUNAMEA=$(uname -a)
- XUNAME=$XUNAMES
- while true; do
- xmessage -geometry +32+2 -buttons "$XUNAME":0 ""
- UACTION=$?
- echo "Uname bar: code $UACTION"
- if [ $UACTION -eq 0 ]; then
- if [ "$XUNAME" = "$XUNAMES" ]; then
- XUNAME=$XUNAMEA
- else
- XUNAME=$XUNAMES
- fi
- else
- echo "Uname bar: $UACTION is not a button code."
- fi
- # stop looping if xclock died (killed by GiveConsole)
- if [ -z "$(pgrep -U root xclock)" ]; then break; fi
- done
- ) &
- # screenshot
- #sleep 3 && xwd -out /tmp/xenodm$(date +%Y%m%d.%H%M).xwd -root &
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement