Your Latest Workflow Improvement - Desktop Customization & Workflow

Users browsing this thread: 1 Guest(s)
z3bra
Grey Hair Nixers
Hey there.

I know we're all interrested in improving our day-to-day tasks to make them faster, or easier to do.
We all do different things to improve our workflow, and most of the time, it feels pretty good to see it working.

I create this thread so we can share any snippet, trick or solution we find to improve our workflow. I'll start with a script of mine I use a lot:

At work, I'm forced to use a window machine. Not a big deal as I'm allowed to run a VM on it (archlinux, for convenience). But from time to time, I need to send logfiles, memory dumps and similar to people, and this is a tedious task, as I need to copy the files from the VM to a shared folder with the host, then put it on people's desktop using the windows explorer (I'm a system admin, so that's why I have these access).

I then created a script call "winput" which uses smbclient to send search netbios names on the network, and put files on the desktop of these people.
Computers here are named after the login name, with 1,2 or 3 appended to it (or not):


Code:
#!/bin/sh

usage() {
    echo "usage: $(basename $0) <netbios> <file>" >&2
    exit 1
}

echolor() {
    printf '[1;3%dm%s\n' "$1" "$2"
}

find_hostname() {
    BASE=$1
    for SFX in '' 1 2 3; do
        ping -c1 ${BASE}${SFX} >/dev/null 2>&1 && echo ${BASE}${SFX} && return
    done
    echo NONE
}

test $# -lt 2 && usage

printf 'NETBIOS:  '
SMBHOST=$(find_hostname $1)

test "$SMBHOST" == "NONE" && echolor 1 "$SMBHOST" && exit 1
echolor 2 "$SMBHOST"
DIRNAME=$(dirname $2)
BASENAME=$(basename $2)

printf 'TRANSFER: '
if smbclient "//$SMBHOST/c$" -c "lcd $DIRNAME; cd Users/$1/Desktop; put $BASENAME" -A /etc/cifsauth -E 2>/dev/null; then
    echolor 2 OK
else
    echolor 1 FAIL
fi

Example of it running:

Code:
$ winput username ~/.profile
NETBIOS:  username2
TRANSFER: OK

And I can now si the .profile file on my desktop! Magic :D

Your turn now!
BANGARANG, MOTHERFUCKER
venam
Administrators
I recently finished reading Practical Vim and because I spend most of my time programming it boosted my workflow.

I also got myself to use more and more background processes (ctrl-z) and specific zsh tricks with directories (using pushd).
z3bra
Grey Hair Nixers
(17-08-2015, 09:58 AM)venam Wrote: specific zsh tricks with directories (using pushd).

Any example about these? I'm curious as to how popd/pushd can be used for interactive use.
venam
Administrators
(17-08-2015, 11:50 AM)z3bra Wrote:
Quote:specific zsh tricks with directories (using pushd).
Any example about these? I'm curious as to how popd/pushd can be used for interactive use.
Code:
~ > pushd BUILDING                                                                                         <
~/BUILDING ~
~/BUILDING > pushd l_systems                                                                               <
~/BUILDING/l_systems ~/BUILDING ~
~/BUILDING/l_systems > cd -0                                                                               <
---- directory stack
0 -- /home/raptor
1 -- /home/raptor/BUILDING
~/BUILDING/l_systems > #OR
~/BUILDING/l_systems > popd -                                                                              <
---- directory stack
0 -- /home/raptor
1 -- /home/raptor/BUILDING
I press TAB after the '-'.
Like that you can move wherever you want in the stack in an interactive way.
neeasade
Grey Hair Nixers
Well, I'm working on a small script to help me if I forget where open windows are/ multihead nicety[WIP]: https://sr.ht/6lif.webm

Still messing around with dzen2 a bit, it's fun.

