You are not logged in.

#126 2020-07-16 20:38:58

misko_2083
Member
Registered: 2016-05-24
Posts: 371

Re: Handy command-line stuff for terminals or scripts

Found a fancy bash menu
https://askubuntu.com/questions/1705/ho … ell-script
But it had issued that I fixed. Entering any three keys activated menu.
Used it to wrapp desktopify
Mostly out of boredom.
https://i.imgur.com/ufX0v8p.gif

#!/bin/bash

# Wrapper for desktopify Misko_2083
# Menu code adapted from https://askubuntu.com/questions/1705/how-can-i-create-a-select-menu-in-a-shell-script
# Run from the same dir as desktopify


      E='echo -e';e='echo -en';trap "R;exit" 2
    ESC=$( $e "\e")
   TPUT(){ $e "\e[${1};${2}H" ;}
  CLEAR(){ $e "\ec";}
  CIVIS(){ $e "\e[?25l";}
   MARK(){ $e "\e[7m";}
 UNMARK(){ $e "\e[27m";}
cursor_blink_on()   { printf "$ESC[?25h"; }
cursor_blink_off()  { printf "$ESC[?25l"; }
      R(){ CLEAR ;stty sane;CLEAR;};
   HEAD(){ for each in $(seq 1 15);do
           $E "   \xE2\x94\x82                                          \xE2\x94\x82"
           done
           MARK;TPUT 1 5
           $E "              DESKTOPIFY                  " ;UNMARK;
           TPUT 2 5
           $E "      SELECT A DESKTOP ENVIRONMENT        " ;}
HEAD_II(){ for each in $(seq 1 15);do
           $E "   \xE2\x94\x82                                          \xE2\x94\x82"
           done
           MARK;TPUT 1 5
           $E "              DESKTOPIFY                  " ;UNMARK;
           TPUT 2 5
           $E "        SELECT ADDITIONAL OPTIONS         " ;
           TPUT 4 10
           $E "  Desktop Environment $1" ;}
           i=0; CLEAR; CIVIS;
   FOOT(){ MARK;TPUT 15 5
           $E " UP \xE2\x86\x91 \xE2\x86\x93 DOWN \xE2\x94\x82 \xe2\x86\xb5 ENTER - NEXT \xE2\x94\x82 EXIT - X  ";UNMARK;}
