quicksilver / Quicksilver

Quicksilver Project Source
http://qsapp.com
Apache License 2.0
2.74k stars 286 forks source link

Sleep no longer selectable #2636

Closed Max-Intosh closed 2 years ago

Max-Intosh commented 2 years ago

The Sleep function is no longer available to the input.

pjrobertson commented 2 years ago

Hi @Max-Intosh - can you please upload a screenshot of the problem you are facing, and follow the Issue form template, including providing the following information:

What version of macOS?

What version of Quicksilver?

jeutzsch commented 2 years ago

Hi @pjrobertson: I noticed the same thing yesterday after first updating to Monterey 12.2.1 and then updating to QS v1.6.1 on both my computers (MacMini 2018 and MBP 13" 2019). I'm not sure a screenshot would be useful because this is something that is now missing, so a screenshot wouldn't show anything. Before updating, opening QS and typing "SLEEP" (actually I had it set to be triggered with "SL" already), a script was run that put the computer into sleep mode. But now this script seems to be missing, and opening QS and typing "SLEEP" just doesn't result in anything that will put the computer to sleep. It looks to me like it was/is part of the "Extra Scripts" plugin.

pjrobertson commented 2 years ago

Thanks for the clarification.

OK, so this is an issue with the 'sleep' script from the ExtraScripts plugin no longer being present. Likely to do with the latest release of the plugin @skurfer

It seems that the Script files (which are comiled AppleScripts) are no longer being picked up as such by Quicksilver. Not sure if a re-build would work, or what's needed

Max-Intosh commented 2 years ago

Hi PJ @pjrobertson,

Mac OS 10.14.6 on Macbook Pro (15 inch 2019) with the just updated Quicksilver 1.6.1 (4026).

Can not recall how Quicksilver had been triggering the Sleep function as have had it operation for so many years now. Both Restart and Sleep are missing out of the catalogue of text inputs to the Quicksilver window.

In Catalog>Plugins the item "Scripts (QS Extras)" is present (with 24 to the right hand side) and ticked, however the drop down triangle is not present on the left hand side (indicating that no scripts are present?). Screen shot attached.

In Catalog>Scripts the item "Scripts (All Users)" is present (with 86 to the right hand side) and ticked, however the drop down triangle is not present on the left hand side (indicating that no scripts are present?). Screen shot attached.

Catalog>Custom is empty.

In Plugins>All Plugins the "Extra Scripts Plugin" is ticked (Version 1.0.0 of 05.2022), screen shot attached. Hope that that helps. Screenshot 2022-02-17 at 11 15 10 am Screenshot 2022-02-17 at 11 16 56 am Screenshot 2022-02-17 at 11 20 33 am

n8henrie commented 2 years ago

I've got ExtraScripts building, but not all the actions working yet.

The code for Lock Scren.app no longer works: https://github.com/gaomd/lock-screen-app.git but this does (thanks SO):

extern int SACLockScreenImmediate ( void );

int main ( ) {
    return SACLockScreenImmediate();
}
$ clang -F /System/Library/PrivateFrameworks -framework login -o lockscreen_arm lockscreen.c
$ clang -arch x86_64 -F /System/Library/PrivateFrameworks -framework login -o lockscreen_x86_64 lockscreen.c 
$ lipo -create -output lockscreen lockscreen_arm lockscreen_x86_64 
$ file lockscreen
lockscreen: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit executable x86_64] [arm64:Mach-O 64-bit executable arm64]
lockscreen (for architecture x86_64):   Mach-O 64-bit executable x86_64
lockscreen (for architecture arm64):    Mach-O 64-bit executable arm64

Seems to work.

Looks like KeyboardViewer.app is gone: https://apple.stackexchange.com/questions/59875/how-to-show-or-hide-keyboard-viewer-with-a-keyboard-shortcut

"/System/Library/Input Methods/CharacterPalette.app" exists but doesn't seem to do anything.

Not sure if Toggle Audio Input.scpt is working as I only have one audio source.

Restart seems to be corrupted, can't open. Force Restart and Force Shutdown are empty files.

Top 10.sh -- not clear what the output used to be, I simplified and just print out the PID and process name.

