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!
shortcut with multiple actions
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
shortcut with multiple actions
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.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Re: shortcut with multiple actions
The only thing which comes to mind is:
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.
Code: Select all
#!/bin/sh
rm -r ~/.cache/mozilla/firefox
systemctl poweroff
I'm also Terminalforlife on GitHub.
- AZgl1800
- 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
firefox will let you do that
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?
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?
- AZgl1800
- 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
I also use a Keyboard shortcut to shut the PC down
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
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
Re: shortcut with multiple actions
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.
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
Out of my mind - please leave a message
Re: shortcut with multiple actions
Code: Select all
#!/bin/sh
rm -r ~/.cache/mozilla/firefox
systemctl poweroff
&&
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
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
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
Re: shortcut with multiple actions
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!
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!
Re: shortcut with multiple actions
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.
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.
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.
Re: shortcut with multiple actions
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.
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.