You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+36-3Lines changed: 36 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,40 @@ All notable changes to this project will be documented in this file. This projec
5
5
6
6
## [Unreleased]
7
7
8
-
Nothing yet.
8
+
The focus of this release is to make docklib functions less focused on dock item labels, since labels can change depending on the user's selected language. (See [#32](https://github.com/homebysix/docklib/issues/32) for details.)
9
+
10
+
### Added
11
+
12
+
- A new `findExistingEntry` function that can find dock items based on several attributes.
13
+
14
+
The default behavior of `findExistingEntry` is to match the provided string on (in order of preference):
15
+
16
+
1. label
17
+
2. path
18
+
3. filename with extension
19
+
4. filename without extension
20
+
21
+
The `match_on` parameter can be specified to select only one of those attributes to match, if desired. See the `findExistingEntry` function docstring for available parameters and values.
22
+
23
+
### Changed
24
+
25
+
- The `findExistingLabel` function is now simply a pointer to the new `findExistingEntry` function. `findExistingLabel` will be maintained for backward-compatibility.
26
+
27
+
- The `removeDockEntry` function has a new `match_on` parameter that mirrors the same parameter in `findExistingEntry`. Default behavior is to match on the same attributes listed above, in the same order of preference. (This is a change in behavior from previous versions of docklib. If you prefer to continue removing items solely based on label, you should specify `match_on="label"` in your function call.)
28
+
29
+
- The `replaceDockEntry` function has two new parameters:
30
+
-`match_str`, which allows specifying the item intended to be replaced in the dock (replaces the now deprecated `label` parameter).
31
+
-`match_on`, which mirrors the same parameter in `findExistingEntry`. Default behavior is to match on the same attributes listed above, in the same order of preference.
32
+
33
+
### Deprecated
34
+
35
+
- The `label` parameter of `replaceDockEntry` is deprecated, and it's encouraged to use `match_str` instead. This allows existing items to be replaced based on multiple attributes rather than just label. As stated above, this makes dock customization scripts more reliable in multilingual environments.
36
+
37
+
A warning has been added that alerts administrators to this deprecation.
38
+
39
+
-**This is the last release of docklib that will support Python 2.** Future releases will only be tested in Python 3.
40
+
41
+
If you haven't started bundling a Python 3 runtime for your management tools, [this blog article from @scriptingosx](https://scriptingosx.com/2020/02/wrangling-pythons/) is a good read. Also: a reminder that docklib is already included in the "recommended" flavor of the [macadmins/python](https://github.com/macadmins/python) packages.
9
42
10
43
## [1.2.1] - 2021-03-01
11
44
@@ -15,7 +48,7 @@ Nothing yet.
15
48
16
49
### Fixed
17
50
18
-
- Fixed issue preventing `findExistingLabel()` from finding URLs' labels
51
+
- Fixed issue preventing `findExistingLabel` from finding URLs' labels
19
52
20
53
## [1.2.0] - 2020-10-15
21
54
@@ -25,7 +58,7 @@ Nothing yet.
25
58
26
59
- Published docklib to PyPI so that administrators can manage it with `pip` and more easily bundle it in [custom Python frameworks](https://github.com/macadmins/python). Adjusted repo file structure to match Python packaging standards.
27
60
- Created __build_pkg.sh__ script for creation of macOS package installer.
28
-
- Added `findExistingURL()` and `removeDockURLEntry()` functions for handling URL items.
61
+
- Added `findExistingURL` and `removeDockURLEntry` functions for handling URL items.
Copy file name to clipboardExpand all lines: README.md
+6-2Lines changed: 6 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,6 +32,10 @@ pip install docklib
32
32
33
33
This method is not intended to be used directly on managed devices, but it could be leveraged alongside a custom Python framework (like one built with [macadmins/python](https://github.com/macadmins/python) or [relocatable-python](https://github.com/gregneagle/relocatable-python)) using a requirements file.
34
34
35
+
### Managed Python
36
+
37
+
Docklib is included in the "recommended" flavor of the [macadmins/python](https://github.com/macadmins/python) release package. Installing this package and using `#!/usr/local/managed_python3` for your docklib script shebang may be the most self-contained and future-proof way to deploy docklib.
38
+
35
39
### Manual
36
40
37
41
Another method of using docklib is to simply place the docklib.py file in the same location as the Python script(s) you use to manipulate the macOS dock. Some examples of such scripts are included below.
@@ -109,7 +113,7 @@ import os
109
113
from docklib import Dock
110
114
111
115
dock = Dock()
112
-
if dock.findExistingLabel("Documents", section="persistent-others") ==-1:
116
+
if dock.findExistingEntry("Documents", section="persistent-others") ==-1:
0 commit comments