Read common/nickstheme
# Bigger fonts must be set before including rootmenu
-Style * Font 'xft:M+1P+IPAG:Bold:size=9:minspace=true:rgba=rgb:antialias=true:encoding=iso10646-1'
-Style * IconFont 'xft:M+1P+IPAG:Bold:size=9:minspace=true:rgba=rgb:antialias=true:encoding=iso10646-1'
-MenuStyle * Font 'xft:M+1P+IPAG:size=9:minspace=true:rgba=rgb:antialias=true:encoding=iso10646-1'
-MenuStyle * TitleFont 'xft:M+1P+IPAG:Bold:size=9:minspace=true:rgba=rgb:antialias=true:encoding=iso10646-1'
+Style * Font 'xft:Meiryo Short:Bold:size=9:minspace=true:rgba=rgb:antialias=true:encoding=iso10646-1'
+Style * IconFont 'xft:Meiryo Short:Bold:size=9:minspace=true:rgba=rgb:antialias=true:encoding=iso10646-1'
+MenuStyle * Font 'xft:Meiryo Short:size=9:minspace=true:rgba=rgb:antialias=true:encoding=iso10646-1'
+MenuStyle * TitleFont 'xft:Meiryo Short:Bold:size=9:minspace=true:rgba=rgb:antialias=true:encoding=iso10646-1'
Read artemis/rootmenu
Read common/wallpaper
Mouse 5 T N Windowshade False
# Console
-Key grave A C Exec exec $[TERMINAL]
+Key grave A C Exec exec $[TERMINAL]
+Key grave A CM Exec exec $[TERMINAL] -e zsh -f
Key F3 A M Module FvwmConsole -terminal $[TERMINAL]
Key F3 A M2 Module FvwmConsole -terminal $[TERMINAL]
AddToFunc Mod_M3Func
+ C Lower
+ D Maximize 100 0
- + M PipeRead '. $[FVWM_USERDIR]/scripts/resize.sh $[pointer.wx] $[pointer.wy] $[w.width] $[w.height]'
+ + M PipeRead 'exec $[FVWM_USERDIR]/scripts/resize.sh $[pointer.wx] $[pointer.wy] $[w.width] $[w.height]'
Style * ColorSet 1
Style * HilightColorSet 2
-# Fonts. Probably need to patch FVWM to support proper selection of Japanese
-# fonts...
-Style * Font 'xft:M+1P+IPAG:Bold:size=8:minspace=true:rgba=rgb:antialias=true:encoding=iso10646-1'
-Style * IconFont 'xft:M+1P+IPAG:Bold:size=8:minspace=true:rgba=rgb:antialias=true:encoding=iso10646-1'
-MenuStyle * Font 'xft:M+1P+IPAG:size=8:minspace=true:rgba=rgb:antialias=true:encoding=iso10646-1'
-MenuStyle * TitleFont 'xft:M+1P+IPAG:Bold:size=8:minspace=true:rgba=rgb:antialias=true:encoding=iso10646-1'
+# "Meiryo Short" is a modified version of a font from Windows Vista.
+# Previous configs used M+1P+IPAG with reasonable results.
+# If FVWM supported multiple font selection, this would be nicer.
+Style * Font 'xft:Meiryo Short:Bold:size=8:minspace=true:rgba=rgb:antialias=true:encoding=iso10646-1'
+Style * IconFont 'xft:Meiryo Short:Bold:size=8:minspace=true:rgba=rgb:antialias=true:encoding=iso10646-1'
+MenuStyle * Font 'xft:Meiryo Short:size=8:minspace=true:rgba=rgb:antialias=true:encoding=iso10646-1'
+MenuStyle * TitleFont 'xft:Meiryo Short:Bold:size=8:minspace=true:rgba=rgb:antialias=true:encoding=iso10646-1'
MenuStyle * HilightBack, HilightTitleBack, Hilight3DOff
MenuStyle * TrianglesSolid, TrianglesUseFore, TitleUnderlines1
MenuStyle * SeparatorsLong, BorderWidth 1
MenuStyle * ItemFormat "%.3s%.2|%2.4i%.5l%.5l%.5r%.5i%2.3>%1|"
MenuStyle * MenuColorset 3, ActiveColorset 4, TitleColorset 8
-MenuStyle * VerticalTitleSpacing 3 2, VerticalItemSpacing 2 2
+MenuStyle * VerticalTitleSpacing 1 1, VerticalItemSpacing 1 2
# Buttons: menu iconify maximize --title-- shade close
Mouse 1 1 N Menu MenuWindow
AddToFunc MakeMenuWallpaper
+ I DestroyMenu recreate MenuWallpaper
+ I AddToMenu MenuWallpaper Wallpaper Title
- + I PipeRead '. $[FVWM_USERDIR]/scripts/bgmenu.sh $[BGROOT] MenuWallpaper'
+ + I PipeRead 'exec $[FVWM_USERDIR]/scripts/bgmenu.zsh $[BGROOT] MenuWallpaper'
DestroyFunc SetWallpaper
AddToFunc SetWallpaper
DestroyFunc InitFunction
DestroyFunc StartFunction
DestroyFunc ExitFunction
-SetEnv TERMINAL /home/nick/bin/urxvt.sh
+
+# Global environment
+SetEnv TERMINAL $[HOME]/bin/urxvt.sh
PipeRead 'echo SetEnv HOST `hostname`'
+SetEnv MUSIC /home/music
+
+SetEnv XMODIFIERS '@im=uim'
+SetEnv GTK_IM_MODULE 'uim'
+SetEnv QT_IM_MODULE 'uim'
+
# Global Features
Read global/multiscreen
Read global/fullscreen
Read global/windowmenu
+Read global/appspecific
# Machine-specific features
-Read $[HOST]/config
+PipeRead "[ -f '$[FVWM_USERDIR]/$[HOST]/config' ] \
+ && echo Read $[HOST]/config \
+ || echo Read default/config"
# Virtual Desktops
DesktopSize 6x1
EdgeThickness 1
-EdgeResistance 1 0
+EdgeResistance 1
+Style * EdgeMoveDelay 1, EdgeMoveResistance 0
EdgeScroll 0 0
#####
--- /dev/null
+atropos
\ No newline at end of file
--- /dev/null
+# Global definitions
+SetEnv MUSIC /stuff/music
+
+# Import common features
+Read common/bindings
+Read common/nickstheme
+
+# Bigger fonts must be set before including rootmenu
+Style * Font 'xft:Meiryo Short:Bold:size=9:minspace=true:rgba=rgb:antialias=true:encoding=iso10646-1'
+Style * IconFont 'xft:Meiryo Short:Bold:size=9:minspace=true:rgba=rgb:antialias=true:encoding=iso10646-1'
+MenuStyle * Font 'xft:Meiryo Short:size=9:minspace=true:rgba=rgb:antialias=true:encoding=iso10646-1'
+MenuStyle * TitleFont 'xft:Meiryo Short:Bold:size=9:minspace=true:rgba=rgb:antialias=true:encoding=iso10646-1'
+
+Read finial/rootmenu
+Read common/wallpaper
+Read common/panels
+Read common/modifier
+
+# Bindings for the modifier key
+Mouse 1 WFT 4 Mod_M1Func
+Mouse 2 WFT 4 Mod_M2Func
+Mouse 3 WFT 4 Mod_M3Func
+Mouse 1 WFT 42 Mod_M1Func
+Mouse 2 WFT 42 Mod_M2Func
+Mouse 3 WFT 42 Mod_M3Func
+
+# Struts for the pager.
+EwmhBaseStruts 0 0 0 42
--- /dev/null
+MenuStyle * !TitleWarp
+
+CopyMenuStyle * MenuMPD
+MenuStyle MenuMPD ItemFormat "%.2|%3.5l%.5l%2.3>%-65.5r%.5i%1|"
+
+DestroyMenu MenuFvwmRoot
+AddToMenu MenuFvwmRoot
++ DynamicPopupAction MakeMenuFvwmRoot
+
+DestroyFunc MakeMenuFvwmRoot
+AddToFunc MakeMenuFvwmRoot
++ I DestroyMenu recreate MenuFvwmRoot
++ I PipeRead 'echo AddToMenu MenuFvwmRoot "$USER@`hostname`" Title'
++ I AddToMenu MenuFvwmRoot "Terminal%terminal.svg:16x16%" Exec exec $[TERMINAL]
++ I AddToMenu MenuFvwmRoot "Firefox%firefox.png%" Exec exec firefox
++ I PipeRead "xlsclients -a | grep ' gmpc$' >/dev/null || echo\
+ AddToMenu MenuFvwmRoot 'GMPC%gmpc.png%' Exec exec gmpc"
++ I AddToMenu MenuFvwmRoot "" Nop
++ I AddToMenu MenuFvwmRoot "Network%network.svg:16x16%" Popup MenuNetwork
++ I AddToMenu MenuFvwmRoot "" Nop
++ I AddToMenu MenuFvwmRoot "Wallpaper%wallpaper.svg:16x16%" Popup MenuWallpaper
++ I AddToMenu MenuFvwmRoot "Music%music.svg:16x16%" Popup MenuMPD
++ I AddToMenu MenuFvwmRoot "" Nop
++ I AddToMenu MenuFvwmRoot "Restart FVWM%reload.svg:16x16%" Restart
++ I AddToMenu MenuFvwmRoot "Exit FVWM%logout.svg:16x16%"\
+ Module FvwmForm FvwmForm-QuitVerify
+
+DestroyMenu MenuNetwork
+AddToMenu MenuNetwork
++ "Pan Newsreader%pan.png%" Exec exec env LC_ALL=en_CA.UTF-8 pan
+
+DestroyMenu MenuMPD
+AddToMenu MenuMPD
++ DynamicPopUpAction MakeMenuMPD
++ DynamicPopDownAction KillMenuMPD
+ChangeMenuStyle MenuMPD MenuMPD
+
+DestroyFunc MakeMenuMPD
+AddToFunc MakeMenuMPD
++ I DestroyMenu recreate MenuMPD
++ I PipeRead "exec $[FVWM_USERDIR]/scripts/mpdmenu.pl --menu MenuMPD"
+
+Mouse 3 R A Menu MenuFvwmRoot
--- /dev/null
+Style "Guild Wars" StaysOnTop
-Key F10 W A DoFullScreen
+Key F10 W C DoFullScreen
DestroyFunc Fullscreen
AddToFunc FullScreen
-CFLAGS = -O2 -Wall -Wextra -Wno-sign-compare
+CFLAGS = -O2 -Wall -Wextra -Wno-sign-compare -Wno-missing-field-initializers
LDFLAGS =
-CC = c89
+CC = c99
LD = $(CC)
all: xaspect
+clean:
+ rm -f *.o xaspect
.c.o:
$(CC) -c -o $@ $(CFLAGS) $<
#include <stdlib.h>
#include <string.h>
#include <math.h>
+#include <inttypes.h>
#include <xcb/xcb.h>
#define MKASPECT(w, h) { (double)w/h, #w ":" #h }
} aspects[] = {
MKASPECT(16, 10),
MKASPECT(16, 9),
- MKASPECT(8, 5),
+ MKASPECT(8, 3),
MKASPECT(5, 4),
MKASPECT(4, 3)
};
return best;
}
+struct options {
+ char *displayname;
+ int showdimensions;
+} *parseoptions(int argc, char **argv)
+{
+ static struct options opts = { 0 };
+ int i;
+
+ for (i = 1; i < argc; i++) {
+ if (strcmp(argv[i], "-display") == 0) {
+ if (++i < argc) {
+ opts.displayname = argv[i];
+ continue;
+ }
+ fprintf(stderr, "-display requires an argument\n");
+ } else if (strcmp(argv[i], "-dimensions") == 0) {
+ opts.showdimensions = 1;
+ }
+ }
+
+ return &opts;
+}
+
int main(int argc, char **argv)
{
xcb_connection_t *display;
xcb_screen_t *screen;
- char *dpynam = NULL;
int screen_num;
- if (argc > 2 && strcmp(argv[1], "-display") == 0)
- dpynam = argv[2];
+ struct options *opts = parseoptions(argc, argv);
- display = xcb_connect(dpynam, &screen_num);
+ display = xcb_connect(opts->displayname, &screen_num);
if (xcb_connection_has_error(display)) {
fprintf(stderr, "Failed to open display.\n");
xcb_disconnect(display);
return EXIT_FAILURE;
}
+ if (opts->showdimensions) {
+ printf("%" PRIu16 "x%" PRIu16 "-",
+ screen->width_in_pixels, screen->height_in_pixels);
+ }
printf("%s\n", testaspect(screen));
xcb_disconnect(display);
-#!/bin/sh
+#!/bin/zsh
# Generates an FVWM menu for selecting the PNG images found in a given
# directory. Thumbnails for the images are generated on the fly using convert
# from ImageMagick, and stored in the .thumbs subdirectory. The menu items
menu="MenuWallpaper"
func="SetWallpaper"
-thumber="$HOME/.fvwm/scripts/thumbnail.sh"
+thumber="$FVWM_USERDIR/scripts/thumbnail.zsh"
if [ ! -d "$1" ]; then
echo "usage: $0 <directory> [menuname]" 1>&2
fi
[ -n "$2" ] && menu="$2"
-for i in "$1"/*.png; do
+for i in "$1"/*$($FVWM_USERDIR/scripts/C/xaspect).png; do
thumb="`$thumber --size x160 "$i"`"
echo "AddToMenu $menu \"`basename "${i%.png}"`*$thumb*\" $func \"$i\""
done
use strict;
use Getopt::Long;
-use IO::Socket;
+use IO::Socket::INET6;
use constant {
MPD_MJR_MIN => 0,
$title = decode_utf8($title) if defined($title);;
# Connect to MPD.
-my $sock = new IO::Socket::INET(
+my $sock = new IO::Socket::INET6(
PeerAddr => $host,
PeerPort => $port,
Proto => 'tcp'
my $key = $_;
my $a_album = sanitise($key);
- open THUMB, "-|", "$FVWM/scripts/thumbnail.sh",
+ open THUMB, "-|", "$FVWM/scripts/thumbnail.zsh",
"--small", "--music", $albums{$key};
my $thumb = <THUMB>;
close THUMB;
- die("Incompetent use of thumbnail.sh") if ($?);
+ die("Incompetent use of thumbnail.zsh") if ($?);
$thumb =~ s/\n//sg;
$thumb = "%$thumb%" if (-f $thumb);
$t_artist = sanitise($t_artist);
$t_title = sanitise($t_title);
- open THUMB, "-|", "$FVWM/scripts/thumbnail.sh",
+ open THUMB, "-|", "$FVWM/scripts/thumbnail.zsh",
"--small", "--music", $t_file;
my $thumb = <THUMB>;
close(THUMB);
- die("Incompetent use of thumbnail.sh") if ($?);
+ die("Incompetent use of thumbnail.zsh") if ($?);
$thumb =~ s/\n//sg;
$thumb = "%$thumb%" if (-f $thumb);
}
die("Failed data query\n") unless (keys(%entry) > 0);
- open THUMB, "-|", "$FVWM/scripts/thumbnail.sh",
+ open THUMB, "-|", "$FVWM/scripts/thumbnail.zsh",
"--image", "--music", $entry{file};
my $thumb = <THUMB>;
my $scan = <THUMB>;
--- /dev/null
+#!/usr/bin/perl
+
+use strict;
+
+my $FVWM = (defined $ENV{FVWM_USERDIR}) ? $ENV{FVWM_USERDIR}
+ : $ENV{HOME}."/.fvwm";
+
+die ("usage: randombg.pl <directory>") if (! -d $ARGV[0]);
+
+open XASPECT, "-|", "$FVWM/scripts/C/xaspect", "-dimensions";
+my $aspect = <XASPECT>;
+close XASPECT;
+die ("Incompetent use of xaspect") if ($?);
+
+$aspect =~ s/(^\s*)|(\s*$)//g;
+
+opendir WALLPAPER, $ARGV[0];
+my @dir = grep(/\Q$aspect\E\.png$/, readdir WALLPAPER);
+closedir WALLPAPER;
+
+print $ARGV[0] . "/" . $dir[int(rand(@dir))] . "\n";
+++ /dev/null
-#!/bin/sh
-
-music=/home/music
-thumbs="$HOME/.fvwm/.thumbs"
-
-if [ ! -d "$thumbs" ]; then
- mkdir "$thumbs" || exit 1
-fi
-
-size="x128"
-printimg=""
-ismusic=""
-
-while [ "${1#--}" != "$1" -a "$1" != "-" ]; do
- if [ "$1" = "--small" ]; then
- size="56"
- elif [ "$1" = "--size" ]; then
- size="$2"
- shift
- elif [ "$1" = "--music" ]; then
- ismusic="yes"
- elif [ "$1" = "--image" ]; then
- printimg="yes"
- else
- echo "unrecognised option: $1" 1>&2
- exit 1
- fi
- shift
-done
-[ "$1" = "-" ] && shift
-
-if ! expr match "$size" '^\([0-9]*\(x[0-9]\+\)\?\)$' &>/dev/null; then
- echo "invalid size specification: $size" 1>&2
- exit 1
-fi
-
-if [ -z "$1" ]; then
- echo "usage: thumbnail.sh [--small|--size <spec>] [--image] [--music] path" 1>&2
- exit 1
-fi
-
-if [ -n "$ismusic" ]; then
- path="$music/`dirname "${1#$music}"`/cover.jpg"
- [ ! -f "$path" ] && path="${path%jpg}png"
-else
- path="$1"
-fi
-
-[ ! -f "$path" ] && exit 0
-
-image="`readlink -f -- "$path"`"
-[ ! -f "$image" ] && exit 0
-
-thumb="$thumbs/`echo -n $image | md5sum - | cut -d ' ' -f 1`_$size.png"
-if [ -f "$thumb" ]; then
- mtime_s="`stat -c %Y -- "$image"`"
- mtime_t="`stat -c %Y -- "$thumb"`"
- if [ "$mtime_s" -gt "$mtime_t" ]; then
- convert -scale "$size" "$image" "$thumb"
- fi
-else
- convert -scale "$size" "$image" "$thumb"
-fi
-
-echo "$thumb"
-[ -n "$printimg" ] && echo "$image"
-exit 0
--- /dev/null
+#!/bin/zsh
+
+if [[ -z "$MUSIC" ]]; then
+ MUSIC=/home/music
+fi
+
+thumbs="$HOME/.fvwm/.thumbs"
+
+if ! [[ -d "$thumbs" ]]; then
+ mkdir "$thumbs" || exit 1
+fi
+
+size="x128"
+printimg=""
+ismusic=""
+
+while [[ "${1#--}" != "$1" && "$1" != "-" ]]; do
+ if [[ "$1" == "--small" ]]; then
+ size="56"
+ elif [[ "$1" == "--size" ]]; then
+ size="$2"
+ shift
+ elif [[ "$1" = "--music" ]]; then
+ ismusic="yes"
+ elif [[ "$1" = "--image" ]]; then
+ printimg="yes"
+ else
+ echo "unrecognised option: $1" 1>&2
+ exit 1
+ fi
+ shift
+done
+[ "$1" = "-" ] && shift
+
+if ! [[ "$size" =~ '^([0-9]*(x[0-9]+)?)$' ]]; then
+ echo "invalid size specification: $size" 1>&2
+ exit 1
+fi
+
+if [[ -z "$1" ]]; then
+ echo "usage: thumbnail.zsh [--small|--size <spec>] [--image] [--music] path" 1>&2
+ exit 1
+fi
+
+if [[ -n "$ismusic" ]]; then
+ imgpath="$MUSIC/$(dirname "${1#$MUSIC}")/cover.jpg"
+ [[ ! -f "$imgpath" ]] && imgpath="${imgpath%jpg}png"
+else
+ imgpath="$1"
+fi
+
+[[ ! -f "$imgpath" ]] && exit 0
+
+image="$(readlink -f -- "$imgpath")"
+[[ ! -f "$image" ]] && exit 0
+
+thumb="$thumbs/$(echo -n $image | md5sum - | cut -d ' ' -f 1)_$size.png"
+if [[ -f "$thumb" ]]; then
+ mtime_s="$(stat -c %Y -- "$image")"
+ mtime_t="$(stat -c %Y -- "$thumb")"
+ if [ "$mtime_s" -gt "$mtime_t" ]; then
+ convert -scale "$size" "$image" "$thumb"
+ fi
+else
+ convert -scale "$size" "$image" "$thumb"
+fi
+
+echo "$thumb"
+[ -n "$printimg" ] && echo "$image"
+exit 0