Using Shortkeys in linux (my everyday List)

If it doesn't relate to Debian, but you still want to share it, please do it here

Using Shortkeys in linux (my everyday List)

Postby bester69 » 2020-05-25 22:47

If you dont use shortkeys you dont use linux .. :o

- Ctrl+Shift + W ---> Open up, whatsapp Chrome
Code: Select all
#!/bin/bash
#
/opt/google/chrome/google-chrome --profile-directory=Default --app-id=bgkodfmeijboinjdegggmkbkjfiagaan &

- Ctrl+Shift + N --> Opens up Google Keep Notes
Code: Select all
#!/bin/bash
#
/opt/google/chrome/google-chrome --app-id=hmjkmjkepdijhoojdojkdfohbdgmmhki &
xdotool search --sync --onlyvisible --class "gcolor2" windowminimize &
sleep 1
gcolor2
sleep 1
WID=`xdotool search --name "Google Keep" | tail -n 1`
xdotool windowminimize $WID &
sleep 10
xdotool windowkill $WID &
sleep 2
ps aux|grep -i hmjkmjkepdijhoojdojkdfohbdgmmhk| awk {'print $2'} | xargs kill -9

- Ctrl+ Alt + C --> Opens up Google Chrome Calendar
Code: Select all
#!/bin/bash
#
/opt/google/chrome/google-chrome --app-id=magodclodecbbnbdfpmoehfdddkhlfmm &
 xdotool search --sync --onlyvisible --class "gcolor2" windowminimize &
 sleep 1
  gcolor2
 WID=`xdotool search --name "Clean Google Calendar" | tail -n 1`
 xdotool windowminimize $WID &
 WID=`xdotool search --name "Clean Google Calendar" | tail -n 1`
 xdotool windowkill $WID &
 sleep 2
ps aux|grep -i magodclodecbbnbdfpmoehfdddkhlfmm| awk {'print $2'} | xargs kill -9

- Ctrl+ Alt+ T --> Konsole
- Ctrl+ Shift+ D --> Dolphin Explorer
- Ctrl+ Shift+ K--> Kmail
- Ctrl+ Shift+ P--> PassX (password manager)
- Ctrl+ Shift+ R--> Recoll (Search indexing manager)
- Ctrl+ Shift+ Q--> QMplay2
- Ctrl+ Shift+ G--> smplayer
- Ctrl+ Alt+ G--> Gradio
Code: Select all
#!/bin/bash
#
radiopathback="$HOME/LINUXDEBS/config/de.haeckerfelix.gradio"
radiopath="$HOME/.var/app/de.haeckerfelix.gradio"
mkdir -p "$radiopathback"
if [ ! -z $1 ]
then
    killall gradio
    rsync -av --delete "$radiopath/" "$radiopathback/"
    exit
fi
flatpak run de.haeckerfelix.gradio &> /dev/null
sleep 2
rsync -av --delete "$radiopath/" "$radiopathback/"

- Ctrl+ Shift+ L--> lock desktop
- Ctrl+ Shift+ B --> Opens Cantata (mpd client music)
- Ctrl+ Shift+ 6 --> Play/pause toggle Cantata
- Ctrl+ Shift+ 7 --> Play Next track Cantata
- Ctrl+ Shift+ 5 --> Play Random track Cantata
- Ctrl+ Shift+ A --> Opens Cherrytree journal bbdd
- Ctrl+ Shift+ S --> Opera V7 Bookmarks (Extension)
- Ctrl+ Shift+ F --> Open CopyQ clipboard manager
- Ctrl+ Shift+ H --> Open Mate-system-monitor

- F12 --> Shutter Capture script
- Ctrl +Alt + F --> Faststone capture (wine)
- Ctrl + Mayus + X --> killall konsoles, okular, smplayer, nomacs
- Ctrl + Mayus + L --> LibreOffice

- Ctrl+ Shift + Left --> Window Active Snap left and 50% resize
Code: Select all
#!/bin/sh
wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz &
WIDTH=`xdpyinfo | grep 'dimensions:' | cut -f 2 -d ':' | cut -f 1 -d 'x'` && HALF=$(($WIDTH/2)) && wmctrl -r :ACTIVE: -b add,maximized_vert && wmctrl -r :ACTIVE: -e 0,0,0,$HALF,-1
#Barra arriba WIDTH=`xdpyinfo | grep 'dimensions:' | cut -f 2 -d ':' | cut -f 1 -d 'x'` && HALF=$(($WIDTH/2)) && wmctrl -r :ACTIVE: -b add,maximized_vert && wmctrl -r :ACTIVE: -e 0,0,32,$HALF,-1
wmctrl -r :ACTIVE: -b add,maximized_vert

