Skip to main content
41 events
when toggle format what by license comment
Mar 23, 2018 at 23:48 vote accept AlmuHS
Mar 23, 2018 at 23:48 answer added AlmuHS timeline score: 0
Mar 9, 2018 at 9:02 comment added mviereck This may help: unix.stackexchange.com/a/429162/185747
Feb 25, 2018 at 19:20 answer added AlmuHS timeline score: 0
Feb 23, 2018 at 14:39 comment added AlmuHS @mviereck Well, It's a update based in your workaround. Previously, I put your script in my autostart, and execute it manually to be sure
Feb 23, 2018 at 13:21 comment added mviereck Your script in UPDATE 2 can only work if /tmp/display.$user exists. Therefore you need the autostart script provided in my answer. Instead of XAUTHORITY it works with xhost. You need to read and understand the script snippets to use them.
Feb 22, 2018 at 19:44 history edited AlmuHS CC BY-SA 3.0
deleted 237 characters in body
Feb 22, 2018 at 18:06 history edited AlmuHS CC BY-SA 3.0
added 561 characters in body
Feb 22, 2018 at 8:00 history edited AlmuHS CC BY-SA 3.0
added 1 character in body
Feb 22, 2018 at 7:54 history edited AlmuHS CC BY-SA 3.0
added 201 characters in body
Feb 20, 2018 at 20:19 comment added AlmuHS @ctac_ This rule is part of a program, which will be distributed and used by users with differents desktop environments and distributions. By this reason, my rule file capture all possible shutdown events of each desktop environment and system. The program try to be a reminder, with objective that the user don't forget its pendrive. By this reason, furthermore to lock shutdown when user connect pendrive, is needed a notify when the user try to shutdown
Feb 20, 2018 at 19:34 comment added ctac_ Your rule file is very strange. I think only one catch the shutdown. First at all, you must find the responsible program consolekit, login1 or xfce. Perhaps it's another one ? When I try for your previous ask, the shutdown button was disabled when the pendrive file exist. No need of notification because I can't shutdown.
Feb 20, 2018 at 9:21 history edited AlmuHS CC BY-SA 3.0
edited title
Feb 19, 2018 at 23:29 comment added AlmuHS Yes, I think is a permissions problem
Feb 19, 2018 at 23:25 comment added mviereck One issue: 15:30 is not a valid value for DISPLAY. Most times it is :0 or :1. Another issue: most probably polkitd is not allowed to read .Xauthority. I'll add a workaround to my answer.
Feb 19, 2018 at 23:25 comment added AlmuHS Full code here: github.com/AlmuHS/Pendrive_Reminder
Feb 19, 2018 at 23:23 comment added AlmuHS @Bigon I have other version of same application that, instead use polkit javascript rules, use old polkit authoritization files (.pkga) In this version, I have two scripts linked to 2 udev events. The first script, furthermore creates the usb file, add the pkla polkit file; and the second, after remove id from file, if file is empty, also remove pkla polkit file. But this version don't allow show notifications
Feb 19, 2018 at 23:20 comment added AlmuHS @mviereck 15:30 /home/almu/.Xauthority uid=102(polkitd) gid=105(polkitd) groups=105(polkitd)
Feb 19, 2018 at 23:15 comment added Bigon I'm not exactly sure. I would create a daemon that listen to udev events and that set systemd inhibitor to prevent the reboot/shutdown. But that doesn't solve the problem of the notification (maybe some desktop environment would display something). Note that there are discussion in polkit mailing lists to remove the javascript support for the rules in the future and also note that polkit in debian has an old version that doesn't support that either. I'm still wondering WHY you want to do that.
Feb 19, 2018 at 23:13 comment added mviereck What gives echo $DISPLAY $XAUTHORITY $(id) > /tmp/x.txt?
Feb 19, 2018 at 22:42 comment added AlmuHS @Bigon what is your proposal to solve it?
Feb 19, 2018 at 22:39 comment added Bigon This only works with a X session (and not wayland one) and might break if several users are connected to the machine.
Feb 19, 2018 at 22:32 comment added AlmuHS I did a echo $user > /tmp/user and this file was created correcly with the username in it. So feels the second problem
Feb 19, 2018 at 22:30 comment added mviereck Either the script is not executed, or it cannot write to /home/$user. Try echo $DISPLAY $XAUTHORITY $user > /tmp/x.txt
Feb 19, 2018 at 22:26 comment added AlmuHS After try echo $DISPLAY $XAUTHORITY > /home/$user/x.txt from my script, I check that x.txt file don't exists after press shutdown button.
Feb 19, 2018 at 22:21 comment added AlmuHS ok, I'll try both
Feb 19, 2018 at 22:20 comment added mviereck You can also try xmessage "yourtext" to make sure its not a problem with notify-send itself.
Feb 19, 2018 at 22:18 comment added mviereck Try echo $DISPLAY $XAUTHORITY > /home/$user/x.txt and check the content of x.txt. Also: Does the script run as user $user? There may be access restrictions to .Xauthority forbidding access for other users than $user.
Feb 19, 2018 at 22:13 comment added AlmuHS Added. Unsucessfull yet
Feb 19, 2018 at 22:10 comment added AlmuHS ok, I'll try it
Feb 19, 2018 at 22:10 comment added mviereck Add export DISPLAY XAUTHORITY before notify-send.
Feb 19, 2018 at 21:58 history edited AlmuHS CC BY-SA 3.0
added 361 characters in body
Feb 19, 2018 at 20:49 comment added AlmuHS I added a line in script that write a file during the pendrive disconnection and, after disconnect the pendrive, the file has been created and writed correctly. So, the second script is called correctly
Feb 19, 2018 at 19:34 comment added Bigon Are you trying to achieve this to be sure the pendrive is properly unmounted? Or are you trying to achieve something else? Because even if the pendrive is mounted, the shutdown sequence should ensure that it's properly unmounted
Feb 19, 2018 at 18:11 answer added mviereck timeline score: 0
Feb 19, 2018 at 17:48 history edited AlmuHS CC BY-SA 3.0
deleted 111 characters in body; edited tags
Feb 19, 2018 at 17:42 history edited Jeff Schaller
edited tags
Feb 19, 2018 at 17:37 history edited AlmuHS CC BY-SA 3.0
deleted 111 characters in body; edited tags
Feb 19, 2018 at 15:38 history edited AlmuHS CC BY-SA 3.0
added 59 characters in body
Feb 19, 2018 at 15:31 review First posts
Feb 19, 2018 at 16:11
Feb 19, 2018 at 15:30 history asked AlmuHS CC BY-SA 3.0