Sample Header Ad - 728x90

Unix & Linux Stack Exchange

Q&A for users of Linux, FreeBSD and other Unix-like operating systems

Latest Questions

0 votes
0 answers
34 views
Make Qutebrowser download in specific directory
#### General overview The goal is to make Qutebrowser store downloads in a subdirectory of `~/downloads` named after the ISO date of the day when the download happend. #### What I alredy did In my `~/.config/qutebrowser/config.py`, I made this function: ```python def setDownloadDirectory(): imp...
#### General overview The goal is to make Qutebrowser store downloads in a subdirectory of ~/downloads named after the ISO date of the day when the download happend. #### What I alredy did In my ~/.config/qutebrowser/config.py, I made this function:
def setDownloadDirectory():
	import os
	from datetime import datetime

	# Formater current date
	today = datetime.now().strftime('%Y-%m-%d')
	download_dir = os.path.join(os.path.expanduser('~/Téléchargements/www'), today)

	# Create the directory if any
	if not os.path.exists(download_dir):
		os.makedirs(download_dir)

	# set the new directory
	c.downloads.location.directory = download_dir

setDownloadDirectory()
So, yes, when I try to download something I get the desired behaviour, Qutebrowser suggest ~/Téléchargements/www/2025-06-07/ as download directory, as desired. #### The problem So, what’s the problem? Well their is two main problems: 1. The date is set to the moment when Qutebrowser was opened and not to the moment when the download happens. Let’s suppose I open Qutebrowser at 23:50, the directory will be set to /2025-06-07 and the downloads who will happens at 24:01 or latter in the next day will still on /2025-06-07 directory. 2. The day’s directory is immediately created at the moment when Qutebrowser starts, not when a download happens. So it could open multiple empty folders for the times I just opened Qutebrowser without asking any download. #### The question Is it possible to run setDownloadDirectory() only when some events are triggers like when a download is asked? It will ensure that the date is really the moment when the download happens and also create a directory only if needed.
fauve (1529 rep)
Jun 7, 2025, 02:09 PM
0 votes
1 answers
44 views
Force Qutebrowser to close tab and open default one when there is one tab in the window
In Qutebrowser, I try to create the following behavior: `tab-close`, or at least the action associated with it (i.e., pressing d ), should, in all situations where more than one tab is open, close the current tab, as it already does. However, if the window contains only one tab, it should close that...
In Qutebrowser, I try to create the following behavior: tab-close, or at least the action associated with it (i.e., pressing d), should, in all situations where more than one tab is open, close the current tab, as it already does. However, if the window contains only one tab, it should close that tab and open the default tab in its place. Basically, like Firefox does. I made many tries in config.py, creating a smart_tab_close() function which gets the number of opened tabs, but I failed. So how to make Qutebrowser act like that?
fauve (1529 rep)
Jun 4, 2025, 12:33 PM • Last activity: Jun 6, 2025, 06:29 AM
1 votes
0 answers
45 views
Minimal example of new function in Qutebrowser
## General overview I am trying to create a function I can call from Qutebrowser with ex mode (the commands starting with `:`). But I can’t find a way to do it. ## What I did In my `config.py`, I added the following lines: ```python # Function deffinition def example_function(): print("The function...
## General overview I am trying to create a function I can call from Qutebrowser with ex mode (the commands starting with :). But I can’t find a way to do it. ## What I did In my config.py, I added the following lines:
# Function deffinition
def example_function():
	print("The function started")

# Link the python function to ex-mode function
c.aliases['example-command'] = example_function
In this case, c.aliases take just the output of example_function(), and does not run example_function() each time I call it. ## The question How to create a new function in Qutebrowser and assign it to an ex command or a keybinding ?
fauve (1529 rep)
Apr 1, 2024, 12:03 PM • Last activity: Apr 1, 2024, 02:57 PM
1 votes
1 answers
86 views
Add list of urls to the Qutebrowser’s sqlite3 history
### General overview I have a `history.csv CSV file of urls formated like this: ```csv ; ;2024-03-30T12:00:00;2024-03-30T12:00:00 ``` (The _2024-03-30T12:00:00_ is the same) The goal is to get this urls in the history of Qutebrowser who is in sqlite3. ### What I did #### Prerequest First I clos...
### General overview I have a `history.csv CSV file of urls formated like this:
;;2024-03-30T12:00:00;2024-03-30T12:00:00
(The _2024-03-30T12:00:00_ is the same) The goal is to get this urls in the history of Qutebrowser who is in sqlite3. ### What I did #### Prerequest First I closed Qutebrowser. #### Opening the DB I run:
sqlite3 ~/.local/share/qutebrowser/history.sqlite
#### Adding the new urls In the sqlite3 shell I did:
.mode csv
.separator ';'
.import urls.txt History
The things seams good, except just some bad formated lines like:
history.csv:11671: unescaped " character
history.csv:11671: unescaped " character
history.csv:11772: expected 4 columns but found 6 - extras ignored
#### Verificaton I verified the changes took place with:
SELECT * FROM History;
And yes, I saw the urls. #### Closing Finally I closed the console with:
.quit
### The problem When I went back to Qutebrowser and try to open some urls to see if it works, so it doesn’t work. The urls seems not imported. ### The question What to do to import urls into Qutebrowser’s history? By the way I described or any other way. ## Update The links I added appear when I activate :history command inside Qutebrowser. But did not appear in history completion. So it’s not a question of database.
fauve (1529 rep)
Mar 31, 2024, 12:59 PM • Last activity: Mar 31, 2024, 11:06 PM
Showing page 1 of 4 total questions