Score:0

gksudo is not taking full focus - python, glade

in flag

Ubuntu 18.04.6 LTS. I got this script in python, and its uses Glade as a gui.

Here is the main file: https://github.com/stuk88/UbuntuClearMemoryCache/blob/master/main.py

So. The code at fault here is:

runAsRoot("gksudo sysctl vm.drop_caches=1")

And I dont know why dksudu is not taking focus. Switching windows with alt+` is not working either.

vanadium avatar
cn flag
Note that gksudo to start graphical applications is deprecated. Use pkexec, but better, prefer not to run a graphical application as root at all: have it elevate to root privileges only while actually performing the specific actions that require root permissions.
Stas Arshanski avatar
in flag
Okay its the answer. Thank you
vanadium avatar
cn flag
OK, I have written it out as an answer in that case.
Score:1
cn flag

You are trying to run a terminal command with gksudo. That will start the process, but of course leave you no way of interacting with it. You probably rather want to launch a terminal application, in which that command is started.

Note that gksudo to start graphical applications is deprecated. Use pkexec, but better, prefer not to run a graphical application as root at all: have it elevate to root privileges only while actually performing the specific actions that require root permissions.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.