-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #88 from regolith-linux/chore-api-cleanup
Chore api cleanup
- Loading branch information
Showing
15 changed files
with
135 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
namespace Ilia { | ||
/** | ||
* Implement prev/next item for emacs and vim bindings | ||
* | ||
* returns true if key entry was handled | ||
*/ | ||
public static bool handle_emacs_vim_nav(Gtk.TreeView item_view, Gtk.TreePath path, Gdk.EventKey key) { | ||
if ((key.state & Gdk.ModifierType.CONTROL_MASK) == Gdk.ModifierType.CONTROL_MASK) { //CTRL | ||
bool is_last = selection_is_last (item_view.get_selection ()); | ||
|
||
if (key.keyval == 'p' || key.keyval == 'k') { | ||
path.prev (); | ||
item_view.get_selection ().select_path (path); | ||
item_view.set_cursor (path, null, false); | ||
} else if ((key.keyval == 'n' || key.keyval == 'j') && !is_last) { | ||
path.next (); | ||
item_view.get_selection ().select_path (path); | ||
item_view.set_cursor (path, null, false); | ||
} | ||
|
||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
|
||
public static bool selection_is_last (Gtk.TreeSelection selection) { | ||
Gtk.TreeModel model; | ||
Gtk.TreeIter iter; | ||
if (selection.get_selected(out model, out iter)) { | ||
return !model.iter_next(ref iter); | ||
} | ||
return false; | ||
} | ||
|
||
/* | ||
* Get the location for swaymsg or i3-msg as per the current session type | ||
*/ | ||
public static string? get_wm_cli(string wm_name) { | ||
if (wm_name == "i3") { | ||
return "/usr/bin/i3-msg "; | ||
} else if (wm_name == "sway") { | ||
return "/usr/bin/swaymsg "; | ||
} | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.