- Ctrl+ Shift + Right --> Window Active Snap right and 50% resize
Code: Select all
#!/bin/sh
wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz &
#barra arriba WIDTH=`xdpyinfo | grep 'dimensions:' | cut -f 2 -d ':' | cut -f 1 -d 'x'` && HALF=$(($WIDTH/2)) && wmctrl -r :ACTIVE: -b add,maximized_vert && wmctrl -r :ACTIVE: -e 0,$HALF,32,$HALF,-1
WIDTH=`xdpyinfo | grep 'dimensions:' | cut -f 2 -d ':' | cut -f 1 -d 'x'` && HALF=$(($WIDTH/2)) && wmctrl -r :ACTIVE: -b add,maximized_vert && wmctrl -r :ACTIVE: -e 0,$HALF,0,$HALF,-1
wmctrl -r :ACTIVE: -b add,maximized_vert

- Ctrl+ Shift + Up --> Window Active Maximize
Code: Select all
#!/bin/sh
wmctrl -r :ACTIVE: -b add,maximized_vert,maximized_horz

- Ctrl+ Shift + Down --> Window Active restore
Code: Select all
#!/bin/sh
wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz

- Ctrl+ Shift + ; --> Window Active Snap left and 75% resize
Code: Select all
#!/bin/sh
wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz &
WIDTH=`xdpyinfo | grep 'dimensions:' | cut -f 2 -d ':' | cut -f 1 -d 'x'` && HALF=$(($WIDTH/2)) && wmctrl -r :ACTIVE: -b add,maximized_vert && wmctrl -r :ACTIVE: -e 0,0,0,$(($HALF*4/3)),-1
#Barra arriba WIDTH=`xdpyinfo | grep 'dimensions:' | cut -f 2 -d ':' | cut -f 1 -d 'x'` && HALF=$(($WIDTH/2)) && wmctrl -r :ACTIVE: -b add,maximized_vert && wmctrl -r :ACTIVE: -e 0,0,32,$(($HALF*4/3)),-1
wmctrl -r :ACTIVE: -b add,maximized_vert

- Ctrl+ Shift + : --> Window Active Snap right and 75% resize
Code: Select all
#!/bin/sh
wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz &
WIDTH=`xdpyinfo | grep 'dimensions:' | cut -f 2 -d ':' | cut -f 1 -d 'x'` && HALF=$(($WIDTH/2)) && wmctrl -r :ACTIVE: -b add,maximized_vert && wmctrl -r :ACTIVE: -e 0,$(($HALF*2/3)),0,$(($HALF*4/3)),-1
#Barra arriba WIDTH=`xdpyinfo | grep 'dimensions:' | cut -f 2 -d ':' | cut -f 1 -d 'x'` && HALF=$(($WIDTH/2)) && wmctrl -r :ACTIVE: -b add,maximized_vert && wmctrl -r :ACTIVE: -e 0,$(($HALF*2/3)),32,$(($HALF*4/3)),-1
wmctrl -r :ACTIVE: -b add,maximized_vert




And, thats all for now, I know and use all of them by memory :o
Last edited by bester69 on 2020-05-26 00:24, edited 2 times in total.
bester69 wrote:You wont change my mind when I know Im right, Im not an ...
User avatar
bester69
 
Posts: 1638
Joined: 2015-04-02 13:15

Re: Using Shortkeys in linux (my everyday List)

Postby cuckooflew » 2020-05-25 23:53

Wow, I am truely impressed, you must be proud of your self.
But ,
If you dont use shortkeys you dont use linux .
I don't use them my self, and I am using Debian, is Debian not Linux ?
Please Read What we expect you have already Done
Google knows a lot,
God, our Father knows all, maybe ask Him ,
…one flew east, one flew west,
One flew over the cuckoo’s nest.

I am not the right colour, so my life does not matter ?
to God it does :)
cuckooflew
 
Posts: 434
Joined: 2018-05-10 19:34
Location: Some where out west

Re: Using Shortkeys in linux (my everyday List)

Postby bester69 » 2020-05-26 00:30

. :)
Last edited by bester69 on 2020-05-26 04:51, edited 1 time in total.
bester69 wrote:You wont change my mind when I know Im right, Im not an ...
User avatar
bester69
 
Posts: 1638
Joined: 2015-04-02 13:15

Re: Using Shortkeys in linux (my everyday List)

Postby RU55EL » 2020-05-26 01:28

bester69 wrote:If you dont use shortkeys you dont use linux .. :o


I would venture to say: If you don't use the command line, you don't effectively use Debian. Of course, there are short cut keys for the command line

I use the default shortcut keys. Which cover just about everything that I like to use. Granted, I can think of a couple that I wouldn't mind adding. But, I have never taken the time to create bash scripts to do so. I just set them up in GNOME settings, under devices: keyboard: shortcuts.

Edited to correct grammar.
User avatar
RU55EL
 
Posts: 449
Joined: 2014-04-07 03:42
Location: /home/russel

