public inbox for cygwin-xfree@sourceware.org help / color / mirror / Atom feed
From: Linda Walsh <cygwin@tlinx.org> To: cygwin-xfree@cygwin.com Subject: solution for package startup scripts changing: do your own (was Re: run.exe will not work with upgrade from 1.14.4 to 1.16.3) Date: Mon, 12 Jan 2015 00:26:00 -0000 [thread overview] Message-ID: <54B314B7.5010008@tlinx.org> (raw) In-Reply-To: <54A6FDB8.9070106@blankersfamily.com> Laurens Blankers wrote: > On 2-1-2015 21:10, schilpfamily wrote: >> this has worked for years, now when i run this command, a window very >> briefly blinks into existence but then goes away. any idea why this >> would stop working now? ==== Because the default options in the distribution provided startup script changed to a more secure setting, consistent with upstream changes and the general atmosphere of security paranoia that is gradually eroding usability (as security issues get alot more attention than usability -- so much so, that while a benefit of computers was that they could adapt to the user for a friendly user experience, the opposite is becoming the standard. I.e. users are expected to adapt themselves to the changing machine programs. I start my X server on login -- which means it has to work when called at login -- and I wanted to make sure I could pass custom arguments for the font path (among other things). As a result I simply "wrote my own" startup script that has it's own defaults. I expect it to work until some argument I expect to be there is deleted. I don't instantly get new features and benefits that might be invoked from the distribution script, but usually it starts, and every once in a while I review it and the cygwin start scripts to see if there is something I should change. But at least I don't get caught by this particular problem. I *do* still get caught by the installer overwriting Windows mount points with physical directories which causes various programs to stop functioning until I move the updated files to the 'mount-point' and change the physdir back to a mount point. Anyway, --- The script is started by a shortcut in: C:\Users\<YOURUSERID>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup That has a shortcut to 'bash' with arguments: (Target:) C:\bin\bash.exe -c '/bin/setsid "%USERPROFILE%/bin/startxwin.sh"' (Start in:) %HOMEDRIVE%%HOMEPATH% (Run:) Minimized ---- It is also an icon on my 'Quick Launch' bar (i.e. in directory): C:\Users\<YOURUSERID>\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch ---startxwin.sh--- #!/bin/bash # (c) LA Walsh 2004-2014, licenced under GPLv2 #export DISPLAY=:0 #export XAPPLRESDIR=/usr/X11R6/lib/X11/app-defaults #export XCMSDB=/usr/X11R6/lib/X11/Xcms.txt #export XKEYSYMDB=/usr/X11R6/lib/X11/XKeysymDB #export XNLSPATH=/usr/X11R6/lib/X11/locale #unexport XAPPLRESDIR XCMSDB XKEYSYMDB XNLSPATH # see cygwin Xwin for more option examples # relevant ops: # -multiwindow = use windows manage; not w/(-rootless|-fullscreen) # -clipboard = use built-in version (integrated w/windows) # -unixkill = Enable Ctrl-Alt-BS as X-server shutdown cmnd # -nowinkill = Disable Alt+F4 as a server shutdown key combination. # -trayicon = (default) windows tray icon enabled mount -c / export PATH=/bin:$(/bin/cygpath "$USERPROFILE")/bin:$PATH #ensure our bin is 1st shopt -s expand_aliases extglob alias notify=$(type -P notifu) alias int=declare\ -i alias sub=function alias xset=$(type -P xset); alias array=declare\ -a alias my=declare export DISPLAY="${DISPLAY:-":0"}" sub xup { local stat read -t .1 stat <<<$(xset q >&/dev/null; echo $?) && return $stat ((-1)) } sub Xwin_pids { ( cd /proc && for p in +([0-9])/ ;do p2=${p%/} prg=$(<${p2}/exename) if [[ $prg =~ .*XWin ]]; then printf "%d:%s\n" "$p2" "$prg" fi done ) } sub Xwin_pid { array Xprgs readarray Xprgs< <(Xwin_pids) if ((!${#Xprgs[@]}));then echo 0 return 1 fi my x=${Xprgs[0]} my pid=${x%%:**} prg=${x##*:} array out=( "$pid" "$prg") printf "%s " "${out[@]}" printf "\n" return 0 } sub Xwin_running { int pd; my pg read pd pg < <(Xwin_pid) return $(((!pd))) } export -f Xwin_pids Xwin_pid sub tidy_old_Xwin { local -a sigs=(TERM TERM KILL) # try 2 TERMs then KILL upto maxsigs int pd; my pg int maxsigs=3 lastsig=${#sigs[*]} while ((1)); do read pd pg < <(Xwin_pid) ((pd)) || break #int i=--maxsigs>lastsig ? lastsig:maxsigs kill -${sigs[--maxsigs>lastsig ? lastsig:maxsigs]} $pd ((maxsigs)) || break sleep 1 done rm -fr /tmp/.X11-unix } sub get_dpi { dpi=$(regtool -d get '/HKLM/Software/Microsoft/Windows NT/CurrentVersion/FontDPI/LogPixels') # check for insane values ((dpi<50||dpi>>400)) && dpi=96 echo "$dpi" } sub get_fontpath { local fontpath="/usr/share/TTF:tcp/ishtar:7100,built-ins,/usr/share/fonts/Type1,/usr/share/fonts/misc,/usr/share/fonts/100dpi" echo -n "$fontpath" } sub start_XWin { local fontpath="/usr/share/fonts/TTF,built-ins,/usr/share/fonts/Type1,/usr/share/fonts/misc,/usr/share/fonts/100dpi" int dpi=$(get_dpi) cmd="/bin/run /bin/XWin ${dpi:+-dpi $dpi} -nomultimonitors -clipboard -ac -unixkill -nowinkill -wgl -bs -fp "$fontpath" -multiwindow" echo cmd="$cmd" $cmd } declare -a default_switches=(-dpi -clipboard -unixkill -nowinkill -bs -ac -fp -multiwindow -wgl) readarray -t args< <( a="$default_switches[@]"; IFS=$'\n'; echo "${a[*]#?}"|sort -k1.2 ) sub read_users_mind { #(reads file in lieu of HW support for actual) if [[ -O ~/.mind && -O ~/.mind/Xserver-dflt-overrides ]]; then readarray -t overrides < <( -x <~/.mind/Xserver-dflt-overrides perl -wnE ' chomp; s/\s*(?:#.*)?$//; s/^\s*// s/\s\s+/\s/ ; $_ || next; print $_."\n" ') fi typeset -a switches } sub start_dbus { /bin/run /bin/dbus-launch --exit_with_session ~/.Xsession } sub _in { local x=${1:?};shift for ((;$#>0;)); do [[ $x == $1 ]] && return 0;shift; done return 1 } int tries=3 if Xwin_running && xup; then notify /t info /m "Xserver already running and ready" /d 5000 else echo Cannot contact X Server tidy_old_Xwin while ((1)); do start_XWin $(read_users_mind) sleep 1 for ((i=0;i<5;++i)); do xup && break 2 sleep 1 done if ((--tries<=0)); then m="\aEXITING: Timeout Waiting for Xserver Startup!!" echo "$m" notify /t error /m "$m" exit 1; fi done #start_dbus || { m="\aError Starting Dbus"; echo "$m"; notify /t error /m "$m"; } fi # vim: ts=2:sw=2 -------------- > This is most likely due to a major rewrite of the xinit package which > contains all start-up scripts. ---- Not if you write your own -- then you will get your own "customized" behavior (so at least when it breaks, you have a chance to fix it yourself)... If you don't like mine, fine, copy the cygwin script and make the changes to it and call it the same way. At least you'll get whatever behavior you want and upgrades won't be altering your script... BTW, Laurens Blankers, the opensource model for developers doing their own thing is called a "do-acracy". Those that do, make the rules. Not saying it is a great thing, just putting a handle on it... ;-) -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://x.cygwin.com/docs/ FAQ: http://x.cygwin.com/docs/faq/
prev parent reply other threads:[~2015-01-12 0:26 UTC|newest] Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-01-02 20:11 run.exe will not work with upgrade from 1.14.4 to 1.16.3 schilpfamily 2015-01-02 20:21 ` Laurens Blankers 2015-01-02 20:35 ` schilpfamily 2015-01-03 3:49 ` Larry Hall (Cygwin-X) 2015-01-03 8:04 ` Laurens Blankers 2015-01-03 9:25 ` rcunningham 2015-01-03 23:02 ` Larry Hall (Cygwin-X) 2015-01-04 11:41 ` Laurens Blankers 2015-01-05 4:04 ` Larry Hall (Cygwin-X) 2015-01-05 9:07 ` Laurens Blankers 2015-01-05 9:49 ` Yaakov Selkowitz 2015-01-05 10:03 ` Laurens Blankers 2015-01-05 10:34 ` Yaakov Selkowitz 2015-01-06 4:19 ` Larry Hall (Cygwin-X) 2015-01-12 0:26 ` Linda Walsh [this message]
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=54B314B7.5010008@tlinx.org \ --to=cygwin@tlinx.org \ --cc=cygwin-xfree@cygwin.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).