What software have you made to improve your workflow or rice? - Desktop Customization & Workflow

Users browsing this thread: 1 Guest(s)
mort
Members
I've accrued a bunch of software to scratch workflow itches over the years, and I assum a few of you have done the same, so I thought it'd be fun to have a thread where we share our tools.

I'll start:
  • beanbar, my web-based status bar, because it's nicer to write new interactive widgets in javascript than in C
  • mauncher, my dmenu-like launcher, because I couldn't find any good dmenu alternatives which support wayland natively and support display scaling well (bonus: mmenu, a tool to add a python-based calculator/equation solver/base converter/etc to a dmenu-like launcher)
  • swaylock-effects, a fork of swaylock which adds a clock, screenshot capability, and a bunch of image effects like blur and vignette and scaling
  • facematcher, to unlock my laptop with my face using its infrared camera
  • mouseless, a Firefox add-on to browse the web without using the mouse as much
gmk
Long time nixers
yaki is an organizer/todo list program I wrote that really helps me organize my ideas for programs and other things. (The documentation is sparse but I'll update at some point)
JoshuaRLi
Members
sym is a straightforward batch symlinker developed to easily install and uninstall dotfiles.

It's basically an implementation of the feature subset 99% of GNU Stow users use to (un,)install their dotfiles, with a cleaned-up command line, sane defaults, and multiple args. So instead of something like...

stow --no-folding -t ${HOME} -d shells bash
stow --no-folding -t ${HOME} -d dev-langs python
stow --no-folding -t ${HOME} -d dev-tools tmux

...you can do the equivalent

sym shells/bash dev-langs/python dev-tools/tmux

The README has a more detailed comparison with GNU Stow.

sym does one thing, and does it well :)
(There's also a decent test suite! I've also battle tested it for my own use cases and it works flawlessly.)
jkl
Long time nixers
I do not "improve my rice".

--
<mort> choosing a terrible license just to be spiteful towards others is possibly the most tux0r thing I've ever seen
z3bra
Grey Hair Nixers
(23-08-2019, 04:02 PM)jkl Wrote: I do not "improve my rice".
Glad to know! What about your workflow then? :)

I'm not much into ricing either (not anymore at least!), but still write stuff for my workflow:
  • safe - secret keeper that doesn't need gpg
  • pm - stupid but extremely efficient package manager
  • human - convert numbers between units (Mib, Gib, ...)
  • so many scripts I stopped counting...

safe was my answer to my inability to correctly keep/share/maintain a GPG key for use with pass, a CLI password manager. Mine works using a single master password that is defined when storing the first secret, and is used to safely encrypt your secrets. It is shipped with an agent that can remember the key derived from the password so you don't have to input your password for every operation, just like gpg-agent or ssh-agent.
I've been using it for weeks now, and I'm pretty happy with it!

pm is my solution to the complexity of any package building process. My main distro is crux, one of the most simple linux distro out there when it comes to package management. It uses a port tree with really simple build scripts, and there are multiple composable tools to handle the packages. This is the most simple out there, yet I still found it too complex: you had to write a build script (albeit a short one!), then compile and install your software.
pm(1) is stupid: packages are tarballs, and when installing it, pm will list the installed files so you can remove them later. I couple that with a script of mine called "pack" that is basically it:
Code:
n=$(basename $PWD)
v=$(git tag|tail -n1)
[ -f configure ] && ./configure --prefix= --mandir=/man
make DESTDIR=$PWD/.rootdir PREFIX= MANPREFIX=/man install
tar -C .rootdir -cj . > $n@$v.tbz
pm -a $n@$v.tbz
The real script is a bit more complex with more checks and default values, but you get it! Thanks to it, when I want to install a software, all I do is fetch the source, then run "pack" inside it and it gets installed! This is a slightly improved "make; make install" version because it keeps track of installed files so it doesn't accidentally clutter my file tree, and also I can install to $HOME easily!
This is good for softwares using a compile time configuration, and any software because you don't need to write a single line of codw to have it packaged!

human grew out of the frustration that not all tools have a --human-readable flag to convert numbers like 47273726 into 47.3M. Nothing fancy, but extremely useful!