Re: Using Shortkeys in linux (my everyday List)

Postby None1975 » 2020-05-26 11:30

bester69 wrote:If you dont use shortkeys you dont use linux .. :o


And I can paraphrase this phrase:
If you dont use tiling wm you dont use linux
OS: Debian 10.3 Buster / WM: xmonad
Debian Wiki | DontBreakDebian, My config files on github
User avatar
None1975
 
Posts: 1019
Joined: 2015-11-29 18:23
Location: Lithuania, Vilnius

Re: Using Shortkeys in linux (my everyday List)

Postby sunrat » 2020-05-26 12:19

My boot manager says "Debian" and I use it but don't set custom shortcut keys. Does that mean Debian is not Linux any more?
It's an interesting exercise and satisfying to get little scripts like that to work. But say it took 2 hours to set up those keys and they save 3 seconds over using the menu or whatever, that's 7,200 seconds so you'd need to use them 7,200/3 or 2,400 times before you are ahead.
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!
User avatar
sunrat
 
Posts: 3088
Joined: 2006-08-29 09:12
Location: Melbourne, Australia

Re: Using Shortkeys in linux (my everyday List)

Postby Head_on_a_Stick » 2020-05-26 17:53

bester69 wrote:
Code: Select all
ps aux|grep -i hmjkmjkepdijhoojdojkdfohbdgmmhk| awk {'print $2'} | xargs kill -9

Shorter version:
Code: Select all
pkill hmjkmjkepdijhoojdojkdfohbdgmmhk

And none of your "scripts" need a bash shebang, !#/bin/sh is quite sufficient.
Black Lives Matter

Debian buster-backports ISO image: for new hardware support
User avatar
Head_on_a_Stick
 
Posts: 12194
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Using Shortkeys in linux (my everyday List)

Postby bester69 » 2020-05-26 21:34

Head_on_a_Stick wrote:
bester69 wrote:
Code: Select all
ps aux|grep -i hmjkmjkepdijhoojdojkdfohbdgmmhk| awk {'print $2'} | xargs kill -9

Shorter version:
Code: Select all
pkill hmjkmjkepdijhoojdojkdfohbdgmmhk

And none of your "scripts" need a bash shebang, !#/bin/sh is quite sufficient.

heheh , at my 39yo im too old for changing myself
bester69 wrote:You wont change my mind when I know Im right, Im not an ...
User avatar
bester69
 
Posts: 1638
Joined: 2015-04-02 13:15

Re: Using Shortkeys in linux (my everyday List)

Postby pendrachken » 2020-05-28 20:08

Head_on_a_Stick wrote:
bester69 wrote:
Code: Select all
ps aux|grep -i hmjkmjkepdijhoojdojkdfohbdgmmhk| awk {'print $2'} | xargs kill -9

Shorter version:
Code: Select all
pkill hmjkmjkepdijhoojdojkdfohbdgmmhk

And none of your "scripts" need a bash shebang, !#/bin/sh is quite sufficient.


No. NO. That is sloppy script writing. PERIOD. Never assume the shell you want is going to be executed, always specify the specific shell and environment you want. I don't care if you are only running one command, or if you are writing a complicated script with logic gates and tests. It's sloppy and a horrible habit to get into.

The way you want him to do it by linking /bin/sh is WRONG. "sh" can be linked to any shell, and won't necessarily follow bashisms properly. By linking to "sh" and writing in bash you are relying on the linked shell to both have bash compatibility, and be exactly analogous in behavior to bash. Most times it is true, but "most" only counts in proprietary consumer OS's and shitty software that is unsupported by the releasers. It is always best practices to specify the shell you are writing for, not assume that everyone is going to be using the same shell, or have /bin/sh linked to /bin/bash ( as it is linked to /bin/dash in Debian, and dash only MOSTLY supports bashisms ).

By calling /bin/bash explicitly you are going to get either one of two outcomes consistently - 1: your script executes the same way every time, on all machines, no matter what the default shell is or 2: you get an error about not having bash installed.
fortune -o
Your love life will be... interesting.
:twisted: How did it know?

The U.S. uses the metric system too, we have tenths, hundredths and thousandths of inches :-P
pendrachken
 
Posts: 1374
Joined: 2007-03-04 21:10
Location: U.S.A. - WI.

Re: Using Shortkeys in linux (my everyday List)

Postby Head_on_a_Stick » 2020-05-28 20:44

pendrachken wrote:"sh" can be linked to any shell, and won't necessarily follow bashisms properly.

Perhaps try reading the OP's "scripts"? None of them use bashisms...

And /bin/sh is strictly defined by the POSIX specification so using that shebang and following the specification will result in truly portable utilities.
Black Lives Matter

Debian buster-backports ISO image: for new hardware support
User avatar
Head_on_a_Stick
 
