Bug 397326 - Automatically reassign hotkeys after a task item was moved/removed
Summary: Automatically reassign hotkeys after a task item was moved/removed
Status: RESOLVED INTENTIONAL
Alias: None
Product: lattedock
Classification: Plasma
Component: application (show other bugs)
Version: git (master)
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Michail Vourlakos
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-08-10 04:06 UTC by trmdi
Modified: 2018-08-20 13:33 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description trmdi 2018-08-10 04:06:22 UTC
Item:     i1-i2-i3-i4-i5
Shortcut: k1-k2-k3-k4-k5

###

After swapped (i2,i3):
---
Item:     i1-i3-i2-i4-i5
Shortcut: k1-k2-k3-k4-k5  (no change)

Expected: k1-k3-k2-k4-k5 (if: k2 != default_shortcut_for_item_#2 || k3 != default_shortcut_for_item#3 -> swap the shortcuts)

###

After removed i2:
---
Item:     i1-i3-i4-i5
Shortcut: k1-k2-k3-k4-k5 (no change)

Expected: k1-k3-k4-k5

How to correct the shortcuts?
---
Item:     i1-j2-i3-i4-i5 (j2 is an imagined item at #2)
Shortcut: k1-k2-k3-k4-k5 (k2 is the default shortcut for the item #2)

-> continuously swap (j2,i3) -> (j2,i4) -> (j2,i5) (in mem)
Item:     i1-i3-i4-i5-j2
Shortcut: k1-k3-k4-k5-k6


# This could be not the fastest algorithm, but at least there is one way to solved the problem. :D
Comment 1 trmdi 2018-08-10 10:55:10 UTC
I thinks this one is better:
---------------------------------



n          1  2  3  4  5  6  7

Item0:    i1 i2 i3 i4 i5 i6 i7
Key0 :    k1 k2 k3 k4 k5 k6 k7


### Move i2 to n=5
Item1:    i1 i3 i4 i5 i2 i6 i7
Key1 :    k1  -  -  -  - k6 k7

How to correct the shortcuts?
---
for (i in [i3-i4-i5-i2]):
  if (i->key0 == default_key) then: i->key1 == default_key_at-new-position
                              else: i->key1 == i->key0


### Remove i2 = Move i2 to the end + delete i2
Item1:    i1 i3 i4 i5 i6 i7 i2
Key1 :    k1  -  -  -  -  - -
-> Use the above function to correct the shortcuts
-> restore the default shortcut at position n=7
Comment 2 Michail Vourlakos 2018-08-20 13:33:28 UTC
sorry I dont like the idea:

1. it would add complexity for only a small portion of users
2. the "activate entry" 's of Latte is just that, are not assigned based on the applet but rather on the position so that would break the logic of the implementation
3. the users that want to fix this they can from their plasma systemsettings