I pushed these changes to an m1recompile branch -- I'm wondering if the compiled AppleScripts are going to give us trouble on x86_64 now? Could @pjrobertson test and verify? (IIRC @skurfer is on M1 now --right?)

Should also probably restore a few of the scripts (Restart, Shut Down) -- can work on that soon.

pjrobertson commented 2 years ago

There appears to be a problem with the applescripts packaged in the latest plugin.

If you open the folder in terminal and run mdls FILE you'll note that there's no UTI for these files.

/System ❯❯❯ pwd
/Users/patrick/Library/Application Support/Quicksilver/PlugIns/com.blacktree.Quicksilver.QSExtraScriptsPlugIn.9D.qsplugin/Contents/Resources/ExtraScripts/System
/System ❯❯❯ mdls Sleep
kMDItemFSContentChangeDate = 2022-02-05 02:24:37 +0000
kMDItemFSCreationDate      = 2022-02-05 02:24:37 +0000
kMDItemFSCreatorCode       = ""
kMDItemFSFinderFlags       = 0
kMDItemFSHasCustomIcon     = 0
kMDItemFSInvisible         = 0
kMDItemFSIsExtensionHidden = 0
kMDItemFSIsStationery      = 0
kMDItemFSLabel             = 0
kMDItemFSName              = "Sleep"
kMDItemFSNodeCount         = 854
kMDItemFSOwnerGroupID      = 20
kMDItemFSOwnerUserID       = 501
kMDItemFSSize              = 854
kMDItemFSTypeCode          = ""

The actual files in the repo are correct:

/System git:master ❯❯❯ mdls Sleep
kMDItemContentCreationDate         = 2022-02-16 14:30:47 +0000
kMDItemContentCreationDate_Ranking = 2022-02-16 00:00:00 +0000
kMDItemContentModificationDate     = 2022-02-16 14:30:47 +0000
kMDItemContentType                 = "public.data"
kMDItemContentTypeTree             = (
    "public.data",
    "public.item"
)
kMDItemDateAdded                   = 2022-02-16 14:30:47 +0000
kMDItemDateAdded_Ranking           = 2022-02-16 00:00:00 +0000
kMDItemDisplayName                 = "Sleep"
kMDItemFSContentChangeDate         = 2022-02-16 14:30:47 +0000
kMDItemFSCreationDate              = 2022-02-16 14:30:47 +0000
kMDItemFSCreatorCode               = ""
kMDItemFSFinderFlags               = 0
kMDItemFSHasCustomIcon             = (null)
kMDItemFSInvisible                 = 0
kMDItemFSIsExtensionHidden         = 0
kMDItemFSIsStationery              = (null)
kMDItemFSLabel                     = 0
kMDItemFSName                      = "Sleep"
kMDItemFSNodeCount                 = (null)
kMDItemFSOwnerGroupID              = 20
kMDItemFSOwnerUserID               = 501
kMDItemFSSize                      = 854
kMDItemFSTypeCode                  = ""
kMDItemInterestingDate_Ranking     = 2022-02-16 00:00:00 +0000
kMDItemKind                        = "Document"
kMDItemLogicalSize                 = 854
kMDItemPhysicalSize                = 4096

Looks like the UTI data got stripped on packaging. That's the issue with this plugin. @n8henrie - can you please confirm the scripts in your build have correct UTIs set?

n8henrie commented 2 years ago

Can you check with the new branch I pushed? It looks like you might be on the old branch (based on Sleep vs Sleep.scpt)