FOOT_II(){ MARK;TPUT 14 5
           $E "     \xe2\x86\x90  BACK \xE2\x94\x82 SPACE - SELECT \xE2\x94\x82           ";
           TPUT 15 5
           $E " UP \xE2\x86\x91 \xE2\x86\x93 DOWN \xE2\x94\x82 \xe2\x86\xb5 ENTER - NEXT \xE2\x94\x82 EXIT - X  ";UNMARK;}
  ARROW(){ IFS= read -s -n1 key 2>/dev/null >&2
           if [[ $key = $ESC ]];then 
              read -s -n2 key 2>/dev/null >&2;
              if [[ $key = \[A ]]; then echo up;fi
              if [[ $key = \[B ]]; then echo dn;fi
           fi
           if [[  $key  = [xX]   ]]; then echo exit;fi;
           if [[ "$key" = ""     ]];then echo enter;fi;}
     M0(){ TPUT  4 20; $e "Lubuntu";}
     M1(){ TPUT  5 20; $e "Kubuntu";}
     M2(){ TPUT  6 20; $e "Ubuntu";}
     M3(){ TPUT  7 20; $e "Ubuntu-Budgie";}
     M4(){ TPUT  8 20; $e "Ubuntu-Kylin";}
     M5(){ TPUT  9 20; $e "Ubuntu-Mate";}
     M6(){ TPUT 10 20; $e "Ubuntu-Studio";}
     M7(){ TPUT 11 20; $e "Xubuntu";}
     M8(){ TPUT 12 20; $e "EXIT   ";}
      LM=8
   MENU(){ for each in $(seq 0 $LM);do M${each};done;}
    POS(){ if [[ $cur == up ]];then ((i--));fi
           if [[ $cur == dn ]];then ((i++));fi
           if [[ $i -lt 0   ]];then i=$LM;fi
           if [[ $i -gt $LM ]];then i=0;fi;}
REFRESH(){ after=$((i+1)); before=$((i-1))
           if [[ $before -lt 0  ]];then before=$LM;fi
           if [[ $after -gt $LM ]];then after=0;fi
           if [[ $j -lt $i      ]];then UNMARK;M$before;else UNMARK;M$after;fi
           if [[ $after -eq 0 ]] || [ $before -eq $LM ];then
           UNMARK; M$before; M$after;fi;j=$i;UNMARK;M$before;M$after;}
   INIT(){ R;HEAD;FOOT;MENU;}
     SC(){ REFRESH;MARK;$S;$b;cur=`ARROW`;}
     ES(){ INIT;};INIT
    MSEL() { cursor_blink_on()   { printf "$ESC[?25h"; }
             cursor_blink_off()  { printf "$ESC[?25l"; }
             cursor_to()         { printf "$ESC[$1;${2:-1}H"; }
             print_inactive()    { printf "$2  $1 "; }
             print_active()      { printf "$2  $ESC[7m$1 $ESC[27m"; }
             get_cursor_row()    { IFS=';' read -sdR -p $'\E[6n' ROW COL; echo ${ROW#*[}; }
             key_input()         {
             local key
             IFS= read -rsn1 key 2>/dev/null >&2
             if [[ $key = ""      ]]; then echo enter; fi;
             if [[ $key = [xX]    ]]; then echo exit;  fi;
             if [[ $key = $'\x20' ]]; then echo space; fi;
             if [[ $key = $'\x1b' ]]; then
               read -rsn2 key
               if [[ $key = [A ]]; then echo up;    fi;
               if [[ $key = [B ]]; then echo down;  fi;
               if [[ $key = [D ]]; then echo back;  fi;
             fi;}
             toggle_option()    {
               local arr_name=$1
               eval "local arr=(\"\${${arr_name}[@]}\")"
               local option=$2
               if [[ ${arr[option]} == true ]]; then
                 arr[option]=
               else
                 arr[option]=true
               fi
               eval $arr_name='("${arr[@]}")';}

            local retval=$1
            local options
            local defaults

            IFS=';' read -r -a options <<< "$2"
            if [[ -z $3 ]]; then
              defaults=()
            else
              IFS=';' read -r -a defaults <<< "$3"
            fi
            local selected=()

           for ((i=0; i<${#options[@]}; i++)); do
             selected+=("${defaults[i]}")
             printf "\n"
           done

           # determine current screen position for overwriting the options
           local lastrow=`get_cursor_row`
           local startrow=$(($lastrow - ${#options[@]}))

           # ensure cursor and input echoing back on upon a ctrl+c during read -s
           trap "cursor_blink_on; stty echo; printf '\n'; exit" 2
           cursor_blink_off
           local active=0
           while true; do
             # print options by overwriting the last lines
             local idx=0
             for option in "${options[@]}"; do
               local prefix="[ ]"
               if [[ ${selected[idx]} == true ]]; then
                 prefix="[x]"
               fi

               cursor_to $(($startrow + $idx))
               if [ $idx -eq $active ]; then
                 if [ $option == OEM ]; then
                    TPUT  $((idx+6)) 6
                    print_active "$option" "$prefix"
                    TPUT $((idx+7)) 11
                    $e "Run a setup wizard on the next boot"
                 elif [ $option == FORCE ]; then
                    TPUT  $((idx+8)) 6
                    print_active "$option" "$prefix"
                    TPUT $((idx+9)) 11
                    $e "Force desktop package install"
                 fi
               else
                 if [ $option == OEM ]; then
                    TPUT  $((idx+6)) 6
                    print_inactive "$option" "$prefix"
                    TPUT $((idx+7)) 11
                    $e "Run a setup wizard on the next boot"
                 elif [ $option == FORCE ]; then
                    TPUT  $((idx+8)) 6
                    print_inactive "$option" "$prefix"
                    TPUT $((idx+9)) 11
                    $e "Force desktop package install"
                 fi
               fi
               ((idx++))
             done

            # user key control
            case `key_input` in
              space)  toggle_option selected $active;;
              enter)  break;;
                 up)  ((active--));
                      if [ $active -lt 0 ]; then active=$((${#options[@]} - 1)); fi;;
               down)  ((active++));
                      if [ $active -ge ${#options[@]} ]; then active=0; fi;;
               back)  CLEAR; exec $0;;
               exit)  CLEAR;exit 0;;
            esac
           done

           # cursor position back to normal
           cursor_to $lastrow
           printf "\n"
           cursor_blink_on
           eval $retval='("${selected[@]}")'
       }

  RUN(){
         if [[ $cur != back ]];then 
          R;HEAD_II "$1"
          FOOT_II;
           
          MSEL result "OEM;FORCE" "false;;false"
          CLEAR
          ARG=
          if [[ ${result[0]} == true ]]; then
            ARG="--oem"
          fi
          if [[ ${result[1]} == true ]]; then
            ARG="$ARG --force"
          fi

          $E "sudo desktopify $ARG --de $1"
          sudo ./desktopify --de $1 $ARG

          break
         fi
       }

  # ensure cursor and input echoing back on upon a ctrl+c during read -s
  trap "cursor_blink_on; stty echo; printf '\n'; exit" 2
  cursor_blink_off
  while [[ "$O" != " " ]] && [[ $cur != exit ]]; do case $i in
        0) S=M0;SC;if [[ $cur == enter ]];then RUN lubuntu; fi;;
        1) S=M1;SC;if [[ $cur == enter ]];then RUN kubuntu; fi;;
        2) S=M2;SC;if [[ $cur == enter ]];then RUN ubuntu; fi;;
        3) S=M3;SC;if [[ $cur == enter ]];then RUN ubuntu-budgie; fi;;
        4) S=M4;SC;if [[ $cur == enter ]];then RUN ubuntu-kylin; fi;;
        5) S=M5;SC;if [[ $cur == enter ]];then RUN ubuntu-mate; fi;;
        6) S=M6;SC;if [[ $cur == enter ]];then RUN ubuntu-studio; fi;;
        7) S=M7;SC;if [[ $cur == enter ]];then RUN xubuntu; fi;;
        8) S=M8;SC;if [[ $cur == enter ]];then R;exit 0;fi;;
 esac;POS;done

 CLEAR
 cursor_blink_on

It runs "sudo ./desktopify --de lubuntu --oem --force" if all the options are selected.
If you want to try out comment out that line.
Wouldn't it be cool if bunsen-welcome used something like this?


Што ни оштровиди ум сагледати не може - љубав превазилази.

Offline

#127 2020-07-16 22:54:11

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 7,286
Website

Re: Handy command-line stuff for terminals or scripts

^bookmarked.
Thanks!


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), idle Twitterings and GitStuff )

Introduction to the Bunsenlabs Lithium Desktop

Offline

#128 2020-07-17 07:56:43

ohnonot
...again
Registered: 2015-09-29
Posts: 4,875
Website

Re: Handy command-line stuff for terminals or scripts

brontosaurusrex wrote:

You can crf and see what's the average bitrate and then do the same with 2pass, the quality diff should be small or null.

I now seem to remember reading a blog post that recommended exactly that, but it didn't work for me - using the obtained values gave no reduction in file size.
I suspect that's because I re-encoded already compressed video; using (gigantic) raw video files, this might work better.

So there's a difference between re-encoding sub-optimal input material, and compress-encoding raw material for the first time.

My biggest deciding factor was reduction of file size, while minimizing visible quality loss.
Most use cases are probably the other way round: biggest factor is avoiding visible quality loss, while minimizing file size.

Last edited by ohnonot (2020-07-17 07:57:38)


BL quote proposals to this thread please.
how to ask smart questions | my repos / my repos | my blog
---
Thank you for posting direct image links!

Offline

#129 2020-07-19 18:00:38

misko_2083
Member
Registered: 2016-05-24
Posts: 371

Re: Handy command-line stuff for terminals or scripts

ohnonot wrote:

My biggest deciding factor was reduction of file size, while minimizing visible quality loss.
Most use cases are probably the other way round: biggest factor is avoiding visible quality loss, while minimizing file size.

To reduce the file size, while minimising visible quality loss or to minimize the visible quality loss while reducing file size...It is all the same to me. It takes a trained professional to spot that subtle difference between a YouTuber and a spy both making video compression plans before the travel to the far away lands. :-)


