Scrotwm

Izvor: HrOpenWiki
Inačica od 20:20, 29. kolovoza 2011. koju je unio/unijela Lutherus (razgovor | doprinosi)

Skoči na: orijentacija, traži

Scrotwm je malen dinamičan tiling upravitelj prozorima za X. Rađen je sa idejom da se korisniku kloni sa puta da ga ne ometa u radi kako bi korisnik imao veću koncentraciju na samu radnu površinu i na kraju krajeva sam rad. Ne traži poznavanje nijednog programskog jezika za svoju konfiguraciju u po riječima autora, nastao je od hackera te je namjenjen hackerima. Pisan je u C-u i nastao je optimizacijom koda popularnog tiling managera DWM-a.

Instalacija

Nalazi se u repozitorijima svih većih distribucija no obradit ćemo samo za Arch i Debian jer ga Archevci i Debianovci najviše i koriste.

Arch Linux

pacman -S scrotwm

Debian GNU/Linux

sudo apt-get install scrotwm

Preporučeni alatin za normalan rad

scrot
dmenu
xlockmore
xscreensaver

Konfiguracija

Prilikom pokretanja scrotwm prvo potraži ~/.scrotwm.conf datoteku a ukoliko je nema čita sistemsku iz etc/scrotwm.conf koja služi kao odlična osnova za pisanje osobne konfguracijske datoteke.

~/.scrotwm.conf

# $scrotwm: scrotwm.conf,v 1.22 2009/11/25 15:13:29 marco Exp $
#
# colors for focussed and unfocussed window borders
color_focus		      = rgb:80/83/88
color_unfocus		= rgb:23/28/2b

# bar settings
bar_enabled		      = 1
bar_border[1]		= rgb:19/1e/21
bar_font_color[1]	      = rgb:7f/88/8c
bar_color[1]		= rgb:27/2c/2f
bar_font		      = -*-anorexia-*-*-*-*-*-*-*-*-*-*-*-*
#bar_at_bottom          =1
bar_action		      = ~/conkybaraction.sh
bar_delay		      = 1
stack_enabled		= 1
clock_enabled		= 1
title_name_enabled	= 0
title_class_enabled	= 0

# spawn app
program[term]		= urxvt
# program[screenshot_all]	= screenshot.sh full
# program[screenshot_wind]	= screenshot.sh window
# program[lock]		= xlock
# program[initscr]	= initscreen.sh
program[menu]		= dmenu_run -fn $bar_font -nb $bar_color -nf $bar_font_color -sb $bar_font_color -sf $bar_color
spawn_term		      = urxvt

# dialog box size ratio .3 >= r < 1
dialog_ratio		= 0.6

# Split a non-Xrandr dual head setup into one region per monitor
# (non-standard driver-based multihead is not seen by scrotwm)
# region		= screen[1]:1280x1024+0+0
# region		= screen[1]:1280x1024+1280+0

# mod key, (windows key is Mod4) (apple key on OSX is Mod2)
modkey = Mod4

