This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Timer as KWin effect

Tags: None
(comma "," separated)
VeraS
Registered Member
Posts
11
Karma
0

Timer as KWin effect

Wed Jun 11, 2014 11:52 am
hi guys,

how difficult would it be to implement a timer/countdown effect for KWin? Ideally it would work like the BeClock, but instead of showing the clock it would show a timer.

I have no programming skills in C++/Qt but I'd like to learn if it's not too complicated.

Is this feasible? Where should I look first to learn what I need?
User avatar
Hans
Administrator
Posts
3304
Karma
24
OS

Re: Timer as KWin effect

Wed Jun 11, 2014 4:25 pm
Doesn't sound like it would be too complicated, I would start looking at the source of BeClock. I also recommend learning the fundamentals of C++ and a bit of Qt. I blogged about my experience learning C++/Qt here. It's a bit out-of-date, but may serve as a motivation. You can also have a look at the KDE developer guide.

Finally, if you just want something that works, you can try this runner which allows you to use BeClock as a timer.


Problem solved? Please click on "Accept this answer" below the post with the best answer to mark your topic as solved.

10 things you might want to do in KDE | Open menu with Super key | Mouse shortcuts
luebking
Karma
0

Re: Timer as KWin effect  Topic is solved

Wed Jun 11, 2014 7:12 pm
actually all you need is
Code: Select all
qdbus org.kde.kwin /BeClock countdown [[h] m] s


beclock has a countdown feature accessible via dbus - all you require is some interface to trigger it.
qdbus is a cli dbus tool - you could also combine that with kdialog (so all you need is a bas script) or do whatever else you know =)
VeraS
Registered Member
Posts
11
Karma
0

Re: Timer as KWin effect

Wed Jun 11, 2014 10:55 pm
amazing stuff :D

Hans wrote:Doesn't sound like it would be too complicated.


Thanks, I'll follow your advices anyway since I'd like to learn a bit of c++/qt sooner or later :)
VeraS
Registered Member
Posts
11
Karma
0

Re: Timer as KWin effect

Wed Jun 11, 2014 10:57 pm
luebking wrote:actually all you need is
Code: Select all
qdbus org.kde.kwin /BeClock countdown [[h] m] s


beclock has a countdown feature accessible via dbus - all you require is some interface to trigger it.


by the way, where should I look for a list of magic stuff doable via the dbus interface?

More specifically, is it possible to show/hide the clock via dbus? Something like:

Code: Select all
qdbus org.kde.kwin /BeClock show
User avatar
Hans
Administrator
Posts
3304
Karma
24
OS

Re: Timer as KWin effect

Wed Jun 11, 2014 11:24 pm
VeraS wrote:by the way, where should I look for a list of magic stuff doable via the dbus interface?


You could try the application qdbusviewer.


Problem solved? Please click on "Accept this answer" below the post with the best answer to mark your topic as solved.

10 things you might want to do in KDE | Open menu with Super key | Mouse shortcuts
VeraS
Registered Member
Posts
11
Karma
0

Re: Timer as KWin effect

Thu Jun 12, 2014 6:12 am
Thanks! Found it:

Code: Select all
qdbus org.kde.kwin /Effects toggleEffect kwin4_effect_beclock


While we're here, there is a typo in BeClock KCM, the "Advanced" is called "Andvanced"
luebking
Karma
0

Re: Timer as KWin effect

Thu Jun 12, 2014 6:18 am
nope - not atm.
you can however invoke the toggling shortcut
Code: Select all
qdbus org.kde.kglobalaccel /component/kwin invokeShortcut BeClock

or (if that is what you want) cycle show/hides
Code: Select all
qdbus org.kde.kwin /BeClock getAttention 5


You can also make kwin un/load the effect at runtime (eg. if you only want it during the countdown)
Code: Select all
qdbus org.kde.kwin /Effects loadEffect kwin4_effect_beclock
qdbus org.kde.kwin /BeClock countdown 30
sleep 35 # wait for countdown & finish animation
qdbus org.kde.kglobalaccel /component/kwin invokeShortcut BeClock # fade out
sleep 1 # wait for fade out
qdbus org.kde.kwin /Effects unloadEffect kwin4_effect_beclock # unload effect



"qdbus org.kde.kwin /Effects toggleEffect kwin4_effect_beclock" will toggle the un/load status of the effect

About the typo. One? Thousands (I'm really good at that ;-)


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Evergrowing, Google [Bot], q.ignora, watchstar