Posts: 12194
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Using Shortkeys in linux (my everyday List)

Postby pendrachken » 2020-05-29 02:22

Yes, actually I have. It's still bad practices to assume, even if it will work 99% of the time.

There is at least one script there that will not execute if the user defaults to linking /bin/sh to CSH. The if:then statements are different, and the test is written differently, with different braces.

The likelihood of that isn't ZERO, so it is bad practices. Even relying on zsh's bash compatibility isn't something I would recommend, unless you want to trace down obscure bugs that can be introduced.
fortune -o
Your love life will be... interesting.
:twisted: How did it know?

The U.S. uses the metric system too, we have tenths, hundredths and thousandths of inches :-P
pendrachken
 
Posts: 1374
Joined: 2007-03-04 21:10
Location: U.S.A. - WI.

Re: Using Shortkeys in linux (my everyday List)

Postby Head_on_a_Stick » 2020-05-29 15:56

pendrachken wrote:There is at least one script there that will not execute if the user defaults to linking /bin/sh to CSH. The if:then statements are different, and the test is written differently, with different braces.

Only an idiot would symlink /bin/sh to csh, it's not even a Bourne shell. See also http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/

As I explained above /bin/sh has a very clear specification and so will always operate in the same way. This is in contrast to bash, the behaviour of which changes from one release to the next — for example, if a bash script is written using bashisms from version 5 then it might not work at all on Mac OS X, which runs version 3.

And if you think using a /bin/sh shebang is such a bad idea then why do all of Debian's system scripts use it?
Black Lives Matter

Debian buster-backports ISO image: for new hardware support
User avatar
Head_on_a_Stick
 
Posts: 12194
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Using Shortkeys in linux (my everyday List)

Postby pendrachken » 2020-06-05 14:10

1: I don't care what shell anyone links /bin/sh to. There are people out there that do strange shit, and break things in strange ways. Especially embedded devs. It's not impossible, as I've said, even if it is unlikely.


And if you think using a /bin/sh shebang is such a bad idea then why do all of Debian's system scripts use it?


Nice appeal to authority fallacy you got there.

But the obvious answer is because they aren't following best practices, even if they are specifically writing for their own platform.
fortune -o
Your love life will be... interesting.
:twisted: How did it know?

The U.S. uses the metric system too, we have tenths, hundredths and thousandths of inches :-P
pendrachken
 
Posts: 1374
Joined: 2007-03-04 21:10
Location: U.S.A. - WI.

Re: Using Shortkeys in linux (my everyday List)

Postby Head_on_a_Stick » 2020-06-05 16:15

pendrachken wrote:because they aren't following best practices

Best practice would be to avoid bash like the plague — it's a buggy, bloated mess of a shell.

But anyway I'm sure you know better than those silly Debian developers... :roll:
Black Lives Matter

Debian buster-backports ISO image: for new hardware support
User avatar
Head_on_a_Stick
 
Posts: 12194
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Using Shortkeys in linux (my everyday List)

Postby LE_746F6D617A7A69 » 2020-06-05 19:33

Head_on_a_Stick wrote:As I explained above /bin/sh has a very clear specification and so will always operate in the same way. This is in contrast to bash, the behaviour of which changes from one release to the next — for example, if a bash script is written using bashisms from version 5 then it might not work at all on Mac OS X, which runs version 3.

I disagree - ksh and many other shells are mostly dead projects (f.e. the last commit in ksh was in 2012, and it's not actively developed since that time), so the set of functionalities, features and bugs is the same for every platform that uses it - this has nothing to do with "clear specification"

Bash on the other hand is actively developed (last commit was on 2020.04.24) - and it is obvious that new features will not be supported on older versions - so, just like in case of python or gcc, every OS which is actively maintained should use the latest official stable versions.
I don't know what version of Bash is available on OSX - if it's really v3.x, then it means that OSX simply doesn't officially support this shell.

If "bashisms" means using bash-specific features, then we have also "dashisms" and "kashisms" for ksh - all those shells have specific features or parameters which are breaking portability of scripts.

Head_on_a_Stick wrote:Best practice would be to avoid bash like the plague — it's a buggy, bloated mess of a shell.

Again, I disagree with Your claim - I'm using Bash for running quite complex scripts, and I haven't found any bugs - if You can prove Your claim, You should file a bug report.

pendrachken wrote:But the obvious answer is because they aren't following best practices, even if they are specifically writing for their own platform.

"Best practices" means different things, depending on who's using that term.

Regards
Bill Gates: "(...) In my case, I went to the garbage cans at the Computer Science Center and I fished out listings of their operating system."
The_full_story and Nothing_have_changed
LE_746F6D617A7A69
 
Posts: 184
Joined: 2020-05-03 14:16

Next

Return to Offtopic

Who is online

Users browsing this forum: No registered users and 8 guests

fashionable