# key bindings
#unbind with: bind[]    = <keys>
bind[cycle_layout]	= MOD+space
bind[stack_reset]	      = MOD+Shift+space
bind[master_shrink]	= MOD+-
bind[master_grow] 	= MOD+=
bind[master_add]	      = MOD+comma
bind[master_del]	      = MOD+period
bind[stack_inc]		= MOD+Shift+comma
bind[stack_dec]		= MOD+Shift+period
bind[swap_main]		= MOD+Return
bind[focus_next]	      = MOD+j
bind[focus_prev]	      = MOD+k
bind[swap_next]		= MOD+Shift+j
bind[swap_prev]		= MOD+Shift+k
bind[spawn_term]	      = MOD+Shift+Return
bind[menu]		      = MOD+p
bind[quit]		      = MOD+Shift+q
bind[restart]		= MOD+q
bind[focus_main]	      = MOD+m
bind[ws_1]		      = MOD+1
bind[ws_2]		      = MOD+2
bind[ws_3]		      = MOD+3
bind[ws_4]		      = MOD+4
bind[ws_5]		      = MOD+5
bind[ws_6]		      = MOD+6
bind[ws_7]		      = MOD+7
bind[ws_8]		      = MOD+8
bind[ws_9]		      = MOD+9
bind[ws_10]		      = MOD+0
bind[ws_next]		= Mod+Shift+Right
bind[ws_prev]		= Mod+Shift+Left
#bind[screen_next]	= MOD+Shift+Right
#bind[screen_prev]	= MOD+Shift+Left
bind[mvws_1]		= MOD+Shift+1
bind[mvws_2]		= MOD+Shift+2
bind[mvws_3]		= MOD+Shift+3
bind[mvws_4]		= MOD+Shift+4
bind[mvws_5]		= MOD+Shift+5
bind[mvws_6]		= MOD+Shift+6
bind[mvws_7]		= MOD+Shift+7
bind[mvws_8]		= MOD+Shift+8
bind[mvws_9]		= MOD+Shift+9
bind[mvws_10]		= MOD+Shift+0
bind[bar_toggle]	      = MOD+Shift+b
bind[focus_next]	      = MOD+Tab
bind[focus_prev]	      = MOD+Shift+Tab
bind[wind_kill]		= MOD+Shift+x
bind[wind_del]		= MOD+x
#bind[screenshot_all]	= MOD+s
#bind[screenshot_wind]	= MOD+Shift+s
bind[float_toggle]	= MOD+t
#bind[version]		= MOD+Shift+v
#bind[lock]		= MOD+Shift+Delete
#bind[initscr]		= MOD+Shift+i

#volume control

program[raise_volume] = amixer -q set Master 1%+ unmute
bind[raise_volume]    = XF86AudioRaiseVolume
 
program[lower_volume] = amixer -q set Master 1%- unmute
bind[lower_volume]    = XF86AudioLowerVolume
 
program[mute_volume] = amixer -q set Master mute
bind[mute_volume]    = XF86AudioMute

# quirks
# remove with: quirk[class:name] = NONE
quirk[MPlayer:xv]			= FLOAT + FULLSCREEN
quirk[Nautilus:nautilus]		= FLOAT + ANYWHERE
quirk[Gcolor2:gcolor2]  = FLOAT + ANYWHERE
#quirk[OpenOffice.org 2.4:VCLSalFrame]	= FLOAT
#quirk[OpenOffice.org 3.0:VCLSalFrame]	= FLOAT
#quirk[OpenOffice.org 3.1:VCLSalFrame]	= FLOAT
quirk[Firefox-bin:firefox-bin]		= FLOAT + FULLSCREEN
quirk[Firefox:Dialog]			= FLOAT
#quirk[Gimp:gimp]			= FLOAT + ANYWHERE
#quirk[XTerm:xterm]			= XTERM_FONTADJ
#quirk[xine:Xine Window]			= FLOAT + ANYWHERE
#quirk[Xitk:Xitk Combo]			= FLOAT + ANYWHERE
#quirk[xine:xine Panel]			= FLOAT + ANYWHERE
#quirk[Xitk:Xine Window]			= FLOAT + ANYWHERE
#quirk[xine:xine Video Fullscreen Window] = FULLSCREEN + FLOAT
#quirk[pcb:pcb]				= FLOAT

# EXAMPLE: define firefox program and bind to key
program[firefox]	      = firefox
bind[firefox]		= MOD+f

Pokretanje

Pokretanje se može obaviti na više načina,bilo manulano bilo preko nekog od login managera

Manualno

Za manualno pokretanje potrebno je u ~/.xinitrc dodati

exec sccrotwm

te pokrenuti X sa

startx

SLim

Kako slim čita ~/.xinitrc prilikom podizanja X-a postupak je isti kao i za manualno pokretanje.

XDM

Za XDM kreirajet ~/.xsession sljedećeg sadržaja

# .xsession
# This file is sourced by xdm
scrotwm

te promjenite ovlasti