Што ни оштровиди ум сагледати не може - љубав превазилази.

Offline

#130 2020-07-22 10:36:22

ohnonot
...again
Registered: 2015-09-29
Posts: 4,875
Website

Re: Handy command-line stuff for terminals or scripts

alias itisdone='espeak "It is Done!" >/dev/null 2>&1'

Quite often I perform a time-intensive task and want to know when it's finished. Instead of typing the espeak command out every time, I made it an alias.

Example:

sudo dd if=/fantastic/new/BL.iso of=/dev/sdX bs=4M; sync; itisdone

BL quote proposals to this thread please.
how to ask smart questions | my repos / my repos | my blog
---
Thank you for posting direct image links!

Offline

#131 2020-07-22 12:53:14

damo
....moderator....
Registered: 2015-08-20
Posts: 6,261

Re: Handy command-line stuff for terminals or scripts

^ Ingenious smile  I do a similar thing using a desktop notification.


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Online

#132 2020-07-22 15:30:16

ohnonot
...again
Registered: 2015-09-29
Posts: 4,875
Website

Re: Handy command-line stuff for terminals or scripts

^ Not enough when I'm in the kitchen!


BL quote proposals to this thread please.
how to ask smart questions | my repos / my repos | my blog
---
Thank you for posting direct image links!

