desktop/spectrwm: Updated for version 2.2.0.

Signed-off-by: dsomero <xgizzmo@slackbuilds.org>
This commit is contained in:
LEVAI Daniel 2013-04-24 07:14:11 -04:00 committed by Niels Horn
parent 16da631ccd
commit dec4a7c0b0
10 changed files with 289 additions and 22 deletions

View file

@ -1,10 +1,12 @@
Spectrwm is a small dynamic tiling window manager for X11. It tries Spectrwm is a small dynamic tiling window manager for X11. It tries to stay out
to stay out of the way so that valuable screen real estate can be of the way so that valuable screen real estate can be used for much more
used for much more important stuff. It has sane defaults and does important stuff. It has sane defaults and does not require one to learn a
not require one to learn a language to do any configuration. It language to do any configuration. It was written by hackers for hackers and it
was written by hackers for hackers and it strives to be small, strives to be small, compact and fast.
compact and fast.
This package contains: This package installs an example spectrwm.conf, which contains a fair number of
- example spectrwm.conf and shell scripts for it options and default values. Also, there are example scripts for the bar_action
- occasionally bug fixes and improvements from upstream git configure option, that can be used (perhaps after further customization) on
Slackware to display CPU, memory, wifi link, battery and X11 keyboard layout.
Further information about this can be found in the package's documentation
directory.

View file

@ -0,0 +1,31 @@
spectrwm_baraction.sh is the main script that can be set as the value for the
bar_action option in spectrwm.conf.
You can install it in your PATH and configure it like this (the values are just
examples):
bar_enabled = 1
bar_font = -*-terminus-medium-*-*-*-14-*-*-*-*-*-*-*
bar_action = spectrwm_baraction.sh
This script uses the following utilities:
o top(1) - installed on Slackware
o free(1) - installed on Slackware
o setxkbmap(1) - installed on Slackware
o skb(1) - optional, can be used for alternative keyboard layout detection
o battery_status.sh - optional
Needs the power_supply class in the /sys directory.
o wifi_link_quality.sh - optional
Needs ip(8) from the iproute2 package and iwconfig(8) from the
wireless-tools package (both of which is installed on Slackware).
spectrwm_screenshot.sh:
This makes a screenshot of the actual X11 screen or optionally just a window.
It needs the graphics/scrot package from the SBo repository.
You can configure it in your spectrwm.conf like this:
program[capture] = spectrwm_screenshot.sh full
bind[capture] = MOD+c
program[capture_w] = spectrwm_screenshot.sh window
bind[capture_w] = MOD+Shift+c
Needless to say, that these scripts must be in your PATH it the above cases.

View file

@ -0,0 +1,30 @@
#!/bin/sh
PREF=/sys/class/power_supply/BAT0
[ -r "${PREF}" ] || exit 1
BATTERY_STATUS=$(< ${PREF}/status)
typeset -i FULL_CAPACITY=$(< ${PREF}/charge_full)
typeset -i WARNING_CAPACITY=$(( ${FULL_CAPACITY} * 20 / 100 ))
typeset -i LOW_CAPACITY=$(( ${FULL_CAPACITY} * 10 / 100 ))
typeset -i REMAINING_CAPACITY=$(< ${PREF}/charge_now)
REMAINING_PERCENTAGE=$( echo "scale=1; ${REMAINING_CAPACITY} * 100 / ${FULL_CAPACITY}" |bc )
case "${BATTERY_STATUS}" in
'Full') # battery full
printf "AC"
;;
'Discharging') # battery discharging
printf "${REMAINING_PERCENTAGE}%%"
;;
'Charging') # battery charging
printf "AC^${REMAINING_PERCENTAGE}%%"
;;
esac
exit 0

View file