chmod +x ~/.xsession

CDM

Za CDM kreirajte datoteku /usr/bin/startscrotwm sljedećeg sadržaja

logger "Starting scrotwm from /usr/bin/startscrotwm."
xrandr --dpi 96
xscreensaver -no-splash &
# and start the window manager
exec scrotwm

te u /etc/cdmrc dodajte startscrotwm

KDM

Ukoliko koristite KDM provjerite dal je /usr/share/xsessions unesen u SessionDirs unutar /usr/share/config/kdm/kdmrc. Ako je onda je scrotwm unešen automatski kao opcija izbora sesije u KDM meni.

GDM

Isto kao i za KDM

Xinerama podrška

Dodajte u konfiguraciju

region                = screen[1]:1280x1024+0+0
region                = screen[1]:1280x1024+1280+0

Statusna traka

Kako bi omogućili statusnu traku odkomentirajet sljedeće dvije linije unutar konfiguracijske datoteke

bar_action              = baraction.sh
bar_delay               = 5

Umjesto baraction.sh možete staviti conky pa će na statusnoj traci ispisivati sve conky sa svim informacijama o sustavu.

Baraction.sh

Skriptu baraction.sh smjestite u vaš ~/scripts direktorij te je chmodajte.

#!/bin/bash
# baraction.sh script for scrotwm status bar

SLEEP_SEC=5  # set bar_delay = 5 in /etc/scrotwm.conf
COUNT=0
#loops forever outputting a line every SLEEP_SEC secs
while :; do
	let COUNT=$COUNT+1
        echo -e "         Hello World! $COUNT"
        sleep $SLEEP_SEC
done

skripta za sa više informacija (pogodna za laptop korisnike)

#!/bin/bash
#baraction.sh for scrotwm status bar

