update 13-09-2024.

This commit is contained in:
root_informatica 2024-09-13 22:13:00 -03:00
parent ee30d115f2
commit 908b6bc08f
16 changed files with 145 additions and 162 deletions

View file

@ -28,6 +28,9 @@ I have left the three main scripts, which are the ones I use daily, as the funda
**THE CORE SCRIPTS:**
**[wms.sh]** \
creates the temporary variable file and puts some services to work.
**[wms_voyeur.sh]** \
watch xorg events and do things.
@ -36,28 +39,21 @@ manage focus and colors.
**[wms_usher.sh]** \
move / resize windows.
-fullsize.
-half screen (north, south, est, west).
-centered.
**THE OPT SCRIPTS**
**[wms_switch.sh]** \
jump across windows with menú. (dmenu, fzfmenu, etc.)
-next / prev / wid.
**[wms_shepperd.sh]** \
herds (group windows by herd).
-add individual window.
-add all windows.
-togle herds.
**[wms_layout.sh]** \
window arrangements.
-monocule.
-widespread.
-tiled.
**[wms_bottom]** \
put windows in teh background.
**THE FETICHES**
@ -68,12 +64,6 @@ alternate color borders according to the state of the battery (only on laptops,
**[wms_termrename.sh]** \
change terminal name.
**[wms_mimic.sh]** \
extract colors from the desktop content and use them for decorations, background and more.
**[wms_bottom.sh]** \
send windows to the background and ingore them.
**[wms_screensaver.sh]** \
simple screensaver consisting of the movement of windows across the screen.
@ -85,13 +75,11 @@ simple screensaver consisting of the movement of windows across the screen.
3 - install a daemon for keyboard events, I have used sxhkd. Copy your configuration file, sxhkdrc, from wms/config to .config/sxhkd/.
4 - copy the wms_var file contained in wms/config to .config/wms/.
5 - add the following lines in .xinitrc or sxrc: \
sxhkd & \
exec wms_voyeur.sh \
exec wms.sh \
!! In the case of using a Display Manager, copy the wms.desktop file contained in wms/config to /usr/share/xsessions and add the file wms.sh to the executable path.
!! In the case of using a Display Manager, copy the wms.desktop file contained in wms/config to /usr/share/xsessions.
**This spawn doesn't have mouse support** \

View file

@ -1,24 +0,0 @@
audio
chat
config
dired
emacs
game
irc
irssi
mail
movie
nchat
music
photo
podcast
profanity
script
system
text
torrent
toxic
typing
video
web
xmpp

View file

@ -1,36 +0,0 @@
# terminal.
TERMINAL="xterm"
# menu command.
XMENU=xmenu.sh
# active color
AC=B2AA8E
# inactive color
IC=393128
# background color.
BC=101010
# border width.
BW=2
# windows percentage
WP=94
# master area percentage.
MP=60
# gaps.
GAP=6
# focused window.
FW=$(pfw)
# all maped windows.
AMW=$(lsw)
# root window id.
RID=$(lsw -r)
# root window width.
RW=$(wattr w $RID)
# root window height.
RH=$(wattr h $RID)
# screen utilizable width.
SW=$((RW - 2 * BW))
# screen utilizable height.
SH=$((RH -2 * BW))

View file

@ -1,8 +0,0 @@
#!/bin/sh
# This script summarizes the content of .xinitrc and can be used in case of building a minimal environment from a Display Manager.
# wms.sh by @root_informatica.
sxhkd &
exec wms_voyeur.sh

View file

@ -4,7 +4,9 @@
## this script depends on power.sh which is in the /others repo ##
# wms_batlarm.sh by @root_informatica.
. $HOME/.config/wms/wms_var
. /tmp/wms_var
# focused window.
FW=$(pfw)
# freq.
FREQ=0.5
@ -18,13 +20,13 @@ while true; do
if [ "$STATUS" = "Discharging" ]; then
# alternate border colors.
for c in $COLORS; do
chwb -c $c $(pfw)
chwb -c $c $FW
sleep $FREQ
done
else # if not
# default border colors.
chwb -c $AC $(pfw)
chwb -c $AC $FW
# exit loop.
break

View file

@ -4,13 +4,16 @@
## it depends of wms_focuser.sh ##
# wms_backgroundize.sh by @root_informatica.
. $HOME/.config/wms/wms_var
. /tmp/wms_var
FLAG=$1
# focused window.
FW=$(pfw)
# bottomized window id.
BID=$(lsw -o)
# send windows to background
background() {
bottom() {
# store size and place of the focused widnow in atom.
atomx WM_IGN="$(wattr xywh $FW) $FW" $FW
# put it on bottom in window stack order.
@ -43,5 +46,5 @@ if [ -n "$BID" ]; then
restore
else
background
bottom
fi

View file

@ -3,9 +3,13 @@
## some layouts to order the windows ##
# wms_layout.sh by @root_informatica.
. $HOME/.config/wms/wms_var
. /tmp/wms_var
FLAG=$1
# focused window.
FW=$(pfw)
# all managed windows.
AMW=$(lsw)
# count maped windows.
CMW=$(lsw | wc -l)
@ -21,7 +25,7 @@ EOF
# all windows at full screen
monocule() {
for wid in $(lsw); do
for wid in $AMW; do
wtp 0 0 $SW $SH $wid
done
}
@ -88,7 +92,7 @@ widespread() {
ymax=$(((RH - wh) / CMW))
# put windows in cascade
for wid in $(lsw); do
for wid in $AMW; do
wtp $x $y $ww $wh $wid
# incremental X value.
x=$((x + xmax))

View file

@ -1,49 +0,0 @@
#!/bin/sh
## extract colors from the desktop content by writing them to wms_var so that they are used by wms ##
# wms_mimic.sh by @root_informatica.
# temp image target.
TMPIMG="/tmp/mimic.png"
# temp extracted colors file.
TMPCOL="/tmp/tmpcol"
# window manager variables.
WMSVAR="$HOME/.config/wms/wms_var"
# default x variables file.
XVAR="$HOME/.Xresources"
# number of colors to extract.
NC="3"
# spy on what's on the desktop
import -w root $TMPIMG
# color extractor
colext() {
magick $TMPIMG -colors $NC -depth 6 -format '%c' -alpha off histogram:info:- | awk -v RS="" '{print $11,$7,$3}' | tr -d '#'
}
# if the image file exists, extract the colors and store them temporarily
if [ -f "$TMPIMG" ]; then
colext > $TMPCOL
# check if N colors have been extracted
if [ "$(wc -w < $TMPCOL)" = "$NC" ]; then
# load extracted colors into variables
read ac ic bc < $TMPCOL
# overwrite the values in ~/.config/wms/wms_var
sed -i "s/^.*\bAC=\b.*$/AC=$ac/" $WMSVAR # new acive color
sed -i "s/^.*\bIC=\b.*$/IC=$ic/" $WMSVAR # new inactive color
# sed -i "s/^.*\bBC=\b.*$/BC=$bc/" $WMSVAR # new background color
# overwrite the xterm, emacs and nsxiv values in ~/.Xresources
# sed -i "s/\(XTerm\*background:\).*/\XTerm\*background: \#$bc/" $XVAR
# sed -i "s/\(Nsxiv\*window.background:\).*/\Nsxiv\*window.background: \#$bc/" $XVAR
# apply the change
# wms_value.sh -d
wms_focuser.sh -t
xrdb -merge $XVAR
fi
fi

View file

@ -3,9 +3,11 @@
## use the windows on the desktop as screensavers by moving them randomly ##
# wms_screensaver.sh by @root_informatica.
. $HOME/.config/wms/wms_var
. /tmp/wms_var
FLAG=$1
# focused window.
FW=$(pfw)
# windows width = 80% of the screen.
WW=$((SW * 80 / 100))
# windows height = 80% of the screen.

View file

@ -3,10 +3,11 @@
## sort windows by herds/flock ##
# wms_shepperd.sh by @root_informatica.
. $HOME/.config/wms/wms_var
. $HOME/.config/wms/wms_names
. /tmp/wms_var
FLAG=$1
# focused window.
FW=$(pfw)
usage() {
cat<<EOF
@ -23,7 +24,7 @@ EOF
# create atom in focused window
add_focused() {
# chose herd name.
h_name="$($XMENU < $NAMES)"
h_name="$($XM < $NM)"
if [ -n "$h_name" ]; then
atomx WM_HERD="$h_name $FW" $FW
else
@ -34,7 +35,7 @@ add_focused() {
# create atom in all maped windows
add_all() {
# chose herd name.
h_name="$($XMENU < $NAMES)"
h_name="$($XM < $NM)"
for wid in $AMW; do
if [ -n "$h_name" ]; then
atomx WM_HERD="$h_name $wid" $wid
@ -60,7 +61,7 @@ togle() {
# check if any herd exist.
if [ -n "$herds" ]; then
# select herd target.
h_target=$(printf "$herds" | $XMENU)
h_target=$(printf "$herds" | $XM)
# windwos to map.
wind_to_map=$(atomx WM_HERD $(lsw -u) | grep $h_target | cut -d ' ' -f2)
# windows to unmap.

View file

@ -3,8 +3,10 @@
## switch between windows ##
# wms_jumper.sh by @root_informatica.
. $HOME/.config/wms/wms_var
. /tmp/wms_var
# all managed windows.
AMW=$(lsw)
# delay.
DELAY=.2
@ -14,7 +16,7 @@ if [ -n "$AMW" ]; then
TARGET=$(\
for wid in $(lsw); do
printf '%s\n' "$wid | $(atomx WM_CLASS $wid) | $(wname $wid)"
done | cut -c 1-100 | $XMENU | cut -d '|' -f 1)
done | cut -c 1-100 | $XM | cut -d '|' -f 1)
sleep $DELAY &&
wms_focuser.sh "$TARGET" # focus target

View file

@ -3,11 +3,14 @@
## rename terminals ##
# wms_termrename.sh by @root_informatica.
. $HOME/.config/wms/wms_var
. /tmp/wms_var
# focused window.
FW=$(pfw)
# if any terminal is focused.
if [ "$(atomx WM_CLASS $FW)" = "$TERMINAL" ]; then
if [ "$(atomx WM_CLASS $FW)" = "$TRM" ]; then
# change atom name.
atomx WM_NAME="$($XMENU < $NAMES)" $FW
atomx WM_NAME="$($XM < $NM)" $FW
fi

View file

@ -4,6 +4,8 @@
# wms_toggle.sh by @root_informatica.
FLAG=$1
# focused window.
FW=$(pfw)
usage() {
cat<<EOF
@ -35,7 +37,5 @@ case $FLAG in
*)
usage
;;
esac
esac

91
wms.sh Executable file
View file

@ -0,0 +1,91 @@
#!/bin/sh
# general viariables.
# first a little art.
WMS_ART='"
──▄────▄▄▄▄▄▄▄────▄───
─▀▀▄─▄█████████▄─▄▀▀──
─────██─▀███▀─██──────
───▄─▀████▀████▀─▄────
─▀█────██▀█▀██────█▀──
█ █ █▄ ▄█ ▄▀▀
▀▄▀▄▀ █ ▀ █ ▄██
"'
WM=wms
TERMINAL=xterm
XMENU=xmenu.sh
ACTIVE_COLOR=a0a0a0
INACTIVE_COLOR=404040
BACKGROUND_COLOR=101010
BORDER_WIDTH=2
GAP=6
WINDOWS_PERCENTAGE=94
MASTER_PERCENTAGE=60
NAMES="emacs
profanity
nchat
toxic
irssi
music
podcast
"
# some math.
ROOT_ID=$(lsw -r)
ROOT_WIDTH=$(wattr w $ROOT_ID)
ROOT_HEIGHT=$(wattr h $ROOT_ID)
SCREEN_WIDTH=$((ROOT_WIDTH - 2 * BORDER_WIDTH))
SCREEN_HEIGHT=$((ROOT_HEIGHT - 2 * BORDER_WIDTH))
# a super simple desktop wallpaper
BITMAP="
#define wms_width 32
#define wms_height 20
static unsigned char wms_bits[] = {
0xff, 0xff, 0xff, 0xff, 0x6f, 0x57, 0xb5, 0xfb, 0xe7, 0x03, 0xf0, 0xf9,
0xe7, 0x01, 0xe0, 0xf9, 0xe3, 0x01, 0xe0, 0xf1, 0x45, 0x00, 0x40, 0xf4,
0x9f, 0x00, 0x80, 0xfe, 0x7f, 0x00, 0x80, 0xff, 0x5f, 0x00, 0x80, 0xfe,
0x7f, 0x08, 0x86, 0xff, 0xff, 0x08, 0x84, 0xff, 0x7f, 0x00, 0xc0, 0xff,
0x57, 0x00, 0x80, 0xf6, 0x9f, 0x01, 0x60, 0xfe, 0xc7, 0x01, 0xe0, 0xf8,
0xe3, 0x03, 0xf0, 0xf1, 0x47, 0x01, 0xb0, 0xf9, 0xef, 0x23, 0xf1, 0xf9,
0xff, 0xf7, 0xfd, 0xff, 0xff, 0xff, 0xff, 0xff };
"
# make general variables and math simpler and accessible to all scripts.
printf "
ART=$WMS_ART
TRM=$TERMINAL
XM=$XMENU
AC=$ACTIVE_COLOR
IC=$INACTIVE_COLOR
BC=$BACKGROUND_COLOR
BW=$BORDER_WIDTH
WP=$WINDOWS_PERCENTAGE
MP=$MASTER_PERCENTAGE
GAP=$GAP
RW=$ROOT_WIDTH
RH=$ROOT_HEIGHT
SW=$SCREEN_WIDTH
SH=$SCREEN_HEIGHT
" > /tmp/wms_var
# give a good name to the work environment.
atomx WM_NAME=$WM $ROOT_ID > /dev/null 2>&1
# create the names file.
printf "$NAMES" > /tmp/wms_names
# start the keyboard daemon listener.
sxhkd &
# if is not set,
[ ! -f $HOME/.wall.xbm ] && \
printf "$BITMAP" > $HOME/wall.xbm
# put a nice background image.
xsetroot -fg "#$BACKGROUND_COLOR" -bg "#$INACTIVE_COLOR" -bitmap $HOME/wall.xbm
# finaly, start the xorg event listener.
wms_voyeur.sh

View file

@ -3,9 +3,11 @@
## give windows the focus and put some color ##
# wms_focuser.sh by @root_informatica.
. $HOME/.config/wms/wms_var
. /tmp/wms_var
FLAG=$1
# focused window.
FW=$(pfw)
usage() {
cat<<EOF

View file

@ -3,9 +3,11 @@
## move and resize windows ##
# wms_usher.sh by @root_informatica.
. $HOME/.config/wms/wms_var
. /tmp/wms_var
FLAG=$1
# focused window.
FW=$(pfw)
usage() {
cat<<EOF