Offline

#133 2020-07-22 17:42:54

Sector11
Conky 1.9er Mod Squid
From: Upstairs
Registered: 2015-08-20
Posts: 6,393

Re: Handy command-line stuff for terminals or scripts

I would not hear it in the kitchen, computer is upstairs.

But something similar to my little (?) backup script using rsync

The ending:

echo "    Syncing /media/11/"
echo "      to /media/sector11/disk/M11/"
 rsync -avh --progress --delete --delete-excluded --exclude-from '/home/sector11/bin/rsync_m11_exclude.txt' /media/11/ /media/sector11/disk/M11 > "/home/sector11/.s11bk-logs/M11_$(date +%Y·%m·%d·%H·%M·%S).txt"


sleep 10s &&
echo ""
echo "1. Syncing Complete"
read -p "2. Unmount /media/sector11/disk? (Y|n) " yn
case $yn in
[Yy]* )  ;;
[Nn]* ) echo "    /media/sector11/disk still mounted" && exit;;
esac
echo "    Unmounting /media/sector11/disk,"
umount /media/sector11/disk/
echo "    wait until the blue light"
echo "    stops flashing and the terminal prompt"
sleep 5s &&
echo " To remove a directory"
echo " use r m command: -f -r /media/sector11/disk/S11-MONTH"
echo " "
exit

IF I go to the kitchen, it's waiting for me when I get back.  big_smile

Not originally my idea; adopted and tweaked from other sources.
2020-07-22-143901-S11.jpg


The sun will never set if you keep walking towards it. - my son
Being positive doesn't understand physics.
_______________________________
Debian 10 Buster = SharpBang ♯!

Offline

#134 2020-07-23 02:14:41

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 7,286
Website

Re: Handy command-line stuff for terminals or scripts

I think audio reminders (eg with espeak) are cool. They seem to reach the brain over a different channel, so - for me anyway - they're less distracting than visual popups but the message still gets through.


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), idle Twitterings and GitStuff )

Introduction to the Bunsenlabs Lithium Desktop

Offline

#135 2020-07-23 06:17:46

ohnonot
...again
Registered: 2015-09-29
Posts: 4,875
Website

Re: Handy command-line stuff for terminals or scripts

^ True. I often find myself having dismissed a notification without it having reached my brain.
Like when xfce4-power-manager tells me that my battery is low. Why can't it be set to urgency=critical at least?


BL quote proposals to this thread please.
how to ask smart questions | my repos / my repos | my blog
---
Thank you for posting direct image links!

Offline

#136 2020-07-23 06:24:29

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 7,286
Website

