Skip to content
This repository has been archived by the owner on Jan 3, 2023. It is now read-only.

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
jibedoubleve committed Apr 6, 2020
2 parents aa8466b + ec7d1f3 commit 6cd0880
Show file tree
Hide file tree
Showing 156 changed files with 5,153 additions and 414 deletions.
2 changes: 1 addition & 1 deletion GitVersion.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
assembly-versioning-scheme: MajorMinorPatchTag
next-version: 0.4.1
next-version: 0.5.0
branches:
master:
mode: ContinuousDeployment
Expand Down
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Lanceur
This is a fork of Slickrun in .NET
This is a free adaptation of Slickrun written in .NET and inspired by Wox

# What does it do

Make a list of shortcuts, configure them and earn a lot of time by just tying the shortcut and press `ENTER`

![img](.\doc\assets\lanceur.png)

# Aknowlegment
* [Application icon](https://fr.seaicons.com/le-lanceur-icone-2)
* [SlickRun](https://bayden.com/SlickRun/) inspired me to build this application
* [Wox](https://github.com/Wox-launcher/Wox) inspired me some features
Binary file added doc/assets/Lanceur.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 40 additions & 0 deletions scripts/deploy_plugins.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<#############################################################################
# VARIABLES
#############################################################################>
$release = "Debug"
$src = "$env:GIT_PRJ_SOURCE\lanceur\src\Plugins\Probel.Lanceur.Plugin.{0}\bin\$release\*.*"
$dst = "$env:APPDATA\probel\lanceur\plugins\{0}"
$plugins = "spotify", "calculator"

<#############################################################################
# FUNCTIONS
#############################################################################>
function Write-Debug($msg) {
Write-Host $msg -ForegroundColor Green
}
function Write-Info($msg) {
Write-Host $msg -ForegroundColor Yellow
}

<#############################################################################
# MAIN
#############################################################################>

foreach ($p in $plugins) {
Write-Info "Copying files for plugin '$p'..."
$s = $src -f $p
$d = $dst -f $p
Write-Debug "Source for $plugin : $s"
Write-Debug "Destination for $plugin : $d"
Write-Host "-------------------------------------"

$file_exists = Test-Path $d
if ($file_exists -eq $false) {
Write-Info "Creating directory '$d'"
mkdir $d
}

Copy-Item $s $d -Recurse
}


14 changes: 0 additions & 14 deletions sql/scripts/update-0.1.sql
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,3 @@ create table settings (

insert into settings (s_key, s_value) values ('db_version','0.1');

/*
* Fix history issue in the view
*/
drop view if exists stat_history;
create view stat_history as
select
s.id as id_keyword,
group_concat(sn.name, ', ') as keywords,
su.time_stamp as time_stamp
from
alias_usage su
inner join alias s on su.id_alias = s.id
inner join alias_name sn on s.id = sn.id_alias
group by su.time_stamp;
23 changes: 23 additions & 0 deletions sql/scripts/update-0.2.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
--- DATA RECONCILIATION
-------------------------------------------------------------------------------
update alias set arguments = null where arguments = '';
update alias set notes = null where notes = '';
update alias set working_dir = null where working_dir = '';

drop view if exists data_doubloons;
drop view if exists stat_history;
drop view if exists stat_execution_count;

-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
--- TRIGGERS
-------------------------------------------------------------------------------
drop trigger if exists on_alias_update;
create trigger on_alias_update update on alias
begin
update alias set arguments = null where arguments = '' and id = old.id;
update alias set notes = null where notes = '' and id = old.id;
update alias set working_dir = null where working_dir = '' and id = old.id;
end;
Empty file added sql/scripts/update-0.3.sql
Empty file.
57 changes: 57 additions & 0 deletions sql/scripts/views/views-data.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
-------------------------------------------------------------------------------
/*
* View with all the unused keywords
*/
drop view if exists data_not_used_v;
create view data_not_used_v as
select
a.id,
group_concat(sn.name, ', ') as keywords,
a.file_name,
a.arguments,
a.run_as,
a.working_dir
from
alias a
inner join alias_name sn on a.id = sn.id_alias
left join stat_execution_count_v s on a.id = s.id_keyword
where
s.exec_count is null
or s.exec_count = 0
group by a.id;
-------------------------------------------------------------------------------
/*
* Displays all the doubloons
*/
drop view if exists data_doubloons_v;
create view data_doubloons_v as
select
a.id,
group_concat(sn.name, ', ') as keywords,
a.file_name,
a.arguments,
a.run_as,
a.working_dir
from
alias a
inner join alias_name sn on a.id = sn.id_alias
left join (
select
a.file_name,
a.arguments,
a.run_as,
a.working_dir
from
alias a
group by
a.file_name,
a.arguments,
a.run_as,
a.working_dir
having
count(a.id) >= 2
) t on a.file_name = t.file_name
where
t.file_name is not null
group by a.id
order by a.file_name;
47 changes: 47 additions & 0 deletions sql/scripts/views/views-helpers.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Helper view to list all the hours in the day.
* This view is used amongnst other in
* 'stat_usage_per_hour_in_day_v'
*/
drop view if exists helper_hour_in_day;
create view helper_hour_in_day as
select 0 as exec_count, '00:00' as hour_in_day
union select 0 as exec_count, '01:00' as hour_in_day
union select 0 as exec_count, '02:00' as hour_in_day
union select 0 as exec_count, '03:00' as hour_in_day
union select 0 as exec_count, '04:00' as hour_in_day
union select 0 as exec_count, '05:00' as hour_in_day
union select 0 as exec_count, '06:00' as hour_in_day
union select 0 as exec_count, '07:00' as hour_in_day
union select 0 as exec_count, '08:00' as hour_in_day
union select 0 as exec_count, '09:00' as hour_in_day
union select 0 as exec_count, '10:00' as hour_in_day
union select 0 as exec_count, '11:00' as hour_in_day
union select 0 as exec_count, '12:00' as hour_in_day
union select 0 as exec_count, '13:00' as hour_in_day
union select 0 as exec_count, '14:00' as hour_in_day
union select 0 as exec_count, '15:00' as hour_in_day
union select 0 as exec_count, '16:00' as hour_in_day
union select 0 as exec_count, '17:00' as hour_in_day
union select 0 as exec_count, '18:00' as hour_in_day
union select 0 as exec_count, '19:00' as hour_in_day
union select 0 as exec_count, '20:00' as hour_in_day
union select 0 as exec_count, '21:00' as hour_in_day
union select 0 as exec_count, '22:00' as hour_in_day
union select 0 as exec_count, '23:00' as hour_in_day
order by hour_in_day;
/*
* Helper view to list all the days in the week.
* This view is used amongnst other in
* 'stat_usage_per_hour_in_day_v'
*/
drop view if exists helper_day_in_week;
create view helper_day_in_week as
select 0 as exec_count, 'Sunday' as day_name, 7 as day_of_week
union select 0 as exec_count, 'Monday' as day_name, 1 as day_of_week
union select 0 as exec_count, 'Tuesday' as day_name, 2 as day_of_week
union select 0 as exec_count, 'Wednesday' as day_name, 3 as day_of_week
union select 0 as exec_count, 'Thursday' as day_name, 4 as day_of_week
union select 0 as exec_count, 'Friday' as day_name, 5 as day_of_week
union select 0 as exec_count, 'Saterday' as day_name, 6 as day_of_week
order by day_of_week;
129 changes: 129 additions & 0 deletions sql/scripts/views/views-stat.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@


/*
* View with the count of execution by keyword
*/
drop view if exists stat_execution_count_v;
create view stat_execution_count_v as
select
id_keyword as id_keyword,
count(*) as exec_count,
keywords as keywords
from
stat_history_v sh
group by
id_keyword
order by exec_count desc;
-------------------------------------------------------------------------------
/*
* Fix history issue in the view
*/
drop view if exists stat_history_v;
create view stat_history_v as
select
s.id as id_keyword,
group_concat(sn.name, ', ') as keywords,
su.time_stamp as time_stamp
from
alias_usage su
inner join alias s on su.id_alias = s.id
inner join alias_name sn on s.id = sn.id_alias
group by su.time_stamp;
-------------------------------------------------------------------------------
/*
* Show usage per day/month/year
*/
drop view if exists stat_usage_per_day_v;
create view stat_usage_per_day_v as
select
count(*) as exec_count,
strftime('%Y-%m-%d', time_stamp) as day
from
alias_usage
where
strftime('%Y-%m-%d', time_stamp) < strftime('%Y-%m-01', date())
group by
strftime('%Y-%m-%d', time_stamp)
order by
time_stamp;
-------------------------------------------------------------------------------
/*
* Show usage per month/year
*/
drop view if exists stat_usage_per_month_v;
create view stat_usage_per_month_v as
select
count(*) as exec_count,
strftime('%Y-%m-01', time_stamp) as month
from
alias_usage
where
strftime('%Y-%m-%d', time_stamp) < strftime('%Y-%m-01', date())
group by
strftime('%Y-%m-01', time_stamp)
order by
time_stamp;
-------------------------------------------------------------------------------
/*
* Show usage per day of week
*/
drop view if exists stat_usage_per_day_of_week_v;
create view stat_usage_per_day_of_week_v as
select
sum(exec_count),
day_of_week,
day_name
from (
select *
from (
select
count(*) as exec_count,
case cast(strftime('%w', time_stamp) as integer)
when 0 then 7
else cast(strftime('%w', time_stamp) as integer)
end as day_of_week,
case cast(strftime('%w', time_stamp) as integer)
when 0 then 'Sunday'
when 1 then 'Monday'
when 2 then 'Tuesday'
when 3 then 'Wednesday'
when 4 then 'Thursday'
when 5 then 'Friday'
when 6 then 'Saterday'
else 'error'
end as day_name
from
alias_usage
group by
strftime('%w', time_stamp)
)
union all
select exec_count, day_of_week, day_name from helper_day_in_week
)
group by day_of_week
order by day_of_week;
-------------------------------------------------------------------------------
/*
* Show history per hour in day
*/
drop view if exists stat_usage_per_hour_in_day_v;
create view stat_usage_per_hour_in_day_v as
select
sum(exec_count) as exec_count,
hour_in_day as hour_in_day
from (
select *
from (
select
count(*) as exec_count,
strftime('%H:00', time_stamp) as hour_in_day
from
alias_usage
where
strftime('%Y-%m-%d', time_stamp) < strftime('%Y-%m-01', date())
group by strftime('%H:00', time_stamp)
)
union all select * from helper_hour_in_day
)
group by hour_in_day
order by hour_in_day
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
using System.Windows;
using System.Windows.Controls;

namespace Probel.Lanceur.Plugin.Calculator
{
public static class FocusOnLastBehavior
{
#region Fields

public static readonly DependencyProperty FocusProperty =
DependencyProperty.RegisterAttached(
"Focus",
typeof(bool),
typeof(FocusOnLastBehavior),
new UIPropertyMetadata(false, OnElementFocused));

#endregion Fields

#region Methods

public static bool GetFocus(DependencyObject element) => (bool)element.GetValue(FocusProperty);

public static void SetFocus(DependencyObject element, bool value) => element.SetValue(FocusProperty, value);

private static void OnElementFocused(
DependencyObject depObj, DependencyPropertyChangedEventArgs e)
{
var element = depObj as FrameworkElement;
if (element == null) { return; }

element.Focus();
}
//static void OnElementFocused(DependencyObject depObj, DependencyPropertyChangedEventArgs e)
//{
// ItemsControl itemsControl = depObj as ItemsControl;
// if (itemsControl == null) { return; }
// itemsControl.
// itemsControl.Loaded += (object sender, RoutedEventArgs args) =>
// {
// // get the content presented for the first listbox element
// var contentPresenter = (ContentPresenter)itemsControl.ItemContainerGenerator.ContainerFromIndex(0);

// // get the textbox and give it focus
// var textbox = contentPresenter.ContentTemplate.FindName("myTextBox", contentPresenter) as TextBox;
// textbox.Focus();
// };
//}

#endregion Methods
}
}
Loading

0 comments on commit 6cd0880

Please sign in to comment.