$ mdls **/Sleep.scpt
_kMDItemDisplayNameWithExtensions      = "Sleep.scpt"
com_apple_metadata_modtime             = 666772485.352271
kMDItemContentCreationDate             = 2022-02-15 22:04:43 +0000
kMDItemContentCreationDate_Ranking     = 2022-02-15 00:00:00 +0000
kMDItemContentModificationDate         = 2022-02-17 06:34:45 +0000
kMDItemContentModificationDate_Ranking = 2022-02-17 00:00:00 +0000
kMDItemContentType                     = "com.apple.applescript.script"
kMDItemContentTypeTree                 = (
    "com.apple.applescript.script",
    "public.data",
    "public.item",
    "public.script",
    "public.source-code",
    "public.plain-text",
    "public.text",
    "public.content"
)
kMDItemDateAdded                       = 2022-02-15 22:04:43 +0000
kMDItemDateAdded_Ranking               = 2022-02-15 00:00:00 +0000
kMDItemDisplayName                     = "Sleep.scpt"
kMDItemDocumentIdentifier              = 22972
kMDItemFSContentChangeDate             = 2022-02-17 06:34:45 +0000
kMDItemFSCreationDate                  = 2022-02-15 22:04:43 +0000
kMDItemFSCreatorCode                   = "ToyS"
kMDItemFSFinderFlags                   = 0
kMDItemFSHasCustomIcon                 = (null)
kMDItemFSInvisible                     = 0
kMDItemFSIsExtensionHidden             = 0
kMDItemFSIsStationery                  = (null)
kMDItemFSLabel                         = 0
kMDItemFSName                          = "Sleep.scpt"
kMDItemFSNodeCount                     = (null)
kMDItemFSOwnerGroupID                  = 20
kMDItemFSOwnerUserID                   = 501
kMDItemFSSize                          = 1389
kMDItemFSTypeCode                      = "osas"
kMDItemInterestingDate_Ranking         = 2022-02-17 00:00:00 +0000
kMDItemKind                            = "Script"
kMDItemLastUsedDate                    = 2022-02-17 06:34:43 +0000
kMDItemLastUsedDate_Ranking            = 2022-02-17 00:00:00 +0000
kMDItemLogicalSize                     = 1389
kMDItemPhysicalSize                    = 8192
kMDItemUseCount                        = 7
kMDItemUsedDates                       = (
    "2022-02-16 07:00:00 +0000"
)
kMDItemUserModifiedDate                = (
    "2022-02-17 06:34:45 +0000"
)
kMDItemUserModifiedUserHandle          = (
    501
)
pjrobertson commented 2 years ago

Some of your scripts seem to run fine on my machine, but I don't quite know what you've done. A ton are now missing (Sleep, Restart) and a few others are formatted really weirdly:

Screenshot 2022-02-17 at 14 37 37

I don't think applescripts need re-compiling for M1. My guess is they're not compiled code

n8henrie commented 2 years ago

A ton are now missing (Sleep, Restart)

Correct -- I mentioned that above.

Several appear to be empty files on master, e.g. https://github.com/quicksilver/ExtraScripts-qsplugin/blob/master/Extra%20Scripts%20Plugin/ExtraScripts/System/Force%20Restart

I think they are compiled. For example, from master:

$ wget --content-disposition 'https://github.com/quicksilver/ExtraScripts-qsplugin/blob/master/Extra%20Scripts%20Plugin/ExtraScripts/System/Restart?raw=true'
$ file Restart
Restart: AppleScript compiled
$ open -a 'Script Editor' Restart
Screen Shot 2022-02-16 at 23 45 03
n8henrie commented 2 years ago

Got it -- Script Editor can read (and compile) Restart if I rename it to .scptd (but not as .scpt or .app). Restored those scripts to System.

As long as the compiled scripts are running I can update changelogs / version numbers and merge into master.

Other thoughts -- checking in compiled binaries (lockscreen) and compiled scripts into VCS seems odd. For AppleScript, an alternative is to File -> Save As -> .applescript files, which are then much friendlier with diffing and VCS, but need to be run as osascript myfile.applescript instead of directly executed. I don't know how calling this from ObjC works, or if this is substantially different than the other shell scripts we run.

Also still not sure what to say about the empty files like Force Restart -- I don't see any content there, ever.

git log -p -- "Extra Scripts Plugin/ExtraScripts/System/Force Restart" "Extra Scripts Plugin/Scripts/System/Force Restart"
commit 92c12a4ba44912250fe75bb84a030fcd1b5d6ae3
Author: Patrick Robertson <robertson.patrick@gmail.com>
Date:   Wed Apr 25 17:01:16 2012 +0100

    Use a sh command to copy scripts to the resources folder

    Ensures that the script icons are kept. Xcode is stupid and just gives the default icon

diff --git a/Extra Scripts Plugin/Scripts/System/Force Restart b/Extra Scripts Plugin/ExtraScripts/System/Force Restart
similarity index 100%
rename from Extra Scripts Plugin/Scripts/System/Force Restart
rename to Extra Scripts Plugin/ExtraScripts/System/Force Restart

