Skip to content

Commit

Permalink
configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
sulincix committed Feb 1, 2024
1 parent 77de730 commit a1d1612
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
6 changes: 5 additions & 1 deletion src/data/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#debug=false
#load-async=false
#blank-timeout=300
#notes=true
#font=Regular
#font-size=10
#touch-mode=false
Expand Down Expand Up @@ -62,3 +61,8 @@
#label=xterm
#icon=xterm-color_48x48
#command=xterm

[notes]
#enabled=true
#editable=true
#text-file=
15 changes: 11 additions & 4 deletions src/module/notes.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,21 @@ def _save_note_text(buffer):
gsettings_set("note-text",text)

def module_init():
if not get("notes", True):
if not get("enabled", True, "notes"):
loginwindow.o("ui_button_note").hide()
return
notes_button = loginwindow.o("ui_button_note")
loginwindow.o("ui_textview_notes").get_buffer().set_text(gsettings_get("note-text"))
loginwindow.o("ui_textview_notes").get_buffer().connect("changed", _save_note_text)
notes_button.connect("clicked", _notes_button_event)
height = int(monitor.get_common_resolution().split("x")[1])
width = int(monitor.get_common_resolution().split("x")[0])
loginwindow.o("ui_popover_notes").set_size_request(width/3, height/3)

if get("text-file","","notes") != "":
with open(get("text-file","","notes"),"r") as f:
loginwindow.o("ui_textview_notes").get_buffer().set_text(f.read())
loginwindow.o("ui_textview_notes").set_editable(False)
loginwindow.o("ui_textview_notes").set_can_focus(False)
return
loginwindow.o("ui_textview_notes").get_buffer().set_text(gsettings_get("note-text"))
loginwindow.o("ui_textview_notes").set_can_focus(get("editable", True, "notes"))
loginwindow.o("ui_textview_notes").set_editable(get("editable", True, "notes"))
loginwindow.o("ui_textview_notes").get_buffer().connect("changed", _save_note_text)

0 comments on commit a1d1612

Please sign in to comment.