The plan is to make it so that left click is focus and move cursor to window, and right click is bring to current workspace as biggest window.
dkeg
Members
Just some pretty minor stuff for me. Small bash function for git for quicker and less typing.
Code:
function gitpush() {                                                            
    # usage: gitpush [ . |"file1 file2"] ["commit message"] [branchname]                                                
    args=("$@")                                                                
        git add "${args[0]}" && git commit -m "${args[1]}" && git push -u origin "${args[2]}"    
}
Also cleaning up and centralizing by organizing directories, with more on my /data partition, with symlinks in my $HOME. Gits, media, walls, colors, bin, tools
work hard, complain less
swathe
Members
(17-08-2015, 10:56 PM)dkeg Wrote: Just some pretty minor stuff for me. Small bash function for git for quicker and less typing.
Code:
function gitpush() {                                                            
    # usage: gitpush [ . |"file1 file2"] ["commit message"] [branchname]                                                
    args=("$@")                                                                
        git add ${args[0]} && git commit -m ${args[1]} && git push -u origin ${args[2]}    
}
Also cleaning up and centralizing by organizing directories, with more on my /data partition, with symlinks in my $HOME. Gits, media, walls, colors, bin, tools

I've started using this with git, it's nice https://github.com/qw3rtman/gg
z3bra
Grey Hair Nixers
Git can sure be a pain to deal with (as in, many commands to type...) I should start making it easier to use, at least for my dotfiles where I don't care about the history, I just want them to be in sync everywhere. Something like a script that would run every time I update a file, that would pull/commit/push the changes.

Mmmmmh... I might be onto something!
dkeg
Members
Thanks swathe, looks interesting, but way over the top for my needs.
z3bra, sounds good! I'd be very interested to see what you come up with. I tend to think I may like manual pushes better, for me though, a bit more control.
Actually, I believe there is something a bit similar over at the linuxbbq forums similar .... found it ... http://linuxbbq.org/bbs/viewtopic.php?f=...pper#p9498 ...
work hard, complain less
Wildefyr
Long time nixers
(17-08-2015, 07:21 PM)neeasade Wrote: Well, I'm working on a small script to help me if I forget where open windows are/ multihead nicety[WIP]: https://sr.ht/6lif.webm

Still messing around with dzen2 a bit, it's fun.

The plan is to make it so that left click is focus and move cursor to window, and right click is bring to current workspace as biggest window.

Nice! I've been thinking of doing something similar with wmutils, get a list of open windows and then select using hjkl; actually should be fairly easy to implement, just need to find ( or write ) a menu select system.
neeasade
Grey Hair Nixers
(18-08-2015, 07:41 PM)Wildefyr Wrote: Nice! I've been thinking of doing something similar with wmutils, get a list of open windows and then select using hjkl; actually should be fairly easy to implement, just need to find ( or write ) a menu select system.

Would such a menu written in wmutils be WM agnostic if the WM was simple enough? That's an interesting proposition.
Wildefyr
Long time nixers
(19-08-2015, 09:12 AM)neeasade Wrote:
(18-08-2015, 07:41 PM)Wildefyr Wrote: Nice! I've been thinking of doing something similar with wmutils, get a list of open windows and then select using hjkl; actually should be fairly easy to implement, just need to find ( or write ) a menu select system.

Would such a menu written in wmutils be WM agnostic if the WM was simple enough? That's an interesting proposition.

Yes, it would be.
z3bra
Grey Hair Nixers
Depends on the WM entirely.
Some WM reparent windows, and thus, won't work.
Some WM keep track of windows in-memory and ignore windows deletion event, and thus won't work.
Some WM relies entirely on EWMH, and thus won't work.
Some WM forbid external programs to handle windows, and thus, won't work.

For now, I've only found cwm (and swm, obviously) to fully integrate with wmutils (though some like ratpoison give good results)
I recently installed OpenBSD and by default it comes with CWM (calm window manager). I've found it to be quite useful as it already comes with search and works great IMO.
jvarg
Members
Remapping my capslock to escape was the best improvement i have had.
vedard
Registered
I found a little trick to create a "Recently added" play-list in MPD. It's not perfect because every recently modified files will come at the top of the list.

