1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
|
#!/bin/sh
# Hammerhead Openbox autostart - Zygaena marine-dark identity.
# Idempotent: only launch a daemon if it isn't already running, so
# `openbox --restart` doesn't spawn duplicate panels.
running() { ps -ef | grep -v grep | grep -q "$1"; }
running "[p]icom" || picom --backend xrender -b 2>/dev/null &
# tint2 finds its config live via XDG_CONFIG_DIRS; conky does NOT honor
# XDG_CONFIG_DIRS, so give it the system config path explicitly (stays live).
running "[t]int2" || tint2 &
running "[c]onky" || conky -c @@PREFIX@@/etc/xdg/conky/conky.conf &
feh --bg-fill @@PREFIX@@/share/backgrounds/hammerhead.png 2>/dev/null &
#!/bin/sh
# Build script for hammerhead-desktop (Zygaena marine-dark branding config).
#
# No upstream tarball - all inputs are local files shipped alongside this
# script in the port directory. The only compiled artifact is the cairo
# wallpaper generator, built and run once here (its output PNG is what
# actually ships - the generator binary itself is not installed).
set -e
PORTDIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
export PKG_CONFIG_PATH="$PREFIX/lib/pkgconfig:$PREFIX/share/pkgconfig:/usr/lib/pkgconfig:$PKG_CONFIG_PATH"
# --- Step 1: build + run the wallpaper generator ---
gcc "$PORTDIR/wallpaper-gen.c" $(pkg-config --cflags --libs cairo) -lm -o "$PORTDIR/wg"
mkdir -p "$PKGDIR$PREFIX/share/backgrounds"
"$PORTDIR/wg" "$PKGDIR$PREFIX/share/backgrounds/hammerhead.png"
# --- Step 2: Openbox theme ---
mkdir -p "$PKGDIR$PREFIX/share/themes/Hammerhead/openbox-3"
cp "$PORTDIR/themerc" "$PKGDIR$PREFIX/share/themes/Hammerhead/openbox-3/themerc"
# --- Step 3: tint2 panel config ---
# Matches the existing tint2 port's own default install location
# ($PREFIX/etc/xdg/tint2 - tint2's cmake build doesn't honor
# --sysconfdir), and what the integration step's XDG_CONFIG_DIRS
# ($PREFIX/etc/xdg) resolves against.
mkdir -p "$PKGDIR$PREFIX/etc/xdg/tint2"
cp "$PORTDIR/tint2rc" "$PKGDIR$PREFIX/etc/xdg/tint2/tint2rc"
# --- Step 4: conky config ---
mkdir -p "$PKGDIR$PREFIX/etc/xdg/conky"
cp "$PORTDIR/conky.conf" "$PKGDIR$PREFIX/etc/xdg/conky/conky.conf"
# --- Step 5: Openbox rc.xml + menu.xml ---
mkdir -p "$PKGDIR$PREFIX/etc/xdg/openbox"
cp "$PORTDIR/rc.xml" "$PKGDIR$PREFIX/etc/xdg/openbox/rc.xml"
cp "$PORTDIR/menu.xml" "$PKGDIR$PREFIX/etc/xdg/openbox/menu.xml"
# --- Step 6: autostart (substitute the real $PREFIX) ---
sed "s#@@PREFIX@@#$PREFIX#g" "$PORTDIR/autostart" \
> "$PKGDIR$PREFIX/etc/xdg/openbox/autostart"
chmod 755 "$PKGDIR$PREFIX/etc/xdg/openbox/autostart"
# --- Step 7: screenshot tool (hh-grab XGetImage->PNG + hh-screenshot wrapper) ---
# Bound to Print in rc.xml; saves to ~/Pictures/hh-<timestamp>.png.
mkdir -p "$PKGDIR$PREFIX/bin"
gcc "$PORTDIR/hh-grab.c" -I"$PREFIX/include" -L"$PREFIX/lib" -R"$PREFIX/lib" -lX11 -lpng \
-o "$PKGDIR$PREFIX/bin/hh-grab"
install -m 755 "$PORTDIR/hh-screenshot" "$PKGDIR$PREFIX/bin/hh-screenshot"
# --- Step 8: PDF/image launcher wrappers + branded welcome PDF ---
gcc "$PORTDIR/pdf-gen.c" $(pkg-config --cflags --libs cairo) -o "$PORTDIR/pdfgen"
mkdir -p "$PKGDIR$PREFIX/share/hammerhead"
"$PORTDIR/pdfgen" "$PKGDIR$PREFIX/share/hammerhead/welcome.pdf"
rm -f "$PORTDIR/pdfgen"
install -m 755 "$PORTDIR/hh-pdf" "$PKGDIR$PREFIX/bin/hh-pdf"
install -m 755 "$PORTDIR/hh-images" "$PKGDIR$PREFIX/bin/hh-images"
# --- Step 9: Openbox pipemenus (Places, Recent Files) ---
# GTK-free, POSIX-sh, pattern adapted from CrunchBang++'s
# cbpp-places-pipemenu / cbpp-recent-files-pipemenu; referenced from
# menu.xml via execute="hh-places-pipemenu" / "hh-recent-pipemenu".
install -m 755 "$PORTDIR/hh-places-pipemenu" "$PKGDIR$PREFIX/bin/hh-places-pipemenu"
install -m 755 "$PORTDIR/hh-recent-pipemenu" "$PKGDIR$PREFIX/bin/hh-recent-pipemenu"
# --- Step 10: branded tint2 launcher icons + .desktop entries ---
# The stock launcher was illegible: st ships no icon, xnedit's png was loose,
# and hicolor had no index.theme so name-lookup failed. We ship our own cairo
# glyphs and point each .desktop Icon= at an ABSOLUTE path, which tint2 loads
# directly (no icon theme required). tint2rc references these three by path.
gcc "$PORTDIR/icon-gen.c" $(pkg-config --cflags --libs cairo) -lm -o "$PORTDIR/ig"
mkdir -p "$PKGDIR$PREFIX/share/hammerhead-desktop/launcher"
"$PORTDIR/ig" "$PKGDIR$PREFIX/share/hammerhead-desktop/launcher"
rm -f "$PKGDIR$PREFIX/share/hammerhead-desktop/launcher/preview.png" # review-only
rm -f "$PORTDIR/ig"
mkdir -p "$PKGDIR$PREFIX/share/applications"
cp "$PORTDIR/hh-terminal.desktop" "$PORTDIR/hh-files.desktop" \
"$PORTDIR/hh-editor.desktop" "$PKGDIR$PREFIX/share/applications/"
# Clean up the transient build helper - not shipped.
rm -f "$PORTDIR/wg"
# --- Step 11: /etc/skel/.xsession (Task 4b) ---
# New users' home dirs are seeded from /etc/skel, so this makes a fresh
# account's X session default to the Openbox desktop without any manual
# ~/.xsession setup.
mkdir -p "$PKGDIR/etc/skel"
install -m 755 "$PORTDIR/dot-xsession" "$PKGDIR/etc/skel/.xsession"
# --- Step 12: hh-desktop-init (per-user ~/.config seed, CBPP-style) ---
# openbox-autostart only reads ~/.config or /etc/xdg (not our /usr/local/etc/xdg),
# so the X session entrypoints call this to seed ~/.config on login for new AND
# existing users (copy-if-missing).
install -m 755 "$PORTDIR/hh-desktop-init" "$PKGDIR$PREFIX/bin/hh-desktop-init"
-- Hammerhead conky config - Zygaena marine-dark identity
-- Installed to $PREFIX/etc/xdg/conky/conky.conf
-- Uses conky's native illumos/kstat stat backend (no ${exec} shellouts
-- needed for cpu/mem/fs/net - see task brief).
--
-- Typography/layout adapted from CrunchBang++'s signature right-side
-- conky (github.com/CBPP/cbpp-configs, simon-weber/crunchbang-conf):
-- monospace, right-aligned, uppercase section labels over hairline
-- rules, compact bars. Restyled teal-on-dark instead of CBPP's grey/red,
-- and kept our native kstat vars (no CBPP-style ${exec} shellouts).
conky.config = {
own_window = true,
own_window_type = 'desktop',
own_window_transparent = true,
own_window_argb_visual = true,
own_window_argb_value = 200,
own_window_hints = 'undecorated,below,sticky,skip_taskbar,skip_pager',
alignment = 'top_right',
gap_x = 24,
gap_y = 40,
minimum_width = 260,
maximum_width = 300,
update_interval = 2.0,
double_buffer = true,
use_xft = true,
font = 'monospace:size=9',
default_color = 'cfe0e0',
color1 = '1fb6b6', -- headings / accents
color2 = '5a7575', -- muted / rules
draw_shades = false,
draw_outline = false,
draw_borders = false,
background = false,
}
conky.text = [[
${alignr}${color1}${font monospace:bold:size=14}HAMMERHEAD${font}${color}
${alignr}${color2}${nodename}${color}
${alignr}${color2}${hr 1}${color}
${alignr}${color1}SYSTEM${color}
${alignr}uptime ${color1}${uptime}${color}
${alignr}load ${color1}${loadavg}${color}
${alignr}${color1}CPU${color}
${alignr}${cpu}%${color}
${alignr}${cpubar 6,220}
${alignr}${color1}MEMORY${color}
${alignr}${mem} / ${memmax}${color}
${alignr}${membar 6,220}
${alignr}${color1}DISK (/)${color}
${alignr}${fs_used /} / ${fs_size /}${color}
${alignr}${fs_bar 6,220 /}
${alignr}${color1}NETWORK${color}
${alignr}down ${color1}${downspeed}${color} / up ${color1}${upspeed}${color}
]]
#!/bin/sh
# Hammerhead default X session - launch the Openbox desktop.
#
# Put the Hammerhead desktop config (/usr/local/etc/xdg) on the XDG search
# path so openbox/tint2/conky find the branded config without ~/.config.
# (xdm's Xsession also sets this; repeated here so `startx`/xinit users, who
# run ~/.xsession directly, get the branded desktop too.)
export XDG_CONFIG_DIRS="/usr/local/etc/xdg:${XDG_CONFIG_DIRS:-/etc/xdg}"
export XDG_DATA_DIRS="/usr/local/share:${XDG_DATA_DIRS:-/usr/share}"
# Seed ~/.config so openbox-autostart (which only reads ~/.config or /etc/xdg)
# runs our autostart -> tint2/conky/wallpaper. See hh-desktop-init.
/usr/local/bin/hh-desktop-init
exec /usr/local/bin/openbox-session
#!/bin/sh
# hh-desktop-init - point the user's openbox autostart at the LIVE system
# autostart so desktop-config updates ALWAYS take, with no per-user copies to
# go stale. Called from the X session entrypoint before openbox-session.
#
# Why only the autostart: openbox-autostart (run by openbox-session) reads only
# /etc/xdg/openbox/autostart or ~/.config/openbox/autostart -- NOT
# XDG_CONFIG_DIRS -- so the autostart is the single desktop file that must live
# under ~/.config. Everything else resolves live from /usr/local/etc/xdg via
# XDG_CONFIG_DIRS (set by the X session): openbox rc.xml/menu.xml and tint2rc;
# conky is launched by the autostart with an explicit -c path. So none of those
# need a per-user copy.
#
# We make ~/.config/openbox/autostart a SYMLINK to the system autostart (not a
# copy), so a package update to the autostart is picked up with no re-seed.
# A pre-existing non-symlink here is treated as legacy seeded state and migrated
# to the symlink.
SYS=/usr/local/etc/xdg/openbox/autostart
CFG="${XDG_CONFIG_HOME:-$HOME/.config}/openbox"
mkdir -p "$CFG" 2>/dev/null || exit 0
if [ "$(readlink "$CFG/autostart" 2>/dev/null)" != "$SYS" ]; then
rm -f "$CFG/autostart" 2>/dev/null
ln -sf "$SYS" "$CFG/autostart" 2>/dev/null
fi
exit 0
[Desktop Entry]
Type=Application
Name=Editor
Comment=XNEdit text editor
Exec=/usr/local/bin/xnc -tabbed %F
Icon=/usr/local/share/hammerhead-desktop/launcher/editor.png
Categories=Utility;TextEditor;
Terminal=false
[Desktop Entry]
Type=Application
Name=Files
Comment=Xfe file manager
Exec=xfe
Icon=/usr/local/share/hammerhead-desktop/launcher/files.png
Categories=System;FileManager;
Terminal=false
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <png.h>
#include <stdio.h>
#include <stdlib.h>
int main(int c,char**v){Display*d=XOpenDisplay(NULL);if(!d){fprintf(stderr,"no display\n");return 1;}
Window r=DefaultRootWindow(d);XWindowAttributes g;XGetWindowAttributes(d,r,&g);
XImage*im=XGetImage(d,r,0,0,g.width,g.height,AllPlanes,ZPixmap);if(!im)return 1;
FILE*f=fopen(c>1?v[1]:"screenshot.png","wb");png_structp p=png_create_write_struct(PNG_LIBPNG_VER_STRING,0,0,0);
png_infop i=png_create_info_struct(p);png_init_io(p,f);png_set_IHDR(p,i,g.width,g.height,8,PNG_COLOR_TYPE_RGB,0,0,0);
png_write_info(p,i);png_bytep row=malloc(3*g.width);for(int y=0;y<g.height;y++){for(int x=0;x<g.width;x++){
unsigned long px=XGetPixel(im,x,y);row[3*x]=(px>>16)&0xFF;row[3*x+1]=(px>>8)&0xFF;row[3*x+2]=px&0xFF;}png_write_row(p,row);}
png_write_end(p,i);fclose(f);return 0;}
#!/bin/sh
mkdir -p "$HOME/Pictures"
exec /usr/local/bin/feh --auto-zoom --scale-down --geometry 1000x720 "$HOME/Pictures" /usr/local/share/backgrounds
#!/bin/sh
[ -n "$1" ] && exec /usr/local/bin/mupdf-x11 "$@"
exec /usr/local/bin/mupdf-x11 /usr/local/share/hammerhead/welcome.pdf
#!/bin/sh
# hh-places-pipemenu - Openbox "Places" pipe menu (GTK-free)
#
# Pattern adapted from CrunchBang++'s cbpp-places-pipemenu
# (github.com/CBPP/cbpp-pipemenus, Copyright (C) 2010 John Crawley,
# ported to #!++ by Ben Young) - same idea (walk a directory, XML-escape
# names, emit an <openbox_pipe_menu>) but rewritten small/flat for our
# stack: no thunar/exo-open/geany, no recursive submenus. Every entry
# opens in xfe; a matching terminal entry opens st in that directory.
#
# Usage: <menu id="places-menu" label="Places" execute="hh-places-pipemenu"/>
# in menu.xml. Invoked with no arguments; always lists $HOME's immediate
# subdirectories (dotdirs skipped).
#
# NB: the shell, not bash - keep this POSIX sh / dash-fast per upstream.
files="xfe"
xml_escape() {
# $1 -> escaped on stdout
printf '%s' "$1" | sed \
-e 's/&/\&/g' \
-e 's/</\</g' \
-e 's/>/\>/g' \
-e 's/"/\"/g'
}
home="${HOME:-/root}"
printf '<openbox_pipe_menu>\n'
printf ' <item label="~ Home">\n'
printf ' <action name="Execute"><command>%s %s</command></action>\n' "$files" "$(xml_escape "$home")"
printf ' </item>\n'
printf ' <item label="Terminal Here">\n'
printf ' <action name="Execute"><command>st -d %s</command></action>\n' "$(xml_escape "$home")"
printf ' </item>\n'
printf ' <separator/>\n'
# Immediate subdirectories of $HOME, skipping dotdirs, alphabetical.
for d in "$home"/*/; do
[ -d "$d" ] || continue
d="${d%/}"
base="${d##*/}"
case "$base" in
.*) continue ;;
esac
label="$(xml_escape "$base")"
path="$(xml_escape "$d")"
printf ' <item label="%s">\n' "$label"
printf ' <action name="Execute"><command>%s %s</command></action>\n' "$files" "$path"
printf ' </item>\n'
printf ' <item label="Terminal: %s">\n' "$label"
printf ' <action name="Execute"><command>st -d %s</command></action>\n' "$path"
printf ' </item>\n'
done
printf '</openbox_pipe_menu>\n'
#!/bin/sh
# hh-recent-pipemenu - Openbox "Recent Files" pipe menu (GTK-free)
#
# Loosely modeled on CrunchBang++'s cbpp-recent-files-pipemenu
# (github.com/CBPP/cbpp-pipemenus), but that one parses GTK's
# ~/.local/share/recently-used.xbel, which nothing on Hammerhead writes
# (no GTK). Instead: find(1) over $HOME for recently-modified
# docs/images, opened with the matching viewer.
#
# Usage: <menu id="recent-menu" label="Recent Files" execute="hh-recent-pipemenu"/>
max_entries=12
home="${HOME:-/root}"
xml_escape() {
printf '%s' "$1" | sed \
-e 's/&/\&/g' \
-e 's/</\</g' \
-e 's/>/\>/g' \
-e 's/"/\"/g'
}
viewer_for() {
case "$1" in
*.pdf) echo "hh-pdf" ;;
*.png|*.jpg|*.jpeg|*.gif|*.bmp) echo "hh-images" ;;
*) echo "xnedit" ;;
esac
}
printf '<openbox_pipe_menu>\n'
count=0
find "$home" -maxdepth 3 -type f \
\( -iname '*.pdf' -o -iname '*.txt' -o -iname '*.png' -o -iname '*.jpg' -o -iname '*.jpeg' \) \
-mtime -14 -print 2>/dev/null | while IFS= read -r f; do
viewer="$(viewer_for "$f")"
label="$(xml_escape "${f##*/}")"
path="$(xml_escape "$f")"
printf ' <item label="%s">\n' "$label"
printf ' <action name="Execute"><command>%s %s</command></action>\n' "$viewer" "$path"
printf ' </item>\n'
count=$((count + 1))
[ "$count" -ge "$max_entries" ] && break
done
printf '</openbox_pipe_menu>\n'
#!/bin/sh
mkdir -p "$HOME/Pictures"
exec /usr/local/bin/hh-grab "$HOME/Pictures/hh-$(date +%Y%m%d-%H%M%S).png"
[Desktop Entry]
Type=Application
Name=Terminal
Comment=st terminal emulator
Exec=st
Icon=/usr/local/share/hammerhead-desktop/launcher/terminal.png
Categories=System;TerminalEmulator;
Terminal=false
/*
* icon-gen.c - Zygaena marine-dark launcher icon generator.
*
* Renders three 48x48 ARGB launcher glyphs - terminal, files, editor - in
* the Hammerhead teal palette (matching wallpaper-gen.c). tint2 loads these
* by ABSOLUTE path (Icon=/usr/local/share/hammerhead-desktop/launcher/*.png),
* so no freedesktop icon theme / hicolor index.theme is required - which is
* exactly why the stock launcher was illegible (st shipped no icon, xnedit's
* png was loose, hicolor had no index.theme).
*
* Build: gcc icon-gen.c $(pkg-config --cflags --libs cairo) -lm -o ig
* Usage: ./ig /output/dir (writes terminal.png, files.png, editor.png,
* and preview.png for design review)
*/
#include <cairo.h>
#include <math.h>
#include <stdio.h>
#define S 48 /* icon canvas size */
/* palette - matches wallpaper-gen.c */
#define TILE_R 0x12/255.0
#define TILE_G 0x2e/255.0
#define TILE_B 0x34/255.0
#define TEAL_R 0x1f/255.0
#define TEAL_G 0xb6/255.0
#define TEAL_B 0xb6/255.0
#define TEALBR_R 0x54/255.0
#define TEALBR_G 0xe0/255.0
#define TEALBR_B 0xe0/255.0
#define TEXT_R 0xcf/255.0
#define TEXT_G 0xe0/255.0
#define TEXT_B 0xe0/255.0
static void
rrect(cairo_t *cr, double x, double y, double w, double h, double r)
{
cairo_new_sub_path(cr);
cairo_arc(cr, x + w - r, y + r, r, -M_PI / 2, 0);
cairo_arc(cr, x + w - r, y + h - r, r, 0, M_PI / 2);
cairo_arc(cr, x + r, y + h - r, r, M_PI / 2, M_PI);
cairo_arc(cr, x + r, y + r, r, M_PI, 3 * M_PI / 2);
cairo_close_path(cr);
}
/* subtle elevated chip so the three icons read as one branded set */
static void
tile(cairo_t *cr)
{
rrect(cr, 2.5, 2.5, S - 5, S - 5, 10);
cairo_set_source_rgb(cr, TILE_R, TILE_G, TILE_B);
cairo_fill_preserve(cr);
cairo_set_source_rgba(cr, TEAL_R, TEAL_G, TEAL_B, 0.40);
cairo_set_line_width(cr, 1.5);
cairo_stroke(cr);
}
/* Terminal: a prompt chevron ">" plus a cursor underscore "_". */
static void
draw_terminal(cairo_t *cr)
{
tile(cr);
cairo_set_line_cap(cr, CAIRO_LINE_CAP_ROUND);
cairo_set_line_join(cr, CAIRO_LINE_JOIN_ROUND);
cairo_set_source_rgb(cr, TEALBR_R, TEALBR_G, TEALBR_B);
cairo_set_line_width(cr, 4.4);
cairo_move_to(cr, 15, 16);
cairo_line_to(cr, 25, 24);
cairo_line_to(cr, 15, 32);
cairo_stroke(cr);
cairo_set_source_rgb(cr, TEXT_R, TEXT_G, TEXT_B);
cairo_set_line_width(cr, 4.0);
cairo_move_to(cr, 27, 33);
cairo_line_to(cr, 34, 33);
cairo_stroke(cr);
}
/* Files: a two-tone manila folder (tab + body). */
static void
draw_files(cairo_t *cr)
{
tile(cr);
cairo_set_line_join(cr, CAIRO_LINE_JOIN_ROUND);
/* tab peeking above the body's top-left */
cairo_set_source_rgb(cr, TEAL_R, TEAL_G, TEAL_B);
rrect(cr, 11, 14, 14, 8, 2.5);
cairo_fill(cr);
/* back body */
rrect(cr, 11, 18, 26, 17, 3);
cairo_fill(cr);
/* front pocket, lighter, slightly inset - gives the folder depth */
cairo_set_source_rgb(cr, TEALBR_R, TEALBR_G, TEALBR_B);
rrect(cr, 13, 23, 22, 12, 2.5);
cairo_fill(cr);
}
/* Editor: a pencil at 45 degrees (eraser, shaft, nib, tip). */
static void
draw_editor(cairo_t *cr)
{
tile(cr);
cairo_save(cr);
cairo_translate(cr, 24, 24);
cairo_rotate(cr, -M_PI / 4);
double pw = 8, half = pw / 2;
/* shaft */
cairo_set_source_rgb(cr, TEAL_R, TEAL_G, TEAL_B);
rrect(cr, -half, -13, pw, 19, 1.5);
cairo_fill(cr);
/* eraser (top) */
cairo_set_source_rgb(cr, TEXT_R, TEXT_G, TEXT_B);
rrect(cr, -half, -16.5, pw, 4, 1.2);
cairo_fill(cr);
/* nib (bottom), brighter teal */
cairo_set_source_rgb(cr, TEALBR_R, TEALBR_G, TEALBR_B);
cairo_move_to(cr, -half, 6);
cairo_line_to(cr, half, 6);
cairo_line_to(cr, 0, 14);
cairo_close_path(cr);
cairo_fill(cr);
/* graphite tip */
cairo_set_source_rgb(cr, TILE_R, TILE_G, TILE_B);
cairo_move_to(cr, -2.2, 10.5);
cairo_line_to(cr, 2.2, 10.5);
cairo_line_to(cr, 0, 14);
cairo_close_path(cr);
cairo_fill(cr);
cairo_restore(cr);
}
typedef void (*drawfn)(cairo_t *);
static void
emit(const char *dir, const char *name, drawfn fn)
{
char path[1024];
cairo_surface_t *s = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, S, S);
cairo_t *cr = cairo_create(s);
fn(cr);
snprintf(path, sizeof path, "%s/%s", dir, name);
cairo_surface_write_to_png(s, path);
printf("wrote %s\n", path);
cairo_destroy(cr);
cairo_surface_destroy(s);
}
/* Review sheet: each glyph at 3x (detail) over the same glyph at 22px
* (real launcher size) on a panel-tone strip, so legibility is judged at
* the size it will actually render. */
static void
emit_preview(const char *dir)
{
drawfn fns[3] = { draw_terminal, draw_files, draw_editor };
int cw = 160, W = cw * 3, H = 210;
char path[1024];
cairo_surface_t *s = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, W, H);
cairo_t *cr = cairo_create(s);
cairo_set_source_rgb(cr, 0x0d / 255.0, 0x11 / 255.0, 0x17 / 255.0);
cairo_paint(cr);
for (int i = 0; i < 3; i++) {
cairo_save(cr);
cairo_translate(cr, i * cw + (cw - 144) / 2.0, 8);
cairo_scale(cr, 144.0 / S, 144.0 / S);
fns[i](cr);
cairo_restore(cr);
}
/* panel strip */
cairo_set_source_rgb(cr, 0x0e / 255.0, 0x1c / 255.0, 0x1f / 255.0);
cairo_rectangle(cr, 0, 168, W, 42);
cairo_fill(cr);
for (int i = 0; i < 3; i++) {
cairo_save(cr);
cairo_translate(cr, i * cw + (cw - 22) / 2.0, 178);
cairo_scale(cr, 22.0 / S, 22.0 / S);
fns[i](cr);
cairo_restore(cr);
}
snprintf(path, sizeof path, "%s/preview.png", dir);
cairo_surface_write_to_png(s, path);
printf("wrote %s\n", path);
cairo_destroy(cr);
cairo_surface_destroy(s);
}
int
main(int argc, char **argv)
{
const char *dir = (argc > 1) ? argv[1] : ".";
emit(dir, "terminal.png", draw_terminal);
emit(dir, "files.png", draw_files);
emit(dir, "editor.png", draw_editor);
emit_preview(dir);
return 0;
}
<?xml version="1.0" encoding="UTF-8"?>
<!-- Hammerhead Openbox root menu - Zygaena marine-dark identity
Installed to $PREFIX/etc/xdg/openbox/menu.xml
Structure adapted from CrunchBang++'s categorized root menu
(github.com/CBPP/cbpp-configs, simon-weber/crunchbang-conf) -
Applications/Places submenus, quick launchers, an Openbox submenu,
plain Exit (no GTK exit dialog). Rebuilt GTK-free for our real
apps: st, xfe, xnedit, nvim (in st), hh-pdf, hh-images, dmenu_run. -->
<openbox_menu xmlns="http://openbox.org/3.4/menu">
<menu id="root-menu" label="Hammerhead">
<menu id="apps-menu" label="Applications">
<menu id="apps-accessories-menu" label="Accessories">
<item label="Text Editor (XNEdit)">
<action name="Execute"><command>xnedit</command></action>
</item>
<item label="Vim (terminal)">
<action name="Execute"><command>st -e nvim</command></action>
</item>
<item label="Files (Xfe)">
<action name="Execute"><command>xfe</command></action>
</item>
<item label="Image Viewer">
<action name="Execute"><command>hh-images</command></action>
</item>
<item label="PDF Viewer">
<action name="Execute"><command>hh-pdf</command></action>
</item>
</menu>
<menu id="apps-system-menu" label="System">
<item label="Terminal">
<action name="Execute"><command>st</command></action>
</item>
</menu>
</menu>
<menu id="places-menu" label="Places" execute="hh-places-pipemenu"/>
<menu id="recent-menu" label="Recent Files" execute="hh-recent-pipemenu"/>
<separator/>
<item label="Terminal">
<action name="Execute"><command>st</command></action>
</item>
<item label="Files">
<action name="Execute"><command>xfe</command></action>
</item>
<item label="Run...">
<action name="Execute"><command>dmenu_run</command></action>
</item>
<separator/>
<menu id="openbox-menu" label="Openbox">
<item label="Reconfigure">
<action name="Reconfigure"/>
</item>
<item label="Restart">
<action name="Restart"/>
</item>
</menu>
<separator/>
<!-- Power management. zygctl talks to the root-owned zyginit socket, so
it needs root privilege; the desktop runs as zygaena (uid 1000).
pfexec elevates via the "Hammerhead Power Management" RBAC profile
(base config: rootfs/etc/security/{prof,exec}_attr.d/hammerhead +
rootfs/etc/user_attr.d/hammerhead). Each has an Openbox confirm
<prompt> so a stray click can't power off the machine. -->
<item label="Reboot">
<action name="Execute">
<command>pfexec /sbin/zygctl reboot</command>
<prompt>Reboot the system?</prompt>
</action>
</item>
<item label="Shutdown">
<action name="Execute">
<command>pfexec /sbin/zygctl poweroff</command>
<prompt>Shut down the system?</prompt>
</action>
</item>
<item label="Log Out / Exit">
<action name="Exit">
<prompt>yes</prompt>
</action>
</item>
</menu>
</openbox_menu>
# hammerhead-desktop - Zygaena marine-dark desktop branding/config
# (wallpaper, Openbox theme, tint2/conky configs, menu/keybinds, autostart)
#
# No upstream source - this port carries its own config files + a small
# cairo program (wallpaper-gen.c) that renders the branded wallpaper PNG
# at package-build time. See build.sh.
[package]
name = "hammerhead-desktop"
version = "1.7.0"
release = 1
description = "Zygaena marine-dark desktop branding: wallpaper, Openbox theme, tint2/conky configs, categorized menu w/ CBPP-style Places/Recent pipemenus + Shutdown/Reboot (pfexec zygctl), autostart"
url = "https://git.sharkos.one/zygaena/hammerhead"
license = "CDDL-1.0"
maintainer = "Chris Tusa <chris.tusa@leafscale.com>"
arch = "x86_64"
[dependencies]
runtime = ["openbox", "tint2", "conky", "picom", "feh", "dmenu", "st", "xfe", "mupdf", "xnedit", "cairo", "libpng"]
build = ["cairo", "libpng"]
[build]
parallel = false
#include <cairo.h>
#include <cairo-pdf.h>
int main(int c,char**v){
cairo_surface_t*s=cairo_pdf_surface_create(c>1?v[1]:"welcome.pdf",612,792);
cairo_t*cr=cairo_create(s);
cairo_set_source_rgb(cr,0.02,0.035,0.06); cairo_paint(cr);
cairo_set_source_rgb(cr,0.12,0.71,0.71); cairo_rectangle(cr,0,0,612,8); cairo_fill(cr);
cairo_select_font_face(cr,"sans",CAIRO_FONT_SLANT_NORMAL,CAIRO_FONT_WEIGHT_BOLD);
cairo_set_font_size(cr,40); cairo_set_source_rgb(cr,0.12,0.71,0.71);
cairo_move_to(cr,60,120); cairo_show_text(cr,"HAMMERHEAD");
cairo_select_font_face(cr,"sans",CAIRO_FONT_SLANT_NORMAL,CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size(cr,15); cairo_set_source_rgb(cr,0.55,0.68,0.68);
cairo_move_to(cr,62,148); cairo_show_text(cr,"Zygaena Operating System");
const char*L[]={"Welcome to your Hammerhead desktop.","",
"This document is displayed by mupdf, built from source for",
"Hammerhead - a 64-bit illumos-derived OS with a modern GNU",
"toolchain running an XLibre + Openbox desktop, all GTK-free.","",
"Keys: Super+Return terminal Super+f files Super+e editor",
" Super+Space launcher Right-click the desktop for the menu.",0};
cairo_set_font_size(cr,14); double y=210;
for(int i=0;L[i];i++){cairo_set_source_rgb(cr,0.82,0.9,0.9);cairo_move_to(cr,60,y);cairo_show_text(cr,L[i]);y+=26;}
cairo_show_page(cr); cairo_destroy(cr); cairo_surface_destroy(s); return 0;}
<?xml version="1.0" encoding="UTF-8"?>
<!-- Hammerhead Openbox config - Zygaena marine-dark identity
Installed to $PREFIX/etc/xdg/openbox/rc.xml -->
<openbox_config xmlns="http://openbox.org/3.4/rc">
<resistance>
<strength>10</strength>
<screen_edge_strength>20</screen_edge_strength>
</resistance>
<focus>
<focusNew>yes</focusNew>
<followMouse>no</followMouse>
<focusLast>yes</focusLast>
</focus>
<placement>
<policy>Smart</policy>
<center>yes</center>
</placement>
<theme>
<name>Hammerhead</name>
<titleLayout>NLIMC</titleLayout>
<keepBorder>yes</keepBorder>
<animateIconify>no</animateIconify>
<font place="ActiveWindow">
<name>sans</name>
<size>9</size>
<weight>Bold</weight>
<slant>Normal</slant>
</font>
<font place="InactiveWindow">
<name>sans</name>
<size>9</size>
<weight>Normal</weight>
<slant>Normal</slant>
</font>
</theme>
<desktops>
<number>4</number>
<firstdesk>1</firstdesk>
<names>
<name>1</name>
<name>2</name>
<name>3</name>
<name>4</name>
</names>
<popupTime>500</popupTime>
</desktops>
<keyboard>
<!-- Application launchers (Super) -->
<keybind key="W-Return"><action name="Execute"><command>st</command></action></keybind>
<keybind key="W-t"><action name="Execute"><command>st</command></action></keybind>
<keybind key="W-f"><action name="Execute"><command>xfe</command></action></keybind>
<keybind key="W-e"><action name="Execute"><command>xnedit</command></action></keybind>
<keybind key="W-space"><action name="Execute"><command>dmenu_run</command></action></keybind>
<keybind key="A-F2"><action name="Execute"><command>dmenu_run</command></action></keybind>
<keybind key="A-F3"><action name="Execute"><command>dmenu_run</command></action></keybind>
<!-- Menus -->
<keybind key="W-m"><action name="ShowMenu"><menu>root-menu</menu></action></keybind>
<keybind key="C-A-q"><action name="ShowMenu"><menu>root-menu</menu></action></keybind>
<keybind key="W-Tab"><action name="ShowMenu"><menu>client-list-combined-menu</menu></action></keybind>
<!-- Screenshot -->
<keybind key="Print"><action name="Execute"><command>hh-screenshot</command></action></keybind>
<!-- Window management -->
<keybind key="A-F4"><action name="Close"/></keybind>
<keybind key="W-q"><action name="Close"/></keybind>
<keybind key="A-space"><action name="ShowMenu"><menu>client-menu</menu></action></keybind>
<keybind key="A-Tab"><action name="NextWindow"/></keybind>
<keybind key="A-S-Tab"><action name="PreviousWindow"/></keybind>
<keybind key="W-A-f"><action name="ToggleMaximizeFull"/></keybind>
<!-- Half-screen tiling -->
<keybind key="W-Left"><action name="UnmaximizeFull"/><action name="MoveResizeTo"><x>0</x><y>0</y><width>50%</width><height>100%</height></action></keybind>
<keybind key="W-Right"><action name="UnmaximizeFull"/><action name="MoveResizeTo"><x>-0</x><y>0</y><width>50%</width><height>100%</height></action></keybind>
<keybind key="W-Up"><action name="ToggleMaximizeFull"/></keybind>
<keybind key="W-Down"><action name="Iconify"/></keybind>
<!-- Desktops -->
<keybind key="C-A-Left"><action name="GoToDesktop"><to>left</to><wrap>no</wrap></action></keybind>
<keybind key="C-A-Right"><action name="GoToDesktop"><to>right</to><wrap>no</wrap></action></keybind>
<keybind key="W-F1"><action name="GoToDesktop"><to>1</to></action></keybind>
<keybind key="W-F2"><action name="GoToDesktop"><to>2</to></action></keybind>
<keybind key="W-d"><action name="ToggleShowDesktop"/></keybind>
<keybind key="S-A-Left"><action name="SendToDesktop"><to>left</to><wrap>no</wrap></action></keybind>
<keybind key="S-A-Right"><action name="SendToDesktop"><to>right</to><wrap>no</wrap></action></keybind>
</keyboard>
<mouse>
<dragThreshold>1</dragThreshold>
<doubleClickTime>300</doubleClickTime>
<context name="Frame">
<mousebind button="A-Left" action="Press"><action name="Focus"/><action name="Raise"/></mousebind>
<mousebind button="A-Left" action="Drag"><action name="Move"/></mousebind>
<mousebind button="A-Right" action="Press"><action name="Focus"/><action name="Raise"/></mousebind>
<mousebind button="A-Right" action="Drag"><action name="Resize"/></mousebind>
<mousebind button="A-Middle" action="Press"><action name="Lower"/><action name="FocusToBottom"/><action name="Unfocus"/></mousebind>
</context>
<context name="Titlebar">
<mousebind button="Left" action="Press"><action name="Focus"/><action name="Raise"/></mousebind>
<mousebind button="Left" action="Drag"><action name="Move"/></mousebind>
<mousebind button="Left" action="DoubleClick"><action name="ToggleShade"/></mousebind>
<mousebind button="Up" action="Click"><action name="Shade"/></mousebind>
<mousebind button="Down" action="Click"><action name="Unshade"/></mousebind>
<mousebind button="Middle" action="Press"><action name="Lower"/><action name="FocusToBottom"/><action name="Unfocus"/></mousebind>
<mousebind button="Right" action="Press"><action name="Focus"/><action name="Raise"/><action name="ShowMenu"><menu>client-menu</menu></action></mousebind>
</context>
<context name="Top"><mousebind button="Left" action="Drag"><action name="Resize"><edge>top</edge></action></mousebind></context>
<context name="Bottom"><mousebind button="Left" action="Drag"><action name="Resize"><edge>bottom</edge></action></mousebind></context>
<context name="Left"><mousebind button="Left" action="Drag"><action name="Resize"><edge>left</edge></action></mousebind></context>
<context name="Right"><mousebind button="Left" action="Drag"><action name="Resize"><edge>right</edge></action></mousebind></context>
<context name="TLCorner TRCorner BLCorner BRCorner"><mousebind button="Left" action="Drag"><action name="Resize"/></mousebind></context>
<context name="Client">
<mousebind button="Left" action="Press"><action name="Focus"/><action name="Raise"/></mousebind>
<mousebind button="Middle" action="Press"><action name="Focus"/><action name="Raise"/></mousebind>
<mousebind button="Right" action="Press"><action name="Focus"/><action name="Raise"/></mousebind>
</context>
<context name="Icon">
<mousebind button="Left" action="Press"><action name="Focus"/><action name="Raise"/><action name="ShowMenu"><menu>client-menu</menu></action></mousebind>
<mousebind button="Right" action="Press"><action name="Focus"/><action name="Raise"/><action name="ShowMenu"><menu>client-menu</menu></action></mousebind>
</context>
<context name="Iconify"><mousebind button="Left" action="Click"><action name="Iconify"/></mousebind></context>
<context name="Maximize">
<mousebind button="Left" action="Click"><action name="ToggleMaximize"/></mousebind>
<mousebind button="Middle" action="Click"><action name="ToggleMaximizeVertical"/></mousebind>
<mousebind button="Right" action="Click"><action name="ToggleMaximizeHorizontal"/></mousebind>
</context>
<context name="Close"><mousebind button="Left" action="Click"><action name="Close"/></mousebind></context>
<context name="Desktop">
<mousebind button="Up" action="Click"><action name="GoToDesktop"><to>previous</to></action></mousebind>
<mousebind button="Down" action="Click"><action name="GoToDesktop"><to>next</to></action></mousebind>
</context>
<context name="Root">
<mousebind button="Middle" action="Press"><action name="ShowMenu"><menu>client-list-combined-menu</menu></action></mousebind>
<mousebind button="Right" action="Press"><action name="ShowMenu"><menu>root-menu</menu></action></mousebind>
</context>
</mouse>
<menu>
<file>menu.xml</file>
<hideDelay>200</hideDelay>
<middle>no</middle>
<submenuShowDelay>100</submenuShowDelay>
<showIcons>yes</showIcons>
</menu>
<applications/>
</openbox_config>
# Hammerhead Openbox theme - Zygaena marine-dark identity
# Installed to $PREFIX/share/themes/Hammerhead/openbox-3/themerc
window.active.title.bg: flat solid
window.active.title.bg.color: #12303a
window.inactive.title.bg: flat solid
window.inactive.title.bg.color: #0d1117
window.active.label.bg: parentrelative
window.inactive.label.bg: parentrelative
window.active.label.text.color: #cfe0e0
window.inactive.label.text.color: #5a7575
window.active.title.separator.color: #1fb6b6
window.inactive.title.separator.color: #0d1117
window.active.border.color: #1fb6b6
window.inactive.border.color: #0d1117
window.active.handle.bg: flat solid
window.active.handle.bg.color: #12303a
window.inactive.handle.bg: flat solid
window.inactive.handle.bg.color: #0d1117
window.active.grip.bg: flat solid
window.active.grip.bg.color: #1fb6b6
window.inactive.grip.bg: flat solid
window.inactive.grip.bg.color: #0d1117
window.active.button.unpressed.bg: flat solid
window.active.button.unpressed.bg.color: #12303a
window.active.button.pressed.bg: flat solid
window.active.button.pressed.bg.color: #1fb6b6
window.active.button.disabled.bg: flat solid
window.active.button.disabled.bg.color: #0d1117
window.active.button.hover.bg: flat solid
window.active.button.hover.bg.color: #3fd0d0
window.inactive.button.unpressed.bg: flat solid
window.inactive.button.unpressed.bg.color: #0d1117
window.inactive.button.pressed.bg: flat solid
window.inactive.button.pressed.bg.color: #1fb6b6
window.inactive.button.disabled.bg: flat solid
window.inactive.button.disabled.bg.color: #0d1117
window.inactive.button.hover.bg: flat solid
window.inactive.button.hover.bg.color: #3fd0d0
window.active.button.unpressed.image.color: #cfe0e0
window.active.button.pressed.image.color: #05080d
window.active.button.disabled.image.color: #5a7575
window.active.button.hover.image.color: #05080d
window.inactive.button.unpressed.image.color: #5a7575
window.inactive.button.pressed.image.color: #05080d
window.inactive.button.disabled.image.color: #5a7575
window.inactive.button.hover.image.color: #05080d
border.width: 2
padding.width: 2
padding.height: 2
window.client.padding.width: 0
window.handle.width: 6
window.label.text.justify: left
menu.items.bg: flat solid
menu.items.bg.color: #0d1117
menu.items.text.color: #cfe0e0
menu.items.disabled.text.color: #5a7575
menu.items.active.bg: flat solid
menu.items.active.bg.color: #12303a
menu.items.active.text.color: #3fd0d0
menu.border.color: #1fb6b6
menu.border.width: 1
menu.separator.color: #1fb6b6
menu.separator.padding.width: 6
menu.separator.padding.height: 3
menu.title.bg: flat solid
menu.title.bg.color: #12303a
menu.title.text.color: #cfe0e0
menu.title.text.justify: left
osd.bg: flat solid
osd.bg.color: #0d1117
osd.border.color: #1fb6b6
osd.border.width: 1
osd.label.bg: parentrelative
osd.label.text.color: #cfe0e0
window.active.shadow: false
window.inactive.shadow: false
font: shadow=n
font: place=ActiveWindow
font: family=sans
font: size=9
font: weight=bold
font: slant=normal
font: place=InactiveWindow
font: family=sans
font: size=9
font: weight=normal
font: slant=normal
font: place=MenuHeader
font: family=sans
font: size=9
font: weight=bold
font: place=MenuItem
font: family=sans
font: size=9
font: weight=normal
font: place=OnScreenDisplay
font: family=sans
font: size=9
font: weight=bold
#---------------------------------------------
# Hammerhead tint2 panel - Zygaena marine-dark identity
# Installed to $PREFIX/etc/xdg/tint2/tint2rc
#
# Layout adapted from CrunchBang++'s tint2rc (github.com/CBPP/cbpp-configs,
# simon-weber/crunchbang-conf): bottom panel, left launcher block, centered
# taskbar, right-hand systray + two-line clock, teal active-task highlight.
# No battery/brightness applets (headless/Xvfb-safe). Restyled to our
# marine-dark palette, not CBPP's grey.
#---------------------------------------------
#-------------------------------------
# Backgrounds
# bg_color_0: panel background
rounded = 0
border_width = 0
background_color = #0d1117 88
border_color = #1fb6b6 0
rounded = 3
border_width = 1
background_color = #12303a 100
border_color = #1fb6b6 70
rounded = 3
border_width = 0
background_color = #1fb6b6 25
border_color = #1fb6b6 0
rounded = 0
border_width = 0
background_color = #0d1117 0
border_color = #1fb6b6 0
#-------------------------------------
# Panel
panel_items = LTSC
panel_size = 100% 30
panel_margin = 0 0
panel_padding = 6 0 8
panel_background_id = 1
panel_position = bottom center horizontal
panel_layer = top
panel_monitor = all
autohide = 0
strut_policy = follow_size
panel_dock = 0
wm_menu = 1
panel_window_name = tint2
disable_transparency = 0
mouse_effects = 1
#-------------------------------------
# Launcher
launcher_padding = 6 3 8
launcher_background_id = 4
launcher_icon_size = 22
launcher_icon_theme_override = 0
launcher_item_app = /usr/local/share/applications/hh-terminal.desktop
launcher_item_app = /usr/local/share/applications/hh-files.desktop
launcher_item_app = /usr/local/share/applications/hh-editor.desktop
#-------------------------------------
# Taskbar
taskbar_mode = multi_desktop
taskbar_hide_if_empty = 0
taskbar_padding = 4 2 4
taskbar_background_id = 0
taskbar_active_background_id = 0
taskbar_name = 1
taskbar_name_padding = 8 3
taskbar_name_background_id = 0
taskbar_name_active_background_id = 3
taskbar_name_font = sans bold 9
taskbar_name_font_color = #5a7575 100
taskbar_name_active_font_color = #1fb6b6 100
taskbar_distribute_size = 1
#-------------------------------------
# Task
task_text = 1
task_icon = 1
task_centered = 1
task_maximum_size = 180 28
task_padding = 6 2
task_background_id = 0
task_active_background_id = 2
task_urgent_background_id = 2
task_font = sans 9
task_font_color = #cfe0e0 100
task_active_font_color = #3fd0d0 100
task_urgent_font_color = #3fd0d0 100
task_tooltip = 1
#-------------------------------------
# Clock (two-line, CBPP-style: time over date)
time1_format = %H:%M
time2_format = %a %d %b
time1_font = sans bold 9
time2_font = sans 7
clock_font_color = #cfe0e0 100
clock_padding = 8 0
clock_background_id = 0
clock_tooltip = %A, %d %B %Y
#-------------------------------------
# System tray
systray_padding = 4 2 8
systray_background_id = 0
systray_sort = ascending
systray_icon_size = 18
systray_icon_asb = 100 0 0
#-------------------------------------
# Tooltips
tooltip_padding = 4 4
tooltip_show_timeout = 0.5
tooltip_hide_timeout = 0.1
tooltip_background_id = 1
tooltip_font_color = #cfe0e0 100
tooltip_font = sans 8
/*
* wallpaper-gen.c - Zygaena marine-dark wallpaper generator.
*
* Renders a 1920x1080 PNG: deep-ocean vertical gradient, low-alpha
* concentric sonar arcs from a lower-left origin, a low-alpha stylized
* hammerhead-shark silhouette, and the HAMMERHEAD/ZYGAENA wordmark in
* the lower-right corner.
*
* Build: gcc wallpaper-gen.c $(pkg-config --cflags --libs cairo) -lm -o wg
* Usage: ./wg /path/to/output.png
*/
#include <cairo.h>
#include <math.h>
#include <stdio.h>
#define W 1920
#define H 1080
/* Zygaena marine-dark palette */
#define BG_TOP_R 0x05/255.0
#define BG_TOP_G 0x08/255.0
#define BG_TOP_B 0x0d/255.0
#define BG_BOT_R 0x0a/255.0
#define BG_BOT_G 0x27/255.0
#define BG_BOT_B 0x33/255.0
#define TEAL_R 0x1f/255.0
#define TEAL_G 0xb6/255.0
#define TEAL_B 0xb6/255.0
#define TEAL_BR_R 0x3f/255.0
#define TEAL_BR_G 0xd0/255.0
#define TEAL_BR_B 0xd0/255.0
#define MUTED_R 0x5a/255.0
#define MUTED_G 0x75/255.0
#define MUTED_B 0x75/255.0
static void
draw_background(cairo_t *cr)
{
cairo_pattern_t *grad = cairo_pattern_create_linear(0, 0, 0, H);
cairo_pattern_add_color_stop_rgb(grad, 0.0, BG_TOP_R, BG_TOP_G, BG_TOP_B);
cairo_pattern_add_color_stop_rgb(grad, 1.0, BG_BOT_R, BG_BOT_G, BG_BOT_B);
cairo_set_source(cr, grad);
cairo_paint(cr);
cairo_pattern_destroy(grad);
}
static void
draw_sonar_arcs(cairo_t *cr)
{
/* Origin lower-left, off canvas a bit so rings sweep across the
* bottom-left quadrant. */
double cx = -80, cy = H + 80;
int rings = 5;
double base_r = 260;
double step_r = 220;
for (int i = 0; i < rings; i++) {
double alpha = 0.12 - (i * (0.06 / (rings - 1)));
if (alpha < 0.06) alpha = 0.06;
cairo_set_source_rgba(cr, TEAL_R, TEAL_G, TEAL_B, alpha);
cairo_set_line_width(cr, 2.0);
cairo_arc(cr, cx, cy, base_r + i * step_r, -M_PI / 2.2, 0.15);
cairo_stroke(cr);
}
}
/*
* Stylized hammerhead-shark silhouette: a wide flattened "hammer" head
* bar with an eye-dot at each end, a tapering dorsal body, and a
* crescent tail - all in one low-alpha teal fill, large and off-center
* (upper-left-of-center so it doesn't collide with the wordmark).
*/
static void
draw_hammerhead_motif(cairo_t *cr)
{
double ox = 560, oy = 430; /* motif origin (center of the head bar) */
double scale = 1.55;
cairo_save(cr);
cairo_translate(cr, ox, oy);
cairo_scale(cr, scale, scale);
cairo_set_source_rgba(cr, TEAL_R, TEAL_G, TEAL_B, 0.10);
/* Hammer head: a wide, slightly bowed bar. */
cairo_move_to(cr, -260, 0);
cairo_curve_to(cr, -180, -34, 180, -34, 260, 0);
cairo_curve_to(cr, 180, 34, -180, 34, -260, 0);
cairo_close_path(cr);
cairo_fill(cr);
/* Tapering body/tail sweeping down-right from the head's center. */
cairo_move_to(cr, -40, 18);
cairo_curve_to(cr, 120, 60, 260, 160, 360, 340);
cairo_curve_to(cr, 380, 380, 340, 400, 300, 380);
cairo_curve_to(cr, 220, 220, 90, 100, -40, 54);
cairo_close_path(cr);
cairo_fill(cr);
/* Tail fluke. */
cairo_move_to(cr, 340, 320);
cairo_curve_to(cr, 400, 330, 440, 300, 470, 250);
cairo_curve_to(cr, 450, 310, 420, 360, 380, 400);
cairo_curve_to(cr, 360, 370, 345, 345, 340, 320);
cairo_close_path(cr);
cairo_fill(cr);
/* Eye-dots at each end of the hammer bar. */
cairo_arc(cr, -235, 0, 10, 0, 2 * M_PI);
cairo_fill(cr);
cairo_arc(cr, 235, 0, 10, 0, 2 * M_PI);
cairo_fill(cr);
cairo_restore(cr);
}
/* Draw text with manual letter-spacing (cairo toy text API has no
* built-in tracking control). */
static void
draw_tracked_text(cairo_t *cr, const char *s, double x, double y, double tracking)
{
cairo_text_extents_t ext;
double cx = x;
char buf[2] = {0, 0};
for (const char *p = s; *p; p++) {
buf[0] = *p;
cairo_text_extents(cr, buf, &ext);
cairo_move_to(cr, cx, y);
cairo_show_text(cr, buf);
cx += ext.x_advance + tracking;
}
}
static void
draw_wordmark(cairo_t *cr)
{
cairo_text_extents_t ext;
cairo_select_font_face(cr, "sans-serif", CAIRO_FONT_SLANT_NORMAL,
CAIRO_FONT_WEIGHT_BOLD);
cairo_set_font_size(cr, 64);
cairo_set_source_rgb(cr, TEAL_R, TEAL_G, TEAL_B);
/* Measure full tracked width to right-align at x = W - 120. */
const char *word = "HAMMERHEAD";
double tracking = 8.0;
double total_w = 0;
char buf[2] = {0, 0};
for (const char *p = word; *p; p++) {
buf[0] = *p;
cairo_text_extents(cr, buf, &ext);
total_w += ext.x_advance + tracking;
}
total_w -= tracking;
double x = W - 120 - total_w;
double y = H - 150;
draw_tracked_text(cr, word, x, y, tracking);
/* Subtitle */
cairo_select_font_face(cr, "sans-serif", CAIRO_FONT_SLANT_NORMAL,
CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size(cr, 22);
cairo_set_source_rgb(cr, MUTED_R, MUTED_G, MUTED_B);
const char *sub = "ZYGAENA";
double sub_tracking = 6.0;
double sub_w = 0;
for (const char *p = sub; *p; p++) {
buf[0] = *p;
cairo_text_extents(cr, buf, &ext);
sub_w += ext.x_advance + sub_tracking;
}
sub_w -= sub_tracking;
draw_tracked_text(cr, sub, W - 120 - sub_w, y + 40, sub_tracking);
}
int
main(int argc, char **argv)
{
const char *outpath = (argc > 1) ? argv[1] : "/tmp/hammerhead.png";
cairo_surface_t *surface = cairo_image_surface_create(CAIRO_FORMAT_RGB24, W, H);
cairo_t *cr = cairo_create(surface);
draw_background(cr);
draw_sonar_arcs(cr);
draw_hammerhead_motif(cr);
draw_wordmark(cr);
cairo_status_t st = cairo_surface_write_to_png(surface, outpath);
if (st != CAIRO_STATUS_SUCCESS) {
fprintf(stderr, "write_to_png failed: %s\n", cairo_status_to_string(st));
cairo_destroy(cr);
cairo_surface_destroy(surface);
return 1;
}
printf("wrote %s (%dx%d)\n", outpath, W, H);
cairo_destroy(cr);
cairo_surface_destroy(surface);
return 0;
}
|