pointless

  • 0 Posts
  • 71 Comments
Joined 1 year ago
cake
Cake day: June 23rd, 2023

help-circle







  • Putting the following with executable permissions inside ~/.local/share/nautilus/scripts/SCRIPTNAME adds a right click menu to Nautilus that serves the same purpose:

    #!/bin/bash
    
    CLIPBD=''
    [[ "${XDG_SESSION_TYPE}" == "x11" ]] && CLIPBD='xsel -ib'
    [[ "${XDG_SESSION_TYPE}" == "wayland" ]] && CLIPBD='wl-copy --trim-newline' && wl-copy --clear
    
    echo -n "${NAUTILUS_SCRIPT_SELECTED_FILE_PATHS}" \
      | tee >(xargs -I {} notify-send "Path Copied:" "{}") \
      | ${CLIPBD}
    

    The ‘notify-send’ bit isn’t necessary; it just puts up a notification.

    Mentioning only because it’s a simple demonstration of a pretty easy way to extend Nautilus for all kinds of purposes; w/o messing around with the pygobject interface. (There’s supposed to be an xdg standard for file manager extensions like this, but managers use their own custom folders, syntax, etc. for such extensions. I think pcmanfm adheres to the standard; Dolphin requires a .desktop file somewhere; Thunar, Caja, & Nemo work similar to Nautilus.)












  • wvstolzing@lemmy.mltoLinux@lemmy.mlIs anyone using awk?
    link
    fedilink
    arrow-up
    23
    arrow-down
    1
    ·
    9 months ago

    awk predates perl as well as python by a pretty large margin (1978); it’s useful, of course, for processing things in a pipeline, but as it became obsolete as a general-purpose scripting language, users have had less and less of a reason to learn its syntax in detail – so nowadays it shows up in one-liners where it could be replaced by a tiny bit of cut.

    I had worked through a good bit of the O’Reilly ‘sed & awk’ book – the first programming book I got, after being enticed by shell scripting in general. Once I learned a bit of Python, & got better at vim scripting, though, I started using it less and less; today I barely remember its syntax.