Re: [dev] [dmenu] running shell scripts in dmenu
On 01/05/19 13:54, Sean MacLennan wrote: > I almost always run X11... so I want it to startup when I login. > Without a DM, this is how I handle it. For a single-user laptop or workstation, why does there even need to be a concept of "logging in"? And why do you need 3-4 layers of shells running in the background to manage your X session? You've got: - your login shell - startx - xinit - your .xinitrc, if you don't exec your window manager Exactly zero of these are necessary for a proper X session! X is a client-server protocol, not magic. Start a server, start a client, tell it where the server is, and that's it. No shells, no gettys, none of that cruft -- this is suckless, right? This is what I do: 1) I have a udev rule that chowns tty1 to my user, so I can run Xorg without root privileges: SUBSYSTEM=="tty", KERNEL=="tty1", OWNER="me", GROUP="me", MODE="0600" If your Xorg is suid root or cap_sys_admin, you don't need this. But I prefer to not give it privileges it doesn't need. 2) In my user's unprivileged s6[1] supervision tree[2], I have a supervised service that runs Xorg on tty1: Xorg -displayfd 5 vt1 The `-displayfd` argument tells Xorg to write its display number to a file, which is put in an envdir[3] and unsurprisingly named "DISPLAY". The fact that Xorg is independently supervised means it is always running, regardless of which (if any) clients are connected. So if my window manager crashes, I don't lose my session! Another benefit of supervision is that Xorg is always run in the same environment. I could ssh into the box and restart Xorg, and it would be right back on tty1, 100% of the time. 3) Also in my user's s6 supervision tree, I have a service for my window manager. s6-rc[4] handles the dependency on the X server and the DISPLAY environment variable automatically. s6-envdir -fi /run/user/me/env i3 I have similarly simple services for urxvtd, redshift, compton, etc. That way I *always* know at a glance a) if those background processes are running, because s6 will tell me; and b) where the processes are, because it's always the same place -- in the supervision tree. It is simply not possible to have "leftover" processes from a previous session, or to start a service with the wrong environment by starting it from the "wrong" shell. 4) What about passwords? Simple! Have the screen locker start at boot, just like everything else I've mentioned so far. Doing things this way means I get to reuse the same tools for managing my X session as I do for my system services. It also means there's a consistent set of environment variables for all of my processes, and there are no extra shells sitting around. Here's what the process tree looks like (where each of the s6-supervise processes are using a *single 4k page* of RAM, and the s6-svscan's are using about 64k, and absolutely 0 CPU time unless you interact with them): s6-svscan -s [PID 1, running as root] ├─ s6-supervise user-services@me │ └─ s6-svscan -S [running as me] │ ├─ i3bar --bar_id=bar-0 --socket=/run/user/me/i3/socket │ │ └─ i3status │ ├─ s6-supervise xorg │ │ └─ Xorg -displayfd 5 -nolisten local -nolisten tcp -quiet -tst vt1 │ ├─ s6-supervise urxvtd │ │ └─ urxvtd -q │ │ └─ zsh │ ├─ s6-supervise ssh-agent │ │ └─ ssh-agent -a /run/user/me/ssh-agent -Ds │ ├─ s6-supervise s6rc-oneshot-runner │ │ └─ s6-ipcserverd -1 ... [runs oneshots like setting the wallpaper] │ ├─ s6-supervise s6rc-fdholder │ ├─ s6-supervise redshift │ │ └─ redshift -r │ ├─ s6-supervise mpd │ │ └─ mpd --no-daemon --stderr │ ├─ s6-supervise i3 │ │ └─ i3 │ └─ s6-supervise compton │ ... [system services] TL;DR: "startx vs a DM" is a false dichotomy. "Logging in" to a PC is meaningless. Supervision is the *correct* answer to managing a set of long-running processes. Cheers, Samuel [1]: https://skarnet.org/software/s6 (like runit, but much better) [2]: https://github.com/smaeul/rc-user [3]: https://skarnet.org/software/s6/s6-envdir.html [4]: https://skarnet.org/software/s6-rc
Re: [dev] st: selecting text affects both primary and clipbaord
On March 12, 2015 11:05:10 AM CDT, Wander Nauta wrote: >> Do most numpad-less laptop keyboards even have Insert or a middle >mouse button? > >Macbooks have neither, I believe, and they're fairly popular. They have insert at fn+Enter. Of course, it's not labeled. -- Regards, Samuel Holland
Re: [dev] [st] can't use Xterm font
On February 24, 2015 10:10:53 AM CST, Greg Reagle wrote: >It's not the the xterm font, but I am just as happy with the font when >I >run "st -f mono" (I am running Xubuntu 14.04). Does anyone know how to >figure out specifically which font is being used in this case? Thanks. fc-match mono -- Regards, Samuel Holland
Re: [dev] Looking for simple, alpha supporting image format
On Fri, 2014-07-18 at 20:57 +0200, FRIGN wrote: > On Fri, 18 Jul 2014 13:45:50 -0500 > Samuel Holland wrote: > > > Then put it after the magic string. And they don't have to be > > characters; they can be one-byte integers, which would be better > > anyway. My point is that the format shouldn't be limited to just , > > especially if you're concerned with file size, so the header should > > specify the bits per channel somewhere. > > I can see your motivation, but this is way too complex. > If you have no alpha-channel, the compression will take care of that, > because the pattern is really simple (every fourth is a 0, xxx0). That does make sense now. By reducing the entropy of the data, it compresses better, even without removing bits from the uncompressed version (which isn't used where space matters anyway). It's the same principle as LossyWAV[0], though even more effective. [0] http://wiki.hydrogenaud.io/index.php?title=LossyWAV > Cheers > > FRIGN -- Regards, Samuel Holland
Re: [dev] Looking for simple, alpha supporting image format
On Fri, 2014-07-18 at 20:32 +0200, koneu wrote: > On 07/18/2014 08:28 PM, Samuel Holland wrote: > > I think it would be slightly more useful to put the number of bits > > per channel in the header instead of the string "rgba". It would allow > > more freedom in reducing the file size when color depth isn't very > > important. For example, you could do 5658 or or or 8880 (to > > omit alpha, even though currently omitting the "a" does the same). I > > can think of some cases where overlays might benefit from something > > like 1115. (There's still no real way to do monochrome.) > > Why put ASCII metadata in the magic string? I don't get it. Then put it after the magic string. And they don't have to be characters; they can be one-byte integers, which would be better anyway. My point is that the format shouldn't be limited to just , especially if you're concerned with file size, so the header should specify the bits per channel somewhere. > And please align your lines next time you send an email to this list. Done. Thanks for the heads up. -- Regards, Samuel Holland
Re: [dev] Looking for simple, alpha supporting image format
On Jul 18, 2014, at 1:10 PM, FRIGN wrote: > I'd rather put it this way: > > BytesDescription > 13ASCII string: "img13w4h4rgba" > 432 bit Big-Endian integer for width > 432 bit Big-Endian integer for height > (w*h)Raw RGBA. I think it would be slightly more useful to put the number of bits per channel in the header instead of the string "rgba". It would allow more freedom in reducing the file size when color depth isn't very important. For example, you could do 5658 or or or 8880 (to omit alpha, even though currently omitting the "a" does the same). I can think of some cases where overlays might benefit from something like 1115. (There's still no real way to do monochrome.) The header would need to be rearranged a little, to separate it from the height field length. The simplest way would be to add a "b" before the numbers, making the first part, say, "img14w4h4b". Regards, Samuel
Re: [dev] New utility "when"
>> On Dec 12, 2013, at 4:10 PM, "Fernando C.V." wrote: >> On Thu, Dec 12, 2013 at 10:49 PM, Fernando C.V. wrote: >> This way could do something like: >> >> $ when -t ssh host >>> xmessage DONE! > > Well... even if you didn't prompt it to the user interactively, it > would still be nice for aliases. > Probably most of the time you just want to get notfications: > > $ alias retry='echo "xmessage DONE" | when' > $ retry ssh host And if you only need simple messages, then there's nothing wrong with having to quote the "on success" command: $ when -t -c "xmessage Success" The advantage of specifying the message command as an argument (as opposed to &&) is that it allows you to pass through the return value of the main command. For example, if your long-running program is still running after the timeout, you get the message; but it may fail later, and you want to know about that too. $ when -t -c 'logger "Service started successfully"' non-forking-service || logger "Service exited unexpectedly" - Samuel Holland
Re: [dev] [st] Very strange font problem
Nick wrote: > Quoth FRIGN: >> On Thu, 28 Nov 2013 23:37:59 +0200 >> Dimitris Zervas wrote: >> >>> I attach a screenshot of xterm that I now use and the st that I'm > configuring. >>> I want to make st look the same with xterm. >>> Any help apprecieted. >> >> I have had this problem before. It has definitely something to do with >> the font. You might try playing around with the font-parameters (esp. >> autohinting). > > It isn't any of the font parameters. A few fonts just didn't work > with st. I don't know why (and can't remember any examples). > > Which version of st are you using? Font handling is done differently > to how it used to be, so you may find using the latest tip it all > just works for you. > It happens whenever you try to use a proportional font, though I can only specifically remember it happening with Xft fonts. - Samuel Holland
Re: [dev] Some thoughts about XML
Chris Down wrote: >On 2013-10-24 01:04, Samuel Holland wrote: >> [body] >> content="%ol%%p%" >> [ol] >> style="list-style-type: decimal" >> content="%li.1%%li.2%%li.3" >> [li] >> style="display: list-item" >> content1="Lack of proper hierarchy, for one;" >> content2="Lack of proper heterogeneous containers, for two;" >> content3="%b%:\nlack of multiline strings." >> [b] >> style="font-weight: bold" >> content="The most important one" >> [p] >> style="display: block" >> content="Try to express something as simple as %i% (which is\nrather >trivial HTML snippet) in .ini format." >> [i] >> style="font-style: italic" >> content="my answer" > >I'm hoping this is devil's advocate, this is the worst thing I've ever >seen. Yes, it was. The variable substitution is entirely made up, but what's worse is that almost every line of the Wikipedia page starts with "some implementations..." What I have been giving thought to is a representation using JSON, where each element is an array. The first member is a CSS selector, and subsequent members are strings and more arrays. That way you keep ordering and small size, yet can still mix text and elements.
Re: [dev] Some thoughts about XML
"Alexander S." wrote: > 2013/10/24 Mihail Zenkov : > > 2013/10/23, Alexander S. : > >>> I'm confused as to what is wrong with the .ini style configurations. > >>> They're not just used in Windows, they're used in many other places that > >>> require simple, easy to use configurations. Python uses it, there are C > >>> api's for it, etc. > >>> > >>> So what problem do you have with a .ini file? > >> They are okay for simple config files. They are the opposite of okay > >> for a markup language. > > > > Why? > > Lack of proper hierarchy, for one; > Lack of proper heterogenous containers, for two; > The most important one: > lack of multiline strings. > > > Try to express something as simple as my answer (which is > rather trivial HTML snippet) in .ini format. > [body] content="%ol%%p%" [ol] style="list-style-type: decimal" content="%li.1%%li.2%%li.3" [li] style="display: list-item" content1="Lack of proper hierarchy, for one;" content2="Lack of proper heterogeneous containers, for two;" content3="%b%:\nlack of multiline strings." [b] style="font-weight: bold" content="The most important one" [p] style="display: block" content="Try to express something as simple as %i% (which is\nrather trivial HTML snippet) in .ini format." [i] style="font-style: italic" content="my answer"