Re: Handy command-line stuff for terminals or scripts

^I can't remember ever having got a low-battery warning in time to do anything useful before the laptop shut itself down. neutral


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), idle Twitterings and GitStuff )

Introduction to the Bunsenlabs Lithium Desktop

Offline

#137 2020-07-23 13:44:10

Sector11
Conky 1.9er Mod Squid
From: Upstairs
Registered: 2015-08-20
Posts: 6,393

Re: Handy command-line stuff for terminals or scripts

No laptop - no battery warning.

Mine just sits in the terminal.
Come back from the kitchen with my coffee, and read it.


The sun will never set if you keep walking towards it. - my son
Being positive doesn't understand physics.
_______________________________
Debian 10 Buster = SharpBang ♯!

Offline

#138 2020-07-25 11:09:04

ohnonot
...again
Registered: 2015-09-29
Posts: 4,875
Website

Re: Handy command-line stuff for terminals or scripts

Not sure it's "handy", but I found it interesting:

sudo dd if=/dev/mem bs=2048 count=1000 | strings -16

will show you what interesting strings are in your memory (first 2MB if my calculations are correct).
The first 5 lines on mine:

Missing operating system.
Multiple active partitions.
Operating system load error.
IBM VGA Compatible BIOS.
For Evaluation Use Only.

Evaluation use only? Weird.
After that it starts getting device specific.

From this article: Understanding the /dev directory


BL quote proposals to this thread please.
how to ask smart questions | my repos / my repos | my blog
---
Thank you for posting direct image links!

Offline

#139 2020-07-26 06:46:22

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 7,286
Website

Re: Handy command-line stuff for terminals or scripts

^That's fun. This worked too:

sudo strings -16 /dev/mem | less
00IBM VGA Compatible BIOS. 
For Evaluation Use Only.
$VBT HASWELL        d
BIOS_DATA_BLOCK 
2180Intel(R) HSW Mobile/Desktop PCI Accelerated SVGA BIOS
DECOMPILATION OR DISASSEMBLY PROHIBITED
Copyright (C) 2000-2011 Intel Corp. All Rights Reserved.

Again that odd evaluation comment. XdcAYOB.gif


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), idle Twitterings and GitStuff )

Introduction to the Bunsenlabs Lithium Desktop

Offline

#140 2020-07-26 09:19:50

ohnonot
...again
Registered: 2015-09-29
Posts: 4,875
Website

Re: Handy command-line stuff for terminals or scripts

johnraff wrote:

Again that odd evaluation comment.

I think the BIOS (?) stores all possible strings it can display on screen, even if it doesn't apply to the current situation. Seems oddly wasteful to me, but what's a few bytes to a few GB... Also they hardcoded the dot at the end of each sentence glasses
BTW, the -16 option just filters out shorter (and usually not representing human words) strings. Change or remove that option, there's much more.


BL quote proposals to this thread please.
how to ask smart questions | my repos / my repos | my blog
---
Thank you for posting direct image links!

Offline

#141 2020-07-26 09:48:08

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 7,286
Website

Re: Handy command-line stuff for terminals or scripts

^Yeh I checked 'man strings'. I've used it often before, but never with any options.


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), idle Twitterings and GitStuff )

Introduction to the Bunsenlabs Lithium Desktop

Offline

#142 2020-07-26 12:47:56

Sector11
Conky 1.9er Mod Squid
From: Upstairs
Registered: 2015-08-20
Posts: 6,393

Re: Handy command-line stuff for terminals or scripts

yes, taking the -16 out gets a LOT.

Interesting that I get no:

For Evaluation Use Only.

It must me an IBM thing:

 761295520
04/25/19,05:49:18
113-PICASSO-115
RAVEN
PCI_EXPRESS
PICASSO Generic VBIOS                                                       
(C) 1988-2010, Advanced Micro Devices, Inc.
ATOMBIOSBK-AMD VER016.002.000.010.000000
PicassoGener
17742501
457094  
        
AMD_PICASSO_GENERIC\config.h
ATOM
PCIR
AMD ATOMBIOS

The sun will never set if you keep walking towards it. - my son
Being positive doesn't understand physics.
_______________________________
Debian 10 Buster = SharpBang ♯!

