Skip to content

Commit

Permalink
Allow closing focus application
Browse files Browse the repository at this point in the history
  • Loading branch information
Niels van de Weem committed Apr 21, 2024
1 parent eb20d65 commit 5de9540
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ A backup will be made when converting. If you want to downgrade to a previous ve
- Pressing escape when a dialog is open will close the dialog
- Version check is done using the GitHub version api and will notify when a new snapshot is available
- [Linux] #44 - pactl commands are run in English so that their output can be parsed correctly
- [Windows] #57 - The end focussed task command works again

**Fixes within the snapshot:**
(not relevant when not upgrading from a previous snapshot)
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/com/getpcpanel/util/IPlatformCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,16 @@ public void exec(String shortcut) {

@Override
public void kill(String process) {
var toKill = FOCUS.equals(process) ? sndCtrl.getFocusApplication() : process;
var toKill = stripFile(FOCUS.equals(process) ? sndCtrl.getFocusApplication() : process);
try {
rt.exec("cmd.exe /c taskkill /IM " + toKill + " /F");
} catch (IOException e) {
log.error("Unable to end '{}'", toKill, e);
}
}

private String stripFile(String file) {
return new File(file).getName();
}
}
}

0 comments on commit 5de9540

Please sign in to comment.