shortcut with multiple actions

Please post suggestions for improvement of Cinnamon on:
https://github.com/linuxmint/Cinnamon
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
timmi
Level 1
Level 1
Posts: 3
Joined: Mon May 29, 2023 4:17 pm

shortcut with multiple actions

Post by timmi »

Linux Mint Vera 21.1

After the typical 'falling asleep on the couch' situation, is there a way to have a shortcut that empties the browser cache and then shuts down the pc? So my sleepy head just has to aim for a single button that does all the magic instead of fiddling on the touchpad like I'm on 'Wetten Das'?

What I've tried :
- pushing the power button to hardcore shutdown the pc but then when firing it up again the next day the browser comes with 'recovery mode yes?'
- there'S shortcuts for showing the browser cache but then you still have to push manually the enter button to clear it, and then navigate to shut down the pc, which is still a bit of a hassle.

Thanks!
Last edited by LockBot on Wed Nov 29, 2023 11:00 pm, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
Termy
Level 12
Level 12
Posts: 4254
Joined: Mon Sep 04, 2017 8:49 pm
Location: UK
Contact:

Re: shortcut with multiple actions

Post by Termy »

The only thing which comes to mind is:

Code: Select all

#!/bin/sh

rm -r ~/.cache/mozilla/firefox
systemctl poweroff
Add the above to an empty file, make it executable, then assign the script to a keyboard shortcut. Just be sure you choose a suitable key, as I would expect it to immediately and without question power down the PC, once Firefox's cache is deleted. I'm assuming you're using Firefox and not Firefox ESR. Note that if you have multiple Firefox profiles, it will delete the cache for them all. This also assumes you haven't set the cache to be somewhere other than the default. If you don't want to go the keyboard shortcut route, you could keep it on the desktop so you can double-click it when needed.
I'm also Terminalforlife on GitHub.
User avatar
AZgl1800
Level 20
Level 20
Posts: 11146
Joined: Thu Dec 31, 2015 3:20 am
Location: Oklahoma where the wind comes Sweeping down the Plains
Contact:

Re: shortcut with multiple actions

Post by AZgl1800 »

firefox will let you do that

FF DATA.jpg
if you do that, you loose all passwords....
this not just the cache

Look under History,
Control-Shift-Delete erases all of your History, and it sounds like that is what you want?
LM21.3 Cinnamon ASUS FX705GM | Donate to Mint https://www.patreon.com/linux_mint
Image
User avatar
AZgl1800
Level 20
Level 20
Posts: 11146
Joined: Thu Dec 31, 2015 3:20 am
Location: Oklahoma where the wind comes Sweeping down the Plains
Contact:

Re: shortcut with multiple actions

Post by AZgl1800 »

I also use a Keyboard shortcut to shut the PC down

shutdown shortcut.jpg
so, 2 keystrokes will do what you want

Control-Shift-Delete erases FF history

and for me, Control-Alt-O will start the Shutdown process.

2 seconds or less and the PC is off
LM21.3 Cinnamon ASUS FX705GM | Donate to Mint https://www.patreon.com/linux_mint
Image
User avatar
lsemmens
Level 11
Level 11
Posts: 3936
Joined: Wed Sep 10, 2014 9:07 pm
Location: Rural South Australia

Re: shortcut with multiple actions

Post by lsemmens »

Are not most of those settings available as part of Firefox under the Privacy & Security Tab of Settings.?

The only time Firefox restores a "crashed" session is if I happen to close my computer down without shutting down Firefox first.
Fully mint Household
Out of my mind - please leave a message
motoryzen
Level 10
Level 10
Posts: 3443
Joined: Sun Dec 08, 2019 12:25 am

Re: shortcut with multiple actions

Post by motoryzen »

Code: Select all

#!/bin/sh

rm -r ~/.cache/mozilla/firefox
systemctl poweroff
I'm curious if adding an && at the end of the firefox line of that script file will accomplish the mission and guarantee the PC won't begin the power off process until that rm -r first line command has completed.

Code: Select all

#!/bin/sh

rm -r ~/.cache/mozilla/firefox &&
systemctl poweroff
*Scratches chin curiously*

Also there is the idea of turning that script into a gui launcher button on the cinnamon panel. *shrugs*

I always have a couple of separate Panel launchers on the right side of my cinnamon panel with spacers in between each panel set. One set for reboot * so just one launcher/item* and another set for ejecting my timeshift, ejected any /media/USB STICK, and a toggle eject button for my bluray burner drive.
Mint 21.2 Cinnamon 5.8.4
asrock x570 taichi ...bios p5.00
ryzen 5900x
128GB Kingston Fury @ 3600mhz
Corsair mp600 pro xt NVME ssd 4TB
three 4TB ssds
dual 1TB ssds
Two 16TB Toshiba hdd's
24GB amd 7900xtx vid card
Viewsonic Elite UHD 32" 144hz monitor
timmi
Level 1
Level 1
Posts: 3
Joined: Mon May 29, 2023 4:17 pm

Re: shortcut with multiple actions

Post by timmi »

Termy that seems to work like a charm, thanks so much! :)

I only need to direct to a different cache -using librewolf as a flatpak- but should work.

edit: Does anybody know how to empty librewolf flatpak history etc through terminal? I've tried to locate it but there'S heaps of locations which could be the cache. (I'm not a pro on these things)

Just a quick reply to the others, I know about the shortcuts etc, the thing was to bundle them into a one-button action, but thanks for the tips!
User avatar
Termy
Level 12
Level 12
Posts: 4254
Joined: Mon Sep 04, 2017 8:49 pm
Location: UK
Contact:

Re: shortcut with multiple actions

Post by Termy »

timmi wrote: Tue May 30, 2023 10:38 am Termy that seems to work like a charm, thanks so much! :)
You're more than welcome. Unfortunately, I can't help with LibreWolf as I'm not familiar with it and have only minimal experience with flatpaks.
motoryzen wrote: Mon May 29, 2023 11:50 pm I'm curious if adding an && at the end of the firefox line of that script file will accomplish the mission and guarantee the PC won't begin the power off process until that rm -r first line command has completed.
Yup! Quite right. I decided against adding it though, because I figured OP would prefer the computer actually turn off, regardless of whether the cache evisceration was a success of not. Were I to do this myself, I'd probably set it up with a notification or something, but hopefully it's good enough for OP.
motoryzen wrote: Mon May 29, 2023 11:50 pm Also there is the idea of turning that script into a gui launcher button on the cinnamon panel. *shrugs*
That would be awesome, and saves the risk of accidentally pressing the keyboard shortcut. Adding a simple 'Are you sure?' dialog would be ideal, even if it's just xmessage(1).
I'm also Terminalforlife on GitHub.
timmi
Level 1
Level 1
Posts: 3
Joined: Mon May 29, 2023 4:17 pm

Re: shortcut with multiple actions

Post by timmi »

Ok I'll try to search for the flatpak cache then, for sure there's a way somewhere.

I was thinking since I use this a lot, the shortcut might be bad when using software-shortcuts and accidently power the whole shebang off. Which would be bad.

So yeah, a GUI in the distro has my thumbs up too! We could name it 'sleazy button' as in 'sleepy & easy'. Maybe there's more people who find it useful.
Locked

Return to “Cinnamon”