Your Latest Workflow Improvement - Desktop Customization & Workflow

Users browsing this thread: 22 Guest(s)
z3bra
Grey Hair Nixers
(05-05-2017, 12:42 AM)venam Wrote:
(04-05-2017, 05:39 PM)z3bra Wrote: Then you'll probably love piping your selection into random programs
Code:
:'<,'>!tr a-z A-Z
My favorite one:
Code:
:'<,'> !fmt

I think vim call fmt internally when pressing 'gq'. But yeah, I use that a lot!

EDIT: mine can be replaced with pressing 'gU' also
xcko
Members
I also like using :'a,'bw !lua to check certain code snippits through the interpreter, or :!gcc && ./a.out though my favorite lately has been :!! to rerun the last shell command used in the command prompt
z3bra
Grey Hair Nixers
I prefer using ^Z to run external commands though. It is more flexible IMO. Also, I never use gcc by itself, and rather a makefile, be it as simple as:

Code:
pgm: pgm.c
gaak
Members
jvarg's remap capslock to escape is quite good.

tmux + vim + some REPL -- i.e. use vim+tmux to control a shell or interpreter. That way, you live in your editor and think about ssh'ing into a router or whatnot more programmatically.

inbox zero is a good hack for ppl who use email as their default message bus -- notifications that interrupt attention need to be pretty damn important.
prx*
Members
(07-09-2015, 03:15 PM)jury Wrote: ^ That's why I'm rarely on IRC; I can never get anything else done when it's open =P

Unrelated: if you don't have a constantly displayed clock (because minimalism or, like me, laziness), you can put one in dmenu output. Here's my dmenu_run (same as vanilla except for a couple lines):
Code:
#!/bin/sh
cachedir=${XDG_CACHE_HOME:-"$HOME/.cache"}
if [ -d "$cachedir" ]; then
        cache=$cachedir/dmenu_run
else
        cache=$HOME/.dmenu_cache # if no xdg dir, fall back to dotfile in ~
fi
(
        IFS=:
        if stest -dqr -n "$cache" $PATH; then
                echo -e "$(date +"%m/%d %R")\n$(stest -flx $PATH | sort -u | tee $cache)" | dmenu "$@"
        else
                echo -e "$(date +"%m/%d %R")\n$(cat $cache)" | dmenu "$@"
                #dmenu "$@" < "$cache"
        fi
) | ${SHELL:-"/bin/sh"} &
More functionality for the same old shortcut! A friend of mine came up with it, but I use it all the time.
For this under CWM, I use this attached to a keystroke :

Code:
#!/bin/sh
xclock -digital -strftime "%H:%M  --  %d/%m/%Y" -geometry +0+0 &
PID=$!
sleep 5
kill -9 $PID

exit 0
gaak
Members
Yeah, put all the status bits in one place and tie one keystroke to it

Code:
quiet() { $* 2>/dev/null ; }                                                  
net=$( quiet ip route show | grep -qs ^default || echo "NO NETWORK -- " )    
vpn=$( quiet ip route show | grep -qs ^10.82 && echo VPN )                    
bat=$( acpi -b | sed 's/Battery 0://;s/Discharging,//')                      
now=$( date +'%F %T' )                                                        
printf "\n%s %s %s %s\n" "$bat" "$now" "$net" "$vpn" | ~/pkg/x11/bin/dmenu.sh
                                                                              
exit 0
anthk
Members
Well, I have several for irssi (I use it mainly with Bitlbee).
You'll need to autoload fnotify.pl from Irssi's script database.

Code:
drwho:~>cat bin/irc
tmux attach -t irssi ||  tmux new -s irssi irssi

drwho:~>cat bin/irc_notify
#!/bin/sh
if
(pgrep -f "entr -s /home/drwho/bin/lnotify" )
then
notify-send "entr <-> irc is up"
exit 0
fi
while true ; do ls ~/.irssi/fnotify | entr -p /home/drwho/bin/lnotify ; done

drwho:~>cat bin/lnotify  
#!/bin/sh
OL="$(tail -1 ~/.irssi/fnotify)"
if (echo "$OL" | grep -v -q anthk_)
then
notify-send "$OL"
else
exit 0
fi
TastyFugu
Registered
I wanted to know how many monitors are active at the moment so i came up with this one liner:

Code:
xrandr -d :0 -q | grep '*+' | wc -l

You can also check how many monitors are connected (on or off):

Code:
xrandr -d :0 -q | grep '+' | wc -l
prx*
Members
I wanted to add magnet link in rtorrent from the hash found in omgtorrent (no torrent hosted, so not illegal) :
Code:
#!/bin/sh
#hash to magnet (omgtorrent)

T1="udp%3A%2F%2Ftracker.openbittorrent.com%3A80"
T2="udp%3A%2F%2Fudp://tracker.publicbt.com%3A80"
T3="udp%3A//9.rarbg.com%3A2800"
T4="udp%3A%2F%2Fexplodie.org%3A6969"
T5="udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969"
T6="udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969"

HASH=$(xclip -o)