commit 7262ca8eb09fab6d69402fbd453b0bfb868eff0f
Author: Patrick Robertson <robertson.patrick@gmail.com>
Date:   Wed Apr 25 14:30:00 2012 +0100

    Initial Commit

diff --git a/Extra Scripts Plugin/Scripts/System/Force Restart b/Extra Scripts Plugin/Scripts/System/Force Restart
new file mode 100644
index 0000000..e69de29
pjrobertson commented 2 years ago

Also still not sure what to say about the empty files like Force Restart -- I don't see any content there, ever.

Same here, just checked a backup of QS I have from ~7 years ago and it's empty then. For those that are really empty: delete or replace them. For those that were working previously (Sleep, Shutdown, Restart etc) we need to fix them

pjrobertson commented 2 years ago

"Show Keyboard Viewer" is still good for me, I use it regularly but yeah - I see it's dead in Catalina. [1] and [2] seem to be solutions.

Show Character Palette doesn't work for me, I can open the app but can't get the window to display. Seems broken - remove.

Toggle Audio input/output both work for me. However there's a delay between opening the System prefs and being able to edit it, I'll push a change to master to fix this.

n8henrie commented 2 years ago

For those that were working previously (Sleep, Shutdown, Restart etc) we need to fix them

Already done, they're in the referenced branch.

Seems broken - remove.

Done

pjrobertson commented 2 years ago

@Max-Intosh - This has been fixed, and an update for the Extra Scripts plugin should be available in the next few days. Please make sure to check for updates regularly from within Quicksilver: Screenshot 2022-02-19 at 07 56 46

Thank you for reporting the issue!

Max-Intosh commented 2 years ago

Thank you @pjrobertson and @n8henrie,

Appreciate the swift action, the detailed feedback, and resolution to the issue. Made the whole signing to Github worthwhile. Sorry to bang on, but seriously thus has been the best experience received by any tech help.

Well done guys, love the work.

n8henrie commented 2 years ago

@skurfer @pjrobertson -- can we exclude specific items from the QS catalog by default?

In making sure my new version of Lock Screen is compiling and working well (seems to be):

~/Library/Application Support/Quicksilver/PlugIns/com.blacktree.Quicksilver.QSExtraScriptsPlugIn.97.qsplugin/Contents/Resources/ExtraScripts/Processes/Lock Screen

I found that QS was already indexing what seemed to be a built-in Apple screen locker:

/System/Library/CoreServices/RemoteManagement/AppleVNCServer.bundle/Contents/Support/LockScreen.app

Unfortunately when I ran it, I get a black screen with a large lock icon -- and no way to unlock it (tried all the keyboard shortcuts I could think of, no indication that it's registering any input). Thankfully I was able to SSH in and kill the process.

Apparently this is app is for hiding the screen when someone is using remote desktop, and inability to unlock is a known issue. However, it would be a shame for end users to be looking for our QS Lock Screen action and be confused between the two, I imagine many of whom would ultimately have to hard reboot to recover from the situation (potential data loss etc.)

It would seem prudent to selectively exclude this specific item (and perhaps others) from indexing by default, and give users the option to manually index it if desired, but I'm not familiar enough with the codebase yet to know where to look for this.

skurfer commented 2 years ago

If you know what catalog entry is responsible for adding the unwanted app (Show Source in Catalog should be able to tell you), I think you can remove it by adding an omittedItems array to the catalog preset’s definition.

See https://github.com/quicksilver/Quicksilver/blob/master/Quicksilver/Code-QuickStepCore/QSLibrarian.m#L193

That list is generally reserved for user-disabled items, but I think it should be possible to pre-define it. Of course users that run into this problem could manually disable the item themselves, but that’s not ideal.

Max-Intosh commented 2 years ago

Have been checking for updates and updating plugins since the post above, however, Sleep still cannot be selected from the Quicksilver window.

jeutzsch commented 2 years ago

@Max-Intosh: it works for me again, since updating yesterday (or the day before?) to version 1.6.1 (4026). But if I remember correctly, I had to de-select the "extra scripts" plugin, quit QS, launch it again, and re-select "extra scripts" for it to work.