@ -0,0 +1,73 @@
# Spectrwm example script for SBo slackbuild.
# See spectrwm(1) for information about the configuration options,
# and examples/spectrwm_orig.conf under the package's documentation directory
# for the original example configuration file which contains more options and
# descriptions.
# A rather long and informative bar with a custom date and time display.
# Feel free to play around with the switches - after you've read the
# spectrwm(1) man page ;)
bar_enabled = 1
bar_font = -*-terminus-medium-*-*-*-14-*-*-*-*-*-*-*
bar_action = /home/daniell/bin/spectrwm_baraction.sh
stack_enabled = 1 # current stacking algorithm
clock_enabled = 1
clock_format = %Y.%m.%d[%V] %a %H:%M.%S
title_name_enabled = 1 # current window's title
title_class_enabled = 1 # current window's class name
window_name_enabled = 1 # current window's name
urgent_enabled = 1 # information about the workspace's urgency hints
verbose_layout = 0 # workspace's master and stack values
focus_mode = default # default, follow, manual
disable_border = 1 # remove window border when bar is disabled and
# there's only one window on a workspace
#modkey = Mod4 # Win
modkey = Mod1 # Alt
# These will be started when spectrwm(1) starts.
#autorun = ws[1]:urxvt
#autorun = ws[1]:firefox
#autorun = ws[2]:Thunar
#autorun = ws[3]:liferea
#autorun = ws[4]:audacious
#autorun = ws[6]:libreoffice
#autorun = ws[7]:skype
# Custom window manager settings for specific programs
quirk[mplayer2:gl] = FLOAT + FULLSCREEN
quirk[mplayer2:xv] = FLOAT + FULLSCREEN
quirk[ioquake3.i386:ioquake3.i386] = FLOAT
quirk[openarena.i386:openarena.i386] = FLOAT
quirk[Firefox-bin:firefox-bin] = TRANSSZ + FLOAT
quirk[Firefox:Navigator] = TRANSSZ
quirk[Firefox:Browser] = FLOAT
quirk[Firefox:Toolkit] = FLOAT
quirk[Firefox:Download] = FLOAT
quirk[Firefox:Extension] = FLOAT
quirk[Chrome:chrome] = TRANSSZ
quirk[Gimp:gimp] = NONE
# These are custom bindings:
# See example/keybindings/spectrwm_*.conf under the package' documentation
# directory for more information.
#keyboard_mapping = ~/.spectrwm.binds
# executes this on bind[term]
#spawn_term = /usr/bin/urxvt
# Example key bindings (see spectrwm(1) and the 'keyboard_mapping' option above):
program[capture] = spectrwm_screenshot.sh full
bind[capture] = MOD+c
program[capture_w] = spectrwm_screenshot.sh window
bind[capture_w] = MOD+Shift+c
program[lock] = xlock -mode blank -bg black -fg white
bind[lock] = MOD+Control+l
bind[lock] = XF86Sleep
program[media] = audacious
bind[media] = XF86Media

View file

