Skip to content

Commit 507af06

Browse files
authored
Fixes cinnamon-session-quit --logout --no-prompt --force not working (#183)
1 parent f72fbe1 commit 507af06

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

cinnamon-session-quit/cinnamon-session-quit.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def __init__(self):
6060
group.add_argument("--reboot", dest="mode", action='store_const', const=Action.RESTART,
6161
help="Log out")
6262
parser.add_argument("--force", dest="force", action="store_true",
63-
help=_("Ignoring any existing inhibitors"))
63+
help=_("Ignoring any existing inhibitors. Implies --no-prompt"))
6464
parser.add_argument("--no-prompt", dest="no_prompt", action='store_true',
6565
help=_("Don't prompt for user confirmation"))
6666
parser.add_argument("--sm-owned", action="store_true", help=argparse.SUPPRESS)
@@ -76,8 +76,13 @@ def __init__(self):
7676
self.mode = args.mode
7777
self.default_response = ResponseCode(int(self.mode))
7878

79-
self.force = args.force
80-
self.no_prompt = args.no_prompt
79+
if args.force:
80+
self.LogoutMode = LogoutParams.FORCE
81+
elif args.no_prompt:
82+
self.LogoutMode = LogoutParams.NO_PROMPT
83+
else:
84+
self.LogoutMode = LogoutParams.NORMAL
85+
8186
self.sm_owned = args.sm_owned
8287
self.bus_id = args.bus_id
8388

@@ -120,16 +125,10 @@ def async_cb(proxy, res):
120125
print("An error occurred forwarding to the session manager: %s" % e.message, file=sys.stderr, end=None)
121126

122127
if self.mode == Action.LOGOUT:
123-
arg = LogoutParams.NORMAL
124-
125-
if self.no_prompt:
126-
arg |= LogoutParams.NO_PROMPT
127-
if self.force:
128-
arg |= LogoutParams.FORCE
129128

130129
sm_proxy.call(
131130
"Logout",
132-
GLib.Variant("(u)", [arg]),
131+
GLib.Variant("(u)", [self.LogoutMode]),
133132
Gio.DBusCallFlags.NO_AUTO_START,
134133
-1,
135134
None,

0 commit comments

Comments
 (0)