Skip to content

Commit

Permalink
feat: add open firefox fav folder
Browse files Browse the repository at this point in the history
  • Loading branch information
klesh committed Dec 30, 2023
1 parent 7eb8d47 commit 5acc48e
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 14 deletions.
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"[python]": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true,
"source.unusedImports": true
"source.organizeImports": "explicit",
"source.unusedImports": "explicit"
},
},
"isort.args": [
Expand Down
4 changes: 2 additions & 2 deletions examples/services.pyw
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ from jigsawwm import daemon
class SyncthingService(daemon.ProcessService):
name = "syncthing"
args = [
r"C:\Programs\syncthing-windows-amd64-v1.23.2\syncthing.exe",
r"C:\Users\Klesh\Programs\syncthing\syncthing.exe",
"-no-browser",
"-no-restart",
"-no-upgrade",
]
log_path = r"C:\Programs\syncthing-windows-amd64-v1.23.2\syncthing.log"
log_path = r"C:\Users\Klesh\Programs\syncthing\syncthing.log"


daemon.register(SyncthingService)
Expand Down
8 changes: 5 additions & 3 deletions examples/tasks.pyw
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@ from datetime import timedelta
from log import *
from mailcalaid.cal.holiday import ChinaHolidayBook

from jigsawwm import chrome, daemon, smartstart
from jigsawwm import browser, daemon, smartstart


class DailyRoutine(daemon.Task):
name = "daily routine"

def run(self):
chrome.open_fav_folder("bookmark_bar", "daily")
# chrome.open_edge_fav_folder("bookmark_bar", "daily")
# browser.open_chrome_fav_folder("bookmark_bar", "daily")
# browser.open_edge_fav_folder("bookmark_bar", "daily")
browser.open_firefox_fav_folder(r"C:\Users\Klesh\AppData\Roaming\Mozilla\Firefox\Profiles\gxmksz50.default-release\places.sqlite")
pass

def condition(self):
return smartstart.daily_once("daily websites")
Expand Down
10 changes: 5 additions & 5 deletions examples/wm.pyw
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ wm = WindowManager(
# gap=2,
# strict=True,
# ),
Theme(
name="Mono",
layout_tiler=tilers.mono_layout_tiler,
strict=True,
),
Theme(
name="WideScreen Dwindle",
layout_tiler=tilers.widescreen_dwindle_layout_tiler,
Expand All @@ -29,6 +24,11 @@ wm = WindowManager(
strict=True,
new_window_as_master=True,
),
Theme(
name="Mono",
layout_tiler=tilers.mono_layout_tiler,
strict=True,
),
Theme(
name="Dwindle",
layout_tiler=tilers.dwindle_layout_tiler,
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
comtypes ~= 1.1.14
pyside6 ~= 6.5.2
pyside6 ~= 6.5.2
mailcalaid
29 changes: 28 additions & 1 deletion src/jigsawwm/chrome.py → src/jigsawwm/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,34 @@ def open_folder(folder):
open_folder(folder)


def open_fav_folder(root_folder, fav_folder):
def open_firefox_fav_folder(places_path, fav_folder='daily'):
import sqlite3
sql_query = f"""
select
-- mb.title,
mp.url
from
moz_bookmarks mb
left join moz_places mp on
(mb.fk = mp.id)
where
mb.parent =(
select
id
from
moz_bookmarks
where
title = ?
and type = 2)
"""
con = sqlite3.connect(places_path)
cur = con.cursor()
res = cur.execute(sql_query, fav_folder)
for url, in res.fetchall():
os.startfile(url)


def open_chrome_fav_folder(root_folder, fav_folder):
"""Opens the Chrome Favorites folder"""
bookmarks_path = os.path.join(
os.getenv("LOCALAPPDATA"),
Expand Down

0 comments on commit 5acc48e

Please sign in to comment.