Finally, all my tiny little script (not shared online yet) to help me with all the stuff I do.everyday, like build a list of all the hosts in my /etc/hosts,
ssh/known_hosts, .ssh/config, pipe it into a fuzzy searcher for me to pick, and fire up ssh (I manage a list of 1000+ hosts at work, so you can guess how useful it is). I also have some scripts to fetch passwords from an online vault-like password keeper via API, setup a remote socks.proxy for testing acces from the outside world, select a password from safe(1) with dmenu and store it in the clipboard, tidy my mailbox based on a set of rules, open whatever is in the clipboard based on mimetype OR url+Content-type (like "plumb" on plan9), and so on and so forth :)
There is also this one that looks like black magic to my coworkers that is called like this:
Code:
$ mpcon '.*-dc[0-9]prd1.*'
It will fireup a dvtm instamce controlled via a socket, use the regex to extract a list of hosts (again from /etc/hosts, .ssh/config, ...) and open and create a new window in the dvtm with an ssh connection to this host. In one command, I connect to a few dozen hosts and can multiplex what I type in one window to all others, thus making me the great lord of the servs for administration!

If you're interested, I can share some if my scripts, but they might not be.if any use to you in the current state (lot of hardcoded stuff because it is not meant for wide distribution).



Sometimes I think it would be hyper interesting to sit next to someone and watch them actually use their computer for a day, just to see how they do it, and the tricks they use everyday.
Maybe we should do another screencast video session here at nixers, with real job done! Like pick a task from a random list, and screen yourself while doing it.
pkal
Long time nixers
Usually I fix my workflow with Elisp, which works well, but when I need something to work system wide I tend to fall back onto C or shell scripts. The most recent example is probably mkskel, that I use to create simple project skeletons (I have collected a few here, but there's still a lot to be done). I end up just having to type

Code:
mkskel latex cc0


to generate a latex article with all the usual usepackage's and a CC0 license file. Works quite well.
Wildefyr
Long time nixers
People probably already know this but I wrote mpvc a while back. It's served me pretty well over the years, very usable for all sorts of media playback. A couple of things I'd like to do is to patch fff with custom commands so I can run mpvc more easily from within fff, and eventually a full C rewrite would be great too.

A couple of things I did recently was to patch dmenu and lemonbar with proper border support, and I've written a wmutils script under to find the root window, and when it does execute the given command. Like CWM's menu popups, but more customisable with dmenu. Right now I have just my program launcher and a window menu finder, but could be used for other menus too. Again I'd like to write under in C at some point.
budRich
Long time nixers

i also made a custom css that hides all posts on nixers from jkl .
fraun
Members
(06-09-2019, 05:35 PM)budRich Wrote: i also made a custom css that hides all posts on nixers from jkl .


I'm interested!
Halfwit
Members
Hey, https://github.com/cloudef/bemenu works fine on Wayland
Halfwit
Members
Anyways for me, https://github.com/halfwit/dsearch is my main utility for any query, from opening a file, to a link in the correct program. It uses dmenu as a backend, and many bespoke pieces are tightly integrated. That makes it really unfortunate to try to use with other setups, thus https://github.com/halfwit/searchfs is being worked on, which will present a 9p-based filesystem that one can listen on your home network with, mounting up on client PCs with 9p-fuse or even a bare mount -t 9p. From it you can simply read from a file, like /path/to/where/i/mounted/youtube/channel/craz3bra and get a list of videos, /path/to/where/i/mounted/google/image/chickadee to get a list of URLs pointing to images of chickadees, etc. The benefit of this approach is twofold. First, you can trivially client-side cache the results, as most 9p client implementations have baked in caching, and secondly a system with relatively light resources can leverage the more powerful host system and better (ethernet connected intsead of wifi) latencies to the internet. It's pretty simple to pipe it through like `cat /path/to/where/i/mounted/youtube/search/chickens | dmenu | plumb` should I require something transient like I had with dsearch, but much more stable, and simple to install and use on any arbitrary system; quite contrary to dsearch.

Other than that, I've written hwwm, which is deprecated and pending a complete rewrite to abstract it from X11 (I want to also use it with Plan9's Rio) and to clean up the configurations heavily, as well as moving much of the logic to a monolithic binary for reasons of abstracted state management (currently I rely heavily on X11 atoms)

I did a rewrite of Plan9's Plumber in shell that understood remote URLs by content-type, but since I've gone back to using the original plumber from Plan9 (basically xdg-open on crack for the uninitiated) and instead rewrote the client binary to understand remote URLs, for a much more flexible and clean approach.

