From ecfce5d8bdeb8deb71f61defc42892c0d5a62d74 Mon Sep 17 00:00:00 2001 From: Rael Gugelmin Cunha Date: Thu, 15 Jun 2017 11:08:00 -0300 Subject: [PATCH 1/2] Keep online status (#585) --- scudcloud/resources/scudcloud.js | 2 +- scudcloud/scudcloud.py | 6 +++++- sources/scudcloud.js | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/scudcloud/resources/scudcloud.js b/scudcloud/resources/scudcloud.js index b9ce01a..f5de77e 100644 --- a/scudcloud/resources/scudcloud.js +++ b/scudcloud/resources/scudcloud.js @@ -1 +1 @@ -ScudCloud={unloaded:!0,env:{mac_ssb_version:1},hasPreference:function(a){return!1},getPreference:function(a){return!1},setPreference:function(a,b){return!1},canShowHtmlNotifications:function(){return!1},app:{getModifierKeys:function(){}},call:function(a,b){switch(ScudCloud.log(a,b),a){case"reload":return ScudCloud.reload();case"didStartLoading":return ScudCloud.didStartLoading();case"didFinishLoading":return ScudCloud.didFinishLoading();case"setConnectionStatus":return ScudCloud.setConnectionStatus(b);case"notify":return ScudCloud.notify(b);case"setBadgeCount":return ScudCloud.setBadgeCount(b);case"displayTeam":return ScudCloud.displayTeam(b);case"signInTeam":return ScudCloud.signInTeam()}return!1},reload:function(){window.location.reload()},didStartLoading:function(){},didFinishLoading:function(){TS.ui.banner.close(),ScudCloud.populate(),ScudCloud.unloaded=!1},setConnectionStatus:function(a){switch(a){case"online":desktop.enableMenus(!0);break;default:desktop.enableMenus(!1)}},notify:function(a){desktop.sendMessage(a.title,a.content)},setBadgeCount:function(a){desktop.count(a.all_unread_highlights_cnt,a.all_unread_cnt)},signInTeam:function(){desktop.addTeam()},displayTeam:function(a){},log:function(a,b){try{"object"==typeof b&&(b=JSON.stringify(b))}catch(a){b=""}console.log("ScudCloud."+a+", args: "+b)},populate:function(){if("undefined"!=TS&&TS.model&&TS.model.team&&TS.model.team.icon&&TS.model.team.icon.image_44)desktop.populate(JSON.stringify({channels:ScudCloud.listChannels(),teams:ScudCloud.listTeams(),icon:TS.model.team.icon.image_44})),document.querySelector(".ql-editor").addEventListener("paste",desktop.pasted);else{var a=1e3,b=100,c=Math.round(Math.random()*(a-b))+b;setTimeout(ScudCloud.populate,c)}},createSnippet:function(){return TS.ui.snippet_dialog.start()},listChannels:function(){var a=TS.channels.getUnarchivedChannelsForUser();return a.push(TS.channels.getChannelById(TS.model.active_channel_id)),a},listTeams:function(){var a={id:TS.boot_data.user_id,team_color:null,team_icon:TS.model.team.icon,team_id:TS.model.team.id,team_name:TS.model.team.name,team_url:"https://"+TS.model.team.domain+".slack.com/"},b=[a];for(var c in TS.boot_data.other_accounts)b.push(TS.boot_data.other_accounts[c]);return b},quicklist:function(){desktop.quicklist(ScudCloud.listChannels())},join:function(a){return TS.channels.join(a)},setClipboard:function(a){TS.client.ui.file_pasted_sig.dispatch(a,TS.model.shift_key_pressed)},sendTickle:function(){return TS.ms.sendTickle()},preferences:function(){return TS.ui.prefs_dialog.start()},addTeam:function(){document.location=TS.boot_data.signin_url},getCurrentTeam:function(){return TS.boot_data.user_id?TS.boot_data.user_id:""},logout:function(){document.location=TS.boot_data.logout_url},help:function(){return TS.help_modal.start()}},document.onpaste=function(a){desktop.pasted(!1)},$("body").delegate("#channel_calls_button","click",function(){desktop.open(TS.boot_data.team_url+"call/"+TS.model.active_cid)}),$("body").undelegate('a[href="/files/create/space"]',"click"),$("body").delegate('a[href="/files/create/space"]',"click",function(a){desktop.createPost(TS.boot_data.team_url),a.preventDefault()}),window.winssb=TSSSB=ScudCloud,ScudCloud.unloaded&&ScudCloud.didFinishLoading(); \ No newline at end of file +ScudCloud={unloaded:!0,env:{mac_ssb_version:1},hasPreference:function(e){return!1},getPreference:function(e){return!1},setPreference:function(e,t){return!1},canShowHtmlNotifications:function(){return!1},app:{getModifierKeys:function(){}},call:function(e,t){switch(ScudCloud.log(e,t),e){case"reload":return ScudCloud.reload();case"didStartLoading":return ScudCloud.didStartLoading();case"didFinishLoading":return ScudCloud.didFinishLoading();case"setConnectionStatus":return ScudCloud.setConnectionStatus(t);case"notify":return ScudCloud.notify(t);case"setBadgeCount":return ScudCloud.setBadgeCount(t);case"displayTeam":return ScudCloud.displayTeam(t);case"signInTeam":return ScudCloud.signInTeam()}return!1},reload:function(){window.location.reload()},didStartLoading:function(){},didFinishLoading:function(){TS.ui.banner.close(),ScudCloud.populate(),ScudCloud.unloaded=!1},setConnectionStatus:function(e){switch(e){case"online":desktop.enableMenus(!0);break;default:desktop.enableMenus(!1)}},notify:function(e){desktop.sendMessage(e.title,e.content)},setBadgeCount:function(e){desktop.count(e.all_unread_highlights_cnt,e.all_unread_cnt)},signInTeam:function(){desktop.addTeam()},displayTeam:function(e){},log:function(e,t){try{"object"==typeof t&&(t=JSON.stringify(t))}catch(e){t=""}console.log("ScudCloud."+e+", args: "+t)},populate:function(){if("undefined"!=TS&&TS.model&&TS.model.team&&TS.model.team.icon&&TS.model.team.icon.image_44)desktop.populate(JSON.stringify({channels:ScudCloud.listChannels(),teams:ScudCloud.listTeams(),icon:TS.model.team.icon.image_44})),document.querySelector(".ql-editor").addEventListener("paste",desktop.pasted);else{var e=Math.round(900*Math.random())+100;setTimeout(ScudCloud.populate,e)}},createSnippet:function(){return TS.ui.snippet_dialog.start()},listChannels:function(){var e=TS.channels.getUnarchivedChannelsForUser();return e.push(TS.channels.getChannelById(TS.model.active_channel_id)),e},listTeams:function(){var e=[{id:TS.boot_data.user_id,team_color:null,team_icon:TS.model.team.icon,team_id:TS.model.team.id,team_name:TS.model.team.name,team_url:"https://"+TS.model.team.domain+".slack.com/"}];for(var t in TS.boot_data.other_accounts)e.push(TS.boot_data.other_accounts[t]);return e},quicklist:function(){desktop.quicklist(ScudCloud.listChannels())},join:function(e){return TS.channels.join(e)},setClipboard:function(e){TS.client.ui.file_pasted_sig.dispatch(e,TS.model.shift_key_pressed)},sendTickle:function(){return TS.client.ui.maybeTickleMS()},preferences:function(){return TS.ui.prefs_dialog.start()},addTeam:function(){document.location=TS.boot_data.signin_url},getCurrentTeam:function(){return TS.boot_data.user_id?TS.boot_data.user_id:""},logout:function(){document.location=TS.boot_data.logout_url},help:function(){return TS.help_modal.start()}},document.onpaste=function(e){desktop.pasted(!1)},$("body").delegate("#channel_calls_button","click",function(){desktop.open(TS.boot_data.team_url+"call/"+TS.model.active_cid)}),$("body").undelegate('a[href="/files/create/space"]',"click"),$("body").delegate('a[href="/files/create/space"]',"click",function(e){desktop.createPost(TS.boot_data.team_url),e.preventDefault()}),window.winssb=TSSSB=ScudCloud,ScudCloud.unloaded&&ScudCloud.didFinishLoading(); \ No newline at end of file diff --git a/scudcloud/scudcloud.py b/scudcloud/scudcloud.py index c5fb451..2c1b0f8 100755 --- a/scudcloud/scudcloud.py +++ b/scudcloud/scudcloud.py @@ -91,8 +91,12 @@ def __init__(self, debug = False, minimized = None, urgent_hint = None, settings sessionBus = dbus.SessionBus() # Ubuntu 12.04 and other distros sessionBus.add_match_string("type='signal',interface='org.gnome.ScreenSaver'") - # Ubuntu 14.04 and above + # Ubuntu 14.04 sessionBus.add_match_string("type='signal',interface='com.ubuntu.Upstart0_6'") + # Ubuntu 16.04 and KDE + sessionBus.add_match_string("type='signal',interface='org.freedesktop.ScreenSaver'") + # Cinnamon + essionBus.add_match_string("type='signal',interface='org.cinnamon.ScreenSaver'") sessionBus.add_message_filter(self.screenListener) self.tickler.timeout.connect(self.sendTickle) # If dbus is not present, tickler timer will act like a blocker to not send tickle too often diff --git a/sources/scudcloud.js b/sources/scudcloud.js index ec3d750..e0b6487 100644 --- a/sources/scudcloud.js +++ b/sources/scudcloud.js @@ -131,7 +131,7 @@ ScudCloud = { TS.client.ui.file_pasted_sig.dispatch(data, TS.model.shift_key_pressed); }, sendTickle: function(){ - return TS.ms.sendTickle(); + return TS.client.ui.maybeTickleMS(); }, preferences: function(){ return TS.ui.prefs_dialog.start(); From 0b2228d2155799c59d572a9a958ae053a7c3d3f1 Mon Sep 17 00:00:00 2001 From: Rael Gugelmin Cunha Date: Thu, 15 Jun 2017 12:06:51 -0300 Subject: [PATCH 2/2] Updating Slack tickle function (#585) --- scudcloud/resources/scudcloud.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scudcloud/resources/scudcloud.js b/scudcloud/resources/scudcloud.js index ec3d750..e0b6487 100644 --- a/scudcloud/resources/scudcloud.js +++ b/scudcloud/resources/scudcloud.js @@ -131,7 +131,7 @@ ScudCloud = { TS.client.ui.file_pasted_sig.dispatch(data, TS.model.shift_key_pressed); }, sendTickle: function(){ - return TS.ms.sendTickle(); + return TS.client.ui.maybeTickleMS(); }, preferences: function(){ return TS.ui.prefs_dialog.start();