Skip to content

Commit

Permalink
feat(applications): enhance applications widget with additional launc…
Browse files Browse the repository at this point in the history
…h options and command handling
  • Loading branch information
amnweb committed Mar 6, 2025
1 parent 4ca58f5 commit c8e86e0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
14 changes: 9 additions & 5 deletions docs/widgets/(Widget)-Applications.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Applications Widget Options

| Option | Type | Default | Description |
|------------|--------|---------|-----------------------------------------------------------------------------|
| `label` | string | {data} | The label for the applications widget. |
Expand All @@ -16,11 +17,14 @@ apps:
options:
label: "{data}"
app_list:
- {icon: "\uf0a2", launch: "notification_center"}
- {icon: "\ueb51", launch: "quick_settings"}
- {icon: "\uf422", launch: "search"}
- {icon: "\uf489", launch: "wt"}
- {icon: "C:\\Users\\marko\\icons\\vscode.png", launch: "C:\\Users\\Username\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe"}
- {icon: "\uf0a2", launch: "notification_center"} # launch notification center
- {icon: "\ueb51", launch: "quick_settings"} # launch quick settings
- {icon: "\uf422", launch: "search"} # launch search
- {icon: "\uf489", launch: "wt"} # launch terminal
- {icon: "C:\\Users\\marko\\icons\\vscode.png", launch: "C:\\Users\\Username\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe"} # open vscode
- {icon: "\udb81\udc4d",launch: "\"C:\\Program Files\\Mozilla Firefox\\firefox.exe\" -new-tab www.reddit.com"} # open reddit in new tab in firefox
- {icon: "\udb81\udc4d",launch: "\"C:\\Program Files\\Mozilla Firefox\\firefox.exe\" -new-window www.reddit.com"} # open reddit in new window in firefox
- {icon: "\udb81\udc4d",launch: "\"C:\\Program Files\\Mozilla Firefox\\firefox.exe\" -private-window www.reddit.com"} # open reddit in private window in firefox
container_padding:
top: 0
left: 8
Expand Down
5 changes: 3 additions & 2 deletions src/core/widgets/yasb/applications.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@ def execute_code(self, data):
function_map[data]()
else:
try:
command = data.split()
subprocess.Popen(command, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=True)
if not any(param in data for param in ['-new-tab', '-new-window','-private-window']):
data = data.split()
subprocess.Popen(data, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=True)
except Exception as e:
logging.error(f"Error starting app: {str(e)}")
except Exception as e:
Expand Down

0 comments on commit c8e86e0

Please sign in to comment.