Tangential to the Plumber thing was a dsearch-target called `store`, which took an arbitrary resource, mostly URLs, and ran a specific handler based on the content-type. So for a pdf, it would run a script which fetched artwork, set in the Author's name and publishing year, and created a launcher entry for a dmenu that has pango image support. On a Youtube video, storing it meant appending it to an m3u playlist, for an RSS feed, an entry was added to my aggregator, for a github URL, I could clone into my src directory or store it as a bookmark; super handy and generally useful. Since then, I've realised I could use Plan9's Plumber to achieve the same thing, with a very clean syntax and greater granularity than otherwise possible (seriously, it's so clean!)
(The code for this is still available in dsearch, under https://github.com/halfwit/dsearch/blob/...dlers/save, but again it's terribly bespoke to my own needs and not very generally useful for others.)
Basically everything I've made in the past on Linux was re-evaluated when I went to plan9, and I came up with better solutions overall.
budRich
Long time nixers
(09-09-2019, 12:22 PM)fraun Wrote:
(06-09-2019, 05:35 PM)budRich Wrote: i also made a custom css that hides all posts on nixers from jkl .


I'm interested!

https://0x0.st/zJlp.png
pkal
Long time nixers
Thanks, but shouldn't the regex be have a ^ and a $? If I'm not mistaken, your bloking anyone who has "jkl" as a substring.

^^ Also, not sure how clever it is to use googleapis...
budRich
Long time nixers
(11-09-2019, 07:05 AM)zge Wrote: Thanks, but shouldn't the regex be have a ^ and a $? If I'm not mistaken, your bloking anyone who has "jkl" as a substring.

^^ Also, not sure how clever it is to use googleapis...

When fraun was interested i got interested too, so I searched for "userscript to hide annoying users on forum". I found a pastebin with a script for some other forum, and just hacked on it till jkl disappeared. I don't know javascript or jQuery, but i am sure there is a way to do it without jQuery at all, and maybe it can be included in some other way then google api. I use decentraleyes, and i think it always uses local jquery anyways.

And yes, the regex could be improved, maybe not using a regex at all and only test for exact matches would be better.
kontroll
Registered
(11-09-2019, 11:09 AM)budRich Wrote:
(11-09-2019, 07:05 AM)zge Wrote: Thanks, but shouldn't the regex be have a ^ and a $? If I'm not mistaken, your bloking anyone who has "jkl" as a substring.

^^ Also, not sure how clever it is to use googleapis...

When fraun was interested i got interested too, so I searched for "userscript to hide annoying users on forum". I found a pastebin with a script for some other forum, and just hacked on it till jkl disappeared. I don't know javascript or jQuery, but i am sure there is a way to do it without jQuery at all, and maybe it can be included in some other way then google api. I use decentraleyes, and i think it always uses local jquery anyways.

And yes, the regex could be improved, maybe not using a regex at all and only test for exact matches would be better.

I registered for the sole purpose of submitting an improvement.

Code:
$('table').has("a[href='https://nixers.net/member.php?action=profile&uid=1548']").has("span[class='usernames']").css('display', 'none');

It selects only tables where there is a child <a> element that links directly to the offending user. And because this created problems with the main forum page, it also requires a <span> child with the class of 'usernames'. It appears sufficiently specific to circumvent any overzealous matching, and small enough to please the eye.
jkl
Long time nixers
I find it amusing how many hours are wasted by writing scripts which discriminate other members in order to "improve your workflow". Get a life, friends.

--
<mort> choosing a terrible license just to be spiteful towards others is possibly the most tux0r thing I've ever seen
kontroll
Registered
For my part I wouldn't say it's a matter of hours, but I'm sure some people may take it that far.
fraun
Members
(17-09-2019, 08:08 AM)jkl Wrote: I find it amusing how many hours are wasted by writing scripts which discriminate other members in order to "improve your workflow". Get a life, friends.
My "interest" was more of an interest in how to do it. I also found it funny / though the original comment was a joke...
budRich
Long time nixers
(17-09-2019, 08:08 AM)jkl Wrote: I find it amusing how many hours are wasted by writing scripts which discriminate other members in order to "improve your workflow".

I find your definition of discrimination amusing. Using the script only restricts and discriminate the user of the the script.

Since I have such a turbo riced environment, the userscript dirthack took me ~5 minutes (4 of which where following links when i searched for "userscript hide annoying user on forum").

And limiting ones social media, is probably the most effective workflow improvement of all.

(17-09-2019, 08:08 AM)jkl Wrote: Get a life, friends.
rice is a way of life.. friend.
--

(17-09-2019, 07:36 AM)kontroll Wrote: I registered for the sole purpose of submitting an improvement.
...

You did the right thing! "My" code (the script I was inspired by, only had three .parent() ), wasn't the prettiest.

---
on topic:

using mpv for audio. I never watch a video and listen to mp3/flac (music/pod) at the same time, so using the same program for both is great. And mpv has some nice playback manipulation features (change speed with adjusted pitch) built in, and is very "rice friendly" . I have this bash script, that i use to open all media with:

Code:
#!/usr/bin/env bash
: "${MPV_FIFO_FILE:=/tmp/mp_pipe}"

targetVideo="$1"

if [[ -n $(xdotool search --class mpv) ]]; then
  echo "loadfile \"${targetVideo}\" append-play" > "$MPV_FIFO_FILE"

else
  rm -f "$MPV_FIFO_FILE"
  mkfifo "$MPV_FIFO_FILE"
  mpv "$targetVideo" --input-file="$MPV_FIFO_FILE" > /dev/null 2>&1 &
fi

If no mpv instance is running, it will start a new one, with the important "--input-file" option, otherwise it will add $1 to the playlist of the currently running mpv instance. This input-file fifo can be used to send any action to mpv, and i use it to control the media with global (i3) keybindings via this:

Code:
#!/usr/bin/env bash

: "${MPV_FIFO_FILE:=/tmp/mp_pipe}"

action="${1:-toggle}"
arg="${2:-}"

case "$action" in

  ( speed )
    : "${arg:-+}"
    [[ $arg = + ]] \
      && arg="multiply speed 1.1" \
      || arg="multiply speed 1/1.1"

      echo "$arg" > "$MPV_FIFO_FILE"
  ;;

  ( toggle )
    echo "keypress space" > "$MPV_FIFO_FILE" ;;

  ( next )
    echo "playlist-next" > "$MPV_FIFO_FILE"  ;;

  ( prev )
    echo "playlist-prev" > "$MPV_FIFO_FILE"  ;;

  ( seek )
    amount="${arg:-2}"
    [[ ! $amount =~ ^[+-][0-9]+$ ]] && amount='+2'
    echo "seek $amount" > "$MPV_FIFO_FILE"
  ;;
esac
Halfwit
Members
I use mpg123/ogg123 for audio and pipe the now playing title to a file, which is then read by my status bar. It's super useful, and works well with external mpd/radio streams. Mpd you can have as a multi-device solution, and you should try it out in that capacity if you haven't. It really shines
budRich
Long time nixers
I don't have a multi-device solution. If I did, i would probably give mpd another chance, but i also bet there are some solutions for something similar using mpv, maybe..

I used mpd/mpc/npmpcpp/cmus prior to mpv, but there where several things that annoyed me. npmpcpp/cmus not my cup of tea (i really dislike ncurses programs), npmpcpp has a minimum-width limit and "crashes" if the window is to narrow, which happens from time to time, since i use a tiling wm. I also like that mpv, can display the "album art" if it is included in the id3 tags (which i have a script that does automatically when i "get stuff"). Another annoying thing was that you need to add all new files to the "mpd database", which I guess can be automated, and not really a big deal, but i remember it annoyed me back then. But most importantly, i could never find a way to change the playback speed, i often listen and watch at higher playback speed, and I don't think it is possible with mpd, might be wrong though.

And mpv is as i said extremely rice friendly, so I have a lua script that updates my statusbar as well (TITLE TIME-LEFT).

I also select music/pods/videos with a dirthack rofi/dmenu system. (ls -t ~/porn | dmenu | mpvopen)

The biggest benefit imo to using one mediaplayer, is the global keybindings. toggle play (Mod4+/) is the same for both video and audio, since they are global i can do them without activating the player (i use this for both audio and video, very useful when watching tutorials or lectures and i want to take notes etc). But this can also be achieved with mpd+mpv, by querying mpc and see if it's playing or not and stuff, much cleaner and easier with one player though.
Halfwit
Members
Yeah, it's pretty much what I have in my hooks.lua, I do a bit of window management to handle resizes when the video switches (the tiling I use maintains video aspect ratio for no black bars anywhere) but basically it's all status bar code
Code:
• cat hooks.lua
local RUNTIME_DIR = os.getenv("XDG_RUNTIME_DIR")
RUNTIME_DIR = RUNTIME_DIR or os.getenv("HOME").."/.local/run"

function update_bar(name)
        title = mp.get_property("media-title")
        local f = io.open(RUNTIME_DIR.."/statusbar/media", "w")
        f:write(title.." ")
        f:flush()
        f:close()
        os.execute('/usr/local/share/hwwm/wshuf | xe -s \'wtp $1 $2 $3 $4 $5\' &')
end

function clean_bar(reason)
        local f = io.open(RUNTIME_DIR.."/statusbar/media", "w")
        f:write("")
        f:flush()
        f:close()
end
mp.register_event("start-file", update_bar)
mp.observe_property("media-title", "string", update_bar)
mp.register_event("end-file", clean_bar)

The lua API is really nice though, you can do a lot of things with it that I haven't bothered to do yet.
Halfwit
Members
I actually used mpv as my front end to mpd for a long while, but went to ogg123/mpd123 out of frustration with it having to draw a window. I'd simply "hide" the thing, but at the end of the day I never needed a graphical client.
anthk
Members
lots ot local scripts.
-A custom "mkg" gopher creation script to show the date in the ISO format.
-A paralell pwget URL fetching from a file.
-mps-youtube wrapper
-B/W art generator:

Code:
convert -fuzz 90% -threshold 50% "$1" -fill White +opaque Black "$2" "$@"

That way I can generate semi-good looking 80x24 ascii art for my gopher site

-Lots of aliases

Code:
alias cloud='cadaver https://cloud.disroot.org/remote.php/dav/files/anthk'
alias doom='prboom-plus -iwad /usr/local/share/doom/freedoom1.wad'
alias doom2='prboom-plus -iwad /usr/local/share/doom/freedoom2.wad'
alias fortran='flang -O2'
alias mupdf='mupdf -C f9c9a2' #no more blinding white
alias tilderadio='torsocks ffplay -nodisp https://radio.tildeverse.org/radio/8000/radio.ogg'
alias tetris='tetris -k '\''sjf pq'\''  -l9 '
alias tmux='tmux -u'
alias ific=nfrotz
Wildefyr
Long time nixers
(22-09-2019, 05:03 PM)Halfwit Wrote: I actually used mpv as my front end to mpd for a long while, but went to ogg123/mpd123 out of frustration with it having to draw a window. I'd simply "hide" the thing, but at the end of the day I never needed a graphical client.

You could look at mpvc for this. It uses mpv's socket feature to add and control files added to the queue. I'm the author, but there are a couple of other implementations around too.

You could also use a mpv profile to quote --no-video in it to.
Grok
Registered
My greatest lifesaver so far is a set of ansible scripts that will completely reinstall my desktop, servers, VMs and Raspberries to the settings and packages I want. I tend to break things while experimenting and I'm a lazy bastard when it comes to backups, so this tiny bit of organisation keeps me sane.

Last week one of my servers went unresponsive and subsequently got corrupted by a hard reset, five minutes later I was up and running again. That makes keeping my /etc files in a git repo worth it.
I sleep soundly knowing my crontab kicks off the right jobs on my hadoop clusters every five minutes without me having to manually check /etc after an upgrade.

The other thing is the reason I have two hadoop clusters: I got fed up using google to (not) find the things I need to develop stuff, so I've been busy building a search engine specifically for developer resources. The more time I spend building it, the more it proves that I really need something better than google.

Might turn out to be overkill, might be better than sliced bread.
seninha
Long time nixers
The software I made that I always use in my workflow is xprompt, a dmenu replacement.

I have a script that handles the xprompt output that I use in my workflow:
Rather than open a terminal to do anything, I open xprompt with Alt+Space and type the command I want prefixed with a ! (the ! will send the command to a shell).
Other commands interpreted by my xprompt script are:

Code:
mus play song_name

To play a song.

Code:
man command_name

To open a man page in zathura.

There are some small scripts I wrote that I use quite often: trash, an XDG-compliant trash bin manager; and unpack, which is just a wrapper around tar/gz/unzip/unrar so I do not have to understand their syntax.