@ -0,0 +1,98 @@
#!/bin/sh
typeset -i USED=0
typeset -i AVAIL=0
typeset -i FREE=0
typeset -i CACHED=0
_mem() {
case "${OS}" in
'OpenBSD')
TOP_OUT=$(top -b -1 -d 1 |egrep ^Memory:)
USED=$(echo ${TOP_OUT} |cut -d' ' -f3 |cut -d/ -f1 |tr -d M)
AVAIL=$(echo ${TOP_OUT} |cut -d' ' -f3 |cut -d/ -f2 |tr -d M)
FREE=$(echo ${TOP_OUT} |cut -d' ' -f6 |tr -d M)
CACHED=$(echo ${TOP_OUT} |cut -d' ' -f8 |tr -d M)
;;
'Linux')
FREE_OUT=$(free -m |egrep ^Mem: |tr -s ' ')
USED=$(echo ${FREE_OUT} |cut -d' ' -f3)
AVAIL=$(echo ${FREE_OUT} |cut -d' ' -f2)
FREE=$(echo ${FREE_OUT} |cut -d' ' -f4)
CACHED=$(echo ${FREE_OUT} |cut -d' ' -f7)
;;
esac
MEM_OUTPUT="U: ${USED}/${AVAIL} C: ${CACHED} - ${FREE}"
}
typeset -i USER=0
typeset -i NICE=0
typeset -i SYS=0
typeset -i IO=0
typeset -i IDLE=0
_cpu() {
case "${OS}" in
'OpenBSD')
TOP_OUT=$(top -b -1 -s 1 -d 2 |egrep '^All CPUs' |tail -n1 |tr -d '[a-z %]' |cut -d: -f2-)
NICE=$(echo ${TOP_OUT} |cut -d, -f2 |cut -d. -f1)
SYS=$(echo ${TOP_OUT} |cut -d, -f3 |cut -d. -f1)
IO=$(echo ${TOP_OUT} |cut -d, -f4 |cut -d. -f1)
IDLE=$(echo ${TOP_OUT} |cut -d, -f5 |cut -d. -f1)
USER=$(echo ${TOP_OUT} |cut -d, -f1 |cut -d. -f1)
;;
'Linux')
# using top(1)
TOP_OUT=$(top -b -d 0.1 -n 2 |egrep ^Cpu |tail -n1 |tr -d '%usynidwaht ' |cut -d: -f2-)
NICE=$(echo ${TOP_OUT} |cut -d, -f3 |cut -d. -f1)
SYS=$(echo ${TOP_OUT} |cut -d, -f2 |cut -d. -f1)
IO=$(echo ${TOP_OUT} |cut -d, -f5 |cut -d. -f1)
IDLE=$(echo ${TOP_OUT} |cut -d, -f4 |cut -d. -f1)
USER=$(echo ${TOP_OUT} |cut -d, -f1 |cut -d. -f1)
# using iostat(1)
#IOSTAT_OUT=$(iostat -c 1 2 |tail -n2 |head -n1 |tr -s ' ' |tr ' ' '|')
#NICE=$(echo ${IOSTAT_OUT} |cut -d\| -f3 |cut -d, -f1)
#SYS=$(echo ${IOSTAT_OUT} |cut -d\| -f4 |cut -d, -f1)
#IO=$(echo ${IOSTAT_OUT} |cut -d\| -f5 |cut -d, -f1)
#IDLE=$(echo ${IOSTAT_OUT} |cut -d\| -f7 |cut -d, -f1)
#USER=$(echo ${IOSTAT_OUT} |cut -d\| -f2 |cut -d, -f1)
;;
esac
CPU_OUTPUT="U: ${USER} S: ${SYS} N: ${NICE} I: ${IO} - ${IDLE}"
}
_xkb_layout() {
# this won't work with "XkbLayout" "us,hu" like setups:
CURRENT_LAYOUT=$(setxkbmap -query |awk '/^layout:/ {print $2}')
# ... but if you have skb(1)
#CURRENT_LAYOUT=$(skb -1)
XKB_LAYOUT_OUTPUT="[${CURRENT_LAYOUT}]"
}
_battery() {
BAT_OUTPUT=$(battery_status.sh)
}
_wifi() {
WIFI_OUTPUT=$(wifi_link_quality.sh)
}
OS=$(uname -s)
CPU_OUTPUT=''
MEM_OUTPUT=''
XKB_LAYOUT_OUTPUT=''
WIFI_OUTPUT=''
BAT_OUTPUT=''
while :;do
_cpu; echo -n "${CPU_OUTPUT} "
_mem; echo -n "${MEM_OUTPUT} "
_xkb_layout; echo -n "${XKB_LAYOUT_OUTPUT} "
_wifi; echo -n "${WIFI_OUTPUT} "
_battery; echo -n "${BAT_OUTPUT} "
echo
done

View file

@ -0,0 +1,21 @@
#!/bin/sh
SCROT=$(which scrot)
[ -x "${SCROT}" ] || exit 1
screenshot() {
case $1 in
full)
"${SCROT}" --multidisp
;;
window)
sleep 0.5
"${SCROT}" --select
;;
*)
;;
esac;
}
screenshot $1

View file

