OS hacking: Taking PNG screenshots in SerenityOS

แชร์
ฝัง
  • เผยแพร่เมื่อ 17 ธ.ค. 2024

ความคิดเห็น • 93

  • @sharoyveduchi
    @sharoyveduchi 3 ปีที่แล้ว +67

    To be truly "open" source means making all privates public :^)

    • @sharoyveduchi
      @sharoyveduchi 3 ปีที่แล้ว +5

      @@kreuner11 go to 8:36. I'm joking about public vs private variables

  • @Jordan-no6wh
    @Jordan-no6wh 3 ปีที่แล้ว +22

    8:40 gave me a good chuckle lol
    Great video as always, its a pleasure watching you work away like this. Hoping one day Ill be good enough to contribute to the serenityOS community :)

    • @yeppiidev
      @yeppiidev 6 หลายเดือนก่อน

      🤣🤣🤣

  • @Extys
    @Extys 3 ปีที่แล้ว +42

    Your debug logs: "It's empty, so let's make a nice one" my debug logs: "goes there 4"

    • @supervesp
      @supervesp 3 ปีที่แล้ว +5

      here.. hereee.. XXXXX... here again...

    • @zackh5413
      @zackh5413 3 ปีที่แล้ว +14

      "fuck" "fuck1" "fuck23222222"

    • @brandonstevens6886
      @brandonstevens6886 3 ปีที่แล้ว +1

      mine are: s, ss, and sss

    • @Quaker763
      @Quaker763 3 ปีที่แล้ว +3

      Lol you should see mine in my Serenity USB branch :P I accidentally let "FUCKING FUCK FUCK" slip into PR (which got merged) HAHAHAA

    • @kattihatt
      @kattihatt 3 ปีที่แล้ว

      @@Quaker763 lol

  • @lepsycho3691
    @lepsycho3691 3 ปีที่แล้ว +1

    I am really impressed! Writing a screenshot program in 14 minutes, just blows my mind! Good job!

  • @sabamacx
    @sabamacx 3 ปีที่แล้ว +14

    It would be neat if the screenshot png had metadata embedded, like OS compositor version/ref and time and stuff :)

  •  3 ปีที่แล้ว +2

    This came just in time. I've been having problems with gnome-screenshot using the x11 fallback. Devs practically told me that the fallback is unmantained. In the future I'll try to build one myself ;) Thanks for the amazing content

  • @xavierthomas1980
    @xavierthomas1980 3 ปีที่แล้ว +6

    10:25 I suppose returning a const bitmap would also convey the idea that the returned bitmap should not be mutated. Also I think the webserver is listening to 8000 on the guest but you actually need to connect to the port QEMU is listening to on the host.

  • @xgriff91
    @xgriff91 3 ปีที่แล้ว +2

    I'm currently watching all your videos, they are really interesting, never stop uploading you are teaching a lot to everyone !

    • @awesomekling
      @awesomekling  3 ปีที่แล้ว

      I’m glad to hear you like them, thank you for telling me! :)

    • @chrispence8352
      @chrispence8352 2 ปีที่แล้ว

      How did you update the start menu inside serenity os

  • @forgottenmohawks8734
    @forgottenmohawks8734 3 ปีที่แล้ว +11

    Andreas now that you are on the topic of screenshots I want to share a thought that I have been thinking about for a long while, and I think SerenityOS would be in a good position to do this. Namely, instead of saving only a rasterized screenshot do also offer the possibility of dumping the raw data that described what was on screen. Not sure I formulate myself well here but what I mean then is that all strings on screen, all geometric shapes, etc, would be persisted to a file. And then you can later either rasterize it and show it but you can also do things like know what programs are on screen and what text is on screen etc. So then when I take a tonne of screenshots as I do, I could filter by which programs are open, or search by strings that were on screen. This should apply even to the browser showing a website. So if I search for ycombinator in the string data and filtered to show only files that has the browser on screen then I can see all of the “screenshots” I have taken with this system of stuff on HN. Likewise let’s say that some day Spotify runs on SerenityOS, then I could filter my screenshots to only those where Spotify is in focus, in order to find the songs that I screenshoted. And I could even export to SVG in order to view it on other systems and retaining some of the search ability on other systems. I think about this often. I take a lot of screenshots on my phone and really wish my phone worked this way. Maybe one day. I hope.

    • @matheusd.rodrigues429
      @matheusd.rodrigues429 3 ปีที่แล้ว +1

      Samsung phones save the url if you take screenshots on browsers, but that's it (and google images categorize them by face, which is both awesome and scary at the same time, how does it knows my friends face?)

    • @willest5719
      @willest5719 3 ปีที่แล้ว

      Could probably make a third-party app that does this. Only issue I see would be the app pledging access to almost everything running on screen.

  • @konstantingeist3587
    @konstantingeist3587 2 ปีที่แล้ว +1

    It's interesting to go back and see what's changed after 1 year. For example, the weird PNGWriter::write was changed to ::encode

  • @cxboog
    @cxboog 3 ปีที่แล้ว +10

    fwiw ArgsParser does allow you to define fallback values (it won't touch the initial value if the argument is missing).
    Also, `ws` not working is a documented TCP stack bug :P

  • @akj7
    @akj7 3 ปีที่แล้ว

    Really fun watching you program.
    Some notices:
    1. Reload CMake from CLion to remove that anoying: "CMake can't find file"or sonething at the top of the new CPP file.
    2. Build from CLion. Simply use the build shortcut.
    3. Remote debugging from CLion with breakpoints.
    4. CRTL+P in a function parentheses to show the list of arguments or CRTL+Q on function name to see help.
    5. Vim Extension for CLion.

  • @flightvision
    @flightvision 3 ปีที่แล้ว +2

    I will probably never build anything that grabs the whole screen. But I am interested to see how this stuff works :) Also your advices like "let's not confuse ourselves with features now" are so golden.

  • @JP-pm1fe
    @JP-pm1fe 3 ปีที่แล้ว +10

    I would add a delay so that you can minimize the CLI before taking the screenshot

    • @awesomekling
      @awesomekling  3 ปีที่แล้ว +15

      sleep 5; shot

    • @JP-pm1fe
      @JP-pm1fe 3 ปีที่แล้ว +7

      That's so obvious. Why didn't I think if this? :D

    • @sdwvit
      @sdwvit 3 ปีที่แล้ว

      Make this an option pls :)

  • @TheSn0ringOne
    @TheSn0ringOne 3 ปีที่แล้ว +1

    Great video! Here are some feature ideas:
    * Implement a global key binding to trigger shot
    * Support selecting just part of the screen and/or a single window
    * Copy result to clipboard

    • @meep.472
      @meep.472 2 ปีที่แล้ว

      screenshotting individual windows or a selected area?

  • @sirdiealot7805
    @sirdiealot7805 3 ปีที่แล้ว +1

    The screenshot utility is probably the best part of the OSX UI, so a sensible thing to eventually copy.

  • @pawanyr360
    @pawanyr360 3 ปีที่แล้ว +5

    I love the new Start Menu! Looks very Win 2K-esque . . .

  • @shantanugadgil
    @shantanugadgil 3 ปีที่แล้ว

    This has been quite a fun video to watch. 😎 👍👍👍. A startup delay would have be nice for the screenshot program. This should be a good start point for anyone interested in adding a new utility to Serenity OS.

    • @awesomekling
      @awesomekling  3 ปีที่แล้ว

      "sleep 5; shot" if you need a delay :^)

    • @shantanugadgil
      @shantanugadgil 3 ปีที่แล้ว

      @@awesomekling :facepalm: yes why didn't I think of that.

  • @user-kr1nj3bu7c
    @user-kr1nj3bu7c 3 ปีที่แล้ว +15

    Since when does Serenity have that Start-like menu and lost the top bar? Is it a new theme?

    • @NateLevin
      @NateLevin 3 ปีที่แล้ว +11

      Yeah, I liked the top bar a lot. Start menu is a welcome addition though!

    • @awesomekling
      @awesomekling  3 ปีที่แล้ว +16

      Since 2 days ago. It's not a new theme, it's an evolution of the old theme :)

  • @anicsr
    @anicsr 3 ปีที่แล้ว +1

    Really big changes today. Exciting! 😁

  • @samuelschwager
    @samuelschwager 3 ปีที่แล้ว +7

    Wow, worked at 1st try. Very impressive.

    • @awesomekling
      @awesomekling  3 ปีที่แล้ว +1

      Love it when that happens! :^)

  • @antoniocs8873
    @antoniocs8873 3 ปีที่แล้ว +6

    23:56 - I mentally screamed this a few times :D

  • @紺野-純子
    @紺野-純子 3 ปีที่แล้ว +5

    I actually understand what he's doing HOW

  • @TheOPtmal
    @TheOPtmal 3 ปีที่แล้ว +2

    Now the next steps: Save the images in the Pictures folder by default instead of just Home, and bind it to PrintScreen by default.

  • @elfamosokilluah3072
    @elfamosokilluah3072 3 ปีที่แล้ว +7

    Your code looks like a weird melting pot with C and C++ but I just find it so nice to read

  • @transpiler
    @transpiler 3 ปีที่แล้ว +24

    This is like watching a speedrun

    •  3 ปีที่แล้ว +8

      I agree. There's something about watching people perform a task extremely competently that makes it so enjoyable.

  • @BrookeSpeaks
    @BrookeSpeaks 3 ปีที่แล้ว

    wow. Badge is such a clever thing!!

    • @stewartzayat7526
      @stewartzayat7526 3 ปีที่แล้ว

      it is. I don't think I've really seen the concept of a badge in c++ before this.

  • @TheKittko
    @TheKittko 3 ปีที่แล้ว

    13:00 "worked on the first try :^)" that feeling doe, after only 13mins. beast mode.

  • @p20ph37
    @p20ph37 3 ปีที่แล้ว

    This is way better than Bob Ross reruns.

  • @Swirlstudios
    @Swirlstudios 3 ปีที่แล้ว

    Love the wallpaper. What an amazing game.

  • @firmman4505
    @firmman4505 3 ปีที่แล้ว +3

    Why not try make a screen record feature and buy a machine purely to run serenity OS and develop from the OS?

    • @vladk5694
      @vladk5694 3 ปีที่แล้ว

      Isn't a screen recorder just a lot of screenshots?

    • @inalone
      @inalone 3 ปีที่แล้ว

      I think that's the end goal

  • @winfr34k
    @winfr34k 3 ปีที่แล้ว +1

    Wouldn't it be a lot safer to just return an immutable copy of the current bitmap instead of just allowing direct access? Especially if your intention is to not be modifyable, maybe it's better just not allow it in the first place.

  • @__JaviC
    @__JaviC 3 ปีที่แล้ว +1

    But if you are trying to screenshot something and you need to use the command line, doesn't that make the command line the only thing screenshotable? like it will always be on top right?

    • @nea89o
      @nea89o 3 ปีที่แล้ว

      You could add a macro/keybind i guess.

    • @mikeziri
      @mikeziri 3 ปีที่แล้ว

      2 comments up: sleep 5; shot
      although with a gui app this will probably be an option

  • @melinazhang6007
    @melinazhang6007 3 ปีที่แล้ว

    What command is 'gap' that you used to query your git diffs and stage them?

    • @awesomekling
      @awesomekling  3 ปีที่แล้ว

      It’s an alias for “git add -p” :)

  • @dirkus3722
    @dirkus3722 3 ปีที่แล้ว +1

    Enjoyed your video. Thanks!

  • @sam-pd7su
    @sam-pd7su 3 ปีที่แล้ว

    Sorry for the stupid question but what is your base distro?

  • @justaguy5367
    @justaguy5367 3 ปีที่แล้ว +1

    Man , this is way more better than netflix , and guess what? it's free

  • @kattihatt
    @kattihatt 3 ปีที่แล้ว

    I havent worked with open source or github. What is required to contribute? Creat a branch plus PR, and hope that you merge my changes?

  • @shaadaab1
    @shaadaab1 3 ปีที่แล้ว

    This man is a genius . Its amazing how fast he thinks and puts it into code. Whats his education or experience?

  • @bogdanpashchenko2142
    @bogdanpashchenko2142 3 ปีที่แล้ว

    I wonder whether Andreas plans to move to serenity as a host / main system in the nearest time 🤔

  • @nonefvnfvnjnjnjevjenjvonej3384
    @nonefvnfvnjnjnjevjenjvonej3384 3 ปีที่แล้ว

    What font do you use in CLion?

    • @awesomekling
      @awesomekling  3 ปีที่แล้ว

      It's the built-in font called JetBrains Mono :)
      You can get it here: www.jetbrains.com/lp/mono/

    • @nonefvnfvnjnjnjevjenjvonej3384
      @nonefvnfvnjnjnjevjenjvonej3384 3 ปีที่แล้ว +1

      @@awesomekling thank you. Also you are amazing. I learn so much from you.

  • @markozagar
    @markozagar 3 ปีที่แล้ว

    Personally I wouldn't return a pointer to Compositor's internal state. Wouldn't it be a lot safer to have Compositor make a copy of its front buffer and hand that off? That's extra overhead for making a copy, but unless you're planning to use this function to stream the desktop or record it, shouldn't be that big of a hit...

  • @mikeziri
    @mikeziri 3 ปีที่แล้ว +1

    ready to implement a vnc server ;)

  • @ffkkinos
    @ffkkinos 3 ปีที่แล้ว

    suggestion: a simple GUI for the screenshot utility, something like gnome-screenshot would be nice!

  • @tommytomtomtomestini3894
    @tommytomtomtomestini3894 3 ปีที่แล้ว +1

    To show "the thing" press Ctrl+P :-)

    • @nea89o
      @nea89o 3 ปีที่แล้ว

      the argument list, but yes

  • @justanormalperson
    @justanormalperson 3 ปีที่แล้ว +5

    nice :D

  • @ifross
    @ifross 3 ปีที่แล้ว

    Noticed that the image viewer in your host OS said that the png file size was 3.1mb which is suspiciously similar to the size a 1024x768x4 bitmap would consume.
    Your screenshot looks like rle should do a good job (no gradients etc) so you might want to check your png implementation?

    • @transpiler
      @transpiler 3 ปีที่แล้ว

      Commit #5037 shows that the PNG implementation is indeed a simple naive implementation that basically only adds alpha transparency to bitmaps.

    • @ifross
      @ifross 3 ปีที่แล้ว

      @@transpiler TIL, thanks for the info I didn't know png had an uncompressed mode, my bad.

  • @garcez9472
    @garcez9472 3 ปีที่แล้ว +1

    The real question is: What are you drinking?

    • @yrath5034
      @yrath5034 3 ปีที่แล้ว +1

      Definitely a soft drink.

    • @awesomekling
      @awesomekling  3 ปีที่แล้ว +2

      Twinings Earl Grey tea :)

  • @ethanedwards1841
    @ethanedwards1841 3 ปีที่แล้ว +2

    I have just started work on my OS, watching this video made feel a bit out of my capabilities

    • @awesomekling
      @awesomekling  3 ปีที่แล้ว +6

      Don’t worry, I’ve been doing this for a long time. Just keep at it and enjoy the process. Your skills will grow faster than you think :)

  • @notnow4068
    @notnow4068 3 ปีที่แล้ว +4

    Hi maan

  • @shantanugadgil
    @shantanugadgil 3 ปีที่แล้ว

    08:39 lol lol lol