SLEEP_SEC=5
#loops forever outputting a line every SLEEP_SEC secs
while :; do

 	eval $(cat /proc/acpi/battery/BAT0/state | awk '/charging state/ {printf "BAT_CHGSTATE=%s;", $3}; /remaining capacity/ {printf "BAT_REMNG=%s;",$3}; /present rate/ {printf "BAT_RATE=%s;",$3};' -)
 	eval $(cat /proc/acpi/battery/BAT0/info | awk '/present/ {printf "BAT_PRESENT=%s;", $2}; /last full capacity/ {printf "BAT_LASTFULL=%s;",$4};' -)
 
	BAT_REMNG_WH=`echo "scale=1; a=($BAT_REMNG+50)/1000; print a" | bc -l`
	BAT_RATE_W=`echo "scale=1; a=($BAT_RATE+50)/1000; print a" | bc -l`
	BCSCRIPT="scale=0; a=(100*$BAT_REMNG / $BAT_LASTFULL); print a"
	BAT_PCT=`echo $BCSCRIPT | bc -l`%

	case $BAT_PRESENT in
		no)
		POWER_STR="AC, NO BATTERY"
		;;
		yes)

		case $BAT_CHGSTATE in
			charged)
			#on ac
			AC_STATUS="ON AC"
			TIME_REMNG="N/A"
			POWER_STR="$AC_STATUS $BAT_CHGSTATE $BAT_PCT"
			;;
			charging)
			#on ac
			AC_STATUS="ON AC"
			BCSCRIPT="scale=1; a=(60*($BAT_LASTFULL - $BAT_REMNG) / $BAT_RATE); print a"
			TIMETOFULL_MIN=`echo $BCSCRIPT | bc -l`
			POWER_STR="$AC_STATUS $BAT_CHGSTATE $BAT_PCT C="$BAT_REMNG_WH"Wh Rate="$BAT_RATE_W"W TTF="$TIMETOFULL_MIN"min"
			;;
			discharging)
			AC_STATUS="ON BATT"
			TIME_REMNG_MIN=`echo "scale=0; a=(60*$BAT_REMNG / $BAT_RATE); print a" | bc -l`
			TIME_REMNG_HH=`echo "scale=0; a=($BAT_REMNG / $BAT_RATE); if (a<10) {print "0"; print a} else {print a}" | bc -l`

			TIME_REMNG_MM=`echo "scale=0; a=($TIME_REMNG_MIN-60*$TIME_REMNG_HH); if (a<10) {print "0"; print a} else {print a}" | bc -l`
			POWER_STR="$AC_STATUS $BAT_PCT C="$BAT_REMNG_WH"Wh P="$BAT_RATE_W"W R="$TIME_REMNG_HH":"$TIME_REMNG_MM
			;;
			*)
			POWER_STR=$BAT_CHGSTATE
			;;
		esac

		;;
		*)
		POWER_STR="error"
		;;
	esac

	#scrotwm bar_print can't handle UTF-8 characters, such as degree symbol
	#Core 0:      +67.0°C  (crit = +100.0°C)
	eval $(sensors 2>/dev/null | sed s/[°+]//g | awk '/^Core 0/ {printf "CORE0TEMP=%s;", $3}; /^Core 1/ {printf "CORE1TEMP=%s;",$3}; /^fan1/ {printf "FANSPD=%s;",$2};' -)
	TEMP_STR="Tcpu=$CORE0TEMP,$CORE1TEMP F=$FANSPD"

	WLAN_ESSID=$(iwconfig wlan0 | awk -F "\"" '/wlan0/ { print $2 }')
	eval $(cat /proc/net/wireless | sed s/[.]//g | awk '/wlan0/ {printf "WLAN_QULTY=%s; WLAN_SIGNL=%s; WLAN_NOISE=%s", $3,$4,$5};' -)
	BCSCRIPT="scale=0;a=100*$WLAN_QULTY/70;print a"
	WLAN_QPCT=`echo $BCSCRIPT | bc -l`
	WLAN_POWER=`iwconfig 2>/dev/null| grep "Tx-Power"| awk {'print $4'}|sed s/Tx-Power=//`
	WLAN_STR="$WLAN_ESSID: Q=$WLAN_QPCT% S/N="$WLAN_SIGNL"/"$WLAN_NOISE"dBm T="$WLAN_POWER"dBm"

	CPUFREQ_STR=`echo "Freq:"$(cat /proc/cpuinfo | grep 'cpu MHz' | sed 's/.*: //g; s/\..*//g;')`
	CPULOAD_STR="Load:$(uptime | sed 's/.*://; s/,//g')"

	eval $(awk '/^MemTotal/ {printf "MTOT=%s;", $2}; /^MemFree/ {printf "MFREE=%s;",$2}' /proc/meminfo)
	MUSED=$(( $MTOT - $MFREE ))
	MUSEDPT=$(( ($MUSED * 100) / $MTOT ))
	MEM_STR="Mem:${MUSEDPT}%"

	echo -e "$POWER_STR  $TEMP_STR  $CPUFREQ_STR  $CPULOAD_STR  $MEM_STR  $WLAN_STR"
        #alternatively if you prefer a different date format
        #DATE_STR=`date +"%H:%M %a %d %b`
	#echo -e "$DATE_STR   $POWER_STR  $TEMP_STR  $CPUFREQ_STR  $CPULOAD_STR  $MEM_STR  $WLAN_STR"

	sleep $SLEEP_SEC
done

Korištenje

    • izvađeno sa službene wiki stranice
Meta+Shift+Return: otvara terminal
Meta+p: dmenu 
Meta+1/2/3/4/5/6/7/8/9/0: select radne površine 1-10
Meta+Shift+1/2/3/4/5/6/7/8/9/0:seli prozor na površinu 1-10
Meta+Right/Left: sljedeća/prethodna površina
Meta+Shift+Right/Left: sljedeći/prethodni  desktop
Meta+Spacebar: mijenja položaj prozora
Meta+j/k: pomiće prozore naprijed/natrag
Meta+Tab/Meta+Shft+Tab: kao i Meta+j/k
Meta+Return: master 
Meta+h/l:  smanjuje/povećava master prozor