@ -0,0 +1,10 @@
#!/bin/sh
wlan_int=wlan0
/sbin/ip link show dev ${wlan_int} >/dev/null 2>&1 || exit 1
/sbin/ip link show dev ${wlan_int} 2>&1 |fgrep -q -e"state DOWN" && exit 1
LINK_QUALITY=$( /sbin/iwconfig "${wlan_int}" 2>&1 |fgrep -e'Link Quality' |tr -s ' ' |cut -d' ' -f3 |cut -d= -f2 )
echo "{${LINK_QUALITY}}"

View file

@ -1,9 +1,9 @@
# HOW TO EDIT THIS FILE: # HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description. Line # The "handy ruler" below makes it easier to edit a package description.
# up the first '|' above the ':' following the base package name, and the '|' # Line up the first '|' above the ':' following the base package name, and
# on the right side marks the last column you can put a character in. You must # the '|' on the right side marks the last column you can put a character in.
# make exactly 11 lines for the formatting to be correct. It's also # You must make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'. # customary to leave one space after the ':' except on otherwise blank lines.
|-----handy-ruler------------------------------------------------------| |-----handy-ruler------------------------------------------------------|
spectrwm: spectrwm (small dynamic tiling window manager) spectrwm: spectrwm (small dynamic tiling window manager)

View file

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# Copyright (c) 2011, 2012 Daniel LEVAI # Copyright (c) 2011-2013 LEVAI Daniel
# All rights reserved. # All rights reserved.
# #
# * Redistribution and use in source and binary forms, with or without # * Redistribution and use in source and binary forms, with or without
@ -24,7 +24,7 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
PRGNAM=spectrwm PRGNAM=spectrwm
VERSION=${VERSION:-2.1.1} VERSION=${VERSION:-2.2.0}
BUILD=${BUILD:-1} BUILD=${BUILD:-1}
TAG=${TAG:-_SBo} TAG=${TAG:-_SBo}
@ -94,9 +94,11 @@ rm -f $PKG/usr/bin/scrotwm
find . -type f -exec gzip -9 {} \; find . -type f -exec gzip -9 {} \;
) )
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION/examples/ mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION/examples/keybindings
cp -a spectrwm*.conf initscreen.sh baraction.sh screenshot.sh \ install -m0644 -oroot -groot initscreen.sh $CWD/examples/* \
$PKG/usr/doc/$PRGNAM-$VERSION/examples/ $PKG/usr/doc/$PRGNAM-$VERSION/examples/
cp -a spectrwm.conf $PKG/usr/doc/$PRGNAM-$VERSION/examples/spectrwm_orig.conf
cp -a spectrwm_*.conf $PKG/usr/doc/$PRGNAM-$VERSION/examples/keybindings/
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
find $PKG/usr/doc -type f -exec chmod 0644 {} \; find $PKG/usr/doc -type f -exec chmod 0644 {} \;

View file

@ -1,10 +1,10 @@
PRGNAM="spectrwm" PRGNAM="spectrwm"
VERSION="2.1.1" VERSION="2.2.0"
HOMEPAGE="https://opensource.conformal.com/wiki/spectrwm" HOMEPAGE="https://opensource.conformal.com/wiki/spectrwm"
DOWNLOAD="https://opensource.conformal.com/snapshots/spectrwm/spectrwm-2.1.1.tgz" DOWNLOAD="https://opensource.conformal.com/snapshots/spectrwm/spectrwm-2.2.0.tgz"
MD5SUM="98aba16fb76131bdf57ead10c8583d9a" MD5SUM="c572727b5fb9fe3674c03a7e51d191c4"
DOWNLOAD_x86_64="" DOWNLOAD_x86_64=""
MD5SUM_x86_64="" MD5SUM_x86_64=""
REQUIRES="" REQUIRES=""
MAINTAINER="Daniel LEVAI" MAINTAINER="LEVAI Daniel"
EMAIL="leva@ecentrum.hu" EMAIL="leva@ecentrum.hu"