From a38f9e2e0051ce2e7e108e2c8c0bfc555a9740c8 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Thu, 10 Feb 2022 03:21:35 +0300 Subject: [PATCH] Refactor(.fvwmrc): Combine term+ssh+screen macros --- .fvwm/main.m4 | 86 +++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 67 insertions(+), 19 deletions(-) diff --git a/.fvwm/main.m4 b/.fvwm/main.m4 index 3fd324d..05298ed 100644 --- a/.fvwm/main.m4 +++ b/.fvwm/main.m4 @@ -94,6 +94,12 @@ TERM_TITLE_SSH(TERM_KOI8, $1, $2)) define(`SSH_SCREEN_KOI8', `-t $1 exec /usr/bin/screen -xRR -S default-koi8') define(`SSH_SCREEN_UTF8', `-t $1 exec /usr/bin/screen -xRR -S default-utf8') +define(`TERM_TITLE_SSH_SCREEN_KOI8', +`$1 -title "$3 scr" -n "$3 scr" -e SSH SSH_SCREEN_KOI8($2)') + +define(`TERM_TITLE_SSH_SCREEN_UTF8', +`$1 -title "$3 scr" -n "$3 scr" -e SSH SSH_SCREEN_UTF8($2)') + define(`MENU_TERM_KOI8_SSH', "$2 (koi8)" TERM_KOI8_SSH($1, $2)) @@ -104,10 +110,28 @@ define(`TERM_KOI8_BOTRT_SSH', TERM_TITLE_SSH(TERM_KOI8_BOTRT, $1, $2)) define(`MENU_TERM_KOI8_BOTLT_SSH', -"$2 (koi8,btlt)" TERM_KOI8_BOTLT_SSH($1, $2)) +"$2 (btlt,koi8)" TERM_KOI8_BOTLT_SSH($1, $2)) define(`MENU_TERM_KOI8_BOTRT_SSH', -"$2 (koi8,btrt)" TERM_KOI8_BOTRT_SSH($1, $2)) +"$2 (btrt,koi8)" TERM_KOI8_BOTRT_SSH($1, $2)) + +define(`TERM_KOI8_SSH_SCREEN', +TERM_TITLE_SSH_SCREEN_KOI8(TERM_KOI8, $1, $2)) + +define(`MENU_TERM_KOI8_SSH_SCREEN', +"$2 (koi8,scr)" TERM_TITLE_SSH_SCREEN_KOI8(TERM_KOI8, $1, $2)) + +define(`TERM_KOI8_BOTLT_SSH_SCREEN', +TERM_TITLE_SSH_SCREEN_KOI8(TERM_KOI8_BOTLT, $1, $2)) + +define(`TERM_KOI8_BOTRT_SSH_SCREEN', +TERM_TITLE_SSH_SCREEN_KOI8(TERM_KOI8_BOTRT, $1, $2)) + +define(`MENU_TERM_KOI8_BOTLT_SSH_SCREEN', +"$2 (btlt,koi8,scr)" TERM_KOI8_BOTLT_SSH_SCREEN($1, $2)) + +define(`MENU_TERM_KOI8_BOTRT_SSH_SCREEN', +"$2 (btrt,koi8,scr)" TERM_KOI8_BOTRT_SSH_SCREEN($1, $2)) define(`TERM_UTF8_SSH', TERM_TITLE_SSH(TERM_RU_UTF8, $1, $2)) @@ -122,10 +146,28 @@ define(`TERM_UTF8_BOTRT_SSH', TERM_TITLE_SSH(TERM_RU_UTF8_BOTRT, $1, $2)) define(`MENU_TERM_UTF8_BOTLT_SSH', -"$2 (utf8,btlt)" TERM_UTF8_BOTLT_SSH($1, $2)) +"$2 (btlt,utf8)" TERM_UTF8_BOTLT_SSH($1, $2)) define(`MENU_TERM_UTF8_BOTRT_SSH', -"$2 (utf8,btrt)" TERM_UTF8_BOTRT_SSH($1, $2)) +"$2 (btrt,utf8)" TERM_UTF8_BOTRT_SSH($1, $2)) + +define(`TERM_UTF8_SSH_SCREEN', +TERM_TITLE_SSH_SCREEN_UTF8(TERM_RU_UTF8, $1, $2)) + +define(`MENU_TERM_UTF8_SSH_SCREEN', +"$2 (utf8,scr)" TERM_UTF8_SSH_SCREEN($1, $2)) + +define(`TERM_UTF8_BOTLT_SSH_SCREEN', +TERM_TITLE_SSH_SCREEN_UTF8(TERM_RU_UTF8_BOTLT, $1, $2)) + +define(`TERM_UTF8_BOTRT_SSH_SCREEN', +TERM_TITLE_SSH_SCREEN_UTF8(TERM_RU_UTF8_BOTRT, $1, $2)) + +define(`MENU_TERM_UTF8_BOTLT_SSH_SCREEN', +"$2 (btlt,utf8,scr)" TERM_UTF8_BOTLT_SSH_SCREEN($1, $2)) + +define(`MENU_TERM_UTF8_BOTRT_SSH_SCREEN', +"$2 (btrt,utf8,scr)" TERM_UTF8_BOTRT_SSH_SCREEN($1, $2)) define(`TERM_KOI8_BIG_SSH', TERM_KOI8 -geometry TERM_GEOM_BIG -title "$2" -n "$2" -e SSH "$1") @@ -133,6 +175,12 @@ TERM_KOI8 -geometry TERM_GEOM_BIG -title "$2" -n "$2" -e SSH "$1") define(`MENU_TERM_KOI8_BIG_SSH', "$2 (koi8)" TERM_KOI8_BIG_SSH($1, $2)) +define(`TERM_KOI8_BIG_SSH_SCREEN', +TERM_KOI8 -geometry TERM_GEOM_BIG -title "$2" -n "$2" -e SSH_SCREEN_KOI8 "$1") + +define(`MENU_TERM_KOI8_BIG_SSH_SCREEN', +"$2 (koi8,scr)" TERM_KOI8_BIG_SSH_SCREEN($1, $2)) + divert ########################################################################## @@ -585,7 +633,7 @@ AddToFunc AudioPlayer I GotoDeskAndPage 0 1 1 DestroyFunc Term-Iskra AddToFunc Term-Iskra I GotoDeskAndPage 1 1 2 -+ I TERM_KOI8_SSH(SSH_SCREEN_KOI8(iskra-aviel.phdru.name), iskra scr) ++ I TERM_KOI8_SSH_SCREEN(iskra-aviel.phdru.name, iskra) DestroyFunc Term-Iskra-Big AddToFunc Term-Iskra-Big I GotoDeskAndPage 1 1 2 @@ -593,7 +641,7 @@ AddToFunc Term-Iskra-Big I GotoDeskAndPage 1 1 2 DestroyFunc Term-Oper AddToFunc Term-Oper I GotoDeskAndPage 1 1 2 -+ I TERM_KOI8_BOTRT_SSH(SSH_SCREEN_KOI8(oper.med.ru), oper scr) ++ I TERM_KOI8_BOTRT_SSH_SCREEN(oper.med.ru, oper) DestroyFunc Term-Oper-Big AddToFunc Term-Oper-Big I GotoDeskAndPage 1 1 2 @@ -601,7 +649,7 @@ AddToFunc Term-Oper-Big I GotoDeskAndPage 1 1 2 DestroyFunc Term-Phdru AddToFunc Term-Phdru I GotoDeskAndPage 1 0 1 -+ I TERM_KOI8_SSH(SSH_SCREEN_KOI8(phdru.name), phdru.name scr) ++ I TERM_KOI8_SSH_SCREEN(phdru.name, phdru.name) DestroyFunc Term-Phdru-Big AddToFunc Term-Phdru-Big I GotoDeskAndPage 1 0 1 @@ -613,7 +661,7 @@ AddToFunc Term3Hosts I Term-Iskra + I Term-Oper + I Wait TERM + I GotoDeskAndPage 1 0 1 -+ I TERM_KOI8_SSH(SSH_SCREEN_KOI8(-D 1080 phdru.name), phdru.name scr) ++ I TERM_KOI8_SSH_SCREEN(-D 1080 phdru.name, phdru.name) + I Wait TERM + I GotoDeskAndPage 1 1 2 @@ -685,10 +733,10 @@ AddToMenu Terminals "Terminals" Title + "Grey term (koi8)" TERM_KOI8 + "Grey term (utf8)" TERM_RU_UTF8 + "Grey term (heb-utf8)" TERM_HEB_UTF8 -+ "Grey term (koi8,btlt)" TERM_KOI8_BOTLT -+ "Grey term (koi8,btrt)" TERM_KOI8_BOTRT -+ "Grey term (utf8,btlt)" TERM_RU_UTF8_BOTLT -+ "Grey term (utf8,btrt)" TERM_RU_UTF8_BOTRT ++ "Grey term (btlt,koi8)" TERM_KOI8_BOTLT ++ "Grey term (btrt,koi8)" TERM_KOI8_BOTRT ++ "Grey term (btlt,utf8)" TERM_RU_UTF8_BOTLT ++ "Grey term (btrt,utf8)" TERM_RU_UTF8_BOTRT + "Big grey term (koi8)" TERM_KOI8 -geometry TERM_GEOM_BIG + "Big grey term (utf8)" TERM_RU_UTF8 -geometry TERM_GEOM_BIG + "" Nop @@ -723,16 +771,16 @@ AddToMenu TermColors "Term Colors" Title AddToMenu Systems "Systems" Title + "Iskra+Oper+Phdru" Term3Hosts + "" Nop -+ MENU_TERM_KOI8_SSH(SSH_SCREEN_KOI8(iskra-aviel.phdru.name), iskra scr) ++ MENU_TERM_KOI8_SSH_SCREEN(iskra-aviel.phdru.name, iskra) + MENU_TERM_UTF8_BOTLT_SSH(iskra-aviel.phdru.name, iskra) + MENU_TERM_KOI8_BIG_SSH(iskra-aviel.phdru.name, ISKRA) + "" Nop -+ MENU_TERM_KOI8_BOTRT_SSH(SSH_SCREEN_KOI8(oper.med.ru), oper scr) ++ MENU_TERM_KOI8_BOTRT_SSH_SCREEN(oper.med.ru, oper) + MENU_TERM_UTF8_BOTRT_SSH(oper.med.ru, oper) + MENU_TERM_KOI8_BIG_SSH(oper.med.ru, OPER) + "" Nop -+ MENU_TERM_KOI8_SSH(SSH_SCREEN_KOI8(phdru.name), phdru scr) -+ MENU_TERM_KOI8_SSH(SSH_SCREEN_KOI8(-D 1080 phdru.name), phdru scr SOCKS5) ++ MENU_TERM_KOI8_SSH_SCREEN(phdru.name, phdru) ++ MENU_TERM_KOI8_SSH_SCREEN(-D 1080 phdru.name, phdru SOCKS5) + MENU_TERM_UTF8_BOTLT_SSH(phdru.name, phdru) + MENU_TERM_KOI8_BIG_SSH(phdru.name, PHDRU) @@ -918,9 +966,9 @@ pushdef(`TERM_KOI8', `Exec "TERM" LC_CTYPE=ru_RU.KOI8-R exec TERM') pushdef(`TERM_RU_UTF8', `Exec "URxvt" LC_CTYPE=ru_RU.UTF-8 exec TERM -name URxvt') *FvwmButtons: (Title Term, Icon rterm2.xpm, Action TERM_KOI8) *FvwmButtons: (Title UTF-8, Icon rterm2.xpm, Action TERM_RU_UTF8) -*FvwmButtons: (Title "phdru scr", Icon xterm-sgi.xpm, Action TERM_KOI8_SSH(SSH_SCREEN_KOI8(phdru.name), phdru.name scr)) -*FvwmButtons: (Title "iskra scr", Icon xterm-sgi.xpm, Action TERM_KOI8_SSH(SSH_SCREEN_KOI8(iskra-aviel.phdru.name), iskra scr)) -*FvwmButtons: (Title "oper scr", Icon xterm-linux.xpm, Action TERM_KOI8_BOTRT_SSH(SSH_SCREEN_KOI8(oper.med.ru), oper scr)) +*FvwmButtons: (Title "phdru (koi8,scr)", Icon xterm-sgi.xpm, Action TERM_KOI8_SSH_SCREEN(phdru.name, phdru.name)) +*FvwmButtons: (Title "iskra (koi8,scr)", Icon xterm-sgi.xpm, Action TERM_KOI8_SSH_SCREEN(iskra-aviel.phdru.name, iskra)) +*FvwmButtons: (Title "oper (koi8,scr)", Icon xterm-linux.xpm, Action TERM_KOI8_BOTRT_SSH_SCREEN(oper.med.ru, oper)) popdef(`TERM_KOI8', `TERM_RU_UTF8') *FvwmButtons: (Title Wallpaper, Icon find1.xpm, Action Exec "gxmessage" "$HOME"/current/projects/xsetbg/print-filename.py | text-wrap.py -w TEXT_WIDTH -s | gxmessage -buttons Ok -default Ok -fn 'MESSAGE_FONT' -file -) -- 2.39.5