website

My personal website
git clone git://git.ckyln.com/website
Log | Files | Refs

20200812-starting-x-without-xinit.html (2171B)


      1 <!DOCTYPE HTML>
      2 <html lan=en>
      3   <head>
      4     <title>Starting X without Xinit | Cem's Website</title>
      5     <meta charset="utf-8">
      6     <meta name="Description" content="Cem Keylan's Website">
      7     <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
      8     <style>
      9       html {font-family:monospace;font-size:16px;color:#282a36;}
     10       body {
     11 	  width: 90%;
     12 	  max-width: 1050px;
     13 	  margin-left: auto;
     14 	  margin-right: auto;
     15 	  margin-top: 20px;
     16 	  overflow: none;
     17           overflow-y: scroll;
     18 	  padding-right: 10px;
     19 	  padding-left: 10px;
     20       }
     21       a{text-decoration:none;font-weight:bold;color:#282a36;}
     22       a:hover{text-decoration:underline;}
     23       @media (prefers-color-scheme: dark) {
     24           html {color: white;background:#282a36;}
     25           a{color:white;}
     26       }
     27     </style>
     28     <link rel="stylesheet" href="/static/syntax.css">
     29     <script src="/static/highlight.pack.js"></script>
     30     <script>hljs.initHighlightingOnLoad();</script>
     31   </head>
     32   <body>
     33     <div class="header">
     34       <nav>
     35         <a href='/'>index</a> |
     36         <a href="/software.html">software</a> |
     37         <a href="/blog.html">blog</a> |
     38         <a href="/contact.html">contact</a> |
     39         <a href="/sysmgr">sysmgr</a> |
     40       </nav>
     41     </div>
     42     <hr>
     43     <p>
     44 <h1>Starting X without Xinit</h1>
     45 
     46 <p>Most people who don&rsquo;t use a desktop environment use the <code>startx</code> command to
     47 initialize their X windowing system. Now, <code>startx</code> is a shell script that runs
     48 the C program <code>xinit</code> which basically runs <code>xorg-server</code>. Using xinit obviously
     49 has some nice perks. It makes some checks and runs your .xinitrc file. We don&rsquo;t
     50 need any of that though. Here is my X launcher:</p>
     51 
     52 <pre><code class="sh">#!/bin/sh
     53 
     54 export DISPLAY=${DISPLAY:-:0}
     55 trap "$HOME/.xinitrc" USR1
     56 
     57 (
     58     trap '' USR1
     59 
     60     exec X -keeptty :0 vt1
     61 ) &amp;
     62 
     63 wait
     64 </code></pre>
     65 
     66 <p>You need to keep in mind that your .xinitrc should be an executable.</p>
     67     </p>
     68     <a href="/blog/20200812-starting-x-without-xinit.txt">This page in plain-text</a>
     69     <hr>
     70     <p class=footer>Copyright &copy; 2019-2021 Cem Keylan</p>
     71   </body>
     72 </html>