MAGNET="magnet:?xt=urn:btih:$HASH&tr=${T1}&tr=${T2}&tr=${T3}&tr=${T4}&tr=${T5}&tr=${T6}"
echo -n "$MAGNET" | xclip -i
echo -n "$MAGNET" | xclip -i -selection clipboard
exit 0
neeasade
Grey Hair Nixers
I made a script to toggle mpc when pulseaudio brings other things on board:

https://github.com/neeasade/dotfiles/blo...lsewatcher
venam
Administrators
My latest, not so new, workflow improvement is to use `at` as a notification timer.
When I have to do something after X time or at X time I just fire up `at` with notify-send and/or some sound.

It's pretty neat, light, and simple.
z3bra
Grey Hair Nixers
I recently switched from tmux to dvtm.
It doesnt sound like much, but the fact it auto arrange stuff is great to force you tidy your things, istead of spending time making mosaics.
grah
Members
My latest workflow improvement is a simple one and is probably something that everyone is already aware of: using Ctrl-Backspace or Ctrl-Del to delete a whole word instead of just using Backspace or Delete. Works in most graphical applications.

(27-02-2019, 11:40 AM)z3bra Wrote: I recently switched from tmux to dvtm.
It doesnt sound like much, but the fact it auto arrange stuff is great to force you tidy your things, istead of spending time making mosaics.

Wow thanks for posting this, dvtm is perfect! I've now dropped tmux and screen and use it along with dtach.
Igrom
Members
Today's workflow improvement is a result of automating a recent piece of work outlined in https://nixers.net/showthread.php?tid=2253.

Code:
# trim video
function vtrim () {
  ffplay -vf "drawtext=text='%{pts\:hms}':box=1:x=(w-tw)/2:y=h-(2*lh)" "$1"
  while :
  do
    read
    ffmpeg -i "$1" -ss 00:00:$REPLY short-"$1"
    ffplay short-"$1"
  done
}

# record video
function vrecord () {
  ffmpeg -video_size $(xrandr | grep -P '(?<=current )[^,]+' -o | tr -d ' ') -framerate 25 -f x11grab -i :0 full.mp4
  vtrim full.mp4
}

The code records my screen. Once the recording is stopped, the video plays back with a rectangular overlay with the frame timestamp. Once I scroll to the beginning of the video's actual content, I memorize the timestamp, ^C and subsequently enter the seconds and microseconds in the terminal to trim the video. I confirm visually that it was done okay, otherwise I ^C to tweak the trim.
wolf
Members
MPD + Youtube-dl : Listen Youtube at mpd

Not exactly a work stuff, but work related since I like to listen some music while working :

Code:
#!/usr/local/bin/bash

mpdu2bCacheDir=/tmp/mpdu2bdir/ ;
/usr/bin/youtube-dl -x \
    --audio-format mp3
    -q "${1}" \
    -o "${mpdu2bdir}/%(title)s.%(ext)s" \
    --exec 'mpc add {}' ;

I used to use the stream URI directly to mpd, but had issues with mp4 and song name ( sometimes I want to see the lyrics ).

Note : You'll need configure your mpd to use Unix Socket as address to bind.
prx*
Members
@wolf : omg that's great !
I guess there is a little mistake in variable.
I modified it a bit to add the "continue" option to youtube-dl if the file is already retrieved:

Code:
#!/bin/sh
MUSDIR=~/Musique
/usr/bin/youtube-dl -x \
    --audio-format best \
    -q "${1}" \
    -c \
    -o "${MUSDIR}/%(title)s.%(ext)s" \
    --exec 'mpc add {}' ;
wolf
Members
(30-03-2019, 09:49 AM)thuban Wrote: @wolf : omg that's great !
I guess there is a little mistake in variable.
I modified it a bit to add the "continue" option to youtube-dl if the file is already retrieved:

Code:
#!/bin/sh
MUSDIR=~/Musique
/usr/bin/youtube-dl -x \
    --audio-format best \
    -q "${1}" \
    -c \
    -o "${MUSDIR}/%(title)s.%(ext)s" \
    --exec 'mpc add {}' ;

Hey, thanks for the fix and improvement. thuban++
z3bra
Grey Hair Nixers
This week I made a simple script to track my time (ask by my management recently). It lets you create/close tasks (one task is a single line description).
There is only one task elected as "current" at a given time, which is a symlink to the actuall task. When you create a different time, the timestamp is recorded in the file, and a keyword "now" is added to define when you finished it.
When you close a task "now" is replaced by the timestamp, and "[CLOSED]" is prepended to the subject.
You can list you tasks, or export them in csv form if you want to post-process them.

I'm not quite sure if it will help, but it does a good job at tracking time :)

If anyone is interested, I can post the script tomorrow.
pkal
Long time nixers
(16-03-2019, 06:22 PM)grah Wrote: My latest workflow improvement is a simple one and is probably something that everyone is already aware of: using Ctrl-Backspace or Ctrl-Del to delete a whole word instead of just using Backspace or Delete. Works in most graphical applications.

