💅 style(launcher, notification_popup): update keyboard focus styling and add discharging battery icons
This commit is contained in:
12 files changed
+531
-91
No files matched your search
@@ -34,6 +34,10 @@ class CalendarWidget(Gtk.Box):
|
||||
self.today = datetime.date.today()
|
||||
self.plugin = plugin_instance
|
||||
|
||||
# Make widget focusable for keyboard events
|
||||
self.set_can_focus(True)
|
||||
self.connect("key-press-event", self._on_key_press)
|
||||
|
||||
self.setup_ui()
|
||||
|
||||
def setup_ui(self):
|
||||
@@ -127,6 +131,33 @@ class CalendarWidget(Gtk.Box):
|
||||
if self.plugin:
|
||||
self.plugin._navigate_to_next()
|
||||
|
||||
def _on_key_press(self, widget, event):
|
||||
"""Handle keyboard navigation for calendar."""
|
||||
from gi.repository import Gdk
|
||||
|
||||
keyval = event.keyval
|
||||
|
||||
# Left arrow - previous month
|
||||
if keyval == Gdk.KEY_Left:
|
||||
if self.plugin:
|
||||
self.plugin._navigate_to_previous()
|
||||
return True
|
||||
|
||||
# Right arrow - next month
|
||||
if keyval == Gdk.KEY_Right:
|
||||
if self.plugin:
|
||||
self.plugin._navigate_to_next()
|
||||
return True
|
||||
|
||||
# Home - go to current month
|
||||
if keyval == Gdk.KEY_Home:
|
||||
if self.plugin:
|
||||
self.plugin._reset_to_current_month()
|
||||
self.plugin._force_launcher_refresh()
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
def update_display(self, month: int, year: int):
|
||||
"""Update the calendar to show a different month/year."""
|
||||
self.display_month = month
|
||||
@@ -214,6 +245,7 @@ class CalendarPlugin(PluginBase):
|
||||
def initialize(self):
|
||||
"""Initialize the Calendar plugin."""
|
||||
self.set_triggers(["cal", "cal "])
|
||||
self.description = "Calendar with visual dates and navigation. Use ← → arrows for months, Home for current month"
|
||||
|
||||
def cleanup(self):
|
||||
"""Cleanup the Calendar plugin."""
|
||||
@@ -306,7 +338,7 @@ class CalendarPlugin(PluginBase):
|
||||
results.append(
|
||||
Result(
|
||||
title=f"Calendar - {month_name} {display_year}",
|
||||
subtitle="Use ◀ ▶ buttons to navigate months",
|
||||
subtitle="← → navigate months, Home for current month",
|
||||
icon_markup=icons.calendar,
|
||||
action=lambda: None,
|
||||
relevance=1.0,
|
||||
|
||||
@@ -127,9 +127,13 @@ class KanbanNote(Gtk.EventBox):
|
||||
super().__init__()
|
||||
self.text = text
|
||||
|
||||
# Make focusable for keyboard events
|
||||
self.set_can_focus(True)
|
||||
|
||||
self.setup_ui()
|
||||
self.setup_dnd()
|
||||
self.connect("button-press-event", self.on_button_press)
|
||||
self.connect("key-press-event", self.on_key_press)
|
||||
|
||||
def setup_ui(self):
|
||||
self.box = Gtk.Box(name="kanban-note", spacing=4)
|
||||
@@ -167,6 +171,24 @@ class KanbanNote(Gtk.EventBox):
|
||||
self.start_edit()
|
||||
return False
|
||||
|
||||
def on_key_press(self, widget, event):
|
||||
"""Handle keyboard events for kanban notes."""
|
||||
from gi.repository import Gdk
|
||||
|
||||
keyval = event.keyval
|
||||
|
||||
# Enter or F2 - start editing
|
||||
if keyval in (Gdk.KEY_Return, Gdk.KEY_F2):
|
||||
self.start_edit()
|
||||
return True
|
||||
|
||||
# Delete - remove note
|
||||
if keyval == Gdk.KEY_Delete:
|
||||
self.get_parent().destroy()
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
def on_drag_begin(self, widget, context):
|
||||
surface = createSurfaceFromWidget(self)
|
||||
Gtk.drag_set_icon_surface(context, surface)
|
||||
@@ -405,12 +427,35 @@ class Kanban(Gtk.Box):
|
||||
|
||||
def on_key_press(self, widget, event):
|
||||
"""Handle key press events for the kanban widget."""
|
||||
if event.keyval == Gdk.KEY_Return:
|
||||
from gi.repository import Gdk
|
||||
|
||||
keyval = event.keyval
|
||||
|
||||
# Enter - add pending text as note
|
||||
if keyval == Gdk.KEY_Return:
|
||||
if self.pending_add_text:
|
||||
self.columns[0].add_note(self.pending_add_text)
|
||||
self.save_state()
|
||||
self.pending_add_text = None
|
||||
return True
|
||||
|
||||
# Ctrl+N - add new note to first column
|
||||
if keyval == Gdk.KEY_n and event.state & Gdk.ModifierType.CONTROL_MASK:
|
||||
self.columns[0].on_add_clicked(None)
|
||||
return True
|
||||
|
||||
# Ctrl+1, Ctrl+2, Ctrl+3 - add note to specific column
|
||||
if event.state & Gdk.ModifierType.CONTROL_MASK:
|
||||
if keyval == Gdk.KEY_1 and len(self.columns) > 0:
|
||||
self.columns[0].on_add_clicked(None)
|
||||
return True
|
||||
elif keyval == Gdk.KEY_2 and len(self.columns) > 1:
|
||||
self.columns[1].on_add_clicked(None)
|
||||
return True
|
||||
elif keyval == Gdk.KEY_3 and len(self.columns) > 2:
|
||||
self.columns[2].on_add_clicked(None)
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
def on_hidden_entry_activate(self, entry):
|
||||
@@ -471,7 +516,7 @@ class KanbanPlugin(PluginBase):
|
||||
def initialize(self):
|
||||
"""Initialize the Kanban plugin."""
|
||||
self.set_triggers(["kanban", "kanban "])
|
||||
self.description = "Kanban board for task management. Use 'kanban add <text>' to quickly add tasks."
|
||||
self.description = "Kanban board for task management. Use 'kanban add <text>' to quickly add tasks. Keyboard: Enter/F2 to edit, Del to delete, Ctrl+N to add new note"
|
||||
|
||||
def cleanup(self):
|
||||
"""Cleanup the Kanban plugin."""
|
||||
|
||||
@@ -27,13 +27,17 @@ class NetworkPasswordEntry(Box):
|
||||
self.access_point = access_point
|
||||
self.network_plugin = network_plugin
|
||||
|
||||
# Make widget focusable for keyboard events
|
||||
self.set_can_focus(True)
|
||||
self.connect("key-press-event", self.on_key_press)
|
||||
|
||||
# Password entry field
|
||||
self.password_entry = Entry(
|
||||
name="network-password-field",
|
||||
placeholder="Enter password",
|
||||
h_expand=True,
|
||||
h_align="fill",
|
||||
visibility=False
|
||||
visibility=False
|
||||
)
|
||||
|
||||
# Connect Enter key to connect action
|
||||
@@ -42,7 +46,6 @@ class NetworkPasswordEntry(Box):
|
||||
# Auto-focus the password entry when widget is created
|
||||
GLib.timeout_add(100, self._focus_password_entry)
|
||||
|
||||
|
||||
# Add widgets to layout
|
||||
self.add(self.password_entry)
|
||||
|
||||
@@ -54,6 +57,24 @@ class NetworkPasswordEntry(Box):
|
||||
print(f"Could not focus password entry: {e}")
|
||||
return False # Don't repeat
|
||||
|
||||
def on_key_press(self, widget, event):
|
||||
"""Handle keyboard events for password entry."""
|
||||
from gi.repository import Gdk
|
||||
|
||||
keyval = event.keyval
|
||||
|
||||
# Enter - connect to network
|
||||
if keyval == Gdk.KEY_Return:
|
||||
self.connect_to_network()
|
||||
return True
|
||||
|
||||
# Escape - cancel password entry
|
||||
if keyval == Gdk.KEY_Escape:
|
||||
self.cancel_password_entry()
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
def connect_to_network(self):
|
||||
"""Connect to network with entered password."""
|
||||
password = self.password_entry.get_text()
|
||||
@@ -105,6 +126,7 @@ class NetworkPlugin(PluginBase):
|
||||
def initialize(self):
|
||||
"""Initialize the network plugin."""
|
||||
self.set_triggers(["net"])
|
||||
self.description = "Manage WiFi networks and connections. Keyboard: Enter to connect, Esc to cancel password entry"
|
||||
|
||||
def cleanup(self):
|
||||
"""Cleanup the network plugin."""
|
||||
|
||||
Reference in new issue
Block a user