Code:
cd ~/drv/Music/iTunes/iTunes\ Media/Music
find -iname "*.[mmw][p4a][3av]" -mtime -50 | sort | sed 's/\.\///' > ~/.config/mpd/playlists/recent
swathe
Members
Nothing amazing, but I ditched wordpress for the octopress blogging framework. I have to say I enjoy using it a lot more.
Wildefyr
Long time nixers
Wrote this script using fzf to give me an interactive way to view and then kill processes without loading something like htop: (dcat has already mentioned how he hates this tho):
Code:
KILL=/tmp/.kill

ps ax | fzf -m -x --tac | awk '{print $1}' > $KILL

for i in $(seq $(cat $KILL | wc -l)); do
    kill -9 $(cat $KILL | sed "$i!d")
done
neeasade
Grey Hair Nixers
oh fuck yeah fzf functions.

https://github.com/junegunn/fzf


Code:
fe() {
    # fe - Open the selected files with the default editor
    local files=$(fzf --query="$1" --select-1 --exit-0 | sed -e "s/\(.*\)/\'\1\'/")
    local command="${EDITOR:-vim} -p $files"
    [ -n "$files" ] && eval $command
}

fd() {
    # fd - cd to selected directory
    local dir
    dir=$(find ${1:-*} -path '*/\.*' -prune -o -type d -print 2> /dev/null | fzf +m) &&
    cd "$dir"
}

fh() {
    # fh - repeat history
    eval $( ([ -n "$ZSH_NAME" ] && fc -l 1 || history) | fzf +s --tac | sed 's/ *[0-9]* *//')
}

fkill() {
    # fkill - kill process
    pid=$(ps -ef | sed 1d | fzf -m | awk '{print $2}')
    if [ "x$pid" != "x" ]
    then
        kill -${1:-9} $pid
    fi
}
greduan
Long time nixers
What I don't like about fzf is that the install script invades the hell out of your config files. .bashrc and .zshrc IIRC. Otherwise I'd use it all day, nowadays I don't install it because of that.
Eduan / greduan
https://greduan.com
me@greduan.com
z3bra
Grey Hair Nixers
I've stopped using IRC at work recently. That's a huge productivity boost in the end. I didn't realise how distracting it was.
jury
Registered
^ 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.
ninjacharlie
Members
Not a super recent performance boost, but I did start using Vimium in Chrome (adds vim-ish keybindings). It's way more comfortable for me to use now :)
Wildefyr
Long time nixers
(07-09-2015, 09:08 PM)ninjacharlie Wrote: Not a super recent performance boost, but I did start using Vimium in Chrome (adds vim-ish keybindings). It's way more comfortable for me to use now :)

I tried using that, but I think cVim is a much better implementation. Also vimperator for firefox is far more feature complete and more hackable, main reason why I switched over to firefox from chrome.
greduan
Long time nixers
(07-09-2015, 04:55 AM)z3bra Wrote: I've stopped using IRC at work recently. That's a huge productivity boost in the end. I didn't realise how distracting it was.
IKR, same. Problem is then I completely forget to join IRC and then happens what happened, which is that I'm offline for months at a time. lol
Eduan / greduan
https://greduan.com
me@greduan.com
z3bra
Grey Hair Nixers
Yeah it makes me realise how much I was quatting IRC...
dkeg
Members
gtk colors from xcolors
replace current color values in gtk theme with xcolors

https://github.com/dkeg/inspin/blob/master/gtkColor
work hard, complain less
neeasade
Grey Hair Nixers
(13-09-2015, 06:24 PM)dkeg Wrote: gtk colors from xcolors
replace current color values in gtk theme with xcolors

https://github.com/dkeg/inspin/blob/master/gtkColor
Very nice. Will have to play with this when home today.
venam
Administrators
(13-09-2015, 06:24 PM)dkeg Wrote: gtk colors from xcolors
replace current color values in gtk theme with xcolors

https://github.com/dkeg/inspin/blob/master/gtkColor
That's epic. This weekend I'll try to combine your gtkColor and 2bwmColor with URNN.
Like that you get a wallpaper that fits with the terminal colorscheme that fits with 2bwm borders that fits with the gtk colors.

I'll report when I'm done!
Kudos for the good work.
dkeg
Members
^cool. Look forward to it. And thanks!
work hard, complain less