Learning Emacs keybindings is generally quite useful when you use bash. I regularly use C-x ( to record macros, C-a/C-e to jump around the current line, C-l to clear the screen, C-y/M-y to use the kill ring, and M-u/M-c/M-l to toggle cases. And I guess it's just my preference, but C-f/C-b/C-p/C-n are nicer than the arrow keys, especially on laptops.
fraun
Members
(31-03-2019, 07:05 PM)z3bra Wrote: This week I made a simple script to track my time (ask by my management recently). It lets you create/close tasks (one task is a single line description).
There is only one task elected as "current" at a given time, which is a symlink to the actuall task. When you create a different time, the timestamp is recorded in the file, and a keyword "now" is added to define when you finished it.
When you close a task "now" is replaced by the timestamp, and "[CLOSED]" is prepended to the subject.
You can list you tasks, or export them in csv form if you want to post-process them.

I'm not quite sure if it will help, but it does a good job at tracking time :)

If anyone is interested, I can post the script tomorrow.

That sounds kind of like org-mode in emacs... In fact it is doable in org-mode
z3bra
Grey Hair Nixers
Maybe but I run a linux machine, not an emacs one ;)
pyratebeard
Long time nixers
(27-02-2019, 06:20 AM)venam Wrote: When I have to do something after X time or at X time I just fire up `at` with notify-send and/or some sound.
It's pretty neat, light, and simple.

I have started using this as well, it's very useful.

I have stopped keeping tabs open in the browser and started storing links in buku or making notes on my wiki. I found that I would rarely go back to that article I wanted to read, or need that stackoverflow answer again so decided to keep my browser clear. If I do need a link I can find it in buku.

I could do with a shot of rum right now.
pkal
Long time nixers
(05-04-2019, 02:24 PM)z3bra Wrote: Maybe but I run a linux machine, not an emacs one ;)

Whoever doesn't use Emacs, is doomed to reinvent it ;^)
z3bra
Grey Hair Nixers
hahaha nice quote! I'll steal it ^^
For my organisation issue, I changed the concept a bit, and decided to consider my work as a stack of tasks.
When a new task arrive, I push it on top, and it becomes my current task. When the top task is done, I "pop" it out, and the one below becomes the main one.
At any given time, I can move a lower task to the top and work on it, but I force myself to only work on the top task.

Of course, that doesn't take multitasking into account. If smI get a request that can be cleared in less than a minute, I don't even stack it.

I wrote a first PoC named "stak" (I like that it's an anagram for task). I'll clean it a bit and post it if you're interested
acg
Members
(12-04-2019, 10:57 AM)z3bra Wrote: For my organisation issue, I changed the concept a bit, and decided to consider my work as a stack of tasks.
When a new task arrive, I push it on top, and it becomes my current task. When the top task is done, I "pop" it out, and the one below becomes the main one.

I'm wondering what do you do with a "current" task when another one arrives if you still have one in progress. This is one of my main issues, I'm working on something and get approached with a new non-trivial task.

What I've been doing lately is delaying those task until I finish the current one and reorganize.
z3bra
Grey Hair Nixers
Depends. For now every new task goes to the top by design, and becomes the current.
If it's not urgent, I just put back the last task on top
prx*
Members
I recently added to my ~/.xsession calls to xdotools in order to start some stuff when the mouse is on screen border.
Code:
xdotool behave_screen_edge --delay 900 bottom-left exec tkmenu &
xdotool behave_screen_edge --delay 900 bottom-right exec pager &
(also added these commands to cwm's menu)

Code:
command " -  Min win " "xdotool selectwindow windowminimize"
command " +  Max win " "xdotool selectwindow windowsize 100% 100% windowmove 0 0"
command " x  Close win " "xdotool selectwindow windowclose"
command " -* Desktop  " "sh -c 'for i in $(xdotool search --onlyvisible .); do xdotool windowminimize $i; done'"
z3bra
Grey Hair Nixers
I don't get it. You added this because you wanted the ability to do it without the keyboard?
venam
Administrators
(16-04-2019, 05:29 AM)thuban Wrote: I recently added to my ~/.xsession calls to xdotools in order to start some stuff when the mouse is on screen border.
xdotool behave_screen_edge --delay 900 bottom-left exec tkmenu &
xdotool behave_screen_edge --delay 900 bottom-right exec pager &
(also added these commands to cwm's menu)

I might actually use that to show a popup with the current time and date or todos when hitting a corner of the screen.
prx*
Members
Yep, for inspiration, I have this to handle windows
Code:
#!/bin/sh
# window operation
# requires xdotool

MSG="$(date '+%v %T')"
xmessage -nearmouse -timeout 5 -buttons "-:3,+:4,-*:5,x:6" "${MSG}"

case $? in
    3) xdotool selectwindow windowminimize ;;
    4) xdotool selectwindow windowsize 100% 100% windowmove 0 0 ;;
    5) for i in $(xdotool search --onlyvisible .);
           do xdotool windowminimize $i;
       done ;;
    6) xdotool selectwindow windowclose ;;
esac

exit

And to call the pager (and destroy it after a short time)
Code:
#!/bin/sh

netwmpager &
PID=$!

sleep 5
kill -9 $PID