Offline

#143 2020-09-03 11:02:18

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 2,095
Website

Re: Handy command-line stuff for terminals or scripts

Something to minimize.this.urxvt.window

alias hide="xdotool windowminimize $(xdotool getactivewindow)"

Last edited by brontosaurusrex (2020-09-03 11:02:31)

Offline

#144 2020-09-03 13:28:30

vasa1
Member
Registered: 2015-09-29
Posts: 187

Re: Handy command-line stuff for terminals or scripts

brontosaurusrex wrote:

Something to minimize.this.urxvt.window

alias hide="xdotool windowminimize $(xdotool getactivewindow)"

Why not just use your window manager's shortcut? Many, including Openbox, use `Alt+Spacebar, N`. Kwin uses `Alt+F3, N`.


Using the Openbox (3.5.2) session of Lubuntu 14.04 LTS but very interested in BL :)

Offline

#145 2020-09-03 16:46:29

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 2,095
Website

Re: Handy command-line stuff for terminals or scripts

In my case: I tend to mouse/tint2 to minimize, but urxvt windows have no decorations. And I have no memory that alt+i seems to be shortkey for minimize...., so an alternative I guess.^

Offline

#146 2020-09-05 07:26:01

ohnonot
...again
Registered: 2015-09-29
Posts: 4,875
Website

Re: Handy command-line stuff for terminals or scripts

^ try what vasa1 said: "Alt+Spacebar, N" - it should work without decorations, too. It's two keystrokes less than "hide<Enter>" big_smile


BL quote proposals to this thread please.
how to ask smart questions | my repos / my repos | my blog
---
Thank you for posting direct image links!

Offline

#147 2020-09-05 08:49:35

vasa1
Member
Registered: 2015-09-29
Posts: 187

Re: Handy command-line stuff for terminals or scripts

ohnonot wrote:

^ try what vasa1 said: "Alt+Spacebar, N" - it should work without decorations, too. It's two keystrokes less than "hide<Enter>" big_smile

Changing the alias to "hd", assuming "hd" is available, would get over that wink


Using the Openbox (3.5.2) session of Lubuntu 14.04 LTS but very interested in BL :)

Offline

#148 2020-09-12 05:35:19

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 7,286
Website

Re: Handy command-line stuff for terminals or scripts

When an executable you just put in ~/bin isn't being run.
Sometimes 'which' pretends it's there, but the system doesn't yet know about it. Maybe the old path (eg /usr/bin/file) is cached somewhere. Use 'hash' to refresh the path:

$ which myexec
/usr/bin/myexec
$ cp myexec ~/bin
$ chmod +x ~/bin/myexec
$ which myexec
/home/john/bin/myexec
### but it's a lie!
### /usr/bin/myexec is still being invoked
$ hash myexec
### now it works

...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), idle Twitterings and GitStuff )

Introduction to the Bunsenlabs Lithium Desktop

Offline

#149 2020-09-12 21:47:12

ohnonot
...again
Registered: 2015-09-29
Posts: 4,875
Website

Re: Handy command-line stuff for terminals or scripts

^ good to know!
I usually just close/open the terminal...


BL quote proposals to this thread please.
how to ask smart questions | my repos / my repos | my blog
---
Thank you for posting direct image links!

Offline

#150 2020-09-16 18:08:51

sleekmason
Member
Registered: 2018-05-22
Posts: 184

Re: Handy command-line stuff for terminals or scripts

A nice option to using root in menus and keybinds in Debian.

Create a script in /usr/local/bin that calls pkexec with env set.

cd /usr/local/bin

create the file:

sudo nano gksudo

Then add this:

pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY $@

Hit F2 and save.
Then make executable:

sudo chmod 755 gksudo

Basically this creates a link to pkexec with the env variables already in place, so using:

gksudo pcmanfm /home/sleekmason

will now work in a menu entry or keybind to open pcmanfm as root in my home folder. Replace program as desired and/or add cool options.  I have a few keybinds set for commonly used folders in /etc.

Last edited by sleekmason (2020-09-16 19:07:11)

Offline

Board footer

Powered by FluxBB